aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
commite252b51ccde010cbd2a146485d8045103cd99533 (patch)
treee060f101cdc32bf5e520de8e5275db9d4236b74c /gcc/testsuite
parentf10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff)
parent104c05c5284b7822d770ee51a7d91946c7e56d50 (diff)
downloadgcc-e252b51ccde010cbd2a146485d8045103cd99533.zip
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog9809
-rw-r--r--gcc/testsuite/brig.dg/README12
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/alloca.hsail37
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/atomics.hsail33
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/branches.hsail58
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail74
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/function_calls.hsail59
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail146
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/kernarg.hsail25
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/mem.hsail39
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/mulhi.hsail33
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/packed.hsail76
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail87
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail91
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/variables.hsail125
-rw-r--r--gcc/testsuite/brig.dg/test/gimple/vector.hsail57
-rw-r--r--gcc/testsuite/c-c++-common/Walloca-larger-than.C21
-rw-r--r--gcc/testsuite/c-c++-common/Warray-bounds-10.c114
-rw-r--r--gcc/testsuite/c-c++-common/Warray-bounds-3.c4
-rw-r--r--gcc/testsuite/c-c++-common/Warray-bounds-4.c12
-rw-r--r--gcc/testsuite/c-c++-common/Warray-bounds-9.c144
-rw-r--r--gcc/testsuite/c-c++-common/Wattributes.c36
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c16
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c4
-rw-r--r--gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c4
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-16.c4
-rw-r--r--gcc/testsuite/c-c++-common/attr-nonstring-3.c4
-rw-r--r--gcc/testsuite/c-c++-common/attr-retain-10.c11
-rw-r--r--gcc/testsuite/c-c++-common/attr-retain-11.c11
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-1.c41
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-10.c22
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-11.c14
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-12.c14
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-13.c23
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-14.c23
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-15.c13
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-16.c13
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-2.c41
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-3.c19
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-4.c19
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-5.c21
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-6.c21
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-7.c35
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-8.c35
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-9.c20
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-esra.c35
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-padding-1.c23
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-padding-2.c114
-rw-r--r--gcc/testsuite/c-c++-common/auto-init-padding-3.c114
-rw-r--r--gcc/testsuite/c-c++-common/builtin-shufflevector-2.c18
-rw-r--r--gcc/testsuite/c-c++-common/cpp/file-name-1.c22
-rw-r--r--gcc/testsuite/c-c++-common/cpp/va-opt-3.c8
-rw-r--r--gcc/testsuite/c-c++-common/cpp/va-opt-5.c67
-rw-r--r--gcc/testsuite/c-c++-common/cpp/va-opt-6.c17
-rw-r--r--gcc/testsuite/c-c++-common/cpp/va-opt-7.c101
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c20
-rw-r--r--gcc/testsuite/c-c++-common/dump-ada-spec-14.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc-gomp/atomic.c3
-rw-r--r--gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c14
-rw-r--r--gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/acc-icf.c7
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c11
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-kernels.c11
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-parallel.c11
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-routine-nohost.c41
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-routine.c19
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-serial.c16
-rw-r--r--gcc/testsuite/c-c++-common/goacc/collapse-2.c56
-rw-r--r--gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c124
-rw-r--r--gcc/testsuite/c-c++-common/goacc/finalize-1.c12
-rw-r--r--gcc/testsuite/c-c++-common/goacc/if-clause-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c5
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/mdc-1.c19
-rw-r--r--gcc/testsuite/c-c++-common/goacc/mdc-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c8
-rw-r--r--gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c7
-rw-r--r--gcc/testsuite/c-c++-common/goacc/parallel-reduction.c4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/pr70688.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/private-reduction-1.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c93
-rw-r--r--gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c88
-rw-r--r--gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c93
-rw-r--r--gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c91
-rw-r--r--gcc/testsuite/c-c++-common/goacc/routine-1.c8
-rw-r--r--gcc/testsuite/c-c++-common/goacc/routine-2.c4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/routine-nohost-1.c50
-rw-r--r--gcc/testsuite/c-c++-common/goacc/routine-nohost-2.c96
-rw-r--r--gcc/testsuite/c-c++-common/goacc/struct-enter-exit-data-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c9
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-1.c24
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-2.c232
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-3.c77
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-4.c103
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-5.c32
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-6.c36
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-7.c37
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-17.c10
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-18.c24
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-21.c3
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-24.c12
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-25.c50
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-26.c63
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-27.c41
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-28.c43
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-29.c43
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-30.c137
-rw-r--r--gcc/testsuite/c-c++-common/gomp/attrs-1.c146
-rw-r--r--gcc/testsuite/c-c++-common/gomp/attrs-2.c146
-rw-r--r--gcc/testsuite/c-c++-common/gomp/attrs-3.c74
-rw-r--r--gcc/testsuite/c-c++-common/gomp/cancel-1.c22
-rw-r--r--gcc/testsuite/c-c++-common/gomp/clause-dups-1.c5
-rw-r--r--gcc/testsuite/c-c++-common/gomp/clauses-1.c82
-rw-r--r--gcc/testsuite/c-c++-common/gomp/clauses-5.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/error-1.c45
-rw-r--r--gcc/testsuite/c-c++-common/gomp/error-2.c24
-rw-r--r--gcc/testsuite/c-c++-common/gomp/error-3.c70
-rw-r--r--gcc/testsuite/c-c++-common/gomp/flush-1.c9
-rw-r--r--gcc/testsuite/c-c++-common/gomp/flush-2.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/loop-1.c18
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-6.c135
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-7.c20
-rw-r--r--gcc/testsuite/c-c++-common/gomp/masked-1.c23
-rw-r--r--gcc/testsuite/c-c++-common/gomp/masked-2.c11
-rw-r--r--gcc/testsuite/c-c++-common/gomp/masked-combined-1.c37
-rw-r--r--gcc/testsuite/c-c++-common/gomp/masked-combined-2.c13
-rw-r--r--gcc/testsuite/c-c++-common/gomp/nesting-2.c12
-rw-r--r--gcc/testsuite/c-c++-common/gomp/nothing-1.c37
-rw-r--r--gcc/testsuite/c-c++-common/gomp/nothing-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr100450.c20
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr100902-1.c17
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr101535-1.c31
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr101535-2.c11
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr61486-2.c13
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr63326.c44
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-1.c206
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-10.c231
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-11.c28
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-12.c23
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-13.c171
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-14.c171
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-15.c26
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-16.c16
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-2.c208
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-3.c119
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-4.c76
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-5.c107
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-6.c107
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-7.c103
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-8.c219
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-9.c219
-rw-r--r--gcc/testsuite/c-c++-common/gomp/reduction-task-2.c8
-rw-r--r--gcc/testsuite/c-c++-common/gomp/requires-3.c3
-rw-r--r--gcc/testsuite/c-c++-common/gomp/scan-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/scope-1.c39
-rw-r--r--gcc/testsuite/c-c++-common/gomp/scope-2.c41
-rw-r--r--gcc/testsuite/c-c++-common/gomp/sink-5.c16
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-device-1.c32
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-device-2.c14
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-device-ancestor-1.c13
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-device-ancestor-2.c82
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-device-ancestor-3.c37
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c17
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-in-reduction-1.c12
-rw-r--r--gcc/testsuite/c-c++-common/gomp/task-detach-3.c19
-rw-r--r--gcc/testsuite/c-c++-common/modref-dse.c38
-rw-r--r--gcc/testsuite/c-c++-common/pr100785.c21
-rw-r--r--gcc/testsuite/c-c++-common/pr19807-2.c5
-rw-r--r--gcc/testsuite/c-c++-common/pr19807-3.c5
-rw-r--r--gcc/testsuite/c-c++-common/spellcheck-reserved.c18
-rw-r--r--gcc/testsuite/c-c++-common/torture/builtin-shufflevector-1.c49
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c6
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c6
-rw-r--r--gcc/testsuite/c-c++-common/uninit-17.c6
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-10.c2
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-11.c2
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-6.c1
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-7.c1
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-8.c2
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-9.c2
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2082.C12
-rw-r--r--gcc/testsuite/g++.dg/abi/abi-tag24a.C18
-rw-r--r--gcc/testsuite/g++.dg/abi/lambda-defarg1.C11
-rw-r--r--gcc/testsuite/g++.dg/abi/macro0.C2
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle71.C12
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle77.C31
-rw-r--r--gcc/testsuite/g++.dg/analyzer/placement-new.C2
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr100244.C22
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr101522.C31
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr93212.C4
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr94011.C2
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr94503.C2
-rw-r--r--gcc/testsuite/g++.dg/analyzer/vfunc-2.C44
-rw-r--r--gcc/testsuite/g++.dg/analyzer/vfunc-3.C32
-rw-r--r--gcc/testsuite/g++.dg/analyzer/vfunc-4.C28
-rw-r--r--gcc/testsuite/g++.dg/analyzer/vfunc-5.C103
-rw-r--r--gcc/testsuite/g++.dg/asan/asan_test.C2
-rw-r--r--gcc/testsuite/g++.dg/asan/pr99877.C19
-rw-r--r--gcc/testsuite/g++.dg/auto-init-uninit-pred-1_a.C3
-rw-r--r--gcc/testsuite/g++.dg/auto-init-uninit-pred-2_a.C3
-rw-r--r--gcc/testsuite/g++.dg/auto-init-uninit-pred-3_a.C3
-rw-r--r--gcc/testsuite/g++.dg/auto-init-uninit-pred-4.C3
-rw-r--r--gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c2
-rw-r--r--gcc/testsuite/g++.dg/concepts/abbrev10.C18
-rw-r--r--gcc/testsuite/g++.dg/concepts/abbrev11.C10
-rw-r--r--gcc/testsuite/g++.dg/concepts/diagnostic16.C45
-rw-r--r--gcc/testsuite/g++.dg/concepts/diagnostic17.C17
-rw-r--r--gcc/testsuite/g++.dg/concepts/diagnostic18.C7
-rw-r--r--gcc/testsuite/g++.dg/concepts/diagnostic2.C2
-rw-r--r--gcc/testsuite/g++.dg/concepts/explicit-spec1.C9
-rw-r--r--gcc/testsuite/g++.dg/conversion/pr100635.C12
-rw-r--r--gcc/testsuite/g++.dg/conversion/pr66211.C2
-rw-r--r--gcc/testsuite/g++.dg/conversion/real-to-int1.C17
-rw-r--r--gcc/testsuite/g++.dg/conversion/ref7.C17
-rw-r--r--gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C2
-rw-r--r--gcc/testsuite/g++.dg/coroutines/pr95520.C29
-rw-r--r--gcc/testsuite/g++.dg/coroutines/pr99047.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic2.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alignof7.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto24.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto3.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto42.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-delegating3.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-empty16.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/dc10.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype29.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/deleted15.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/depr-copy3.C35
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/depr-copy4.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/enum_base4.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/enum_base5.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/extern_template-6.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/friend7.C40
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/friend8.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-45.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-58.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-59.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-75.C35
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-76.C34
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C26
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-base4.C26
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-new5.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist124.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist48.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist75.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist80.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/new5.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept66.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept67.C26
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept68.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept69.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept70.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi-virtual1a.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi17.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr11.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr46.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr60209-neg.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr68724.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr78765.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr94616.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv-cast6.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv-life.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae67.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae68.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/static_assert17.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic181.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic182.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic38.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-88982.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.h2
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/auto-fn61.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/builtin_location.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-101371-2.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-101371.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C24
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C33
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr88872.C24
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr95226.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction-access1.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction-access2.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction-access3.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction84.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction85.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction86.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction87.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction88.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction89.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction90.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction91.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction92.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction93.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction94.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction95.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction96.C34
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction97.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction98.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-if35.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp55.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/elide6.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C30
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/inline-var9.C40
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/nodiscard8.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/nodiscard9.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/nontype-auto19.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/pr81016.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/pr99790.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/pr99833.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/using9.C49
-rw-r--r--gcc/testsuite/g++.dg/cpp23/auto-array.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if1.C103
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if10.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if2.C129
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if3.C73
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if4.C44
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if5.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if6.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if7.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if8.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp23/consteval-if9.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp23/mixed-concat1.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp23/narrowing-bool1.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize1.C66
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize2.C66
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize3.C80
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize4.C66
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize5.C66
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize6.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize7.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp23/ucnid-1-utf8.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp23/whitespace-splice1.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr11.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/class-deduction-alias9.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-access2.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-decltype.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-err3.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-lambda14.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C61
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-requires25.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-requires26.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-requires27.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-return-req3.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-uneval4.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C27
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-init22.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C60
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C45
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C43
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new20.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new21.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new5.C60
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new6.C64
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constinit16.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/construct_at.h62
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/desig18.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/desig19.C33
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/destroying-delete5.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/explicit16.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/explicit17.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/explicit18.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated12.C79
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated9.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member1.C61
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member2.C158
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member3.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member5.C95
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member6.C34
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member7.C71
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-corresponding-member8.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-layout-compatible1.C80
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-layout-compatible2.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-layout-compatible3.C64
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-base-of1.C55
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class1.C65
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class2.C135
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class3.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class4.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class5.C59
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class6.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C27
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-uneval16.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/no_unique_address13.C24
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class39.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class42.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class43.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class44.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class45.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class46.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class47.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class48.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class49.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-complex1.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/pr99833.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-err7.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-fallback1.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg6.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-synth11.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/srcloc1.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/srcloc15.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/srcloc16.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/srcloc19.C44
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/srcloc2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/typename14.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/typename19.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/using-enum-9.C28
-rw-r--r--gcc/testsuite/g++.dg/debug/cleanup1.C41
-rw-r--r--gcc/testsuite/g++.dg/debug/defaulted1.C10
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/deallocator.C3
-rw-r--r--gcc/testsuite/g++.dg/dfp/mangle-6.C19
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/auto1.C3
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/enum3.C9
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/maybe_unused1.C17
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr100716-1.C54
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr100716.C54
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C2
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/static_assert4.C30
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/string-literal-concat.C6
-rw-r--r--gcc/testsuite/g++.dg/expr/ptr-comp4.C21
-rw-r--r--gcc/testsuite/g++.dg/ext/anon-struct8.C9
-rw-r--r--gcc/testsuite/g++.dg/ext/anon-struct9.C9
-rw-r--r--gcc/testsuite/g++.dg/ext/array4.C172
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-1.C113
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-2.C10
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-3.C14
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-4.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-5.C6
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-6.C110
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-7.C19
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-8.C17
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-unavailable-9.C17
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib62.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib63.C34
-rw-r--r--gcc/testsuite/g++.dg/ext/builtin-shufflevector-1.C19
-rw-r--r--gcc/testsuite/g++.dg/ext/builtin-shufflevector-2.C13
-rw-r--r--gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C4
-rw-r--r--gcc/testsuite/g++.dg/ext/flexary13.C24
-rw-r--r--gcc/testsuite/g++.dg/ext/utf-badconcat.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/utf-badconcat2.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/va-arg-pack-3.C18
-rw-r--r--gcc/testsuite/g++.dg/ext/vector40.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/vector41.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/noPLT.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/vla22.C2
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov-2.C4
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov-threads-1.C2
-rw-r--r--gcc/testsuite/g++.dg/goacc/mdc.C2
-rw-r--r--gcc/testsuite/g++.dg/goacc/pr101759.C5
-rw-r--r--gcc/testsuite/g++.dg/goacc/template.C17
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-18.C3
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-1.C628
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-10.C240
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-11.C86
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-12.C41
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-13.C34
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-2.C620
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-3.C40
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-4.C61
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-5.C46
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-6.C50
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-7.C63
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-8.C10
-rw-r--r--gcc/testsuite/g++.dg/gomp/attrs-9.C16
-rw-r--r--gcc/testsuite/g++.dg/gomp/barrier-2.C2
-rw-r--r--gcc/testsuite/g++.dg/gomp/block-11.C18
-rw-r--r--gcc/testsuite/g++.dg/gomp/clause-3.C2
-rw-r--r--gcc/testsuite/g++.dg/gomp/declare-simd-8.C15
-rw-r--r--gcc/testsuite/g++.dg/gomp/depend-iterator-3.C43
-rw-r--r--gcc/testsuite/g++.dg/gomp/doacross-2.C16
-rw-r--r--gcc/testsuite/g++.dg/gomp/error-1.C42
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr101516.C8
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr101759.C8
-rw-r--r--gcc/testsuite/g++.dg/gomp/this-1.C20
-rw-r--r--gcc/testsuite/g++.dg/gomp/tls-5.C2
-rw-r--r--gcc/testsuite/g++.dg/gomp/tpl-masked-1.C21
-rw-r--r--gcc/testsuite/g++.dg/inherit/covariant23.C14
-rw-r--r--gcc/testsuite/g++.dg/inherit/virtual15.C18
-rw-r--r--gcc/testsuite/g++.dg/inherit/virtual15a.C19
-rw-r--r--gcc/testsuite/g++.dg/init/no-elide2.C32
-rw-r--r--gcc/testsuite/g++.dg/ipa/ipa-sra-4.C37
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr45572-2.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr82352.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/pure-const-3.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/operator-3.C109
-rw-r--r--gcc/testsuite/g++.dg/lookup/pr84962.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/strong-using.C9
-rw-r--r--gcc/testsuite/g++.dg/lookup/strong-using2.C9
-rw-r--r--gcc/testsuite/g++.dg/lookup/using-decl1.C38
-rw-r--r--gcc/testsuite/g++.dg/lookup/using66.C23
-rw-r--r--gcc/testsuite/g++.dg/lto/odr-1_0.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/odr-1_1.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/odr-2_1.C2
-rw-r--r--gcc/testsuite/g++.dg/lto/pr101396_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/pr101396_1.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/pr89335_0.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/pr97565_0.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/pr97565_1.C6
-rw-r--r--gcc/testsuite/g++.dg/modules/adhoc-1_b.C2
-rw-r--r--gcc/testsuite/g++.dg/modules/builtin-3_a.C23
-rw-r--r--gcc/testsuite/g++.dg/modules/builtin-3_b.C7
-rw-r--r--gcc/testsuite/g++.dg/modules/hdr-init-1_c.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/indirect-3_c.C2
-rw-r--r--gcc/testsuite/g++.dg/modules/indirect-4_c.C2
-rw-r--r--gcc/testsuite/g++.dg/modules/lambda-3_b.C6
-rw-r--r--gcc/testsuite/g++.dg/modules/late-ret-3_c.C2
-rw-r--r--gcc/testsuite/g++.dg/modules/macloc-1_c.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/macloc-1_d.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/omp-1_a.C3
-rw-r--r--gcc/testsuite/g++.dg/modules/omp-1_b.C1
-rw-r--r--gcc/testsuite/g++.dg/modules/omp-1_c.C3
-rw-r--r--gcc/testsuite/g++.dg/modules/omp-2_a.C3
-rw-r--r--gcc/testsuite/g++.dg/modules/omp-2_b.C1
-rw-r--r--gcc/testsuite/g++.dg/modules/pr101582-1.C9
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99239_a.H13
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99239_b.H12
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-1_a.H6
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-1_b.H10
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-2_a.H12
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-2_b.H22
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-2_c.H20
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-3_a.H31
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-3_b.H9
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-4.H20
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-5.h9
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-5_a.H14
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-5_b.H12
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-5_c.C5
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-6.h23
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-6_a.H33
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-6_b.H164
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-6_c.C10
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-6_d.H10
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-7-swap.h17
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-7-traits.h41
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-7_a.H97
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-7_b.H4
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-7_c.C8
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99283-7_d.H8
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99425-1.h11
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99425-1_a.H4
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99425-1_b.H19
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99425-1_c.C11
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99425-2_a.X7
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99425-2_b.X4
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99480_a.H10
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99480_b.H9
-rw-r--r--gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H8
-rw-r--r--gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C7
-rw-r--r--gcc/testsuite/g++.dg/no-stack-protector-attr-3.C3
-rw-r--r--gcc/testsuite/g++.dg/opt/nrv20.C20
-rw-r--r--gcc/testsuite/g++.dg/opt/nrv21.C14
-rw-r--r--gcc/testsuite/g++.dg/opt/pr100148.C27
-rw-r--r--gcc/testsuite/g++.dg/opt/pr100254.C101
-rw-r--r--gcc/testsuite/g++.dg/opt/pr100852.C25
-rw-r--r--gcc/testsuite/g++.dg/opt/pr101162.C21
-rw-r--r--gcc/testsuite/g++.dg/opt/pr94589-1.C33
-rw-r--r--gcc/testsuite/g++.dg/opt/pr94589-2.C33
-rw-r--r--gcc/testsuite/g++.dg/opt/pr94589-3.C84
-rw-r--r--gcc/testsuite/g++.dg/opt/pr94589-4.C84
-rw-r--r--gcc/testsuite/g++.dg/opt/pr99456.C33
-rw-r--r--gcc/testsuite/g++.dg/opt/pr99728.C50
-rw-r--r--gcc/testsuite/g++.dg/other/anon-union5.C9
-rw-r--r--gcc/testsuite/g++.dg/other/gc6.C16
-rw-r--r--gcc/testsuite/g++.dg/other/gc7.C16
-rw-r--r--gcc/testsuite/g++.dg/other/i386-2.C2
-rw-r--r--gcc/testsuite/g++.dg/other/i386-3.C2
-rw-r--r--gcc/testsuite/g++.dg/other/pr100580.C8
-rw-r--r--gcc/testsuite/g++.dg/parse/access13.C7
-rw-r--r--gcc/testsuite/g++.dg/parse/saved1.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/template2.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/uneval1.C14
-rw-r--r--gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C2
-rw-r--r--gcc/testsuite/g++.dg/plugin/location-overflow-test-pr100796.c25
-rw-r--r--gcc/testsuite/g++.dg/plugin/plugin.exp3
-rw-r--r--gcc/testsuite/g++.dg/pr100253.C33
-rw-r--r--gcc/testsuite/g++.dg/pr100574.C68
-rw-r--r--gcc/testsuite/g++.dg/pr100774.C24
-rw-r--r--gcc/testsuite/g++.dg/pr101331.C7
-rw-r--r--gcc/testsuite/g++.dg/pr101511.C22
-rw-r--r--gcc/testsuite/g++.dg/pr71389.C2
-rw-r--r--gcc/testsuite/g++.dg/pr71655.C1
-rw-r--r--gcc/testsuite/g++.dg/pr90773-1.h14
-rw-r--r--gcc/testsuite/g++.dg/pr90773-1a.C13
-rw-r--r--gcc/testsuite/g++.dg/pr90773-1b.C5
-rw-r--r--gcc/testsuite/g++.dg/pr90773-1c.C5
-rw-r--r--gcc/testsuite/g++.dg/pr90773-1d.C19
-rw-r--r--gcc/testsuite/g++.dg/pr93195a.C1
-rw-r--r--gcc/testsuite/g++.dg/pr94314-3.C2
-rw-r--r--gcc/testsuite/g++.dg/pr95768.C2
-rw-r--r--gcc/testsuite/g++.dg/pr98032.C20
-rw-r--r--gcc/testsuite/g++.dg/pr98136.C26
-rw-r--r--gcc/testsuite/g++.dg/spellcheck-stdlib.C18
-rw-r--r--gcc/testsuite/g++.dg/template/access2.C6
-rw-r--r--gcc/testsuite/g++.dg/template/access36.C25
-rw-r--r--gcc/testsuite/g++.dg/template/access37.C26
-rw-r--r--gcc/testsuite/g++.dg/template/access37a.C6
-rw-r--r--gcc/testsuite/g++.dg/template/access38.C15
-rw-r--r--gcc/testsuite/g++.dg/template/access39.C17
-rw-r--r--gcc/testsuite/g++.dg/template/access40.C28
-rw-r--r--gcc/testsuite/g++.dg/template/access40a.C28
-rw-r--r--gcc/testsuite/g++.dg/template/access41.C24
-rw-r--r--gcc/testsuite/g++.dg/template/access41a.C29
-rw-r--r--gcc/testsuite/g++.dg/template/call8.C14
-rw-r--r--gcc/testsuite/g++.dg/template/conv17.C56
-rw-r--r--gcc/testsuite/g++.dg/template/crash50.C2
-rw-r--r--gcc/testsuite/g++.dg/template/dependent-tmpl1.C9
-rw-r--r--gcc/testsuite/g++.dg/template/dependent-tmpl2.C10
-rw-r--r--gcc/testsuite/g++.dg/template/error56.C4
-rw-r--r--gcc/testsuite/g++.dg/template/error8.C2
-rw-r--r--gcc/testsuite/g++.dg/template/explicit-args6.C34
-rw-r--r--gcc/testsuite/g++.dg/template/explicit-args7.C33
-rw-r--r--gcc/testsuite/g++.dg/template/friend70.C9
-rw-r--r--gcc/testsuite/g++.dg/template/friend71.C8
-rw-r--r--gcc/testsuite/g++.dg/template/koenig12.C15
-rw-r--r--gcc/testsuite/g++.dg/template/koenig12a.C16
-rw-r--r--gcc/testsuite/g++.dg/template/lookup17.C18
-rw-r--r--gcc/testsuite/g++.dg/template/mem-spec2.C11
-rw-r--r--gcc/testsuite/g++.dg/template/nontype29.C4
-rw-r--r--gcc/testsuite/g++.dg/template/param4.C10
-rw-r--r--gcc/testsuite/g++.dg/template/param5.C7
-rw-r--r--gcc/testsuite/g++.dg/template/partial-specialization9.C7
-rw-r--r--gcc/testsuite/g++.dg/template/partial16.C8
-rw-r--r--gcc/testsuite/g++.dg/template/partial17.C14
-rw-r--r--gcc/testsuite/g++.dg/template/partial18.C19
-rw-r--r--gcc/testsuite/g++.dg/template/partial19.C11
-rw-r--r--gcc/testsuite/g++.dg/template/partial5.C2
-rw-r--r--gcc/testsuite/g++.dg/template/pr99425.C45
-rw-r--r--gcc/testsuite/g++.dg/template/ref11.C9
-rw-r--r--gcc/testsuite/g++.dg/template/sfinae-dr1227.C23
-rw-r--r--gcc/testsuite/g++.dg/template/sfinae14.C2
-rw-r--r--gcc/testsuite/g++.dg/template/spec26.C2
-rw-r--r--gcc/testsuite/g++.dg/template/ttp34.C14
-rw-r--r--gcc/testsuite/g++.dg/template/ttp34a.C14
-rw-r--r--gcc/testsuite/g++.dg/template/ttp34b.C14
-rw-r--r--gcc/testsuite/g++.dg/tm/inherit2.C4
-rw-r--r--gcc/testsuite/g++.dg/tm/unsafe1.C4
-rw-r--r--gcc/testsuite/g++.dg/torture/builtin-clear-padding-4.C44
-rw-r--r--gcc/testsuite/g++.dg/torture/pr100303.C112
-rw-r--r--gcc/testsuite/g++.dg/torture/pr100382.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr100925.C24
-rw-r--r--gcc/testsuite/g++.dg/torture/pr101256.C28
-rw-r--r--gcc/testsuite/g++.dg/torture/pr101373.C33
-rw-r--r--gcc/testsuite/g++.dg/torture/pr102142.C9
-rw-r--r--gcc/testsuite/g++.dg/torture/pr99777.C44
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C4
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/morefunc.C7
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/reorder.C6
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/array-temp1.C6
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/modref-1.C32
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr101769.C56
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr83518.C2
-rw-r--r--gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C31
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr101210.C13
-rw-r--r--gcc/testsuite/g++.dg/uninit-pr74762.C24
-rw-r--r--gcc/testsuite/g++.dg/vect/pr102226.cc29
-rwxr-xr-xgcc/testsuite/g++.dg/vect/pr99149.cc2
-rw-r--r--gcc/testsuite/g++.dg/vect/slp-pr98855.cc4
-rw-r--r--gcc/testsuite/g++.dg/vect/slp-pr99971.cc36
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-10.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-11.C23
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-12.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-13.C23
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-17.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-20.C12
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-22.C105
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-23.C345
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-24.C289
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-25.C59
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-26.C27
-rw-r--r--gcc/testsuite/g++.dg/warn/Wconversion5.C19
-rw-r--r--gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C9
-rw-r--r--gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C11
-rw-r--r--gcc/testsuite/g++.dg/warn/Wfree-nonheap-object-6.C45
-rw-r--r--gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C16
-rw-r--r--gcc/testsuite/g++.dg/warn/Winterference-2.C14
-rw-r--r--gcc/testsuite/g++.dg/warn/Winterference.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/Winterference.H7
-rw-r--r--gcc/testsuite/g++.dg/warn/Wlogical-op-3.C12
-rw-r--r--gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C37
-rw-r--r--gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C37
-rw-r--r--gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-6.C158
-rw-r--r--gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-7.C91
-rw-r--r--gcc/testsuite/g++.dg/warn/Wnonnull13.C28
-rw-r--r--gcc/testsuite/g++.dg/warn/Wnonnull14.C28
-rw-r--r--gcc/testsuite/g++.dg/warn/Wnonnull15.C28
-rw-r--r--gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C39
-rw-r--r--gcc/testsuite/g++.dg/warn/Wreturn-5.C15
-rw-r--r--gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C7
-rw-r--r--gcc/testsuite/g++.dg/warn/Wstringop-overflow-7.C42
-rw-r--r--gcc/testsuite/g++.dg/warn/Wtype-limits6.C17
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-18.C13
-rw-r--r--gcc/testsuite/g++.dg/warn/pr101219.C11
-rw-r--r--gcc/testsuite/g++.dg/warn/uninit-pr48483.C56
-rw-r--r--gcc/testsuite/g++.dg/warn/uninit-pr55288.C43
-rw-r--r--gcc/testsuite/g++.dg/warn/uninit-pr55881.C34
-rw-r--r--gcc/testsuite/g++.dg/warn/uninit-pr74765.C24
-rw-r--r--gcc/testsuite/g++.dg/warn/uninit-pr82800.C43
-rw-r--r--gcc/testsuite/g++.dg/warn/uninit-pr93100.C60
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/union4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ns/crash3.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ns/template7.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/inline7.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash8.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec21.C3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/unify6.C4
-rw-r--r--gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp72
-rw-r--r--gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C110
-rw-r--r--gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C4
-rw-r--r--gcc/testsuite/g++.target/aarch64/interference.C9
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp6
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp4
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp4
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr102252.C37
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr96974.C18
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr99216.C5
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr99766.C24
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr99781.C18
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr99813.C27
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp4
-rw-r--r--gcc/testsuite/g++.target/arm/arm.exp2
-rw-r--r--gcc/testsuite/g++.target/arm/interference.C9
-rw-r--r--gcc/testsuite/g++.target/arm/mve.exp2
-rw-r--r--gcc/testsuite/g++.target/arm/pr99593.C129
-rw-r--r--gcc/testsuite/g++.target/i386/avx2-pr54700-2.C8
-rw-r--r--gcc/testsuite/g++.target/i386/avx512vl-pr54700-1a.C9
-rw-r--r--gcc/testsuite/g++.target/i386/avx512vl-pr54700-1b.C9
-rw-r--r--gcc/testsuite/g++.target/i386/avx512vl-pr54700-2a.C17
-rw-r--r--gcc/testsuite/g++.target/i386/avx512vl-pr54700-2b.C17
-rw-r--r--gcc/testsuite/g++.target/i386/empty-class1.C9
-rw-r--r--gcc/testsuite/g++.target/i386/empty-class2.C20
-rw-r--r--gcc/testsuite/g++.target/i386/float16-1.C8
-rw-r--r--gcc/testsuite/g++.target/i386/float16-2.C14
-rw-r--r--gcc/testsuite/g++.target/i386/float16-3.C10
-rw-r--r--gcc/testsuite/g++.target/i386/interference.C8
-rw-r--r--gcc/testsuite/g++.target/i386/mv16.C6
-rw-r--r--gcc/testsuite/g++.target/i386/mv30.C50
-rw-r--r--gcc/testsuite/g++.target/i386/pr100581.C9
-rw-r--r--gcc/testsuite/g++.target/i386/pr100637-1b.C17
-rw-r--r--gcc/testsuite/g++.target/i386/pr100637-1w.C17
-rw-r--r--gcc/testsuite/g++.target/i386/pr100885.C144
-rw-r--r--gcc/testsuite/g++.target/i386/pr101023a.C63
-rw-r--r--gcc/testsuite/g++.target/i386/pr101023b.C5
-rw-r--r--gcc/testsuite/g++.target/i386/pr102166.C20
-rw-r--r--gcc/testsuite/g++.target/i386/pr80566-1.C15
-rw-r--r--gcc/testsuite/g++.target/i386/pr80566-2.C14
-rw-r--r--gcc/testsuite/g++.target/i386/pr94185.C1
-rw-r--r--gcc/testsuite/g++.target/i386/pr98218-1.C20
-rw-r--r--gcc/testsuite/g++.target/i386/pr99679-1.C17
-rw-r--r--gcc/testsuite/g++.target/i386/pr99679-2.C17
-rw-r--r--gcc/testsuite/g++.target/powerpc/pr99842.C188
-rw-r--r--gcc/testsuite/g++.target/s390/mi-thunk.C23
-rw-r--r--gcc/testsuite/g++.target/s390/pr100281-1.C10
-rw-r--r--gcc/testsuite/g++.target/s390/pr100281-2.C9
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030405-2.c58
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040304-2.c45
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr100106.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr100305.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr100576.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr101159.c10
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr101437.c29
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr10153-1.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr10153-2.c9
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr101562.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr101642.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr61159.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr83510.c54
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr97141.c8
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr98726.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr99647.c5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr99822.c41
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/ssa-unused-1.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20210505-1.c31
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/950704-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/alias-2.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/fprintf-2.c3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h13
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c126
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c125
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c168
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr102134.c23
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr92618.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr98736.c14
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr99751.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/printf-2.c3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/user-printf.c3
-rw-r--r--gcc/testsuite/gcc.dg/20030612-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-larger-than-4.c18
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-29.c22
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-30.c2
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-31.c8
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-32.c26
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-39.c49
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-52.c6
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-53.c6
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-58.c2
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-63.c6
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-64.c2
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-66.c12
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-69.c2
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-71.c7
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-71.h46
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-72.c7
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-73.c7
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-74.c7
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-75.c12
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-76.c35
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-77.c135
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-78.c109
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-79.c112
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-80.c96
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-81.c302
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-82.c258
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-83.c172
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-84.c65
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-85.c30
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-87.c48
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-88.c134
-rw-r--r--gcc/testsuite/gcc.dg/Warray-parameter-9.c54
-rw-r--r--gcc/testsuite/gcc.dg/Warray-parameter.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wattributes-6.c36
-rw-r--r--gcc/testsuite/gcc.dg/Wfree-nonheap-object-4.c24
-rw-r--r--gcc/testsuite/gcc.dg/Wfree-nonheap-object-5.c46
-rw-r--r--gcc/testsuite/gcc.dg/Wfree-nonheap-object-6.c49
-rw-r--r--gcc/testsuite/gcc.dg/Wnonnull-4.c36
-rw-r--r--gcc/testsuite/gcc.dg/Wnonnull-6.c93
-rw-r--r--gcc/testsuite/gcc.dg/Wnonnull-7.c15
-rw-r--r--gcc/testsuite/gcc.dg/Wobjsize-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/Wrestrict-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wreturn-type3.c54
-rw-r--r--gcc/testsuite/gcc.dg/Wstring-compare-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wstring-compare.c10
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-11.c8
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-12.c6
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-34.c8
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-41.c3
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-42.c12
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-43.c13
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-46.c5
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-47.c25
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-55.c10
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-61.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-67.c92
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-68.c104
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-69.c84
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-70.c24
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-71.c113
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-72.c13
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-73.c35
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overread-6.c574
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overread.c32
-rw-r--r--gcc/testsuite/gcc.dg/Wunused-result.c50
-rw-r--r--gcc/testsuite/gcc.dg/Wunused-var-5.c23
-rw-r--r--gcc/testsuite/gcc.dg/Wunused-var-6.c14
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-larger-than-5.c38
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-10.c68
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-11.c70
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-12.c36
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-13.c18
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-3.c12
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-9.c30
-rw-r--r--gcc/testsuite/gcc.dg/alias-7.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c69
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-1.c131
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-2.c34
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c4
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/bitfields-1.c144
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/capacity-1.c106
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/capacity-2.c55
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/capacity-3.c82
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/clobbers-1.c97
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/clobbers-2.c72
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-1.c86
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-10.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-20.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-22.c101
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-23.c26
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/dump-state.c14
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/explode-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/explode-2.c18
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/explode-2a.c51
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/feasibility-3.c133
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fgets-1.c31
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fread-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/function-ptr-4.c24
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c38
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/memset-1.c118
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/memset-CVE-2017-18549-1.c107
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/paths-8.c17
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/phi-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/phi-2.c27
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr100011.c16
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr100546.c17
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr100615.c53
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101143.c18
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101503.c11
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101547.c11
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101570.c5
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101721.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101837.c10
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101875.c16
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101962.c51
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c7
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr93695-1.c53
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr94047.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr94851-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr96841.c4
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr98599-a.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr98599-b.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr98628.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99042.c53
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99044-1.c60
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99044-2.c42
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99193-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99193-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99716-1.c40
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99716-2.c34
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99716-3.c16
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99771-1.c63
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99774-1.c61
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99774-2.c144
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99886.c21
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr99906.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/realloc-1.c52
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/realloc-2.c80
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/sock-1.c112
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/sock-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/strdup-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/strndup-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/switch.c141
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/symbolic-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/symbolic-7.c46
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/symbolic-8.c11
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c74
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c81
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c135
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c46
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c210
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c33
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c319
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c77
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/pr102225.c6
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/pr93649.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/switch-2.c42
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c158
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/switch-4.c27
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/switch-5.c68
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/ubsan-1.c60
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-2.c14
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-3.c36
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-4.c39
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-6.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-6b.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-pr94713.c11
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/uninit-pr94714.c12
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/use-after-free-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/use-after-free-3.c12
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/zlib-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/zlib-6.c13
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/zlib-6a.c47
-rw-r--r--gcc/testsuite/gcc.dg/array-quals-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-7.c45
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-nonstring-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/attr-nonstring-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/attr-noreturn.c64
-rw-r--r--gcc/testsuite/gcc.dg/attr-returns-nonnull.c58
-rw-r--r--gcc/testsuite/gcc.dg/attr-unavailable-1.c88
-rw-r--r--gcc/testsuite/gcc.dg/attr-unavailable-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/attr-unavailable-3.c10
-rw-r--r--gcc/testsuite/gcc.dg/attr-unavailable-4.c88
-rw-r--r--gcc/testsuite/gcc.dg/attr-unavailable-5.c6
-rw-r--r--gcc/testsuite/gcc.dg/attr-unavailable-6.c11
-rw-r--r--gcc/testsuite/gcc.dg/attr-vector_size.c16
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-sra-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-sra-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-12.c4
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-13.c10
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-15.c26
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-16.c25
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-17.c15
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-18.c3
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-19.c26
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-20.c4
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-21.c4
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-22.c3
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-23.c27
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-24.c3
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-25.c23
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-26.c23
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-34.c60
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-36.c238
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-37.c156
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-4.c10
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-5.c6
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-6.c7
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-8.c8
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-9.c8
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-A.c7
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-B.c17
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-C.c5
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-H.c5
-rw-r--r--gcc/testsuite/gcc.dg/auto-init-uninit-I.c3
-rw-r--r--gcc/testsuite/gcc.dg/builtin-bswap-13.c329
-rw-r--r--gcc/testsuite/gcc.dg/builtin-bswap-14.c302
-rw-r--r--gcc/testsuite/gcc.dg/builtin-object-size-10.c6
-rw-r--r--gcc/testsuite/gcc.dg/builtins-70.c46
-rw-r--r--gcc/testsuite/gcc.dg/c11-digit-separators-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/c11-qual-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/c11-unproto-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/c11-unproto-2.c21
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/c2x-digit-separators-1.c39
-rw-r--r--gcc/testsuite/gcc.dg/c2x-digit-separators-2.c25
-rw-r--r--gcc/testsuite/gcc.dg/c2x-digit-separators-3.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-qual-1.c30
-rw-r--r--gcc/testsuite/gcc.dg/c2x-qual-2.c30
-rw-r--r--gcc/testsuite/gcc.dg/c2x-qual-3.c30
-rw-r--r--gcc/testsuite/gcc.dg/c2x-qual-4.c105
-rw-r--r--gcc/testsuite/gcc.dg/c2x-qual-5.c101
-rw-r--r--gcc/testsuite/gcc.dg/c2x-qual-6.c114
-rw-r--r--gcc/testsuite/gcc.dg/c2x-qual-7.c16
-rw-r--r--gcc/testsuite/gcc.dg/c2x-unproto-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/c2x-unproto-2.c21
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c16
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c57
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c63
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr100392.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr100392.h4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr100646-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr100646-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr101638.c7
-rw-r--r--gcc/testsuite/gcc.dg/cpp/ucnid-4-utf8.c4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/ucnid-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/ucnid-5-utf8.c17
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c31
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c34
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c26
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c38
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-4.c23
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c53
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c46
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c30
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-float-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c18
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c22
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c19
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c82
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c16
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c33
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c27
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-variables-3.c36
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf.exp48
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c31
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c38
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c17
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c13
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c30
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c39
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c16
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c19
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c66
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c30
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c25
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c23
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-2.c7
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c27
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c16
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c40
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c21
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c18
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c34
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c30
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c25
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c38
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c18
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c20
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c21
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c19
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c18
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c18
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-8.c27
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c32
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c65
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c68
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c24
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c32
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/debug/ctf/ctf.exp48
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c20
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr57351.c1
-rw-r--r--gcc/testsuite/gcc.dg/diagnostic-input-charset-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/diagnostic-input-utf8-bom.c14
-rw-r--r--gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges-2.c26
-rw-r--r--gcc/testsuite/gcc.dg/fold-convlshift-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/fold-convlshift-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/fold-convlshift-3.c8
-rw-r--r--gcc/testsuite/gcc.dg/fold-eqbswap-1.c113
-rw-r--r--gcc/testsuite/gcc.dg/fold-eqrotate-1.c46
-rw-r--r--gcc/testsuite/gcc.dg/fold-ior-4.c61
-rw-r--r--gcc/testsuite/gcc.dg/fold-ior-5.c17
-rw-r--r--gcc/testsuite/gcc.dg/format/c90-printf-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_diag-10.c20
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_diag-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/format/strfmon-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gcov-info-to-gcda.c60
-rw-r--r--gcc/testsuite/gcc.dg/gimplefe-45.c19
-rw-r--r--gcc/testsuite/gcc.dg/gimplefe-error-10.c8
-rw-r--r--gcc/testsuite/gcc.dg/gimplefe-error-11.c12
-rw-r--r--gcc/testsuite/gcc.dg/gimplefe-error-9.c9
-rw-r--r--gcc/testsuite/gcc.dg/goacc/loop-processing-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/gomp/atomic-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/barrier-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/gomp/clause-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-simd-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-variant-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/nesting-1.c99
-rw-r--r--gcc/testsuite/gcc.dg/gomp/pr100508.c14
-rw-r--r--gcc/testsuite/gcc.dg/gomp/scan-1.c51
-rw-r--r--gcc/testsuite/gcc.dg/gomp/simd-clones-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/fuse-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/guality/example.c3
-rw-r--r--gcc/testsuite/gcc.dg/guality/guality.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/inline-params.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/loop-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr101905.c15
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr36728-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr36728-2.c30
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr36728-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr41353-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr41447-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr43077-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr49888.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54200.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54519-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54519-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54519-3.c8
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54519-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54519-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54519-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54693-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr54970.c16
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr56154-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr59776.c16
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr68860-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr68860-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr90074.c4
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr90716.c2
-rw-r--r--gcc/testsuite/gcc.dg/guality/sra-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inline-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-23.c24
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-24.c20
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modref-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr100600.c22
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr101066.c20
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr93385.c27
-rw-r--r--gcc/testsuite/gcc.dg/ipa/propmalloc-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-3.c23
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-4.c31
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-5.c38
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-6.c24
-rw-r--r--gcc/testsuite/gcc.dg/local1.c2
-rw-r--r--gcc/testsuite/gcc.dg/loop-unswitch-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr101868_0.c33
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr101868_1.c23
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr101868_2.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr101868_3.c8
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr101949_0.c20
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr101949_1.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr48622_1.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr99849_0.c23
-rw-r--r--gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/nonnull-6.c15
-rw-r--r--gcc/testsuite/gcc.dg/old-style-asm-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapdi-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapdi-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapsi-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapsi-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapsi-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapsi-6.c38
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c21
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c2
-rw-r--r--gcc/testsuite/gcc.dg/pointer-array-quals-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/pointer-array-quals-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr100142.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr100225.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr100239.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr100292.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr100349.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr100373.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr100414.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr100464.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr100509.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr100512.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr100521.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr100547.c35
-rw-r--r--gcc/testsuite/gcc.dg/pr100563.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr100590.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr100619.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr100781.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr100788.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr100790.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr100791.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr100887.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr101008.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr101028.c34
-rw-r--r--gcc/testsuite/gcc.dg/pr101062.c29
-rw-r--r--gcc/testsuite/gcc.dg/pr101156.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr101170.c37
-rw-r--r--gcc/testsuite/gcc.dg/pr101171.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr101172.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr101223.c44
-rw-r--r--gcc/testsuite/gcc.dg/pr101254.c27
-rw-r--r--gcc/testsuite/gcc.dg/pr101266.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr101294.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr101384.c39
-rw-r--r--gcc/testsuite/gcc.dg/pr101403.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr101419.c62
-rw-r--r--gcc/testsuite/gcc.dg/pr101496.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr101497.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr101741.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr101858.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr101938.c28
-rw-r--r--gcc/testsuite/gcc.dg/pr102141.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr102152.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr102207.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr102224.c49
-rw-r--r--gcc/testsuite/gcc.dg/pr102269.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr102273.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr20126.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr43864-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/pr48552-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr48552-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr56727-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr68217.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr68317.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr78213.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr78888.c29
-rw-r--r--gcc/testsuite/gcc.dg/pr79214.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr79412.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr79972.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr80776-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr81192.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr84877.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr86058.c19
-rw-r--r--gcc/testsuite/gcc.dg/pr86723.c63
-rw-r--r--gcc/testsuite/gcc.dg/pr89984.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr93210.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr94589-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/pr94589-2.c35
-rw-r--r--gcc/testsuite/gcc.dg/pr94589-3.c97
-rw-r--r--gcc/testsuite/gcc.dg/pr94589-4.c97
-rw-r--r--gcc/testsuite/gcc.dg/pr95580.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr96392.c33
-rw-r--r--gcc/testsuite/gcc.dg/pr96542.c27
-rw-r--r--gcc/testsuite/gcc.dg/pr96573.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr97567-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr98099.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr99122-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr99230.c40
-rw-r--r--gcc/testsuite/gcc.dg/pr99296.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr99830.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr99882.c37
-rw-r--r--gcc/testsuite/gcc.dg/pr99990.c12
-rw-r--r--gcc/testsuite/gcc.dg/pragma-diag-10.c20
-rw-r--r--gcc/testsuite/gcc.dg/pragma-diag-9.c141
-rw-r--r--gcc/testsuite/gcc.dg/predict-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/predict-9.c4
-rw-r--r--gcc/testsuite/gcc.dg/sancov/attribute.c27
-rw-r--r--gcc/testsuite/gcc.dg/shrink-wrap-loop.c54
-rw-r--r--gcc/testsuite/gcc.dg/sibcall-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/sms-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/sms-10.c3
-rw-r--r--gcc/testsuite/gcc.dg/sms-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/sms-3.c3
-rw-r--r--gcc/testsuite/gcc.dg/sms-4.c3
-rw-r--r--gcc/testsuite/gcc.dg/sms-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/sms-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/spellcheck-options-23.c5
-rw-r--r--gcc/testsuite/gcc.dg/spellcheck-stdlib.c10
-rw-r--r--gcc/testsuite/gcc.dg/sso-12.c27
-rw-r--r--gcc/testsuite/gcc.dg/sso-13.c24
-rw-r--r--gcc/testsuite/gcc.dg/sso-14.c56
-rw-r--r--gcc/testsuite/gcc.dg/sso-15.c36
-rw-r--r--gcc/testsuite/gcc.dg/sso-16.c100
-rw-r--r--gcc/testsuite/gcc.dg/sso-9.c27
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-73.c13
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-80.c2
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-95.c65
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr99466-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr99466-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100053.c25
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100329.c16
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100398.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100492.c26
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100519.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100566.c36
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100672.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100778.c31
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100923.c25
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr100934.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101009.c17
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101025.c23
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101031.c28
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101088.c45
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101105.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101151.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101173.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101202.c33
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101229.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101230-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101278.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101394.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101512.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr102124.c27
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr102139.c43
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr102149.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr69170.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70025.c5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr79334-0.c23
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr79334-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr93491.c24
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr94947-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr96513.c26
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr98601.c14
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99652-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99652-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99694.c27
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99824.c33
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99880.c22
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99947.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99954.c30
-rw-r--r--gcc/testsuite/gcc.dg/torture/vshuf-4.inc4
-rw-r--r--gcc/testsuite/gcc.dg/torture/vshuf-8.inc4
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-11.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-12.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-28.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-29.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-3.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c38
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-27.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp-trans.c144
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp11.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp30.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/evrp6.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-16.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-4.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-6.c37
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-7.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-8.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-9.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-23.c44
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-24.c44
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25.c83
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount4l.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount4ll.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount5ll.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr100278.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr100453.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr100794.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr101189.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr101335.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr101824.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr20739.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21001.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21294.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21417.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21563.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr49039.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr61839_2.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr61839_3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr64130.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr68198.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr70232.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr77445.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr84512.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr88087.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-7-comp-ref.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr93781-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c57
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr96789.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c51
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr96928.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr97009.c66
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr98265.C348
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-2.c39
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-3.c41
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-4.c83
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-5.c80
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-40.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-41.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c9
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-14.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c39
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-48.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-15.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-16.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-17.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c212
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-14.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-10.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-11.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-12.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-13.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-8.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp02.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp03.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp05.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp06.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp07.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp09.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp19.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp20.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp24.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp33.c2
-rw-r--r--gcc/testsuite/gcc.dg/typedef-var-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-5-utf8.c2
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/uninit-15-O0.c4
-rw-r--r--gcc/testsuite/gcc.dg/uninit-15.c10
-rw-r--r--gcc/testsuite/gcc.dg/uninit-23.c2
-rw-r--r--gcc/testsuite/gcc.dg/uninit-38.c39
-rw-r--r--gcc/testsuite/gcc.dg/uninit-41.c121
-rw-r--r--gcc/testsuite/gcc.dg/uninit-42.c87
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr100250.c29
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr100732.c21
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr101300.c53
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr101494.c60
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr101573.c10
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr44547.c61
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr55060.c30
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr59970.c79
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr61112.c89
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr61677.c26
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr61869.c47
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr65178.c21
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr65182.c44
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr89230-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr89230-2.c54
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr93100.c75
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr98583.c31
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pred-9_b.c3
-rw-r--r--gcc/testsuite/gcc.dg/uninit-suppress_3.c98
-rw-r--r--gcc/testsuite/gcc.dg/unroll-10.c13
-rw-r--r--gcc/testsuite/gcc.dg/unroll-9.c12
-rw-r--r--gcc/testsuite/gcc.dg/unroll-and-jam.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-16.c7
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-39.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-43.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-71.c32
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-72.c29
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-73.c29
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-74.c31
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr100778-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr101207.c25
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr101242.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c30
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr101756.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c43
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/gimplefe-40.c (renamed from gcc/testsuite/gcc.dg/gimplefe-40.c)0
-rw-r--r--gcc/testsuite/gcc.dg/vect/gimplefe-41.c (renamed from gcc/testsuite/gcc.dg/gimplefe-41.c)0
-rw-r--r--gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145.c187
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145.inc65
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145_1.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145_2.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145_3.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145inf.c25
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145inf.inc28
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101145inf_1.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101445.c28
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr101505.c16
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr102046.c19
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr34195.c33
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr56541.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr65947-7.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr71264.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97769.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97832-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97832-2.c29
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97832-3.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97832-4.c28
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr99102.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr99540.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr99856.c33
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-21.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-28.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-3.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-50.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-perm-9.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-5.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-10.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-11.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-12.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-13.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-14.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-15.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-16.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-17.c53
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-18.c53
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-19.c52
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-20.c52
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-21.c52
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-22.c52
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-9.c53
-rw-r--r--gcc/testsuite/gcc.dg/vla-stexp-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/vla-stexp-2.c33
-rw-r--r--gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c39
-rw-r--r--gcc/testsuite/gcc.misc-tests/linkage.exp12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c1
-rwxr-xr-xgcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c1
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c129
-rwxr-xr-xgcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c1
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c67
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c67
-rw-r--r--gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-1.c32
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-2.c35
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-3.c19
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-4.c19
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-5.c19
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-6.c18
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-7.c32
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-8.c32
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-10.c22
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-11.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-12.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c18
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-5.c22
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-6.c20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-7.c20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-8.c22
-rw-r--r--gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c21
-rw-r--r--gcc/testsuite/gcc.target/aarch64/cpunative/info_168
-rw-r--r--gcc/testsuite/gcc.target/aarch64/cpunative/info_178
-rw-r--r--gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/csinv-neg-1.c112
-rw-r--r--gcc/testsuite/gcc.target/aarch64/extract_zero_extend.c9
-rw-r--r--gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c23
-rw-r--r--gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c59
-rw-r--r--gcc/testsuite/gcc.target/aarch64/insv_1.c4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/lane-bound-1.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/lane-bound-2.c10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c26
-rw-r--r--gcc/testsuite/gcc.target/aarch64/memset-strict-align-1.c28
-rw-r--r--gcc/testsuite/gcc.target/aarch64/narrow_high_combine.c231
-rw-r--r--gcc/testsuite/gcc.target/aarch64/narrow_zero_high_half.c130
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr100028.c22
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr100056.c58
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr100075.c21
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr70398.c1
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr91710.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr98772.c3
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr99767.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr99808.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr99873_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr99873_2.c20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr99873_3.c20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr99988.c66
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/ssra.c3
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/usra.c3
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vmulx_laneq_f64_1.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vmulxd_laneq_f64_1.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vmulxs_lane_f32_1.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vmulxs_laneq_f32_1.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmlalh_lane_s16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmlslh_lane_s16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_lane_s16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_laneq_s16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_lane_s32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_laneq_s32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vusdot-autovec.c38
-rw-r--r--gcc/testsuite/gcc.target/aarch64/smov_1.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp15
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f16.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f32.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f64.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c103
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c36
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c72
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general/cntb_1.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/clastb_4.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/cond_arith_6.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/cost_model_12.c19
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/dup_lane_1.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/extract_1.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/extract_2.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/extract_3.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/extract_4.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/ld1_extend.c10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/live_1.c5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/mul_2.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/part_vect_single_iter_epilog.c11
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr100048.c25
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr100302.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr81003.c10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr88834.c5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr97141.c10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr98119.c13
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c11
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr98726.c9
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c15
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c18
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c18
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_10.c77
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_10_run.c49
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_11.c71
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_11_run.c34
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_12.c71
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_12_run.c66
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_13.c101
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_13_run.c61
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_14.c107
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_14_run.c187
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_15.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_15_run.c22
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_9.c77
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/reduc_9_run.c29
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/vusdot-autovec.c38
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vaddX_high_cost.c38
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vect-fmaxv-fminv.x20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vect-shr-reg-run.c53
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vect-shr-reg.c30
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vect-vaddv.c4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vect-vmaxv.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vector_structure_intrinsics.c273
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vmul_element_cost.c94
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vmul_high_cost.c85
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vsubX_high_cost.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/acle/dsp_arith.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/acle/pr100856.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/acle/saturation.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/arm.exp2
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c16
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_2-fp16-neon-2.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/attr-neon.c9
-rw-r--r--gcc/testsuite/gcc.target/arm/attr-neon2.c35
-rw-r--r--gcc/testsuite/gcc.target/arm/attr-neon3.c48
-rw-r--r--gcc/testsuite/gcc.target/arm/bf16_dup.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/bf16_reinterpret.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c6
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-16.c6
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-18.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-20.c28
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse.exp7
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c31
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c28
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c30
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c27
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c30
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c27
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/pr100333.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/pr99725.c5
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/struct-1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/crypto-vsha1cq_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/crypto-vsha1h_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/crypto-vsha1mq_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/crypto-vsha1pq_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/multilib.exp113
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu1.c5
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu2.c5
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/pr101016.c136
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f16.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s16.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s8.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u16.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u8.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/mve.exp2
-rw-r--r--gcc/testsuite/gcc.target/arm/pr51534.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/pr51968.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/pr69245.c8
-rw-r--r--gcc/testsuite/gcc.target/arm/pr98636.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/pr99596.c18
-rw-r--r--gcc/testsuite/gcc.target/arm/pr99724.c31
-rw-r--r--gcc/testsuite/gcc.target/arm/pr99727.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/pr99786.c30
-rw-r--r--gcc/testsuite/gcc.target/arm/pr99977.c8
-rw-r--r--gcc/testsuite/gcc.target/arm/pragma_fpu_attribute.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/pragma_fpu_attribute_2.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/pure-code/pr96770.c16
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c80
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c69
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vabs.c44
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c43
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c47
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vaddv-1.c26
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vclz.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c30
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c30
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c50
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vec-pack.c26
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vec-unpack.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vhadd-1.c31
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vhadd-2.c31
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vld2.c96
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vld4.c140
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c60
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vshl.c5
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vshr.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c47
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c60
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/neon-vhadd-1.c34
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/neon-vhadd-2.c33
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/pr97906.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/pr98435.c16
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vmmla_1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vusdot-autovec.c40
-rw-r--r--gcc/testsuite/gcc.target/arm/unsigned-float.c6
-rw-r--r--gcc/testsuite/gcc.target/bpf/alu-1.c56
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-attr-1.c23
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-attr-2.c21
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-attr-3.c41
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-attr-4.c35
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-1.c64
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-2.c26
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-3.c26
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-lto-1.c9
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-section-1.c38
-rw-r--r--gcc/testsuite/gcc.target/bpf/jmp-1.c57
-rw-r--r--gcc/testsuite/gcc.target/csky/fldrd_fstrd.c17
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fldr64_fstr64.c18
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp51
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c15
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c23
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c11
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c55
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c41
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c11
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c72
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c96
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c31
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c23
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c23
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c22
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c14
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c14
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c11
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c11
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c23
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c76
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c20
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c19
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c21
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c20
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c19
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c20
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c19
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c20
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c16
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c16
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c15
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c16
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c16
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c19
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c21
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c14
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c16
-rw-r--r--gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c29
-rw-r--r--gcc/testsuite/gcc.target/csky/ldbs.c11
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-1.c17
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-2.c17
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-3.c21
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-4.c21
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-5.c17
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-6.c17
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-7.c21
-rw-r--r--gcc/testsuite/gcc.target/gcn/sram-ecc-8.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-1.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-2.c36
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-21.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-22.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-23.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-24.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-3.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-4.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-5.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-6.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-7.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-8.c35
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-1.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-10.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-11.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-12.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-2.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-3.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-4.c28
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-5.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-6.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-7.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-8.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-padding-9.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-1.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-pr102224.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-pr82370.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-pr89984.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-pr94680.c107
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-psraq-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vzeroupper-14.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vzeroupper-15.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vzeroupper-28.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-gather-2.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-pr101286.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-pr101611-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-pr101611-2.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-pr82370.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-pr99908.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-psraq-1.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-shiftqihi-constant-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512-check.h3
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bitalg-pr97770-1.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr100267-1.c38
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr100267-b-2.c74
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr100267-d-2.c74
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr100267-q-2.c74
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr100267-w-2.c74
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-shiftqihi-constant-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqb-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqw-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtb-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtw-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-abs-copysign-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr100267-1.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr100267-pd-2.c76
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr100267-ps-2.c72
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr101471.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr101472.c49
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr101860.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr101896.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr80355-1.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr80355-2.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr82370.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr94680.c144
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXpd.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXps.c50
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXpd.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXps.c50
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqd-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqq-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtd-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtq-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vshufpd-1.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vshufps-1.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f_cond_move.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-10a.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-10b.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-11a.c36
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-11b.c75
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-12a.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-12b.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-1a.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-1b.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-1c.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-1d.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-1e.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-2a.c28
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-2b.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-2c.c36
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-3a.c36
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-3b.c35
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-3c.c40
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-4.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-5.c133
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-6.c57
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-7.c86
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-8.c53
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-9a.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-9b.c49
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-helper.h244
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1a.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1b.c92
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1a.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1b.c104
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vararg-1.c122
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vararg-2.c107
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vararg-3.c114
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vararg-4.c115
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1a.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1b.c70
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1a.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1b.c45
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1a.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1b.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1c.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1a.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1b.c97
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1a.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1b.c76
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vec_set_var.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1a.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1b.c94
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1b.c72
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1a.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1b.c93
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1b.c72
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1a.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1b.c92
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1a.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1b.c77
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1a.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1b.c93
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1a.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1b.c76
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1a.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1a.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1a.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1a.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1a.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1a.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1a.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-abs-copysign-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-blendv-1.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-blendv-2.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-pr100267-1.c122
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-pr100267-pd-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-pr100267-ps-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-pr100648.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-pr101472.c79
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-pr95488-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqd-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtd-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-1.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-b-2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-d-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-q-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-w-2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vlfp16-11a.c68
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vlfp16-11b.c96
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vpopcntdq-pr97770-1.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/bitwise_mask_op-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/bitwise_mask_op-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/bitwise_mask_op-3.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/blendv-1.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/blendv-2.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/bt-5.c44
-rw-r--r--gcc/testsuite/gcc.target/i386/bt-6.c69
-rw-r--r--gcc/testsuite/gcc.target/i386/bt-7.c69
-rw-r--r--gcc/testsuite/gcc.target/i386/builtin_target.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/cold-attribute-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-1.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-2.c78
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-1.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-2.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-1.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-2.c86
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-1.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-1.c38
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-2.c78
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-1.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_fma_double-1.c87
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_fma_double-2.c208
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_fma_float-1.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_fma_float-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-1.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-2.c67
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-1.c39
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-2.c67
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_d-1.c56
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_d-2.c102
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_q-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_q-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_ud-1.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_ud-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_uq-1.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_uq-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_uw-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_uw-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_w-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cond_op_shift_w-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/crc32-6.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/dec-cmov-1.c105
-rw-r--r--gcc/testsuite/gcc.target/i386/dec-cmov-2.c57
-rw-r--r--gcc/testsuite/gcc.target/i386/divmod-9.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/eh_return-1.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/eh_return-2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/float16-3a.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/float16-3b.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/float16-4a.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/float16-4b.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/float16-5.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/float16-6.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/float16-7.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-3.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-56.inc3
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-8.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/incoming-11.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/m512-check.h38
-rw-r--r--gcc/testsuite/gcc.target/i386/mask-shift.c83
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-3.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-4.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-5.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-6.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-7.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-8.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-9.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/monitor-2.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/mvc16.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/mvc5.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/mvc7.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-10.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-11.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-12.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-13.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-14.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-15.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-16.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-10.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-11.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-12.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-13.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-14.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-15.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-16.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-17.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-18.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-19.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-20.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-21.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-22.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-23.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-24.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-25.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-26.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-27.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-28.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-29.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-3.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-30.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-31.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-32.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-33.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-34.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-35.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-36.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-37.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-38.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-39.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-4.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-40.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-41.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-42.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-43.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-44.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-5.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-6.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-7.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-8.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pieces-memset-9.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100066.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100093.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100119.c28
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100182.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100310.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100342.c70
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100445-1.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100445.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100504.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100549.c108
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100582.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-1b.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-1w.c38
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-2b.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-2w.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-3b.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-3w.c96
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-4b.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-4w.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-5b.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100637-5w.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100660.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100701.c28
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100704-1.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100704-2.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100704-3.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100722.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-10a.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-10b.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-11a.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-11b.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-11c.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-12a.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-12b.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-12c.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-2.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-3.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-4a.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-4b.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-5a.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-5b.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-6a.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-6b.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-6c.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-7a.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-7b.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-7c.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-8a.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-8b.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-8c.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-9a.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-9b.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-9c.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100887.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100936.c34
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100951.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101021-1.c35
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101021-2.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101044.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101046.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101058.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101175.c28
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101248.c123
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101261.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101282.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101346.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101395-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101395-2.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101395-3.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101424.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101456-1.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101456-2.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101492-1.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101492-2.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101492-3.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101492-4.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101504.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101685.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101716.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101742a.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101742b.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101797.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101812.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101846-1.c95
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101846-2.c81
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101846-3.c73
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101846-4.c40
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101930.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101950-1.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101950-2.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101989-1.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101989-2.c102
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/pr102016.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr102021.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr11877-2.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/pr11877.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr43147.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr54400.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr54855-11.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr54855-12.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr54855-13.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr57655.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-6.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr70738-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr71245-1.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/pr71245-2.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/pr72839.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr78103-1.c28
-rw-r--r--gcc/testsuite/gcc.target/i386/pr78103-2.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/pr78103-3.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/pr79514.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82460-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82735-1.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82735-2.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82735-3.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82735-4.c48
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82735-5.c54
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82941-1.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82942-1.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-1.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-3.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-5.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85819-1a.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85819-1b.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85819-2a.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85819-2b.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85819-2c.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85819-3.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr86723.c52
-rw-r--r--gcc/testsuite/gcc.target/i386/pr88531-1a.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr88531-1b.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr88531-1c.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr88531-2a.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr88531-2b.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr88531-2c.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr89676.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr89984-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr89984-2.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-10.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-11.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-12.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-13.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-14.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-15.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-16.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-17.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-18.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-19.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-2.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-20.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-21.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-22.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-23.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-24.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-25.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-26.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-3.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-4.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-5.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-6.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-7.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-8.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-9.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr91103-1.c37
-rw-r--r--gcc/testsuite/gcc.target/i386/pr91103-2.c81
-rw-r--r--gcc/testsuite/gcc.target/i386/pr91400-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr91400-2.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr91446.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-avx2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-avx512bw-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-avx512bw-trunc.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-avx512f.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr92658-sse4.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr94147.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/pr94467-3.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95046-9.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95443-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95443-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95778-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95778-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr96696.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/pr96744-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97249-1.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97313.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97950.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98060.c47
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98218-1.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98218-1a.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98218-2.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98218-2a.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98218-3.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98218-3a.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98218-4.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98309-1.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98309-2.c39
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98365.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98434-1.c64
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98434-2.c129
-rw-r--r--gcc/testsuite/gcc.target/i386/pr98911.c116
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99405.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99591.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99726.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-1.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-2.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-3.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-4.c357
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-5.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-6.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-7.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99744-8.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99753.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99863.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99881.c49
-rw-r--r--gcc/testsuite/gcc.target/i386/pr99905.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/spill_to_mask-1.c89
-rw-r--r--gcc/testsuite/gcc.target/i386/spill_to_mask-2.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/spill_to_mask-3.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/spill_to_mask-4.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-13.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-14.c56
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-22.c58
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-23.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-pr101007.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-float16-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-float16-2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-float16-3.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-pr101059.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-pr39821.c45
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-pr94680.c91
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-psraq-1.c53
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-shiftqihi-constant-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse3-pr101059.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4-pr39821.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1a.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2.c45
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2a.c44
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/strncmp-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sw-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-addsub-2.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-addsub-3.c38
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-addsubv2df.c42
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-addsubv4df.c36
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-addsubv4sf.c46
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-addsubv8sf.c46
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-10.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-11.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-12.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-2.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-3.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-4.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-5.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-6.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-7.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-8.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-float16-9.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXpd.c34
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXps.c34
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXpd.c34
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXps.c34
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-gather-1.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-reduc-1.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/vect8-ret.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/vperm-v2hi.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/vperm-v4qi.c47
-rw-r--r--gcc/testsuite/gcc.target/i386/xorsign-avx.c4
-rw-r--r--gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/mips.exp2
-rw-r--r--gcc/testsuite/gcc.target/mips/pr100760.c10
-rw-r--r--gcc/testsuite/gcc.target/mips/pr100761.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/pr100762.c25
-rw-r--r--gcc/testsuite/gcc.target/mips/pr101132.c14
-rw-r--r--gcc/testsuite/gcc.target/mips/pr101922.c19
-rw-r--r--gcc/testsuite/gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c231
-rw-r--r--gcc/testsuite/gcc.target/powerpc/div-vectorize-1.c46
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.h22
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.h22
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-1.c54
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-2.c56
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-call.c27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-cmove.c58
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-minmax-3.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-minmax.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-div-longlong.c7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-char.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-float.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-int.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-short.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-char.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-float.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-int.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-short.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-mult-longlong.c7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-splat-floatdouble.c7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-splat-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-char.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-float.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-int.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-short.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-char.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-float.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-int.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-short.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-char.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-float.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-int.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-short.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fp128_conversions.c294
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c214
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c38
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c78
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c93
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fusion-p10-stst.c31
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fusion-p10-stst2.c30
-rw-r--r--gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c2370
-rw-r--r--gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c24
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c26
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mma-builtin-8.c27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mma-builtin-9.c28
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mod-vectorize.c46
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mul-vectorize-1.c27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mul-vectorize-2.c27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mul-vectorize-3.c32
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mul-vectorize-4.c33
-rw-r--r--gcc/testsuite/gcc.target/powerpc/not-promote-mode.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.h40
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-run-1.c48
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p10-vdivq-vmodq.c27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-fpcvt-3.c23
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c128
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-inc-di.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-di.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-hi.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-qi.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-sf.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-si.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-vector.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-di.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-hi.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-qi.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-sf.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-si.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-vector.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c30
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c12
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr100085.c25
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr100777.c24
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr101129.c36
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr101384-1.c79
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr101384-2.c79
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr101596-1.c30
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr101596-2.c30
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr101596-3.c58
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr101849.c22
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr56605.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr61837.c20
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr70117.c24
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79251.p7.c23
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79251.p8.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79251.p9.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr81348.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr93658.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr97142.c35
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr98914.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr98952.c28
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr99557.c53
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr99581.c17
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pragma-optimize.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/rop-1.c17
-rw-r--r--gcc/testsuite/gcc.target/powerpc/rop-2.c17
-rw-r--r--gcc/testsuite/gcc.target/powerpc/rop-3.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/rop-4.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/rop-5.c14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-blendpd.c89
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-blendps-2.c81
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-blendps.c90
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-blendvpd.c65
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c51
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c41
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c119
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c95
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-check.h4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c51
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c41
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c119
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c95
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-phminposuw.c68
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-ptest-1.c117
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h20
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-round.h27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h27
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c36
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c36
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.h14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.c12
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.h7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.h7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-1.c24
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-2.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-3.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/unpack-vectorize.h42
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-perm-ctor-run.c124
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.h163
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c29
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c11
-rw-r--r--gcc/testsuite/gcc.target/riscv/arch-12.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/attribute-19.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/pr99702.c7
-rw-r--r--gcc/testsuite/gcc.target/riscv/shift-shift-5.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/ashr.c11
-rw-r--r--gcc/testsuite/gcc.target/s390/call-z10-pic-nodatarel.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/call-z10-pic.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/call-z10.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/call-z9-pic-nodatarel.c18
-rw-r--r--gcc/testsuite/gcc.target/s390/call-z9-pic.c18
-rw-r--r--gcc/testsuite/gcc.target/s390/call-z9.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/call.h40
-rw-r--r--gcc/testsuite/gcc.target/s390/global-array-element-pic2.c5
-rw-r--r--gcc/testsuite/gcc.target/s390/load-imm64-1.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/load-imm64-2.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/mfentry-m64-pic.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/mnop-mcount-m31-mzarch.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/mnop-mcount-m64.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/nodatarel-1.c26
-rw-r--r--gcc/testsuite/gcc.target/s390/oscbreak-1.c5
-rw-r--r--gcc/testsuite/gcc.target/s390/pr80080-4.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/pr99663.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/risbg-ll-3.c6
-rw-r--r--gcc/testsuite/gcc.target/s390/tls-pic.c14
-rw-r--r--gcc/testsuite/gcc.target/s390/tls.c10
-rw-r--r--gcc/testsuite/gcc.target/s390/tls.h23
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c26
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c33
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c31
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-off-on.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-on-off.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/perm-merge.c104
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/perm-vpdi.c49
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c41
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c41
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vec-types.h35
-rw-r--r--gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c50
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c26
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec-doublee.c22
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec-floate.c23
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec-types.h37
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec_merge.c88
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c45
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec_permi.c66
-rw-r--r--gcc/testsuite/gcc.target/tic6x/rotdi16-scan.c8
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/abi-avx512fp16-xmm.exp48
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/args.h190
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S81
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-check.h74
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-xmm-check.h3
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/defines.h166
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/abi-avx512fp16-ymm.exp45
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/args.h182
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S81
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/avx512fp16-ymm-check.h3
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_m256_returning.c54
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_m256.c370
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_structs.c113
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_unions.c337
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_varargs-m256.c160
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/abi-avx512fp16-zmm.exp48
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/args.h186
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S97
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/avx512fp16-zmm-check.h4
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_m512_returning.c62
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_m512.c380
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_structs.c123
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_unions.c415
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_varargs-m512.c164
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/macros.h53
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_3_element_struct_and_unions.c794
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_alignment.c45
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_array_size_and_align.c43
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_returning.c87
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_sizes.c43
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_struct_size_and_align.c42
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_union_size_and_align.c40
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_complex_returning.c104
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_m64m128_returning.c73
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_floats.c1066
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_m64m128.c510
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_structs.c332
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_unions.c335
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_struct_returning.c274
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_varargs-m128.c164
-rw-r--r--gcc/testsuite/gdc.dg/attr_allocsize1.d44
-rw-r--r--gcc/testsuite/gdc.dg/attr_allocsize2.d13
-rw-r--r--gcc/testsuite/gdc.dg/attr_alwaysinline1.d17
-rw-r--r--gcc/testsuite/gdc.dg/attr_cold1.d13
-rw-r--r--gcc/testsuite/gdc.dg/attr_exclusions1.d19
-rw-r--r--gcc/testsuite/gdc.dg/attr_exclusions2.d19
-rw-r--r--gcc/testsuite/gdc.dg/attr_flatten1.d21
-rw-r--r--gcc/testsuite/gdc.dg/attr_module.d40
-rw-r--r--gcc/testsuite/gdc.dg/attr_noclone1.d12
-rw-r--r--gcc/testsuite/gdc.dg/attr_noicf1.d30
-rw-r--r--gcc/testsuite/gdc.dg/attr_noinline1.d19
-rw-r--r--gcc/testsuite/gdc.dg/attr_noipa1.d17
-rw-r--r--gcc/testsuite/gdc.dg/attr_noplt1.d13
-rw-r--r--gcc/testsuite/gdc.dg/attr_optimize1.d48
-rw-r--r--gcc/testsuite/gdc.dg/attr_optimize2.d9
-rw-r--r--gcc/testsuite/gdc.dg/attr_optimize3.d19
-rw-r--r--gcc/testsuite/gdc.dg/attr_optimize4.d45
-rw-r--r--gcc/testsuite/gdc.dg/attr_restrict1.d18
-rw-r--r--gcc/testsuite/gdc.dg/attr_section1.d23
-rw-r--r--gcc/testsuite/gdc.dg/attr_symver1.d24
-rw-r--r--gcc/testsuite/gdc.dg/attr_target1.d20
-rw-r--r--gcc/testsuite/gdc.dg/attr_targetclones1.d12
-rw-r--r--gcc/testsuite/gdc.dg/attr_used1.d16
-rw-r--r--gcc/testsuite/gdc.dg/attr_used2.d16
-rw-r--r--gcc/testsuite/gdc.dg/attr_weak1.d14
-rw-r--r--gcc/testsuite/gdc.dg/extern-c++/extern-c++.exp (renamed from gcc/testsuite/brig.dg/dg.exp)26
-rw-r--r--gcc/testsuite/gdc.dg/extern-c++/pr101664.d15
-rw-r--r--gcc/testsuite/gdc.dg/extern-c++/pr101664_1.cc10
-rw-r--r--gcc/testsuite/gdc.dg/gdc108.d4
-rw-r--r--gcc/testsuite/gdc.dg/gdc142.d2
-rw-r--r--gcc/testsuite/gdc.dg/gdc270a.d11
-rw-r--r--gcc/testsuite/gdc.dg/gdc270b.d7
-rw-r--r--gcc/testsuite/gdc.dg/imports/attributes.d28
-rw-r--r--gcc/testsuite/gdc.dg/lto/pr102094_0.d18
-rw-r--r--gcc/testsuite/gdc.dg/pr100882a.d35
-rw-r--r--gcc/testsuite/gdc.dg/pr100882b.d19
-rw-r--r--gcc/testsuite/gdc.dg/pr100882c.d25
-rw-r--r--gcc/testsuite/gdc.dg/pr100967.d11
-rw-r--r--gcc/testsuite/gdc.dg/pr101127a.d8
-rw-r--r--gcc/testsuite/gdc.dg/pr101127b.d7
-rw-r--r--gcc/testsuite/gdc.dg/pr101490.d21
-rw-r--r--gcc/testsuite/gdc.dg/pr101640.d11
-rw-r--r--gcc/testsuite/gdc.dg/pr101657.d14
-rw-r--r--gcc/testsuite/gdc.dg/pr101672.d19
-rw-r--r--gcc/testsuite/gdc.dg/pr102185.d7
-rw-r--r--gcc/testsuite/gdc.dg/pr90136a.d4
-rw-r--r--gcc/testsuite/gdc.dg/pr90136b.d2
-rw-r--r--gcc/testsuite/gdc.dg/pr90136c.d6
-rw-r--r--gcc/testsuite/gdc.dg/pr95173.d2
-rw-r--r--gcc/testsuite/gdc.dg/pr96429.d2
-rw-r--r--gcc/testsuite/gdc.dg/pr98457.d9
-rw-r--r--gcc/testsuite/gdc.dg/pr99914.d5
-rw-r--r--gcc/testsuite/gdc.dg/torture/pr100882.d21
-rw-r--r--gcc/testsuite/gdc.dg/torture/pr101273.d39
-rw-r--r--gcc/testsuite/gdc.dg/torture/pr101282.d23
-rw-r--r--gcc/testsuite/gdc.dg/torture/pr96435.d21
-rw-r--r--gcc/testsuite/gdc.test/compilable/aggr_alignment.d20
-rw-r--r--gcc/testsuite/gdc.test/compilable/b19002.d12
-rw-r--r--gcc/testsuite/gdc.test/compilable/betterCarray.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/bug20796.d2
-rw-r--r--gcc/testsuite/gdc.test/compilable/cppmangle.d18
-rw-r--r--gcc/testsuite/gdc.test/compilable/ddocunittest.d1
-rw-r--r--gcc/testsuite/gdc.test/compilable/extra-files/minimal/object.d1
-rw-r--r--gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d8
-rw-r--r--gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d12
-rw-r--r--gcc/testsuite/gdc.test/compilable/fix21585.d24
-rw-r--r--gcc/testsuite/gdc.test/compilable/fix21647.d30
-rw-r--r--gcc/testsuite/gdc.test/compilable/ice10598.d3
-rw-r--r--gcc/testsuite/gdc.test/compilable/ice10770.d5
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/issue21614a.d22
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d4
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d4
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d0
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d0
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d0
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d0
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test20530a.d0
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test21501b.d7
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test21501c.d4
-rw-r--r--gcc/testsuite/gdc.test/compilable/interpret5.d30
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue16020.d39
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue16044.d9
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue20915.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue21614.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue21726.d2
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue21813a.d13
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue21813b.d13
-rw-r--r--gcc/testsuite/gdc.test/compilable/minimal3.d36
-rw-r--r--gcc/testsuite/gdc.test/compilable/mixintype.d55
-rw-r--r--gcc/testsuite/gdc.test/compilable/mixintype2.d68
-rw-r--r--gcc/testsuite/gdc.test/compilable/noreturn1.d21
-rw-r--r--gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d5
-rw-r--r--gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d7
-rw-r--r--gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d1
-rw-r--r--gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d6
-rw-r--r--gcc/testsuite/gdc.test/compilable/staticforeach.d38
-rw-r--r--gcc/testsuite/gdc.test/compilable/test16002.d3
-rw-r--r--gcc/testsuite/gdc.test/compilable/test17991.d3
-rw-r--r--gcc/testsuite/gdc.test/compilable/test19145.d14
-rw-r--r--gcc/testsuite/gdc.test/compilable/test19292.d15
-rw-r--r--gcc/testsuite/gdc.test/compilable/test20151a.d3
-rw-r--r--gcc/testsuite/gdc.test/compilable/test20280.d8
-rw-r--r--gcc/testsuite/gdc.test/compilable/test20530.d46
-rw-r--r--gcc/testsuite/gdc.test/compilable/test20537.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/test20692.d18
-rw-r--r--gcc/testsuite/gdc.test/compilable/test20894.d46
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21501a.d19
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21742.d13
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21812.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21898.d7
-rw-r--r--gcc/testsuite/gdc.test/compilable/test22006.d14
-rw-r--r--gcc/testsuite/gdc.test/compilable/test22133.d16
-rw-r--r--gcc/testsuite/gdc.test/compilable/test9029.d39
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/b12504.d64
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/bug15613.d18
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/bug16165.d18
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/bug9631.d100
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/chkformat.d171
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/cppmangle.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag11819b.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag13082.d6
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag16271.d12
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag16976.d69
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag19196.d16
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag8101.d47
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag8101b.d17
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag9420.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/enum_init.d171
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail109.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail11038.d17
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail11445.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail117.d6
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail15361.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail15896.d18
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail17630.d15
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail18219.d20
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail19107.d21
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail22006.d22
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail22133.d24
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail22144.d14
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail263.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail3.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail322.d7
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail332.d45
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail347.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail53.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail55.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424b.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424c.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424d.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424e.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424f.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424g.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424h.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7424i.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail79.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail9766.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail99.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fix21585.d19
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/format.d44
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice10598.d10
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice10770.d13
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice10922.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice12497.d18
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice12501.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice14907.d22
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice14923.d5
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice8255.d5
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice8511.d13
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice9406.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice9540.d5
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d6
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d15
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d (renamed from gcc/testsuite/gdc.test/compilable/imports/ice10598a.d)0
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d (renamed from gcc/testsuite/gdc.test/compilable/imports/ice10598b.d)0
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/issue16020.d13
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/mixintype2.d16
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test16002.d15
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test16228.d17
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test20919.d13
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21651.d11
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21927.d20
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21939.d9
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/warn12809.d41
-rw-r--r--gcc/testsuite/gdc.test/runnable/funclit.d61
-rw-r--r--gcc/testsuite/gdc.test/runnable/mangle.d6
-rw-r--r--gcc/testsuite/gdc.test/runnable/noreturn1.d74
-rw-r--r--gcc/testsuite/gdc.test/runnable_cxx/cppa.d29
-rw-r--r--gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp4
-rw-r--r--gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp82
-rw-r--r--gcc/testsuite/gdc.test/runnable_cxx/test21515.d104
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c12
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f908
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c2
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c2
-rw-r--r--gcc/testsuite/gfortran.dg/PR100094.f9037
-rw-r--r--gcc/testsuite/gfortran.dg/PR100120.f90198
-rw-r--r--gcc/testsuite/gfortran.dg/PR10018.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/PR100911.c82
-rw-r--r--gcc/testsuite/gfortran.dg/PR100911.f90282
-rw-r--r--gcc/testsuite/gfortran.dg/PR100914.c226
-rw-r--r--gcc/testsuite/gfortran.dg/PR100914.f90651
-rw-r--r--gcc/testsuite/gfortran.dg/PR100915.c80
-rw-r--r--gcc/testsuite/gfortran.dg/PR100915.f90272
-rw-r--r--gcc/testsuite/gfortran.dg/PR82376.f9060
-rw-r--r--gcc/testsuite/gfortran.dg/PR93308.f9052
-rw-r--r--gcc/testsuite/gfortran.dg/PR93963.f90150
-rw-r--r--gcc/testsuite/gfortran.dg/PR94327.c70
-rw-r--r--gcc/testsuite/gfortran.dg/PR94327.f90195
-rw-r--r--gcc/testsuite/gfortran.dg/PR94331.c73
-rw-r--r--gcc/testsuite/gfortran.dg/PR94331.f90252
-rw-r--r--gcc/testsuite/gfortran.dg/PR97046.f9058
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_stat.f908
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_stat_3.f9071
-rw-r--r--gcc/testsuite/gfortran.dg/analyzer/pr97668.f2
-rw-r--r--gcc/testsuite/gfortran.dg/argument_checking_25.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/array_constructor_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_array_params_2.f905
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c2
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_char_10.f90480
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_char_6.f90260
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_char_7.f90260
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_char_8.f90249
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_char_9.f90207
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_contiguous.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/bounds_check_22.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/bounds_check_23.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy-c.c54
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy.f9098
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/allocatable-optional-pointer.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/allocate-c.c168
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/allocate-errors-c.c109
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/allocate.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-1.f9031
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-2.f9048
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-3.f9051
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-4.f9050
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-5.f9031
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-6.f9048
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-7.f9051
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-8.f9050
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f9084
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c-interop.exp57
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c1255-1.f9083
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c1255-2.f90106
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c1255a.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c407a-1.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c407a-2.f9088
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c407b-1.f90107
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90150
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c407c-1.f9063
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c516.f9067
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c524a.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535a-1.f9065
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535a-2.f9078
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535b-1.f90333
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535b-2.f90387
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535b-3.f9079
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535c-1.f9087
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535c-2.f9074
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535c-3.f9073
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c535c-4.f9073
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1-c.c91
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1.f9066
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2-c.c91
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2.f9082
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3-c.c92
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3.f9058
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4-c.c112
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4.f9073
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c36
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5.f9031
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6-c.c81
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6.f9072
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7-c.c81
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7.f9074
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8-c.c73
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8.f9078
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1-c.c87
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1.f90174
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2-c.c87
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2.f90157
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3-c.c108
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3.f90134
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4-c.c175
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4.f90207
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5-c.c31
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5.f9048
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6-c.c42
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6.f90115
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/contiguous-1-c.c56
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/contiguous-1.f9067
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/contiguous-2-c.c113
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/contiguous-2.f90152
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/contiguous-3-c.c80
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/contiguous-3.f90171
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/deferred-character-1.f9076
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.c195
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.h12
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/establish-c.c134
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/establish-errors-c.c120
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/establish-errors.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/establish.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/explicit-interface.f9060
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1-c.c46
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2-c.c68
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3-c.c42
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3.f9037
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4-c.c57
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4.f9036
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5-c.c28
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6-c.c51
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6.f9050
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7-c.c46
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7.f9037
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8-c.c20
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9-c.c42
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1-c.c52
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1.f9066
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2-c.c52
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2.f9066
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3-c.c71
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3.f9059
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4-c.c96
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4.f9075
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5-c.c30
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6-c.c50
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6.f9049
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7-c.c136
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7.f9071
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-1.f90123
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-2.f9097
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-3.f90148
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-4.f90198
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-5.f9061
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-6.f9071
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-7.f9089
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/note-5-3.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/note-5-4-c.c10
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/note-5-4.f9063
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/optional-c.c82
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/optional.f90114
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/rank-class.f9088
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/rank.f9099
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-1.f9041
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-2.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-3.f9037
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-4.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-1-c.c135
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-1.f9071
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-1p.f9075
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-2-c.c175
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-2.f90102
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-2p.f90104
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-3-c.c235
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-3.f90103
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-3p.f90127
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-4-c.c101
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-4.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-errors-c.c149
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/section-errors.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/select-c.c138
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/select-errors-c.c125
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/select-errors.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/select.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/setpointer-c.c78
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/setpointer-errors-c.c127
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/setpointer.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/shape.f9077
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/size.f90106
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/tkr.f9046
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic-c.c169
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic.f90151
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char-c.c35
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char.f9037
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128-c.c38
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128-c.c40
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble-c.c37
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity-c.c179
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic-c.c168
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic.f90160
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128-c.c38
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128-c.c41
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble-c.c37
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/ubound.f90129
-rw-r--r--gcc/testsuite/gfortran.dg/char4-subscript.f902
-rw-r--r--gcc/testsuite/gfortran.dg/character_workout_1.f90689
-rw-r--r--gcc/testsuite/gfortran.dg/character_workout_4.f90689
-rw-r--r--gcc/testsuite/gfortran.dg/class_dummy_6.f9065
-rw-r--r--gcc/testsuite/gfortran.dg/class_dummy_7.f9060
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/dummy_2.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_3.f904
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_48.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_collectives_17.f9042
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_sync.f9044
-rw-r--r--gcc/testsuite/gfortran.dg/entry_24.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_nonchar_3.f907
-rw-r--r--gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/goacc-gomp/mixed-1.f23
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/asyncwait-1.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/attach-descriptor.f906
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f9511
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-kernels.f9511
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-parallel.f9511
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-routine-nohost.f9539
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-routine.f9518
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-serial.f9514
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/default-2.f32
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/enter-exit-data.f954
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/finalize-1.f12
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/host_data-tree.f954
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/if.f9512
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f955
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-tree.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/omp-fixed.f10
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/omp.f9512
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/parallel-kernels-clauses.f9516
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/parallel-tree.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/pr78027.f904
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/private-3.f957
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f9057
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f9048
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f9056
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f9047
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/pure-elemental-procedures-2.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-4.f909
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-6.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f26
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f10
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f906
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-module-1.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-module-2.f906
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-module-3.f9043
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f9064
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f9069
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-2.f90147
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/sie.f9520
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/update-if_present-2.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/affinity-1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/affinity-clause-1.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/affinity-clause-2.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/affinity-clause-3.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/affinity-clause-4.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/affinity-clause-5.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/affinity-clause-6.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/cancel-1.f90539
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/cancel-2.f904
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/cancel-4.f909
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/class-firstprivate-1.f9062
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/class-firstprivate-2.f9054
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/class-firstprivate-3.f9061
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/class-firstprivate-4.f9044
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/defaultmap-1.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/defaultmap-2.f90108
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/defaultmap-3.f9060
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/defaultmap-4.f90141
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/defaultmap-5.f90145
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/defaultmap-6.f90104
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/defaultmap-7.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depend-iterator-1.f9045
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f9044
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depend-iterator-3.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depobj-1.f9025
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depobj-2.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/error-1.f9051
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/error-2.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/error-3.f9088
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/flush-1.f908
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/flush-2.f909
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/implicit-save.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/loop-1.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/loop-2.f9044
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/loop-3.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/loop-4.f90279
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/map-5.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/map-6.f9050
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/map-7.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/map-8.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/masked-1.f9094
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/masked-2.f9046
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/masked-3.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/masked-combined-1.f9065
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/masked-combined-2.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nesting-1.f9068
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nesting-2.f90165
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nesting-3.f90347
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nothing-1.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nothing-2.f907
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nowait-1.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/openmp-simd-6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f909
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr100965.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-1.f90239
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-11.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-2.f90233
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-3.f90139
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-4.f9090
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-5.f90108
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-6.f90108
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr99928-8.f90253
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/reduction-task-1.f90112
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/reduction-task-2.f9045
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/reduction-task-2a.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/reduction-task-3.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/reduction4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/reduction5.f904
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/reduction7.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/scan-1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/scan-5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/scope-1.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/scope-2.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-1.f9067
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-2.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-2.f9092
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-3.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/taskloop-1.f90126
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/taskloop-2.f9072
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/taskwait.f907
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/workshare-59.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/goto_9.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/ieee_6.f901
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/ieee_8.f904
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_11.f902
-rw-r--r--gcc/testsuite/gfortran.dg/implied_do_io_7.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/inline_matmul_25.f909
-rw-r--r--gcc/testsuite/gfortran.dg/inline_matmul_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/inquiry_type_ref_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/iso_c_binding_char_1.f903
-rw-r--r--gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c2
-rw-r--r--gcc/testsuite/gfortran.dg/longnames.f9092
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_bounds_9.f902
-rw-r--r--gcc/testsuite/gfortran.dg/min0_max0_1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/min0_max0_2.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/null_11.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_26.f034
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_31.f0326
-rw-r--r--gcc/testsuite/gfortran.dg/pointer_check_14.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/pr100154.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/pr100551.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/pr100949.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/pr100950.f9065
-rw-r--r--gcc/testsuite/gfortran.dg/pr101026.f11
-rw-r--r--gcc/testsuite/gfortran.dg/pr101121.f203
-rw-r--r--gcc/testsuite/gfortran.dg/pr101158.f9025
-rw-r--r--gcc/testsuite/gfortran.dg/pr101264.f9094
-rw-r--r--gcc/testsuite/gfortran.dg/pr101267.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/pr101327.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/pr101514.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/pr101536.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/pr32599.f038
-rw-r--r--gcc/testsuite/gfortran.dg/pr63797.f9060
-rw-r--r--gcc/testsuite/gfortran.dg/pr78033.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr82314.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/pr93524.c33
-rw-r--r--gcc/testsuite/gfortran.dg/pr93524.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/pr95502.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr96325.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr96711.f906
-rw-r--r--gcc/testsuite/gfortran.dg/pr98411.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/pr99602.f9094
-rw-r--r--gcc/testsuite/gfortran.dg/pr99602a.f9093
-rw-r--r--gcc/testsuite/gfortran.dg/pr99602b.f9064
-rw-r--r--gcc/testsuite/gfortran.dg/pr99602c.f9025
-rw-r--r--gcc/testsuite/gfortran.dg/pr99602d.f9025
-rw-r--r--gcc/testsuite/gfortran.dg/pr99956.f45
-rw-r--r--gcc/testsuite/gfortran.dg/ptr-func-4.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/set_vm_limit.c13
-rw-r--r--gcc/testsuite/gfortran.dg/substr_10.f90 (renamed from gcc/testsuite/substr_10.f90)0
-rw-r--r--gcc/testsuite/gfortran.dg/substr_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/substr_9.f90 (renamed from gcc/testsuite/substr_9.f90)0
-rw-r--r--gcc/testsuite/gfortran.dg/transpose_5.f908
-rw-r--r--gcc/testsuite/gfortran.dg/ubsan/pr101624.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/ubsan/ubsan.exp38
-rw-r--r--gcc/testsuite/gfortran.dg/unlimited_polymorphic_33.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr100981-1.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr99656.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr99721.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr99746.f9045
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr99807.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr99825.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr99924.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/vect/vect-8.f904
-rw-r--r--gcc/testsuite/gnat.dg/bit_packed_array6.adb10
-rw-r--r--gcc/testsuite/gnat.dg/bit_packed_array6_pkg.ads13
-rw-r--r--gcc/testsuite/gnat.dg/containers2.adb158
-rw-r--r--gcc/testsuite/gnat.dg/debug11.adb20
-rw-r--r--gcc/testsuite/gnat.dg/debug16.adb8
-rw-r--r--gcc/testsuite/gnat.dg/debug17.adb25
-rw-r--r--gcc/testsuite/gnat.dg/debug18.adb20
-rw-r--r--gcc/testsuite/gnat.dg/debug8.adb8
-rw-r--r--gcc/testsuite/gnat.dg/derived_type7.adb9
-rw-r--r--gcc/testsuite/gnat.dg/derived_type7.ads13
-rw-r--r--gcc/testsuite/gnat.dg/inline22.adb19
-rw-r--r--gcc/testsuite/gnat.dg/limited4.adb13
-rw-r--r--gcc/testsuite/gnat.dg/lto21.adb1
-rw-r--r--gcc/testsuite/gnat.dg/opt92.adb38
-rw-r--r--gcc/testsuite/gnat.dg/opt93.adb20
-rw-r--r--gcc/testsuite/gnat.dg/opt93.ads14
-rw-r--r--gcc/testsuite/gnat.dg/opt94.adb17
-rw-r--r--gcc/testsuite/gnat.dg/opt94_pkg.adb31
-rw-r--r--gcc/testsuite/gnat.dg/opt94_pkg.ads11
-rw-r--r--gcc/testsuite/gnat.dg/opt95.adb40
-rw-r--r--gcc/testsuite/gnat.dg/specs/debug1.ads3
-rw-r--r--gcc/testsuite/gnat.dg/specs/opt5.ads25
-rw-r--r--gcc/testsuite/gnat.dg/specs/opt5_pkg.ads17
-rw-r--r--gcc/testsuite/gnat.dg/unchecked_convert5.adb2
-rw-r--r--gcc/testsuite/gnat.dg/unchecked_convert6.adb2
-rw-r--r--gcc/testsuite/go.test/test/convert4.go86
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/issue22200b.go2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/issue6036.go2
-rw-r--r--gcc/testsuite/go.test/test/unsafebuiltins.go64
-rw-r--r--gcc/testsuite/jit.dg/all-non-failing-tests.h10
-rw-r--r--gcc/testsuite/jit.dg/harness.h2
-rw-r--r--gcc/testsuite/jit.dg/jit.exp35
-rw-r--r--gcc/testsuite/jit.dg/test-asm.c15
-rw-r--r--gcc/testsuite/jit.dg/test-asm.cc14
-rw-r--r--gcc/testsuite/jit.dg/test-cast.c66
-rw-r--r--gcc/testsuite/jit.dg/test-debuginfo.c72
-rw-r--r--gcc/testsuite/jit.dg/test-error-array-bounds.c2
-rw-r--r--gcc/testsuite/jit.dg/test-vector-rvalues.cc8
-rw-r--r--gcc/testsuite/jit.dg/test-vector-types.cc8
-rw-r--r--gcc/testsuite/lib/brig-dg.exp29
-rw-r--r--gcc/testsuite/lib/brig.exp40
-rw-r--r--gcc/testsuite/lib/dg-pch.exp4
-rw-r--r--gcc/testsuite/lib/gcc-defs.exp96
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp91
-rw-r--r--gcc/testsuite/lib/gcc.exp3
-rw-r--r--gcc/testsuite/lib/gdc-utils.exp85
-rw-r--r--gcc/testsuite/lib/gfortran.exp8
-rw-r--r--gcc/testsuite/lib/lto.exp25
-rw-r--r--gcc/testsuite/lib/profopt.exp6
-rw-r--r--gcc/testsuite/lib/prune.exp7
-rw-r--r--gcc/testsuite/lib/scanasm.exp2
-rw-r--r--gcc/testsuite/lib/target-supports-dg.exp10
-rw-r--r--gcc/testsuite/lib/target-supports.exp408
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-unavailable-1.mm34
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-unavailable-2.mm24
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-unavailable-3.mm22
-rw-r--r--gcc/testsuite/obj-c++.dg/pr101666-0.mm7
-rw-r--r--gcc/testsuite/obj-c++.dg/pr101666-1.mm10
-rw-r--r--gcc/testsuite/obj-c++.dg/pr101666.inc29
-rw-r--r--gcc/testsuite/obj-c++.dg/pr49070.mm52
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-unavailable-1.mm38
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-unavailable-2.mm26
-rw-r--r--gcc/testsuite/obj-c++.dg/property/dotsyntax-unavailable-1.mm42
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-unavailable-1.m34
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-unavailable-2.m24
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-unavailable-3.m22
-rw-r--r--gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c2
-rw-r--r--gcc/testsuite/objc.dg/pr101666-0.m7
-rw-r--r--gcc/testsuite/objc.dg/pr101666-1.m10
-rw-r--r--gcc/testsuite/objc.dg/pr101666.inc29
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-unavailable-1.m39
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-unavailable-2.m26
-rw-r--r--gcc/testsuite/objc.dg/property/dotsyntax-unavailable-1.m42
-rw-r--r--gcc/testsuite/objc.dg/unnamed-parms.m28
3690 files changed, 125982 insertions, 4113 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5e6b536..137382c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9812 @@
+2021-09-12 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/102185
+ * gdc.dg/pr102185.d: New test.
+
+2021-09-11 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/auto-init-1.c: Enable test only on ilp32 or lp64
+ targets, expect different long and pointer sizes between ilp32 and
+ lp64.
+ * c-c++-common/auto-init-2.c: Likewise.
+ * c-c++-common/auto-init-3.c: Expect one of the common long double
+ sizes (8/12/16 bytes) instead of hardcoding 16 bytes.
+ * c-c++-common/auto-init-4.c: Likewise.
+ * c-c++-common/auto-init-5.c: Expect one of the common
+ _Complex long double sizes (16/24/32 bytes) instead of hardcoding 32
+ bytes.
+ * c-c++-common/auto-init-6.c: Likewise.
+ * c-c++-common/auto-init-padding-1.c: Enable test only on ilp32 or lp64
+ targets.
+ (struct test_small_hole): Change type of four to unsigned long long
+ and add aligned attribute.
+
+2021-09-10 Petter Tomner <tomner@kth.se>
+
+ * jit.dg/test-error-array-bounds.c: Array is not unsigned
+ * jit.dg/jit.exp: Helper function
+ * jit.dg/test-debuginfo.c: New testcase
+
+2021-09-10 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/atomic-17.c (foo): Add tests for atomic read,
+ write or update with acq_rel clause and atomic update with acquire clause.
+ * c-c++-common/gomp/atomic-18.c (foo): Adjust expected diagnostics
+ wording, remove tests moved to atomic-17.c.
+ * c-c++-common/gomp/atomic-21.c: Expect only 2 omp atomic release and
+ 2 omp atomic acq_rel directives instead of 4 omp atomic release.
+ * c-c++-common/gomp/atomic-25.c: New test.
+ * c-c++-common/gomp/atomic-26.c: New test.
+ * c-c++-common/gomp/atomic-27.c: New test.
+ * c-c++-common/gomp/atomic-28.c: New test.
+ * c-c++-common/gomp/atomic-29.c: New test.
+ * c-c++-common/gomp/atomic-30.c: New test.
+ * c-c++-common/goacc-gomp/atomic.c: Expect 1 omp atomic release and
+ 1 omp atomic_acq_rel instead of 2 omp atomic release directives.
+ * gcc.dg/gomp/atomic-5.c: Adjust expected error diagnostic wording.
+ * g++.dg/gomp/atomic-18.C:Expect 4 omp atomic release and
+ 1 omp atomic_acq_rel instead of 5 omp atomic release directives.
+
+2021-09-10 Aldy Hernandez <aldyh@redhat.com>
+ Michael Matz <matz@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-dom-thread-2b.c: Adjust for disabling of
+ threading through latches.
+ * gcc.dg/tree-ssa/ssa-dom-thread-6.c: Same.
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Same.
+
+2021-09-10 David Faust <david.faust@oracle.com>
+
+ * gcc.target/bpf/alu-1.c: New test.
+ * gcc.target/bpf/jmp-1.c: New test.
+
+2021-09-10 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/102273
+ * gcc.dg/pr102273.c: New testcase.
+
+2021-09-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/auto-init-padding-2.c: Fix 'dg-do run' syntax.
+ * c-c++-common/auto-init-padding-3.c: Likewise.
+
+2021-09-10 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/102269
+ * gcc.dg/pr102269.c: New testcase.
+
+2021-09-10 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512fp16-helper.h
+ (check_results_mask): New check_function.
+ * gcc.target/i386/avx512fp16-vcmpph-1a.c: New test.
+ * gcc.target/i386/avx512fp16-vcmpph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vcmpsh-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vcmpsh-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vcomish-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vcomish-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vcomish-1c.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vcmpph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vcmpph-1b.c: Ditto.
+
+2021-09-10 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx-1.c: Add test for new builtins.
+ * gcc.target/i386/sse-13.c: Ditto.
+ * gcc.target/i386/sse-23.c: Ditto.
+ * gcc.target/i386/sse-14.c: Add test for new intrinsics.
+ * gcc.target/i386/sse-22.c: Ditto.
+
+2021-09-10 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512fp16-vmaxph-1a.c: New test.
+ * gcc.target/i386/avx512fp16-vmaxph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vmaxsh-1.c: Ditto.
+ * gcc.target/i386/avx512fp16-vmaxsh-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vminph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vminph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vminsh-1.c: Ditto.
+ * gcc.target/i386/avx512fp16-vminsh-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vmaxph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vmaxph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vminph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vminph-1b.c: Ditto.
+
+2021-09-10 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx-1.c: Add test for new builtins.
+ * gcc.target/i386/sse-13.c: Ditto.
+ * gcc.target/i386/sse-23.c: Ditto.
+ * gcc.target/i386/sse-14.c: Add test for new intrinsics.
+ * gcc.target/i386/sse-22.c: Ditto.
+
+2021-09-10 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512fp16-vaddsh-1a.c: New test.
+ * gcc.target/i386/avx512fp16-vaddsh-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vdivsh-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vdivsh-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vmulsh-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vmulsh-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vsubsh-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vsubsh-1b.c: Ditto.
+ * gcc.target/i386/pr54855-11.c: Ditto.
+
+2021-09-10 Liu, Hongtao <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx-1.c: Add test for new builtins.
+ * gcc.target/i386/sse-13.c: Ditto.
+ * gcc.target/i386/sse-23.c: Ditto.
+ * gcc.target/i386/sse-14.c: Add test for new intrinsics.
+ * gcc.target/i386/sse-22.c: Ditto.
+
+2021-09-10 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/vect-float16-1.c: New test.
+ * gcc.target/i386/vect-float16-10.c: Ditto.
+ * gcc.target/i386/vect-float16-11.c: Ditto.
+ * gcc.target/i386/vect-float16-12.c: Ditto.
+ * gcc.target/i386/vect-float16-2.c: Ditto.
+ * gcc.target/i386/vect-float16-3.c: Ditto.
+ * gcc.target/i386/vect-float16-4.c: Ditto.
+ * gcc.target/i386/vect-float16-5.c: Ditto.
+ * gcc.target/i386/vect-float16-6.c: Ditto.
+ * gcc.target/i386/vect-float16-7.c: Ditto.
+ * gcc.target/i386/vect-float16-8.c: Ditto.
+ * gcc.target/i386/vect-float16-9.c: Ditto.
+
+2021-09-10 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512dq-abs-copysign-1.c: Adjust testcase.
+ * gcc.target/i386/avx512vl-abs-copysign-1.c: Adjust testcase.
+
+2021-09-09 qing zhao <qing.zhao@oracle.com>
+
+ * c-c++-common/auto-init-1.c: New test.
+ * c-c++-common/auto-init-10.c: New test.
+ * c-c++-common/auto-init-11.c: New test.
+ * c-c++-common/auto-init-12.c: New test.
+ * c-c++-common/auto-init-13.c: New test.
+ * c-c++-common/auto-init-14.c: New test.
+ * c-c++-common/auto-init-15.c: New test.
+ * c-c++-common/auto-init-16.c: New test.
+ * c-c++-common/auto-init-2.c: New test.
+ * c-c++-common/auto-init-3.c: New test.
+ * c-c++-common/auto-init-4.c: New test.
+ * c-c++-common/auto-init-5.c: New test.
+ * c-c++-common/auto-init-6.c: New test.
+ * c-c++-common/auto-init-7.c: New test.
+ * c-c++-common/auto-init-8.c: New test.
+ * c-c++-common/auto-init-9.c: New test.
+ * c-c++-common/auto-init-esra.c: New test.
+ * c-c++-common/auto-init-padding-1.c: New test.
+ * c-c++-common/auto-init-padding-2.c: New test.
+ * c-c++-common/auto-init-padding-3.c: New test.
+ * g++.dg/auto-init-uninit-pred-1_a.C: New test.
+ * g++.dg/auto-init-uninit-pred-2_a.C: New test.
+ * g++.dg/auto-init-uninit-pred-3_a.C: New test.
+ * g++.dg/auto-init-uninit-pred-4.C: New test.
+ * gcc.dg/auto-init-sra-1.c: New test.
+ * gcc.dg/auto-init-sra-2.c: New test.
+ * gcc.dg/auto-init-uninit-1.c: New test.
+ * gcc.dg/auto-init-uninit-12.c: New test.
+ * gcc.dg/auto-init-uninit-13.c: New test.
+ * gcc.dg/auto-init-uninit-14.c: New test.
+ * gcc.dg/auto-init-uninit-15.c: New test.
+ * gcc.dg/auto-init-uninit-16.c: New test.
+ * gcc.dg/auto-init-uninit-17.c: New test.
+ * gcc.dg/auto-init-uninit-18.c: New test.
+ * gcc.dg/auto-init-uninit-19.c: New test.
+ * gcc.dg/auto-init-uninit-2.c: New test.
+ * gcc.dg/auto-init-uninit-20.c: New test.
+ * gcc.dg/auto-init-uninit-21.c: New test.
+ * gcc.dg/auto-init-uninit-22.c: New test.
+ * gcc.dg/auto-init-uninit-23.c: New test.
+ * gcc.dg/auto-init-uninit-24.c: New test.
+ * gcc.dg/auto-init-uninit-25.c: New test.
+ * gcc.dg/auto-init-uninit-26.c: New test.
+ * gcc.dg/auto-init-uninit-3.c: New test.
+ * gcc.dg/auto-init-uninit-34.c: New test.
+ * gcc.dg/auto-init-uninit-36.c: New test.
+ * gcc.dg/auto-init-uninit-37.c: New test.
+ * gcc.dg/auto-init-uninit-4.c: New test.
+ * gcc.dg/auto-init-uninit-5.c: New test.
+ * gcc.dg/auto-init-uninit-6.c: New test.
+ * gcc.dg/auto-init-uninit-8.c: New test.
+ * gcc.dg/auto-init-uninit-9.c: New test.
+ * gcc.dg/auto-init-uninit-A.c: New test.
+ * gcc.dg/auto-init-uninit-B.c: New test.
+ * gcc.dg/auto-init-uninit-C.c: New test.
+ * gcc.dg/auto-init-uninit-H.c: New test.
+ * gcc.dg/auto-init-uninit-I.c: New test.
+ * gcc.target/aarch64/auto-init-1.c: New test.
+ * gcc.target/aarch64/auto-init-2.c: New test.
+ * gcc.target/aarch64/auto-init-3.c: New test.
+ * gcc.target/aarch64/auto-init-4.c: New test.
+ * gcc.target/aarch64/auto-init-5.c: New test.
+ * gcc.target/aarch64/auto-init-6.c: New test.
+ * gcc.target/aarch64/auto-init-7.c: New test.
+ * gcc.target/aarch64/auto-init-8.c: New test.
+ * gcc.target/aarch64/auto-init-padding-1.c: New test.
+ * gcc.target/aarch64/auto-init-padding-10.c: New test.
+ * gcc.target/aarch64/auto-init-padding-11.c: New test.
+ * gcc.target/aarch64/auto-init-padding-12.c: New test.
+ * gcc.target/aarch64/auto-init-padding-2.c: New test.
+ * gcc.target/aarch64/auto-init-padding-3.c: New test.
+ * gcc.target/aarch64/auto-init-padding-4.c: New test.
+ * gcc.target/aarch64/auto-init-padding-5.c: New test.
+ * gcc.target/aarch64/auto-init-padding-6.c: New test.
+ * gcc.target/aarch64/auto-init-padding-7.c: New test.
+ * gcc.target/aarch64/auto-init-padding-8.c: New test.
+ * gcc.target/aarch64/auto-init-padding-9.c: New test.
+ * gcc.target/i386/auto-init-1.c: New test.
+ * gcc.target/i386/auto-init-2.c: New test.
+ * gcc.target/i386/auto-init-21.c: New test.
+ * gcc.target/i386/auto-init-22.c: New test.
+ * gcc.target/i386/auto-init-23.c: New test.
+ * gcc.target/i386/auto-init-24.c: New test.
+ * gcc.target/i386/auto-init-3.c: New test.
+ * gcc.target/i386/auto-init-4.c: New test.
+ * gcc.target/i386/auto-init-5.c: New test.
+ * gcc.target/i386/auto-init-6.c: New test.
+ * gcc.target/i386/auto-init-7.c: New test.
+ * gcc.target/i386/auto-init-8.c: New test.
+ * gcc.target/i386/auto-init-padding-1.c: New test.
+ * gcc.target/i386/auto-init-padding-10.c: New test.
+ * gcc.target/i386/auto-init-padding-11.c: New test.
+ * gcc.target/i386/auto-init-padding-12.c: New test.
+ * gcc.target/i386/auto-init-padding-2.c: New test.
+ * gcc.target/i386/auto-init-padding-3.c: New test.
+ * gcc.target/i386/auto-init-padding-4.c: New test.
+ * gcc.target/i386/auto-init-padding-5.c: New test.
+ * gcc.target/i386/auto-init-padding-6.c: New test.
+ * gcc.target/i386/auto-init-padding-7.c: New test.
+ * gcc.target/i386/auto-init-padding-8.c: New test.
+ * gcc.target/i386/auto-init-padding-9.c: New test.
+
+2021-09-09 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/98490
+ * gfortran.dg/bounds_check_23.f90: New test.
+
+2021-09-09 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/x86_64/abi/avx512fp16/args.h: Replace long with
+ long long.
+ (XMM_T): Rename _long to _longlong and _ulong to _ulonglong.
+ (X87_T): Rename _ulong to _ulonglong.
+ * gcc.target/x86_64/abi/avx512fp16/defines.h (TYPE_SIZE_LONG):
+ Define to 4 if __ILP32__ is defined.
+ (TYPE_SIZE_POINTER): Likewise.
+ (TYPE_ALIGN_LONG): Likewise.
+ (TYPE_ALIGN_POINTER): Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_3_element_struct_and_unions.c
+ (main): Skip test for long if __ILP32__ is defined.
+ * gcc.target/x86_64/abi/avx512fp16/test_m64m128_returning.c
+ (do_test): Replace _long with _longlong.
+ * gcc.target/x86_64/abi/avx512fp16/test_struct_returning.c:
+ (check_300): Replace _ulong with _ulonglong.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/args.h: Replace long
+ with long long.
+ (YMM_T): Rename _long to _longlong and _ulong to _ulonglong.
+ (X87_T): Rename _ulong to _ulonglong.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/args.h: Replace long
+ with long long.
+ (ZMM_T): Rename _long to _longlong and _ulong to _ulonglong.
+ (X87_T): Rename _ulong to _ulonglong.
+
+2021-09-09 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-lim-17.c: New testcase.
+
+2021-09-09 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512fp16-helper.h: New header file for
+ FP16 runtime test.
+ * gcc.target/i386/avx512fp16-vaddph-1a.c: New test.
+ * gcc.target/i386/avx512fp16-vaddph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vdivph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vdivph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vmulph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vmulph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-vsubph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-vsubph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vaddph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vaddph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vdivph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vdivph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vmulph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vmulph-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vsubph-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16vl-vsubph-1b.c: Ditto.
+
+2021-09-09 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx-1.c: Add -mavx512vl and test for new intrinsics.
+ * gcc.target/i386/avx-2.c: Add -mavx512vl.
+ * gcc.target/i386/avx512fp16-11a.c: New test.
+ * gcc.target/i386/avx512fp16-11b.c: Ditto.
+ * gcc.target/i386/avx512vlfp16-11a.c: Ditto.
+ * gcc.target/i386/avx512vlfp16-11b.c: Ditto.
+ * gcc.target/i386/sse-13.c: Add test for new builtins.
+ * gcc.target/i386/sse-23.c: Ditto.
+ * gcc.target/i386/sse-14.c: Add test for new intrinsics.
+ * gcc.target/i386/sse-22.c: Ditto.
+
+2021-09-09 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101059
+ * gcc.target/i386/sse2-pr101059.c: New test.
+ * gcc.target/i386/sse3-pr101059.c: New test.
+
+2021-09-09 liuhongt <hongtao.liu@intel.com>
+
+ PR target/91103
+ * gcc.target/i386/pr91103-1.c: New test.
+ * gcc.target/i386/pr91103-2.c: New test.
+
+2021-09-08 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/102225
+ * gcc.dg/analyzer/realloc-1.c (test_10): New.
+ * gcc.dg/analyzer/torture/pr102225.c: New test.
+
+2021-09-08 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/array-quals-1.c: Allow .sdata section in more cases.
+
+2021-09-08 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/tree-ssa/pr89430-1.c, gcc.dg/tree-ssa/pr89430-2.c,
+ gcc.dg/tree-ssa/pr89430-3.c, gcc.dg/tree-ssa/pr89430-4.c,
+ gcc.dg/tree-ssa/pr89430-5.c, gcc.dg/tree-ssa/pr89430-6.c,
+ gcc.dg/tree-ssa/pr89430-7-comp-ref.c,
+ gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c,
+ gcc.dg/tree-ssa/pr99473-1.c: Use -ftree-cselim.
+
+2021-09-08 Jakub Jelinek <jakub@redhat.com>
+ liuhongt <hongtao.liu@intel.com>
+
+ PR target/89984
+ * gcc.target/i386/avx-pr102224.c: Fix up PR number.
+ * gcc.dg/pr89984.c: New test.
+ * gcc.target/i386/avx-pr89984.c: New test.
+
+2021-09-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/102224
+ * gcc.dg/pr102224.c: New test.
+ * gcc.target/i386/avx-pr102224.c: New test.
+
+2021-09-08 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/x86_64/abi/avx512fp16/m512h/abi-avx512fp16-zmm.exp:
+ New file.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/args.h: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/avx512fp16-zmm-check.h:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/test_m512_returning.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_m512.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_structs.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_unions.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m512h/test_varargs-m512.c:
+ Likewise.
+
+2021-09-08 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/x86_64/abi/avx512fp16/m256h/abi-avx512fp16-ymm.exp:
+ New exp file.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/args.h: New header.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/avx512fp16-ymm-check.h:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S: New.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/test_m256_returning.c:
+ New test.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_m256.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_structs.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_unions.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/m256h/test_varargs-m256.c: Likewise.
+
+2021-09-08 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/x86_64/abi/avx512fp16/abi-avx512fp16-xmm.exp: New exp
+ file for abi test.
+ * gcc.target/x86_64/abi/avx512fp16/args.h: New header file for abi test.
+ * gcc.target/x86_64/abi/avx512fp16/avx512fp16-check.h: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/avx512fp16-xmm-check.h: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/defines.h: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/macros.h: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/asm-support.S: New asm for abi check.
+ * gcc.target/x86_64/abi/avx512fp16/test_3_element_struct_and_unions.c:
+ New test.
+ * gcc.target/x86_64/abi/avx512fp16/test_basic_alignment.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_basic_array_size_and_align.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_basic_returning.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_basic_sizes.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_basic_struct_size_and_align.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_basic_union_size_and_align.c:
+ Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_complex_returning.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_m64m128_returning.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_passing_floats.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_passing_m64m128.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_passing_structs.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_passing_unions.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_struct_returning.c: Likewise.
+ * gcc.target/x86_64/abi/avx512fp16/test_varargs-m128.c: Likewise.
+
+2021-09-08 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/avx512fp16-vararg-1.c: New test.
+ * gcc.target/i386/avx512fp16-vararg-2.c: Ditto.
+ * gcc.target/i386/avx512fp16-vararg-3.c: Ditto.
+ * gcc.target/i386/avx512fp16-vararg-4.c: Ditto.
+
+2021-09-08 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/m512-check.h: Add union128h, union256h, union512h.
+ * gcc.target/i386/avx512fp16-10a.c: New test.
+ * gcc.target/i386/avx512fp16-10b.c: Ditto.
+ * gcc.target/i386/avx512fp16-1a.c: Ditto.
+ * gcc.target/i386/avx512fp16-1b.c: Ditto.
+ * gcc.target/i386/avx512fp16-1c.c: Ditto.
+ * gcc.target/i386/avx512fp16-1d.c: Ditto.
+ * gcc.target/i386/avx512fp16-1e.c: Ditto.
+ * gcc.target/i386/avx512fp16-2a.c: Ditto.
+ * gcc.target/i386/avx512fp16-2b.c: Ditto.
+ * gcc.target/i386/avx512fp16-2c.c: Ditto.
+ * gcc.target/i386/avx512fp16-3a.c: Ditto.
+ * gcc.target/i386/avx512fp16-3b.c: Ditto.
+ * gcc.target/i386/avx512fp16-3c.c: Ditto.
+ * gcc.target/i386/avx512fp16-4.c: Ditto.
+ * gcc.target/i386/avx512fp16-5.c: Ditto.
+ * gcc.target/i386/avx512fp16-6.c: Ditto.
+ * gcc.target/i386/avx512fp16-7.c: Ditto.
+ * gcc.target/i386/avx512fp16-8.c: Ditto.
+ * gcc.target/i386/avx512fp16-9a.c: Ditto.
+ * gcc.target/i386/avx512fp16-9b.c: Ditto.
+ * gcc.target/i386/pr54855-13.c: Ditto.
+ * gcc.target/i386/avx512fp16-vec_set_var.c: Ditto.
+
+2021-09-08 Guo, Xuepeng <xuepeng.guo@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+ Liu Hongtao <hongtao.liu@intel.com>
+ Wang Hongyu <hongyu.wang@intel.com>
+ Xu Dianhong <dianhong.xu@intel.com>
+
+ * gcc.target/i386/avx-1.c: Add -mavx512fp16 in dg-options.
+ * gcc.target/i386/avx-2.c: Ditto.
+ * gcc.target/i386/avx512-check.h: Check cpuid for AVX512FP16.
+ * gcc.target/i386/funcspec-56.inc: Add new target attribute check.
+ * gcc.target/i386/sse-13.c: Add -mavx512fp16.
+ * gcc.target/i386/sse-14.c: Ditto.
+ * gcc.target/i386/sse-22.c: Ditto.
+ * gcc.target/i386/sse-23.c: Ditto.
+ * lib/target-supports.exp: (check_effective_target_avx512fp16): New.
+ * g++.target/i386/float16-1.C: New test.
+ * g++.target/i386/float16-2.C: Ditto.
+ * g++.target/i386/float16-3.C: Ditto.
+ * gcc.target/i386/avx512fp16-12a.c: Ditto.
+ * gcc.target/i386/avx512fp16-12b.c: Ditto.
+ * gcc.target/i386/float16-3a.c: Ditto.
+ * gcc.target/i386/float16-3b.c: Ditto.
+ * gcc.target/i386/float16-4a.c: Ditto.
+ * gcc.target/i386/float16-4b.c: Ditto.
+ * gcc.target/i386/pr54855-12.c: Ditto.
+ * g++.dg/other/i386-2.C: Ditto.
+ * g++.dg/other/i386-3.C: Ditto.
+
+2021-09-08 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/float16-6.c: New test.
+ * gcc.target/i386/float16-7.c: New test.
+
+2021-09-07 David Faust <david.faust@oracle.com>
+
+ * gcc.target/bpf/core-attr-1.c: New test.
+ * gcc.target/bpf/core-attr-2.c: Likewise.
+ * gcc.target/bpf/core-attr-3.c: Likewise.
+ * gcc.target/bpf/core-attr-4.c: Likewise
+ * gcc.target/bpf/core-builtin-1.c: Likewise
+ * gcc.target/bpf/core-builtin-2.c: Likewise.
+ * gcc.target/bpf/core-builtin-3.c: Likewise.
+ * gcc.target/bpf/core-section-1.c: Likewise.
+
+2021-09-07 Hans-Peter Nilsson <hp@axis.com>
+
+ * gcc.dg/no_profile_instrument_function-attr-2.c: Fix
+ typo in last change.
+
+2021-09-07 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101327
+ * gfortran.dg/pr101327.f90: New test.
+
+2021-09-07 Indu Bhagat <indu.bhagat@oracle.com>
+
+ * gcc.target/bpf/core-lto-1.c: New test.
+
+2021-09-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100495
+ * g++.dg/cpp2a/constexpr-new21.C: New test.
+
+2021-09-07 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/85819
+ * gcc.target/i386/pr85819-1a.c: New test.
+ * gcc.target/i386/pr85819-1b.c: Likewise.
+ * gcc.target/i386/pr85819-2a.c: Likewise.
+ * gcc.target/i386/pr85819-2b.c: Likewise.
+ * gcc.target/i386/pr85819-2c.c: Likewise.
+ * gcc.target/i386/pr85819-3.c: Likewise.
+
+2021-09-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/102226
+ * g++.dg/vect/pr102226.cc: New testcase.
+
+2021-09-07 Marcel Vollweiler <marcel@codesourcery.com>
+
+ * c-c++-common/gomp/flush-1.c: Add test case for 'seq_cst'.
+ * c-c++-common/gomp/flush-2.c: Add test case for 'seq_cst'.
+ * g++.dg/gomp/attrs-1.C: Adapt test to handle all flush clauses.
+ * g++.dg/gomp/attrs-2.C: Adapt test to handle all flush clauses.
+ * gfortran.dg/gomp/flush-1.f90: Add test case for 'seq_cst'.
+ * gfortran.dg/gomp/flush-2.f90: Add test case for 'seq_cst'.
+
+2021-09-07 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/80223
+ * gcc.dg/no_profile_instrument_function-attr-2.c: New test.
+
+2021-09-07 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ PR target/97142
+ * gcc.target/powerpc/pr97142.c: New test.
+
+2021-09-06 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/89984
+ * gcc.target/i386/pr89984-1.c: New test.
+ * gcc.target/i386/pr89984-2.c: Likewise.
+ * gcc.target/i386/xorsign-avx.c: Likewise.
+
+2021-09-06 liuhongt <hongtao.liu@intel.com>
+
+ PR middle-end/102182
+ * gcc.target/i386/pr101282.c: New test.
+
+2021-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/102207
+ * gcc.dg/pr102207.c: New test.
+
+2021-09-06 Andrew Pinski <apinski@marvell.com>
+
+ PR tree-optimization/63184
+ * c-c++-common/pr19807-2.c: Enable for all targets and remove the xfail.
+ * c-c++-common/pr19807-3.c: Likewise.
+
+2021-09-03 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101904
+ * g++.dg/template/conv17.C: New test.
+
+2021-09-03 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/bind_c_char_6.f90: Update dg-error.
+ * gfortran.dg/bind_c_char_7.f90: Likewise.
+ * gfortran.dg/bind_c_char_8.f90: Likewise.
+ * gfortran.dg/iso_c_binding_char_1.f90: Likewise.
+ * gfortran.dg/pr32599.f03: Likewise.
+ * gfortran.dg/bind_c_char_9.f90: Comment testcase bits which are
+ implementable but not valid F2018.
+ * gfortran.dg/bind_c_contiguous.f90: New test.
+
+2021-09-03 liuhongt <hongtao.liu@intel.com>
+
+ PR target/102166
+ * g++.target/i386/pr102166.C: New test.
+
+2021-09-02 Sandra Loosemore <sandra@codesourcery.com>
+ José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/100911
+ PR fortran/100915
+ PR fortran/100916
+ * gfortran.dg/PR100911.c: New file.
+ * gfortran.dg/PR100911.f90: New file.
+ * gfortran.dg/PR100914.c: New file.
+ * gfortran.dg/PR100914.f90: New file.
+ * gfortran.dg/PR100915.c: New file.
+ * gfortran.dg/PR100915.f90: New file.
+
+2021-09-02 Sandra Loosemore <sandra@codesourcery.com>
+
+ * gfortran.dg/c-interop/allocatable-dummy-c.c: New file.
+ * gfortran.dg/c-interop/allocatable-dummy.f90: New file.
+ * gfortran.dg/c-interop/allocatable-optional-pointer.f90: New file.
+ * gfortran.dg/c-interop/allocate-c.c: New file.
+ * gfortran.dg/c-interop/allocate-errors-c.c: New file.
+ * gfortran.dg/c-interop/allocate-errors.f90: New file.
+ * gfortran.dg/c-interop/allocate.f90: New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-1.f90:
+ New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-2.f90:
+ New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-3.f90:
+ New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-4.f90:
+ New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-5.f90:
+ New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-6.f90:
+ New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-7.f90:
+ New file.
+ * gfortran.dg/c-interop/argument-association-assumed-rank-8.f90:
+ New file.
+ * gfortran.dg/c-interop/assumed-type-dummy.f90: New file.
+ * gfortran.dg/c-interop/c-interop.exp: New file.
+ * gfortran.dg/c-interop/c1255-1.f90: New file.
+ * gfortran.dg/c-interop/c1255-2.f90: New file.
+ * gfortran.dg/c-interop/c1255a.f90: New file.
+ * gfortran.dg/c-interop/c407a-1.f90: New file.
+ * gfortran.dg/c-interop/c407a-2.f90: New file.
+ * gfortran.dg/c-interop/c407b-1.f90: New file.
+ * gfortran.dg/c-interop/c407b-2.f90: New file.
+ * gfortran.dg/c-interop/c407c-1.f90: New file.
+ * gfortran.dg/c-interop/c516.f90: New file.
+ * gfortran.dg/c-interop/c524a.f90: New file.
+ * gfortran.dg/c-interop/c535a-1.f90: New file.
+ * gfortran.dg/c-interop/c535a-2.f90: New file.
+ * gfortran.dg/c-interop/c535b-1.f90: New file.
+ * gfortran.dg/c-interop/c535b-2.f90: New file.
+ * gfortran.dg/c-interop/c535b-3.f90: New file.
+ * gfortran.dg/c-interop/c535c-1.f90: New file.
+ * gfortran.dg/c-interop/c535c-2.f90: New file.
+ * gfortran.dg/c-interop/c535c-3.f90: New file.
+ * gfortran.dg/c-interop/c535c-4.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-1-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-1.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-2-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-2.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-3-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-3.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-4-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-4.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-5-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-5.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-6-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-6.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-7-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-7.f90: New file.
+ * gfortran.dg/c-interop/cf-descriptor-8-c.c: New file.
+ * gfortran.dg/c-interop/cf-descriptor-8.f90: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-1-c.c: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-1.f90: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-2-c.c: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-2.f90: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-3-c.c: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-3.f90: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-4-c.c: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-4.f90: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-5-c.c: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-5.f90: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-6-c.c: New file.
+ * gfortran.dg/c-interop/cf-out-descriptor-6.f90: New file.
+ * gfortran.dg/c-interop/contiguous-1-c.c: New file.
+ * gfortran.dg/c-interop/contiguous-1.f90: New file.
+ * gfortran.dg/c-interop/contiguous-2-c.c: New file.
+ * gfortran.dg/c-interop/contiguous-2.f90: New file.
+ * gfortran.dg/c-interop/contiguous-3-c.c: New file.
+ * gfortran.dg/c-interop/contiguous-3.f90: New file.
+ * gfortran.dg/c-interop/deferred-character-1.f90: New file.
+ * gfortran.dg/c-interop/deferred-character-2.f90: New file.
+ * gfortran.dg/c-interop/dump-descriptors.c: New file.
+ * gfortran.dg/c-interop/dump-descriptors.h: New file.
+ * gfortran.dg/c-interop/establish-c.c: New file.
+ * gfortran.dg/c-interop/establish-errors-c.c: New file.
+ * gfortran.dg/c-interop/establish-errors.f90: New file.
+ * gfortran.dg/c-interop/establish.f90: New file.
+ * gfortran.dg/c-interop/explicit-interface.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-1-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-1.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-2-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-2.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-3-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-3.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-4-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-4.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-5-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-5.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-6-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-6.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-7-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-7.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-8-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-8.f90: New file.
+ * gfortran.dg/c-interop/fc-descriptor-9-c.c: New file.
+ * gfortran.dg/c-interop/fc-descriptor-9.f90: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-1-c.c: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-1.f90: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-2-c.c: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-2.f90: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-3-c.c: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-3.f90: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-4-c.c: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-4.f90: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-5-c.c: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-5.f90: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-6-c.c: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-6.f90: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-7-c.c: New file.
+ * gfortran.dg/c-interop/fc-out-descriptor-7.f90: New file.
+ * gfortran.dg/c-interop/ff-descriptor-1.f90: New file.
+ * gfortran.dg/c-interop/ff-descriptor-2.f90: New file.
+ * gfortran.dg/c-interop/ff-descriptor-3.f90: New file.
+ * gfortran.dg/c-interop/ff-descriptor-4.f90: New file.
+ * gfortran.dg/c-interop/ff-descriptor-5.f90: New file.
+ * gfortran.dg/c-interop/ff-descriptor-6.f90: New file.
+ * gfortran.dg/c-interop/ff-descriptor-7.f90: New file.
+ * gfortran.dg/c-interop/note-5-3.f90: New file.
+ * gfortran.dg/c-interop/note-5-4-c.c: New file.
+ * gfortran.dg/c-interop/note-5-4.f90: New file.
+ * gfortran.dg/c-interop/optional-c.c: New file.
+ * gfortran.dg/c-interop/optional.f90: New file.
+ * gfortran.dg/c-interop/rank-class.f90: New file.
+ * gfortran.dg/c-interop/rank.f90: New file.
+ * gfortran.dg/c-interop/removed-restrictions-1.f90: New file.
+ * gfortran.dg/c-interop/removed-restrictions-2.f90: New file.
+ * gfortran.dg/c-interop/removed-restrictions-3.f90: New file.
+ * gfortran.dg/c-interop/removed-restrictions-4.f90: New file.
+ * gfortran.dg/c-interop/section-1-c.c: New file.
+ * gfortran.dg/c-interop/section-1.f90: New file.
+ * gfortran.dg/c-interop/section-1p.f90: New file.
+ * gfortran.dg/c-interop/section-2-c.c: New file.
+ * gfortran.dg/c-interop/section-2.f90: New file.
+ * gfortran.dg/c-interop/section-2p.f90: New file.
+ * gfortran.dg/c-interop/section-3-c.c: New file.
+ * gfortran.dg/c-interop/section-3.f90: New file.
+ * gfortran.dg/c-interop/section-3p.f90: New file.
+ * gfortran.dg/c-interop/section-4-c.c: New file.
+ * gfortran.dg/c-interop/section-4.f90: New file.
+ * gfortran.dg/c-interop/section-errors-c.c: New file.
+ * gfortran.dg/c-interop/section-errors.f90: New file.
+ * gfortran.dg/c-interop/select-c.c: New file.
+ * gfortran.dg/c-interop/select-errors-c.c: New file.
+ * gfortran.dg/c-interop/select-errors.f90: New file.
+ * gfortran.dg/c-interop/select.f90: New file.
+ * gfortran.dg/c-interop/setpointer-c.c: New file.
+ * gfortran.dg/c-interop/setpointer-errors-c.c: New file.
+ * gfortran.dg/c-interop/setpointer-errors.f90: New file.
+ * gfortran.dg/c-interop/setpointer.f90: New file.
+ * gfortran.dg/c-interop/shape.f90: New file.
+ * gfortran.dg/c-interop/size.f90: New file.
+ * gfortran.dg/c-interop/tkr.f90: New file.
+ * gfortran.dg/c-interop/typecodes-array-basic-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-array-basic.f90: New file.
+ * gfortran.dg/c-interop/typecodes-array-char-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-array-char.f90: New file.
+ * gfortran.dg/c-interop/typecodes-array-float128-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-array-float128.f90: New file.
+ * gfortran.dg/c-interop/typecodes-array-int128-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-array-int128.f90: New file.
+ * gfortran.dg/c-interop/typecodes-array-longdouble-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-array-longdouble.f90: New file.
+ * gfortran.dg/c-interop/typecodes-sanity-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-sanity.f90: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-basic-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-basic.f90: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-float128-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-float128.f90: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-int128-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-int128.f90: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-longdouble-c.c: New file.
+ * gfortran.dg/c-interop/typecodes-scalar-longdouble.f90: New file.
+ * gfortran.dg/c-interop/ubound.f90: New file.
+ * lib/target-supports.exp
+ (check_effective_target_fortran_real_c_float128): New function.
+
+2021-09-02 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/17506
+ PR testsuite/37182
+ * gcc.dg/diagnostic-tree-expr-ranges-2.c: Add expected output.
+ * gcc.dg/uninit-15-O0.c: Remove xfail.
+ * gcc.dg/uninit-15.c: Same.
+
+2021-09-02 Marcel Vollweiler <marcel@codesourcery.com>
+
+ * gfortran.dg/gomp/target-device-ancestor-4.f90: Comment out dg-final to avoid
+ UNRESOLVED.
+
+2021-09-02 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-lim-16.c: New testcase.
+
+2021-09-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/99591
+ * gcc.target/i386/pr99591.c: New test.
+ * gcc.target/i386/pr97950.c: Match or reject setb or jn?b instructions
+ together with seta or jn?a.
+
+2021-09-02 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/sse2-float16-1.c: New test.
+ * gcc.target/i386/sse2-float16-2.c: Ditto.
+ * gcc.target/i386/sse2-float16-3.c: Ditto.
+ * gcc.target/i386/float16-5.c: New test.
+
+2021-09-01 Jeff Law <jlaw@localhost.localdomain>
+
+ PR tree-optimization/102152
+ * gcc.dg/pr102152.c: New test
+
+2021-09-01 Andrew Pinski <apinski@marvell.com>
+
+ PR target/101934
+ * gcc.target/aarch64/memset-strict-align-1.c: New test.
+
+2021-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100977
+ * g++.dg/cpp23/normalize1.C: New test.
+ * g++.dg/cpp23/normalize2.C: New test.
+ * g++.dg/cpp23/normalize3.C: New test.
+ * g++.dg/cpp23/normalize4.C: New test.
+ * g++.dg/cpp23/normalize5.C: New test.
+ * g++.dg/cpp23/normalize6.C: New test.
+ * g++.dg/cpp23/normalize7.C: New test.
+ * g++.dg/cpp23/ucnid-1-utf8.C: New test.
+ * g++.dg/cpp23/ucnid-2-utf8.C: New test.
+ * gcc.dg/cpp/ucnid-4.c: Don't expect
+ "not valid at the start of an identifier" errors.
+ * gcc.dg/cpp/ucnid-4-utf8.c: Likewise.
+ * gcc.dg/cpp/ucnid-5-utf8.c: New test.
+
+2021-09-01 Andrew Pinski <apinski@marvell.com>
+
+ PR testsuite/51748
+ * gcc.misc-tests/linkage.exp: Add mips*-linux-* support.
+
+2021-09-01 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wstringop-overflow-11.c: Remove xfails.
+ * gcc.dg/Wstringop-overflow-12.c: Same.
+ * gcc.dg/Wstringop-overflow-43.c: Add xfails.
+ * gcc.dg/Wstringop-overflow-73.c: New test.
+
+2021-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/101488
+ * c-c++-common/cpp/va-opt-3.c: Adjust expected output.
+ * c-c++-common/cpp/va-opt-7.c: New test.
+
+2021-09-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/101592
+ * g++.dg/warn/Wlogical-op-3.C: New test.
+
+2021-09-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * g++.dg/ext/attr-unavailable-1.C: New test.
+ * g++.dg/ext/attr-unavailable-2.C: New test.
+ * g++.dg/ext/attr-unavailable-3.C: New test.
+ * g++.dg/ext/attr-unavailable-4.C: New test.
+ * g++.dg/ext/attr-unavailable-5.C: New test.
+ * g++.dg/ext/attr-unavailable-6.C: New test.
+ * g++.dg/ext/attr-unavailable-7.C: New test.
+ * g++.dg/ext/attr-unavailable-8.C: New test.
+ * g++.dg/ext/attr-unavailable-9.C: New test.
+ * gcc.dg/attr-unavailable-1.c: New test.
+ * gcc.dg/attr-unavailable-2.c: New test.
+ * gcc.dg/attr-unavailable-3.c: New test.
+ * gcc.dg/attr-unavailable-4.c: New test.
+ * gcc.dg/attr-unavailable-5.c: New test.
+ * gcc.dg/attr-unavailable-6.c: New test.
+ * obj-c++.dg/attributes/method-unavailable-1.mm: New test.
+ * obj-c++.dg/attributes/method-unavailable-2.mm: New test.
+ * obj-c++.dg/attributes/method-unavailable-3.mm: New test.
+ * obj-c++.dg/property/at-property-unavailable-1.mm: New test.
+ * obj-c++.dg/property/at-property-unavailable-2.mm: New test.
+ * obj-c++.dg/property/dotsyntax-unavailable-1.mm: New test.
+ * objc.dg/attributes/method-unavailable-1.m: New test.
+ * objc.dg/attributes/method-unavailable-2.m: New test.
+ * objc.dg/attributes/method-unavailable-3.m: New test.
+ * objc.dg/property/at-property-unavailable-1.m: New test.
+ * objc.dg/property/at-property-unavailable-2.m: New test.
+ * objc.dg/property/dotsyntax-unavailable-1.m: New test.
+
+2021-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/102124
+ * gcc.dg/torture/pr102124.c: New test.
+
+2021-09-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/93491
+ * gcc.dg/torture/pr93491.c: New testcase.
+ * gcc.dg/tree-ssa/pr88087.c: Change to valid PRE opportunity.
+
+2021-09-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/102139
+ * gcc.dg/torture/pr102139.c: New testcase.
+
+2021-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/102141
+ * gcc.dg/pr102141.c: New test.
+
+2021-09-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/102149
+ * gcc.dg/torture/pr102149.c: New testcase.
+
+2021-09-01 Roger Sayle <roger@nextmovesoftware.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ PR c/79412
+ * gcc.dg/pr79412.c: New test case.
+ * gcc.dg/typedef-var-2.c: Update expeted errors.
+
+2021-08-31 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100950
+ * gfortran.dg/pr100950.f90: Extend coverage.
+
+2021-08-31 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/12672
+ * g++.dg/cpp0x/decltype29.C: Adjust.
+ * g++.dg/template/error56.C: Adjust.
+ * g++.old-deja/g++.pt/unify6.C: Adjust.
+ * g++.dg/template/explicit-args7.C: New test.
+
+2021-08-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/92193
+ * g++.dg/diagnostic/static_assert4.C: New test.
+
+2021-08-31 Jeff Law <jlaw@localhost.localdomain>
+
+ * gcc.target/mips/mips.exp: Add tree-vrp to mips_option_group.
+ * gcc.target/mips/data-sym-multi-pool.c: Add -fno-tree-vrp.
+
+2021-08-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/101145
+ * gcc.dg/vect/pr101145.c: Use dg-additional-options with just -O3
+ instead of dg-options with -O3 -fdump-tree-vect-details.
+ * gcc.dg/vect/pr101145_1.c: Likewise.
+ * gcc.dg/vect/pr101145_2.c: Likewise.
+ * gcc.dg/vect/pr101145_3.c: Likewise.
+
+2021-08-31 Marcel Vollweiler <marcel@codesourcery.com>
+
+ * c-c++-common/gomp/target-device-1.c: New test.
+ * c-c++-common/gomp/target-device-2.c: New test.
+ * c-c++-common/gomp/target-device-ancestor-1.c: New test.
+ * c-c++-common/gomp/target-device-ancestor-2.c: New test.
+ * c-c++-common/gomp/target-device-ancestor-3.c: New test.
+ * c-c++-common/gomp/target-device-ancestor-4.c: New test.
+ * gfortran.dg/gomp/target-device-1.f90: New test.
+ * gfortran.dg/gomp/target-device-2.f90: New test.
+ * gfortran.dg/gomp/target-device-ancestor-1.f90: New test.
+ * gfortran.dg/gomp/target-device-ancestor-2.f90: New test.
+ * gfortran.dg/gomp/target-device-ancestor-3.f90: New test.
+ * gfortran.dg/gomp/target-device-ancestor-4.f90: New test.
+
+2021-08-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/102142
+ * g++.dg/torture/pr102142.C: New testcase.
+
+2021-08-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/102134
+ * gcc.c-torture/execute/pr102134.c: New test.
+
+2021-08-31 prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
+
+ * gcc.target/arm/pr51534.c: Adjust test-case for soft fp targets.
+
+2021-08-31 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/ipa/inline-8.c: Mark cmp and move as
+ static so they both bind local and available for
+ inlinine.
+
+2021-08-31 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512bw-vpcmpeqb-1.c: Adjust testcase.
+ * gcc.target/i386/avx512bw-vpcmpeqw-1.c: Ditto.
+ * gcc.target/i386/avx512bw-vpcmpgtb-1.c: Ditto.
+ * gcc.target/i386/avx512bw-vpcmpgtw-1.c: Ditto.
+ * gcc.target/i386/avx512f-vpcmpeqd-1.c: Ditto.
+ * gcc.target/i386/avx512f-vpcmpeqq-1.c: Ditto.
+ * gcc.target/i386/avx512f-vpcmpgtd-1.c: Ditto.
+ * gcc.target/i386/avx512f-vpcmpgtq-1.c: Ditto.
+ * gcc.target/i386/avx512vl-vpcmpeqd-1.c: Ditto.
+ * gcc.target/i386/avx512vl-vpcmpeqq-1.c: Ditto.
+ * gcc.target/i386/avx512vl-vpcmpgtd-1.c: Ditto.
+ * gcc.target/i386/avx512vl-vpcmpgtq-1.c: Ditto.
+ * gcc.target/i386/bitwise_mask_op-1.c: Ditto.
+ * gcc.target/i386/bitwise_mask_op-2.c: Ditto.
+
+2021-08-30 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/99260
+ * gcc.dg/analyzer/capacity-2.c: Update for changes to realloc
+ analysis.
+ * gcc.dg/analyzer/pr99193-1.c: Likewise.
+ * gcc.dg/analyzer/pr99193-3.c: Likewise.
+ * gcc.dg/analyzer/realloc-1.c: Likewise. Add test coverage for
+ realloc of non-heap pointer, realloc from mismatching allocator,
+ and realloc on a freed pointer.
+ * gcc.dg/analyzer/realloc-2.c: New test.
+
+2021-08-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/96286
+ * g++.dg/template/access2.C: Split struct A.
+
+2021-08-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/101460
+ * g++.dg/template/explicit-args6.C: New test.
+
+2021-08-30 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/102113
+ * gfortran.dg/goto_9.f90: New test.
+
+2021-08-30 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp2a/concepts-lambda14.C: Add expected warnings.
+
+2021-08-30 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101349
+ * gfortran.dg/unlimited_polymorphic_33.f90: New test.
+
+2021-08-30 Pat Haugen <pthaugen@linux.ibm.com>
+
+ * gcc.target/powerpc/fusion-p10-stst.c: New test.
+ * gcc.target/powerpc/fusion-p10-stst2.c: New test.
+
+2021-08-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/102094
+ * gdc.dg/lto/pr102094_0.d: New test.
+
+2021-08-29 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc.dg/analyzer/strndup-1.c: Skip for Darwin versions
+ without strndup support in libc.
+
+2021-08-28 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc.dg/tree-ssa/modref-9.c: New test.
+
+2021-08-28 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/87737
+ * gfortran.dg/entry_24.f90: New test.
+
+2021-08-27 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/float128-call.c: Update comments.
+
+2021-08-27 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/float128-call.c: Fix test for IEEE 128-bit
+ long double and power10.
+
+2021-08-27 Iain Sandoe <iain@sandoe.co.uk>
+
+ * lib/target-supports.exp: Exclude cctools assembler based on
+ GAS 1.38.
+
+2021-08-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/45178
+ * gcc.dg/tree-ssa/ssa-dce-3.c: Adjust testcase.
+
+2021-08-27 konglin1 <lingling.kong@intel.com>
+
+ PR target/101472
+ * gcc.target/i386/avx512f-pr101472.c: New test.
+ * gcc.target/i386/avx512vl-pr101472.c: New test.
+
+2021-08-27 Kewen Lin <linkw@linux.ibm.com>
+
+ * gcc.target/powerpc/dive-vectorize-1.c: New test.
+ * gcc.target/powerpc/dive-vectorize-1.h: New test.
+ * gcc.target/powerpc/dive-vectorize-2.c: New test.
+ * gcc.target/powerpc/dive-vectorize-2.h: New test.
+ * gcc.target/powerpc/dive-vectorize-run-1.c: New test.
+ * gcc.target/powerpc/dive-vectorize-run-2.c: New test.
+ * gcc.target/powerpc/p10-bifs-vectorize-1.c: New test.
+ * gcc.target/powerpc/p10-bifs-vectorize-1.h: New test.
+ * gcc.target/powerpc/p10-bifs-vectorize-run-1.c: New test.
+
+2021-08-27 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512f-vshufpd-1.c: Adjust testcase.
+ * gcc.target/i386/avx512f-vshufps-1.c: Adjust testcase.
+ * gcc.target/i386/pr43147.c: New test.
+
+2021-08-26 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.dg/tree-ssa/ssa-ccp-41.c: New test case.
+
+2021-08-26 Martin Liska <mliska@suse.cz>
+ Stefan Kneifel <stefan.kneifel@bluewin.ch>
+
+ * gcc.target/i386/mvc5.c: Scan assembly names.
+ * gcc.target/i386/mvc7.c: Likewise.
+ * gcc.target/i386/pr95778-1.c: Update scanned patterns.
+ * gcc.target/i386/pr95778-2.c: Likewise.
+
+2021-08-25 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/tree-ssa/evrp1.c: Add -details to dump option.
+ * gcc.dg/tree-ssa/evrp2.c: Same.
+ * gcc.dg/tree-ssa/evrp3.c: Same.
+ * gcc.dg/tree-ssa/evrp4.c: Same.
+ * gcc.dg/tree-ssa/evrp6.c: Same.
+ * gcc.dg/tree-ssa/pr64130.c: Same.
+
+2021-08-25 Michael Meissner <meissner@linux.ibm.com>
+
+ PR target/94630
+ * gcc.target/powerpc/pr70117.c: Specify that we need the long double
+ type to be IBM 128-bit. Remove the code to use __ibm128.
+ * c-c++-common/dfp/convert-bfp-11.c: Specify that we need the long
+ double type to be IBM 128-bit. Run the test at -O2 optimization.
+ * lib/target-supports.exp (add_options_for_long_double_ibm128): New
+ function.
+ (check_effective_target_long_double_ibm128): New function.
+ (add_options_for_long_double_ieee128): New function.
+ (check_effective_target_long_double_ieee128): New function.
+ (add_options_for_long_double_64bit): New function.
+ (check_effective_target_long_double_64bit): New function.
+
+2021-08-25 Andrew Pinski <apinski@marvell.com>
+
+ PR c++/66590
+ * g++.dg/warn/Wreturn-5.C: New test.
+
+2021-08-25 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc.dg/ipa/modref-1.c: Update testcase.
+ * gcc.dg/tree-ssa/modref-4.c: Update testcase.
+ * gcc.dg/tree-ssa/modref-8.c: New test.
+
+2021-08-25 Lewis Hyatt <lhyatt@gmail.com>
+
+ PR other/93067
+ * gcc.dg/diagnostic-input-charset-1.c: New test.
+ * gcc.dg/diagnostic-input-utf8-bom.c: New test.
+
+2021-08-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/102046
+ * gcc.dg/vect/pr102046.c: New testcase.
+
+2021-08-25 Hongyu Wang <hongyu.wang@intel.com>
+
+ PR target/101716
+ * gcc.target/i386/pr101716.c: New test.
+
+2021-08-25 Jiufu Guo <guojiufu@linux.ibm.com>
+
+ PR tree-optimization/101145
+ * gcc.dg/vect/pr101145.c: New test.
+ * gcc.dg/vect/pr101145.inc: New test.
+ * gcc.dg/vect/pr101145_1.c: New test.
+ * gcc.dg/vect/pr101145_2.c: New test.
+ * gcc.dg/vect/pr101145_3.c: New test.
+ * gcc.dg/vect/pr101145inf.c: New test.
+ * gcc.dg/vect/pr101145inf.inc: New test.
+ * gcc.dg/vect/pr101145inf_1.c: New test.
+
+2021-08-25 konglin1 <lingling.kong@intel.com>
+
+ PR target/101471
+ * gcc.target/i386/avx512f-pr101471.c: New test.
+
+2021-08-25 Kewen Lin <linkw@linux.ibm.com>
+
+ * gcc.target/powerpc/unpack-vectorize-1.c: New test.
+ * gcc.target/powerpc/unpack-vectorize-1.h: New test.
+ * gcc.target/powerpc/unpack-vectorize-2.c: New test.
+ * gcc.target/powerpc/unpack-vectorize-2.h: New test.
+ * gcc.target/powerpc/unpack-vectorize-3.c: New test.
+ * gcc.target/powerpc/unpack-vectorize-3.h: New test.
+ * gcc.target/powerpc/unpack-vectorize-run-1.c: New test.
+ * gcc.target/powerpc/unpack-vectorize-run-2.c: New test.
+ * gcc.target/powerpc/unpack-vectorize-run-3.c: New test.
+ * gcc.target/powerpc/unpack-vectorize.h: New test.
+
+2021-08-25 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101989
+ * gcc.target/i386/avx2-shiftqihi-constant-1.c: Add -mno-avx512f.
+ * gcc.target/i386/sse2-shiftqihi-constant-1.c: Add -mno-avx
+
+2021-08-24 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/98411
+ * gfortran.dg/pr98411.f90: Adjust testcase options to restrict to
+ F2008, and verify case of implicit SAVE.
+
+2021-08-24 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101600
+ PR middle-end/101977
+ * g++.dg/pr100574.C: Prune out valid warning.
+ * gcc.dg/pr20126.c: Same.
+ * gcc.dg/Wstringop-overread.c: Adjust text of expected warnings.
+ Add new instances.
+ * gcc.dg/warn-strnlen-no-nul.c: Same.
+ * g++.dg/warn/Warray-bounds-26.C: New test.
+ * gcc.dg/Warray-bounds-88.c: New test.
+
+2021-08-24 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/predict-1.c: Disable evrp.
+ * gcc.dg/tree-ssa/evrp-trans.c: New.
+
+2021-08-24 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/102021
+ * gcc.target/i386/pr100865-10b.c: Expect vzeroupper.
+ * gcc.target/i386/pr100865-4b.c: Likewise.
+ * gcc.target/i386/pr100865-6b.c: Expect vmovdqu and vzeroupper.
+ * gcc.target/i386/pr100865-7b.c: Likewise.
+ * gcc.target/i386/pr102021.c: New test.
+
+2021-08-24 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/102035
+ * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c: New test.
+ * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c: Likewise.
+ * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c: Likewise.
+ * gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c: Likewise.
+ * gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c: Likewise.
+ * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c: Likewise.
+ * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c: Likewise.
+ * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c: Likewise.
+
+2021-08-24 Richard Earnshaw <rearnsha@arm.com>
+
+ * lib/target-supports.exp (check_effective_target_arm_cmse_hw):
+ Check the CMSE feature register, rather than relying on the
+ SG operation causing an execution fault.
+
+2021-08-24 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101989
+ * gcc.target/i386/pr101989-broadcast-1.c: New test.
+
+2021-08-24 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101989
+ * gcc.target/i386/pr101989-1.c: New test.
+ * gcc.target/i386/pr101989-2.c: New test.
+ * gcc.target/i386/avx512bw-shiftqihi-constant-1.c: Adjust testcase.
+
+2021-08-24 Roger Sayle <roger@nextmovesoftware.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/102029
+ * gcc.dg/fold-convlshift-3.c: New test case.
+
+2021-08-23 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/switch.c: Remove xfail. Add various tests.
+ * gcc.dg/analyzer/torture/switch-2.c: New test.
+ * gcc.dg/analyzer/torture/switch-3.c: New test.
+ * gcc.dg/analyzer/torture/switch-4.c: New test.
+ * gcc.dg/analyzer/torture/switch-5.c: New test.
+
+2021-08-23 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101875
+ * gcc.dg/analyzer/pr101875.c: New test.
+
+2021-08-23 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101837
+ * gcc.dg/analyzer/pr101837.c: New test.
+
+2021-08-23 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101962
+ * gcc.dg/analyzer/data-model-23.c: New test.
+ * gcc.dg/analyzer/pr101962.c: New test.
+
+2021-08-23 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/data-model-22.c: New test.
+ * gcc.dg/analyzer/uninit-6.c: New test.
+ * gcc.dg/analyzer/uninit-6b.c: New test.
+
+2021-08-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc.dg/tree-ssa/modref-7.c: New test.
+
+2021-08-23 Richard Biener <rguenther@suse.de>
+
+ PR ipa/97565
+ * g++.dg/lto/pr97565_0.C: New testcase.
+ * g++.dg/lto/pr97565_1.C: Likewise.
+
+2021-08-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * g++.dg/tree-ssa/modref-1.C: Fix template.
+
+2021-08-23 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/goacc/asyncwait-1.f95: Update dg-error.
+ * gfortran.dg/goacc/default-2.f: Update dg-error.
+ * gfortran.dg/goacc/enter-exit-data.f95: Update dg-error.
+ * gfortran.dg/goacc/if.f95: Update dg-error.
+ * gfortran.dg/goacc/parallel-kernels-clauses.f95: Update dg-error.
+ * gfortran.dg/goacc/routine-6.f90: Update dg-error.
+ * gfortran.dg/goacc/sie.f95: Update dg-error.
+ * gfortran.dg/goacc/update-if_present-2.f90: Update dg-error.
+ * gfortran.dg/gomp/cancel-2.f90: Update dg-error.
+ * gfortran.dg/gomp/declare-simd-1.f90: Update dg-error.
+ * gfortran.dg/gomp/error-3.f90: Update dg-error.
+ * gfortran.dg/gomp/loop-2.f90: Update dg-error.
+ * gfortran.dg/gomp/masked-2.f90: Update dg-error.
+
+2021-08-23 Ankur Saini <arsenic@sourceware.org>
+
+ PR analyzer/102020
+ * gcc.dg/analyzer/malloc-callbacks.c : Fix faulty test.
+
+2021-08-23 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.dg/fold-convlshift-1.c: New test case.
+ * gcc.dg/fold-convlshift-2.c: New test case.
+
+2021-08-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/86723
+ * gcc.dg/pr86723.c: New test.
+ * gcc.target/i386/pr86723.c: New test.
+ * gcc.dg/optimize-bswapdi-1.c: Use -fdump-tree-optimized instead of
+ -fdump-tree-bswap and scan for number of __builtin_bswap64 calls.
+ * gcc.dg/optimize-bswapdi-2.c: Likewise.
+ * gcc.dg/optimize-bswapsi-1.c: Use -fdump-tree-optimized instead of
+ -fdump-tree-bswap and scan for number of __builtin_bswap32 calls.
+ * gcc.dg/optimize-bswapsi-5.c: Likewise.
+ * gcc.dg/optimize-bswapsi-3.c: Likewise. Expect one __builtin_bswap32
+ call instead of zero.
+
+2021-08-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/79334
+ * gcc.dg/torture/pr79334-0.c: New testcase.
+ * gcc.dg/torture/pr79334-1.c: Likewise.
+
+2021-08-23 liuhongt <hongtao.liu@intel.com>
+
+ PR target/102016
+ * gcc.target/i386/pr102016.c: New test.
+
+2021-08-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/101905
+ * gcc.dg/guality/pr101905.c: New test.
+
+2021-08-23 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ PR target/100856
+ * gcc.target/arm/acle/pr100856.c: Use arm_v8m_main_cde_multilib
+ and arm_v8m_main_cde.
+ * lib/target-supports.exp: Add
+ check_effective_target_FUNC_multilib for ARM CDE.
+
+2021-08-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * g++.dg/tree-ssa/modref-1.C: New test.
+
+2021-08-23 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ PR target/101922
+ * gcc.target/mips/pr101922.c: New test.
+
+2021-08-23 Jonathan Yong <10walls@gmail.com>
+
+ * gcc.c-torture/execute/gcc_tmpnam.h: Fix tmpnam case on Windows
+ where it can return a filename with "\" to indicate current
+ directory.
+ * gcc.c-torture/execute/fprintf-2.c: Use wrapper.
+ * gcc.c-torture/execute/printf-2.c: Use wrapper.
+ * gcc.c-torture/execute/user-printf.c: Use wrapper.
+
+2021-08-22 Martin Uecker <muecker@gwdg.de>
+
+ PR c/98397
+ * gcc.dg/c11-qual-1.c: New test.
+ * gcc.dg/c2x-qual-1.c: New test.
+ * gcc.dg/c2x-qual-2.c: New test.
+ * gcc.dg/c2x-qual-3.c: New test.
+ * gcc.dg/c2x-qual-4.c: New test.
+ * gcc.dg/c2x-qual-5.c: New test.
+ * gcc.dg/c2x-qual-6.c: New test.
+ * gcc.dg/c2x-qual-7.c: New test.
+ * gcc.dg/pointer-array-quals-1.c: Remove unnecessary flag.
+ * gcc.dg/pointer-array-quals-2.c: Remove unnecessary flag.
+
+2021-08-22 Jan Hubicka <hubicka@ucw.cz>
+ Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/lto/pr101949_0.c: New test.
+ * gcc.dg/lto/pr101949_1.c: New test.
+
+2021-08-21 Ankur Saini <arsenic@sourceware.org>
+
+ PR analyzer/101980
+ * gcc.dg/analyzer/function-ptr-2.c : Add issue for double 'free'.
+ * gcc.dg/analyzer/malloc-callbacks.c : Fix xfail testcase.
+
+2021-08-20 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/error-1.f90: New test.
+ * gfortran.dg/gomp/error-2.f90: New test.
+ * gfortran.dg/gomp/error-3.f90: New test.
+
+2021-08-20 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/error-1.c: New test.
+ * c-c++-common/gomp/error-2.c: New test.
+ * c-c++-common/gomp/error-3.c: New test.
+ * g++.dg/gomp/attrs-1.C (bar): Add error directive test.
+ * g++.dg/gomp/attrs-2.C (bar): Add error directive test.
+ * g++.dg/gomp/attrs-13.C: New test.
+ * g++.dg/gomp/error-1.C: New test.
+
+2021-08-20 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/sink-5.c: New test.
+ * c-c++-common/gomp/requires-3.c: Add test for spurious comma
+ at the end of pragma line.
+
+2021-08-19 Roger Sayle <roger@nextmovesoftware.com>
+
+ * c-c++-common/Wunused-var-16.c: Add an extra check that ~0
+ is optimized away.
+
+2021-08-19 Peter Bergner <bergner@linux.ibm.com>
+
+ PR target/101849
+ * gcc.target/powerpc/pr101849.c: New test.
+
+2021-08-19 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100950
+ * gfortran.dg/pr100950.f90: New test.
+
+2021-08-19 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101803
+ * g++.dg/cpp2a/class-deduction-aggr12.C: Fix PR number.
+
+2021-08-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101950
+ * gcc.target/i386/pr101950-1.c: New test.
+ * gcc.target/i386/pr101950-2.c: New test.
+
+2021-08-19 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/requires-3.c: Add testcase for
+ atomic_default_mem_order ( at the end of line without corresponding ).
+
+2021-08-19 Iain Sandoe <iain@sandoe.co.uk>
+
+ * jit.dg/test-asm.c: Provide Mach-O fragment.
+ * jit.dg/test-asm.cc: Likewise.
+
+2021-08-19 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/nothing-2.c: New test.
+
+2021-08-19 Iain Sandoe <iain@sandoe.co.uk>
+
+ * jit.dg/harness.h: Include jit-dejagnu.h.
+ * jit.dg/jit.exp: Use -rdynamic conditionally on target
+ support, instead of unconditional -Wl,--export-dynamic.
+
+2021-08-19 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR testsuite/101969
+ * gcc.dg/pr78213.c: Fix up for '--enable-checking=release' etc.
+
+2021-08-19 liuhongt <hongtao.liu@intel.com>
+
+ Revert:
+ 2021-08-19 liuhongt <hongtao.liu@intel.com>
+
+ PR target/99881
+ * gcc.target/i386/pr99881.c: New test.
+
+2021-08-18 Tobias Burnus <tobias@codesourcery.com>
+
+ PR testsuite/101963
+ * gfortran.dg/nothing-1.f90: Moved to ...
+ * gfortran.dg/gomp/nothing-1.f90: ... here.
+ * gfortran.dg/nothing-2.f90: Moved to ...
+ * gfortran.dg/gomp/nothing-2.f90: ... here;
+ avoid $ issue in $OMP in dg-error.
+
+2021-08-18 Iain Sandoe <iain@sandoe.co.uk>
+ Matt Jacobson <mhjacobson@me.com>
+
+ PR objc/101666
+ * obj-c++.dg/pr101666-0.mm: New test.
+ * obj-c++.dg/pr101666-1.mm: New test.
+ * obj-c++.dg/pr101666.inc: New.
+ * objc.dg/pr101666-0.m: New test.
+ * objc.dg/pr101666-1.m: New test.
+ * objc.dg/pr101666.inc: New.
+
+2021-08-18 Ankur Saini <arsenic@sourceware.org>
+
+ PR analyzer/97114
+ * g++.dg/analyzer/vfunc-2.C: New test.
+ * g++.dg/analyzer/vfunc-3.C: New test.
+ * g++.dg/analyzer/vfunc-4.C: New test.
+ * g++.dg/analyzer/vfunc-5.C: New test.
+
+2021-08-18 Ankur Saini <arsenic@sourceware.org>
+
+ PR analyzer/100546
+ * gcc.dg/analyzer/function-ptr-4.c: New test.
+ * gcc.dg/analyzer/pr100546.c: New test.
+
+2021-08-18 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/nothing-1.f90: New test.
+ * gfortran.dg/nothing-2.f90: New test.
+
+2021-08-18 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101344
+ PR c++/101803
+ * g++.dg/cpp2a/class-deduction-aggr11.C: New test.
+ * g++.dg/cpp2a/class-deduction-aggr12.C: New test.
+
+2021-08-18 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101883
+ * g++.dg/cpp2a/nontype-class49.C: New test.
+
+2021-08-18 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/nothing-1.c: New test.
+ * g++.dg/gomp/attrs-1.C (bar): Add nothing directive test.
+ * g++.dg/gomp/attrs-2.C (bar): Likewise.
+ * g++.dg/gomp/attrs-9.C: Likewise.
+
+2021-08-18 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/pr63326.c: Don't expect extra "before" errors
+ in C++.
+ * g++.dg/gomp/attrs-7.C: Don't expect one extra error.
+ * g++.dg/gomp/barrier-2.C: Likewise.
+ * gcc.dg/gomp/declare-simd-5.c: Likewise.
+ * gcc.dg/gomp/barrier-2.c: Likewise.
+ * gcc.dg/gomp/declare-variant-2.c: Likewise.
+
+2021-08-18 liuhongt <hongtao.liu@intel.com>
+
+ PR target/97147
+ * gcc.target/i386/pr54400.c: Adjust testcase.
+ * gcc.target/i386/pr94147.c: New test.
+
+2021-08-17 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101854
+ * gcc.dg/attr-alloc_size-5.c: Adjust optimization to -O1.
+ * gcc.dg/attr-alloc_size-7.c: Use #pragmas to adjust optimization.
+ * gcc.dg/attr-alloc_size-8.c: Adjust optimization to -O1.
+ * gcc.dg/Wstringop-overflow-72.c: New test.
+
+2021-08-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101539
+ * g++.dg/cpp2a/is-corresponding-member1.C: New test.
+ * g++.dg/cpp2a/is-corresponding-member2.C: New test.
+ * g++.dg/cpp2a/is-corresponding-member3.C: New test.
+ * g++.dg/cpp2a/is-corresponding-member4.C: New test.
+ * g++.dg/cpp2a/is-corresponding-member5.C: New test.
+ * g++.dg/cpp2a/is-corresponding-member6.C: New test.
+ * g++.dg/cpp2a/is-corresponding-member7.C: New test.
+ * g++.dg/cpp2a/is-corresponding-member8.C: New test.
+ * g++.dg/cpp2a/is-layout-compatible1.C: New test.
+ * g++.dg/cpp2a/is-layout-compatible2.C: New test.
+ * g++.dg/cpp2a/is-layout-compatible3.C: New test.
+
+2021-08-17 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gcc.dg/pr78213.c: Restore testing.
+
+2021-08-17 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.dg/tree-ssa/ssa-ccp-40.c: New test case.
+
+2021-08-17 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.dg/fold-ior-5.c: New test case.
+
+2021-08-17 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/scan-1.f90:
+ * gfortran.dg/gomp/cancel-1.f90: New test.
+ * gfortran.dg/gomp/cancel-4.f90: New test.
+ * gfortran.dg/gomp/loop-4.f90: New test.
+ * gfortran.dg/gomp/nesting-1.f90: New test.
+ * gfortran.dg/gomp/nesting-2.f90: New test.
+ * gfortran.dg/gomp/nesting-3.f90: New test.
+ * gfortran.dg/gomp/nowait-1.f90: New test.
+ * gfortran.dg/gomp/reduction-task-1.f90: New test.
+ * gfortran.dg/gomp/reduction-task-2.f90: New test.
+ * gfortran.dg/gomp/reduction-task-2a.f90: New test.
+ * gfortran.dg/gomp/reduction-task-3.f90: New test.
+ * gfortran.dg/gomp/scope-1.f90: New test.
+ * gfortran.dg/gomp/scope-2.f90: New test.
+
+2021-08-17 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/101938
+ * gcc.dg/pr101938.c: New test.
+
+2021-08-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101868
+ * gcc.dg/lto/pr101868_0.c: New testcase.
+ * gcc.dg/lto/pr101868_1.c: Likewise.
+ * gcc.dg/lto/pr101868_2.c: Likewise.
+ * gcc.dg/lto/pr101868_3.c: Likewise.
+
+2021-08-17 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/nesting-2.c (foo): Add scope and masked
+ construct tests.
+ * c-c++-common/gomp/scan-1.c (f3): Add scope construct test..
+ * c-c++-common/gomp/cancel-1.c (f2): Add scope and masked
+ construct tests.
+ * c-c++-common/gomp/reduction-task-2.c (bar): Add scope construct
+ test. Adjust diagnostics for the addition of scope.
+ * c-c++-common/gomp/loop-1.c (f5): Add master, masked and scope
+ construct tests.
+ * c-c++-common/gomp/clause-dups-1.c (f1): Add scope construct test.
+ * gcc.dg/gomp/nesting-1.c (f1, f2, f3): Add scope construct tests.
+ * c-c++-common/gomp/scope-1.c: New test.
+ * c-c++-common/gomp/scope-2.c: New test.
+ * g++.dg/gomp/attrs-1.C (bar): Add scope construct tests.
+ * g++.dg/gomp/attrs-2.C (bar): Likewise.
+ * gfortran.dg/gomp/reduction4.f90: Adjust expected diagnostics.
+ * gfortran.dg/gomp/reduction7.f90: Likewise.
+
+2021-08-17 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/cpp/va-opt-5.c: New test.
+ * c-c++-common/cpp/va-opt-6.c: New test.
+
+2021-08-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101925
+ * gcc.dg/sso-16.c: New testcase.
+
+2021-08-17 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr82460-2.c: Adjust testcase by adding
+ --param=vect-epilogues-nomask=0
+
+2021-08-16 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101930
+ * gcc.target/i386/pr101930.c: New test.
+
+2021-08-16 Martin Liska <mliska@suse.cz>
+
+ PR ipa/100600
+ * gcc.dg/ipa/pr100600.c: New test.
+
+2021-08-16 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101846
+ * gcc.target/i386/pr101846-2.c: New test.
+ * gcc.target/i386/pr101846-3.c: New test.
+ * gcc.target/i386/pr101846-4.c: New test.
+
+2021-08-16 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/masked-1.f90: New test.
+ * gfortran.dg/gomp/masked-2.f90: New test.
+ * gfortran.dg/gomp/masked-3.f90: New test.
+ * gfortran.dg/gomp/masked-combined-1.f90: New test.
+ * gfortran.dg/gomp/masked-combined-2.f90: New test.
+
+2021-08-15 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/99351
+ * gfortran.dg/coarray_sync.f90: New test.
+ * gfortran.dg/coarray_3.f90: Adjust error messages.
+
+2021-08-14 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101791
+ * g++.dg/warn/Wmismatched-new-delete-6.C: New test.
+ * g++.dg/warn/Wmismatched-new-delete-7.C: New test.
+
+2021-08-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/101896
+ * gcc.target/i386/avx512f-pr101896.c: New test.
+
+2021-08-13 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101734
+ * gcc.dg/uninit-42.c: New test.
+
+2021-08-13 Martin Liska <mliska@suse.cz>
+
+ PR ipa/101261
+ * gcc.target/i386/pr101261.c: New test.
+
+2021-08-13 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc.dg/tree-ssa/modref-6.c: Update.
+
+2021-08-13 prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
+
+ * gcc.target/arm/simd/pr98435.c: Add dg-require-effective-target
+ arm_softfp_ok.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/clauses-1.c (bar): Add tests for combined masked
+ constructs with clauses.
+ * c-c++-common/gomp/clauses-5.c (foo): Add testcase for filter clause.
+ * c-c++-common/gomp/clause-dups-1.c (f1): Likewise.
+ * c-c++-common/gomp/masked-1.c: New test.
+ * c-c++-common/gomp/masked-2.c: New test.
+ * c-c++-common/gomp/masked-combined-1.c: New test.
+ * c-c++-common/gomp/masked-combined-2.c: New test.
+ * c-c++-common/goacc/uninit-if-clause.c: Remove xfails.
+ * g++.dg/gomp/block-11.C: New test.
+ * g++.dg/gomp/tpl-masked-1.C: New test.
+ * g++.dg/gomp/attrs-1.C (bar): Add tests for masked construct and
+ combined masked constructs with clauses in attribute syntax.
+ * g++.dg/gomp/attrs-2.C (bar): Likewise.
+ * gcc.dg/gomp/nesting-1.c (f1, f2): Add tests for masked construct
+ nesting.
+ * gfortran.dg/goacc/host_data-tree.f95: Allow also SSA_NAMEs in if
+ clause.
+ * gfortran.dg/goacc/kernels-tree.f95: Likewise.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/101638
+ * gcc.dg/cpp/pr101638.c: New test.
+
+2021-08-12 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c: Fix
+ typo in regular expression.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c:
+ Likewise.
+
+2021-08-12 Sergei Trofimovich <siarheit@google.com>
+
+ PR c++/101219
+ * g++.dg/warn/pr101219.C: New test.
+
+2021-08-12 Martin Uecker <muecker@gwdg.de>
+
+ PR c/101838
+ * gcc.dg/vla-stexp-2.c: New test.
+
+2021-08-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Remove call into the legacy
+ code and adjust for ranger threader.
+
+2021-08-12 Tobias Burnus <tobias@codesourcery.com>
+
+ * c-c++-common/gomp/pr61486-2.c: Duplicate one proc_bind(master)
+ testcase and test proc_bind(primary) instead.
+ * gfortran.dg/gomp/affinity-1.f90: Likewise.
+
+2021-08-12 Hans-Peter Nilsson <hp@axis.com>
+
+ * gfortran.dg/PR82376.f90: Robustify match.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/101860
+ * gcc.target/i386/avx512f-pr101860.c: New test.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-12.C: New test.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-11.C: Add new tests.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99429
+ PR c++/94162
+ * g++.dg/cpp2a/spaceship-synth11.C: New test.
+ * g++.dg/cpp2a/spaceship-synth-neg6.C: New test.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-11.C: Adjust expected diagnostics.
+
+2021-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/lookup/strong-using.C: Add test using [[gnu::strong]]
+ as well.
+ * g++.dg/lookup/strong-using2.C: Likewise.
+ * g++.dg/cpp0x/gen-attrs-58.C: Move alignas(int) before
+ using namespace.
+ * g++.dg/cpp0x/gen-attrs-59.C: Move alignas(X) before
+ using namespace, add tests for alignas before semicolon.
+ * g++.dg/cpp0x/gen-attrs-76.C: Remove xfails. Add test for
+ C++11 attributes on using directive before semicolon.
+
+2021-08-12 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101846
+ * gcc.target/i386/pr101846-1.c: New test.
+
+2021-08-12 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101663
+ * g++.dg/cpp2a/construct_at.h: New convenience header file that
+ defines minimal implementations of std::construct_at/destroy_at,
+ split out from ...
+ * g++.dg/cpp2a/constexpr-new5.C: ... here.
+ * g++.dg/cpp2a/constexpr-new6.C: Use the header.
+ * g++.dg/cpp2a/constexpr-new14.C: Likewise.
+ * g++.dg/cpp2a/constexpr-new20.C: New test.
+
+2021-08-11 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101725
+ DR 2082
+ * g++.dg/DRs/dr2082.C: New test.
+ * g++.dg/cpp2a/concepts-uneval4.C: New test.
+
+2021-08-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101786
+ * g++.dg/cpp2a/constinit16.C: New test.
+
+2021-08-11 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/79501
+ * g++.dg/cpp1z/class-deduction98.C: New test.
+
+2021-08-11 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/89062
+ * g++.dg/cpp1z/class-deduction97.C: New test.
+
+2021-08-11 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/lto/pr48622_1.c: Provide non-LTO definition
+ of ashift_qi_1.
+
+2021-08-11 Jan Hubicka <jh@suse.cz>
+
+ * c-c++-common/modref-dse.c: New test.
+
+2021-08-11 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/101858
+ * gcc.dg/pr101858.c: New testcase.
+
+2021-08-11 prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR target/66791
+ * gcc.target/arm/pr51534.c: Adjust test.
+
+2021-08-11 liuhongt <hongtao.liu@intel.com>
+
+ PR target/98309
+ * gcc.target/i386/pr98309-1.c: New test.
+ * gcc.target/i386/pr98309-2.c: New test.
+
+2021-08-11 Hans-Peter Nilsson <hp@axis.com>
+
+ PR middle-end/101674
+ * gcc.dg/uninit-pred-9_b.c: Xfail for cris-*-* too.
+
+2021-08-10 Tobias Burnus <tobias@codesourcery.com>
+
+ PR libfortran/101305
+ PR fortran/101660
+ PR testsuite/101847
+ * lib/gfortran.exp (gfortran_init): Remove -I$specpath/libgfortran
+ from the string used to set GFORTRAN_UNDER_TEST.
+
+2021-08-10 H.J. Lu <hjl.tools@gmail.com>
+
+ PR tree-optimization/101809
+ * gcc.target/i386/pr88531-1a.c: Enable for all targets.
+
+2021-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/80355
+ * gcc.target/i386/avx512f-pr80355-2.c: New test.
+
+2021-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/80355
+ * gcc.target/i386/avx512f-pr80355-1.c: New test.
+
+2021-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-1.C (bar): Add missing semicolon after
+ [[omp::directive (threadprivate (t2))]]. Add tests with
+ if/while/switch after parallel in attribute syntax.
+ (corge): Add missing omp:: before directive.
+ * g++.dg/gomp/attrs-2.C (bar): Add missing semicolon after
+ [[omp::directive (threadprivate (t2))]].
+ * g++.dg/gomp/attrs-10.C: New test.
+ * g++.dg/gomp/attrs-11.C: New test.
+
+2021-08-10 Hongyu Wang <hongyu.wang@intel.com>
+
+ * gcc.target/i386/amxbf16-dpbf16ps-2.c: Fix typos.
+
+2021-08-10 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/101824
+ * gcc.dg/tree-ssa/pr101824.c: New testcase.
+
+2021-08-10 Martin Uecker <muecker@gwdg.de>
+
+ PR c/29970
+ * gcc.dg/vla-stexp-1.c: New test.
+
+2021-08-10 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101804
+ * gcc.target/i386/avx2-gather-2.c: Pass -march=skylake instead
+ of "-mavx2 -mtune=skylake". Scan vpcmpeqd.
+
+2021-08-10 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_shift_d-1.c: New test.
+ * gcc.target/i386/cond_op_shift_d-2.c: New test.
+ * gcc.target/i386/cond_op_shift_q-1.c: New test.
+ * gcc.target/i386/cond_op_shift_q-2.c: New test.
+ * gcc.target/i386/cond_op_shift_ud-1.c: New test.
+ * gcc.target/i386/cond_op_shift_ud-2.c: New test.
+ * gcc.target/i386/cond_op_shift_uq-1.c: New test.
+ * gcc.target/i386/cond_op_shift_uq-2.c: New test.
+ * gcc.target/i386/cond_op_shift_uw-1.c: New test.
+ * gcc.target/i386/cond_op_shift_uw-2.c: New test.
+ * gcc.target/i386/cond_op_shift_w-1.c: New test.
+ * gcc.target/i386/cond_op_shift_w-2.c: New test.
+
+2021-08-09 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr101741.c: New.
+
+2021-08-09 Martin Jambor <mjambor@suse.cz>
+
+ PR testsuite/101654
+ * gcc.dg/ipa/remref-6.c: Added missing -fdump-ipa-inline option.
+
+2021-08-09 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101812
+ * gcc.target/i386/pr101812.c: New test.
+
+2021-08-09 Tejas Belagod <tejas.belagod@arm.com>
+
+ * gcc.target/aarch64/vect-shr-reg.c: New testcase.
+ * gcc.target/aarch64/vect-shr-reg-run.c: Likewise.
+
+2021-08-09 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.dg/pr68217.c: Add -fno-tree-ccp option.
+ * gcc.dg/tree-ssa/vrp24.c: Add -fno-tree-ccp option.
+ * g++.dg/ipa/pure-const-3.C: Add -fno-tree-ccp option.
+
+2021-08-09 Tobias Burnus <tobias@codesourcery.com>
+
+ PR libfortran/101305
+ PR fortran/101660
+ * lib/gfortran.exp (gfortran_init): Add -I $specdir/libgfortran to
+ GFORTRAN_UNDER_TEST; update it when set by previous gfortran_init call.
+ * gfortran.dg/ISO_Fortran_binding_1.c: Use <...> not "..." for
+ ISO_Fortran_binding.h's #include.
+ * gfortran.dg/ISO_Fortran_binding_10.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_11.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_12.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_15.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_16.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_17.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_18.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_3.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_5.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_6.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_7.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_8.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_9.c: Likewise.
+ * gfortran.dg/PR94327.c: Likewise.
+ * gfortran.dg/PR94331.c: Likewise.
+ * gfortran.dg/bind_c_array_params_3_aux.c: Likewise.
+ * gfortran.dg/iso_fortran_binding_uint8_array_driver.c: Likewise.
+ * gfortran.dg/pr93524.c: Likewise.
+
+2021-08-09 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/sve/dup_lane_1.c: Don't split
+ scan-assembler tests over multiple lines. Expect 32-bit
+ result values in 'w' registers.
+ * gcc.target/aarch64/sve/extract_1.c: Likewise.
+ * gcc.target/aarch64/sve/extract_2.c: Likewise.
+ * gcc.target/aarch64/sve/extract_3.c: Likewise.
+ * gcc.target/aarch64/sve/extract_4.c: Likewise.
+
+2021-08-09 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Restrict
+ tests to little-endian targets.
+
+2021-08-08 Jeff Law <jlaw@localhost.localdomain>
+
+ * gcc.target/tic6x/rotdi16-scan.c: Pull rotate into its own function.
+
+2021-08-07 H.J. Lu <hjl.tools@gmail.com>
+
+ PR tree-optimization/88531
+ * gcc.target/i386/pr88531-1a.c: New test.
+ * gcc.target/i386/pr88531-1b.c: Likewise.
+ * gcc.target/i386/pr88531-1c.c: Likewise.
+ * gcc.target/i386/pr88531-2a.c: Likewise.
+ * gcc.target/i386/pr88531-2b.c: Likewise.
+ * gcc.target/i386/pr88531-2c.c: Likewise.
+
+2021-08-06 Martin Sebor <msebor@redhat.com>
+
+ * c-c++-common/Wsizeof-pointer-memaccess1.c: Also disable
+ -Wstringop-overread.
+ * c-c++-common/attr-nonstring-3.c: Adjust pattern of expected message.
+ * gcc.dg/Warray-bounds-39.c: Add an xfail due to a known bug.
+ * gcc.dg/Wstring-compare-3.c: Also disable -Wstringop-overread.
+ * gcc.dg/attr-nonstring-2.c: Adjust pattern of expected message.
+ * gcc.dg/attr-nonstring-4.c: Same.
+ * gcc.dg/Wstringop-overread-6.c: New test.
+ * gcc.dg/sso-14.c: Fix typos to avoid buffer overflow.
+
+2021-08-06 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ PR target/101723
+ * gcc.target/arm/pr69245.c: Make sure to emit code for fn1, fix
+ typo.
+
+2021-08-06 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ PR target/101723
+ * gcc.target/arm/attr-neon3.c: Fix typo.
+ * gcc.target/arm/pragma_fpu_attribute_2.c: Fix typo.
+
+2021-08-06 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101797
+ * gcc.target/i386/pr101797.c: New test.
+
+2021-08-06 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-08-06 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-08-06 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-08-06 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-08-06 Martin Liska <mliska@suse.cz>
+
+ * gcc.target/powerpc/pragma-optimize.c: New test.
+
+2021-08-06 Richard Biener <rguenther@suse.de>
+
+ * gfortran.dg/vect/vect-8.f90: Simplify aarch64 scanning.
+
+2021-08-06 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * gcc.dg/gcov-info-to-gcda.c: New test.
+
+2021-08-05 Jonathan Wakely <jwakely@redhat.com>
+
+ * g++.old-deja/g++.other/inline7.C: Cast nodiscard call to void.
+
+2021-08-05 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/99744
+ * gcc.target/i386/pr99744-3.c: New test.
+ * gcc.target/i386/pr99744-4.c: Likewise.
+ * gcc.target/i386/pr99744-5.c: Likewise.
+ * gcc.target/i386/pr99744-6.c: Likewise.
+ * gcc.target/i386/pr99744-7.c: Likewise.
+ * gcc.target/i386/pr99744-8.c: Likewise.
+
+2021-08-05 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/101723
+ * gcc.target/arm/cortex-m55-nofp-flag-hard.c: Update expected output.
+ * gcc.target/arm/cortex-m55-nofp-flag-softfp.c: Likewise.
+ * gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/mve_fpu1.c: Convert to dg-do assemble.
+ Add a non-no-op function body.
+ * gcc.target/arm/mve/intrinsics/mve_fpu2.c: Likewise.
+ * gcc.target/arm/pr98636.c (dg-options): Add -mfloat-abi=softfp.
+ * gcc.target/arm/attr-neon.c: Tighten scan-assembler tests.
+ * gcc.target/arm/attr-neon2.c: Use -Ofast, convert test to use
+ check-function-bodies.
+ * gcc.target/arm/attr-neon3.c: Likewise.
+ * gcc.target/arm/pr69245.c: Tighten scan-assembler match, but allow
+ multiple instances.
+ * gcc.target/arm/pragma_fpu_attribute.c: Likewise.
+ * gcc.target/arm/pragma_fpu_attribute_2.c: Likewise.
+
+2021-08-05 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vsubX_high_cost.c: New test.
+
+2021-08-05 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vaddX_high_cost.c: New test.
+
+2021-08-05 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-pr101756.c: Add -w.
+
+2021-08-05 Eric Botcazou <ebotcazou@gcc.gnu.org>
+
+ * gcc.dg/sso-15.c: New test.
+
+2021-08-05 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_anylogic_d-1.c: New test.
+ * gcc.target/i386/cond_op_anylogic_d-2.c: New test.
+ * gcc.target/i386/cond_op_anylogic_q-1.c: New test.
+ * gcc.target/i386/cond_op_anylogic_q-2.c: New test.
+
+2021-08-05 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_maxmin_double-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_double-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_float-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_float-2.c: New test.
+
+2021-08-05 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_maxmin_b-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_b-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_d-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_d-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_q-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_q-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_ub-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_ub-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_ud-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_ud-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_uq-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_uq-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_uw-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_uw-2.c: New test.
+ * gcc.target/i386/cond_op_maxmin_w-1.c: New test.
+ * gcc.target/i386/cond_op_maxmin_w-2.c: New test.
+
+2021-08-04 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101570
+ * gcc.dg/analyzer/asm-x86-1.c: New test.
+ * gcc.dg/analyzer/asm-x86-lp64-1.c: New test.
+ * gcc.dg/analyzer/asm-x86-lp64-2.c: New test.
+ * gcc.dg/analyzer/pr101570.c: New test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c:
+ New test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c: New
+ test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c: New
+ test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c: New test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c: New
+ test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c: New test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c:
+ New test.
+ * gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c:
+ New test.
+
+2021-08-04 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101742
+ * gcc.target/i386/pr101742a.c: New test.
+ * gcc.target/i386/pr101742b.c: Likewise.
+
+2021-08-04 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101772
+ * gcc.target/i386/eh_return-2.c: New test.
+
+2021-08-04 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/vector/perm-vpdi.c: New test.
+
+2021-08-04 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/vector/perm-merge.c: New test.
+ * gcc.target/s390/vector/vec-types.h: New test.
+
+2021-08-04 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/zvector/vec-permi.c: Removed.
+ * gcc.target/s390/zvector/vec_permi.c: New test.
+
+2021-08-04 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c:
+ Instead of vpdi with 0 and 5 vmrlg and vmrhg are used now.
+ * gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c: Likewise.
+ * gcc.target/s390/zvector/vec-types.h: New test.
+ * gcc.target/s390/zvector/vec_merge.c: New test.
+
+2021-08-04 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vmul_high_cost.c: New test.
+
+2021-08-04 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vmul_element_cost.c: New test.
+
+2021-08-04 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/cost_model_12.c: New test.
+
+2021-08-04 Tamar Christina <tamar.christina@arm.com>
+
+ PR tree-optimization/101750
+ * g++.dg/vect/pr99149.cc: Name class.
+
+2021-08-04 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/vect-gather-1.c: New testcase.
+ * gfortran.dg/vect/vect-8.f90: Adjust.
+
+2021-08-04 Roger Sayle <roger@nextmovesoftware.com>
+ Marc Glisse <marc.glisse@inria.fr>
+
+ * gcc.dg/fold-ior-4.c: New test.
+
+2021-08-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101756
+ * gcc.dg/vect/bb-slp-pr101756.c: New testcase.
+
+2021-08-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101759
+ * g++.dg/gomp/pr101759.C: New test.
+ * g++.dg/goacc/pr101759.C: New test.
+
+2021-08-04 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/execute/ieee/pr29302-1.x: Undo doubly applied patch.
+
+2021-08-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101769
+ * g++.dg/tree-ssa/pr101769.C: New testcase.
+
+2021-08-04 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_addsubmul_d-2.c: Add
+ dg-require-effective-target for avx512.
+ * gcc.target/i386/cond_op_addsubmul_q-2.c: Ditto.
+ * gcc.target/i386/cond_op_addsubmul_w-2.c: Ditto.
+ * gcc.target/i386/cond_op_addsubmuldiv_double-2.c: Ditto.
+ * gcc.target/i386/cond_op_addsubmuldiv_float-2.c: Ditto.
+ * gcc.target/i386/cond_op_fma_double-2.c: Ditto.
+ * gcc.target/i386/cond_op_fma_float-2.c: Ditto.
+
+2021-08-04 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_fma_double-1.c: New test.
+ * gcc.target/i386/cond_op_fma_double-2.c: New test.
+ * gcc.target/i386/cond_op_fma_float-1.c: New test.
+ * gcc.target/i386/cond_op_fma_float-2.c: New test.
+
+2021-08-03 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * lib/profopt.exp: Pass gdwarf-4 when compiling test to profile; pass -gcov_version=2.
+ * lib/target-supports.exp: Remove unnecessary -o perf.data passed to gcc-auto-profile.
+
+2021-08-03 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * gcc.dg/tree-prof/indir-call-prof-2.c: Fix dg-final-use-autofdo.
+ * lib/profopt.exp: Pass -fearly-inlining when compiling with AutoFDO.
+
+2021-08-03 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * g++.dg/tree-prof/indir-call-prof.C: Fix options, increase the number of iterations.
+ * g++.dg/tree-prof/morefunc.C: Fix options, increase the number of iterations.
+ * g++.dg/tree-prof/reorder.C: Fix options, increase the number of iterations.
+ * gcc.dg/tree-prof/indir-call-prof-2.c: Fix options, increase the number of iterations.
+ * gcc.dg/tree-prof/indir-call-prof.c: Fix options.
+
+2021-08-03 Martin Sebor <msebor@redhat.com>
+
+ PR testsuite/101688
+ * g++.dg/warn/Wstringop-overflow-4.C: Disable a test case in ILP32.
+
+2021-08-03 Paul A. Clarke <pc@us.ibm.com>
+
+ * gcc.target/powerpc/sse4_1-phminposuw.c: Copy from
+ gcc/testsuite/gcc.target/i386, adjust dg directives to suit,
+ make more robust.
+
+2021-08-03 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/avx-vzeroupper-14.c: Pass -mno-avx512f to
+ disable XMM31.
+ * gcc.target/i386/avx-vzeroupper-15.c: Likewise.
+ * gcc.target/i386/pr82941-1.c: Updated. Check for vzeroupper.
+ * gcc.target/i386/pr82942-1.c: Likewise.
+ * gcc.target/i386/pr82990-1.c: Likewise.
+ * gcc.target/i386/pr82990-3.c: Likewise.
+ * gcc.target/i386/pr82990-5.c: Likewise.
+ * gcc.target/i386/pr100865-4b.c: Likewise.
+ * gcc.target/i386/pr100865-6b.c: Likewise.
+ * gcc.target/i386/pr100865-7b.c: Likewise.
+ * gcc.target/i386/pr100865-10b.c: Likewise.
+ * gcc.target/i386/pr100865-8b.c: Updated.
+ * gcc.target/i386/pr100865-9b.c: Likewise.
+ * gcc.target/i386/pr100865-11b.c: Likewise.
+ * gcc.target/i386/pr100865-12b.c: Likewise.
+
+2021-08-03 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_addsubmul_d-1.c: New test.
+ * gcc.target/i386/cond_op_addsubmul_d-2.c: New test.
+ * gcc.target/i386/cond_op_addsubmul_q-1.c: New test.
+ * gcc.target/i386/cond_op_addsubmul_q-2.c: New test.
+ * gcc.target/i386/cond_op_addsubmul_w-1.c: New test.
+ * gcc.target/i386/cond_op_addsubmul_w-2.c: New test.
+
+2021-08-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR analyzer/101721
+ * gcc.dg/analyzer/pr101721.c: New test.
+
+2021-08-03 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/80566
+ * g++.target/i386/pr80566-1.C: New test.
+ * g++.target/i386/pr80566-2.C: Likewise.
+
+2021-08-03 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/cond_op_addsubmuldiv_double-1.c: New test.
+ * gcc.target/i386/cond_op_addsubmuldiv_double-2.c: New test.
+ * gcc.target/i386/cond_op_addsubmuldiv_float-1.c: New test.
+ * gcc.target/i386/cond_op_addsubmuldiv_float-2.c: New test.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/vect8-ret.c: Also pass -mno-sse.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/incoming-11.c: Expect no stack realignment.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/sw-1.c: Also pass -mno-avx for ia32.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/cold-attribute-1.c: Also pass -mno-avx.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/pr72839.c: Also pass -mno-avx.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/pieces-memcpy-10.c: New test.
+ * gcc.target/i386/pieces-memcpy-11.c: Likewise.
+ * gcc.target/i386/pieces-memcpy-12.c: Likewise.
+ * gcc.target/i386/pieces-memcpy-13.c: Likewise.
+ * gcc.target/i386/pieces-memcpy-14.c: Likewise.
+ * gcc.target/i386/pieces-memcpy-15.c: Likewise.
+ * gcc.target/i386/pieces-memcpy-16.c: Likewise.
+ * gcc.target/i386/pieces-memset-1.c: Likewise.
+ * gcc.target/i386/pieces-memset-2.c: Likewise.
+ * gcc.target/i386/pieces-memset-3.c: Likewise.
+ * gcc.target/i386/pieces-memset-4.c: Likewise.
+ * gcc.target/i386/pieces-memset-5.c: Likewise.
+ * gcc.target/i386/pieces-memset-6.c: Likewise.
+ * gcc.target/i386/pieces-memset-7.c: Likewise.
+ * gcc.target/i386/pieces-memset-8.c: Likewise.
+ * gcc.target/i386/pieces-memset-9.c: Likewise.
+ * gcc.target/i386/pieces-memset-10.c: Likewise.
+ * gcc.target/i386/pieces-memset-11.c: Likewise.
+ * gcc.target/i386/pieces-memset-12.c: Likewise.
+ * gcc.target/i386/pieces-memset-13.c: Likewise.
+ * gcc.target/i386/pieces-memset-14.c: Likewise.
+ * gcc.target/i386/pieces-memset-15.c: Likewise.
+ * gcc.target/i386/pieces-memset-16.c: Likewise.
+ * gcc.target/i386/pieces-memset-17.c: Likewise.
+ * gcc.target/i386/pieces-memset-18.c: Likewise.
+ * gcc.target/i386/pieces-memset-19.c: Likewise.
+ * gcc.target/i386/pieces-memset-20.c: Likewise.
+ * gcc.target/i386/pieces-memset-21.c: Likewise.
+ * gcc.target/i386/pieces-memset-22.c: Likewise.
+ * gcc.target/i386/pieces-memset-23.c: Likewise.
+ * gcc.target/i386/pieces-memset-24.c: Likewise.
+ * gcc.target/i386/pieces-memset-25.c: Likewise.
+ * gcc.target/i386/pieces-memset-26.c: Likewise.
+ * gcc.target/i386/pieces-memset-27.c: Likewise.
+ * gcc.target/i386/pieces-memset-28.c: Likewise.
+ * gcc.target/i386/pieces-memset-29.c: Likewise.
+ * gcc.target/i386/pieces-memset-30.c: Likewise.
+ * gcc.target/i386/pieces-memset-31.c: Likewise.
+ * gcc.target/i386/pieces-memset-32.c: Likewise.
+ * gcc.target/i386/pieces-memset-33.c: Likewise.
+ * gcc.target/i386/pieces-memset-34.c: Likewise.
+ * gcc.target/i386/pieces-memset-35.c: Likewise.
+ * gcc.target/i386/pieces-memset-36.c: Likewise.
+ * gcc.target/i386/pieces-memset-37.c: Likewise.
+ * gcc.target/i386/pieces-memset-38.c: Likewise.
+ * gcc.target/i386/pieces-memset-39.c: Likewise.
+ * gcc.target/i386/pieces-memset-40.c: Likewise.
+ * gcc.target/i386/pieces-memset-41.c: Likewise.
+ * gcc.target/i386/pieces-memset-42.c: Likewise.
+ * gcc.target/i386/pieces-memset-43.c: Likewise.
+ * gcc.target/i386/pieces-memset-44.c: Likewise.
+ * gcc.target/i386/pieces-memcpy-7.c: New file.
+ * gcc.target/i386/pieces-memcpy-8.c: New file.
+ * gcc.target/i386/pieces-memcpy-9.c: New file.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ PR middle-end/90773
+ * gcc.target/i386/pr90773-20.c: New test.
+ * gcc.target/i386/pr90773-21.c: Likewise.
+ * gcc.target/i386/pr90773-22.c: Likewise.
+ * gcc.target/i386/pr90773-23.c: Likewise.
+ * gcc.target/i386/pr90773-26.c: Likewise.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/pr90773-1.c: Adjust to expect movq for 32-bit.
+ * gcc.target/i386/pr90773-4.c: Also run for 32-bit.
+ * gcc.target/i386/pr90773-15.c: Likewise.
+ * gcc.target/i386/pr90773-16.c: Likewise.
+ * gcc.target/i386/pr90773-17.c: Likewise.
+ * gcc.target/i386/pr90773-24.c: Likewise.
+ * gcc.target/i386/pr90773-25.c: Likewise.
+ * gcc.target/i386/pr100865-1.c: Likewise.
+ * gcc.target/i386/pr100865-2.c: Likewise.
+ * gcc.target/i386/pr100865-3.c: Likewise.
+ * gcc.target/i386/pr90773-14.c: Also run for 32-bit and expect
+ XMM movd to store 4 bytes.
+ * gcc.target/i386/pr100865-4a.c: Also run for 32-bit and expect
+ YMM registers.
+ * gcc.target/i386/pr100865-4b.c: Likewise.
+ * gcc.target/i386/pr100865-10a.c: Expect YMM registers.
+ * gcc.target/i386/pr100865-10b.c: Likewise.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/eh_return-1.c: New test.
+
+2021-08-02 H.J. Lu <hjl.tools@gmail.com>
+
+ PR middle-end/90773
+ * gcc.target/i386/pr90773-5.c: Updated to expect XMM register.
+ * gcc.target/i386/pr90773-14.c: Likewise.
+ * gcc.target/i386/pr90773-15.c: New test.
+ * gcc.target/i386/pr90773-16.c: Likewise.
+ * gcc.target/i386/pr90773-17.c: Likewise.
+ * gcc.target/i386/pr90773-18.c: Likewise.
+ * gcc.target/i386/pr90773-19.c: Likewise.
+
+2021-08-02 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.dg/tree-ssa/phi-opt-25.c: New test case.
+
+2021-08-01 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/78103
+ * gcc.target/i386/pr78103-2.c: Also scan incl.
+ * gcc.target/i386/pr78103-3.c: Scan leal|addl|incl for x32. Also
+ scan incq.
+
+2021-07-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/96636
+ * g++.dg/ext/anon-struct9.C: New test.
+
+2021-07-31 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.target/i386/dec-cmov-2.c: Require -march=core2 with -m32.
+
+2021-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-9.C: New test.
+
+2021-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/78103
+ * gcc.target/i386/pr78103-1.c: New test.
+ * gcc.target/i386/pr78103-2.c: New test.
+ * gcc.target/i386/pr78103-3.c: New test.
+
+2021-07-31 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Skip on mmix-knuth-mmixware.
+
+2021-07-31 Hans-Peter Nilsson <hp@bitrange.com>
+
+ PR middle-end/101674
+ * gcc.dg/uninit-pred-9_b.c: Xfail for mmix-*-* too.
+
+2021-07-30 Paul A. Clarke <pc@us.ibm.com>
+
+ * gcc.target/powerpc/sse4_1-floorpd.c: New.
+ * gcc.target/powerpc/sse4_1-floorps.c: New.
+ * gcc.target/powerpc/sse4_1-floorsd.c: New.
+ * gcc.target/powerpc/sse4_1-floorss.c: New.
+ * gcc.target/powerpc/sse4_1-roundpd-2.c: Copy from
+ gcc/testsuite/gcc.target/i386 and adjust dg directives to suit.
+
+2021-07-30 Paul A. Clarke <pc@us.ibm.com>
+
+ * gcc.target/powerpc/sse4_1-ceilpd.c: New.
+ * gcc.target/powerpc/sse4_1-ceilps.c: New.
+ * gcc.target/powerpc/sse4_1-ceilsd.c: New.
+ * gcc.target/powerpc/sse4_1-ceilss.c: New.
+ * gcc.target/powerpc/sse4_1-round-data.h: New.
+ * gcc.target/powerpc/sse4_1-round.h: New.
+ * gcc.target/powerpc/sse4_1-round2.h: New.
+ * gcc.target/powerpc/sse4_1-roundpd-3.c: Copy from gcc.target/i386
+ and adjust dg directives to suit.
+ * gcc.target/powerpc/sse4_1-check.h (__VSX_SSE2__): Define.
+
+2021-07-30 Paul A. Clarke <pc@us.ibm.com>
+
+ * gcc.target/powerpc/sse4_1-blendpd.c: Copy from gcc.target/i386
+ and adjust dg directives to suit.
+ * gcc.target/powerpc/sse4_1-blendps-2.c: Likewise.
+ * gcc.target/powerpc/sse4_1-blendps.c: Likewise.
+ * gcc.target/powerpc/sse4_1-blendvpd.c: Likewise.
+
+2021-07-30 Roger Sayle <roger@nextmovesoftware.com>
+ Uroš Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/dec-cmov-1.c: New test.
+ * gcc.target/i386/dec-cmov-2.c: New test.
+
+2021-07-30 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/tree-ssa/pr61839_2.c: Adjust. Add new const fold test.
+
+2021-07-30 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/tree-ssa/pr61839_2.c: Adjust.
+
+2021-07-30 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101671
+ * gcc.c-torture/compile/pr83510.c: Move test functions...
+ * gcc.dg/Warray-bounds-87.c: ...to this file.
+
+2021-07-30 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/pr100865-3.c: Expect vmovdqu8 instead of
+ vmovdqu.
+ * gcc.target/i386/pr100865-4b.c: Likewise.
+
+2021-07-30 Andrew Pinski <apinski@marvell.com>
+
+ PR testsuite/101517
+ * g++.dg/warn/Wunused-18.C: New test.
+ * gcc.c-torture/compile/20030405-2.c: New test.
+ * gcc.c-torture/compile/20040304-2.c: New test.
+ * gcc.dg/20030612-2.c: New test.
+
+2021-07-30 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ PR target/101132
+ * gcc.target/mips/pr101132.c: New test.
+
+2021-07-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101539
+ * g++.dg/cpp2a/is-pointer-interconvertible-base-of1.C: New test.
+ * g++.dg/cpp2a/is-pointer-interconvertible-with-class1.C: New test.
+ * g++.dg/cpp2a/is-pointer-interconvertible-with-class2.C: New test.
+ * g++.dg/cpp2a/is-pointer-interconvertible-with-class3.C: New test.
+ * g++.dg/cpp2a/is-pointer-interconvertible-with-class4.C: New test.
+ * g++.dg/cpp2a/is-pointer-interconvertible-with-class5.C: New test.
+ * g++.dg/cpp2a/is-pointer-interconvertible-with-class6.C: New test.
+
+2021-07-30 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/ext/anon-struct8.C: New test.
+
+2021-07-30 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/cpp0x/gen-attrs-76.C: New test.
+
+2021-07-30 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101685
+ * gcc.target/i386/pr101685.c: New test.
+
+2021-07-30 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/shrink-wrap-loop.c: Enable early jump threading. Mark as
+ XFAIL.
+
+2021-07-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101582
+ * g++.dg/cpp0x/gen-attrs-45.C: Expect a warning about ignored
+ attributes instead of error.
+ * g++.dg/cpp0x/gen-attrs-75.C: New test.
+ * g++.dg/modules/pr101582-1.C: New test.
+
+2021-07-30 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ PR ipa/101396
+ * g++.dg/lto/pr101396_0.C: New test.
+ * g++.dg/lto/pr101396_1.C: New test.
+
+2021-07-29 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101674
+ * gcc.dg/uninit-pred-9_b.c: Xfail just the failing assertion and
+ correct target.
+
+2021-07-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101672
+ * gdc.dg/pr100967.d: Update test.
+ * gdc.dg/pr101672.d: New test.
+
+2021-07-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101664
+ * gdc.dg/extern-c++/extern-c++.exp: New.
+ * gdc.dg/extern-c++/pr101664.d: New test.
+ * gdc.dg/extern-c++/pr101664_1.cc: New test.
+
+2021-07-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/96435
+ * gdc.dg/torture/pr96435.d: New test.
+
+2021-07-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101657
+ * gdc.dg/pr101657.d: New test.
+
+2021-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/101647
+ * g++.dg/pr71389.C: Include <array> instead of <functional>.
+ * g++.dg/cpp0x/initlist48.C: Include also <initializer_list>.
+
+2021-07-29 Thomas Schwinge <thomas@codesourcery.com>
+ Julian Brown <julian@codesourcery.com>
+ Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * c-c++-common/goacc/classify-kernels-unparallelized.c:
+ 's%oaccdevlow%oaccloops%g'.
+ * c-c++-common/goacc/classify-kernels.c: Likewise.
+ * c-c++-common/goacc/classify-parallel.c: Likewise.
+ * c-c++-common/goacc/classify-routine-nohost.c: Likewise.
+ * c-c++-common/goacc/classify-routine.c: Likewise.
+ * c-c++-common/goacc/classify-serial.c: Likewise.
+ * c-c++-common/goacc/routine-nohost-1.c: Likewise.
+ * g++.dg/goacc/template.C: Likewise.
+ * gcc.dg/goacc/loop-processing-1.c: Likewise.
+ * gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
+ * gfortran.dg/goacc/classify-kernels.f95: Likewise.
+ * gfortran.dg/goacc/classify-parallel.f95: Likewise.
+ * gfortran.dg/goacc/classify-routine-nohost.f95: Likewise.
+ * gfortran.dg/goacc/classify-routine.f95: Likewise.
+ * gfortran.dg/goacc/classify-serial.f95: Likewise.
+ * gfortran.dg/goacc/routine-multiple-directives-1.f90: Likewise.
+
+2021-07-29 Haochen Gui <guihaoc@gcc.gnu.org>
+
+ PR target/100952
+ * gcc.target/powerpc/pr56605.c: Change matching
+ conditions.
+ * gcc.target/powerpc/pr81348.c: Likewise.
+
+2021-07-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * g++.dg/debug/dwarf2/deallocator.C: Adjust for threader.
+ * gcc.c-torture/compile/pr83510.c: Same.
+ * gcc.dg/analyzer/pr94851-2.c: Same.
+ * gcc.dg/loop-unswitch-2.c: Same.
+ * gcc.dg/old-style-asm-1.c: Same.
+ * gcc.dg/pr68317.c: Same.
+ * gcc.dg/pr97567-2.c: Same.
+ * gcc.dg/predict-9.c: Same.
+ * gcc.dg/shrink-wrap-loop.c: Same.
+ * gcc.dg/sibcall-1.c: Same.
+ * gcc.dg/tree-ssa/builtin-sprintf-3.c: Same.
+ * gcc.dg/tree-ssa/pr21001.c: Same.
+ * gcc.dg/tree-ssa/pr21294.c: Same.
+ * gcc.dg/tree-ssa/pr21417.c: Same.
+ * gcc.dg/tree-ssa/pr21458-2.c: Same.
+ * gcc.dg/tree-ssa/pr21563.c: Same.
+ * gcc.dg/tree-ssa/pr49039.c: Same.
+ * gcc.dg/tree-ssa/pr61839_1.c: Same.
+ * gcc.dg/tree-ssa/pr61839_3.c: Same.
+ * gcc.dg/tree-ssa/pr77445-2.c: Same.
+ * gcc.dg/tree-ssa/split-path-4.c: Same.
+ * gcc.dg/tree-ssa/ssa-dom-thread-11.c: Same.
+ * gcc.dg/tree-ssa/ssa-dom-thread-12.c: Same.
+ * gcc.dg/tree-ssa/ssa-dom-thread-14.c: Same.
+ * gcc.dg/tree-ssa/ssa-dom-thread-18.c: Same.
+ * gcc.dg/tree-ssa/ssa-dom-thread-6.c: Same.
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Same.
+ * gcc.dg/tree-ssa/ssa-fre-48.c: Same.
+ * gcc.dg/tree-ssa/ssa-thread-11.c: Same.
+ * gcc.dg/tree-ssa/ssa-thread-12.c: Same.
+ * gcc.dg/tree-ssa/ssa-thread-14.c: Same.
+ * gcc.dg/tree-ssa/vrp02.c: Same.
+ * gcc.dg/tree-ssa/vrp03.c: Same.
+ * gcc.dg/tree-ssa/vrp05.c: Same.
+ * gcc.dg/tree-ssa/vrp06.c: Same.
+ * gcc.dg/tree-ssa/vrp07.c: Same.
+ * gcc.dg/tree-ssa/vrp09.c: Same.
+ * gcc.dg/tree-ssa/vrp19.c: Same.
+ * gcc.dg/tree-ssa/vrp20.c: Same.
+ * gcc.dg/tree-ssa/vrp33.c: Same.
+ * gcc.dg/uninit-pred-9_b.c: Same.
+ * gcc.dg/uninit-pr61112.c: Same.
+ * gcc.dg/vect/bb-slp-16.c: Same.
+ * gcc.target/i386/avx2-vect-aggressive.c: Same.
+ * gcc.dg/tree-ssa/ranger-threader-1.c: New test.
+ * gcc.dg/tree-ssa/ranger-threader-2.c: New test.
+ * gcc.dg/tree-ssa/ranger-threader-3.c: New test.
+ * gcc.dg/tree-ssa/ranger-threader-4.c: New test.
+ * gcc.dg/tree-ssa/ranger-threader-5.c: New test.
+
+2021-07-29 Richard Biener <rguenther@suse.de>
+
+ PR c/101512
+ * gcc.dg/torture/pr101512.c: New testcase.
+
+2021-07-29 liuhongt <hongtao.liu@intel.com>
+
+ PR target/99881
+ * gcc.target/i386/pr91446.c:
+ * gcc.target/i386/pr92658-avx512bw-2.c:
+ * gcc.target/i386/pr92658-sse4-2.c:
+ * gcc.target/i386/pr92658-sse4.c:
+ * gcc.target/i386/pr99881.c:
+
+2021-07-29 liuhongt <hongtao.liu@intel.com>
+
+ PR target/39821
+ * gcc.target/i386/sse2-pr39821.c: New test.
+ * gcc.target/i386/sse4-pr39821.c: New test.
+
+2021-07-29 Jiufu Guo <guojiufu@linux.ibm.com>
+
+ PR target/61837
+ * gcc.target/powerpc/pr61837.c: New test.
+
+2021-07-28 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101494
+ * gcc.dg/uninit-pr101494.c: New test.
+
+2021-07-28 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101601
+ * g++.dg/warn/Warray-bounds-25.C: New test.
+ * gcc.dg/Warray-bounds-85.c: New test.
+
+2021-07-28 Michael Meissner <meissner@linux.ibm.com>
+
+ PR testsuite/100168
+ * gcc.dg/pr56727-2.c: Add support for PC-relative calls.
+
+2021-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/torture/ubsan-1.c: New test.
+
+2021-07-28 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101564
+ * gfortran.dg/allocate_stat_3.f90: New test.
+ * gfortran.dg/allocate_stat.f90: Adjust error messages.
+ * gfortran.dg/implicit_11.f90: Likewise.
+ * gfortran.dg/inquiry_type_ref_3.f90: Likewise.
+
+2021-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101624
+ * gfortran.dg/ubsan/ubsan.exp: New file.
+ * gfortran.dg/ubsan/pr101624.f90: New test.
+
+2021-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101642
+ * gcc.c-torture/compile/pr101642.c: New test.
+
+2021-07-28 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * gcc.target/s390/global-array-element-pic2.c: Add -mzarch, add
+ an expectation for 31-bit mode.
+ * gcc.target/s390/load-imm64-1.c: Use unsigned long long.
+ * gcc.target/s390/load-imm64-2.c: Likewise.
+ * gcc.target/s390/vector/long-double-vx-macro-off-on.c: Use
+ -mzarch.
+ * gcc.target/s390/vector/long-double-vx-macro-on-off.c:
+ Likewise.
+
+2021-07-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101615
+ * gcc.dg/vect/bb-slp-pr101615-2.c: New testcase.
+
+2021-07-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/aarch64/smov_1.c: New test.
+ * gcc.target/aarch64/sve/clastb_4.c: Adjust clast scan-assembler.
+
+2021-07-28 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101456
+ * gcc.target/i386/pr101456-1.c: New test.
+ * gcc.target/i386/pr101456-2.c: Likewise.
+
+2021-07-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101615
+ * gcc.dg/vect/bb-slp-pr101615-1.c: New testcase.
+
+2021-07-28 Siddhesh Poyarekar <siddhesh@gotplt.org>
+
+ * gcc.dg/analyzer/strdup-1.c (test_4, test_5, test_6): New
+ tests.
+
+2021-07-28 Siddhesh Poyarekar <siddhesh@gotplt.org>
+
+ * gcc.dg/analyzer/attr-malloc-1.c (compatible_alloc,
+ compatible_alloc2): New extern allocator declarations.
+ (test_9, test_10): New tests.
+
+2021-07-28 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101640
+ * gdc.dg/pr96429.d: Update test.
+ * gdc.dg/pr101640.d: New test.
+
+2021-07-28 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101490
+ * gdc.dg/pr101490.d: New test.
+
+2021-07-28 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101127
+ * gdc.dg/pr101127a.d: New test.
+ * gdc.dg/pr101127b.d: New test.
+
+2021-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/101611
+ * gcc.target/i386/avx2-pr101611-1.c: New test.
+ * gcc.target/i386/avx2-pr101611-2.c: New test.
+
+2021-07-28 Martin Uecker <muecker@gwdg.de>
+
+ * gcc.dg/Wnonnull-4.c: Correct argument numbers in warnings.
+
+2021-07-28 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR libfortran/101317
+ * gfortran.dg/ISO_Fortran_binding_17.f90: Fix typo in error
+ message patterns.
+
+2021-07-28 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR libfortran/101310
+ * gfortran.dg/ISO_Fortran_binding_1.c (section_c): Remove
+ incorrect assertions.
+
+2021-07-28 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR libfortran/101305
+ * gfortran.dg/ISO_Fortran_binding_1.c: Adjust include path.
+ * gfortran.dg/ISO_Fortran_binding_10.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_11.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_12.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_15.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_16.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_17.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_18.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_3.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_5.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_6.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_7.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_8.c: Likewise.
+ * gfortran.dg/ISO_Fortran_binding_9.c: Likewise.
+ * gfortran.dg/PR94327.c: Likewise.
+ * gfortran.dg/PR94331.c: Likewise.
+ * gfortran.dg/bind_c_array_params_3_aux.c: Likewise.
+ * gfortran.dg/iso_fortran_binding_uint8_array_driver.c: Likewise.
+ * gfortran.dg/pr93524.c: Likewise.
+
+2021-07-28 Kewen Lin <linkw@linux.ibm.com>
+
+ PR tree-optimization/101596
+ * gcc.target/powerpc/pr101596-1.c: New test.
+ * gcc.target/powerpc/pr101596-2.c: Likewise.
+ * gcc.target/powerpc/pr101596-3.c: Likewise.
+
+2021-07-28 liuhongt <hongtao.liu@intel.com>
+
+ PR target/99881
+ * gcc.target/i386/pr99881.c: New test.
+
+2021-07-27 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/101584
+ * gcc.dg/uninit-38.c: Remove assertions.
+ * gcc.dg/uninit-41.c: New test.
+
+2021-07-27 Jonathan Wakely <jwakely@redhat.com>
+
+ PR testsuite/101646
+ * g++.dg/coroutines/pr99047.C: Fix includes.
+ * g++.dg/pr71655.C: Likewise.
+
+2021-07-27 Martin Sebor <msebor@redhat.com>
+
+ PR c/101585
+ * gcc.dg/Wvla-parameter-13.c: New test.
+
+2021-07-27 Jeff Law <jlaw@localhost.localdomain>
+
+ * g++.dg/gcov/gcov-threads-1.C: Fix argument to pthread_join.
+
+2021-07-27 Marek Polacek <polacek@redhat.com>
+
+ DR 1512
+ PR c++/99701
+ * g++.dg/cpp0x/nullptr11.C: Remove invalid tests.
+ * g++.dg/cpp0x/nullptr46.C: Add dg-error.
+ * g++.dg/cpp2a/spaceship-err7.C: New test.
+ * g++.dg/expr/ptr-comp4.C: New test.
+
+2021-07-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101573
+ * gcc.dg/uninit-pr101573.c: New testcase.
+ * gcc.dg/uninit-15-O0.c: Adjust.
+ * gcc.dg/uninit-15.c: Likewise.
+ * gcc.dg/uninit-23.c: Likewise.
+ * c-c++-common/uninit-17.c: Likewise.
+
+2021-07-27 Martin Jambor <mjambor@suse.cz>
+
+ * gcc.dg/ipa/remref-3.c: New test.
+ * gcc.dg/ipa/remref-4.c: Likewise.
+ * gcc.dg/ipa/remref-5.c: Likewise.
+ * gcc.dg/ipa/remref-6.c: Likewise.
+
+2021-07-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101586
+ * g++.dg/torture/builtin-clear-padding-4.C: New test.
+
+2021-07-27 Michael Meissner <meissner@linux.ibm.com>
+
+ PR testsuite/100170
+ * gcc.target/powerpc/ppc-eq0-1.c: Adjust insn counts if power10
+ code is generated.
+ * gcc.target/powerpc/ppc-ne0-1.c: (ne0): Adjust insn counts if
+ power10 code is generated.
+ (plus_ne0): Move to ppc-ne0-2.c.
+ (cmp_plus_ne): Likewise.
+ (plus_ne0_cmp): Likewise.
+ * gcc.target/powerpc/ppc-ne0-2.c: New file.
+
+2021-07-26 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/sock-1.c: New test.
+ * gcc.dg/analyzer/sock-2.c: New test.
+
+2021-07-26 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr78888.c: New.
+
+2021-07-26 Roger Sayle <roger@nextmovesoftware.com>
+ Marc Glisse <marc.glisse@inria.fr>
+
+ * gcc.dg/fold-eqrotate-1.c: New test case.
+ * gcc.dg/fold-eqbswap-1.c: New test case.
+
+2021-07-26 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+ Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/93308
+ PR fortran/93963
+ PR fortran/94327
+ PR fortran/94331
+ PR fortran/97046
+ * gfortran.dg/ISO_Fortran_binding_1.f90: Add pointer attribute,
+ this test is still erroneous but now it compiles.
+ * gfortran.dg/bind_c_array_params_2.f90: Update regex to match
+ code changes.
+ * gfortran.dg/PR93308.f90: New test.
+ * gfortran.dg/PR93963.f90: New test.
+ * gfortran.dg/PR94327.c: New test.
+ * gfortran.dg/PR94327.f90: New test.
+ * gfortran.dg/PR94331.c: New test.
+ * gfortran.dg/PR94331.f90: New test.
+ * gfortran.dg/PR97046.f90: New test.
+
+2021-07-26 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-1.C: Use attribute syntax even for section
+ and scan directives.
+ * g++.dg/gomp/attrs-2.C: Likewise.
+ * g++.dg/gomp/attrs-6.C: New test.
+ * g++.dg/gomp/attrs-7.C: New test.
+ * g++.dg/gomp/attrs-8.C: New test.
+
+2021-07-23 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101536
+ * gfortran.dg/pr101536.f90: New test.
+
+2021-07-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/101562
+ * gcc.c-torture/compile/pr101562.c: New test.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-07-23 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101504
+ * gcc.target/i386/pr101504.c: New test.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: Add new
+ tests.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: New tests.
+
+2021-07-23 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/vector_structure_intrinsics.c: New test.
+
+2021-07-23 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/attrs-1.c: New test.
+ * c-c++-common/gomp/attrs-2.c: New test.
+ * c-c++-common/gomp/attrs-3.c: New test.
+
+2021-07-23 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-4.C: New test.
+ * g++.dg/gomp/attrs-5.C: New test.
+
+2021-07-23 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ * gcc.target/mips/mips.exp (mips_option_groups): add
+ -finline and -fno-inline.
+
+2021-07-23 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ Revert:
+ 2021-07-09 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ * gcc.target/mips/cfgcleanup-jalr2.c: Remove -fno-inline and add
+ __attribute__((noinline)).
+ * gcc.target/mips/cfgcleanup-jalr3.c: Likewise.
+
+2021-07-23 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/feasibility-3.c: New test.
+
+2021-07-22 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/65178
+ * gcc.dg/uninit-pr65178.c: New test.
+
+2021-07-22 Martin Sebor <msebor@redhat.com>
+
+ PR testsuite/101568
+ * g++.dg/ipa/pr82352.C
+
+2021-07-22 Andrew Pinski <apinski@marvell.com>
+
+ PR tree-optimization/10153
+ * gcc.c-torture/compile/pr10153-1.c: New test.
+ * gcc.c-torture/compile/pr10153-2.c: New test.
+
+2021-07-22 Andrew MacLeod <amacleod@redhat.com>
+
+ * g++.dg/pr101511.C: New.
+
+2021-07-22 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr101497.c: New.
+
+2021-07-22 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr101496.c: New.
+
+2021-07-22 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/fuse-caller-save-xmm.c: Adjust testcase.
+
+2021-07-22 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/mask-shift.c: New test.
+
+2021-07-21 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101547
+ * gcc.dg/analyzer/pr101547.c: New test.
+
+2021-07-21 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101522
+ * g++.dg/analyzer/pr101522.C: New test.
+
+2021-07-21 Thomas Schwinge <thomas@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ Cesar Philippidis <cesar@codesourcery.com>
+
+ * c-c++-common/goacc/classify-routine-nohost.c: New file.
+ * c-c++-common/goacc/classify-routine.c: Update.
+ * c-c++-common/goacc/routine-2.c: Likewise.
+ * c-c++-common/goacc/routine-nohost-1.c: New file.
+ * c-c++-common/goacc/routine-nohost-2.c: Likewise.
+ * g++.dg/goacc/template.C: Update.
+ * gfortran.dg/goacc/classify-routine-nohost.f95: New file.
+ * gfortran.dg/goacc/classify-routine.f95: Update.
+ * gfortran.dg/goacc/pure-elemental-procedures-2.f90: Likewise.
+ * gfortran.dg/goacc/routine-6.f90: Likewise.
+ * gfortran.dg/goacc/routine-intrinsic-2.f: Likewise.
+ * gfortran.dg/goacc/routine-module-1.f90: Likewise.
+ * gfortran.dg/goacc/routine-module-2.f90: Likewise.
+ * gfortran.dg/goacc/routine-module-3.f90: Likewise.
+ * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
+ * gfortran.dg/goacc/routine-multiple-directives-1.f90: Likewise.
+ * gfortran.dg/goacc/routine-multiple-directives-2.f90: Likewise.
+
+2021-07-21 Thomas Schwinge <thomas@codesourcery.com>
+
+ * g++.dg/goacc/template.C: Fix '#pragma atomic update' typo.
+
+2021-07-21 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/explode-2.c: Remove xfail.
+ * gcc.dg/analyzer/explode-2a.c: Remove expected leak warning on
+ while stmt.
+ * gcc.dg/analyzer/phi-2.c: New test.
+
+2021-07-21 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ PR target/101531
+ * gcc.target/powerpc/pr101129.c: Adjust.
+
+2021-07-21 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101549
+ * gcc.target/i386/crc32-6.c: New test.
+
+2021-07-21 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101514
+ * gfortran.dg/pr101514.f90: New test.
+
+2021-07-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101535
+ * c-c++-common/gomp/pr101535-1.c: New test.
+ * c-c++-common/gomp/pr101535-2.c: New test.
+
+2021-07-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101516
+ * g++.dg/gomp/pr101516.C: New test.
+
+2021-07-21 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/iso_c_binding_char_1.f90: Update dg-error.
+ * gfortran.dg/pr32599.f03: Use -std=-f2003 + update comment.
+ * gfortran.dg/bind_c_char_10.f90: New test.
+ * gfortran.dg/bind_c_char_6.f90: New test.
+ * gfortran.dg/bind_c_char_7.f90: New test.
+ * gfortran.dg/bind_c_char_8.f90: New test.
+ * gfortran.dg/bind_c_char_9.f90: New test.
+
+2021-07-21 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/unroll-10.c: New test.
+
+2021-07-21 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/unroll-9.c: New test/
+
+2021-07-20 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101397
+ * gcc.dg/Warray-bounds-80.c: New test.
+ * gcc.dg/Warray-bounds-81.c: New test.
+ * gcc.dg/Warray-bounds-82.c: New test.
+ * gcc.dg/Warray-bounds-83.c: New test.
+ * gcc.dg/Warray-bounds-84.c: New test.
+ * gcc.dg/Wstringop-overflow-46.c: Adjust expected output.
+
+2021-07-20 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101300
+ * gcc.dg/uninit-pr101300.c: New test.
+
+2021-07-20 Michael Meissner <meissner@linux.ibm.com>
+
+ PR testsuite/100167
+ * gcc.target/powerpc/fold-vec-div-longlong.c: Fix expected code
+ generation on power10.
+ * gcc.target/powerpc/fold-vec-mult-longlong.c: Likewise.
+
+2021-07-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/101384
+ * gcc.dg/pr101384.c: New test.
+ * gcc.target/powerpc/pr101384-1.c: New test.
+ * gcc.target/powerpc/pr101384-2.c: New test.
+
+2021-07-20 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR testsuite/101506
+ * gcc.target/aarch64/vect-vmaxv.c: Use an asm to hide the
+ true initial value of the reduction from the vectorizer.
+ * gcc.target/aarch64/vect-vaddv.c: Likewise. Make the vector
+ loop operate on exactly LANES (rather than LANES-1) iterations.
+ * gcc.target/aarch64/vect-fmaxv-fminv.x: Likewise.
+
+2021-07-20 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100182
+ * gcc.target/i386/pr71245-1.c: Remove.
+ * gcc.target/i386/pr71245-2.c: Ditto.
+
+2021-07-20 Kewen Lin <linkw@linux.ibm.com>
+
+ * gcc.target/powerpc/mul-vectorize-3.c: New test.
+ * gcc.target/powerpc/mul-vectorize-4.c: New test.
+
+2021-07-20 Kewen Lin <linkw@linux.ibm.com>
+
+ PR tree-optimization/100696
+ * gcc.target/i386/pr100637-3w.c: Adjust for mul_highpart recog.
+
+2021-07-19 Martin Sebor <msebor@redhat.com>
+
+ * gcc.target/powerpc/pr93658.c: Suppress valid warnings.
+
+2021-07-19 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR c++/95520
+ * g++.dg/coroutines/pr95520.C: New test.
+
+2021-07-19 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101503
+ * gcc.dg/analyzer/pr101503.c: New test.
+
+2021-07-19 Indu Bhagat <indu.bhagat@oracle.com>
+
+ * gcc.dg/debug/btf/btf.exp: Do not run BTF testsuite if target does not
+ support BTF format. Remove redundant check for AIX.
+ * gcc.dg/debug/ctf/ctf.exp: Do not run CTF testsuite if target does not
+ support CTF format. Remove redundant check for AIX.
+ * lib/gcc-dg.exp: Remove redundant check for AIX.
+
+2021-07-19 Andrew Stubbs <ams@codesourcery.com>
+
+ PR target/100208
+ * gcc.target/gcn/sram-ecc-1.c: New test.
+ * gcc.target/gcn/sram-ecc-2.c: New test.
+ * gcc.target/gcn/sram-ecc-3.c: New test.
+ * gcc.target/gcn/sram-ecc-4.c: New test.
+ * gcc.target/gcn/sram-ecc-5.c: New test.
+ * gcc.target/gcn/sram-ecc-6.c: New test.
+ * gcc.target/gcn/sram-ecc-7.c: New test.
+ * gcc.target/gcn/sram-ecc-8.c: New test.
+
+2021-07-19 Andrew Pinski <apinski@marvell.com>
+
+ PR target/101205
+ * gcc.target/aarch64/csinv-neg-1.c: New test.
+
+2021-07-19 Marek Polacek <polacek@redhat.com>
+
+ DR 2126
+ * g++.dg/cpp0x/constexpr-temp2.C: New test.
+
+2021-07-19 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101505
+ * gcc.dg/vect/pr101505.c: New testcase.
+
+2021-07-18 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101492
+ * gcc.target/i386/pr101492-1.c: New test.
+ * gcc.target/i386/pr101492-2.c: Likewise.
+ * gcc.target/i386/pr101492-3.c: Likewise.
+ * gcc.target/i386/pr101492-4.c: Likewise.
+
+2021-07-18 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101084
+ * gfortran.dg/fmt_nonchar_3.f90: New test.
+
+2021-07-18 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101495
+ * gcc.target/i386/avx-vzeroupper-28.c: New test.
+
+2021-07-18 Antoni Boucher <bouanto@zoho.com>
+
+ PR target/95498
+ * jit.dg/all-non-failing-tests.h: New test.
+ * jit.dg/test-cast.c: New test.
+
+2021-07-17 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc.dg/tree-ssa/modref-6.c: New test.
+
+2021-07-17 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr96542.c: New.
+
+2021-07-16 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101233
+ * g++.dg/cpp2a/class-deduction-alias10.C: New test.
+
+2021-07-16 Patrick Palka <ppalka@redhat.com>
+
+ DR 960
+ PR c++/99664
+ * g++.dg/inherit/covariant23.C: New test.
+
+2021-07-16 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/analyzer-decls.h (__analyzer_dump_state): New.
+ * gcc.dg/analyzer/dump-state.c: New test.
+
+2021-07-16 Martin Sebor <msebor@redhat.com>
+
+ PR testsuite/101468
+ * gcc.dg/Wstringop-overflow-41.c: Adjust to avoid target-specific
+ failures.
+ * gcc.dg/Wstringop-overflow-42.c: Same.
+ * gcc.dg/Wstringop-overflow-68.c: Same.
+ * gcc.dg/Wstringop-overflow-70.c: Same.
+ * gcc.dg/Wstringop-overflow-71.c: Same.
+ * gcc.dg/strlenopt-95.c: Fix typos.
+
+2021-07-16 Tamar Christina <tamar.christina@arm.com>
+
+ PR middle-end/101457
+ * gcc.dg/vect/vect-reduc-dot-19.c: Use long long.
+ * gcc.dg/vect/vect-reduc-dot-20.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-21.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-22.c: Likewise.
+
+2021-07-16 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/cpp1y/Wnarrowing2.C: New test.
+ * g++.dg/cpp1y/Wnarrowing2.h: New test.
+
+2021-07-16 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * g++.dg/ext/visibility/noPLT.C: Skip on s390x.
+ * g++.target/s390/mi-thunk.C: New test.
+ * gcc.target/s390/nodatarel-1.c: Move foostatic to the new
+ tests.
+ * gcc.target/s390/pr80080-4.c: Allow @PLT suffix.
+ * gcc.target/s390/risbg-ll-3.c: Likewise.
+ * gcc.target/s390/call.h: Common code for the new tests.
+ * gcc.target/s390/call-z10-pic-nodatarel.c: New test.
+ * gcc.target/s390/call-z10-pic.c: New test.
+ * gcc.target/s390/call-z10.c: New test.
+ * gcc.target/s390/call-z9-pic-nodatarel.c: New test.
+ * gcc.target/s390/call-z9-pic.c: New test.
+ * gcc.target/s390/call-z9.c: New test.
+ * gcc.target/s390/mfentry-m64-pic.c: New test.
+ * gcc.target/s390/tls.h: Common code for the new TLS tests.
+ * gcc.target/s390/tls-pic.c: New test.
+ * gcc.target/s390/tls.c: New test.
+
+2021-07-16 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/sve/extract_1.c: Split expected results
+ by big/little endian targets, restoring the old expected
+ result for big endian.
+ * gcc.target/aarch64/sve/extract_2.c: Likewise.
+ * gcc.target/aarch64/sve/extract_3.c: Likewise.
+ * gcc.target/aarch64/sve/extract_4.c: Likewise.
+
+2021-07-15 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101346
+ * gcc.target/i386/pr101346.c: New test.
+
+2021-07-15 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97027
+ * gcc.dg/Wstringop-overflow-15.c: Remove an xfail.
+ * gcc.dg/Wstringop-overflow-47.c: Adjust xfails.
+ * gcc.dg/torture/pr69170.c: Avoid valid warnings.
+ * gcc.dg/torture/pr70025.c: Prune out a false positive.
+ * gcc.dg/vect/pr97769.c: Initialize a loop control variable.
+ * gcc.target/i386/pr92658-avx512bw-trunc.c: Increase buffer size
+ to avoid overflow.
+ * gcc.target/i386/pr92658-avx512f.c: Same.
+ * gcc.dg/Wstringop-overflow-68.c: New test.
+ * gcc.dg/Wstringop-overflow-69.c: New test.
+ * gcc.dg/Wstringop-overflow-70.c: New test.
+ * gcc.dg/Wstringop-overflow-71.c: New test.
+ * gcc.dg/strlenopt-95.c: New test.
+
+2021-07-15 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/95006
+ PR analyzer/94713
+ PR analyzer/94714
+ * g++.dg/analyzer/pr93212.C: Update location of warning.
+ * g++.dg/analyzer/pr94011.C: Add
+ -Wno-analyzer-use-of-uninitialized-value.
+ * g++.dg/analyzer/pr94503.C: Likewise.
+ * gcc.dg/analyzer/clobbers-1.c: Convert "f" from a local to a
+ param to avoid uninitialized warning.
+ * gcc.dg/analyzer/data-model-1.c (test_12): Add test for
+ uninitialized value on result of alloca.
+ (test_12a): Add expected warning.
+ (test_12c): Likewise.
+ (test_19): Likewise.
+ (test_29b): Likewise.
+ (test_29c): Likewise.
+ (test_37): Remove xfail.
+ (test_37a): Likewise.
+ * gcc.dg/analyzer/data-model-20.c: Add warning about leak.
+ * gcc.dg/analyzer/explode-2.c: Remove params; add
+ -Wno-analyzer-too-complex, -Wno-analyzer-malloc-leak, and xfails.
+ Initialize the locals.
+ * gcc.dg/analyzer/explode-2a.c: Initialize the locals. Add
+ expected leak.
+ * gcc.dg/analyzer/fgets-1.c: New test.
+ * gcc.dg/analyzer/fread-1.c: New test.
+ * gcc.dg/analyzer/malloc-1.c (test_16): Add expected warning.
+ (test_40): Likewise.
+ * gcc.dg/analyzer/memset-CVE-2017-18549-1.c: Check for
+ uninitialized padding.
+ * gcc.dg/analyzer/pr93355-localealias-feasibility.c (fread): New
+ decl.
+ (read_alias_file): Call it.
+ * gcc.dg/analyzer/pr94047.c: Add expected warnings.
+ * gcc.dg/analyzer/pr94851-2.c: Likewise.
+ * gcc.dg/analyzer/pr96841.c: Convert local to a param.
+ * gcc.dg/analyzer/pr98628.c: Likewise.
+ * gcc.dg/analyzer/pr99042.c: Updated expected location of leak
+ diagnostics.
+ * gcc.dg/analyzer/symbolic-1.c: Add expected warnings.
+ * gcc.dg/analyzer/symbolic-7.c: Likewise.
+ * gcc.dg/analyzer/torture/pr93649.c: Add expected warning. Skip
+ with -fno-fat-lto-objects.
+ * gcc.dg/analyzer/uninit-1.c: New test.
+ * gcc.dg/analyzer/uninit-2.c: New test.
+ * gcc.dg/analyzer/uninit-3.c: New test.
+ * gcc.dg/analyzer/uninit-4.c: New test.
+ * gcc.dg/analyzer/uninit-pr94713.c: New test.
+ * gcc.dg/analyzer/uninit-pr94714.c: New test.
+ * gcc.dg/analyzer/use-after-free-2.c: New test.
+ * gcc.dg/analyzer/use-after-free-3.c: New test.
+ * gcc.dg/analyzer/zlib-3.c: Add expected warning.
+ * gcc.dg/analyzer/zlib-6.c: Convert locals to params to avoid
+ uninitialized warnings. Remove xfail.
+ * gcc.dg/analyzer/zlib-6a.c: New test, based on the old version
+ of the above.
+ * gfortran.dg/analyzer/pr97668.f: Add
+ -Wno-analyzer-use-of-uninitialized-value and
+ -Wno-analyzer-too-complex.
+
+2021-07-15 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/phi-1.c: New test.
+
+2021-07-15 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ * lib/target-supports.exp (arm_v8_2a_imm8_neon_ok_nocache):
+ Delete.
+
+2021-07-15 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ * gcc.target/arm/simd/vusdot-autovec.c: Use arm_v8_2a_i8mm_ok
+ effective-target.
+
+2021-07-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101443
+ * g++.dg/cpp0x/nullptr46.C: New test.
+
+2021-07-15 Tamar Christina <tamar.christina@arm.com>
+
+ PR middle-end/101457
+ * gcc.dg/vect/vect-reduc-dot-17.c: Fix signs of scalar code.
+ * gcc.dg/vect/vect-reduc-dot-18.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-22.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-9.c: Likewise.
+
+2021-07-15 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wvla-parameter-12.c: New test.
+
+2021-07-15 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ PR target/101129
+ * gcc.target/powerpc/pr101129.c: New.
+
+2021-07-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101437
+ * gcc.c-torture/compile/pr101437.c: New test.
+
+2021-07-14 Peter Bergner <bergner@linux.ibm.com>
+
+ * gcc.target/powerpc/mma-builtin-9.c: New test.
+
+2021-07-14 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/88252
+ * g++.dg/cpp1z/class-deduction96.C: New test.
+
+2021-07-14 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/torture/pr100382.C: Pass -fno-delete-dead-exceptions.
+
+2021-07-14 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.dg/vect/vect-reduc-dot-11.c: Expect pass.
+ * gcc.dg/vect/vect-reduc-dot-15.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-19.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-21.c: Likewise.
+
+2021-07-14 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr80776-1.c: Remove xfail.
+
+2021-07-14 Marek Polacek <polacek@redhat.com>
+
+ PR c++/101371
+ * g++.dg/cpp1y/constexpr-101371-2.C: New test.
+ * g++.dg/cpp1y/constexpr-101371.C: New test.
+
+2021-07-14 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100949
+ * gfortran.dg/pr100949.f90: New test.
+
+2021-07-14 Tamar Christina <tamar.christina@arm.com>
+
+ * lib/target-supports.exp
+ (check_effective_target_arm_v8_2a_imm8_neon_ok_nocache,
+ check_effective_target_arm_v8_2a_i8mm_neon_hw,
+ check_effective_target_vect_usdot_qi): New.
+ * gcc.dg/vect/vect-reduc-dot-9.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-10.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-11.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-12.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-13.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-14.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-15.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-16.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-17.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-18.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-19.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-20.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-21.c: New test.
+ * gcc.dg/vect/vect-reduc-dot-22.c: New test.
+
+2021-07-14 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.target/arm/simd/vusdot-autovec.c: New test.
+
+2021-07-14 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.target/aarch64/simd/vusdot-autovec.c: New test.
+ * gcc.target/aarch64/sve/vusdot-autovec.c: New test.
+
+2021-07-14 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101395
+ * gcc.target/i386/pr101395-1.c: New test.
+ * gcc.target/i386/pr101395-2.c: Likewise.
+ * gcc.target/i386/pr101395-3.c: Likewise.
+
+2021-07-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101445
+ * gcc.dg/vect/pr101445.c: New testcase.
+
+2021-07-14 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/vect-reduc-1.c: New testcase.
+
+2021-07-13 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/extract_zero_extend.c: Remove dump scan
+ for RTL pattern match.
+ * gcc.target/aarch64/narrow_high_combine.c: Add new tests.
+ * gcc.target/aarch64/simd/vmulx_laneq_f64_1.c: Update
+ scan-assembler regex to look for a scalar register instead of
+ lane 0 of a vector.
+ * gcc.target/aarch64/simd/vmulxd_laneq_f64_1.c: Likewise.
+ * gcc.target/aarch64/simd/vmulxs_lane_f32_1.c: Likewise.
+ * gcc.target/aarch64/simd/vmulxs_laneq_f32_1.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmlalh_lane_s16.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmlals_lane_s32.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmlslh_lane_s16.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmlsls_lane_s32.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmullh_lane_s16.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmullh_laneq_s16.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmulls_lane_s32.c: Likewise.
+ * gcc.target/aarch64/simd/vqdmulls_laneq_s32.c: Likewise.
+ * gcc.target/aarch64/sve/dup_lane_1.c: Likewise.
+ * gcc.target/aarch64/sve/extract_1.c: Likewise.
+ * gcc.target/aarch64/sve/extract_2.c: Likewise.
+ * gcc.target/aarch64/sve/extract_3.c: Likewise.
+ * gcc.target/aarch64/sve/extract_4.c: Likewise.
+ * gcc.target/aarch64/sve/live_1.c: Update scan-assembler regex
+ cases to look for 'b' and 'h' registers instead of 'w'.
+ * gcc.target/arm/crypto-vsha1cq_u32.c: Update scan-assembler
+ regex to reflect lane 0 vector extractions being simplified
+ to scalar register moves.
+ * gcc.target/arm/crypto-vsha1h_u32.c: Likewise.
+ * gcc.target/arm/crypto-vsha1mq_u32.c: Likewise.
+ * gcc.target/arm/crypto-vsha1pq_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_f16.c: Extract
+ lane 1 as the moves for lane 0 now get optimized away.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_u16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_u8.c: Likewise.
+
+2021-07-13 Paul A. Clarke <pc@us.ibm.com>
+
+ * gcc.target/powerpc/sse4_1-ptest-1.c: Copy from
+ gcc/testsuite/gcc.target/i386.
+
+2021-07-13 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/93781
+ * gcc.dg/tree-ssa/pr93781-1.c: Check that call is removed.
+
+2021-07-13 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/reduc_9.c: New test.
+ * gcc.target/aarch64/sve/reduc_9_run.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_10.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_10_run.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_11.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_11_run.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_12.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_12_run.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_13.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_13_run.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_14.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_14_run.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_15.c: Likewise.
+ * gcc.target/aarch64/sve/reduc_15_run.c: Likewise.
+
+2021-07-13 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/cond_arith_6.c: New test.
+
+2021-07-13 Jakub Jelinek <jakub@redhat.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101419
+ * gcc.dg/builtin-object-size-10.c: Pass -fdump-tree-early_objsz-details
+ instead of -fdump-tree-objsz1-details in dg-options and adjust names
+ of dump file in scan-tree-dump.
+ * gcc.dg/pr101419.c: New test.
+
+2021-07-13 Richard Biener <rguenther@suse.de>
+
+ Revert:
+ 2021-07-13 Richard Biener <rguenther@suse.de>
+
+ * g++.dg/vect/slp-pr87105.cc: Adjust.
+ * gcc.dg/vect/bb-slp-pr54400.c: Likewise.
+
+2021-07-13 Michael Meissner <meissner@linux.ibm.com>
+
+ PR testsuite/100166
+ * gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c: Update
+ insn counts to account for power10 prefixed loads and stores.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_vsx_ld-char.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_vsx_ld-double.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_vsx_ld-float.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_vsx_ld-int.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_vsx_ld-longlong.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_vsx_ld-short.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_xl-char.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_xl-double.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_xl-float.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_xl-int.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_xl-longlong.c: Likewise.
+ * gcc.target/powerpc/fold-vec-load-vec_xl-short.c: Likewise.
+ * gcc.target/powerpc/fold-vec-splat-floatdouble.c: Likewise.
+ * gcc.target/powerpc/fold-vec-splat-longlong.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-builtin_vec_xst-char.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-builtin_vec_xst-double.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-builtin_vec_xst-float.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-builtin_vec_xst-int.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-builtin_vec_xst-longlong.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-builtin_vec_xst-short.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_vsx_st-char.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_vsx_st-double.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_vsx_st-float.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_vsx_st-int.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_vsx_st-longlong.c:
+ Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_vsx_st-short.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_xst-char.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_xst-double.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_xst-float.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_xst-int.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_xst-longlong.c: Likewise.
+ * gcc.target/powerpc/fold-vec-store-vec_xst-short.c: Likewise.
+ * gcc.target/powerpc/lvsl-lvsr.c: Likewise.
+ * gcc.target/powerpc/pr86731-fwrapv-longlong.c: Likewise.
+
+2021-07-13 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/vec-splati-runnable.c: Run test with -O2
+ optimization. Do not check what XXSPLTIDP generates if the value
+ is undefined.
+
+2021-07-12 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/79501
+ PR c++/100983
+ * g++.dg/cpp1z/class-deduction92.C: New test.
+ * g++.dg/cpp1z/class-deduction93.C: New test.
+ * g++.dg/cpp1z/class-deduction94.C: New test.
+ * g++.dg/cpp1z/class-deduction95.C: New test.
+
+2021-07-12 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101424
+ * gcc.target/i386/pr101424.c: New test.
+
+2021-07-12 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/tree-ssa/pr101335.c: New.
+
+2021-07-12 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/tree-ssa/pr96928-1.c: Update to similar as pr96928.c.
+
+2021-07-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101373
+ * g++.dg/torture/pr101373.C: New testcase, XFAILed.
+ * gnat.dg/opt95.adb: Likewise.
+
+2021-07-12 Richard Biener <rguenther@suse.de>
+
+ * g++.dg/vect/slp-pr87105.cc: Adjust.
+ * gcc.dg/vect/bb-slp-pr54400.c: Likewise.
+
+2021-07-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101394
+ * gcc.dg/torture/pr101394.c: New testcase.
+
+2021-07-12 Roger Sayle <roger@nextmovesoftware.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/101403
+ * gcc.dg/pr101403.c: Avoid (unimportant) uninitialized variable.
+
+2021-07-12 prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR target/66791
+ * gcc.target/arm/armv8_2-fp16-neon-2.c: Adjust.
+
+2021-07-12 prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR target/98435
+ * gcc.target/arm/simd/pr98435.c: New test.
+
+2021-07-12 Roger Sayle <roger@nextmovesoftware.com>
+
+ PR tree-optimization/101403
+ * gcc.dg/pr101403.c: New test case.
+
+2021-07-10 John David Anglin <danglin@gcc.gnu.org>
+
+ * gcc.dg/torture/pr100329.c: Require target lra.
+ * gcc.dg/torture/pr100519.c: Likewise.
+
+2021-07-10 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/82110
+ * g++.dg/cpp0x/pr78765.C: Expect another conversion failure
+ diagnostic.
+ * g++.dg/template/sfinae14.C: Flip incorrect assertion.
+ * g++.dg/cpp2a/concepts-requires27.C: New test.
+
+2021-07-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/101098
+ * g++.dg/concepts/explicit-spec1.C: New test.
+
+2021-07-09 Roger Sayle <roger@nextmovesoftware.com>
+ Uroš Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/divmod-9.c: New test case.
+
+2021-07-09 Indu Bhagat <indu.bhagat@oracle.com>
+
+ PR testsuite/101269
+ * gcc.dg/debug/btf/btf-datasec-1.c: Force -msdata=none with ilp32 for
+ powerpc based targets.
+
+2021-07-09 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101181
+ * g++.dg/cpp2a/concepts-requires26.C: New test.
+ * g++.dg/cpp2a/lambda-uneval16.C: New test.
+
+2021-07-09 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101247
+ * g++.dg/cpp2a/concepts-memtmpl4.C: Uncomment the commented out
+ example, which we now handle correctly.
+ * g++.dg/cpp2a/concepts-memtmpl5.C: New test.
+ * g++.dg/cpp2a/concepts-memtmpl5a.C: New test.
+
+2021-07-09 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ * gcc.target/mips/cfgcleanup-jalr2.c: Remove -fno-inline and add
+ __attribute__((noinline)).
+ * gcc.target/mips/cfgcleanup-jalr3.c: Likewise.
+
+2021-07-09 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ PR target/100760
+ PR target/100761
+ PR target/100762
+ * gcc.target/mips/pr100760.c: New test.
+ * gcc.target/mips/pr100761.c: New test.
+ * gcc.target/mips/pr100762.c: New test.
+
+2021-07-09 Kewen Lin <linkw@linux.ibm.com>
+
+ * gcc.target/powerpc/mod-vectorize.c: New test.
+
+2021-07-09 Kewen Lin <linkw@linux.ibm.com>
+
+ * gcc.target/powerpc/div-vectorize-1.c: New test.
+
+2021-07-09 Kewen Lin <linkw@linux.ibm.com>
+
+ * gcc.target/powerpc/mul-vectorize-1.c: New test.
+ * gcc.target/powerpc/mul-vectorize-2.c: New test.
+
+2021-07-08 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wstringop-overflow-43.c: Remove an xfail.
+
+2021-07-08 Martin Sebor <msebor@redhat.com>
+
+ PR testsuite/100451
+ * g++.dg/warn/Warray-bounds-20.C: Adjust expected output for LP32.
+
+2021-07-08 Martin Sebor <msebor@redhat.com>
+
+ * g++.dg/warn/Warray-bounds-11.C: Avoid including <new>.
+ * g++.dg/warn/Warray-bounds-13.C: Same.
+
+2021-07-08 Marek Polacek <polacek@redhat.com>
+
+ PR c++/101087
+ * g++.dg/cpp0x/noexcept70.C: New test.
+
+2021-07-08 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/101066
+ * gcc.dg/ipa/pr101066.c: New test.
+
+2021-07-08 Martin Sebor <msebor@redhat.com>
+
+ PR bootstrap/101374
+ * c-c++-common/Warray-bounds-3.c: Xfail assertion.
+ * c-c++-common/Warray-bounds-4.c: Same.
+
+2021-07-08 Christophe Lyon <christophe.lyon@foss.st.om>
+
+ * gcc.dg/debug/pr57351.c: Require arm_arch_v7a_ok
+ effective-target.
+
+2021-07-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/acle/general/cntb_1.c: New test.
+
+2021-07-08 Roger Sayle <roger@nextmovesoftware.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/40210
+ * gcc.dg/builtin-bswap-13.c: New test.
+ * gcc.dg/builtin-bswap-14.c: New test.
+
+2021-07-08 Michael Meissner <meissner@linux.ibm.com>
+
+ PR target/100809
+ * gcc.target/powerpc/p10-vdivq-vmodq.c: New test.
+
+2021-07-07 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/pattern-test-2.c: Update expected results.
+ * gcc.dg/plugin/analyzer_gil_plugin.c
+ (gil_state_machine::on_condition): Remove.
+
+2021-07-07 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/100137
+ PR tree-optimization/99121
+ PR tree-optimization/97027
+ * c-c++-common/Warray-bounds-3.c: Remove xfail
+ * c-c++-common/Warray-bounds-4.c: Add an expected warning.
+ * c-c++-common/Warray-bounds-9.c: New test.
+ * c-c++-common/Warray-bounds-10.c: New test.
+ * g++.dg/asan/asan_test.C: Suppress expected warnings.
+ * g++.dg/pr95768.C: Same.
+ * g++.dg/warn/Warray-bounds-10.C: Adjust text of expected messages.
+ * g++.dg/warn/Warray-bounds-11.C: Same.
+ * g++.dg/warn/Warray-bounds-12.C: Same.
+ * g++.dg/warn/Warray-bounds-13.C: Same.
+ * g++.dg/warn/Warray-bounds-17.C: Same.
+ * g++.dg/warn/Warray-bounds-20.C: Same.
+ * gcc.dg/Warray-bounds-29.c: Same.
+ * gcc.dg/Warray-bounds-30.c: Add xfail.
+ * gcc.dg/Warray-bounds-31.c: Adjust text of expected messages.
+ * gcc.dg/Warray-bounds-32.c: Same.
+ * gcc.dg/Warray-bounds-52.c: Same.
+ * gcc.dg/Warray-bounds-53.c: Same.
+ * gcc.dg/Warray-bounds-58.c: Remove xfail.
+ * gcc.dg/Warray-bounds-63.c: Adjust text of expected messages.
+ * gcc.dg/Warray-bounds-66.c: Same.
+ * gcc.dg/Warray-bounds-69.c: Same.
+ * gcc.dg/Wstringop-overflow-34.c: Same.
+ * gcc.dg/Wstringop-overflow-47.c: Same.
+ * gcc.dg/Wstringop-overflow-61.c: Same.
+ * gcc.dg/Warray-bounds-77.c: New test.
+ * gcc.dg/Warray-bounds-78.c: New test.
+ * gcc.dg/Warray-bounds-79.c: New test.
+
+2021-07-07 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ PR debug/101321
+ * gcc.dg/debug/btf/btf-bitfields-3.c: Remove -fno-short-enums.
+
+2021-07-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/34195
+ * gcc.dg/vect/pr34195.c: New testcase.
+
+2021-07-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99728
+ * g++.dg/opt/pr99728.C: New testcase.
+
+2021-07-07 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512f-vect-fmaddsubXXXpd.c: New test.
+ * gcc.target/i386/avx512f-vect-fmaddsubXXXps.c: New test.
+ * gcc.target/i386/avx512f-vect-fmsubaddXXXpd.c: New test.
+ * gcc.target/i386/avx512f-vect-fmsubaddXXXps.c: New test.
+
+2021-07-06 Indu Bhagat <indu.bhagat@oracle.com>
+
+ PR debug/101283
+ * gcc.dg/debug/btf/btf-bitfields-3.c: Remove the check on btm_type.
+
+2021-07-06 Indu Bhagat <indu.bhagat@oracle.com>
+
+ PR debug/101283
+ * gcc.dg/debug/ctf/ctf-attr-mode-1.c: Remove the check for ctv_typeidx.
+
+2021-07-06 Martin Sebor <msebor@redhat.com>
+
+ PR c++/55881
+ * g++.dg/warn/uninit-pr55881.C: New test.
+
+2021-07-06 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/86650
+ * gcc.dg/Warray-bounds-76.c: New test.
+
+2021-07-06 Indu Bhagat <indu.bhagat@oracle.com>
+
+ PR debug/101283
+ * gcc.dg/debug/ctf/ctf-struct-array-2.c: Adjust the value in the testcase.
+
+2021-07-06 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/format/gcc_diag-10.c: Update expected warnings.
+ * gcc.dg/plugin/diagnostic_plugin_test_inlining.c: Remove %G.
+
+2021-07-06 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wobjsize-1.c: Prune expected output.
+ * gcc.dg/Warray-bounds-71.c: New test.
+ * gcc.dg/Warray-bounds-71.h: New test header.
+ * gcc.dg/Warray-bounds-72.c: New test.
+ * gcc.dg/Warray-bounds-73.c: New test.
+ * gcc.dg/Warray-bounds-74.c: New test.
+ * gcc.dg/Warray-bounds-75.c: New test.
+ * gcc.dg/Wfree-nonheap-object-4.c: Adjust expected output.
+ * gcc.dg/Wfree-nonheap-object-5.c: New test.
+ * gcc.dg/Wfree-nonheap-object-6.c: New test.
+ * gcc.dg/pragma-diag-10.c: New test.
+ * gcc.dg/pragma-diag-9.c: New test.
+ * gcc.dg/uninit-suppress_3.c: New test.
+ * gcc.dg/pr79214.c: Xfail tests.
+ * gcc.dg/tree-ssa/builtin-sprintf-warn-27.c: New test.
+ * gcc.dg/format/c90-printf-1.c: Adjust expected output.
+
+2021-07-06 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/97194
+ * gcc.target/i386/sse4_1-vec-set-1a.c: New test.
+ * gcc.target/i386/sse4_1-vec-set-2a.c: Ditto.
+
+2021-07-06 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/vect-fmaddsubXXXpd.c: New testcase.
+ * gcc.target/i386/vect-fmaddsubXXXps.c: Likewise.
+ * gcc.target/i386/vect-fmsubaddXXXpd.c: Likewise.
+ * gcc.target/i386/vect-fmsubaddXXXps.c: Likewise.
+
+2021-07-06 Andrew Pinski <apinski@marvell.com>
+
+ PR tree-optimization/101256
+ * g++.dg/torture/pr101256.C: New test.
+
+2021-07-06 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/100227
+ * gfortran.dg/implied_do_io_7.f90: New test.
+
+2021-07-06 Kewen Lin <linkw@linux.ibm.com>
+
+ PR rtl-optimization/100328
+ * gcc.target/aarch64/sve/acle/asm/div_f16.c: Remove one xfail.
+ * gcc.target/aarch64/sve/acle/asm/div_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/div_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/divr_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/divr_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/divr_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mad_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mad_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mad_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mla_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mla_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mla_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mls_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mls_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mls_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/msb_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/msb_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/msb_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mulx_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mulx_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/mulx_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmad_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmad_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmad_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmla_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmla_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmla_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmls_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmls_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmls_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmsb_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmsb_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/nmsb_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/sub_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/sub_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/sub_f64.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/subr_f16.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/subr_f32.c: Likewise.
+ * gcc.target/aarch64/sve/acle/asm/subr_f64.c: Likewise.
+
+2021-07-06 Indu Bhagat <indu.bhagat@oracle.com>
+
+ PR debug/101283
+ * gcc.dg/debug/btf/btf-cvr-quals-1.c: Use -gdwarf-4 on Darwin targets.
+ * gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Likewise.
+
+2021-07-05 Andrew Pinski <apinski@marvell.com>
+
+ PR tree-optimization/101039
+ * gcc.dg/tree-ssa/phi-opt-15.c: Update test to expect
+ ABSU and still not expect ABS_EXPR.
+ * gcc.dg/tree-ssa/phi-opt-23.c: New test.
+ * gcc.dg/tree-ssa/phi-opt-24.c: New test.
+
+2021-07-05 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ PR debug/101321
+ * gcc.dg/debug/btf/btf-bitfields-3.c: Add -fno-short-enums.
+
+2021-07-05 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/101299
+ * gcc.dg/vect/bb-slp-74.c: Add vect_double requires.
+
+2021-07-05 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr92658-avx512vl.c: Refine testcase.
+
+2021-07-03 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.dg/debug/btf/btf.exp: Skip on AIX.
+ * gcc.dg/debug/ctf/ctf.exp: Skip on AIX.
+ * lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): AIX
+ doesn't support CTF.
+ (gcc-dg-debug-runtest): Move CTF support within
+ target support format test.
+
+2021-07-03 H.J. Lu <hjl.tools@gmail.com>
+
+ PR middle-end/101294
+ * gcc.dg/pr101294.c: New test.
+
+2021-07-03 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101273
+ * gdc.dg/torture/pr101273.d: New test.
+
+2021-07-02 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/101282
+ * gdc.dg/torture/pr101282.d: New test.
+
+2021-07-02 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/gomp/attrs-1.C: New test.
+ * g++.dg/gomp/attrs-2.C: New test.
+ * g++.dg/gomp/attrs-3.C: New test.
+
+2021-07-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/101297
+ * c-c++-common/gomp/atomic-24.c: New test.
+
+2021-07-02 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101247
+ * g++.dg/cpp2a/concepts-memtmpl4.C: New test.
+
+2021-07-02 Peter Bergner <bergner@linux.ibm.com>
+
+ * gcc.target/powerpc/mma-builtin-7.c: New test.
+ * gcc.target/powerpc/mma-builtin-8.c: New test.
+
+2021-07-02 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/101223
+ * gcc.dg/pr101223.c: New.
+
+2021-07-02 David Faust <david.faust@oracle.com>
+
+ * gcc.dg/debug/btf/btf-float-1.c: New test.
+ * gcc.dg/debug/btf/btf-function-3.c: Use different unrepresentable type.
+ * gcc.dg/debug/btf/btf-struct-2.c: Likewise.
+ * gcc.dg/debug/btf/btf-variables-2.c: Likewise.
+
+2021-07-02 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
+
+ * lib/gcc-defs.exp: Add a comment.
+
+2021-07-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101293
+ * gcc.dg/tree-ssa/ssa-lim-15.c: New testcase.
+
+2021-07-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/101286
+ * gcc.target/i386/avx2-pr101286.c: New test.
+
+2021-07-02 Hongyu Wang <hongyu.wang@intel.com>
+
+ * gcc.target/i386/keylocker-aesdec128kl.c: Update test.
+ * gcc.target/i386/keylocker-aesdec256kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesdecwide128kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesdecwide256kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesenc128kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesenc256kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesencwide128kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesencwide256kl.c: Likewise.
+
+2021-07-01 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/float128-cmove.c: New test.
+ * gcc.target/powerpc/float128-minmax-3.c: New test.
+
+2021-07-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-c++-common/dump-ada-spec-14.c: Adjust dg-warning directive.
+
+2021-07-01 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/100865
+ * gcc.target/i386/avx512f-broadcast-pr87767-1.c: Expect integer
+ broadcast.
+ * gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
+ * gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
+ * gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
+ * gcc.target/i386/avx512f_cond_move.c: Also pass
+ -mprefer-vector-width=512 and expect integer broadcast.
+ * gcc.target/i386/pr100865-1.c: New test.
+ * gcc.target/i386/pr100865-2.c: Likewise.
+ * gcc.target/i386/pr100865-3.c: Likewise.
+ * gcc.target/i386/pr100865-4a.c: Likewise.
+ * gcc.target/i386/pr100865-4b.c: Likewise.
+ * gcc.target/i386/pr100865-5a.c: Likewise.
+ * gcc.target/i386/pr100865-5b.c: Likewise.
+ * gcc.target/i386/pr100865-6a.c: Likewise.
+ * gcc.target/i386/pr100865-6b.c: Likewise.
+ * gcc.target/i386/pr100865-6c.c: Likewise.
+ * gcc.target/i386/pr100865-7a.c: Likewise.
+ * gcc.target/i386/pr100865-7b.c: Likewise.
+ * gcc.target/i386/pr100865-7c.c: Likewise.
+ * gcc.target/i386/pr100865-8a.c: Likewise.
+ * gcc.target/i386/pr100865-8b.c: Likewise.
+ * gcc.target/i386/pr100865-8c.c: Likewise.
+ * gcc.target/i386/pr100865-9a.c: Likewise.
+ * gcc.target/i386/pr100865-9b.c: Likewise.
+ * gcc.target/i386/pr100865-9c.c: Likewise.
+ * gcc.target/i386/pr100865-10a.c: Likewise.
+ * gcc.target/i386/pr100865-10b.c: Likewise.
+ * gcc.target/i386/pr100865-11a.c: Likewise.
+ * gcc.target/i386/pr100865-11b.c: Likewise.
+ * gcc.target/i386/pr100865-11c.c: Likewise.
+ * gcc.target/i386/pr100865-12a.c: Likewise.
+ * gcc.target/i386/pr100865-12b.c: Likewise.
+ * gcc.target/i386/pr100865-12c.c: Likewise.
+
+2021-07-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101280
+ PR tree-optimization/101173
+ * gcc.dg/tree-ssa/loop-interchange-16.c: New testcase.
+
+2021-07-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101278
+ * gcc.dg/torture/pr101278.c: New testcase.
+
+2021-07-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100778
+ * gcc.dg/torture/pr100778.c: New testcase.
+
+2021-07-01 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101044
+ * gcc.target/i386/pr101044.c: New test.
+
+2021-07-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101178
+ * gcc.dg/vect/bb-slp-72.c: New testcase.
+ * gcc.dg/vect/bb-slp-73.c: Likewise.
+ * gcc.dg/vect/bb-slp-74.c: Likewise.
+
+2021-07-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/101266
+ * gcc.dg/pr101266.c: New test.
+
+2021-07-01 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101194
+ * g++.dg/cpp0x/constexpr-empty16.C: New test.
+
+2021-07-01 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/96204
+ * g++.dg/template/access41.C: New test.
+ * g++.dg/template/access41a.C: New test.
+
+2021-06-30 Indu Bhagat <indu.bhagat@oracle.com>
+
+ * gcc.dg/debug/ctf/ctf-skip-types-4.c: Add dg-add-options float64 and
+ float64x.
+
+2021-06-30 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/float128-minmax.c: Adjust expected code for
+ power10.
+ * lib/target-supports.exp (check_effective_target_has_arch_pwr10):
+ New.
+
+2021-06-30 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/cpp2a/concepts-access2.C: New test.
+
+2021-06-30 Marek Polacek <polacek@redhat.com>
+
+ PR c++/100975
+ DR 2397
+ * g++.dg/cpp0x/auto24.C: Remove dg-error.
+ * g++.dg/cpp0x/auto3.C: Adjust dg-error.
+ * g++.dg/cpp0x/auto42.C: Likewise.
+ * g++.dg/cpp0x/initlist75.C: Likewise.
+ * g++.dg/cpp0x/initlist80.C: Likewise.
+ * g++.dg/diagnostic/auto1.C: Remove dg-error.
+ * g++.dg/cpp23/auto-array.C: New test.
+
+2021-06-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101267
+ * gfortran.dg/pr101267.f90: New testcase.
+
+2021-06-30 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/95006
+ * gcc.dg/analyzer/clobbers-1.c: New test.
+ * gcc.dg/analyzer/clobbers-2.c: New test.
+ * gcc.dg/analyzer/data-model-1.c (test_26): Mark xfail as fixed.
+ (test_28): Likewise.
+ (test_52): Likewise. Add coverage for end of buffer.
+ * gcc.dg/analyzer/explode-1.c: Add leak warning.
+ * gcc.dg/analyzer/memset-1.c (test_3): Mark xfail as fixed.
+ (test_4): Use char. Mark xfail as fixed.
+ (test_6b): New.
+ (test_7): Mark xfail as fixed. Add coverage for start of buffer.
+ (test_8): New.
+ (test_9): New.
+ * gcc.dg/analyzer/memset-CVE-2017-18549-1.c: New test.
+ * gcc.dg/analyzer/symbolic-8.c: New test.
+
+2021-06-30 Christophe Lyon <christophe.lyon@foss.st.com>
+
+ * gcc.dg/debug/ctf/ctf-skip-types-2.c: Add dg-add-options float16.
+
+2021-06-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101264
+ * gfortran.dg/pr101264.f90: New testcase.
+
+2021-06-30 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101248
+ * gcc.target/i386/pr101248.c: New test.
+
+2021-06-29 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr101254.c: New.
+
+2021-06-29 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/95046
+ * gcc.target/i386/pr95046-9.c: New test.
+
+2021-06-29 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/pr67790.c: Un-XFAIL.
+ * gcc.dg/vect/bb-slp-71.c: New testcase.
+
+2021-06-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/101210
+ * g++.dg/ubsan/pr101210.C: New test.
+
+2021-06-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101242
+ * gcc.dg/vect/bb-slp-pr101242.c: New testcase.
+ * gcc.dg/vect/pr67790.c: XFAIL scan for zero VEC_PERM_EXPR.
+
+2021-06-28 Martin Sebor <msebor@redhat.com>
+
+ * g++.dg/uninit-pr74762.C: New test.
+ * g++.dg/warn/uninit-pr74765.C: Same.
+
+2021-06-28 Indu Bhagat <indu.bhagat@oracle.com>
+ David Faust <david.faust@oracle.com>
+
+ * lib/gcc-dg.exp (gcc-dg-frontend-supports-ctf): New procedure.
+ (gcc-dg-debug-runtest): Add -gctf support.
+ * gcc.dg/debug/btf/btf-1.c: New test.
+ * gcc.dg/debug/btf/btf-2.c: Likewise.
+ * gcc.dg/debug/btf/btf-anonymous-struct-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-anonymous-union-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-array-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-bitfields-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-bitfields-2.c: Likewise.
+ * gcc.dg/debug/btf/btf-bitfields-3.c: Likewise.
+ * gcc.dg/debug/btf/btf-cvr-quals-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-enum-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-forward-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-function-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-function-2.c: Likewise.
+ * gcc.dg/debug/btf/btf-int-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-pointers-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-struct-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-typedef-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-union-1.c: Likewise.
+ * gcc.dg/debug/btf/btf-variables-1.c: Likewise.
+ * gcc.dg/debug/btf/btf.exp: Likewise.
+ * gcc.dg/debug/ctf/ctf-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-anonymous-struct-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-anonymous-union-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-array-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-array-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-array-3.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-array-4.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-attr-mode-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-attr-used-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-bitfields-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-bitfields-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-bitfields-3.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-bitfields-4.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-complex-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-cvr-quals-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-cvr-quals-3.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-cvr-quals-4.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-enum-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-enum-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-file-scope-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-float-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-forward-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-forward-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-func-index-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-function-pointers-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-function-pointers-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-function-pointers-3.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-functions-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-int-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-objt-index-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-pointers-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-pointers-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-preamble-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-skip-types-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-skip-types-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-skip-types-3.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-skip-types-4.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-skip-types-5.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-skip-types-6.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-str-table-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-struct-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-struct-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-struct-array-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-struct-pointer-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-struct-pointer-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-typedef-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-typedef-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-typedef-3.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-typedef-struct-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-typedef-struct-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-typedef-struct-3.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-union-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-variables-1.c: Likewise.
+ * gcc.dg/debug/ctf/ctf-variables-2.c: Likewise.
+ * gcc.dg/debug/ctf/ctf.exp: Likewise.
+ * gcc.dg/debug/btf/btf-bitfields-4.c: New file.
+ * gcc.dg/debug/btf/btf-datasec-1.c: New file.
+ * gcc.dg/debug/btf/btf-function-3.c: New file.
+ * gcc.dg/debug/btf/btf-pointers-2.c: New file.
+ * gcc.dg/debug/btf/btf-struct-2.c: New file.
+ * gcc.dg/debug/btf/btf-variables-2.c: New file.
+ * gcc.dg/debug/btf/btf-variables-3.c: New file.
+ * gcc.dg/debug/ctf/ctf-debug-1.c: New file.
+ * gcc.dg/debug/ctf/ctf-debug-2.c: New file.
+ * gcc.dg/debug/ctf/ctf-function-pointers-4.c: New file.
+ * gcc.dg/debug/ctf/ctf-skip-types-7.c: New file.
+ * gcc.dg/debug/ctf/ctf-skip-types-8.c: New file.
+ * gcc.dg/debug/ctf/ctf-struct-array-2.c: New file.
+
+2021-06-28 Indu Bhagat <indu.bhagat@oracle.com>
+
+ * lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): New procedure.
+
+2021-06-28 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/93385
+ * gcc.dg/ipa/pr93385.c: New test.
+ * gcc.dg/ipa/ipa-sra-23.c: Likewise.
+ * gcc.dg/ipa/ipa-sra-24.c: Likewise.
+ * g++.dg/ipa/ipa-sra-4.C: Likewise.
+
+2021-06-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101229
+ * gcc.dg/torture/pr101229.c: New testcase.
+
+2021-06-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101207
+ * gcc.dg/vect/bb-slp-pr101207.c: New testcase.
+
+2021-06-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101173
+ * gcc.dg/torture/pr101173.c: New testcase.
+
+2021-06-28 liuhongt <hongtao.liu@intel.com>
+
+ PR target/100648
+ * g++.target/i386/avx2-pr54700-2.C: Adjust testcase.
+ * g++.target/i386/avx512vl-pr54700-1a.C: New test.
+ * g++.target/i386/avx512vl-pr54700-1b.C: New test.
+ * g++.target/i386/avx512vl-pr54700-2a.C: New test.
+ * g++.target/i386/avx512vl-pr54700-2b.C: New test.
+ * gcc.target/i386/avx512vl-pr100648.c: New test.
+ * gcc.target/i386/avx512vl-blendv-1.c: New test.
+ * gcc.target/i386/avx512vl-blendv-2.c: New test.
+
+2021-06-28 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/funcspec-8.c: Replace
+ __builtin_ia32_blendvpd with __builtin_ia32_roundps_az.
+ * gcc.target/i386/blendv-1.c: New test.
+ * gcc.target/i386/blendv-2.c: New test.
+
+2021-06-27 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/torture/pr101230-1.c: New test.
+
+2021-06-26 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/96204
+ * g++.dg/template/access40.C: New test.
+ * g++.dg/template/access40a.C: New test.
+
+2021-06-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/101040
+ PR c++/97566
+ * g++.dg/cpp2a/no_unique_address13.C: New test.
+
+2021-06-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/100752
+ * g++.dg/cpp0x/noexcept69.C: New test.
+ * g++.dg/parse/saved1.C: Adjust dg-error.
+ * g++.dg/template/crash50.C: Likewise.
+
+2021-06-25 David Malcolm <dmalcolm@redhat.com>
+
+ * jit.dg/test-vector-rvalues.cc (check_div): Add specialization
+ for v4f, to avoid relying on exact floating-point equality.
+ * jit.dg/test-vector-types.cc (check_div): Likewise.
+
+2021-06-25 David Malcolm <dmalcolm@redhat.com>
+
+ * jit.dg/test-asm.c: Remove i?86-*-* from target specifier.
+ * jit.dg/test-asm.cc: Likewise.
+
+2021-06-25 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/101216
+ * gcc.dg/Wnonnull-7.c: New test.
+
+2021-06-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101202
+ * gcc.dg/torture/pr101202.c: New testcase.
+
+2021-06-25 Xi Ruoyao <xry111@mengyan1223.wang>
+
+ * g++.dg/no-stack-protector-attr-3.C (dg-final): Adjust for MIPS.
+
+2021-06-25 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101185
+ * gcc.target/i386/bitwise_mask_op-3.c: Add xfail to
+ temporarily avoid regression, eventually xfail should be
+ removed.
+
+2021-06-24 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/tree-ssa/evrp30.c: New.
+
+2021-06-24 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/tree-ssa/pr101189.c: New.
+
+2021-06-24 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/98832
+ * g++.dg/cpp2a/class-deduction-alias9.C: New test.
+
+2021-06-24 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101182
+ * g++.dg/cpp2a/concepts-requires25.C: New test.
+
+2021-06-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/101171
+ * gcc.dg/pr101171.c: New test.
+
+2021-06-24 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/89021
+ * gcc.dg/vect/vect-nb-iter-ub-3.c (dg-additional-options):
+ Add --param vect-epilogues-nomask=0.
+ * gcc.target/i386/pr97249-1.c (foo): Add #pragma GCC unroll
+ to avoid loop vectorization.
+ (foo1): Ditto.
+ (foo2): Ditto.
+
+2021-06-24 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/vect-addsubv2df.c: New testcase.
+ * gcc.target/i386/vect-addsubv4sf.c: Likewise.
+ * gcc.target/i386/vect-addsubv4df.c: Likewise.
+ * gcc.target/i386/vect-addsubv8sf.c: Likewise.
+ * gcc.target/i386/vect-addsub-2.c: Likewise.
+ * gcc.target/i386/vect-addsub-3.c: Likewise.
+
+2021-06-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101170
+ * gcc.dg/pr101170.c: New test.
+
+2021-06-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101172
+ * gcc.dg/pr101172.c: New test.
+
+2021-06-24 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * gcc.target/s390/mnop-mcount-m31-mzarch.c: Adapt to the new
+ prologue size.
+ * gcc.target/s390/mnop-mcount-m64.c: Likewise.
+
+2021-06-24 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/target-in-reduction-1.c: New test.
+ * c-c++-common/gomp/clauses-1.c: Add in_reduction clauses on
+ target or combined target constructs.
+
+2021-06-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101105
+ * gcc.dg/torture/pr101105.c: New testcase.
+
+2021-06-24 liuhongt <hongtao.liu@intel.com>
+
+ PR target/98434
+ * gcc.target/i386/pr98434-1.c: New test.
+ * gcc.target/i386/pr98434-2.c: New test.
+ * gcc.target/i386/avx512vl-pr95488-1.c: Adjust testcase.
+
+2021-06-23 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101174
+ * g++.dg/cpp1z/class-deduction-access3.C: New test.
+ * g++.dg/cpp1z/class-deduction91.C: New test.
+
+2021-06-23 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ * gcc.target/powerpc/pcrel-opt-inc-di.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-ld-df.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-ld-di.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-ld-hi.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-ld-qi.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-ld-sf.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-ld-si.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-ld-vector.c: Enable -mpcrel-opt to
+ test it.
+ * gcc.target/powerpc/pcrel-opt-st-df.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-st-di.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-st-hi.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-st-qi.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-st-sf.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-st-si.c: Enable -mpcrel-opt to test it.
+ * gcc.target/powerpc/pcrel-opt-st-vector.c: Enable -mpcrel-opt to
+ test it.
+
+2021-06-23 Xi Ruoyao <xry111@mengyan@123.wang>
+
+ * gcc.c-torture/execute/950704-1.c: Add -fwrapv to avoid
+ undefined behavior.
+
+2021-06-23 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/86439
+ * g++.dg/cpp1z/class-deduction88.C: New test.
+ * g++.dg/cpp1z/class-deduction89.C: New test.
+ * g++.dg/cpp1z/class-deduction90.C: New test.
+
+2021-06-23 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101175
+ * gcc.target/i386/pr101175.c: New test.
+
+2021-06-23 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/100337
+ * gfortran.dg/coarray_collectives_17.f90: New test.
+
+2021-06-22 Sandra Loosemore <sandra@codesourcery.com>
+ Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/93524
+ * gfortran.dg/pr93524.c: New.
+ * gfortran.dg/pr93524.f90: New.
+
+2021-06-22 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101143
+ * gcc.dg/analyzer/pr101143.c: New test.
+
+2021-06-22 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/101156
+ * gcc.dg/pr101156.c: New testcase.
+
+2021-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/101159
+ * gcc.c-torture/compile/pr101159.c: New test.
+
+2021-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101160
+ * g++.target/i386/empty-class1.C: Require lp64 effective target
+ instead of x86_64-*-*.
+ * g++.target/i386/empty-class2.C: New test.
+
+2021-06-22 Jakub Jelinek <jakub@redhat.com>
+ Andrew Pinski <apinski@marvell.com>
+
+ PR tree-optimization/101162
+ * g++.dg/opt/pr101162.C: New test.
+
+2021-06-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101151
+ * gcc.dg/torture/pr101151.c: New testcase.
+
+2021-06-22 Kito Cheng <kito.cheng@sifive.com>
+
+ * g++.dg/modules/omp-1_a.C: Check pthread is available for
+ dg-module-cmi.
+ * g++.dg/modules/omp-2_a.C: Ditto.
+
+2021-06-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101158
+ * gfortran.dg/pr101158.f90: New testcase.
+
+2021-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/11877
+ * gcc.target/i386/pr11877-2.c: New test.
+
+2021-06-22 liuhongt <hongtao.liu@intel.com>
+
+ PR tree-optimization/97770
+ * gcc.target/i386/avx512bitalg-pr97770-1.c: Remove xfail.
+ * gcc.target/i386/avx512vpopcntdq-pr97770-1.c: Remove xfail.
+
+2021-06-22 liuhongt <hongtao.liu@intel.com>
+
+ PR target/100267
+ * gcc.target/i386/avx512bw-pr100267-1.c: New test.
+ * gcc.target/i386/avx512bw-pr100267-b-2.c: New test.
+ * gcc.target/i386/avx512bw-pr100267-d-2.c: New test.
+ * gcc.target/i386/avx512bw-pr100267-q-2.c: New test.
+ * gcc.target/i386/avx512bw-pr100267-w-2.c: New test.
+ * gcc.target/i386/avx512f-pr100267-1.c: New test.
+ * gcc.target/i386/avx512f-pr100267-pd-2.c: New test.
+ * gcc.target/i386/avx512f-pr100267-ps-2.c: New test.
+ * gcc.target/i386/avx512vl-pr100267-1.c: New test.
+ * gcc.target/i386/avx512vl-pr100267-pd-2.c: New test.
+ * gcc.target/i386/avx512vl-pr100267-ps-2.c: New test.
+ * gcc.target/i386/avx512vlbw-pr100267-1.c: New test.
+ * gcc.target/i386/avx512vlbw-pr100267-b-2.c: New test.
+ * gcc.target/i386/avx512vlbw-pr100267-d-2.c: New test.
+ * gcc.target/i386/avx512vlbw-pr100267-q-2.c: New test.
+ * gcc.target/i386/avx512vlbw-pr100267-w-2.c: New test.
+
+2021-06-22 liuhongt <hongtao.liu@intel.com>
+
+ PR target/100310
+ * gcc.target/i386/pr100310.c: New test.
+
+2021-06-21 Jason Merrill <jason@redhat.com>
+
+ PR target/88529
+ * g++.target/i386/empty-class1.C: New test.
+
+2021-06-21 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/67302
+ * g++.dg/opt/nrv21.C: New test.
+
+2021-06-21 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/80431
+ * g++.dg/cpp0x/nsdmi-virtual1a.C: New test.
+
+2021-06-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/100785
+ * c-c++-common/pr100785.c: New test.
+ * gcc.dg/pr48552-1.c: Don't expect invalid lvalue errors.
+ * gcc.dg/pr48552-2.c: Likewise.
+
+2021-06-21 prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR target/97906
+ * gcc.target/arm/simd/pr97906.c: New test.
+
+2021-06-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101121
+ * gfortran.dg/pr101121.f: New testcase.
+
+2021-06-21 liuhongt <hongtao.liu@intel.com>
+
+ PR target/101142
+ * gcc.target/i386/spill_to_mask-1.c: Adjust testcase.
+ * gcc.target/i386/spill_to_mask-2.c: Adjust testcase.
+ * gcc.target/i386/spill_to_mask-3.c: Adjust testcase.
+ * gcc.target/i386/spill_to_mask-4.c: Adjust testcase.
+
+2021-06-21 Roger Sayle <roger@nextmovesoftware.com>
+
+ PR target/11877
+ * gcc.target/i386/pr11877.c: New test case.
+
+2021-06-18 Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/fusion-p10-2logical.c: Update pattern
+ match counts.
+ * gcc.target/powerpc/fusion-p10-addadd.c: Update pattern match
+ counts.
+ * gcc.target/powerpc/fusion-p10-ldcmpi.c: Update pattern match
+ counts.
+ * gcc.target/powerpc/fusion-p10-logadd.c: Update pattern match
+ counts.
+
+2021-06-18 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100283
+ PR fortran/101123
+ * gfortran.dg/min0_max0_1.f90: New test.
+ * gfortran.dg/min0_max0_2.f90: New test.
+
+2021-06-18 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/symbolic-7.c: New test.
+
+2021-06-18 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/100856
+ * gcc.target/arm/acle/pr100856.c: New test.
+ * gcc.target/arm/multilib.exp: Add tests for cde options.
+
+2021-06-18 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/float128-minmax-2.c: New test.
+
+2021-06-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/101106
+ * g++.dg/cpp0x/deleted15.C: New test.
+
+2021-06-17 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/100704
+ * gcc.target/i386/pr100704-1.c: New test.
+ * gcc.target/i386/pr100704-2.c: Likewise.
+ * gcc.target/i386/pr100704-3.c: Likewise.
+
+2021-06-17 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/97194
+ * gcc.target/i386/sse4_1-vec-set-1.c: New test.
+ * gcc.target/i386/sse4_1-vec-set-2.c: ditto.
+
+2021-06-17 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr100790.c: New test.
+
+2021-06-17 Marius Hillenbrand <mhillen@linux.ibm.com>
+
+ * gcc.target/s390/zvector/vec-doublee.c: New test.
+ * gcc.target/s390/zvector/vec-floate.c: New test.
+
+2021-06-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/54400
+ * gcc.dg/vect/bb-slp-pr54400.c: New testcase.
+
+2021-06-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/101078
+ PR c++/91706
+ * g++.dg/template/access39.C: New test.
+
+2021-06-16 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/95501
+ PR fortran/95502
+ * gfortran.dg/pr95502.f90: New test.
+
+2021-06-16 Harald Anlauf <anlauf@gmx.de>
+
+ Revert:
+ 2021-06-16 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/95501
+ PR fortran/95502
+ * gfortran.dg/pr95502.f90: New test.
+
+2021-06-16 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/95501
+ PR fortran/95502
+ * gfortran.dg/pr95502.f90: New test.
+
+2021-06-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/100796
+ PR preprocessor/96391
+ * g++.dg/plugin/location-overflow-test-pr100796.c: New test.
+ * g++.dg/plugin/plugin.exp: Run it.
+
+2021-06-16 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/narrow_zero_high_half.c: Add new tests.
+
+2021-06-16 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/narrow_zero_high_half.c: Add new tests.
+
+2021-06-16 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/narrow_zero_high_half.c: Add new tests.
+
+2021-06-16 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/narrow_zero_high_half.c: Add new tests.
+
+2021-06-16 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/narrow_zero_high_half.c: New test.
+
+2021-06-16 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/100453
+ * gcc.dg/tree-ssa/pr100453.c: New test.
+
+2021-06-16 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/guality/pr49888.c (f): Use noipa attribute instead of
+ noinline, noclone.
+
+2021-06-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/101062
+ * gcc.dg/pr101062.c: New test.
+
+2021-06-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101088
+ * gcc.dg/torture/pr101088.c: New testcase.
+
+2021-06-16 Roger Sayle <roger@nextmovesoftware.com>
+
+ PR rtl-optimization/46235
+ * gcc.target/i386/bt-5.c: New test.
+ * gcc.target/i386/bt-6.c: New test.
+ * gcc.target/i386/bt-7.c: New test.
+
+2021-06-16 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/limited4.adb: Disable illegal code.
+
+2021-06-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101083
+ * gcc.dg/vect/pr97832-4.c: New testcase.
+
+2021-06-15 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/92568
+ * gfortran.dg/gomp/pr99928-1.f90: Uncomment 'defaultmap(none)'.
+ * gfortran.dg/gomp/pr99928-2.f90: Uncomment 'defaultmap(none)'.
+ * gfortran.dg/gomp/pr99928-3.f90: Uncomment 'defaultmap(none)'.
+ * gfortran.dg/gomp/pr99928-4.f90: Uncomment 'defaultmap(none)'.
+ * gfortran.dg/gomp/pr99928-5.f90: Uncomment 'defaultmap(none)'.
+ * gfortran.dg/gomp/pr99928-6.f90: Uncomment 'defaultmap(none)'.
+ * gfortran.dg/gomp/pr99928-8.f90: Uncomment 'defaultmap(none)'.
+ * gfortran.dg/gomp/defaultmap-1.f90: New test.
+ * gfortran.dg/gomp/defaultmap-2.f90: New test.
+ * gfortran.dg/gomp/defaultmap-3.f90: New test.
+ * gfortran.dg/gomp/defaultmap-4.f90: New test.
+ * gfortran.dg/gomp/defaultmap-5.f90: New test.
+ * gfortran.dg/gomp/defaultmap-6.f90: New test.
+ * gfortran.dg/gomp/defaultmap-7.f90: New test.
+
+2021-06-15 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/analyzer-decls.h (__analyzer_dump_capacity): New decl.
+ * gcc.dg/analyzer/capacity-1.c: New test.
+ * gcc.dg/analyzer/capacity-2.c: New test.
+ * gcc.dg/analyzer/capacity-3.c: New test.
+
+2021-06-15 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/101068
+ * gcc.dg/analyzer/explode-2a.c: New test.
+
+2021-06-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/101046
+ * gcc.target/i386/pr101046.c: New test.
+
+2021-06-15 Robin Dapp <rdapp@linux.ibm.com>
+
+ * c-c++-common/Wattributes.c: Remove s390-specific check and add
+ new tests.
+ * gcc.dg/Wattributes-6.c: Likewise.
+
+2021-06-15 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ PR target/101020
+ * gcc.target/powerpc/float128-call.c: Adjust counts for be and le.
+
+2021-06-14 Martin Sebor <msebor@redhat.com>
+
+ PR c++/100876
+ * g++.dg/warn/Wmismatched-new-delete-4.C: New test.
+ * g++.dg/warn/Wmismatched-new-delete-5.C: New test.
+ * g++.dg/warn/Wstringop-overflow-7.C: New test.
+ * g++.dg/warn/Wfree-nonheap-object-6.C: New test.
+ * g++.dg/analyzer/placement-new.C: Prune out expected warning.
+
+2021-06-14 Peter Bergner <bergner@linux.ibm.com>
+
+ PR target/100777
+ * gcc.target/powerpc/pr100777.c: New test.
+
+2021-06-14 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101058
+ * gcc.target/i386/pr101058.c: New test.
+
+2021-06-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR c++/101052
+ * g++.dg/spellcheck-stdlib.C: Add checks for <cstdlib> names.
+ * gcc.dg/spellcheck-stdlib.c: Likewise.
+
+2021-06-14 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vclz.c: Update expected results.
+ * gcc.target/arm/simd/mve-vshl.c: Likewise.
+ * gcc.target/arm/simd/mve-vec-pack.c: New test.
+ * gcc.target/arm/simd/mve-vec-unpack.c: New test.
+
+2021-06-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100934
+ * gcc.dg/torture/pr100934.c: New testcase.
+
+2021-06-14 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ * gcc.dg/sms-1.c: Remove scan-rtl-dump-times check.
+ * gcc.dg/sms-2.c: Remove scan-rtl-dump-times check.
+ * gcc.dg/sms-3.c: Remove scan-rtl-dump-times check.
+ * gcc.dg/sms-4.c: Remove scan-rtl-dump-times check.
+ * gcc.dg/sms-6.c: Remove scan-rtl-dump-times check.
+ * gcc.dg/sms-8.c: Remove scan-rtl-dump-times check.
+ * gcc.dg/sms-10.c: Remove scan-rtl-dump-times check.
+
+2021-06-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101031
+ * gcc.dg/torture/pr101031.c: New testcase.
+
+2021-06-13 Jason Merrill <jason@redhat.com>
+
+ * gcc.dg/c2x-attr-maybe_unused-1.c: Expect no warnings.
+
+2021-06-13 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/101023
+ * g++.target/i386/pr101023a.C: New test.
+ * g++.target/i386/pr101023b.C: Likewise.
+
+2021-06-12 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/ext/builtin-shufflevector-2.C: Ignore psabi warning.
+ * gcc.dg/uninit-pr93100.c: Skip on AIX.
+ * gcc.target/powerpc/pr100085.c: Require int128 and float128.
+
+2021-06-12 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/ext/attrib62.C: No longer warn.
+ * g++.dg/diagnostic/maybe_unused1.C: New test.
+
+2021-06-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/101029
+ * g++.dg/ext/array4.C: New test.
+
+2021-06-11 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c
+ (dg-require-effective-target): Change target to p9vector_hw.
+
+2021-06-11 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gcc.dg/gomp/simd-clones-2.c: Enhance.
+
+2021-06-11 Patrick Palka <ppalka@redhat.com>
+
+ DR 1227
+ PR c++/96560
+ * g++.dg/template/sfinae-dr1227.C: New test.
+
+2021-06-11 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/101016
+ * gcc.target/arm/mve/intrinsics/pr101016.c: New test.
+
+2021-06-11 Roger Sayle <roger@nextmovesoftware.com>
+
+ PR tree-optimization/96392
+ * gcc.dg/pr96392.c: New test.
+
+2021-06-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101025
+ * gcc.dg/torture/pr101025.c: New testcase.
+
+2021-06-11 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/99939
+ * gcc.target/arm/cmse/cmse-18.c: Add separate scan-assembler
+ directives check for target is v8.1-m.main+mve or not before
+ comparing the assembly output.
+ * gcc.target/arm/cmse/cmse-20.c: New test.
+
+2021-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100974
+ * g++.dg/cpp23/consteval-if1.C: New test.
+ * g++.dg/cpp23/consteval-if2.C: New test.
+ * g++.dg/cpp23/consteval-if3.C: New test.
+ * g++.dg/cpp23/consteval-if4.C: New test.
+ * g++.dg/cpp23/consteval-if5.C: New test.
+ * g++.dg/cpp23/consteval-if6.C: New test.
+ * g++.dg/cpp23/consteval-if7.C: New test.
+ * g++.dg/cpp23/consteval-if8.C: New test.
+ * g++.dg/cpp23/consteval-if9.C: New test.
+ * g++.dg/cpp23/consteval-if10.C: New test.
+ * g++.dg/cpp23/feat-cxx2b.C: Add __cpp_if_consteval tests.
+
+2021-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c: Update
+ expected number of enodes after the loop.
+ * gcc.dg/analyzer/paths-8.c: New test.
+
+2021-06-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101028
+ * gcc.dg/pr101028.c: New testcase.
+
+2021-06-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/101026
+ * gfortran.dg/pr101026.f: New testcase.
+
+2021-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/101008
+ * gcc.dg/pr101008.c: New test.
+
+2021-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/101007
+ * gcc.target/i386/sse-pr101007.c: New test.
+
+2021-06-11 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/101021
+ * gcc.target/i386/pr101021-1.c: New test.
+ * gcc.target/i386/pr101021-2.c: Ditto.
+
+2021-06-11 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/100788
+ * gcc.dg/pr100788.c: New test.
+
+2021-06-11 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/101009
+ * gcc.dg/torture/pr101009.c: New testcase.
+
+2021-06-11 Kewen Lin <linkw@linux.ibm.com>
+
+ * gcc.target/powerpc/p9-fpcvt-3.c: New test.
+
+2021-06-11 Marek Polacek <polacek@redhat.com>
+
+ PR c++/100995
+ * g++.dg/cpp2a/is-constant-evaluated9.C: Add dg-warning.
+ * g++.dg/cpp2a/is-constant-evaluated12.C: New test.
+
+2021-06-10 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/67829
+ * g++.dg/template/ttp34.C: New test.
+ * g++.dg/template/ttp34a.C: New test.
+ * g++.dg/template/ttp34b.C: New test.
+
+2021-06-10 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100946
+ * g++.dg/cpp2a/concepts-return-req3.C: New test.
+
+2021-06-10 Peter Bergner <bergner@linux.ibm.com>
+
+ * gcc.target/powerpc/mma-builtin-4.c (__builtin_vsx_build_pair): Add
+ tests. Update expected counts.
+ * gcc.target/powerpc/mma-builtin-5.c (__builtin_mma_build_acc): Add
+ tests. Update expected counts.
+
+2021-06-10 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/100967
+ * gdc.dg/pr100967.d: New test.
+
+2021-06-10 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/vector/vcond-mixed-double.c: New test.
+ * gcc.target/s390/vector/vcond-mixed-float.c: New test.
+
+2021-06-10 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.dg/vect/pr56541.c: Fix target selector.
+
+2021-06-10 Andrew Stubbs <ams@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc-gomp/nesting-fail-1.c: Adjust patterns.
+ * c-c++-common/goacc/finalize-1.c: Likewise.
+ * c-c++-common/goacc/mdc-1.c: Likewise.
+ * c-c++-common/goacc/nesting-fail-1.c: Likewise.
+ * c-c++-common/goacc/struct-enter-exit-data-1.c: Likewise.
+ * gfortran.dg/goacc/attach-descriptor.f90: Likewise.
+ * gfortran.dg/goacc/finalize-1.f: Likewise.
+ * gfortran.dg/goacc/mapping-tests-3.f90: Likewise.
+
+2021-06-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/mdc-1.c: Fix '#pragma acc acc [...]' typo.
+ * c-c++-common/goacc/mdc-2.c: Likewise.
+ * g++.dg/goacc/mdc.C: Likewise.
+
+2021-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/cpp2a/feat-cxx2a.C: Uncomment __cpp_consteval test.
+ * g++.dg/cpp23/feat-cxx2b.C: Likewise.
+
+2021-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/100852
+ * g++.dg/opt/pr100852.C: New test.
+
+2021-06-09 Andrew Pinski <apinski@marvell.com>
+
+ * g++.dg/torture/pr100925.C: New test.
+
+2021-06-09 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/int_128bit-runnable.c (extsd2q): Update expected
+ count.
+ Add tests for vec_signextq.
+ * gcc.target/powerpc/p9-sign_extend-runnable.c: New test case.
+
+2021-06-09 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/fp128_conversions.c: New file.
+ * gcc.target/powerpc/int_128bit-runnable.c(vextsd2q,
+ vcmpuq, vcmpsq, vcmpequq, vcmpequq., vcmpgtsq, vcmpgtsq.
+ vcmpgtuq, vcmpgtuq.): Update scan-assembler-times.
+ (ppc_native_128bit): Remove dg-require-effective-target.
+
+2021-06-09 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/int_128bit-runnable.c: Add shift_right, shift_left
+ tests.
+
+2021-06-09 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/int_128bit-runnable.c: Add 128-bit DFP
+ conversion tests.
+
+2021-06-09 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/int_128bit-runnable.c: New test file.
+
+2021-06-09 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c:
+ New runnable test case.
+ * gcc.target/powerpc/vec-rlmi-rlnm.c: Update scan assembler times
+ for xxlor instruction.
+
+2021-06-09 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vclz.c: New test.
+
+2021-06-09 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vhadd-1.c: New test.
+ * gcc.target/arm/simd/mve-vhadd-2.c: New test.
+ * gcc.target/arm/simd/neon-vhadd-1.c: New test.
+ * gcc.target/arm/simd/neon-vhadd-2.c: New test.
+
+2021-06-09 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.dg/builtins-70.c: New test.
+
+2021-06-09 Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/fusion-p10-2logical.c: Update fused insn
+ counts to test 32 and 64 bit separately.
+ * gcc.target/powerpc/fusion-p10-addadd.c: Update fused insn
+ counts to test 32 and 64 bit separately.
+ * gcc.target/powerpc/fusion-p10-ldcmpi.c: Update fused insn
+ counts to test 32 and 64 bit separately.
+ * gcc.target/powerpc/fusion-p10-logadd.c: Update fused insn
+ counts to test 32 and 64 bit separately.
+
+2021-06-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100981
+ * gfortran.dg/vect/pr100981-1.f90: New testcase.
+
+2021-06-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97832
+ * gcc.dg/vect/pr97832-1.c: New testcase.
+ * gcc.dg/vect/pr97832-2.c: Likewise.
+ * gcc.dg/vect/pr97832-3.c: Likewise.
+ * g++.dg/vect/slp-pr98855.cc: XFAIL.
+ * gcc.dg/vect/slp-50.c: New file.
+
+2021-06-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/100965
+ * gfortran.dg/gomp/pr100965.f90: New test.
+
+2021-06-09 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100936
+ * gcc.target/i386/pr100936.c: New test.
+
+2021-06-09 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ * gcc.target/powerpc/float128-call.c: Adjust.
+ * gcc.target/powerpc/pr100085.c: New test.
+
+2021-06-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/100879
+ * g++.dg/diagnostic/enum3.C: New test.
+
+2021-06-08 Marek Polacek <polacek@redhat.com>
+
+ PR c++/100065
+ * g++.dg/cpp2a/explicit18.C: New test.
+
+2021-06-08 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/tree-ssa/pr96928-1.c: Fix testcase for now that ~
+ happens on the outside of the bit_xor.
+
+2021-06-08 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/pr60209-neg.C: Update diagnostic.
+ * g++.dg/diagnostic/string-literal-concat.C: Likewise.
+ * g++.dg/ext/utf-badconcat.C: Likewise.
+ * g++.dg/ext/utf-badconcat2.C: Likewise.
+
+2021-06-08 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp23/mixed-concat1.C: New test.
+
+2021-06-08 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp23/whitespace-splice1.C: New test.
+
+2021-06-08 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp23/narrowing-bool1.C: New test.
+
+2021-06-08 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/99212
+ * gcc.dg/analyzer/bitfields-1.c: New test.
+ * gcc.dg/analyzer/data-model-1.c (struct sbits): Make bitfields
+ explicitly signed.
+ (test_44): Update test values assigned to the bits to ones that
+ fit in the range of the bitfield type. Remove xfails.
+ (test_45): Remove xfails.
+
+2021-06-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/100963
+ * g++.dg/cpp0x/initlist124.C: New test.
+
+2021-06-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100923
+ * gcc.dg/torture/pr100923.c: New testcase.
+
+2021-06-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100957
+ * g++.dg/gomp/doacross-2.C: New test.
+
+2021-06-08 H.J. Lu <hjl.tools@gmail.com>
+
+ PR middle-end/100951
+ * gcc.target/i386/pr100951.c: New test.
+
+2021-06-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100887
+ PR testsuite/100943
+ * gcc.dg/pr100887.c: Add -Wno-psabi -w to dg-options.
+
+2021-06-08 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/99928
+ * gfortran.dg/gomp/openmp-simd-6.f90: Update scan-tree-dump.
+ * gfortran.dg/gomp/scan-5.f90: Likewise.
+ * gfortran.dg/gomp/loop-1.f90: Likewise; remove xfail.
+ * gfortran.dg/gomp/pr99928-1.f90: Remove xfail.
+ * gfortran.dg/gomp/pr99928-2.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-3.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-8.f90: Likewise.
+
+2021-06-08 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/format/strfmon-1.c: Fix typo.
+ * gfortran.dg/char4-subscript.f90: Likewise.
+
+2021-06-08 Kewen Lin <linkw@linux.ibm.com>
+
+ PR tree-optimization/100794
+ * gcc.dg/tree-ssa/pr100794.c: New test.
+
+2021-06-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/91706
+ * g++.dg/template/lookup17.C: New test.
+
+2021-06-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/100102
+ * g++.dg/cpp0x/alias-decl-73.C: New test.
+
+2021-06-07 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100637
+ * gcc.target/i386/pr100637-5b.c: New test.
+ * gcc.target/i386/pr100637-5w.c: Ditto.
+
+2021-06-07 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/82735
+ * gcc.target/i386/pr82735-3.c: Don't compile for x32.
+ * gcc.target/i386/pr82735-4.c: Likewise.
+ * gcc.target/i386/pr82735-5.c: Likewise.
+
+2021-06-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/sso-14.c: Adjust.
+
+2021-06-07 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100918
+ * g++.dg/template/access38.C: New test.
+
+2021-06-07 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/100885
+ * g++.target/i386/pr100885.C (_mm_set_epi64): Cast __m64 to long
+ long.
+
+2021-06-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100887
+ * gcc.dg/pr100887.c: New test.
+
+2021-06-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/100898
+ * g++.dg/ext/va-arg-pack-3.C: New test.
+
+2021-06-07 liuhongt <hongtao.liu@intel.com>
+
+ PR target/100885
+ * g++.target/i386/pr100885.C: New test.
+
+2021-06-07 liuhongt <hongtao.liu@intel.com>
+
+ PR target/82735
+ * gcc.target/i386/pr82735-1.c: New test.
+ * gcc.target/i386/pr82735-2.c: New test.
+ * gcc.target/i386/pr82735-3.c: New test.
+ * gcc.target/i386/pr82735-4.c: New test.
+ * gcc.target/i386/pr82735-5.c: New test.
+
+2021-06-06 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/gomp/scan-1.c: New test.
+
+2021-06-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/100902
+ * c-c++-common/gomp/pr100902-1.c: New test.
+
+2021-06-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/sso-14.c: New test.
+
+2021-06-05 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/100120
+ PR fortran/100816
+ PR fortran/100818
+ PR fortran/100819
+ PR fortran/100821
+ * gfortran.dg/PR100120.f90: New test.
+ * gfortran.dg/character_workout_1.f90: New test.
+ * gfortran.dg/character_workout_4.f90: New test.
+
+2021-06-04 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/100905
+ * gfortran.dg/gomp/loop-3.f90: New test.
+
+2021-06-04 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/100882
+ * gdc.dg/pr100882a.d: New test.
+ * gdc.dg/pr100882b.d: New test.
+ * gdc.dg/pr100882c.d: New test.
+ * gdc.dg/torture/pr100882.d: New test.
+
+2021-06-04 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100893
+ * g++.dg/template/param4.C: New test.
+ * g++.dg/template/param5.C: New test.
+ * g++.dg/cpp1z/nontype-auto19.C: New test.
+ * g++.dg/cpp2a/concepts-decltype.C: Don't expect that the
+ deduced type of a decltype(auto) NTTP has top-level cv-quals.
+
+2021-06-04 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100102
+ * g++.dg/cpp0x/alias-decl-72.C: New test.
+ * g++.dg/cpp0x/alias-decl-72a.C: New test.
+
+2021-06-04 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/99839
+ * gfortran.dg/inline_matmul_25.f90: New test.
+
+2021-06-04 Martin Sebor <msebor@redhat.com>
+
+ PR c/100783
+ * gcc.dg/nonnull-6.c: New test.
+
+2021-06-04 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/100732
+ * gcc.dg/tree-ssa/builtin-snprintf-11.c: New test.
+ * gcc.dg/tree-ssa/builtin-snprintf-12.c: New test.
+ * gcc.dg/tree-ssa/builtin-sprintf-28.c: New test.
+ * gcc.dg/tree-ssa/builtin-sprintf-29.c: New test.
+ * gcc.dg/uninit-pr100732.c: New test.
+
+2021-06-04 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wvla-parameter-10.c: New test.
+ * gcc.dg/Wvla-parameter-11.c: New test.
+
+2021-06-04 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/goacc/omp-fixed.f: Re-add test item changed in previous
+ commit in addition - add more dg-errors and '... end ...' due to changed
+ parsing.
+ * gfortran.dg/goacc/omp.f95: Likewise.
+ * gfortran.dg/goacc-gomp/mixed-1.f: New test.
+
+2021-06-04 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100637
+ * gcc.dg/vect/slp-perm-9.c (dg-final): Adjust dumps for vect32 targets.
+
+2021-06-04 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/pr99928-5.f90: Really use the
+ proper iteration variable.
+
+2021-06-04 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/pr99928-1.f90: Add 'implicit none'.
+ * gfortran.dg/gomp/pr99928-11.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-4.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-6.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-8.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-2.f90: Likewise. Add missing decl.
+ * gfortran.dg/gomp/pr99928-5.f90: Add implicit none;
+ fix loop-variable and remove xfail.
+
+2021-06-04 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/99928
+ * gfortran.dg/gomp/loop-2.f90: Update for typo fix.
+
+2021-06-04 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/99928
+ * gfortran.dg/gomp/pr99928-3.f90: Add 'default(none)', following
+ C/C++ version of the patch.
+ * gfortran.dg/gomp/loop-1.f90: New test.
+ * gfortran.dg/gomp/loop-2.f90: New test.
+ * gfortran.dg/gomp/pr99928-1.f90: New test; based on C/C++ test.
+ * gfortran.dg/gomp/pr99928-11.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-2.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-4.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-5.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-6.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-8.f90: Likewise.
+ * gfortran.dg/goacc/omp.f95: Use 'acc kernels loops' instead
+ of 'acc loops' to hide unrelated bug for now.
+ * gfortran.dg/goacc/omp-fixed.f: Likewise
+
+2021-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100887
+ * gcc.target/i386/pr100887.c: New test.
+
+2021-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100872
+ * g++.dg/gomp/declare-simd-8.C: New test.
+
+2021-06-04 Haochen Gui <guihaoc@gcc.gnu.org>
+
+ * gcc.target/powerpc/not-promote-mode.c: New.
+
+2021-06-03 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100637
+ * gcc.target/i386/vperm-v2hi.c: New test.
+ * gcc.target/i386/vperm-v4qi.c: Ditto.
+
+2021-06-03 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr80776-1.c: XFAIL and document the reason why.
+
+2021-06-03 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100592
+ * g++.dg/cpp0x/alias-decl-71.C: New test.
+
+2021-06-03 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100862
+ * g++.dg/cpp2a/using-enum-9.C: New test.
+
+2021-06-03 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ * gcc.target/aarch64/sve/part_vect_single_iter_epilog.c: New test.
+
+2021-06-03 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vabs.c: New test.
+
+2021-06-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/bit_packed_array6.adb: New test.
+ * gnat.dg/bit_packed_array6_pkg.ads: New helper.
+
+2021-06-03 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/spellcheck-options-23.c: New test.
+
+2021-06-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/inline22.adb: New test.
+
+2021-06-03 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.target/aarch64/cpunative/info_16: Update implementer.
+ * gcc.target/aarch64/cpunative/info_17: Likewise
+
+2021-06-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100859
+ * g++.dg/gomp/depend-iterator-3.C: New test.
+ * g++.dg/gomp/this-1.C: Don't expect any diagnostics for
+ this as base expression of depend array section, expect a different
+ error wording for this as depend locator and add testcases
+ for affinity clauses.
+
+2021-06-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/100838
+ * g++.dg/init/no-elide2.C: New test.
+
+2021-06-02 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * gcc.target/s390/ashr.c: New test.
+
+2021-06-02 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/99928
+ * gfortran.dg/gomp/taskloop-2.f90: New.
+
+2021-06-02 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/ext/builtin-shufflevector-1.C: Add -Wno-psabi -w to
+ dg-options.
+
+2021-06-01 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/65816
+ * g++.dg/cpp0x/constexpr-delegating3.C: New test.
+ * g++.dg/cpp0x/dc10.C: New test.
+ * g++.dg/cpp0x/initlist-base4.C: New test.
+ * g++.dg/cpp2a/constexpr-init22.C: New test.
+
+2021-06-01 Andrew Pinski <apinski@marvell.com>
+
+ PR tree-optimization/95481
+ * gcc.dg/tree-ssa/tailcall-10.c: New test.
+ * gcc.dg/tree-ssa/tailcall-11.c: New test.
+ * gcc.dg/tree-ssa/tailcall-12.c: New test.
+ * gcc.dg/tree-ssa/tailcall-13.c: New test.
+ * gcc.dg/tree-ssa/tailrecursion-8.c: New test.
+
+2021-06-01 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ PR testsuite/100750
+ * gcc.target/powerpc/rop-5.c: Require ELFv2 ABI.
+
+2021-06-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/91859
+ * g++.dg/cpp2a/destroying-delete5.C: New test.
+
+2021-06-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/94492
+ * g++.dg/cpp0x/depr-copy4.C: New test.
+
+2021-06-01 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/Wstringop-overflow-55.c: Adjust for global ranges changes.
+ * gcc.dg/pr80776-1.c: Same.
+
+2021-06-01 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/99928
+ * gfortran.dg/gomp/reduction5.f90: Remove dg-error; the issue is
+ now diagnosed with less error output.
+ * gfortran.dg/gomp/scan-1.f90: Likewise.
+ * gfortran.dg/gomp/pr99928-3.f90: New test.
+ * gfortran.dg/gomp/taskloop-1.f90: New test.
+
+2021-06-01 liuhongt <hongtao.liu@intel.com>
+
+ PR tree-optimization/98365
+ * gcc.target/i386/pr98365.c: New test.
+
+2021-06-01 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/100781
+ * gcc.dg/pr100781.c: New.
+
+2021-06-01 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/100774
+ * g++.dg/pr100774.C: New.
+
+2021-05-31 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/depend-iterator-1.f90: Use dg-do compile.
+ * gfortran.dg/gomp/depend-iterator-2.f90: Use dg-do compile.
+
+2021-05-31 Richard Biener <rguenther@suse.de>
+
+ PR c++/88601
+ * c-c++-common/builtin-shufflevector-2.c: New testcase.
+ * c-c++-common/torture/builtin-shufflevector-1.c: Likewise.
+ * g++.dg/ext/builtin-shufflevector-1.C: Likewise.
+ * g++.dg/ext/builtin-shufflevector-2.C: Likewise.
+
+2021-05-31 Peter Bergner <bergner@linux.ibm.com>
+
+ PR target/99842
+ * g++.target/powerpc/pr99842.C: New.
+
+2021-05-29 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * gcc.dg/plugin/diagnostic_plugin_show_trees.c (plugin_init): Fix caret_max_with.
+ * gcc.dg/plugin/diagnostic_plugin_test_inlining.c
+ (plugin_init): Likewise.
+ * gcc.dg/plugin/diagnostic_plugin_test_paths.c (plugin_init): Likewise.
+ * gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
+ (plugin_init): Likewise.
+ * gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
+ (plugin_init): Likewise.
+
+2021-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-1.c: Add default(none) to constructs
+ combined with parallel, teams or taskloop and defaultmap(none)
+ to constructs combined with target.
+ * c-c++-common/gomp/pr99928-2.c: Likewise.
+ * c-c++-common/gomp/pr99928-3.c: Likewise.
+ * c-c++-common/gomp/pr99928-4.c: Likewise.
+ * c-c++-common/gomp/pr99928-5.c: Likewise.
+ * c-c++-common/gomp/pr99928-6.c: Likewise.
+ * c-c++-common/gomp/pr99928-7.c: Likewise.
+ * c-c++-common/gomp/pr99928-8.c: Likewise.
+ * c-c++-common/gomp/pr99928-9.c: Likewise.
+ * c-c++-common/gomp/pr99928-10.c: Likewise.
+ * c-c++-common/gomp/pr99928-13.c: Likewise.
+ * c-c++-common/gomp/pr99928-14.c: Likewise.
+
+2021-05-29 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/Wstringop-overflow-55.c:
+ * gcc.dg/pr80776-1.c:
+
+2021-05-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100778
+ * gcc.dg/vect/bb-slp-pr100778-1.c: New testcase.
+
+2021-05-28 Jason Merrill <jason@redhat.com>
+
+ PR c++/100797
+ PR c++/95719
+ * g++.dg/inherit/virtual15.C: New test.
+ * g++.dg/inherit/virtual15a.C: New file.
+
+2021-05-28 Richard Biener <rguenther@suse.de>
+
+ PR ipa/100791
+ * gcc.dg/pr100791.c: New testcase.
+
+2021-05-28 Richard Biener <rguenther@suse.de>
+
+ PR c/100803
+ * gcc.dg/gimplefe-error-11.c: New testcase.
+
+2021-05-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-8.c: Remove all xfails.
+ * c-c++-common/gomp/pr99928-9.c: Likewise.
+ * c-c++-common/gomp/pr99928-10.c: Likewise.
+ * c-c++-common/gomp/pr99928-16.c: New test.
+
+2021-05-28 Tobias Burnus <tobias@codesourcery.com>
+
+ * c-c++-common/gomp/affinity-1.c: New test.
+ * c-c++-common/gomp/affinity-2.c: New test.
+ * c-c++-common/gomp/affinity-3.c: New test.
+ * c-c++-common/gomp/affinity-4.c: New test.
+ * c-c++-common/gomp/affinity-5.c: New test.
+ * c-c++-common/gomp/affinity-6.c: New test.
+ * c-c++-common/gomp/affinity-7.c: New test.
+ * gfortran.dg/gomp/affinity-clause-1.f90: New test.
+ * gfortran.dg/gomp/affinity-clause-2.f90: New test.
+ * gfortran.dg/gomp/affinity-clause-3.f90: New test.
+ * gfortran.dg/gomp/affinity-clause-4.f90: New test.
+ * gfortran.dg/gomp/affinity-clause-5.f90: New test.
+ * gfortran.dg/gomp/affinity-clause-6.f90: New test.
+ * gfortran.dg/gomp/depend-iterator-1.f90: New test.
+ * gfortran.dg/gomp/depend-iterator-2.f90: New test.
+ * gfortran.dg/gomp/depend-iterator-3.f90: New test.
+ * gfortran.dg/gomp/taskwait.f90: New test.
+
+2021-05-28 Joern Rennecke <joern.rennecke@riscy-ip.com>
+ Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/popcount4ll.c: Remove lp64 condition.
+ Adjust scanning pattern for !lp64.
+ * gcc.dg/tree-ssa/popcount5ll.c: Likewise.
+ * gcc.dg/tree-ssa/popcount4l.c: Adjust scanning pattern
+ for ! int32plus.
+
+2021-05-28 Kewen Lin <linkw@linux.ibm.com>
+
+ PR tree-optimization/99398
+ * gcc.target/powerpc/vec-perm-ctor-run.c: New test.
+ * gcc.target/powerpc/vec-perm-ctor.c: New test.
+ * gcc.target/powerpc/vec-perm-ctor.h: New test.
+
+2021-05-27 Matthias Kretz <kretz@kde.org>
+
+ PR c++/100716
+ * g++.dg/diagnostic/pr100716.C: New test.
+ * g++.dg/diagnostic/pr100716-1.C: Same test with
+ -fno-pretty-templates.
+
+2021-05-27 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99893
+ * g++.dg/cpp0x/static_assert17.C: New test.
+
+2021-05-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/86355
+ * g++.dg/cpp0x/alias-decl-variadic2.C: New test.
+
+2021-05-27 Patrick Palka <ppalka@redhat.com>
+
+ DR 1315
+ PR c++/67593
+ PR c++/96555
+ * g++.dg/template/partial16.C: New test.
+ * g++.dg/template/partial17.C: New test.
+ * g++.dg/template/partial18.C: New test.
+ * g++.dg/template/partial19.C: New test.
+ * g++.dg/cpp0x/pr68724.C: Adjust expected diagnostic for
+ ill-formed partial specialization.
+ * g++.dg/cpp0x/variadic38.C: Likewise.
+ * g++.dg/cpp1z/pr81016.C: Likewise.
+ * g++.dg/template/partial5.C: Likewise.
+ * g++.old-deja/g++.pt/spec21.C: Likewise.
+
+2021-05-27 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100602
+ * gfortran.dg/pointer_check_14.f90: New test.
+
+2021-05-27 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100656
+ * gfortran.dg/bounds_check_22.f90: New test.
+
+2021-05-27 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/Wstringop-overflow-55.c: Pass -fno-ipa-icf.
+
+2021-05-27 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100637
+ * gcc.target/i386/pr100637-3b.c (avgu): New test.
+ * gcc.target/i386/pr100637-3w.c (avgu): Ditto.
+
+2021-05-26 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100502
+ * g++.dg/template/access37.C: New test.
+ * g++.dg/template/access37a.C: New test.
+
+2021-05-26 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/Wstringop-overflow-55.c: Adapt for range query changes.
+ * gcc.dg/pr80776-1.c: Same.
+
+2021-05-26 Uroš Bizjak <ubizjak@gmail.com>
+
+ * lib/target-supports.exp (check_effective_target_vect32): New.
+ (available_vector_sizes): Append 32 for x86 targets.
+ * gcc.dg/vect/pr71264.c (dg-final): Xfail scan dump for vect32 targets.
+ * gcc.dg/vect/slp-28.c (dg-final): Adjust dumps for vect32 targets.
+ * gcc.dg/vect/slp-3.c (dg-final): Ditto.
+ * gcc.target/i386/pr100637-3b.c: New test.
+ * gcc.target/i386/pr100637-3w.c: Ditto.
+ * gcc.target/i386/pr100637-4b.c: Ditto.
+ * gcc.target/i386/pr100637-4w.c: Ditto.
+
+2021-05-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/sso-13.c: New test.
+
+2021-05-26 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vaddv-1.c: New test.
+
+2021-05-26 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100368
+ * g++.dg/cpp1z/elide6.C: New test.
+
+2021-05-26 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97420
+ * g++.dg/cpp0x/noexcept68.C: New test.
+
+2021-05-26 Geng Qi <gengqi@linux.alibaba.com>
+
+ * gcc.target/csky/fldrd_fstrd.c: New.
+ * gcc.target/csky/fpuv3/fldr64_fstr64.c: New.
+
+2021-05-26 Geng Qi <gengqi@linux.alibaba.com>
+
+ * gcc.target/csky/ldbs.c: New.
+
+2021-05-26 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/tree-ssa/pr96928.c: Update test for slightly different IR.
+ * gcc.dg/tree-ssa/pr96928-1.c: New testcase.
+
+2021-05-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100666
+ * g++.dg/cpp1z/nodiscard8.C: New test.
+ * g++.dg/cpp1z/nodiscard9.C: New test.
+
+2021-05-25 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/sancov/attribute.c: New test.
+
+2021-05-25 Cooper Qu <cooper.qu@linux.alibaba.com>
+
+ * gcc.target/csky/fpuv3/fpuv3.exp : Amend copyright.
+
+2021-05-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-8.c: Remove xfails from omp teams r21 and
+ r28 checks.
+ * c-c++-common/gomp/pr99928-9.c: Likewise.
+ * c-c++-common/gomp/pr99928-10.c: Likewise.
+
+2021-05-25 Geng Qi <gengqi@linux.alibaba.com>
+
+ * gcc.target/csky/fpuv3/fpuv3.exp: New.
+ * gcc.target/csky/fpuv3/fpv3_div.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fadd.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fdtos.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fftoi_rm.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fftoi_rz.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fhtos.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fitof.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fmov.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fmovi.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fmula.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fmuls.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fneg.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fnmula.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fnmuls.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fstod.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fstoh.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fsub.c: New.
+ * gcc.target/csky/fpuv3/fpv3_fxtof.c: New.
+ * gcc.target/csky/fpuv3/fpv3_h.c: New.
+ * gcc.target/csky/fpuv3/fpv3_hs.c: New.
+ * gcc.target/csky/fpuv3/fpv3_hsz.c: New.
+ * gcc.target/csky/fpuv3/fpv3_hz.c: New.
+ * gcc.target/csky/fpuv3/fpv3_ls.c: New.
+ * gcc.target/csky/fpuv3/fpv3_lsz.c: New.
+ * gcc.target/csky/fpuv3/fpv3_lt.c: New.
+ * gcc.target/csky/fpuv3/fpv3_ltz.c: New.
+ * gcc.target/csky/fpuv3/fpv3_max.c: New.
+ * gcc.target/csky/fpuv3/fpv3_min.c: New.
+ * gcc.target/csky/fpuv3/fpv3_mul.c: New.
+ * gcc.target/csky/fpuv3/fpv3_mula.c: New.
+ * gcc.target/csky/fpuv3/fpv3_muls.c: New.
+ * gcc.target/csky/fpuv3/fpv3_ne.c: New.
+ * gcc.target/csky/fpuv3/fpv3_nez.c: New.
+ * gcc.target/csky/fpuv3/fpv3_recip.c: New.
+ * gcc.target/csky/fpuv3/fpv3_sqrt.c: New.
+ * gcc.target/csky/fpuv3/fpv3_unordered.c: New.
+
+2021-05-24 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ * gcc.target/powerpc/fusion-p10-logadd.c: New file.
+
+2021-05-24 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/86470
+ * gfortran.dg/gomp/class-firstprivate-1.f90: New test.
+ * gfortran.dg/gomp/class-firstprivate-2.f90: New test.
+ * gfortran.dg/gomp/class-firstprivate-3.f90: New test.
+ * gfortran.dg/gomp/class-firstprivate-4.f90: New test.
+
+2021-05-24 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vld4.c: New test, derived from
+ slp-perm-3.c
+
+2021-05-24 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vld2.c: New test, derived from
+ slp-perm-2.c
+
+2021-05-24 liuhongt <hongtao.liu@intel.com>
+
+ PR target/100660
+ * gcc.target/i386/pr100660.c: New test.
+
+2021-05-24 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/tree-ssa/phi-opt-10.c: Use "\[0-9\]*" instead of '.'
+ when matching ssa name version.
+ * gcc.dg/tree-ssa/phi-opt-7.c: Likewise.
+
+2021-05-23 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100722
+ * gcc.target/i386/pr100722.c: New test.
+
+2021-05-23 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100551
+ * gfortran.dg/pr100551.f90: New test.
+
+2021-05-23 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/gimplefe-45.c: New test.
+
+2021-05-21 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ * gcc.target/powerpc/fusion-p10-addadd.c: New file.
+
+2021-05-21 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ * gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
+ * gcc.target/powerpc/fusion-p10-2logical.c: New file.
+
+2021-05-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-3.c: Remove all xfails.
+ * c-c++-common/gomp/pr99928-15.c: New test.
+
+2021-05-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-6.c: Remove all xfails.
+ * c-c++-common/gomp/pr99928-13.c: New test.
+ * c-c++-common/gomp/pr99928-14.c: New test.
+
+2021-05-21 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR middle-end/90115
+ * c-c++-common/goacc/privatization-1-compute-loop.c: Update.
+ * c-c++-common/goacc/privatization-1-compute.c: Likewise.
+ * c-c++-common/goacc/privatization-1-routine_gang-loop.c:
+ Likewise.
+ * c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
+
+2021-05-21 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR middle-end/90115
+ * c-c++-common/goacc/privatization-1-compute-loop.c: New file.
+ * c-c++-common/goacc/privatization-1-compute.c: Likewise.
+ * c-c++-common/goacc/privatization-1-routine_gang-loop.c:
+ Likewise.
+ * c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
+ * gfortran.dg/goacc/privatization-1-compute-loop.f90: Likewise.
+ * gfortran.dg/goacc/privatization-1-compute.f90: Likewise.
+ * gfortran.dg/goacc/privatization-1-routine_gang-loop.f90:
+ Likewise.
+ * gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise.
+ * c-c++-common/goacc-gomp/nesting-1.c: Update.
+ * c-c++-common/goacc/private-reduction-1.c: Likewise.
+ * gfortran.dg/goacc/private-3.f95: Likewise.
+
+2021-05-21 Thomas Schwinge <thomas@codesourcery.com>
+
+ * lib/target-supports.exp (check_effective_target___OPTIMIZE__):
+ New proc.
+ * gcc.c-torture/compile/ssa-unused-1.c: New file.
+
+2021-05-21 Richard Biener <rguenther@suse.de>
+ H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/pr90773-24.c: New test.
+ * gcc.target/i386/pr90773-25.c: Likewise.
+
+2021-05-21 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100637
+ * g++.target/i386/pr100637-1b.C: New test.
+ * g++.target/i386/pr100637-1w.C: Ditto.
+ * gcc.target/i386/pr100637-2b.c: Ditto.
+ * gcc.target/i386/pr100637-2w.c: Ditto.
+
+2021-05-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/derived_type7.adb, gnat.dg/derived_type7.ads: New test.
+
+2021-05-20 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp2a/desig19.C: New test.
+
+2021-05-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/100489
+ * g++.dg/cpp2a/desig18.C: New test.
+
+2021-05-20 Indu Bhagat <indu.bhagat@oracle.com>
+
+ * gcc.dg/pch/valid-1.c: Adjust diagnostic message in testcase.
+ * lib/dg-pch.exp: Adjust diagnostic message.
+
+2021-05-20 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/100684
+ * g++.dg/warn/Wnonnull13.C: New test.
+ * g++.dg/warn/Wnonnull14.C: New test.
+ * g++.dg/warn/Wnonnull15.C: New test.
+
+2021-05-20 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * g++.dg/modules/omp-1_c.C: Fix testcase.
+
+2021-05-20 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100701
+ * gcc.target/i386/pr100701.c: New test.
+
+2021-05-20 Marcel Vollweiler <marcel@codesourcery.com>
+
+ * gfortran.dg/gomp/map-6.f90: New test.
+ * gfortran.dg/gomp/map-7.f90: New test.
+ * gfortran.dg/gomp/map-8.f90: New test.
+
+2021-05-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR testsuite/96488
+ * gnat.dg/unchecked_convert5.adb: Do not run on PowerPC64 LE.
+ * gnat.dg/unchecked_convert6.adb: Likewise.
+
+2021-05-20 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100637
+ * gcc.target/i386/pr100637-1w.c (shl, ashr, lshr): New tests.
+
+2021-05-20 Christophe Lyon <christophe.lyon@linaro.org>
+ Torbjörn Svensson <torbjorn.svensson@st.com>
+
+ PR c/42579
+ * c-c++-common/spellcheck-reserved.c: Add tests for __FILE_NAME__.
+ * c-c++-common/cpp/file-name-1.c: New test.
+
+2021-05-20 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/96983
+ * gfortran.dg/pr96711.f90: Use 2**digit(x) instead of a hard-coded value;
+ add comments regarding what the code does.
+
+2021-05-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-4.c: Remove all xfails.
+ * c-c++-common/gomp/pr99928-5.c: Likewise.
+
+2021-05-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/100646
+ * gcc.dg/cpp/pr100646-1.c: New test.
+ * gcc.dg/cpp/pr100646-2.c: New test.
+
+2021-05-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/100634
+ * g++.dg/cpp2a/nontype-complex1.C: New test.
+
+2021-05-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/100659
+ * g++.dg/parse/access13.C: New test.
+
+2021-05-19 Martin Sebor <msebor@redhat.com>
+
+ PR c/100619
+ * gcc.dg/pr100619.c: New test.
+
+2021-05-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/100367
+ PR c++/96299
+ * g++.dg/cpp2a/spaceship-fallback1.C: New test.
+
+2021-05-19 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp1z/class-deduction-access1.C: New test.
+ * g++.dg/cpp1z/class-deduction-access2.C: New test.
+
+2021-05-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/100596
+ * g++.dg/cpp0x/friend7.C: Turn a few dg-warnings into dg-errors.
+ Remove dg-errors for GNU attributes.
+ * g++.dg/ext/attrib63.C: Remove dg-error.
+ * g++.dg/cpp0x/friend8.C: New test.
+
+2021-05-19 Kito Cheng <kito.cheng@sifive.com>
+
+ * g++.dg/modules/omp-1_a.C: Check pthread is available.
+ * g++.dg/modules/omp-1_b.C: Ditto.
+ * g++.dg/modules/omp-1_c.C: Ditto.
+ * g++.dg/modules/omp-2_a.C: Ditto.
+ * g++.dg/modules/omp-2_b.C: Ditto.
+
+2021-05-19 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/100333
+ * gcc.target/arm/cmse/pr100333.c: New test.
+
+2021-05-19 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/99977
+ * gcc.target/arm/pr99977.c: Require arm_arch_v8m_base.
+
+2021-05-19 Geng Qi <gengqi@linux.alibaba.com>
+
+ * gcc.target/riscv/arch-12.c: New.
+ * gcc.target/riscv/attribute-19.c: New.
+
+2021-05-19 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/narrow_high_combine.c: New test.
+
+2021-05-19 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/100672
+ * gcc.dg/torture/pr100672.c: New testcase.
+
+2021-05-19 Martin Liska <mliska@suse.cz>
+
+ PR testsuite/100658
+ * gcc.dg/local1.c: Fix typos.
+ * gcc.dg/ucnid-5-utf8.c: Likewise.
+ * gcc.dg/ucnid-5.c: Likewise.
+
+2021-05-19 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ * gcc.target/aarch64/sve/logical_unpacked_and_2.c: Change
+ scan-assembly-times to scan-assembly not for superfluous uxtb.
+ * gcc.target/aarch64/sve/logical_unpacked_and_3.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_and_4.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_and_6.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_and_7.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_eor_2.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_eor_3.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_eor_4.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_eor_6.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_eor_7.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_orr_2.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_orr_3.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_orr_4.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_orr_6.c: Likewise.
+ * gcc.target/aarch64/sve/logical_unpacked_orr_7.c: Likewise.
+ * gcc.target/aarch64/sve/ld1_extend.c: New test.
+
+2021-05-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/100576
+ * gcc.c-torture/compile/pr100576.c: New test.
+
+2021-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * gcc.dg/tree-ssa/ssa-sink-3.c: Fix test case.
+
+2021-05-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-2.c: Remove all xfails.
+ * c-c++-common/gomp/pr99928-12.c: New test.
+
+2021-05-19 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ * gcc.dg/tree-ssa/ssa-sink-1.c: Adjust.
+ * gcc.dg/tree-ssa/ssa-sink-2.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-3.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-4.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-5.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-6.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-7.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-8.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-9.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-10.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-13.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-14.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-16.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-17.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-sink-18.c: New.
+
+2021-05-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/100261
+ * g++.dg/dfp/mangle-6.C: New test.
+
+2021-05-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/100372
+ * g++.dg/cpp0x/alias-decl-ttp1.C: New test.
+
+2021-05-18 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ * gcc.target/powerpc/ppc64-abi-warn-1.c: Remove.
+ * gcc.target/powerpc/ppc64-abi-warn-2.c: Remove.
+ * gcc.target/powerpc/ppc64-abi-warn-3.c: Remove.
+
+2021-05-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/100205
+ PR c++/99314
+ * g++.dg/cpp0x/decltype-nonstatic1.C: New test.
+
+2021-05-18 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/implicit-delete1.C: New test.
+
+2021-05-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/100615
+ * gcc.dg/analyzer/pr100615.c: New test.
+
+2021-05-18 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100637
+ * gcc.target/i386/pr100637-1b.c: New test.
+ * gcc.target/i386/pr100637-1w.c: Ditto.
+ * gcc.target/i386/pr92658-avx2-2.c: Do not XFAIL scan for pmovsxbq.
+ * gcc.target/i386/pr92658-avx2.c: Do not XFAIL scan for pmovzxbq.
+ * gcc.target/i386/pr92658-avx512vl.c: Do not XFAIL scan for vpmovdb.
+ * gcc.target/i386/pr92658-sse4-2.c: Do not XFAIL scan for
+ pmovsxbd and pmovsxwq.
+ * gcc.target/i386/pr92658-sse4.c: Do not XFAIL scan for
+ pmovzxbd and pmovzxwq.
+
+2021-05-18 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/100642
+ * gfortran.dg/goacc-gomp/depobj.f90: New test.
+
+2021-05-18 Thomas Schwinge <thomas@codesourcery.com>
+
+ * lib/gcc-dg.exp: Implement 'dg-note'.
+ * lib/prune.exp: Likewise.
+ * gcc.dg/vect/nodump-vect-opt-info-2.c: Use 'dg-note', and
+ 'dg-prune-output "note: ".
+ * gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Use
+ 'dg-note', match up additional notes, one class of them with
+ XFAILed 'dg-bogus'.
+ * lib/lto.exp: Implement 'dg-lto-note'.
+ * g++.dg/lto/odr-1_0.C: Use 'dg-lto-note', match up additional
+ notes.
+ * g++.dg/lto/odr-1_1.C: Likewise.
+ * g++.dg/lto/odr-2_1.C: Likewise.
+
+2021-05-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/100590
+ * gcc.dg/pr100590.c: New test.
+
+2021-05-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100580
+ * g++.dg/other/pr100580.C: New test.
+
+2021-05-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/94589
+ * g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to 12.
+
+2021-05-18 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/pr100582.c: Adjust for AVX512.
+
+2021-05-18 Richard Biener <rguenther@suse.de>
+
+ PR c/100522
+ * gcc.dg/gimplefe-error-10.c: New testcase.
+
+2021-05-18 Richard Biener <rguenther@suse.de>
+
+ PR c/100547
+ * gcc.dg/pr100547.c: New testcase.
+ * gcc.dg/attr-vector_size.c: Adjust.
+
+2021-05-18 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/zvector/vec-_Bool.c: New test.
+
+2021-05-18 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR c++/100281
+ * g++.target/s390/pr100281-1.C: New test.
+ * g++.target/s390/pr100281-2.C: New test.
+
+2021-05-17 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/100512
+ * gcc.dg/pr100512.c: New.
+
+2021-05-17 Jonathan Wakely <jwakely@redhat.com>
+
+ * g++.dg/conversion/pr100635.C: New test.
+
+2021-05-17 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/98411
+ * gfortran.dg/pr98411.f90: New test.
+
+2021-05-17 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr100349.c: New test.
+
+2021-05-17 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.target/aarch64/cpunative/info_16: New test.
+ * gcc.target/aarch64/cpunative/info_17: New test.
+ * gcc.target/aarch64/cpunative/native_cpu_16.c: New test.
+ * gcc.target/aarch64/cpunative/native_cpu_17.c: New test.
+
+2021-05-17 Richard Biener <rguenther@suse.de>
+
+ PR c/100625
+ * gcc.dg/gimplefe-error-9.c: New testcase.
+
+2021-05-17 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/100582
+ * gcc.target/i386/pr100582.c: New testcase.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-compare-3.c: New test with GCC vectors.
+ * gcc.target/arm/simd/mve-vcmp-f16.c: New test for
+ auto-vectorization.
+ * gcc.target/arm/armv8_2-fp16-arith-1.c: Adjust since we now
+ vectorize float16_t vectors.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-compare-1.c: New test with GCC vectors.
+ * gcc.target/arm/simd/mve-compare-2.c: New test with GCC vectors.
+ * gcc.target/arm/simd/mve-compare-scalar-1.c: New test with GCC
+ vectors.
+ * gcc.target/arm/simd/mve-vcmp-f32.c: New test for
+ auto-vectorization.
+ * gcc.target/arm/simd/mve-vcmp.c: New test for auto-vectorization.
+
+2021-05-17 liuhongt <hongtao.liu@intel.com>
+
+ PR target/100549
+ * gcc.target/i386/pr100549.c: New test.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vadd-scalar-1.c: New.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vadd-1.c: New.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vsub_1.c: Factorize and add __fp16 test.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vshr.c: Add more scan-assembler-times.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/acle/saturation.c: Use arm_sat_ok effective
+ target.
+ * lib/target-supports.exp
+ (check_effective_target_arm_qbit_ok_nocache): Rename into...
+ (check_effective_target_arm_sat_ok_nocache): ... this. Check
+ __ARM_FEATURE_SAT and use armv6.
+
+2021-05-17 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/100633
+ * gfortran.dg/gomp/workshare-59.f90: New test.
+
+2021-05-17 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR debug/100515
+ * gcc.dg/debug/dwarf2/pr100515.c: Require openmp effective-target.
+
+2021-05-16 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/ext/attrib63.C: Add -Wno-psabi option.
+
+2021-05-16 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/warn/uninit-pr93100.C: Require fsantize support.
+
+2021-05-16 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/unsigned-float.c: Remove arm_fp_ok, adjust
+ dg-options.
+
+2021-05-15 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ * gcc.target/powerpc/rop-1.c: New.
+ * gcc.target/powerpc/rop-2.c: New.
+ * gcc.target/powerpc/rop-3.c: New.
+ * gcc.target/powerpc/rop-4.c: New.
+ * gcc.target/powerpc/rop-5.c: New.
+
+2021-05-15 Martin Jambor <mjambor@suse.cz>
+
+ Revert:
+ 2021-05-15 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/100453
+ * gcc.dg/tree-ssa/pr100453.c: New test.
+
+2021-05-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/100342
+ * gcc.target/i386/pr100342.c: New test.
+
+2021-05-14 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/parallel-master-1.f90: New test.
+ * gfortran.dg/gomp/parallel-master-2.f90: New test.
+
+2021-05-14 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/implicit-save.f90: New test.
+
+2021-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/95226
+ * g++.dg/cpp1y/pr95226.C: New test.
+
+2021-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/94616
+ * g++.dg/cpp0x/pr94616.C: New test.
+
+2021-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/90019
+ * g++.dg/cpp0x/sfinae68.C: New test.
+
+2021-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/cpp1y/pr88872.C: New test.
+
+2021-05-14 Michael de Lang <kingoipo@gmail.com>
+
+ * g++.dg/tsan/pthread_cond_clockwait.C: New test.
+
+2021-05-14 Marek Polacek <polacek@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/99032
+ * g++.dg/cpp0x/friend7.C: New test.
+ * g++.dg/cpp0x/gen-attrs-4.C: Add dg-error.
+ * g++.dg/cpp0x/gen-attrs-39-1.C: Likewise.
+ * g++.dg/cpp0x/gen-attrs-74.C: New test.
+ * g++.dg/ext/attrib63.C: New test.
+
+2021-05-13 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/93100
+ PR middle-end/98583
+ * g++.dg/warn/uninit-pr93100.C: New test.
+ * gcc.dg/uninit-pr93100.c: New test.
+ * gcc.dg/uninit-pr98583.c: New test.
+
+2021-05-13 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/100453
+ * gcc.dg/tree-ssa/pr100453.c: New test.
+
+2021-05-13 Martin Sebor <msebor@redhat.com>
+
+ * g++.dg/pr100574.C: Use size_t as operator new argument type.
+
+2021-05-13 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/100504
+ * gcc.target/i386/pr100504.c: New test.
+
+2021-05-13 Martin Sebor <msebor@redhat.com>
+
+ PR c/100550
+ * gcc.dg/Wvla-parameter-9.c: New test.
+
+2021-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/99928
+ * c-c++-common/gomp/pr99928-1.c: New test.
+ * c-c++-common/gomp/pr99928-2.c: New test.
+ * c-c++-common/gomp/pr99928-3.c: New test.
+ * c-c++-common/gomp/pr99928-4.c: New test.
+ * c-c++-common/gomp/pr99928-5.c: New test.
+ * c-c++-common/gomp/pr99928-6.c: New test.
+ * c-c++-common/gomp/pr99928-7.c: New test.
+ * c-c++-common/gomp/pr99928-8.c: New test.
+ * c-c++-common/gomp/pr99928-9.c: New test.
+ * c-c++-common/gomp/pr99928-10.c: New test.
+ * c-c++-common/gomp/pr99928-11.c: New test.
+
+2021-05-13 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/100563
+ * gcc.dg/pr100563.c (dg-options): Add -wno-pointer-to-int-cast.
+
+2021-05-13 Richard Earnshaw <rearnsha@arm.com>
+
+ * gcc.dg/pr100563.c: New test.
+
+2021-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/98856
+ * gcc.target/i386/sse2-psraq-1.c: New test.
+ * gcc.target/i386/sse4_2-psraq-1.c: New test.
+ * gcc.target/i386/avx-psraq-1.c: New test.
+ * gcc.target/i386/avx2-psraq-1.c: New test.
+ * gcc.target/i386/avx-pr82370.c: Adjust expected number of vpsrad
+ instructions.
+ * gcc.target/i386/avx2-pr82370.c: Likewise.
+ * gcc.target/i386/avx512f-pr82370.c: Likewise.
+ * gcc.target/i386/avx512bw-pr82370.c: Likewise.
+ * gcc.dg/torture/vshuf-4.inc: Add two further permutations.
+ * gcc.dg/torture/vshuf-8.inc: Likewise.
+
+2021-05-13 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100581
+ * g++.target/i386/pr100581.C: New test.
+
+2021-05-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR testsuite/100569
+ * gnat.dg/lto21.adb: Prune new LTO warning.
+
+2021-05-13 Martin Liska <mliska@suse.cz>
+
+ PR testsuite/100569
+ * gcc.dg/atomic/c11-atomic-exec-2.c: Prune new LTO warning.
+ * gcc.dg/torture/pr94947-1.c: Likewise.
+
+2021-05-13 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx-pr94680.c: Fix typo in testcase.
+
+2021-05-13 liuhongt <hongtao.liu@intel.com>
+
+ PR target/94680
+ * gcc.target/i386/avx-pr94680.c: New test.
+ * gcc.target/i386/avx512f-pr94680.c: New test.
+ * gcc.target/i386/sse2-pr94680.c: New test.
+
+2021-05-12 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/100571
+ * gcc.dg/Wstringop-overflow-67.c: New test.
+
+2021-05-12 Aldy Hernandez <aldyh@redhat.com>
+
+ PR c/100521
+ * gcc.dg/pr100521.c: New file.
+
+2021-05-12 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/warn/Wint-in-bool-context-2.C: New test.
+
+2021-05-12 Marcel Vollweiler <marcel@codesourcery.com>
+
+ * c-c++-common/gomp/map-6.c: New test.
+ * c-c++-common/gomp/map-7.c: New test.
+
+2021-05-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100566
+ * gcc.dg/torture/pr100566.c: New testcase.
+
+2021-05-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/100392
+ * gcc.dg/cpp/pr100392.c: New test.
+ * gcc.dg/cpp/pr100392.h: New file.
+
+2021-05-12 Martin Liska <mliska@suse.cz>
+
+ * lib/lto.exp: When running tests without jobserver, one can see
+ the following warning for tests that use 1to1 partitioning.
+
+2021-05-12 liuhongt <hongtao.liu@intel.com>
+
+ PR target/99908
+ * gcc.target/i386/avx2-pr99908.c: New test.
+ * gcc.target/i386/sse4_1-pr99908.c: New test.
+
+2021-05-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100519
+ * gcc.dg/torture/pr100519.c: New testcase.
+
+2021-05-12 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR debug/100515
+ * gcc.dg/debug/dwarf2/pr100515.c: New testcase.
+
+2021-05-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/100508
+ * gcc.dg/gomp/pr100508.c: New test.
+
+2021-05-12 Jakub Jelinek <jakub@redhat.com>
+ Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/94589
+ * gcc.dg/tree-ssa/pr94589-1.c: New test.
+
+2021-05-12 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/98218
+ * g++.target/i386/pr98218-1.C: Ditto.
+ * gcc.target/i386/pr98218-4.c: New test.
+ * gcc.target/i386/pr98218-1.c: Correct PR number.
+ * gcc.target/i386/pr98218-1a.c: Ditto.
+ * gcc.target/i386/pr98218-2.c: Ditto.
+ * gcc.target/i386/pr98218-2a.c: Ditto.
+ * gcc.target/i386/pr98218-3.c: Ditto.
+ * gcc.target/i386/pr98218-3a.c: Ditto.
+
+2021-05-11 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/cpp/c11-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-1.c,
+ gcc.dg/cpp/c2x-elifdef-2.c: New tests.
+
+2021-05-11 Joseph Myers <joseph@codesourcery.com>
+
+ * g++.dg/cpp1y/digit-sep-paste.C, gcc.dg/c2x-digit-separators-3.c:
+ New tests.
+
+2021-05-11 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.dg/guality/pr43077-1.c: Align types of output and input
+ operands by lifting immediates to type long.
+
+2021-05-11 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-digit-separators-1.c,
+ gcc.dg/c2x-digit-separators-1.c, gcc.dg/c2x-digit-separators-2.c:
+ New tests.
+
+2021-05-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/100517
+ * g++.dg/ext/vector41.C: New test.
+
+2021-05-11 Martin Liska <mliska@suse.cz>
+
+ * gfortran.dg/goacc/pr78027.f90: Remove -Wno-hsa option.
+ * brig.dg/README: Removed.
+ * brig.dg/dg.exp: Removed.
+ * brig.dg/test/gimple/alloca.hsail: Removed.
+ * brig.dg/test/gimple/atomics.hsail: Removed.
+ * brig.dg/test/gimple/branches.hsail: Removed.
+ * brig.dg/test/gimple/fbarrier.hsail: Removed.
+ * brig.dg/test/gimple/function_calls.hsail: Removed.
+ * brig.dg/test/gimple/internal-casts.hsail: Removed.
+ * brig.dg/test/gimple/kernarg.hsail: Removed.
+ * brig.dg/test/gimple/mem.hsail: Removed.
+ * brig.dg/test/gimple/mulhi.hsail: Removed.
+ * brig.dg/test/gimple/packed.hsail: Removed.
+ * brig.dg/test/gimple/priv-array-offset-access.hsail: Removed.
+ * brig.dg/test/gimple/smoke_test.hsail: Removed.
+ * brig.dg/test/gimple/variables.hsail: Removed.
+ * brig.dg/test/gimple/vector.hsail: Removed.
+ * lib/brig-dg.exp: Removed.
+ * lib/brig.exp: Removed.
+
+2021-05-11 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/99725
+ * gcc.target/arm/cmse/pr99725.c: New test.
+
+2021-05-11 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/fmul_lane_1.c: New test.
+
+2021-05-11 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/100509
+ * gcc.dg/pr100509.c: New testcase.
+
+2021-05-11 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/risbg-ll-3.c: Change match pattern.
+
+2021-05-11 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/51577
+ * g++.dg/lookup/operator-3.C: New test.
+
+2021-05-11 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100138
+ * g++.dg/cpp2a/concepts-ctad4.C: New test.
+
+2021-05-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/opt5.ads: New test.
+ * gnat.dg/specs/opt5_pkg.ads: New helper.
+
+2021-05-10 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/100425
+ PR middle-end/100510
+ * c-c++-common/Walloca-larger-than.C: New test.
+ * gcc.dg/Walloca-larger-than-4.c: New test.
+ * gcc.dg/Wvla-larger-than-5.c: New test.
+ * gcc.dg/pr79972.c: Remove unexpected warning directive.
+
+2021-05-10 Pat Haugen <pthaugen@linux.ibm.com>
+
+ * gcc.target/powerpc/fold-vec-insert-float-p9.c: Adjust counts.
+ * gcc.target/powerpc/vec-rlmi-rlnm.c: Likewise.
+
+2021-05-10 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vmul-scalar-1.c: New.
+
+2021-05-10 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/mve-vsub-scalar-1.c: New test.
+
+2021-05-10 H.J. Lu <hjl.tools@gmail.com>
+
+ PR tree-optimization/42587
+ * gcc.dg/optimize-bswapsi-6.c: New test.
+
+2021-05-10 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/100452
+ * g++.dg/vect/slp-pr99971.cc: Align data.
+
+2021-05-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100492
+ * gcc.dg/torture/pr100492.c: New testcase.
+
+2021-05-10 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/100464
+ PR c++/100468
+ * gcc.dg/pr100464.c: New testcase.
+ * g++.dg/tree-ssa/array-temp1.C: Adjust.
+
+2021-05-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100434
+ * gcc.dg/tree-ssa/ssa-dse-43.c: New testcase.
+
+2021-05-10 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/99960
+ * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c:
+ Update now that we're (correctly) using full 128-bit vector
+ loads/stores.
+ * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c:
+ Likewise.
+ * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c:
+ Likewise.
+ * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c:
+ Likewise.
+ * gcc.target/arm/mve/intrinsics/vuninitializedq_int.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c:
+ Likewise.
+
+2021-05-08 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/46991
+ * gfortran.dg/class_dummy_7.f90: Correct PR number.
+
+2021-05-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/sso-9.c: Delete.
+
+2021-05-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/debug18.adb: New test.
+
+2021-05-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/sso-12.c: New test.
+
+2021-05-07 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C:
+ Adjust diagnostic.
+
+2021-05-07 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR tree-optimization/79333
+ * gcc.dg/tree-ssa/ssa-fre-94.c: Require c99_runtime.
+
+2021-05-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/100450
+ * c-c++-common/gomp/pr100450.c: New test.
+
+2021-05-07 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100445
+ * gcc.target/i386/pr100445-1.c: New test.
+
+2021-05-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100445
+ * gcc.target/i386/pr100445.c: New test.
+
+2021-05-06 Joseph Myers <joseph@codesourcery.com>
+
+ PR c++/83873
+ PR preprocessor/97604
+ * g++.dg/cpp1y/digit-sep-neg-2.C,
+ g++.dg/cpp1y/digit-sep-pp-number.C: New tests.
+ * g++.dg/cpp1y/digit-sep-line-neg.C, g++.dg/cpp1y/digit-sep-neg.C:
+ Adjust expected messages.
+
+2021-05-06 Martin Jambor <mjambor@suse.cz>
+
+ * gcc.dg/ipa/ipa-sra-1.c (main): Revert change done by
+ 05193687dde, make the argv again pointer to an array.
+
+2021-05-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt93.adb: Compile only for LP64 targets.
+
+2021-05-06 Robin Dapp <rdapp@linux.ibm.com>
+
+ * lib/target-supports.exp: Add s390 checks for vect conversions.
+
+2021-05-06 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.dg/vect/pr56541.c: Add vect_floatint_cvt.
+
+2021-05-06 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/46991
+ PR fortran/99819
+ * gfortran.dg/class_dummy_6.f90: New test.
+ * gfortran.dg/class_dummy_7.f90: New test.
+
+2021-05-06 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR testsuite/100355
+ * gcc.c-torture/execute/ieee/cdivchkld.x: New.
+
+2021-05-06 Marius Hillenbrand <mhillen@linux.ibm.com>
+
+ * gcc.target/s390/zvector/imm-range-error-1.c: Fix test for
+ __builtin_s390_vpdi.
+ * gcc.target/s390/zvector/vec-permi.c: New test for builtin
+ vec_permi.
+
+2021-05-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/94589
+ * gcc.dg/pr94589-1.c: New test.
+ * gcc.dg/pr94589-2.c: New test.
+ * gcc.dg/pr94589-3.c: New test.
+ * gcc.dg/pr94589-4.c: New test.
+ * g++.dg/opt/pr94589-1.C: New test.
+ * g++.dg/opt/pr94589-2.C: New test.
+ * g++.dg/opt/pr94589-3.C: New test.
+ * g++.dg/opt/pr94589-4.C: New test.
+
+2021-05-06 Richard Biener <rguenther@suse.de>
+
+ PR ipa/100373
+ * gcc.dg/pr100373.c: New testcase.
+
+2021-05-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/20210505-1.c: New test.
+
+2021-05-05 Ivan Sorokin <vanyacpp@gmail.com>
+
+ PR target/91400
+ * gcc.target/i386/pr91400-1.c: New test.
+ * gcc.target/i386/pr91400-2.c: Likewise.
+
+2021-05-05 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test.
+
+2021-05-05 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100274
+ * gfortran.dg/argument_checking_25.f90: New test.
+
+2021-05-05 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/98218
+ * gcc.target/i386/pr98218-1.c: New test.
+ * gcc.target/i386/pr98218-1a.c: Ditto.
+ * gcc.target/i386/pr98218-2.c: Ditto.
+ * gcc.target/i386/pr98218-2a.c: Ditto.
+ * gcc.target/i386/pr98218-3.c: Ditto.
+ * gcc.target/i386/pr98218-3a.c: Ditto.
+ * gcc.dg/vect/vect-bool-cmp.c (dg-final):
+ Scan vect tree dump for "LOOP VECTORIZED", not VECTORIZED.
+
+2021-05-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/debug17.adb: Minor tweak.
+
+2021-05-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/debug8.adb: Minor tweak.
+ * gnat.dg/debug11.adb: Likewise.
+ * gnat.dg/debug16.adb: Likewise.
+ * gnat.dg/debug17.adb: New test.
+ * gnat.dg/specs/debug1.ads: Minor tweak.
+
+2021-05-05 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.dg/vect/slp-21.c: Add s390.
+
+2021-05-05 Tobias Burnus <tobias@codesourcery.com>
+
+ PR testsuite/100422
+ * g++.dg/gomp/clause-3.C: Use 'reduction(&:..)' instead of '...(&&:..)'.
+
+2021-05-05 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/79333
+ * gcc.dg/tree-ssa/ssa-fre-94.c: New testcase.
+ * gcc.dg/graphite/fuse-1.c: Adjust.
+ * gcc.dg/pr43864-4.c: Likewise.
+
+2021-05-05 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/100394
+ * g++.dg/torture/pr100382.C: New testcase.
+
+2021-05-04 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/100307
+ * g++.dg/warn/Wplacement-new-size-9.C: New test.
+ * gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test.
+
+2021-05-04 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wvla-parameter-3.c: Use unique strings in directive names.
+
+2021-05-04 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wvla-parameter-2.c: Use unique strings in directive names.
+
+2021-05-04 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/oscbreak-1.c: Compile with -O1
+ -fschedule-insns
+
+2021-05-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100414
+ * gcc.dg/pr100414.c: New testcase.
+
+2021-05-04 Tobias Burnus <tobias@codesourcery.com>
+
+ * gcc.dg/gomp/clause-1.c: Use 'reduction(&:..)' instead of '...(&&:..)'.
+
+2021-05-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt94.adb: New file.
+ * gnat.dg/opt94_pkg.adb: New file.
+ * gnat.dg/opt94_pkg.ads: New file.
+
+2021-05-04 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Skip on !lp64 targets,
+ simplify dump scanning down to one case.
+
+2021-05-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100329
+ * gcc.dg/torture/pr100329.c: New testcase.
+
+2021-05-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100398
+ * gcc.dg/torture/pr100398.c: New testcase.
+
+2021-05-03 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c:
+ Fix dg directives order.
+ * gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c:
+ Likewise.
+
+2021-05-03 Jeff Law <jlaw@tachyum.com>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Fix expected output for nds32le
+ and m32r.
+
+2021-05-03 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100362
+ * g++.dg/cpp1y/lambda-generic-100362.C: New test.
+
+2021-05-03 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/68942
+ PR c++/100344
+ * g++.dg/template/call8.C: New test.
+ * g++.dg/template/koenig12a.C: New test.
+
+2021-05-03 Jeff Law <jlaw@tachyum.com>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Fix expected output for bfin and lm32.
+
+2021-05-03 Marek Polacek <polacek@redhat.com>
+
+ PR c++/100055
+ * g++.dg/concepts/diagnostic18.C: New test.
+
+2021-05-03 Marek Polacek <polacek@redhat.com>
+
+ DR 1312
+ * g++.dg/cpp0x/constexpr-cast2.C: Remove XFAILs.
+
+2021-05-03 Jeff Law <jlaw@tachyum.com>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Fix xstormy selector.
+
+2021-05-03 Jeff Law <jlaw@tachyum.com>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for rx too.
+
+2021-05-03 Jeff Law <jlaw@tachyum.com>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for or1k too.
+
+2021-05-03 Jeff Law <jlaw@tachyum.com>
+
+ * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for
+ cr16 and xstormy16 targets.
+
+2021-05-03 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-dse-42.c: New testcase.
+ * gcc.dg/pr81192.c: Disable DSE.
+
+2021-05-03 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-dse-41.c: New testcase.
+
+2021-05-03 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ PR target/100217
+ * gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c: New test.
+ * gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c: New test.
+
+2021-05-02 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C: Expect [BS]
+ mapping class on AIX.
+ * gcc.c-torture/compile/pr61159.c: XFAIL on AIX.
+ * gcc.c-torture/execute/alias-2.c: Same.
+ * gcc.dg/alias-7.c: Same.
+
+2021-04-30 Jonathan Wright <jonathan.wright@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c:
+ New test.
+ * gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c:
+ New test.
+
+2021-04-30 Richard Biener <rguenther@suse.de>
+
+ PR c++/98032
+ * g++.dg/pr98032.C: New testcase.
+
+2021-04-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/96513
+ * gcc.dg/torture/pr96513.c: New testcase.
+
+2021-04-30 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/98060
+ * gcc.target/i386/pr98060.c: New test.
+
+2021-04-30 Roman Zhuykov <zhroma@ispras.ru>
+
+ PR rtl-optimization/100225
+ PR rtl-optimization/84878
+ * gcc.dg/pr100225.c: New test.
+
+2021-04-29 Joseph Myers <joseph@codesourcery.com>
+
+ PR preprocessor/82359
+ * g++.dg/cpp1y/digit-sep-line.C,
+ g++.dg/cpp1y/digit-sep-line-neg.C: New tests.
+
+2021-04-29 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/lookup/using-decl1.C: New test.
+
+2021-04-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/97974
+ * g++.old-deja/g++.law/union4.C: Add expected diagnostic.
+
+2021-04-29 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/68942
+ * g++.dg/template/koenig12.C: New test.
+
+2021-04-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94102
+ * g++.dg/cpp1z/class-deduction87.C: New test.
+
+2021-04-29 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR rtl-optimization/100303
+ * g++.dg/torture/pr100303.C: New file.
+
+2021-04-29 H.J. Lu <hjl.tools@gmail.com>
+
+ PR middle-end/90773
+ * g++.dg/pr90773-1.h: New test.
+ * g++.dg/pr90773-1a.C: Likewise.
+ * g++.dg/pr90773-1b.C: Likewise.
+ * g++.dg/pr90773-1c.C: Likewise.
+ * g++.dg/pr90773-1d.C: Likewise.
+ * gcc.target/i386/pr90773-1.c: Likewise.
+ * gcc.target/i386/pr90773-2.c: Likewise.
+ * gcc.target/i386/pr90773-3.c: Likewise.
+ * gcc.target/i386/pr90773-4.c: Likewise.
+ * gcc.target/i386/pr90773-5.c: Likewise.
+ * gcc.target/i386/pr90773-6.c: Likewise.
+ * gcc.target/i386/pr90773-7.c: Likewise.
+ * gcc.target/i386/pr90773-8.c: Likewise.
+ * gcc.target/i386/pr90773-9.c: Likewise.
+ * gcc.target/i386/pr90773-10.c: Likewise.
+ * gcc.target/i386/pr90773-11.c: Likewise.
+ * gcc.target/i386/pr90773-12.c: Likewise.
+ * gcc.target/i386/pr90773-13.c: Likewise.
+ * gcc.target/i386/pr90773-14.c: Likewise.
+
+2021-04-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100253
+ * g++.dg/pr100253.C: New testcase.
+
+2021-04-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100305
+ * gcc.c-torture/compile/pr100305.c: Remove dg-options. Add PR line.
+
+2021-04-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100302
+ * gcc.target/aarch64/sve/pr100302.c: New test.
+
+2021-04-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100319
+ * c-c++-common/gomp/task-detach-3.c: New test.
+
+2021-04-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99912
+ * gcc.dg/pr95580.c: Disable DSE.
+ * gcc.dg/Wrestrict-8.c: Place a use after each memcpy.
+ * c-c++-common/ubsan/overflow-negate-3.c: Make asms volatile
+ to prevent them from being removed.
+ * c-c++-common/ubsan/overflow-sub-4.c: Likewise.
+
+2021-04-29 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/100250
+ * gcc.dg/uninit-pr100250.c: New test.
+
+2021-04-29 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-unproto-1.c, gcc.dg/c11-unproto-2.c,
+ gcc.dg/c2x-unproto-1.c, gcc.dg/c2x-unproto-2.c: New tests.
+
+2021-04-28 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/map-5.f90: New test.
+
+2021-04-28 Patrick McGehearty <patrick.mcgehearty@oracle.com>
+
+ * gcc.c-torture/execute/ieee/cdivchkd.c: New test.
+ * gcc.c-torture/execute/ieee/cdivchkf.c: Likewise.
+ * gcc.c-torture/execute/ieee/cdivchkld.c: Likewise.
+
+2021-04-28 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.target/i386/pr89676.c: Add -fomit-frame-pointer.
+
+2021-04-28 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.dg/debug/dwarf2/inline5.c: Adjust pattern to avoid
+ mismatch when asm comments start with "/ ".
+
+2021-04-28 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/100305
+ * gcc.c-torture/compile/pr100305.c: New test.
+
+2021-04-28 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/82376
+ * gfortran.dg/PR82376.f90: New test.
+
+2021-04-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100292
+ * gcc.dg/pr100292.c: New testcase.
+
+2021-04-28 Richard Wai <richard@annexi-strayline.com>
+
+ * gnat.dg/containers2.adb: New test.
+
+2021-04-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt93.ads, gnat.dg/opt93.adb: New test.
+
+2021-04-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/92145
+ * g++.dg/cpp0x/depr-copy3.C: New test.
+
+2021-04-27 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/88580
+ * g++.dg/cpp0x/variadic182.C: New test.
+
+2021-04-27 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR middle-end/100284
+ * gcc.target/aarch64/sve/pr81003.c: New test.
+
+2021-04-27 Martin Sebor <msebor@redhat.com>
+
+ PR testsuite/100272
+ * g++.dg/ext/flexary13.C: Remove malformed directives.
+
+2021-04-27 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR target/100106
+ * gcc.c-torture/compile/pr100106.c: New testcase.
+
+2021-04-27 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/99977
+ * gcc.target/arm/pr99977.c: New test.
+
+2021-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/100239
+ * gcc.dg/pr100239.c: New test.
+
+2021-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/100254
+ * g++.dg/opt/pr100254.C: New test.
+
+2021-04-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99912
+ * gcc.dg/tree-ssa/ldist-33.c: Disable PRE and LIM.
+ * gcc.dg/tree-ssa/pr96789.c: Adjust dump file scanned.
+ * gcc.dg/tree-ssa/ssa-dse-28.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-dse-29.c: Likewise.
+
+2021-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/95527
+ * gcc.dg/tree-ssa/pr95527-2.c: New test.
+
+2021-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/96696
+ * gcc.target/i386/pr96696.c: New test.
+
+2021-04-27 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/100270
+ * gcc.target/aarch64/sve/acle/general-c/pr100270_1.c: New test.
+ * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Change
+ expected error message when subtracting pointers to different
+ vector types. Expect warnings when mixing them elsewhere.
+ * gcc.target/aarch64/sve/acle/general/attributes_7.c: Remove
+ XFAILs. Tweak error messages for some cases.
+
+2021-04-27 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/simd/ssra.c: Use +nosve
+ * gcc.target/aarch64/simd/usra.c: Likewise.
+
+2021-04-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100051
+ * gcc.dg/tree-ssa/ssa-fre-92.c: New testcase.
+
+2021-04-27 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/100272
+ * gcc.dg/tree-ssa/predcom-1.c: Re-enable PRE and fix
+ malformed dg directive.
+
+2021-04-27 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/100272
+ * g++.dg/diagnostic/ptrtomem1.C: Fix dg directives.
+ * g++.dg/ipa/pr45572-2.C: Likewise.
+ * g++.dg/template/spec26.C: Likewise.
+ * gcc.dg/pr20126.c: Likewise.
+ * gcc.dg/tree-ssa/pr20739.c: Likewise.
+
+2021-04-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100278
+ * gcc.dg/tree-ssa/pr100278.c: New testcase.
+
+2021-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/99405
+ * gcc.target/i386/pr99405.c: New test.
+
+2021-04-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99776
+ * gcc.dg/tree-ssa/ssa-fre-91.c: New testcase.
+
+2021-04-26 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/100209
+ * g++.dg/cpp1y/constexpr-base1.C: New test.
+ * g++.dg/cpp1y/constexpr-ptrsub1.C: New test.
+
+2021-04-26 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/goacc/classify-serial.f95:
+ Use [Ww]arning in dg-bogus as FE diagnostic and default
+ diagnostic differ and the result depends on ENABLE_OFFLOAD.
+ * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
+ * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
+
+2021-04-26 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/goacc/classify-serial.f95:
+ Correct spelling in dg-bogus to match -Wopenacc-parallelism.
+ * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
+ * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
+
+2021-04-26 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99956
+ * gfortran.dg/pr99956.f: New testcase.
+
+2021-04-26 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/cmse/bitfield-1.c: Remove dg-do.
+ * gcc.target/arm/cmse/bitfield-2.c: Likewise.
+ * gcc.target/arm/cmse/bitfield-3.c: Likewise.
+ * gcc.target/arm/cmse/cmse-16.c: Likewise.
+ * gcc.target/arm/cmse/struct-1.c: Likewise.
+ * gcc.target/arm/cmse/cmse.exp: Set dg-do-what-default depending
+ on arm_cmse_hw.
+ * lib/target-supports.exp (check_effective_target_arm_cmse_hw):
+ New.
+
+2021-04-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/pr84877.c: XFAIL on SPARC as well.
+
+2021-04-26 Thomas Schwinge <thomas@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Tom de Vries <vries@codesourcery.com>
+ Julian Brown <julian@codesourcery.com>
+ Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * c-c++-common/goacc/diag-parallelism-1.c: New.
+ * c-c++-common/goacc/acc-icf.c: Specify '-Wopenacc-parallelism',
+ and match diagnostics, as appropriate.
+ * c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise.
+ * c-c++-common/goacc/classify-kernels.c: Likewise.
+ * c-c++-common/goacc/classify-parallel.c: Likewise.
+ * c-c++-common/goacc/classify-routine.c: Likewise.
+ * c-c++-common/goacc/classify-serial.c: Likewise.
+ * c-c++-common/goacc/kernels-decompose-1.c: Likewise.
+ * c-c++-common/goacc/kernels-decompose-2.c: Likewise.
+ * c-c++-common/goacc/parallel-dims-1.c: Likewise.
+ * c-c++-common/goacc/parallel-reduction.c: Likewise.
+ * c-c++-common/goacc/pr70688.c: Likewise.
+ * c-c++-common/goacc/routine-1.c: Likewise.
+ * c-c++-common/goacc/routine-level-of-parallelism-2.c: Likewise.
+ * c-c++-common/goacc/uninit-dim-clause.c: Likewise.
+ * gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
+ * gfortran.dg/goacc/classify-kernels.f95: Likewise.
+ * gfortran.dg/goacc/classify-parallel.f95: Likewise.
+ * gfortran.dg/goacc/classify-routine.f95: Likewise.
+ * gfortran.dg/goacc/classify-serial.f95: Likewise.
+ * gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
+ * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
+ * gfortran.dg/goacc/parallel-tree.f95: Likewise.
+ * gfortran.dg/goacc/routine-4.f90: Likewise.
+ * gfortran.dg/goacc/routine-level-of-parallelism-1.f90: Likewise.
+ * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
+ * gfortran.dg/goacc/routine-multiple-directives-1.f90: Likewise.
+ * gfortran.dg/goacc/uninit-dim-clause.f95: Likewise.
+
+2021-04-26 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99473
+ * gcc.dg/tree-ssa/pr99473-1.c: New testcase.
+
+2021-04-25 liuhongt <hongtao.liu@intel.com>
+
+ PR target/98911
+ * gcc.target/i386/pr98911.c: New test.
+ * gcc.target/i386/funcspec-8.c: Replace __builtin_ia32_pcmpgtq
+ with __builtin_ia32_pcmpistrm128 since it has been folded.
+
+2021-04-24 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/100244
+ * g++.dg/analyzer/pr100244.C: New test.
+
+2021-04-24 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100154
+ * gfortran.dg/pr100154.f90: New test.
+
+2021-04-24 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/100218
+ * gfortran.dg/ptr-func-4.f90: New test.
+
+2021-04-24 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/guality/example.c: Update aarch64*-*-* xfails.
+ * gcc.dg/guality/guality.c: Likewise.
+ * gcc.dg/guality/inline-params.c: Likewise.
+ * gcc.dg/guality/loop-1.c: Likewise.
+ * gcc.dg/guality/pr36728-1.c: Likewise.
+ * gcc.dg/guality/pr36728-2.c: Likewise.
+ * gcc.dg/guality/pr36728-3.c: Likewise.
+ * gcc.dg/guality/pr41447-1.c: Likewise.
+ * gcc.dg/guality/pr54200.c: Likewise.
+ * gcc.dg/guality/pr54519-1.c: Likewise.
+ * gcc.dg/guality/pr54519-2.c: Likewise.
+ * gcc.dg/guality/pr54519-3.c: Likewise.
+ * gcc.dg/guality/pr54519-4.c: Likewise.
+ * gcc.dg/guality/pr54519-5.c: Likewise.
+ * gcc.dg/guality/pr54519-6.c: Likewise.
+ * gcc.dg/guality/pr54693-2.c: Likewise.
+ * gcc.dg/guality/pr56154-1.c: Likewise.
+ * gcc.dg/guality/pr59776.c: Likewise.
+ * gcc.dg/guality/pr68860-1.c: Likewise.
+ * gcc.dg/guality/pr68860-2.c: Likewise.
+ * gcc.dg/guality/pr90074.c: Likewise.
+ * gcc.dg/guality/pr90716.c: Likewise.
+ * gcc.dg/guality/sra-1.c: Likewise.
+
+2021-04-24 Richard Sandiford <richard.sandiford@arm.com>
+
+ * lib/target-supports-dg.exp (selector_expression): Handle any-opts
+ and no-opts.
+ * gcc.dg/guality/pr41353-1.c: Exclude -O0 from xfail.
+ * gcc.dg/guality/pr59776.c: Likewise.
+ * gcc.dg/guality/pr54970.c: Likewise -O0 and -Og.
+
+2021-04-24 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/89565
+ PR c++/93383
+ PR c++/95291
+ PR c++/99200
+ PR c++/99683
+ * g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive.
+ * g++.dg/cpp2a/nontype-class45.C: New test.
+ * g++.dg/cpp2a/nontype-class46.C: New test.
+ * g++.dg/cpp2a/nontype-class47.C: New test.
+ * g++.dg/cpp2a/nontype-class48.C: New test.
+
+2021-04-24 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/87709
+ * g++.dg/cpp1z/class-deduction86.C: New test.
+
+2021-04-23 Michael Meissner <meissner@linux.ibm.com>
+
+ PR target/98952
+ * gcc.target/powerpc/pr98952.c: New test.
+
+2021-04-23 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100041
+ * gcc.target/i386/pr79514.c (dg-error):
+ Expect error for 64bit targets.
+
+2021-04-23 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100182
+ * gcc.target/i386/pr100182.c: New test.
+ * gcc.target/i386/pr71245-1.c (dg-final): Xfail scan-assembler-not.
+ * gcc.target/i386/pr71245-2.c (dg-final): Ditto.
+
+2021-04-23 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/98767
+ * g++.dg/concepts/diagnostic17.C: New test.
+
+2021-04-23 Patrick Palka <ppalka@redhat.com>
+
+ DR 2374
+ * g++.dg/cpp1z/direct-enum-init2.C: New test.
+
+2021-04-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99971
+ * g++.dg/vect/slp-pr99971.cc: New testcase.
+
+2021-04-23 liuhongt <hongtao.liu@intel.com>
+
+ PR target/100093
+ * gcc.target/i386/pr100093.c: New test.
+
+2021-04-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/94508
+ * g++.dg/cpp2a/concepts-uneval3.C: New test.
+
+2021-04-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/77435
+ * g++.dg/template/partial-specialization9.C: New test.
+
+2021-04-22 Marek Polacek <polacek@redhat.com>
+
+ PR c++/100161
+ * g++.dg/warn/Wtype-limits6.C: New test.
+
+2021-04-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/84689
+ * g++.dg/cpp0x/sfinae67.C: New test.
+
+2021-04-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/16617
+ * g++.dg/template/access36.C: New test.
+
+2021-04-22 Tobias Burnus <tobias@codesourcery.com>
+
+ * substr_9.f90: Move to ...
+ * gfortran.dg/substr_9.f90: ... here.
+ * substr_10.f90: Move to ...
+ * gfortran.dg/substr_10.f90: ... here.
+
+2021-04-22 Martin Liska <mliska@suse.cz>
+
+ PR testsuite/100159
+ PR testsuite/100192
+ * g++.dg/template/nontype29.C: Fix typos and missing comments.
+ * gcc.dg/Warray-bounds-64.c: Likewise.
+ * gcc.dg/Warray-parameter.c: Likewise.
+ * gcc.dg/Wstring-compare.c: Likewise.
+ * gcc.dg/format/gcc_diag-11.c: Likewise.
+ * gfortran.dg/array_constructor_3.f90: Likewise.
+ * gfortran.dg/matmul_bounds_9.f90: Likewise.
+ * gfortran.dg/pr78033.f90: Likewise.
+ * gfortran.dg/pr96325.f90: Likewise.
+
+2021-04-22 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/100119
+ * gcc.target/i386/pr100119.c: New test.
+
+2021-04-22 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/99988
+ * gcc.target/aarch64/pr99988.c: Skip if not lp64 target.
+
+2021-04-22 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/set_vm_limit.c (set_vm_limit): Call getrlimit, use
+ obtained hard limit, and only call setrlimit if new softlimit is lower.
+
+2021-04-22 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/100176
+ * objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Add
+ missing return.
+
+2021-04-21 David Edelsohn <dje.gcc@gmail.com>
+
+ * gfortran.dg/bind_c_array_params_2.f90: Look for AIX-specific call
+ pattern.
+
+2021-04-21 Marek Polacek <polacek@redhat.com>
+
+ PR c++/96380
+ * g++.dg/cpp0x/enum_base4.C: New test.
+ * g++.dg/cpp0x/enum_base5.C: New test.
+
+2021-04-21 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/99988
+ * gcc.target/aarch64/pr99988.c: New test.
+
+2021-04-21 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/cpp1z/constexpr-lambda26.C: Add dg-additional-options
+ -fchecking.
+ * g++.dg/cpp1y/auto-fn61.C: Likewise.
+ * g++.dg/cpp2a/nontype-class39.C: Likewise.
+ * g++.dg/cpp0x/constexpr-52830.C: Likewise.
+ * g++.dg/cpp0x/vt-88982.C: Likewise.
+ * c-c++-common/goacc/kernels-decompose-ice-1.c: Add -fchecking to
+ dg-additional-options.
+ * c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise.
+
+2021-04-21 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/monitor-2.c: New test.
+
+2021-04-21 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/100176
+ * g++.dg/compat/struct-layout-1_generate.c: Add missing return.
+ * gcc.dg/compat/struct-layout-1_generate.c: Likewise.
+
+2021-04-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/100148
+ * g++.dg/opt/pr100148.C: New test.
+
+2021-04-21 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/depobj-1.f90: New test.
+ * gfortran.dg/gomp/depobj-2.f90: New test.
+
+2021-04-21 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.dg/vect/pr71264.c: Xfail on IBM Z due to V4QImode support.
+
+2021-04-21 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR middle-end/100130
+ * c-c++-common/attr-retain-10.c: New test.
+ * c-c++-common/attr-retain-11.c: Likewise.
+
+2021-04-21 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.dg/vect/bb-slp-39.c: Change number of times the pattern
+ must match for target IBM Z only.
+
+2021-04-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/100109
+ * g++.dg/cpp0x/lambda/lambda-variadic14.C: New test.
+
+2021-04-20 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.target/s390/zero-scratch-regs-1.c: Force test to run for
+ z/Architecture only.
+
+2021-04-20 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/100110
+ * gfortran.dg/pdt_31.f03: New test.
+ * gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9
+ to 8.
+
+2021-04-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97536
+ * g++.dg/concepts/diagnostic16.C: New test.
+
+2021-04-19 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/98457
+ * gdc.dg/pr98457.d: New test.
+
+2021-04-19 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/100075
+ * gcc.target/aarch64/pr100075.c: Add aarch64_little_endian
+ effective target.
+
+2021-04-19 Richard Biener <rguenther@suse.de>
+
+ PR preprocessor/100142
+ * gcc.dg/pr100142.c: New testcase.
+ * g++.dg/diagnostic/pr72803.C: Revert last change.
+
+2021-04-19 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/if-clause-2.c: '-fopenacc-kernels=[...]' ->
+ '--param=openacc-kernels=[...]'.
+ * c-c++-common/goacc/kernels-decompose-1.c: Likewise.
+ * c-c++-common/goacc/kernels-decompose-2.c: Likewise.
+ * c-c++-common/goacc/kernels-decompose-ice-1.c: Likewise.
+ * c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise.
+ * gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
+ * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
+ * gfortran.dg/goacc/kernels-tree.f95: Likewise.
+
+2021-04-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt92.adb: New test.
+
+2021-04-17 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * c-c++-common/zero-scratch-regs-8.c: Enable on s390*.
+ * c-c++-common/zero-scratch-regs-9.c: Likewise.
+ * c-c++-common/zero-scratch-regs-10.c: Likewise.
+ * c-c++-common/zero-scratch-regs-11.c: Likewise.
+ * gcc.target/s390/zero-scratch-regs-1.c: New test.
+
+2021-04-16 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/100094
+ * gfortran.dg/PR100094.f90: New test.
+
+2021-04-16 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96770
+ * gcc.target/arm/pure-code/pr96770.c: Fix scan-assembler-times
+ with movt/movw.
+
+2021-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/91710
+ * gcc.target/aarch64/pr91710.c: New test.
+
+2021-04-16 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/100018
+ * gfortran.dg/PR10018.f90: New test.
+
+2021-04-16 Tamar Christina <tamar.christina@arm.com>
+
+ PR target/100048
+ * gcc.target/aarch64/sve/pr100048.c: New test.
+
+2021-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/100111
+ * g++.dg/cpp0x/constexpr-100111.C: New test.
+
+2021-04-16 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99803
+ * g++.dg/cpp2a/typename14.C: Don't expect particular error
+ messages.
+ * g++.dg/cpp2a/typename19.C: New test.
+
+2021-04-16 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.dg/gimplefe-40.c: Moved to...
+ * gcc.dg/vect/gimplefe-40.c: ...here.
+ * gcc.dg/gimplefe-41.c: Moved to...
+ * gcc.dg/vect/gimplefe-41.c: ...here.
+
+2021-04-16 Harald Anlauf <anlauf@gmx.de>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/63797
+ * gfortran.dg/pr63797.f90: New test.
+
+2021-04-16 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.dg/tree-ssa/pr83403-1.c: Revert
+ max-completely-peeled-insns to the default value on IBM Z.
+ * gcc.dg/tree-ssa/pr83403-2.c: Likewise.
+
+2021-04-16 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99700
+ * g++.dg/cpp2a/constexpr-init21.C: New test.
+
+2021-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100075
+ * gcc.target/aarch64/pr100075.c: New test.
+
+2021-04-16 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR rtl-optimization/99596
+ * gcc.target/arm/pr99596.c: New test.
+
+2021-04-16 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/100067
+ * g++.target/arm/arm.exp (dg_runtest_extra_prunes): Update prune
+ template.
+ * gcc.target/arm/arm.exp (dg_runtest_extra_prunes): Likewise.
+ * g++.target/arm/mve.exp (dg_runtest_extra_prunes): Likewise. Fix
+ missing quotes around switch names.
+ * gcc.target/arm/mve/mve.exp: (dg_runtest_extra_prunes): Likewise.
+
+2021-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/99767
+ * gcc.target/aarch64/pr99767.c: New test.
+
+2021-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99850
+ * g++.dg/cpp23/lambda-specifiers2.C: New test.
+
+2021-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99833
+ * g++.dg/cpp1z/pr99833.C: New test.
+ * g++.dg/cpp2a/pr99833.C: New test.
+
+2021-04-16 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.dg/unroll-and-jam.c: Revert max-completely-peel-times to
+ the default value on IBM Z.
+
+2021-04-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/100079
+ * g++.dg/abi/mangle71.C: Fix expected mangling.
+ * g++.dg/abi/mangle77.C: New test.
+ * g++.dg/cpp2a/nontype-class-union1.C: Likewise.
+ * g++.dg/cpp2a/nontype-class-equiv1.C: Removed.
+ * g++.dg/cpp2a/nontype-class44.C: New test.
+
+2021-04-15 Martin Sebor <msebor@redhat.com>
+
+ PR c/99420
+ PR c/99972
+ * gcc.dg/Warray-parameter-9.c: New test.
+ * gcc.dg/Wnonnull-6.c: New test.
+ * gcc.dg/Wreturn-type3.c: New test.
+ * gcc.dg/Wunused-result.c: New test.
+ * gcc.dg/attr-noreturn.c: New test.
+ * gcc.dg/attr-returns-nonnull.c: New test.
+
+2021-04-15 Hans-Peter Nilsson <hp@axis.com>
+
+ PR middle-end/84877
+ * gcc.dg/pr84877.c: Xfail for cris-*-*.
+
+2021-04-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/80456
+ * g++.dg/cpp0x/constexpr-volatile3.C: New test.
+
+2021-04-15 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/uninit-pr89230-1.c: New test.
+ * gcc.dg/uninit-pr89230-2.c: Same.
+
+2021-04-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/100101
+ * g++.dg/cpp0x/noexcept67.C: New test.
+
+2021-04-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/100091
+ * g++.dg/cpp2a/lambda-uneval15.C: New test.
+
+2021-04-15 Richard Sandiford <richard.sandiford@arm.com>
+
+ * g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Add
+ -mtune=generic to the SVE flags.
+ * g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise.
+ * gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise.
+ * gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise.
+
+2021-04-15 Richard Sandiford <richard.sandiford@arm.com>
+
+ * lib/gcc-defs.exp (aarch64-arch-dg-options): New procedure.
+ (aarch64-with-arch-dg-options): Likewise.
+ * g++.target/aarch64/sve/aarch64-sve.exp: Run the tests inside
+ aarch64-with-arch-dg-options. Move the default architecture
+ flags to the final dg-runtest argument.
+ * gcc.target/aarch64/sve/aarch64-sve.exp: Likewise. Dispense with
+ DEFAULT_CFLAGS.
+ * gcc.target/aarch64/sve2/aarch64-sve2.exp: Likewise.
+
+2021-04-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/100073
+ * gcc.dg/pr86058.c: Enable also on i?86-*-*.
+
+2021-04-15 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR c++/98852
+ * g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp: New file.
+ * g++.target/aarch64/advsimd-intrinsics/pr98852.C: New file.
+
+2021-04-15 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR c/98852
+ * gcc.target/aarch64/advsimd-intrinsics/pr98852.c: New test.
+
+2021-04-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100056
+ * gcc.target/aarch64/pr100056.c: New test.
+
+2021-04-15 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.dg/pr93210.c: Adapt regex in order to also support a
+ RESULT_DECL as an operand for a RETURN_EXPR.
+
+2021-04-14 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/pr99929_1.c: New file.
+ * gcc.target/aarch64/sve/pr99929_2.c: Likewise.
+
+2021-04-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/100078
+ * g++.dg/template/dependent-tmpl2.C: New test.
+
+2021-04-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/93314
+ * g++.dg/parse/uneval1.C: New test.
+
+2021-04-14 Vladimir N. Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/100066
+ * gcc.target/i386/pr100066.c: New.
+
+2021-04-14 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/pr86058.c: Limit to just x86_64.
+
+2021-04-14 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/99246
+ * gcc.target/aarch64/sve/acle/general/pr99246.c: New test.
+
+2021-04-14 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/zvector/imm-range-error-1.c: New test.
+ * gcc.target/s390/zvector/vec_msum_u128-1.c: New test.
+
+2021-04-14 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/83476
+ PR c++/99885
+ * g++.dg/cpp1z/class-deduction85.C: New test.
+ * g++.dg/template/ref11.C: New test.
+
+2021-04-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/99478
+ * g++.dg/cpp2a/lambda-uneval14.C: New test.
+
+2021-04-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/90674
+ * g++.dg/debug/defaulted1.C: New test.
+
+2021-04-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/88742
+ * g++.dg/debug/cleanup1.C: New test.
+ * c-c++-common/Wimplicit-fallthrough-6.c: Adjust diagnostic line.
+ * c-c++-common/Wimplicit-fallthrough-7.c: Likewise.
+ * g++.dg/cpp2a/constexpr-dtor3.C: Likewise.
+ * g++.dg/ext/constexpr-attr-cleanup1.C: Likewise.
+ * g++.dg/tm/inherit2.C: Likewise.
+ * g++.dg/tm/unsafe1.C: Likewise.
+ * g++.dg/warn/Wimplicit-fallthrough-1.C: Likewise.
+ * g++.dg/gcov/gcov-2.C: Adjust coverage counts.
+
+2021-04-13 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/82800
+ * g++.dg/warn/uninit-pr82800.C: New test.
+
+2021-04-13 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/86058
+ * gcc.dg/pr86058.c: New test.
+
+2021-04-13 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99008
+ * g++.old-deja/g++.ns/crash3.C: Adjust expected diagnostic.
+ * g++.old-deja/g++.ns/template7.C: Likewise.
+ * g++.old-deja/g++.pt/crash8.C: Likewise.
+
+2021-04-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/100032
+ * g++.dg/cpp0x/alias-decl-equiv1.C: New test.
+
+2021-04-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97121
+ * g++.dg/cpp2a/spaceship-err6.C: New test.
+
+2021-04-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/100054
+ * g++.dg/cpp1y/lambda-generic-local-class1.C: New test.
+
+2021-04-13 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99008
+ * g++.dg/parse/template2.C: Adjust expected diagnostic.
+ * g++.dg/template/error8.C: Likewise.
+ * g++.dg/cpp1z/class-deduction84.C: New test.
+
+2021-04-13 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100053
+ * gcc.dg/torture/pr100053.c: New testcase.
+ * gcc.dg/tree-ssa/ssa-fre-93.c: Likewise.
+
+2021-04-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/91933
+ * g++.dg/cpp0x/constexpr-base7.C: New test.
+
+2021-04-13 Nathan Sidwell <nathan@acm.org>
+
+ PR preprocessor/99446
+ * g++.dg/diagnostic/pr72803.C: Adjust expected column.
+
+2021-04-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/100028
+ * gcc.target/aarch64/pr100028.c: New test.
+
+2021-04-13 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97134
+ * g++.dg/cpp2a/nontype-class43.C: New test.
+
+2021-04-13 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99961
+ PR c++/99994
+ * g++.dg/cpp2a/concepts-uneval1.C: New test.
+ * g++.dg/cpp2a/concepts-uneval2.C: New test.
+
+2021-04-13 Hans-Peter Nilsson <hp@axis.com>
+
+ PR analyzer/99212
+ * gcc.dg/analyzer/data-model-1.c (test_45): Inverse xfail at
+ line 971 for cris-*-*.
+
+2021-04-13 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/98599
+ * gcc.dg/analyzer/pr98599-a.c: New test.
+ * gcc.dg/analyzer/pr98599-b.c: New test.
+
+2021-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/99905
+ * gcc.target/i386/pr99905.c: New test.
+
+2021-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/99830
+ * gcc.dg/pr99830.c: New test.
+
+2021-04-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/93085
+ * g++.dg/template/dependent-tmpl1.C: New test.
+
+2021-04-12 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/99877
+ * g++.dg/asan/pr99877.C: New test.
+
+2021-04-12 Cui,Lili <lili.cui@intel.com>
+
+ * gcc.target/i386/funcspec-56.inc: Handle new march.
+ * g++.target/i386/mv16.C: Handle new march
+
+2021-04-11 Hafiz Abid Qadeer <abidh@codesourcery.com>
+
+ PR middle-end/98088
+ * c-c++-common/goacc/collapse-2.c: New.
+
+2021-04-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/97974
+ * g++.dg/lookup/pr84962.C: Adjust diagnostic.
+ * g++.dg/other/anon-union5.C: New test.
+
+2021-04-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/98800
+ * g++.dg/gomp/this-1.C: Adjust diagnostic.
+ * g++.dg/cpp0x/constexpr-this1.C: New test.
+
+2021-04-10 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/100011
+ * gcc.dg/analyzer/pr100011.c: New test.
+
+2021-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/99990
+ * gcc.dg/pr99990.c: New test.
+
+2021-04-10 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/99744
+ * gcc.target/i386/pr99744-2.c: New test.
+
+2021-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR lto/99849
+ * gcc.dg/lto/pr99849_0.c: New test.
+
+2021-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/98601
+ * gcc.dg/torture/pr98601.c: New test.
+
+2021-04-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/99180
+ PR c++/93295
+ PR c++/93867
+ PR c++/95486
+ * g++.dg/cpp2a/class-deduction-alias5.C: New test.
+ * g++.dg/cpp2a/class-deduction-alias6.C: New test.
+ * g++.dg/cpp2a/class-deduction-alias7.C: New test.
+ * g++.dg/cpp2a/class-deduction-alias8.C: New test.
+
+2021-04-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/100006
+ * g++.dg/cpp0x/lambda/lambda-variadic13.C: New test.
+
+2021-04-09 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/55288
+ * g++.dg/warn/uninit-pr55288.C: New test.
+
+2021-04-09 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/90215
+ * g++.dg/cpp1z/fold-lambda4.C: New test.
+
+2021-04-09 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99806
+ * g++.dg/concepts/abbrev10.C: New test.
+ * g++.dg/concepts/abbrev11.C: New test.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/pr70398.c: Require a target that can link
+ static executables.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ * g++.target/aarch64/bfloat_cpp_typecheck.C: Remove XFAILs.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gfortran.dg/vect/vect-8.f90: Expect 24 loops to be vectorized
+ with SVE.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ * g++.dg/tree-ssa/pr83518.C: XFAIL for vect_variable_length.
+ * gcc.dg/pr96573.c: Likewise.
+ * gcc.dg/tree-ssa/pr84512.c: Likewise.
+ * gcc.dg/vect/bb-slp-43.c: Likewise.
+ * gcc.dg/vect/slp-reduc-11.c: Likewise.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/pr65947-7.c: Add a noipa attribute. Expect the
+ loop to vectorized if vect_fold_extract_last.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/mem-shift-canonical.c: Use an asm instead
+ of relying on vectorisation.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/87763
+ * gcc.target/aarch64/insv_1.c: XFAIL two scan tests.
+
+2021-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR libfortran/78314
+ * gfortran.dg/ieee/ieee_6.f90: Skip for arm* and aarch64*.
+ * gfortran.dg/ieee/ieee_8.f90: Likewise.
+
+2021-04-09 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/99817
+ * gfortran.dg/coarray/dummy_2.f90: New test.
+
+2021-04-08 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/gomp/tls-5.C: Expect tbss failure on AIX.
+
+2021-04-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99874
+ * g++.dg/cpp2a/concepts-lambda16.C: New test.
+ * g++.dg/cpp2a/concepts-lambda17.C: New test.
+
+2021-04-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97679
+ * g++.dg/cpp2a/concepts-ctad3.C: New test.
+
+2021-04-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * lib/scanasm.exp (scan-lto-assembler): Update expected name
+ of dump file.
+
+2021-04-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * lib/target-supports.exp
+ (check_effective_target_stdint_types_mbig_endian): New proc.
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c: Require
+ stdint_types_mbig_endian.
+ * gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c: Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c: Likewise.
+
+2021-04-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/91849
+ * g++.dg/conversion/pr66211.C: Adjust diagnostic.
+ * g++.dg/conversion/ref7.C: New test.
+
+2021-04-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99859
+ * g++.dg/cpp1y/constexpr-99859-1.C: New test.
+ * g++.dg/cpp1y/constexpr-99859-2.C: New test.
+ * g++.dg/cpp2a/constexpr-new18.C: New test.
+ * g++.dg/cpp2a/constexpr-new19.C: New test.
+
+2021-04-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/pr99102.c: Add -fdump-tree-vect-details.
+
+2021-04-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/acle/general-c/func_redef_1.c: Remove
+ "was here" from error message.
+ * gcc.target/aarch64/sve/acle/general-c/func_redef_2.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/func_redef_3.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/func_redef_6.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_1.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_2.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_3.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_4.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_5.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_6.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_8.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_9.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_10.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/type_redef_13.c: Likewise.
+
+2021-04-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/asimd-mull-elem.c: Add +nosve.
+ * gcc.target/aarch64/pr98772.c: Likewise.
+ * gcc.target/aarch64/simd/vect_su_add_sub.c: Likewise.
+
+2021-04-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/mul_2.c: Adjust negative constants to avoid
+ conversion to shifts and adds.
+
+2021-04-08 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/99042
+ PR analyzer/99774
+ * gcc.dg/analyzer/pr99042.c: New test.
+ * gcc.dg/analyzer/pr99774-1.c: New test.
+ * gcc.dg/analyzer/pr99774-2.c: New test.
+
+2021-04-08 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * gdc.dg/gdc108.d: Update test.
+ * gdc.dg/gdc142.d: Likewise.
+ * gdc.dg/pr90136a.d: Likewise.
+ * gdc.dg/pr90136b.d: Likewise.
+ * gdc.dg/pr90136c.d: Likewise.
+ * gdc.dg/pr95173.d: Likewise.
+ * gdc.dg/attr_allocsize1.d: New test.
+ * gdc.dg/attr_allocsize2.d: New test.
+ * gdc.dg/attr_alwaysinline1.d: New test.
+ * gdc.dg/attr_cold1.d: New test.
+ * gdc.dg/attr_exclusions1.d: New test.
+ * gdc.dg/attr_exclusions2.d: New test.
+ * gdc.dg/attr_flatten1.d: New test.
+ * gdc.dg/attr_module.d: New test.
+ * gdc.dg/attr_noclone1.d: New test.
+ * gdc.dg/attr_noicf1.d: New test.
+ * gdc.dg/attr_noinline1.d: New test.
+ * gdc.dg/attr_noipa1.d: New test.
+ * gdc.dg/attr_noplt1.d: New test.
+ * gdc.dg/attr_optimize1.d: New test.
+ * gdc.dg/attr_optimize2.d: New test.
+ * gdc.dg/attr_optimize3.d: New test.
+ * gdc.dg/attr_optimize4.d: New test.
+ * gdc.dg/attr_restrict1.d: New test.
+ * gdc.dg/attr_section1.d: New test.
+ * gdc.dg/attr_symver1.d: New test.
+ * gdc.dg/attr_target1.d: New test.
+ * gdc.dg/attr_targetclones1.d: New test.
+ * gdc.dg/attr_used1.d: New test.
+ * gdc.dg/attr_used2.d: New test.
+ * gdc.dg/attr_weak1.d: New test.
+ * gdc.dg/imports/attributes.d: New test.
+
+2021-04-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/94529
+ * g++.dg/template/mem-spec2.C: New test.
+
+2021-04-08 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99844
+ * g++.dg/cpp2a/explicit16.C: Use c++20.
+ * g++.dg/cpp0x/noexcept66.C: New test.
+ * g++.dg/cpp2a/explicit17.C: New test.
+
+2021-04-08 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/99647
+ * gcc.c-torture/compile/pr99647.c: New test.
+
+2021-04-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/41723
+ * g++.dg/template/friend71.C: New test.
+
+2021-04-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/52625
+ * g++.dg/template/friend70.C: New test.
+
+2021-04-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/92918
+ * g++.dg/lookup/using66.C: New test.
+
+2021-04-07 Richard Sandiford <richard.sandiford@arm.com>
+
+ * lib/gcc.exp (gcc_target_compile): Add -dumpbase ""
+ when building an executable with testglue.
+
+2021-04-07 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/pr88834.c: Expect the vectorizer to use SLP.
+ * gcc.target/aarch64/sve/pr88834_ld3.c: New test.
+
+2021-04-07 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/slp-21.c: Only expect 2 of the loops to use SLP
+ if IFN_STORE_LANES is available.
+ * gcc.dg/vect/vect-complex-5.c: Expect no loops to use SLP if
+ IFN_STORE_LANES is available.
+ * gcc.target/aarch64/pr99873_1.c: New test.
+ * gcc.target/aarch64/pr99873_2.c: Likewise.
+ * gcc.target/aarch64/pr99873_3.c: Likewise.
+ * gcc.target/aarch64/sve/pr99873_1.c: Likewise.
+ * gcc.target/aarch64/sve/pr99873_2.c: Likewise.
+ * gcc.target/aarch64/sve/pr99873_3.c: Likewise.
+
+2021-04-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99954
+ * gcc.dg/torture/pr99954.c: New testcase.
+
+2021-04-07 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/99955
+ * gcc.c-torture/execute/pr92618.c: Move may_alias attributes
+ last.
+
+2021-04-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99947
+ * gcc.dg/torture/pr99947.c: New testcase.
+
+2021-04-07 Bin Cheng <bin.cheng@linux.alibaba.com>
+
+ PR tree-optimization/98736
+ * gcc.c-torture/execute/pr98736.c: New test.
+
+2021-04-07 Marek Polacek <polacek@redhat.com>
+
+ PR c++/52202
+ * g++.dg/cpp0x/rv-life.C: New test.
+
+2021-04-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/96673
+ * g++.dg/cpp1y/nsdmi-aggr13.C: New test.
+
+2021-04-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/99901
+ * g++.dg/cpp1z/inline-var9.C: New test.
+
+2021-04-06 Vladimir N. Makarov <vmakarov@redhat.com>
+
+ PR target/99781
+ * g++.target/aarch64/sve/pr99781.C: New.
+
+2021-04-06 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/memcpy-strategy-9.c: New test.
+ * gcc.target/i386/memcpy-strategy-10.c: Likewise.
+ * gcc.target/i386/memcpy-strategy-11.c: Likewise.
+ * gcc.target/i386/memset-strategy-7.c: Likewise.
+ * gcc.target/i386/memset-strategy-8.c: Likewise.
+ * gcc.target/i386/memset-strategy-9.c: Likewise.
+
+2021-04-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99880
+ * gcc.dg/torture/pr99880.c: New testcase.
+
+2021-04-06 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/modules/builtin-3_a.C: Remove dump scans.
+ * g++.dg/modules/builtin-3_b.C: Remove dump scans.
+
+2021-04-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/96573
+ * gcc.dg/pr96573.c: Instead of __builtin_bswap accept also
+ VEC_PERM_EXPR with bswapping permutation.
+
+2021-04-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99924
+ * gfortran.dg/vect/pr99924.f90: New testcase.
+
+2021-04-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97900
+ * g++.dg/ext/vector40.C: Add -Wno-psabi -w to dg-options.
+
+2021-04-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/91241
+ * g++.dg/abi/lambda-defarg1.C: New test.
+
+2021-04-06 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99899
+ * g++.dg/cpp2a/concepts-placeholder7.C: New test.
+ * g++.dg/cpp2a/concepts-placeholder8.C: New test.
+
+2021-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/96311
+ * g++.dg/cpp1y/lambda-generic-Wunused.C: New test.
+
+2021-04-05 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/rv-cast6.C: Expect reinterpret_cast error.
+ * g++.dg/cpp0x/reinterpret_cast2.C: Adjust message.
+ * g++.old-deja/g++.jason/rvalue3.C: Likewise.
+
+2021-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/95317
+ * g++.dg/cpp1y/lambda-generic-enum1.C: New test.
+
+2021-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/95870
+ * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.
+
+2021-04-05 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/99906
+ * gcc.dg/analyzer/pr99906.c: New test.
+
+2021-04-05 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/99886
+ * gcc.dg/analyzer/pr99886.c: New test.
+
+2021-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/99066
+ * g++.dg/cpp0x/extern_template-6.C: New test.
+
+2021-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/99201
+ * g++.dg/cpp1z/constexpr-if-lambda4.C: New test.
+
+2021-04-05 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/99914
+ * gdc.dg/pr99914.d: New test.
+
+2021-04-05 Sandra Loosemore <sandra@codesourcery.com>
+
+ * gcc.dg/ipa/propmalloc-4.c: Add -fdelete-null-pointer-checks.
+ * gcc.dg/tree-ssa/evrp11.c: Likewise.
+
+2021-04-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/99643
+ * g++.dg/cpp0x/initlist-new5.C: New test.
+
+2021-04-03 Alexandre Oliva <oliva@adacore.com>
+
+ * g++.dg/pr94314-3.C: Zero-initialize main loop counter.
+
+2021-04-03 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.dg/ipa/ipa-sra-19.c: Extend -Wno-psabi to ppc-vx7r2.
+
+2021-04-03 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91416
+ * g++.dg/other/gc7.C: New test.
+
+2021-04-03 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/99818
+ * gfortran.dg/coarray_48.f90: New test.
+
+2021-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/99882
+ * gcc.dg/pr99882.c: New test.
+
+2021-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/99863
+ * gcc.target/i386/pr99863.c: New test.
+
+2021-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/98125
+ * g++.dg/pr93195a.C: Skip on powerpc*-*-* 64-bit.
+
+2021-04-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/91217
+ * g++.dg/opt/nrv20.C: New test.
+
+2021-04-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/90664
+ * g++.dg/cpp1z/noexcept-type24.C: New test.
+
+2021-04-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/97900
+ * g++.dg/ext/vector40.C: New test.
+
+2021-04-02 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99869
+ * g++.dg/cpp2a/concepts-placeholder6.C: New test.
+
+2021-04-02 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99586
+ * g++.dg/cpp2a/nontype-class42.C: New test.
+
+2021-04-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/97938
+ * g++.dg/cpp2a/lambda-pack-init6.C: New test.
+
+2021-04-02 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/modules/pr99283-6_d.H: New.
+ * g++.dg/modules/pr99283-7-swap.h: New.
+ * g++.dg/modules/pr99283-7-traits.h: New.
+ * g++.dg/modules/pr99283-7_a.H: New.
+ * g++.dg/modules/pr99283-7_b.H: New.
+ * g++.dg/modules/pr99283-7_c.C: New.
+ * g++.dg/modules/pr99283-7_d.H: New.
+
+2021-04-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * go.test/test/fixedbugs/issue6036.go: Skip on sparc.
+ * go.test/test/fixedbugs/issue22200b.go: Likewise.
+
+2021-04-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/99726
+ * gcc.target/i386/pr99726.c: Remove -m32 from dg-options. Move
+ -floop-nest-optimize to dg-additional-options guarded on fgraphite
+ effective target.
+
+2021-04-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99831
+ * g++.dg/other/gc6.C: New test.
+
+2021-04-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/99583
+ * g++.dg/cpp0x/lambda/lambda-variadic12.C: New test.
+
+2021-04-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/98481
+ * g++.dg/abi/abi-tag24a.C: New test.
+ * g++.dg/abi/macro0.C: Adjust expected value.
+
+2021-04-01 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99283
+ * g++.dg/modules/pr99283-6.h: New.
+ * g++.dg/modules/pr99283-6_a.H: New.
+ * g++.dg/modules/pr99283-6_b.H: New.
+ * g++.dg/modules/pr99283-6_c.C: New.
+ * g++.dg/modules/hdr-init-1_c.C: Adjust scan.
+ * g++.dg/modules/indirect-3_c.C: Adjust scan.
+ * g++.dg/modules/indirect-4_c.C: Adjust scan.
+ * g++.dg/modules/lambda-3_b.C: Adjust scan.
+ * g++.dg/modules/late-ret-3_c.C: Adjust scan.
+ * g++.dg/modules/pr99425-1_b.H: Adjust scan.
+ * g++.dg/modules/pr99425-1_c.C: Adjust scan.
+
+2021-04-01 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/98265
+ * gcc.dg/tree-ssa/pr98265.C: New test.
+
+2021-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/96573
+ * gcc.dg/pr96573.c: New test.
+
+2021-04-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99856
+ * gcc.dg/vect/pr99856.c: New testcase.
+
+2021-04-01 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/97009
+ * gcc.dg/tree-ssa/pr97009.c: New test.
+
+2021-04-01 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/99840
+ * gfortran.dg/transpose_5.f90: New test.
+
+2021-03-31 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/99771
+ * gcc.dg/analyzer/data-model-10.c: Update expected output.
+ * gcc.dg/analyzer/malloc-ipa-13.c: Likewise.
+ * gcc.dg/analyzer/malloc-ipa-13a.c: New test.
+ * gcc.dg/analyzer/pr99771-1.c: New test.
+
+2021-03-31 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/98268
+ * gcc.target/aarch64/sve/pr98268-1.c: New test.
+ * gcc.target/aarch64/sve/pr98268-2.c: Likewise.
+
+2021-03-31 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/99726
+ * gcc.target/i386/pr99726.c: New test.
+
+2021-03-31 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR rtl-optimization/97141
+ PR rtl-optimization/98726
+ * gcc.c-torture/compile/pr97141.c: New test.
+ * gcc.c-torture/compile/pr98726.c: Likewise.
+ * gcc.target/aarch64/sve/pr97141.c: Likewise.
+ * gcc.target/aarch64/sve/pr98726.c: Likewise.
+
+2021-03-31 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/65182
+ * gcc.dg/uninit-pr65182.c: New test.
+
+2021-03-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/99445
+ * g++.dg/cpp0x/alias-decl-variadic1.C: New test.
+
+2021-03-31 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96974
+ * g++.target/aarch64/sve/pr96974.C: Expect SLP diagnostic only
+ under lp64.
+
+2021-03-31 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/99786
+ * gcc.target/arm/pr99786.c: New test.
+
+2021-03-31 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/memcpy-strategy-5.c: New test.
+ * gcc.target/i386/memcpy-strategy-6.c: Likewise.
+ * gcc.target/i386/memcpy-strategy-7.c: Likewise.
+ * gcc.target/i386/memcpy-strategy-8.c: Likewise.
+ * gcc.target/i386/memset-strategy-3.c: Likewise.
+ * gcc.target/i386/memset-strategy-4.c: Likewise.
+ * gcc.target/i386/memset-strategy-5.c: Likewise.
+ * gcc.target/i386/memset-strategy-6.c: Likewise.
+
+2021-03-31 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/98119
+ * gcc.target/aarch64/sve/pr98119.c: New test.
+
+2021-03-31 Jakub Jelinek <jakub@redhat.com>
+ Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/99813
+ * g++.target/aarch64/sve/pr99813.C: New test.
+
+2021-03-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/97680
+ * c-c++-common/zero-scratch-regs-6.c: Skip on ia64.
+ * c-c++-common/zero-scratch-regs-7.c: Likewise.
+ * c-c++-common/zero-scratch-regs-8.c: Change from dg-skip-if of
+ selected unsupported triplets to all targets but selected triplets
+ of supported targets.
+ * c-c++-common/zero-scratch-regs-9.c: Likewise.
+ * c-c++-common/zero-scratch-regs-10.c: Likewise.
+ * c-c++-common/zero-scratch-regs-11.c: Likewise.
+
+2021-03-31 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/88115
+ * g++.dg/cpp0x/alignof7.C: Adjust expected mangling.
+
+2021-03-31 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99815
+ * g++.dg/cpp2a/concepts-placeholder5.C: New test.
+
+2021-03-30 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/symbolic-1.c: Fix typo.
+
+2021-03-30 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99283
+ * g++.dg/modules/pr99283-5.h: New.
+ * g++.dg/modules/pr99283-5_a.H: New.
+ * g++.dg/modules/pr99283-5_b.H: New.
+ * g++.dg/modules/pr99283-5_c.C: New.
+
+2021-03-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99790
+ * g++.dg/cpp1z/pr99790.C: New test.
+
+2021-03-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/99822
+ * gcc.c-torture/compile/pr99822.c: New test.
+
+2021-03-30 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ PR target/99718
+ PR target/99718
+ * gcc.target/powerpc/fold-vec-insert-char-p8.c: Update
+ instruction counts.
+ * gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-double.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise.
+ * gcc.target/powerpc/pr79251.p8.c: Likewise.
+ * gcc.target/powerpc/pr79251.p9.c: Likewise.
+ * gcc.target/powerpc/vsx-builtin-7.c: Likewise.
+ * gcc.target/powerpc/pr79251-run.p7.c: New test.
+ * gcc.target/powerpc/pr79251.p7.c: New test.
+
+2021-03-30 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/99744
+ * gcc.target/i386/pr99744-1.c: New test.
+
+2021-03-30 Tamar Christina <tamar.christina@arm.com>
+
+ PR tree-optimization/99825
+ * gfortran.dg/vect/pr99825.f90: New test.
+
+2021-03-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/99808
+ * gcc.target/aarch64/pr99808.c: Use ULL constant suffix.
+
+2021-03-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99824
+ * gcc.dg/torture/pr99824.c: New testcase.
+
+2021-03-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/98136
+ * g++.dg/pr98136.C: New test.
+
+2021-03-30 Mihailo Stojanovic <mihailo.stojanovic@typhoon-hil.com>
+
+ * gcc.target/aarch64/fcvt_nosimd.c: New test.
+
+2021-03-29 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/61869
+ * gcc.dg/uninit-pr61869.c: New test.
+
+2021-03-29 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/61677
+ * gcc.dg/uninit-pr61677.c: New test.
+
+2021-03-29 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/61112
+ * gcc.dg/uninit-pr61112.c: New test.
+
+2021-03-29 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/99751
+ * gcc.c-torture/compile/pr99751.c: Rename from ...
+ * gcc.c-torture/execute/pr99751.c: ... to this.
+
+2021-03-29 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc.c-torture/compile/pr99751.c: New test.
+
+2021-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/93660
+ * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Expect a mixed size
+ declare simd warning on aarch64.
+
+2021-03-29 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/99216
+ * g++.target/aarch64/sve/pr99216.C: New test.
+
+2021-03-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99807
+ * gfortran.dg/vect/pr99807.f90: New testcase.
+
+2021-03-29 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/99808
+ * gcc.target/aarch64/pr99808.c: New test.
+
+2021-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/99777
+ * g++.dg/torture/pr99777.C: New test.
+
+2021-03-28 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96770
+ * gcc.target/arm/pure-code/pr96770.c: Improve scan-assembler-times.
+
+2021-03-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/99602
+ * gfortran.dg/pr99602.f90: New test.
+ * gfortran.dg/pr99602a.f90: New test.
+ * gfortran.dg/pr99602b.f90: New test.
+ * gfortran.dg/pr99602c.f90: New test.
+ * gfortran.dg/pr99602d.f90: New test.
+
+2021-03-28 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * lib/gdc-utils.exp (gdc-copy-extra): Rename to...
+ (gdc-copy-file): ... this. Use file copy instead of open/close.
+ (gdc-convert-test): Save translated dejagnu test to gdc.test
+ directory, only write dejagnu directives to the test file.
+ (gdc-do-test): Don't create gdc.test symlink.
+
+2021-03-28 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * gdc.dg/gdc270a.d: Removed.
+ * gdc.dg/gdc270b.d: Removed.
+
+2021-03-26 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/pr99557.c: New.
+
+2021-03-26 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/59970
+ * gcc.dg/uninit-pr59970.c: New test.
+
+2021-03-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/98352
+ * g++.dg/cpp0x/inh-ctor37.C: Remove dg-error.
+ * g++.dg/cpp0x/nsdmi17.C: New test.
+
+2021-03-26 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99283
+ * g++.dg/modules/pr99283-2_a.H: New.
+ * g++.dg/modules/pr99283-2_b.H: New.
+ * g++.dg/modules/pr99283-2_c.H: New.
+ * g++.dg/modules/pr99283-3_a.H: New.
+ * g++.dg/modules/pr99283-3_b.H: New.
+ * g++.dg/modules/pr99283-4.H: New.
+ * g++.dg/modules/tpl-alias-1_a.H: Adjust scans.
+ * g++.dg/modules/tpl-alias-1_b.C: Adjust scans.
+
+2021-03-26 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR target/99766
+ * g++.target/aarch64/sve/pr99766.C: New.
+
+2021-03-26 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR ipa/99466
+ * gcc.dg/tls/pr99466-1.c: New test.
+ * gcc.dg/tls/pr99466-2.c: New test.
+
+2021-03-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99705
+ * g++.dg/cpp0x/new5.C: New test.
+
+2021-03-26 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/99651
+ * gfortran.dg/null_11.f90: New test.
+
+2021-03-25 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/55060
+ * gcc.dg/uninit-pr55060.c: New.
+
+2021-03-25 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/48483
+ * g++.dg/warn/uninit-pr48483.C: New test.
+
+2021-03-25 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/uninit-pr44547.c: New.
+
+2021-03-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99672
+ * g++.dg/concepts/diagnostic2.C: Adjust expected caret line.
+ * g++.dg/cpp1y/builtin_location.C (f4, n6): Move #line directives
+ to match locus changes.
+ * g++.dg/cpp2a/srcloc1.C: Adjust expected column numbers.
+ * g++.dg/cpp2a/srcloc2.C: Likewise.
+ * g++.dg/cpp2a/srcloc15.C: Likewise.
+ * g++.dg/cpp2a/srcloc16.C: Likewise.
+ * g++.dg/cpp2a/srcloc19.C: New test.
+ * g++.dg/modules/adhoc-1_b.C: Adjust expected column numbers
+ and caret line.
+ * g++.dg/modules/macloc-1_c.C: Adjust expected column numbers.
+ * g++.dg/modules/macloc-1_d.C: Likewise.
+ * g++.dg/plugin/diagnostic-test-expressions-1.C: Adjust expected
+ caret line.
+
+2021-03-25 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94751
+ * g++.dg/cpp0x/inh-ctor37.C: New test.
+
+2021-03-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99745
+ * g++.dg/cpp0x/variadic181.C: New test.
+
+2021-03-25 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99331
+ * g++.dg/warn/Wconversion5.C: New test.
+
+2021-03-25 Stam Markianos-Wright <stam.markianos-wright@arm.com>
+
+ PR tree-optimization/96974
+ * g++.target/aarch64/sve/pr96974.C: New test.
+
+2021-03-25 H.J. Lu <hjl.tools@gmail.com>
+
+ Revert:
+ 2021-03-25 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/98209
+ PR target/99744
+ * gcc.target/i386/pr98209.c: New test.
+ * gcc.target/i386/pr99744-1.c: Likewise.
+ * gcc.target/i386/pr99744-2.c: Likewise.
+
+2021-03-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99565
+ * g++.dg/warn/Wduplicated-branches6.C: New test.
+ * g++.dg/warn/Wduplicated-branches7.C: New test.
+
+2021-03-25 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/98209
+ PR target/99744
+ * gcc.target/i386/pr98209.c: New test.
+ * gcc.target/i386/pr99744-1.c: Likewise.
+ * gcc.target/i386/pr99744-2.c: Likewise.
+
+2021-03-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99746
+ * gfortran.dg/vect/pr99746.f90: New testcase.
+
+2021-03-25 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93695
+ PR analyzer/99044
+ PR analyzer/99716
+ * gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c: Remove
+ xfail.
+ * gcc.dg/analyzer/pr93695-1.c: New test.
+ * gcc.dg/analyzer/pr99044-1.c: New test.
+ * gcc.dg/analyzer/pr99044-2.c: New test.
+ * gcc.dg/analyzer/pr99716-1.c: New test.
+ * gcc.dg/analyzer/pr99716-2.c: New test.
+ * gcc.dg/analyzer/pr99716-3.c: New test.
+
+2021-03-24 Martin Liska <mliska@suse.cz>
+
+ PR target/99753
+ * gcc.target/i386/pr99753.c: New test.
+
+2021-03-24 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/99122
+ * gcc.dg/pr99122-3.c: Remove -fno-ipa-cp from options.
+
+2021-03-24 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/99727
+ * gcc.target/arm/pr99727.c: New test.
+
+2021-03-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/99724
+ * gcc.target/arm/pr99724.c: New test.
+
+2021-03-24 Alexandre Oliva <oliva@adacore.com>
+
+ * lib/target-supports.exp (check_effective_target_sysconf): New.
+ * gcc.target/i386/pr95443-1.c: Require it.
+ * gcc.target/i386/pr95443-2.c: Likewise.
+ * gcc.target/i386/sse2-mmx-maskmovq.c: Likewise.
+ * gcc.target/i386/strncmp-1.c: Likewise.
+
+2021-03-24 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.target/i386/pr97313.c: Require effective target feature pie.
+ * g++.target/i386/pr94185.C: Likewise.
+
+2021-03-24 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.target/i386/funcspec-2.c: Tighten regexps to avoid false
+ positives with -mcmodel=large.
+ * gcc.target/i386/funcspec-3.c: Likewise.
+
+2021-03-24 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.target/i386/pr94467-3.c: New.
+
+2021-03-24 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/99369
+ * gfortran.dg/longnames.f90: New test.
+
+2021-03-23 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99283
+ * g++.dg/modules/pr99283-1_a.H: New.
+ * g++.dg/modules/pr99283-1_b.H: New.
+
+2021-03-23 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * gcc.target/s390/vector/long-double-asm-abi.c: New test.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * lib/target-supports.exp
+ (check_effective_target_arm_dsp_ok_nocache)
+ (check_effective_target_arm_dsp_ok, add_options_for_arm_dsp): New.
+ * gcc.target/arm/acle/dsp_arith.c: Use arm_dsp_ok effective target
+ and add arm_dsp options.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * lib/target-supports.exp
+ (check_effective_target_arm_v8_1m_mve_fp_ok_nocache): Fix
+ -mfloat-abi= options order.
+ (check_effective_target_arm_v8_1m_mve_ok_nocache): Likewise
+ * gcc.target/arm/mve/intrinsics/mve_vector_float2.c: Add
+ arm_hard_ok effective target and -mfloat-abi=hard additional
+ option.
+ * gcc.target/arm/mve/intrinsics/mve_vector_int.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/mve_vector_uint.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/mve_vector_uint1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/mve_vector_uint2.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c: Likewise.
+ * gcc.target/arm/armv8_1m-fp16-move-1.c: Add -mfloat-abi=hard
+ additional option.
+ * gcc.target/arm/armv8_1m-fp32-move-1.c: Likewise.
+ * gcc.target/arm/armv8_1m-fp64-move-1.c: Likewise.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * lib/target-supports.exp
+ (check_effective_target_arm_v8_2a_i8mm_ok_nocache): Fix
+ -mfloat-abi= options order.
+ (check_effective_target_arm_v8_2a_bf16_neon_ok_nocache): Likewise.
+ * gcc.target/arm/bfloat16_scalar_1_1.c: Add arm_hard_ok effective
+ target and -mfloat-abi=hard additional option.
+ * gcc.target/arm/bfloat16_simd_1_1.c: Likewise.
+ * gcc.target/arm/simd/bf16_ma_1.c: Likewise.
+ * gcc.target/arm/simd/bf16_mmla_1.c: Likewise.
+ * gcc.target/arm/simd/vdot-2-1.c: Likewise.
+ * gcc.target/arm/simd/vdot-2-2.c: Likewise.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/armv8_2-fp16-scalar-2.c: Add arm_hard_ok.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/bfloat16_simd_1_2.c: Add arm_softfp_ok.
+ * gcc.target/arm/bfloat16_simd_2_2.c: Likewise.
+ * gcc.target/arm/bfloat16_simd_3_2.c: Likewise.
+ * gcc.target/arm/pr51968.c: Likewise.
+ * gcc.target/arm/bfloat16_simd_2_1.c: arm_hard_ok.
+ * gcc.target/arm/bfloat16_simd_3_1.c: Likewise.
+ * gcc.target/arm/simd/bf16_vldn_1.c: Likewise.
+ * gcc.target/arm/simd/bf16_vstn_1.c: Likewise.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/armv8_1m-shift-imm-1.c: Remove -mfloat=abi option.
+ * gcc.target/arm/armv8_1m-shift-reg-1.c: Likewise.
+ * gcc.target/arm/bf16_dup.c: Likewise.
+ * gcc.target/arm/bf16_reinterpret.c: Likewise.
+ * gcc.target/arm/pr51534.c: Remove -mfloat=abi option.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/simd/vmmla_1.c: Add arm_v8_2a_i8mm options.
+
+2021-03-23 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/bfloat16_scalar_typecheck.c: Add
+ arm_v8_2a_fp16_neon and arm_v8_2a_bf16_neon.
+ * gcc.target/arm/bfloat16_vector_typecheck_1.c: Likewise.
+ * gcc.target/arm/bfloat16_vector_typecheck_2.c: Likewise.
+
+2021-03-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99318
+ * g++.dg/cpp0x/attributes-namespace6.C: New test.
+ * g++.dg/cpp0x/gen-attrs-73.C: New test.
+
+2021-03-23 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/93660
+ * gfortran.dg/gomp/declare-simd-coarray-lib.f90: New test.
+
+2021-03-23 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/99540
+ * gcc.dg/vect/pr99540.c: New test.
+
+2021-03-23 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99239
+ * g++.dg/modules/pr99239_a.H: New.
+ * g++.dg/modules/pr99239_b.H: New.
+
+2021-03-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99721
+ * gfortran.dg/vect/pr99721.f90: New testcase.
+
+2021-03-23 Marcus Comstedt <marcus@mc.pp.se>
+
+ * gcc.target/riscv/shift-shift-5.c (sub): Change
+ order of struct fields depending on byteorder.
+
+2021-03-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99650
+ * g++.dg/cpp1z/decomp55.C: New test.
+
+2021-03-23 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/99296
+ * gcc.dg/pr99296.c: New file.
+
+2021-03-22 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99480
+ * g++.dg/modules/pr99480_a.H: New.
+ * g++.dg/modules/pr99480_b.H: New.
+
+2021-03-22 Vladimir N. Makarov <vmakarov@redhat.com>
+
+ PR target/99581
+ * gcc.target/powerpc/pr99581.c: New.
+
+2021-03-22 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99425
+ * g++.dg/modules/pr99425-1.h: New.
+ * g++.dg/modules/pr99425-1_a.H: New.
+ * g++.dg/modules/pr99425-1_b.H: New.
+ * g++.dg/modules/pr99425-1_c.C: New.
+ * g++.dg/modules/pr99425-2_a.X: New.
+ * g++.dg/modules/pr99425-2_b.X: New.
+ * g++.dg/template/pr99425.C: New.
+
+2021-03-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/99694
+ * gcc.dg/torture/pr99694.c: New testcase.
+
+2021-03-22 Kito Cheng <kito.cheng@sifive.com>
+
+ PR target/99702
+ * gcc.target/riscv/pr99702.c: New.
+
+2021-03-22 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ PR target/98914
+ * gcc.target/powerpc/pr98914.c: New test.
+
+2021-03-20 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/99679
+ * g++.target/i386/pr99679-1.C: New test.
+ * g++.target/i386/pr99679-2.C: Likewise.
+
+2021-03-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/99230
+ * gcc.dg/pr99230.c: New test.
+
+2021-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/99588
+ * gcc.dg/Wunused-var-5.c: New test.
+ * gcc.dg/Wunused-var-6.c: New test.
+
+2021-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ * gfortran.dg/inline_matmul_6.f90: Adjust count for
+ _gfortran_matmul.
+
+2021-03-19 Vladimir N. Makarov <vmakarov@redhat.com>
+
+ PR target/99663
+ * gcc.target/s390/pr99663.c: New.
+
+2021-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/99456
+ * g++.dg/opt/pr99456.C: New test.
+ * g++.dg/ext/vla22.C: Expect a -Wnarrowing warning for c++11 and
+ later.
+
+2021-03-19 Tamar Christina <tamar.christina@arm.com>
+
+ PR tree-optimization/99656
+ * gfortran.dg/vect/pr99656.f90: New test.
+
+2021-03-19 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/99652
+ * gcc.dg/torture/pr99652-1.c: New test.
+ * gcc.dg/torture/pr99652-2.c: Likewise.
+ * gcc.target/i386/pr57655.c: Adjusted.
+ * gcc.target/i386/pr59794-6.c: Likewise.
+ * gcc.target/i386/pr70738-1.c: Likewise.
+ * gcc.target/i386/pr96744-1.c: Likewise.
+
+2021-03-19 Jakub Jelinek <jakub@redhat.com>
+ Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/99593
+ * g++.target/arm/pr99593.C: New test.
+
+2021-03-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/lto/pr89335_0.C: Require the linker plugin.
+
+2021-03-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99500
+ * g++.dg/cpp2a/concepts-err3.C: New test.
+
+2021-03-18 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/99502
+ * g++.dg/warn/Warray-bounds-22.C: New test.
+ * g++.dg/warn/Warray-bounds-23.C: New test.
+ * g++.dg/warn/Warray-bounds-24.C: New test.
+
+2021-03-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/99636
+ * gcc.dg/strlenopt-80.c: For powerpc*-*-*, only enable for lp64.
+
+2021-03-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/99626
+ * gcc.dg/strlenopt-73.c: Ifdef out test_copy_cond_unequal_length_i64
+ on targets other than x86, aarch64, s390 and 64-bit powerpc. Use
+ test_copy_cond_unequal_length_i128 for __x86_64__ with int128 support
+ rather than __i386__.
+
+2021-03-18 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR testsuite/97680
+ * c-c++-common/zero-scratch-regs-10.c: Skip on arm
+
+2021-03-18 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR objc++/49070
+ * obj-c++.dg/pr49070.mm: New test.
+ * objc.dg/unnamed-parms.m: New test.
+
+2021-03-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * g++.target/aarch64/sve/aarch64-sve.exp: Add -moverride=tune=none to
+ sve_flags.
+ * g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise.
+ * g++.target/aarch64/sve/acle/aarch64-sve-acle.exp: Likewise.
+ * gcc.target/aarch64/sve/aarch64-sve.exp: Likewise.
+ * gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise.
+ * gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp: Likewise.
+
+2021-03-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/98099
+ * gcc.dg/pr98099.c: Don't compile the test on pdp endian.
+ For big endian use -fsso-struct=little-endian dg-options.
+
+2021-03-17 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97973
+ * g++.dg/conversion/real-to-int1.C: New test.
+
+2021-03-17 Anthony Sharp <anthonysharp15@gmail.com>
+ Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp1z/using9.C: New using decl test.
+
+2021-03-17 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-c++-common/asan/strncpy-overflow-1.c: Add _FORTIFY_SOURCE=0 and
+ -gdwarf-3 to the command line options. Adjust the expected line
+ numbers for the revised options header.
+
+2021-03-17 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-c++-common/asan/memcmp-1.c: Add _FORTIFY_SOURCE=0 and
+ -gdwarf-3 to the command line options. Provide Darwin-
+ specific match lines for the expected output.
+
+2021-03-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/aarch64/acle/rng_2.c: New test.
+
+2021-03-17 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/99504
+ * gcc.target/i386/pr99530-1.c: New test.
+ * gcc.target/i386/pr99530-2.c: Likewise.
+ * gcc.target/i386/pr99530-3.c: Likewise.
+ * gcc.target/i386/pr99530-4.c: Likewise.
+ * gcc.target/i386/pr99530-5.c: Likewise.
+ * gcc.target/i386/pr99530-6.c: Likewise.
+
2021-03-16 Christophe Lyon <christophe.lyon@linaro.org>
PR target/99542
diff --git a/gcc/testsuite/brig.dg/README b/gcc/testsuite/brig.dg/README
deleted file mode 100644
index 2ad5b24..0000000
--- a/gcc/testsuite/brig.dg/README
+++ /dev/null
@@ -1,12 +0,0 @@
-BRIG (HSAIL) frontend test cases
---------------------------------
-
-The suite consists of "smoke tests" that test several features of
-the compilation and regression tests, but is not an exhaustive test
-suite for all HSAIL instructions. The HSA PRM conformance suite
-is supposed to be used for that.
-
-HSAILasm is required for converting the text HSAIL files to BRIGs
-which the compiler consumes. It can be built from
-https://github.com/HSAFoundation/HSAIL-Tools
-
diff --git a/gcc/testsuite/brig.dg/test/gimple/alloca.hsail b/gcc/testsuite/brig.dg/test/gimple/alloca.hsail
deleted file mode 100644
index 479ab72..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/alloca.hsail
+++ /dev/null
@@ -1,37 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Tests for alloca. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple" } */
-
-prog function &subfunction(arg_u32 %return_value)() {
- alloca_align(1)_u32 $s2, 256;
- st_arg_u32 $s2, [%return_value];
- ret;
-};
-
-prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u32 $s0, [$d0];
-
- alloca_align(256)_u32 $s1, 16;
- {
- arg_u32 %return_value;
- call &subfunction(%return_value)();
- ld_arg_u32 $s1, [%return_value];
- }
- ld_kernarg_u64 $d1, [%output_ptr];
- st_global_u32 $s1, [$d0];
-};
-
-/* { dg-final { scan-tree-dump "s2 = __builtin___hsail_alloca \\\(256, 1, __context\\\);" "gimple" } } */
-
-/* { dg-final { scan-tree-dump "s1 = __builtin___hsail_alloca \\\(16, 256, __context\\\);" "gimple" } } */
-
-
-/* Both functions should have an alloca frame push and pop. */
-/* { dg-final { scan-tree-dump-times "__builtin___hsail_alloca_push_frame \\\(__context\\\);" 2 "gimple" } } */
-
-/* { dg-final { scan-tree-dump-times "__builtin___hsail_alloca_pop_frame \\\(__context\\\);" 2 "gimple" } } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/atomics.hsail b/gcc/testsuite/brig.dg/test/gimple/atomics.hsail
deleted file mode 100644
index b877a66..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/atomics.hsail
+++ /dev/null
@@ -1,33 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Test for atomic instructions. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-original" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
-
- atomic_ld_global_rlx_system_b32 $s0, [$d0];
- atomic_add_global_rlx_system_u32 $s1, [$d0 + 4], $s0;
-
- ld_kernarg_u64 $d0, [%output_ptr];
- atomicnoret_st_global_rlx_system_b32 [$d0], $s2;
-
- atomicnoret_min_global_rlx_system_u32 [$d0 + 4], $s1;
-
- ret;
-};
-
-/* The atomic loads are implemented by casting to an atomic pointer. */
-/* { dg-final { scan-tree-dump "s0 = VIEW_CONVERT_EXPR<unsigned int>\\\(\\\*\\\(atomic unsigned int \\\*\\\)" "original"} } */
-
-/* The atomic add should call a gcc builtin. */
-/* { dg-final { scan-tree-dump "= __sync_fetch_and_add_4 \\\(" "original"} } */
-
-/* The atomic stores are implemented by casting to an atomic pointer. */
-/* { dg-final { scan-tree-dump "\\\*\\\(atomic unsigned int \\\*\\\) d0 = s2;" "original"} } */
-
-/* The atomic min is implemented by a custom builtin. */
-/* { dg-final { scan-tree-dump "builtin_out.\[0-9\]+ = __builtin___hsail_atomic_min_u32 \\\(" "original"} } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/branches.hsail b/gcc/testsuite/brig.dg/test/gimple/branches.hsail
deleted file mode 100644
index 081fde3..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/branches.hsail
+++ /dev/null
@@ -1,58 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Test different style of branches. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u64 $d1, [$d0];
- ld_global_u64 $d2, [$d0 + 8];
-
- ld_global_u32 $s0, [$d0 + 16];
- ld_global_u32 $s1, [$d0 + 20];
-
- sbr_width(all)_u32 $s1 [@case0, @case1, @case2];
-@case0:
- st_global_u64 0, [$d0];
- br @out;
-@case1:
- st_global_u64 1, [$d0];
- br @out;
-@case2:
- st_global_u64 2, [$d0];
-@out:
- cmp_eq_u32_u32 $s2, $s1, $s0;
- cvt_b1_u32 $c0, $s2;
-
- cbr_width(all)_b1 $c0, @true_branch;
-@false_branch:
- st_global_u64 $d1, [$d0];
-
-@true_branch:
- ld_kernarg_u64 $d0, [%output_ptr];
-
- st_global_u32 $s2, [$d0 + 8];
- br @skip;
- st_global_u32 $s3, [$d0 + 12];
-
-@skip:
- ret;
-};
-
-/* sbr is converted to a switch */
-/* { dg-final { scan-tree-dump "switch \\\(s1\\\) <default: <D.\[0-9\]+>, case 0: <D.\[0-9\]+>, case 1: <D.\[0-9\]+>, case 2: <D.\[0-9\]+>>" "gimple"} } */
-
-/* br @out converted to gotos */
-/* { dg-final { scan-tree-dump-times "goto @out" 2 "gimple"} } */
-
-/* the comparison instruction */
-/* { dg-final { scan-tree-dump "c0 = s2 != 0;" "gimple" } } */
-
-/* cbr to an if clause */
-/* { dg-final { scan-tree-dump "if \\\(c0 != 0\\\) goto @true_branch; else goto <D.\[0-9\]+>;" "gimple" } } */
-
-/* br @skip converted to a goto */
-/* { dg-final { scan-tree-dump "goto @skip" "gimple"} } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail b/gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail
deleted file mode 100644
index 9efe027..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail
+++ /dev/null
@@ -1,74 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Tests for fbarrier. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple" } */
-
-fbarrier &fb_module_scope;
-
-prog function &subfunction(arg_u32 %return_value)() {
-
- workitemflatabsid_u32 $s3;
- cvt_b1_u32 $c1, $s3;
- cbr_width(all)_b1 $c1, @skip_fbar;
- waitfbar &fb_module_scope;
-@skip_fbar:
-
- st_arg_u32 $s3, [%return_value];
- ret;
-};
-
-prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- fbarrier %fb_func_scope;
-
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u32 $s0, [$d0];
-
- workitemflatabsid_u32 $s1;
- cvt_b1_u32 $c1, $s1;
- cbr_width(all)_b1 $c1, @skip_init;
-
- initfbar &fb_module_scope;
- initfbar %fb_func_scope;
-
- joinfbar &fb_module_scope;
-
-@skip_init:
- barrier_width(all);
-
- joinfbar %fb_func_scope;
-
- {
- arg_u32 %return_value;
- call &subfunction(%return_value)();
- ld_arg_u32 $s1, [%return_value];
- }
- arrivefbar %fb_func_scope;
-
- ld_kernarg_u64 $d1, [%output_ptr];
- st_global_u32 $s1, [$d0];
-
- workitemflatabsid_u32 $s1;
- cvt_b1_u32 $c0, $s1;
- cbr_width(all)_b1 $c0, @skip_fini;
-
- releasefbar &fb_module_scope;
- releasefbar %fb_func_scope;
-
-@skip_fini:
-
-};
-/* fbarriers are allocated from the group memory in the order of
- appearance. The current implementation allocates 32B per fbarrier. */
-
-/* { dg-final { scan-tree-dump "__hsail_waitfbar \\\(0, __context\\\);" "gimple"} } */
-/* { dg-final { scan-tree-dump "__hsail_initfbar \\\(0, __context\\\);" "gimple"} } */
-/* { dg-final { scan-tree-dump "__hsail_initfbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
-/* { dg-final { scan-tree-dump "__hsail_joinfbar \\\(0, __context\\\);" "gimple"} } */
-/* { dg-final { scan-tree-dump "@skip_init:\[\n ]+__builtin___hsail_barrier \\\(__context\\\);\[\n ]+__builtin___hsail_joinfbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
-
-/* { dg-final { scan-tree-dump "__hsail_arrivefbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
-
-/* { dg-final { scan-tree-dump "__hsail_releasefbar \\\(0, __context\\\);\[\n ]+__builtin___hsail_releasefbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/function_calls.hsail b/gcc/testsuite/brig.dg/test/gimple/function_calls.hsail
deleted file mode 100644
index 50f7906..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/function_calls.hsail
+++ /dev/null
@@ -1,59 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Function calls and argument passing. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple" } */
-
-prog function &subfunction(arg_u32 %return_value)(arg_f32 %float_arg, arg_f64 %double_arg, arg_f16 %half_arg) {
- ld_arg_f32 $s0, [%float_arg];
- cvt_u32_f32 $s0, $s0;
-
- ld_arg_f64 $d0, [%double_arg];
- cvt_u32_f64 $s1, $d0;
-
- ld_arg_f16 $s2, [%half_arg];
- cvt_u32_f16 $s2, $s2;
-
- add_u32 $s3, $s0, $s1;
- add_u32 $s3, $s3, $s2;
-
- st_arg_u32 $s3, [%return_value];
- ret;
-};
-
-prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u32 $s0, [$d0];
- {
- arg_f32 %float_arg;
- arg_f64 %double_arg;
- arg_f16 %half_arg;
- arg_u32 %return_value;
-
- st_arg_f32 12.0f, [%float_arg];
- st_arg_f64 640.0d, [%double_arg];
- st_arg_f16 12.0h, [%half_arg];
-
- call &subfunction(%return_value)(%float_arg, %double_arg, %half_arg);
-
- ld_arg_u32 $s1, [%return_value];
- }
- ld_kernarg_u64 $d1, [%output_ptr];
- st_global_u32 $s1, [$d0];
-};
-
-/* The generated function call should have the incoming arguments and three hidden arguments. */
-
-/* { dg-final { scan-tree-dump "_\[0-9\]+ = subfunction \\\(_kernel.float_arg.\[_0-9\]+, _kernel.double_arg.\[_0-9\]+, _kernel.half_arg.\[_0-9\]+, __context, __group_base_addr, group_local_offset.*, __private_base_addr\\\);" "gimple"} } */
-
-/* The callee should refer directly to the scalar arguments when it reads them. */
-/* { dg-final { scan-tree-dump "= float_arg;" "gimple"} } */
-/* { dg-final { scan-tree-dump "= double_arg;" "gimple"} } */
-/* { dg-final { scan-tree-dump "= half_arg;" "gimple"} } */
-
-/* The return value is stored to a temporary before returned. */
-/* { dg-final { scan-tree-dump "_retvalue_temp = s3;" "gimple"} } */
-/* { dg-final { scan-tree-dump "D.\[0-9\]+ = _retvalue_temp;" "gimple"} } */
-/* { dg-final { scan-tree-dump "return D.\[0-9\]+;" "gimple"} } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail b/gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail
deleted file mode 100644
index 52673c9..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail
+++ /dev/null
@@ -1,146 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Test for casting from/to representation of HSA registers. */
-
-/* HSA registers are untyped but in gccbrig they are presented as */
-/* variables with a type selected by analysis. Currently, each */
-/* register variable, per function, has a type as it is used at */
-/* most. Therefore, register variable can be nearly any type. The */
-/* tests makes sure the generic/tree expressions have the right casts */
-/* from/to the register variables. */
-
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-original" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- private_u64 %foo;
- private_u64 %bar;
- private_b128 %baz;
-
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u32 $s0, [$d0];
-
- /* Trick gccbrig to set wanted type for the registers. */
-
-/* $s0 is selected as float... */
-/* { dg-final { scan-tree-dump "<float:32> s0;" "original"} } */
-/* ..., therefore, there should not be any casts. */
-/* { dg-final { scan-tree-dump "s10 = s0 \\\+ s0;" "original"} } */
-
- add_f32 $s10, $s0, $s0;
- add_f32 $s10, $s0, $s0;
- add_f32 $s10, $s0, $s0;
- add_f32 $s10, $s0, $s0;
- add_f32 $s10, $s0, $s0;
-
-/* Expression with other type, a cast is needed. */
-/* { dg-final { scan-tree-dump "s1 = VIEW_CONVERT_EXPR<unsigned int>.s0. \\\+ 123;" "original"} } */
-
- add_u32 $s1, $s0, 123;
-
-/* { dg-final { scan-tree-dump "unsigned int s1;" "original"} } */
-
- add_u32 $s10, $s1, 0;
- add_u32 $s10, $s1, 0;
- add_u32 $s10, $s1, 0;
- add_u32 $s10, $s1, 0;
- add_u32 $s10, $s1, 0;
-
-/* { dg-final { scan-tree-dump "s0 = VIEW_CONVERT_EXPR<<float:32>>.s1.;" "original"} } */
-
- mov_b32 $s0, $s1;
-
-/* Rig the election for $d0 to be double. */
-/* { dg-final { scan-tree-dump "<float:64> d0;" "original"} } */
-/* { dg-final { scan-tree-dump "d10 = d0 \\\+ d0;" "original"} } */
-
- add_f64 $d10, $d0, $d0;
- add_f64 $d10, $d0, $d0;
- add_f64 $d10, $d0, $d0;
- add_f64 $d10, $d0, $d0;
- add_f64 $d10, $d0, $d0;
-
-/* Make $s2 to be vector type. */
-/* { dg-final { scan-tree-dump "vector.4. unsigned char s2;" "original"} } */
-/* { dg-final { scan-tree-dump "s2 = VIEW_CONVERT_EXPR<vector.4. unsigned char>\\\(s1\\\) \\\+ VIEW_CONVERT_EXPR<vector.4. unsigned char>\\\(s1\\\);" "original"} } */
-
- add_pp_u8x4 $s2, $s1, $s1;
-
-/* { dg-final { scan-tree-dump "s20 = s2 \\\+ s2;" "original"} } */
-
- add_pp_u8x4 $s20, $s2, $s2;
- add_pp_u8x4 $s20, $s2, $s2;
- add_pp_u8x4 $s20, $s2, $s2;
- add_pp_u8x4 $s20, $s2, $s2;
-
-/* { dg-final { scan-tree-dump "d0 = VIEW_CONVERT_EXPR<<float:64>>.{VIEW_CONVERT_EXPR<unsigned int>.s0., VIEW_CONVERT_EXPR<unsigned int>.s2.}.;" "original"} } */
-
- combine_v2_b64_b32 $d0, ($s0, $s2);
-
-/* { dg-final { scan-tree-dump "s2 = VIEW_CONVERT_EXPR<vector.4. unsigned char>.BIT_FIELD_REF <d0, 32, 0>.;" "original"} } */
-/* { dg-final { scan-tree-dump "s1 = BIT_FIELD_REF <d0, 32, 32>;" "original"} } */
-
- expand_v2_b32_b64 ($s2, $s1), $d0;
-
-/* { dg-final { scan-tree-dump "s0 = VIEW_CONVERT_EXPR<<float:32>>\\\(.*VIEW_CONVERT_EXPR<unsigned int>.s0\[\)\]*;" "original"} } */
-
- cvt_s16_s8 $s0, $s0;
-
-/* { dg-final { scan-tree-dump "c0 = .*VIEW_CONVERT_EXPR<<float:32>>.s2..* != 0;" "original"} } */
-
- cvt_b1_f32 $c0, $s2;
-
-/* { dg-final { scan-tree-dump ".*__private_base_addr.* = .*\\\(unsigned char\\\) VIEW_CONVERT_EXPR<unsigned int>\\\(s0\\\)\[\)\]*;" "original"} } */
-
- st_private_u8 $s0, [%foo];
-
-/* { dg-final { scan-tree-dump ".*__private_base_addr.* = .*\\\(unsigned short\\\) VIEW_CONVERT_EXPR<unsigned int>\\\(s2\\\)\[\)\]*;" "original"} } */
-
- st_private_u16 $s2, [%bar];
-
-/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed char \\\*\\\) \\\(__private_base_addr .*\\\);\[ \n\]*s2 = VIEW_CONVERT_EXPR<vector.4. unsigned char>\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */
-
- ld_private_s8 $s2, [%foo];
-
-/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr .*\\\);\[ \n\]*s0 = VIEW_CONVERT_EXPR<<float:32>>\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */
-
- ld_private_s16 $s0, [%bar];
-
-/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 0 = s0;" "original"} } */
-/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 4 = VIEW_CONVERT_EXPR<<float:32>>\\\(s1\\\);" "original"} } */
-/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 8 = VIEW_CONVERT_EXPR<<float:32>>\\\(s2\\\);" "original"} } */
-
- st_v3_private_f32 ($s0, $s1, $s2), [%baz];
-
-/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 0;\[ \n\]*s0 = VIEW_CONVERT_EXPR<<float:32>>\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */
-/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 2;\[ \n\]*s1 = VIEW_CONVERT_EXPR<unsigned int>\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */
-/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 4;\[ \n\]*s2 = VIEW_CONVERT_EXPR<vector.4. unsigned char>\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */
-
- ld_v3_private_s16 ($s0, $s1, $s2), [%baz];
-
-/* { dg-final { scan-tree-dump "s5 = .*VIEW_CONVERT_EXPR<unsigned int>\\\(s0\\\) == VIEW_CONVERT_EXPR<unsigned int>\\\(s2\\\)\\\) .*;" "original"} } */
-
- cmp_eq_s32_u32 $s5, $s0, $s2;
-
-/* { dg-final { scan-tree-dump "s6 = VIEW_CONVERT_EXPR<<float:32>>\\\(.*VIEW_CONVERT_EXPR<vector\\\(2\\\) unsigned short>\\\(s0\\\).*VIEW_CONVERT_EXPR<vector\\\(2\\\) unsigned short>\\\(s2\\\).*;" "original"} } */
-
- cmp_eq_pp_u16x2_u16x2 $s6, $s0, $s2;
-
-/* { dg-final { scan-tree-dump "<float:32> s60;" "original"} } */
-
- add_f32 $s60, $s6, $s6;
- add_f32 $s60, $s6, $s6;
- add_f32 $s60, $s6, $s6;
- add_f32 $s60, $s6, $s6;
-
- ld_kernarg_u64 $d0, [%output_ptr];
- st_global_u32 $s0, [$d0];
-
- ret;
-};
-
-
-
-
diff --git a/gcc/testsuite/brig.dg/test/gimple/kernarg.hsail b/gcc/testsuite/brig.dg/test/gimple/kernarg.hsail
deleted file mode 100644
index 7f30919..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/kernarg.hsail
+++ /dev/null
@@ -1,25 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Tests for kernarg addressing modes. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-original" } */
-
-prog kernel &Kernel(kernarg_u64 %input[4], kernarg_u64 %output_ptr, kernarg_u64 %i)
-{
- ld_kernarg_u64 $d0, [%i];
- ld_kernarg_u64 $d0, [%input][$d0 + 1];
-
- ld_kernarg_u64 $d1, [%output_ptr];
- st_global_u64 $d0, [$d1];
-
- ret;
-};
-
-/* [%i] */
-/* { dg-final { scan-tree-dump " = \\\*\\\(unsigned long \\\*\\\) \\\(__args \\\+ 40\\\);" "original"} } */
-
-/* [%input][$d0 + 1] */
-/* { dg-final { scan-tree-dump "\\\*\\\(unsigned long \\\*\\\) \\\(\\\(VIEW_CONVERT_EXPR<void \\\*>\\\(\\\(unsigned long\\\) __args\\\) \\\+ \\\(unsigned long\\\) d0\\\) \\\+ 1\\\);" "original"} } */
-
-
diff --git a/gcc/testsuite/brig.dg/test/gimple/mem.hsail b/gcc/testsuite/brig.dg/test/gimple/mem.hsail
deleted file mode 100644
index 75835a1..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/mem.hsail
+++ /dev/null
@@ -1,39 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Tests for load/store addressing modes. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-original" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %input_ptr2, kernarg_u64 %output_ptr)
-{
- global_u32 %global_array[4];
-
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_kernarg_u64 $d2, [%input_ptr2];
- ld_global_u32 $s0, [$d0];
- ld_global_u64 $d1, [$d2 + 4];
-
- ld_global_u32 $s2, [%global_array][$d1 + 4];
-
- ld_kernarg_u64 $d0, [%output_ptr];
- st_global_u32 $s0, [$d0];
- st_global_u32 $s1, [$d0 + 4];
- st_global_u32 $s2, [$d0 + 8];
-
- ret;
-};
-
-/* %input_ptr, %input_ptr2 and %output_ptr accesses should generate offsets to the __args array */
-/* { dg-final { scan-tree-dump "__args;\[\n \]+d0 =" "original"} } */
-/* { dg-final { scan-tree-dump "\\\(__args \\\+ 8\\\);\[\n \]+d2 =" "original"} } */
-/* { dg-final { scan-tree-dump "\\\(__args \\\+ 16\\\);\[\n \]+d0 =" "original"} } */
-
-/* ld_global_u32 $s0, [$d0] */
-/* { dg-final { scan-tree-dump "\\\*\\\(unsigned int \\\*\\\) d0;\[\n \]+s0 =" "original"} } */
-
-/* ld_global_u64 $d1, [$d2 + 4] pointer arithmetics*/
-/* { dg-final { scan-tree-dump "d2 \\\+ 4\\\);\[\n \]+d1 = " "original"} } */
-
-/* ld_global_u32 $s2, [%global_array][$d1 + 4]; is the most complex form */
-/* { dg-final { scan-tree-dump "\\\(unsigned long\\\) &_Kernel.global_array\\\) \\\+ \\\(unsigned long\\\) d1\\\) \\\+ 4" "original" } } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/mulhi.hsail b/gcc/testsuite/brig.dg/test/gimple/mulhi.hsail
deleted file mode 100644
index acdced9..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/mulhi.hsail
+++ /dev/null
@@ -1,33 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Test high part multiplies. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u64 $d1, [$d0];
- ld_global_u64 $d2, [$d0 + 8];
-
- ld_global_u32 $s0, [$d0 + 16];
- ld_global_u32 $s1, [$d0 + 20];
-
- mulhi_s32 $s2, $s0, $s1;
- mulhi_s64 $d2, $d1, $d2;
-
- mad24hi_s32 $s3, $s0, $s1, $s2;
- mul24hi_s32 $s3, $s3, $s1;
-
- ld_kernarg_u64 $d0, [%output_ptr];
- st_global_u64 $d1, [$d0];
- st_global_u32 $s2, [$d0 + 8];
- st_global_u32 $s3, [$d0 + 12];
-
- ret;
-};
-
-/* All of the hipart mults areImplemented using MULT_HIGHPART_EXPR (h*). */
-/* { dg-final { scan-tree-dump-times " h\\\* " 4 "gimple"} } */
-
diff --git a/gcc/testsuite/brig.dg/test/gimple/packed.hsail b/gcc/testsuite/brig.dg/test/gimple/packed.hsail
deleted file mode 100644
index 1e2bb53..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/packed.hsail
+++ /dev/null
@@ -1,76 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Test for different cases of packed instruction controls. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple -fdump-tree-original" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_b128 $q0, [$d0];
-
- add_pp_u8x16 $q1, $q0, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
-
- /* Broadcast the 15 as it's the lowest element (pos 0) in the resulting vector. */
- add_ps_u8x16 $q2, $q1, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
-
- /* Broadcast the lowest element of q1. */
- add_sp_u8x16 $q3, $q1, $q2;
-
- /* Perform a scalar computation with the lowest element of both inputs and store it to the lowest element of dest. */
- add_ss_u8x16 $q4, $q2, $q3;
-
- /* Saturating arithmetics variations. */
- add_pp_sat_u8x16 $q5, $q4, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
-
- /* Broadcast the 15 as it's the lowest element (pos 0) in the resulting vector. */
- add_ps_sat_u8x16 $q6, $q5, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
-
- /* Broadcast the lowest element of q1. */
- add_sp_sat_u8x16 $q7, $q6, $q5;
-
- /* Perform a scalar computation with the lowest element of both inputs and store it to the lowest element of dest. */
- add_ss_sat_u8x16 $q8, $q7, $q6;
-
- /* Single operand vector computation. */
- neg_p_s16x8 $q9, $q8;
-
- ld_kernarg_u64 $d0, [%output_ptr];
- st_global_b128 $q8, [$d0];
-
- ret;
-};
-
-/* The b128 load is done using uint128_t*. */
-/* { dg-final { scan-tree-dump "q0 = VIEW_CONVERT_EXPR<uint128_t>\\\(mem_read.\[0-9\]+\\\);" "original"} } */
-
-/* Before arithmetics, the uint128_t is casted to a vector datatype. */
-/* { dg-final { scan-tree-dump "<vector\\\(16\\\) unsigned char>\\\(q0\\\) \\\+ \\\{" "original"} } */
-
-/* The u8x16 constant is generated to an array with elements in reverse order */
-/* in comparison to the HSAIL syntax. */
-/* { dg-final { scan-tree-dump "\\\+ { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }" "original"} } */
-
-/* Broadcasted the constant vector's lowest element and summed it up in the next line. */
-/* { dg-final { scan-tree-dump "= { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 };\[\n \]+\[a-z0-9_\]+ = \[a-z0-9_\]+ \\\+ \[a-z0-9_\]+;" "gimple"} } */
-
-/* Broadcasted the registers lowest element via a VEC_PERM_EXPR that has an all-zeros mask. */
-/* { dg-final { scan-tree-dump "VEC_PERM_EXPR <\[a-z0-9_\]+, \[a-z0-9_\]+, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }>;" "gimple" } } */
-
-/* For the add_ss we assume performing the computation over the whole vector is cheaper than */
-/* extracting the scalar and performing a scalar operation. This aims to stay in the vector
-/* datapath as long as possible. */
-/* { dg-final { scan-tree-dump "new_output.\[0-9\]+ = q2 \\\+ q3;" "gimple" } } */
-
-/* Insert the lowest element of the result to the lowest element of the result register. */
-/* { dg-final { scan-tree-dump "= VEC_PERM_EXPR <new_output.\[0-9\]+, \[a-z0-9_\]+, { 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }>;" "gimple" } } */
-
-/* FIXME */
-/* { dg-final { scan-tree-dump "q4 = \(VIEW_CONVERT_EXPR<uint128_t>\\\()?s_output.\[0-9\]+\(_\[0-9\]+\)*\\\)?;" "gimple" } } */
-
-/* The saturating arithmetics are (curently) implemented using scalar builtin calls. */
-/* { dg-final { scan-tree-dump-times "= __builtin___hsail_sat_add_u8" 64 "gimple" } } */
-
-/* A single operand vector instr (neg.) */
-/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<vector\\\(8\\\) signed short>\\\(\(s_output.\[0-9\]+_\[0-9\]+|q8\)\\\);\[\n \]+q9 = -_\[0-9\]+;\[\n \]+" "gimple" } } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail b/gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail
deleted file mode 100644
index b20704b..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail
+++ /dev/null
@@ -1,87 +0,0 @@
-module &__llvm_hsail_module:1:0:$full:$large:$near;
-
-/* Regression test for a private array access case which used to assert. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple" } */
-
-decl prog function &vec_sum()(
- arg_u32 %a,
- arg_u32 %b,
- arg_u32 %res,
- arg_u32 %N);
-
-prog function &vec_sum()(
- arg_u32 %a,
- arg_u32 %b,
- arg_u32 %res,
- arg_u32 %N)
-{
-
- ld_arg_align(4)_u32 $s0, [%N];
- ld_arg_align(4)_u32 $s1, [%res];
- ld_arg_align(4)_u32 $s2, [%b];
- ld_arg_align(4)_u32 $s3, [%a];
- cmp_le_b1_s32 $c0, $s0, 0;
- cbr_b1 $c0, @BB0_2;
-@BB0_1:
- ld_private_align(4)_u32 $s4, [$s3];
- ld_private_align(4)_u32 $s5, [$s2];
- add_u32 $s4, $s5, $s4;
- st_private_align(4)_u32 $s4, [$s1];
- add_u32 $s1, $s1, 4;
- add_u32 $s2, $s2, 4;
- add_u32 $s3, $s3, 4;
- add_u32 $s0, $s0, 4294967295;
- cmp_ne_b1_s32 $c0, $s0, 0;
- cbr_b1 $c0, @BB0_1;
-@BB0_2:
- ret;
-};
-
-prog kernel &test(
- kernarg_u64 %in,
- kernarg_u64 %out)
-{
-
- align(4) private_u8 %__privateStack[1200];
- mov_b64 $d1, 0;
-/* This used to crash when gcc asserts enabled: */
- lda_private_u32 $s0, [%__privateStack][400];
- lda_private_u32 $s1, [%__privateStack];
- ld_kernarg_align(8)_width(all)_u64 $d0, [%out];
- ld_kernarg_align(8)_width(all)_u64 $d2, [%in];
-@BB1_1:
- add_u64 $d3, $d2, $d1;
- ld_global_align(4)_u32 $s2, [$d3];
- st_private_align(4)_u32 $s2, [$s0];
- st_private_align(4)_u32 $s2, [$s1];
- add_u32 $s1, $s1, 4;
- add_u32 $s0, $s0, 4;
- add_u64 $d1, $d1, 4;
- cmp_ne_b1_s64 $c0, $d1, 400;
- cbr_b1 $c0, @BB1_1;
- mov_b32 $s1, 0;
- lda_private_u32 $s0, [%__privateStack][800];
-@BB1_3:
- ld_private_align(4)_u32 $s2, [%__privateStack][$s1];
- ld_private_align(4)_u32 $s3, [%__privateStack][$s1+400];
- add_u32 $s2, $s3, $s2;
- st_private_align(4)_u32 $s2, [%__privateStack][$s1+800];
- add_u32 $s1, $s1, 4;
- cmp_ne_b1_s32 $c0, $s1, 400;
- cbr_b1 $c0, @BB1_3;
- mov_b64 $d1, 0;
-@BB1_5:
- add_u64 $d2, $d0, $d1;
- ld_private_align(4)_u32 $s1, [$s0];
- st_global_align(4)_u32 $s1, [$d2];
- add_u32 $s0, $s0, 4;
- add_u64 $d1, $d1, 4;
- cmp_ne_b1_s64 $c0, $d1, 400;
- cbr_b1 $c0, @BB1_5;
- ret;
-};
-
-/* br @skip converted to a goto */
-/* { dg-final { scan-tree-dump "= \\\(void \\\*\\\) priv_var_offset" "gimple"} } */
diff --git a/gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail b/gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail
deleted file mode 100644
index 6e23263..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail
+++ /dev/null
@@ -1,91 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* A basic smoke test. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u32 $s0, [$d0];
- ld_global_u32 $s1, [$d0 + 4];
-
- add_u32 $s2, $s0, $s1;
- add_u32 $s3, $s0, 4294967295;
-
- ld_kernarg_u64 $d0, [%output_ptr];
- st_global_u32 $s2, [$d0];
- st_global_u32 $s3, [$d0 + 4];
-
- ret;
-};
-
-prog kernel &KernelWithBarrier(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u32 $s0, [$d0];
- ld_global_u32 $s1, [$d0 + 4];
-
- add_u32 $s2, $s0, $s1;
-
- barrier_width(all);
-
- add_u32 $s3, $s0, 4294967295;
-
- ld_kernarg_u64 $d0, [%output_ptr];
- st_global_u32 $s2, [$d0];
- st_global_u32 $s3, [$d0 + 4];
-
- ret;
-};
-
-/* The kernel function itself should have a fingerprint as follows */
-/* _Kernel (const unsigned char * restrict __args, void * restrict __context, unsigned char * restrict __group_base_addr, unsigned int __group_local_offset, unsigned char * restrict __private_base_addr) */
-/* { dg-final { scan-tree-dump "_Kernel \\\(const unsigned char \\\* restrict __args, void \\\* restrict __context, unsigned char \\\* restrict __group_base_addr, unsigned int __group_local_offset, unsigned char \\\* restrict __private_base_addr\\\)" "gimple"} } */
-
-/* ld_kernarg: mem_read.0 = MEM[(unsigned long *)__args]; */
-/* { dg-final { scan-tree-dump "mem_read.\[0-9\] = MEM\\\[\\\(unsigned long \\\*\\\)__args\\\];" "gimple"} } */
-
-/* The latter ld_global_u32 should be visible as a pointer dereference (after pointer arithmetics on a temporary var): */
-/* mem_read.2 = *D.1691; */
-/* { dg-final { scan-tree-dump "mem_read.\[0-9\]+ = \\\*\[_0-9\]+;" "gimple"} } */
-
-/* add_u32s should generate +operators */
-/* { dg-final { scan-tree-dump "s2 = s0 \\\+ s1;" "gimple"} } */
-/* { dg-final { scan-tree-dump "s3 = s0 \\\+ 4294967295;" "gimple"} } */
-
-/* The latter st_global_u32 should be visible as a pointer dereference (after pointer arithmetics on a temporary var): */
-/* *D.1694 = s3; */
-/* { dg-final { scan-tree-dump "\\\*\[_0-9\]+ = s3;" "gimple"} } */
-
-/* The return inside the kernel should be generated to a goto to the end of the kernel. */
-/* goto __kernel_exit; */
-/* __kernel_exit: */
-/* { dg-final { scan-tree-dump "goto __kernel_exit;" "gimple"} } */
-/* { dg-final { scan-tree-dump "__kernel_exit:" "gimple"} } */
-
-/* Expecting a work item loop because there are no barrier calls. */
-/* { dg-final { scan-tree-dump "if \\\(__local_x < __cur_wg_size_x\\\) goto __wi_loop_x; else goto" "gimple"} } */
-/* { dg-final { scan-tree-dump "if \\\(__local_y < __cur_wg_size_y\\\) goto __wi_loop_y; else goto" "gimple"} } */
-/* { dg-final { scan-tree-dump "if \\\(__local_z < __cur_wg_size_z\\\) goto __wi_loop_z; else goto" "gimple"} } */
-
-/* The launcher should call __hsail_launch_wg_function in this case: */
-/* Kernel (void * restrict __context, unsigned char * restrict __group_base_addr) */
-/* { dg-final { scan-tree-dump "Kernel \\\(void \\\* restrict __context, unsigned char \\\* restrict __group_base_addr\\\)" "gimple"} } */
-/* { dg-final { scan-tree-dump "__hsail_launch_wg_function \\\(_Kernel, __context, __group_base_addr, group_local_offset.*\\\);" "gimple"} }*/
-
-/* The kernel should have the magic metadata section injected to the ELF. */
-/* TODO: this should be disabled in case not outputting to an ELF. */
-/* Currently ELF is assumed by the brig frontend. Do not check for the context */
-/* as it is likely to change. */
-/* { dg-final { scan-tree-dump "\\\.pushsection phsa\\\.desc\\\.Kernel" "gimple"} }*/
-
-/* The kernel with the barrier call should have the barrier builtin call in between the two summations. */
-/* { dg-final { scan-tree-dump "s2 = s0 \\\+ s1;\[\n \]+__builtin___hsail_barrier \\\(__context\\\);\[\n \]+s3 = s0 \\\+ 4294967295;" "gimple"} } */
-
-/* The kernel with the barrier call's launcher function should call the thread-spawning function. */
-/* { dg-final { scan-tree-dump "__hsail_launch_kernel \\\(_KernelWithBarrier, __context, __group_base_addr, group_local_offset.*\\\);" "gimple" } } */
-
-
-
diff --git a/gcc/testsuite/brig.dg/test/gimple/variables.hsail b/gcc/testsuite/brig.dg/test/gimple/variables.hsail
deleted file mode 100644
index 5fd96c1..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/variables.hsail
+++ /dev/null
@@ -1,125 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* Tests for different variable scopes and address spaces. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-gimple -fdump-tree-original" } */
-
-prog align(256) private_u32 &prog_private;
-private_u32 &mod_private;
-
-prog group_u32 &prog_group;
-group_u32 &mod_group;
-
-prog global_u32 &prog_global;
-global_u32 &mod_global;
-
-decl prog global_u32 &prog_global_host_def;
-
-prog readonly_u32 &prog_readonly;
-readonly_u32 &mod_readonly;
-
-prog function &subfunction(arg_u32 %return_value)(arg_u32 %arg) {
-
- private_u32 %func_private;
- group_u32 %func_group;
- align(256) global_u32 %func_global;
- readonly_u32 %func_readonly;
-
- ld_private_u32 $s200, [%func_private];
- st_private_u32 $s200, [&prog_private];
-
-/* { dg-final { scan-tree-dump "__group_base_addr \\\+ \\\(0 \\\+" "original" } } */
- ld_group_u32 $s203, [%func_group];
-
-/* { dg-final { scan-tree-dump "__group_base_addr \\\+ 0" "original" } } */
- st_group_u32 $s203, [&prog_group];
-
- ld_global_u32 $s204, [%func_global];
- st_global_u32 $s204, [&prog_global];
-
- ld_readonly_u32 $s205, [%func_readonly];
- st_global_u32 $s205, [%func_global];
-
- st_arg_u32 $s2, [%return_value];
- ret;
-};
-
-prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- private_u32 %kern_private;
- group_u32 %kern_group;
- global_u32 %kern_global;
- readonly_u32 %kern_readonly;
-
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_global_u32 $s0, [$d0];
-
- ld_private_u32 $s2, [&prog_private];
- st_private_u32 $s2, [%kern_private];
- ld_private_u32 $s3, [&mod_private];
- st_private_u32 $s3, [&prog_private];
-
- ld_group_u32 $s4, [&prog_group];
- st_group_u32 $s4, [%kern_group];
- ld_group_u32 $s5, [&mod_group];
- st_group_u32 $s5, [&prog_group];
-
- ld_global_u32 $s6, [&prog_global];
- st_global_u32 $s6, [%kern_global];
- ld_global_u32 $s7, [&mod_global];
- st_global_u32 $s7, [&prog_global];
-
- ld_readonly_u32 $s8, [&prog_readonly];
- st_global_u32 $s8, [%kern_global];
- ld_readonly_u32 $s9, [&mod_readonly];
- st_global_u32 $s9, [&prog_global];
-
- ld_readonly_u32 $s10, [%kern_readonly];
- st_global_u32 $s10, [%kern_global];
- ld_readonly_u32 $s11, [%kern_readonly];
- st_global_u32 $s11, [&prog_global_host_def];
-
- {
- arg_u32 %arg;
- arg_u32 %return_value;
- st_arg_u32 $s1, [%arg];
- call &subfunction(%return_value)(%arg);
- ld_arg_u32 $s1, [%return_value];
- }
- ld_kernarg_u64 $d1, [%output_ptr];
- st_global_u32 $s1, [$d0];
-};
-
-/* Private variable offsets assigned in the order of their appearance */
-/*
- prog_private @0 (align 256) -> until 254 to ensure all WIs
- mod_private @256 have their chunks aligned
- func_private @260
- kern_private @264
-*/
-
-/* Group variable offsets assigned in the order of their appearance */
-/*
- prog_group @0 (2)
- mod_group @4 (4)
- func_group @8 (1)
- kern_group @12 (3)
-*/
-
-/* The "mangling" of the global and readonly vars. */
-/* { dg-final { scan-tree-dump "\[ \]*prog_global = s204;" "gimple" } } */
-
-/* { dg-final { scan-tree-dump "\.module.mod_global;" "gimple" } } */
-
-/* Host defined variables need indirect access as the address is
- known only at run time. */
-/* { dg-final { scan-tree-dump "\\\*\\\__phsa.host_def.prog_global_host_def.\[0-9\]+_\[0-9\]+ = s11;" "gimple" } } */
-
-/* { dg-final { scan-tree-dump "\.subfunction.func_global;" "gimple" } } */
-/* { dg-final { scan-tree-dump "\.subfunction.func_readonly;" "gimple" } } */
-
-/* { dg-final { scan-tree-dump "kernel.kern_global" "gimple" } } */
-/* { dg-final { scan-tree-dump "kernel.kern_readonly" "gimple" } } */
-
-
diff --git a/gcc/testsuite/brig.dg/test/gimple/vector.hsail b/gcc/testsuite/brig.dg/test/gimple/vector.hsail
deleted file mode 100644
index 7529333..0000000
--- a/gcc/testsuite/brig.dg/test/gimple/vector.hsail
+++ /dev/null
@@ -1,57 +0,0 @@
-module &module:1:0:$full:$large:$default;
-
-/* A test for vector operands. */
-
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-original" } */
-
-prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
-{
- ld_kernarg_u64 $d0, [%input_ptr];
- ld_v2_global_f32 ($s0, $s1), [$d0];
- ld_v3_global_f32 ($s2, $s3, $s4), [$d0 + 8];
- ld_v4_global_f32 ($s5, $s6, $s7, $s8), [$d0 + 20];
-
- add_f32 $s9, $s0, $s1;
- combine_v2_b64_b32 $d2, ($s1, $s0);
- combine_v2_b64_b32 $d3, ($s2, $s3);
-
- add_pp_f32x2 $d4, $d2, $d3;
-
- expand_v2_b32_b64 ($s0, $s3), $d4;
-
- ld_kernarg_u64 $d1, [%output_ptr];
- st_v2_global_f32 ($s0, $s1), [$d1];
- st_v3_global_f32 ($s2, $s3, $s4), [$d1 + 8];
- st_v4_global_f32 ($s5, $s6, $s7, $s8), [$d1 + 20];
-
- ret;
-};
-
-/* The v2 load is done via casting to a vector datatype ptr. */
-/* { dg-final { scan-tree-dump " = MEM\\\[\\\(vector\\\(2\\\) <float:32> \\\*\\\)" "original"} } */
-
-/* The v3 load is scalarized (at the moment) due to gcc requiring 2's exponent wide vectors. */
-/* { dg-final { scan-tree-dump "s0 = .*BIT_FIELD_REF <mem_read.\[0-9\]+, 32, 0>\\\)?;\[\n ]+s1 = .*BIT_FIELD_REF <mem_read.\[0-9\]+, 32, 32>\\\)?;" "original"} } */
-
-/* The v4 load is done via casting to a vector datatype ptr. */
-/* { dg-final { scan-tree-dump " = MEM\\\[\\\(vector\\\(4\\\) <float:32> \\\*\\\)" "original"} } */
-
-/* The combines are generated to vector constructors. */
-/* { dg-final { scan-tree-dump "{.*s1\\\)?, .*s0\\\)?}" "original"} } */
-/* { dg-final { scan-tree-dump "{.*s2\\\)?, .*s3\\\)?}" "original"} } */
-
-/* Expands to BIT_FIELD_REFs. */
-/* { dg-final { scan-tree-dump "s0 = \(VIEW_CONVERT_EXPR.*\\\(\)?BIT_FIELD_REF <d4, 32, 0>\\\)?;" "original"} } */
-/* { dg-final { scan-tree-dump "s3 = \(VIEW_CONVERT_EXPR.*\\\(\)?BIT_FIELD_REF <d4, 32, 32>\\\)?;" "original"} } */
-
-/* The v1 store is done via casting to a vector datatype ptr and constructing a vector from the inputs. */
-/* { dg-final { scan-tree-dump "MEM\\\[\\\(vector\\\(2\\\) <float:32> \\\*\\\)\\\(<float:32> \\\*\\\) d1\\\] = " "original"} } */
-
-/* The v3 store is scalarized (at the moment) due to gcc requiring 2's exponent wide vectors. */
-/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 0 = VIEW_CONVERT_EXPR<<float:32>>\\\(s2\\\);" "original"} } */
-/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 4 = VIEW_CONVERT_EXPR<<float:32>>\\\(s3\\\);" "original"} } */
-/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 8 = VIEW_CONVERT_EXPR<<float:32>>\\\(s4\\\);" "original"} } */
-
-/* The v4 store is done via casting to a vector datatype and constructing a vector from the inputs. */
-/* { dg-final { scan-tree-dump "MEM\\\[\\\(vector\\\(4\\\) <float:32> \\\*\\\)\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 20\\\)\\\] = {VIEW_CONVERT_EXPR<<float:32>>\\\(s5\\\), VIEW_CONVERT_EXPR<<float:32>>\\\(s6\\\), VIEW_CONVERT_EXPR<<float:32>>\\\(s7\\\), VIEW_CONVERT_EXPR<<float:32>>\\\(s8\\\)};" "original"} } */
diff --git a/gcc/testsuite/c-c++-common/Walloca-larger-than.C b/gcc/testsuite/c-c++-common/Walloca-larger-than.C
new file mode 100644
index 0000000..464ea24
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Walloca-larger-than.C
@@ -0,0 +1,21 @@
+/* PR middle-end/100425 - missing -Walloca-larger-than with -O0
+ { dg-do compile }
+ { dg-options "-O0 -Wall -Walloca-larger-than=128" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+#if __cplusplus
+extern "C"
+#endif
+
+void* alloca (size_t);
+
+void sink (void*);
+
+void warn_alloca_too_large (void)
+{
+ sink (alloca (1));
+ sink (alloca (128));
+ sink (alloca (129)); // { dh-warning "\\\[-Walloca-larger-than" }
+ sink (alloca (1024)); // { dh-warning "\\\[-Walloca-larger-than" }
+}
diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-10.c b/gcc/testsuite/c-c++-common/Warray-bounds-10.c
new file mode 100644
index 0000000..cfe9a38
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Warray-bounds-10.c
@@ -0,0 +1,114 @@
+/* PR tree-optimization/99475 - bogus -Warray-bounds accessing an array
+ element of empty structs
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct S
+{
+#if SOME_CONFIG_MACRO
+ /* Suppose the contents are empty in the development configuration
+ but non-empty in others. Out of bounds accesses to elements of
+ the arrays below should be diagnosed in all configurations,
+ including when S is empty, even if they are folded away. */
+ int member;
+#endif
+};
+
+extern struct S sa3[3];
+extern struct S sa2_3[2][3];
+extern struct S sa3_4_5[3][4][5];
+
+void sink (void*);
+
+
+void access_sa3 (struct S s)
+{
+ sa3[0] = s;
+ sa3[1] = s;
+ sa3[2] = s;
+ sa3[3] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+void access_sa3_ptr (struct S s)
+{
+ struct S *p = &sa3[0];
+
+ p[0] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[3] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+void access_sa2_3_ptr (struct S s)
+{
+ struct S *p = &sa2_3[0][0];
+
+ p[0] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[6] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+void access_sa3_4_5_ptr (struct S s, int i)
+{
+ struct S *p = &sa3_4_5[0][0][0];
+
+ p[0] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[60] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+
+void access_vla3 (struct S s, unsigned n)
+{
+ struct S vla3[3 < n ? 3 : n];
+
+ vla3[0] = s;
+ vla3[1] = s;
+ vla3[2] = s;
+ vla3[3] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla3);
+}
+
+void access_vla3_ptr (struct S s, unsigned n)
+{
+ struct S vla3[3 < n ? 3 : n];
+ struct S *p = &vla3[0];
+
+ p[0] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[3] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla3);
+}
+
+void access_vla2_3_ptr (struct S s, unsigned n)
+{
+ struct S vla2_3[2 < n ? 2 : n][3 < n ? 3 : n];
+ struct S *p = &vla2_3[0][0];
+
+ p[0] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[6] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla2_3);
+}
+
+void access_vla3_4_5_ptr (struct S s, unsigned n)
+{
+ struct S vla3_4_5[3 < n ? 3 : n][4 < n ? 4 : n][5 < n ? 5 : n];
+ struct S *p = &vla3_4_5[0][0][0];
+
+ p[0] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = s; // { dg-bogus "\\\[-Warray-bounds" }
+ p[60] = s; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla3_4_5);
+}
+
+// { dg-prune-output "empty struct has size 0 in C" }
diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-3.c b/gcc/testsuite/c-c++-common/Warray-bounds-3.c
index aae4999..75f9a49 100644
--- a/gcc/testsuite/c-c++-common/Warray-bounds-3.c
+++ b/gcc/testsuite/c-c++-common/Warray-bounds-3.c
@@ -158,7 +158,7 @@ void test_memcpy_overflow (char *d, const char *s, size_t n)
but known access size is detected. This works except with small
sizes that are powers of 2 due to bug . */
T (char, 1, arr + SR (DIFF_MAX - 1, DIFF_MAX), s, 1);
- T (char, 1, arr + SR (DIFF_MAX - 1, DIFF_MAX), s, 2); /* { dg-warning "pointer overflow between offset \\\[\[0-9\]+, \[0-9\]+] and size 2 accessing array " "bug " { xfail non_strict_align } } */
+ T (char, 1, arr + SR (DIFF_MAX - 1, DIFF_MAX), s, 2); /* { dg-warning "\\\[-Warray-bounds" } */
T (char, 1, arr + SR (DIFF_MAX - 2, DIFF_MAX), s, 3); /* { dg-warning "pointer overflow between offset \\\[\[0-9\]+, \[0-9\]+] and size 3 accessing array " "memcpy" } */
T (char, 1, arr + SR (DIFF_MAX - 4, DIFF_MAX), s, 5); /* { dg-warning "pointer overflow between offset \\\[\[0-9\]+, \[0-9\]+] and size 5 accessing array " "memcpy" } */
}
@@ -178,7 +178,7 @@ void test_memcpy_bounds_memarray_range (void)
TM (ma.a5, ma.a5 + i, ma.a5, 1);
TM (ma.a5, ma.a5 + i, ma.a5, 3);
- TM (ma.a5, ma.a5 + i, ma.a5, 5);
+ TM (ma.a5, ma.a5 + i, ma.a5, 5); /* { dg-warning "\\\[-Warray-bounds" "pr101374" { xfail *-*-* } } */
TM (ma.a5, ma.a5 + i, ma.a5, 7); /* diagnosed with -Warray-bounds=2 */
}
diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-4.c b/gcc/testsuite/c-c++-common/Warray-bounds-4.c
index 22a23a1..835c634 100644
--- a/gcc/testsuite/c-c++-common/Warray-bounds-4.c
+++ b/gcc/testsuite/c-c++-common/Warray-bounds-4.c
@@ -43,7 +43,17 @@ void test_memcpy_bounds_memarray_range (void)
TM (ma.a5, ma.a5 + j, ma.a5, 1);
TM (ma.a5, ma.a5 + j, ma.a5, 3);
- TM (ma.a5, ma.a5 + j, ma.a5, 5);
+
+ /* The copy below is invalid for two reasons: 1) it overlaps and 2) it
+ writes past the end of ma.a5. The warning is a little cryptic here
+ because the GIMPLE is:
+ _4 = &ma.a5 + prephitmp_14;
+ MEM <unsigned char[5]> [(char * {ref-all})_4]
+ = MEM <unsigned char[5]> [(char * {ref-all})&ma];
+ and could be improved. Just verify that one is issued but not its
+ full text. */
+ TM (ma.a5, ma.a5 + j, ma.a5, 5); /* { dg-warning "\\\[-Warray-bounds" "pr101374" { xfail *-*-* } } */
+
TM (ma.a5, ma.a5 + j, ma.a5, 7); /* { dg-warning "offset \\\[5, 7] from the object at .ma. is out of the bounds of referenced subobject .\(MA::\)?a5. with type .char ?\\\[5]. at offset 0" } */
TM (ma.a5, ma.a5 + j, ma.a5, 9); /* { dg-warning "offset \\\[5, 9] from the object at .ma. is out of the bounds of referenced subobject .\(MA::\)?a5. with type .char ?\\\[5]. at offset 0" } */
}
diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-9.c b/gcc/testsuite/c-c++-common/Warray-bounds-9.c
new file mode 100644
index 0000000..be05775
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Warray-bounds-9.c
@@ -0,0 +1,144 @@
+/* PR tree-optimization/99121 - ICE in -Warray-bounds on a multidimensional
+ VLA
+ { dg-do compile }
+ { dg-options "-O2 -Wall -ftrack-macro-expansion=0" } */
+
+#define NOIPA __attribute__ ((noipa))
+
+void sink (void*, ...);
+#define T(a, x) sink (a, x)
+
+
+NOIPA void a_0_n (int n)
+{
+ int a[0][n];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_n_0 (int n)
+{
+ int a[n][0];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+
+NOIPA void a_1_n_0 (int n)
+{
+ int a[1][n][0];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_1_0_n (int n)
+{
+ int a[1][0][n];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_0_1_n (int n)
+{
+ int a[0][1][n];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_0_n_1 (int n)
+{
+ int a[0][n][1];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_n_0_n (int n)
+{
+ int a[n][0][n];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_n_n_0 (int n)
+{
+ int a[n][n][0];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_0_n_n (int n)
+{
+ int a[0][n][n];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_0_0_n (int n)
+{
+ int a[0][0][n];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_n_0_0 (int n)
+{
+ int a[n][0][0];
+
+ sink (a);
+
+ T (a, ((int *) a)[0]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((char *) a)[1]); // { dg-warning "\\\[-Warray-bounds" }
+ T (a, ((float *) a)[n]); // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void a_n_n_n (int n)
+{
+ int a[n][n][n];
+
+ sink (a);
+
+ T (a, ((int *) a)[-1]); // { dg-warning "\\\[-Warray-bounds" "pr99140" }
+ T (a, ((int *) a)[0]);
+ T (a, ((char *) a)[1]);
+ T (a, ((float *) a)[n]);
+}
diff --git a/gcc/testsuite/c-c++-common/Wattributes.c b/gcc/testsuite/c-c++-common/Wattributes.c
index 4ad9044..978f3f9 100644
--- a/gcc/testsuite/c-c++-common/Wattributes.c
+++ b/gcc/testsuite/c-c++-common/Wattributes.c
@@ -97,6 +97,8 @@ fnoinline1 (void); /* { dg-message "previous declaration here" } */
/* Verify a warning for always_inline conflict. */
void ATTR ((always_inline))
fnoinline1 (void) { } /* { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
+ /* { dg-note "previous definition" "" { target *-*-* } .-2 } */
/* Verify a warning for gnu_inline conflict. */
inline void ATTR ((gnu_inline))
@@ -364,13 +366,15 @@ inline int ATTR ((cold))
finline_cold_noreturn (int);
inline int ATTR ((noreturn))
-finline_cold_noreturn (int);
+finline_cold_noreturn (int); /* { dg-note "previous declaration here" } */
inline int ATTR ((noinline))
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((hot))
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .hot. because it conflicts with attribute .cold." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((warn_unused_result))
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */
@@ -389,23 +393,25 @@ finline_cold_noreturn (int i) { (void)&i; __builtin_abort (); }
and some on distinct declarations. */
inline int ATTR ((always_inline, hot))
-finline_hot_noret_align (int);
+finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */
inline int ATTR ((noreturn, noinline))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((cold, aligned (8)))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .cold. because it conflicts with attribute .hot." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((warn_unused_result))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((aligned (4)))
- finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* s390*-*-* } } } } */
-/* { dg-error "alignment for '.*finline_hot_noret_align.*' must be at least 8" "" { target s390*-*-* } .-1 } */
+ finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* } } } } */
inline int ATTR ((aligned (8)))
-finline_hot_noret_align (int);
+finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */
inline int ATTR ((const))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */
@@ -416,6 +422,26 @@ inline int ATTR ((noreturn))
finline_hot_noret_align (int i) { (void)&i; __builtin_abort (); }
+/* Expect a warning about conflicting alignment but without
+ other declarations inbetween. */
+inline int ATTR ((aligned (32)))
+finline_align (int); /* { dg-note "previous declaration here" } */
+
+inline int ATTR ((aligned (4)))
+finline_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." "" } */
+
+inline int ATTR ((noreturn))
+finline_align (int i) { (void)&i; __builtin_abort (); }
+
+
+/* Expect no note that would refer to the same declaration. */
+inline int ATTR ((aligned (32), aligned (4)))
+finline_double_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." } */
+
+inline int ATTR ((noreturn))
+finline_double_align (int i) { (void)&i; __builtin_abort (); }
+
+
/* Exercise variable attributes. */
extern int ATTR ((common))
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c
index 32d5feb..9593f67 100644
--- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c
@@ -121,8 +121,8 @@ L1:
int j = 0;
bar (j);
if (j == 8)
- return; /* { dg-warning "statement may fall through" "" { target c++ } } */
- }
+ return;
+ } /* { dg-warning "statement may fall through" "" { target c++ } } */
case 2:
bar (99);
}
@@ -151,8 +151,8 @@ L1:
if (j == 8)
bar (1);
else
- return; /* { dg-warning "statement may fall through" "" { target c++ } } */
- }
+ return;
+ } /* { dg-warning "statement may fall through" "" { target c++ } } */
case 2:
bar (99);
}
@@ -181,8 +181,8 @@ L1:
if (j == 8)
bar (1);
else
- bar (2); /* { dg-warning "statement may fall through" "" { target c++ } } */
- }
+ bar (2);
+ } /* { dg-warning "statement may fall through" "" { target c++ } } */
case 2:
bar (99);
}
@@ -281,8 +281,8 @@ L1:
case 1:
{ /* { dg-warning "statement may fall through" "" { target c } } */
int j = 9;
- switch (j); /* { dg-warning "statement may fall through" "" { target c++ } } */
- }
+ switch (j);
+ } /* { dg-warning "statement may fall through" "" { target c++ } } */
case 2:
bar (99);
}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c
index a602216..343b625 100644
--- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c
@@ -22,8 +22,8 @@ f (int i)
{
case 1:
{ /* { dg-warning "statement may fall through" "" { target c } } */
- int a[i]; /* { dg-warning "statement may fall through" "" { target c++ } } */
- }
+ int a[i];
+ } /* { dg-warning "statement may fall through" "" { target c++ } } */
case 2:
bar (99);
}
diff --git a/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c b/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c
index 38e06ba..6c8866d 100644
--- a/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c
+++ b/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c
@@ -1,7 +1,7 @@
/* Test -Wsizeof-pointer-memaccess warnings. */
/* { dg-do compile } */
-/* { dg-options "-Wall -Wno-array-bounds -Wno-sizeof-array-argument -Wno-stringop-overflow" } */
-/* { dg-options "-Wall -Wno-array-bounds -Wno-sizeof-array-argument -Wno-c++-compat -Wno-stringop-overflow" { target c } } */
+/* { dg-options "-Wall -Wno-array-bounds -Wno-sizeof-array-argument -Wno-stringop-overflow -Wno-stringop-overread" } */
+/* { dg-options "-Wall -Wno-array-bounds -Wno-sizeof-array-argument -Wno-c++-compat -Wno-stringop-overflow -Wno-stringop-overread" { target c } } */
/* { dg-require-effective-target alloca } */
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-16.c b/gcc/testsuite/c-c++-common/Wunused-var-16.c
index 8bdbcd3..31c7db3 100644
--- a/gcc/testsuite/c-c++-common/Wunused-var-16.c
+++ b/gcc/testsuite/c-c++-common/Wunused-var-16.c
@@ -1,6 +1,6 @@
/* PR c++/78949 */
/* { dg-do compile } */
-/* { dg-options "-Wunused" } */
+/* { dg-options "-Wunused -fdump-tree-optimized" } */
/* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */
typedef unsigned char V __attribute__((vector_size(16)));
@@ -14,3 +14,5 @@ foo ()
y &= ~x;
v = y;
}
+
+/* { dg-final { scan-tree-dump-not " ~0" "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-nonstring-3.c b/gcc/testsuite/c-c++-common/attr-nonstring-3.c
index e3ceabd..3add7fa 100644
--- a/gcc/testsuite/c-c++-common/attr-nonstring-3.c
+++ b/gcc/testsuite/c-c++-common/attr-nonstring-3.c
@@ -379,9 +379,9 @@ void test_stnrdup_warn (struct MemArrays *p)
T (strndup (p->arr, N));
- T (strndup (arr, N + 1)); /* { dg-warning "specified bound 5 exceeds source size 4" } */
+ T (strndup (arr, N + 1)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound 5|specified bound 5 exceeds source size 4" } */
T (strndup (parr, N + 1));
- T (strndup (p->arr, N + 1)); /* { dg-warning "specified bound 5 exceeds source size 4" } */
+ T (strndup (p->arr, N + 1)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound 5|specified bound 5 exceeds source size 4" } */
T (strndup (p->parr, N + 1));
}
diff --git a/gcc/testsuite/c-c++-common/attr-retain-10.c b/gcc/testsuite/c-c++-common/attr-retain-10.c
new file mode 100644
index 0000000..0bac947
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-retain-10.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target R_flag_in_section } } */
+/* { dg-skip-if "non-ELF target" { *-*-darwin* powerpc*-*-aix* } } */
+/* { dg-options "-Wall -O2 -fno-toplevel-reorder" } */
+
+int __attribute__((used,retain,section(".data.foo"))) foo2 = 2;
+int between = 1;
+int __attribute__((section(".data.foo"))) foo1 = 1;
+/* { dg-warning "'.*' without 'retain' attribute and '.*' with 'retain' attribute are placed in a section with the same name" "" { target R_flag_in_section } .-1 } */
+
+/* { dg-final { scan-assembler ".data.foo,\"aw\"" { target R_flag_in_section } } } */
+/* { dg-final { scan-assembler ".data.foo,\"awR\"" { target R_flag_in_section } } } */
diff --git a/gcc/testsuite/c-c++-common/attr-retain-11.c b/gcc/testsuite/c-c++-common/attr-retain-11.c
new file mode 100644
index 0000000..d1d3d9e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-retain-11.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target R_flag_in_section } } */
+/* { dg-skip-if "non-ELF target" { *-*-darwin* powerpc*-*-aix* } } */
+/* { dg-options "-Wall -O2 -fno-toplevel-reorder" } */
+
+int __attribute__((section(".data.foo"))) foo1 = 1;
+/* { dg-warning "'.*' without 'retain' attribute and '.*' with 'retain' attribute are placed in a section with the same name" "" { target R_flag_in_section } .-1 } */
+int between = 1;
+int __attribute__((used,retain,section(".data.foo"))) foo2 = 2;
+
+/* { dg-final { scan-assembler ".data.foo,\"aw\"" { target R_flag_in_section } } } */
+/* { dg-final { scan-assembler ".data.foo,\"awR\"" { target R_flag_in_section } } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-1.c b/gcc/testsuite/c-c++-common/auto-init-1.c
new file mode 100644
index 0000000..84ba0a9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-1.c
@@ -0,0 +1,41 @@
+/* Verify zero initialization for integer and pointer type automatic variables. */
+/* { dg-do compile { target { ilp32 || lp64 } } } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+enum E {
+ N1 = 0,
+ N2,
+ N3
+};
+
+extern void bar (char, short, int, enum E, long, long long, int *, bool);
+
+void foo()
+{
+ char temp1;
+ short temp2;
+ int temp3;
+ enum E temp4;
+ long temp5;
+ long long temp6;
+ int *temp7;
+ bool temp8;
+
+ bar (temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8);
+ return;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-10.c b/gcc/testsuite/c-c++-common/auto-init-10.c
new file mode 100644
index 0000000..f35205f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-10.c
@@ -0,0 +1,22 @@
+/* Verify the variable attribute "uninitialized". */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+extern void bar (char, long long *) __attribute__ ((uninitialized)); /* { dg-warning "'uninitialized' attribute ignored because" "is not a variable" } */
+extern int __attribute__ ((uninitialized)) boo1; /* { dg-warning "'uninitialized' attribute ignored because 'boo1' is not a local variable" } */
+static int __attribute__ ((uninitialized)) boo2; /* { dg-warning "'uninitialized' attribute ignored because 'boo2' is not a local variable" } */
+
+
+void foo()
+{
+ short temp1;
+ long long __attribute__ ((uninitialized)) temp2[10];
+ static int __attribute__ ((uninitialized)) boo3; /* { dg-warning "'uninitialized' attribute ignored because 'boo3' is not a local variable" } */
+
+
+ bar (temp1, temp2);
+ return;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-11.c b/gcc/testsuite/c-c++-common/auto-init-11.c
new file mode 100644
index 0000000..a2d6690
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-11.c
@@ -0,0 +1,14 @@
+/* Verify zero initialization for VLA automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+extern void bar (int);
+
+void foo(int n)
+{
+ int arr[n];
+ bar (arr[2]);
+ return;
+}
+
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, 1\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-12.c b/gcc/testsuite/c-c++-common/auto-init-12.c
new file mode 100644
index 0000000..f05d743
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-12.c
@@ -0,0 +1,14 @@
+/* Verify zero initialization for VLA automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+extern void bar (int);
+
+void foo(int n)
+{
+ int arr[n];
+ bar (arr[2]);
+ return;
+}
+
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, 1\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-13.c b/gcc/testsuite/c-c++-common/auto-init-13.c
new file mode 100644
index 0000000..b0c0365
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-13.c
@@ -0,0 +1,23 @@
+/* Verify the auto initialization of structure or union with a flexible array
+ member. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+struct a {
+ int b;
+ int array[];
+};
+union tar {
+ struct a bar;
+ char buf;
+};
+
+int foo()
+{
+ struct a d;
+ union tar var;
+ return d.b + var.bar.b;
+}
+
+/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-14.c b/gcc/testsuite/c-c++-common/auto-init-14.c
new file mode 100644
index 0000000..986bb19
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-14.c
@@ -0,0 +1,23 @@
+/* Verify the auto initialization of structure or union with a flexible array
+ member. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+struct a {
+ int b;
+ int array[];
+};
+union tar {
+ struct a bar;
+ char buf;
+};
+
+int foo()
+{
+ struct a d;
+ union tar var;
+ return d.b + var.bar.b;
+}
+
+/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-15.c b/gcc/testsuite/c-c++-common/auto-init-15.c
new file mode 100644
index 0000000..aa9d7fa
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-15.c
@@ -0,0 +1,13 @@
+/* Verify the auto initialization of nested VLA. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+void g(void *);
+
+void foo(int a)
+{
+ int x[a][a];
+ g(x);
+}
+
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, 1\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-16.c b/gcc/testsuite/c-c++-common/auto-init-16.c
new file mode 100644
index 0000000..86493ee
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-16.c
@@ -0,0 +1,13 @@
+/* Verify the auto initialization of nested VLA. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+void g(void *);
+
+void foo(int a)
+{
+ int x[a][a];
+ g(x);
+}
+
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, 1\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-2.c b/gcc/testsuite/c-c++-common/auto-init-2.c
new file mode 100644
index 0000000..69768d6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-2.c
@@ -0,0 +1,41 @@
+/* Verify pattern initialization for integer and pointer type automatic variables. */
+/* { dg-do compile { target { ilp32 || lp64 } } } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+enum E {
+ N1 = 0,
+ N2,
+ N3
+};
+
+extern void bar (char, short, int, enum E, long, long long, int *, bool);
+
+void foo()
+{
+ char temp1;
+ short temp2;
+ int temp3;
+ enum E temp4;
+ long temp5;
+ long long temp6;
+ int *temp7;
+ bool temp8;
+
+ bar (temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8);
+ return;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-3.c b/gcc/testsuite/c-c++-common/auto-init-3.c
new file mode 100644
index 0000000..062d60c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-3.c
@@ -0,0 +1,19 @@
+/* Verify zero initialization for floating point type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+long double result;
+
+long double foo()
+{
+ float temp1;
+ double temp2;
+ long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 2, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-4.c b/gcc/testsuite/c-c++-common/auto-init-4.c
new file mode 100644
index 0000000..9d8f23e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-4.c
@@ -0,0 +1,19 @@
+/* Verify pattern initialization for floating point type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+long double result;
+
+long double foo()
+{
+ float temp1;
+ double temp2;
+ long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 1, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-5.c b/gcc/testsuite/c-c++-common/auto-init-5.c
new file mode 100644
index 0000000..9c98a6e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-5.c
@@ -0,0 +1,21 @@
+/* Verify zero initialization for complex type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+
+_Complex long double result;
+
+_Complex long double foo()
+{
+ _Complex float temp1;
+ _Complex double temp2;
+ _Complex long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 2, 0\\)" "gimple" } } */
+
diff --git a/gcc/testsuite/c-c++-common/auto-init-6.c b/gcc/testsuite/c-c++-common/auto-init-6.c
new file mode 100644
index 0000000..3fe2456
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-6.c
@@ -0,0 +1,21 @@
+/* Verify pattern initialization for complex type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+
+_Complex long double result;
+
+_Complex long double foo()
+{
+ _Complex float temp1;
+ _Complex double temp2;
+ _Complex long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 1, 0\\)" "gimple" } } */
+
diff --git a/gcc/testsuite/c-c++-common/auto-init-7.c b/gcc/testsuite/c-c++-common/auto-init-7.c
new file mode 100644
index 0000000..1998696
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-7.c
@@ -0,0 +1,35 @@
+/* Verify zero initialization for array, union, and structure type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+struct S
+{
+ int f1;
+ float f2;
+ char f3[20];
+};
+
+union U
+{
+ char u1[5];
+ int u2;
+ float u3;
+};
+
+double result;
+
+double foo()
+{
+ int temp1[3];
+ double temp2[3];
+ struct S temp3;
+ union U temp4;
+
+ result = temp1[2] + temp2[1] + temp3.f2 + temp4.u3;
+ return result;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-8.c b/gcc/testsuite/c-c++-common/auto-init-8.c
new file mode 100644
index 0000000..9778e91
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-8.c
@@ -0,0 +1,35 @@
+/* Verify pattern initialization for array, union, and structure type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+struct S
+{
+ int f1;
+ float f2;
+ char f3[20];
+};
+
+union U
+{
+ char u1[5];
+ int u2;
+ float u3;
+};
+
+double result;
+
+double foo()
+{
+ int temp1[3];
+ double temp2[3];
+ struct S temp3;
+ union U temp4;
+
+ result = temp1[2] + temp2[1] + temp3.f2 + temp4.u3;
+ return result;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-9.c b/gcc/testsuite/c-c++-common/auto-init-9.c
new file mode 100644
index 0000000..29acb7f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-9.c
@@ -0,0 +1,20 @@
+/* Verify the variable attribute "uninitialized". */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
+
+extern void bar (char, long long *) __attribute__ ((uninitialized)); /* { dg-warning "'uninitialized' attribute ignored because" "is not a variable" } */
+extern int __attribute__ ((uninitialized)) boo1; /* { dg-warning "'uninitialized' attribute ignored because 'boo1' is not a local variable" } */
+static int __attribute__ ((uninitialized)) boo2; /* { dg-warning "'uninitialized' attribute ignored because 'boo2' is not a local variable" } */
+
+void foo()
+{
+ short temp1;
+ long long __attribute__ ((uninitialized)) temp2[10];
+ static int __attribute__ ((uninitialized)) boo3; /* { dg-warning "'uninitialized' attribute ignored because 'boo3' is not a local variable" } */
+
+ bar (temp1, temp2);
+ return;
+}
+
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-esra.c b/gcc/testsuite/c-c++-common/auto-init-esra.c
new file mode 100644
index 0000000..77ec023
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-esra.c
@@ -0,0 +1,35 @@
+/* Verify the strength reduction adjustment for -ftrivial-auto-var-init. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftrivial-auto-var-init=zero -fdump-tree-gimple -fdump-tree-esra" } */
+
+
+typedef double VECTOR[3];
+
+enum
+{
+ X = 0,
+ Y = 1,
+ Z = 2,
+ T = 3
+};
+
+void Assign_Vector(VECTOR d, VECTOR s)
+{
+ d[X] = s[X];
+ d[Y] = s[Y];
+ d[Z] = s[Z];
+}
+
+void VCross(VECTOR a, const VECTOR b, const VECTOR c)
+{
+ VECTOR tmp;
+
+ tmp[X] = b[Y] * c[Z] - b[Z] * c[Y];
+ tmp[Y] = b[Z] * c[X] - b[X] * c[Z];
+ tmp[Z] = b[X] * c[Y] - b[Y] * c[X];
+
+ Assign_Vector(a, tmp);
+}
+
+/* { dg-final { scan-tree-dump-times "tmp = .DEFERRED_INIT \\(24, 2, 0\\)" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times ".DEFERRED_INIT \\(8, 2, 0\\)" 3 "esra" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-padding-1.c b/gcc/testsuite/c-c++-common/auto-init-padding-1.c
new file mode 100644
index 0000000..83db8dd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-padding-1.c
@@ -0,0 +1,23 @@
+/* Verify the padding initialization for pattern initialization, we always emit
+ * a call to __builtin_clear_padding to initialize the paddings to zero. */
+/* { dg-do compile { target { ilp32 || lp64 } } } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
+
+
+struct test_small_hole {
+ int one;
+ char two;
+ /* 3 byte padding hole here. */
+ int three;
+ unsigned long long four __attribute__((aligned (8)));
+};
+
+extern void g (struct test_small_hole);
+void foo(int a)
+{
+ struct test_small_hole s;
+ g(s);
+}
+
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(24, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "__builtin_clear_padding" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/auto-init-padding-2.c b/gcc/testsuite/c-c++-common/auto-init-padding-2.c
new file mode 100644
index 0000000..462f5ae
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-padding-2.c
@@ -0,0 +1,114 @@
+/* To test that the compiler can fill all the paddings to zeroes for the
+ structures when the auto variable is partially initialized, fully
+ initialized, or not initialized for -ftrivial-auto-var-init=zero. */
+/* { dg-do run } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+/* Structure with no padding. */
+struct test_packed {
+ unsigned long one;
+ unsigned long two;
+ unsigned long three;
+ unsigned long four;
+} p1;
+
+/* Simple structure with padding likely to be covered by compiler. */
+struct test_small_hole {
+ unsigned long one;
+ char two;
+ /* 3 byte padding hole here. */
+ int three;
+ unsigned long four;
+} sh1;
+
+/* Try to trigger unhandled padding in a structure. */
+struct test_aligned {
+ unsigned int internal1;
+ unsigned long long internal2;
+} __attribute__((__aligned__(64)));
+
+struct test_aligned a1;
+
+struct test_big_hole {
+ unsigned char one;
+ unsigned char two;
+ unsigned char three;
+ /* 61 byte padding hole here. */
+ struct test_aligned four;
+} __attribute__((__aligned__(64)));
+
+struct test_big_hole bh1;
+
+struct test_trailing_hole {
+ char *one;
+ char *two;
+ char *three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+} th1;
+
+__attribute__((noipa)) void
+foo (struct test_packed *p, struct test_small_hole *sh, struct test_aligned *a,
+ struct test_big_hole *bh, struct test_trailing_hole *th)
+{
+ p->one = 1; p->two = 2; p->three = 3; p->four = 4;
+ sh->one = 11; sh->two = 12; sh->three = 13; sh->four = 14;
+ a->internal1 = 21; a->internal2 = 22;
+ bh->one = 31; bh->two = 32; bh->three = 33;
+ bh->four.internal1 = 34; bh->four.internal2 = 35;
+ th->one = 0; th->two = 0; th->three = 0; th->four = 44;
+}
+
+int main ()
+{
+ struct test_packed p2;
+ struct test_small_hole sh2;
+ struct test_aligned a2;
+ struct test_big_hole bh2;
+ struct test_trailing_hole th2;
+
+ struct test_packed p3 = {.one = 1};
+ struct test_small_hole sh3 = {.two = 12};
+ struct test_aligned a3 = {.internal1 = 21};
+ struct test_big_hole bh3 = {.one = 31};
+ struct test_trailing_hole th3 = {.three = 0};
+
+ struct test_packed p4 = {.one = 1, .two = 2, .three = 3, .four = 4};
+ struct test_small_hole sh4 = {.one = 11, .two = 12, .three = 13, .four = 14};
+ struct test_aligned a4 = {.internal1 = 21, .internal2 = 22};
+ struct test_big_hole bh4 = {.one = 31, .two = 32, .three = 33};
+ struct test_trailing_hole th4 = {.one = 0, .two = 0, .three = 0, .four = 44};
+
+ foo (&p1, &sh1, &a1, &bh1, &th1);
+ foo (&p2, &sh2, &a2, &bh2, &th2);
+ foo (&p3, &sh3, &a3, &bh3, &th3);
+ bh4.four.internal1 = 34; bh4.four.internal2 = 35;
+
+ __builtin_clear_padding (&p1);
+ __builtin_clear_padding (&sh1);
+ __builtin_clear_padding (&a1);
+ __builtin_clear_padding (&bh1);
+ __builtin_clear_padding (&th1);
+
+ if (__builtin_memcmp (&p1, &p2, sizeof (p1))
+ || __builtin_memcmp (&sh1, &sh2, sizeof (sh1))
+ || __builtin_memcmp (&a1, &a2, sizeof (a1))
+ || __builtin_memcmp (&bh1, &bh2, sizeof (bh1))
+ || __builtin_memcmp (&th1, &th2, sizeof (th1)))
+ __builtin_abort ();
+ if (__builtin_memcmp (&p1, &p3, sizeof (p1))
+ || __builtin_memcmp (&sh1, &sh3, sizeof (sh1))
+ || __builtin_memcmp (&a1, &a3, sizeof (a1))
+ || __builtin_memcmp (&bh1, &bh3, sizeof (bh1))
+ || __builtin_memcmp (&th1, &th3, sizeof (th1)))
+ __builtin_abort ();
+ if (__builtin_memcmp (&p1, &p4, sizeof (p1))
+ || __builtin_memcmp (&sh1, &sh4, sizeof (sh1))
+ || __builtin_memcmp (&a1, &a4, sizeof (a1))
+ || __builtin_memcmp (&bh1, &bh4, sizeof (bh1))
+ || __builtin_memcmp (&th1, &th4, sizeof (th1)))
+ __builtin_abort ();
+
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/auto-init-padding-3.c b/gcc/testsuite/c-c++-common/auto-init-padding-3.c
new file mode 100644
index 0000000..2277014
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/auto-init-padding-3.c
@@ -0,0 +1,114 @@
+/* To test that the compiler can fill all the paddings to zeroes for the
+ structures when the auto variable is partially initialized, fully
+ initialized, or not initialized for -ftrivial-auto-var-init=pattern. */
+/* { dg-do run } */
+/* { dg-options "-ftrivial-auto-var-init=pattern" } */
+
+/* Structure with no padding. */
+struct test_packed {
+ unsigned long one;
+ unsigned long two;
+ unsigned long three;
+ unsigned long four;
+} p1;
+
+/* Simple structure with padding likely to be covered by compiler. */
+struct test_small_hole {
+ unsigned long one;
+ char two;
+ /* 3 byte padding hole here. */
+ int three;
+ unsigned long four;
+} sh1;
+
+/* Try to trigger unhandled padding in a structure. */
+struct test_aligned {
+ unsigned int internal1;
+ unsigned long long internal2;
+} __attribute__((__aligned__(64)));
+
+struct test_aligned a1;
+
+struct test_big_hole {
+ unsigned char one;
+ unsigned char two;
+ unsigned char three;
+ /* 61 byte padding hole here. */
+ struct test_aligned four;
+} __attribute__((__aligned__(64)));
+
+struct test_big_hole bh1;
+
+struct test_trailing_hole {
+ char *one;
+ char *two;
+ char *three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+} th1;
+
+__attribute__((noipa)) void
+foo (struct test_packed *p, struct test_small_hole *sh, struct test_aligned *a,
+ struct test_big_hole *bh, struct test_trailing_hole *th)
+{
+ p->one = 1; p->two = 2; p->three = 3; p->four = 4;
+ sh->one = 11; sh->two = 12; sh->three = 13; sh->four = 14;
+ a->internal1 = 21; a->internal2 = 22;
+ bh->one = 31; bh->two = 32; bh->three = 33;
+ bh->four.internal1 = 34; bh->four.internal2 = 35;
+ th->one = 0; th->two = 0; th->three = 0; th->four = 44;
+}
+
+int main ()
+{
+ struct test_packed p2;
+ struct test_small_hole sh2;
+ struct test_aligned a2;
+ struct test_big_hole bh2;
+ struct test_trailing_hole th2;
+
+ struct test_packed p3 = {.one = 1};
+ struct test_small_hole sh3 = {.two = 12};
+ struct test_aligned a3 = {.internal1 = 21};
+ struct test_big_hole bh3 = {.one = 31};
+ struct test_trailing_hole th3 = {.three = 0};
+
+ struct test_packed p4 = {.one = 1, .two = 2, .three = 3, .four = 4};
+ struct test_small_hole sh4 = {.one = 11, .two = 12, .three = 13, .four = 14};
+ struct test_aligned a4 = {.internal1 = 21, .internal2 = 22};
+ struct test_big_hole bh4 = {.one = 31, .two = 32, .three = 33};
+ struct test_trailing_hole th4 = {.one = 0, .two = 0, .three = 0, .four = 44};
+
+ foo (&p1, &sh1, &a1, &bh1, &th1);
+ foo (&p2, &sh2, &a2, &bh2, &th2);
+ foo (&p3, &sh3, &a3, &bh3, &th3);
+ bh4.four.internal1 = 34; bh4.four.internal2 = 35;
+
+ __builtin_clear_padding (&p1);
+ __builtin_clear_padding (&sh1);
+ __builtin_clear_padding (&a1);
+ __builtin_clear_padding (&bh1);
+ __builtin_clear_padding (&th1);
+
+ if (__builtin_memcmp (&p1, &p2, sizeof (p1))
+ || __builtin_memcmp (&sh1, &sh2, sizeof (sh1))
+ || __builtin_memcmp (&a1, &a2, sizeof (a1))
+ || __builtin_memcmp (&bh1, &bh2, sizeof (bh1))
+ || __builtin_memcmp (&th1, &th2, sizeof (th1)))
+ __builtin_abort ();
+ if (__builtin_memcmp (&p1, &p3, sizeof (p1))
+ || __builtin_memcmp (&sh1, &sh3, sizeof (sh1))
+ || __builtin_memcmp (&a1, &a3, sizeof (a1))
+ || __builtin_memcmp (&bh1, &bh3, sizeof (bh1))
+ || __builtin_memcmp (&th1, &th3, sizeof (th1)))
+ __builtin_abort ();
+ if (__builtin_memcmp (&p1, &p4, sizeof (p1))
+ || __builtin_memcmp (&sh1, &sh4, sizeof (sh1))
+ || __builtin_memcmp (&a1, &a4, sizeof (a1))
+ || __builtin_memcmp (&bh1, &bh4, sizeof (bh1))
+ || __builtin_memcmp (&th1, &th4, sizeof (th1)))
+ __builtin_abort ();
+
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/builtin-shufflevector-2.c b/gcc/testsuite/c-c++-common/builtin-shufflevector-2.c
new file mode 100644
index 0000000..78cec16
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/builtin-shufflevector-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+typedef long v4di __attribute__((vector_size(4 * sizeof (long))));
+typedef int v4si __attribute__((vector_size(4 * sizeof (int))));
+typedef int v8si __attribute__((vector_size(8 * sizeof (int))));
+
+v4si res, a, b;
+v4di resl, al, bl;
+v8si res8, a8, b8;
+void foo (void)
+{
+ res = __builtin_shufflevector (a, 0, 0, 1, 4, 5); /* { dg-error "must be vectors" } */
+ res = __builtin_shufflevector (a, b, 0, 1, 4, 5, 6); /* { dg-error "power of two" } */
+ res = __builtin_shufflevector (a, b, 0, 1, 4, 8); /* { dg-error "invalid" } */
+ res = __builtin_shufflevector (a, b, 0, 1, -4, 5); /* { dg-error "invalid" } */
+ res = __builtin_shufflevector (a, bl, 0, 1, 4, 5); /* { dg-error "same element type" } */
+ resl = __builtin_shufflevector (a, b, 0, 1, 4, 5); /* { dg-error "" } incompatible types */
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/file-name-1.c b/gcc/testsuite/c-c++-common/cpp/file-name-1.c
new file mode 100644
index 0000000..2b476e3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/file-name-1.c
@@ -0,0 +1,22 @@
+/* { dg-do preprocess } */
+/* { dg-additional-options -Wno-pedantic } */
+
+main-1 __FILE_NAME__
+
+# 7 "inner.h" 1
+inner-1 __FILE_NAME__
+# 9 "subdir/inside.h" 1
+inside-1 __FILE_NAME__
+inside-2 __FILE__
+# 11 "" 2
+inner-2 __FILE_NAME__
+#13 "" 2
+main-2 __FILE_NAME__
+
+
+/* { dg-final { scan-file file-name-1.i "main-1 \"\[^\n]*file-name-1.c\"\n" } } */
+/* { dg-final { scan-file file-name-1.i "main-2 \"\[^\n]*file-name-1.c\"\n" } } */
+/* { dg-final { scan-file file-name-1.i "inner-1 \"inner.h\"\n" } } */
+/* { dg-final { scan-file file-name-1.i "inner-2 \"inner.h\"\n" } } */
+/* { dg-final { scan-file file-name-1.i "inside-1 \"inside.h\"\n" } } */
+/* { dg-final { scan-file file-name-1.i "inside-2 \"subdir/inside.h\"\n" } } */
diff --git a/gcc/testsuite/c-c++-common/cpp/va-opt-3.c b/gcc/testsuite/c-c++-common/cpp/va-opt-3.c
index 1a5a7b2..5b4f175 100644
--- a/gcc/testsuite/c-c++-common/cpp/va-opt-3.c
+++ b/gcc/testsuite/c-c++-common/cpp/va-opt-3.c
@@ -85,10 +85,10 @@ t25 f19 (f16 (), 1);
t26 f20 (f21 (), 2);
/* { dg-final { scan-file va-opt-3.i "t26 f17 h;" } } */
t27 f22 (, x);
-/* { dg-final { scan-file va-opt-3.i "t27 123;" } } */
+/* { dg-final { scan-file va-opt-3.i "t27 1 23;" } } */
t28 f23 (, x);
-/* { dg-final { scan-file va-opt-3.i "t28 123;" } } */
+/* { dg-final { scan-file va-opt-3.i "t28 1 23;" } } */
t29 f24 (, x);
-/* { dg-final { scan-file va-opt-3.i "t29 123;" } } */
+/* { dg-final { scan-file va-opt-3.i "t29 12 3;" } } */
t30 f25 (, x);
-/* { dg-final { scan-file va-opt-3.i "t30 123;" } } */
+/* { dg-final { scan-file va-opt-3.i "t30 12 3;" } } */
diff --git a/gcc/testsuite/c-c++-common/cpp/va-opt-5.c b/gcc/testsuite/c-c++-common/cpp/va-opt-5.c
new file mode 100644
index 0000000..b687ced
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/va-opt-5.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "-std=c++20" { target c++ } } */
+
+#define lparen (
+#define a0 fooa0
+#define a1 fooa1 a0
+#define a2 fooa2 a1
+#define a3 fooa3 a2
+#define a() b lparen )
+#define b() c lparen )
+#define c() d lparen )
+#define g h
+#define i(j) j
+#define f(...) #__VA_OPT__(g i(0))
+#define k(x,...) # __VA_OPT__(x) #x #__VA_OPT__(__VA_ARGS__)
+#define l(x,...) #__VA_OPT__(a1 x)
+#define m(x,...) "a()" #__VA_OPT__(a3 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a3) "a()"
+#define n(x,...) = #__VA_OPT__(a3 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a3) #x #__VA_OPT__(a0 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a0) ;
+#define o(x, ...) #__VA_OPT__(x##x x##x)
+#define p(x, ...) #__VA_OPT__(_Pragma ("foobar"))
+#define q(...) #__VA_OPT__(/* foo */x/* bar */)
+const char *v1 = f();
+const char *v2 = f(123);
+const char *v3 = k(1);
+const char *v4 = k(1, 2, 3 );
+const char *v5 = l(a());
+const char *v6 = l(a1 a(), 1);
+const char *v7 = m();
+const char *v8 = m(,);
+const char *v9 = m(,a3);
+const char *v10 = m(a3,a(),a0);
+const char *v11 n()
+const char *v12 n(,)
+const char *v13 n(,a0)
+const char *v14 n(a0, a(),a0)
+const char *v15 = o(, 0);
+const char *v16 = p(0);
+const char *v17 = p(0, 1);
+const char *v18 = q();
+const char *v19 = q(1);
+
+int
+main ()
+{
+ if (__builtin_strcmp (v1, "")
+ || __builtin_strcmp (v2, "g i(0)")
+ || __builtin_strcmp (v3, "1")
+ || __builtin_strcmp (v4, "112, 3")
+ || __builtin_strcmp (v5, "")
+ || __builtin_strcmp (v6, "a1 fooa1 fooa0 b ( )")
+ || __builtin_strcmp (v7, "a()a()")
+ || __builtin_strcmp (v8, "a()a()")
+ || __builtin_strcmp (v9, "a()a3 fooa3 fooa2 fooa1 fooa0 a3c a3a()")
+ || __builtin_strcmp (v10, "a()a3 b ( ),fooa0 a3a(),a0a3c a3a()")
+ || __builtin_strcmp (v11, "")
+ || __builtin_strcmp (v12, "")
+ || __builtin_strcmp (v13, "a3 fooa0 a0c a3a0 fooa0 a0c a0")
+ || __builtin_strcmp (v14, "a3 b ( ),fooa0 a0a(),a0a0c a3a0a0 b ( ),fooa0 a0a(),a0a0c a0")
+ || __builtin_strcmp (v15, "")
+ || __builtin_strcmp (v16, "")
+ || __builtin_strcmp (v17, "_Pragma (\"foobar\")")
+ || __builtin_strcmp (v18, "")
+ || __builtin_strcmp (v19, "x"))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/va-opt-6.c b/gcc/testsuite/c-c++-common/cpp/va-opt-6.c
new file mode 100644
index 0000000..8a7761b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/va-opt-6.c
@@ -0,0 +1,17 @@
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "-std=c++20" { target c++ } } */
+
+#define a ""
+#define b(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"\"\" does not give a valid preprocessing token" } */
+#define c(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"1\"\" does not give a valid preprocessing token" } */
+#define d(...) #__VA_OPT__(1) ## !
+#define e(...) #__VA_OPT__(1) ## !
+#define f(...) #__VA_OPT__(. ## !)
+#define g(...) #__VA_OPT__(. ## !)
+b()
+c(1)
+d( ) /* { dg-error "pasting \"\"\"\" and \"!\" does not give a valid preprocessing token" } */
+e( 1 ) /* { dg-error "pasting \"\"1\"\" and \"!\" does not give a valid preprocessing token" } */
+f()
+g(0) /* { dg-error "pasting \".\" and \"!\" does not give a valid preprocessing token" } */
diff --git a/gcc/testsuite/c-c++-common/cpp/va-opt-7.c b/gcc/testsuite/c-c++-common/cpp/va-opt-7.c
new file mode 100644
index 0000000..06cdb25
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/va-opt-7.c
@@ -0,0 +1,101 @@
+/* PR preprocessor/101488 */
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "-std=c++2a" { target c++ } } */
+
+#define f0() n
+#define f1(x,...) a ## __VA_OPT__ (a) ## a
+#define f2(x,...) a ## __VA_OPT__ () ## a
+#define f3(x,...) a ## __VA_OPT__ (x) ## a
+#define f4(x,...) a ## __VA_OPT__ (x##x) ## a
+#define f5(x,...) a ## __VA_OPT__ (x##x 1) ## a
+#define f6(x,...) a ## __VA_OPT__ (1 x##x) ## a
+#define f7(x,...) __VA_OPT__ (f0 x ## x ) ## 1
+#define f8(x,...) __VA_OPT__ (f0 x) ## 1
+#define f9(x,...) f0 ## __VA_OPT__ (x 1) ## 1
+#define f10(x,...) f0 ## __VA_OPT__ (x ## x 1) ## 1
+#define f11(x, ...) __VA_OPT__(a x ## x) ## b
+#define f12(x, ...) a ## __VA_OPT__(x ## x b)
+#define f13(x) x ## x b
+#define ab def
+#define bc ghi
+#define abc jkl
+#define f14(x, ...) a ## __VA_OPT__(x b x) ## c
+t1 f1(,);
+/* { dg-final { scan-file va-opt-7.i "t1 aa;" } } */
+t2 f1(,1);
+/* { dg-final { scan-file va-opt-7.i "t2 aaa;" } } */
+t3 f1(2,1);
+/* { dg-final { scan-file va-opt-7.i "t3 aaa;" } } */
+t4 f2(,);
+/* { dg-final { scan-file va-opt-7.i "t4 aa;" } } */
+t5 f2(,1);
+/* { dg-final { scan-file va-opt-7.i "t5 aa;" } } */
+t6 f2(2,1);
+/* { dg-final { scan-file va-opt-7.i "t6 aa;" } } */
+t7 f3(,);
+/* { dg-final { scan-file va-opt-7.i "t7 aa;" } } */
+t8 f3(,1);
+/* { dg-final { scan-file va-opt-7.i "t8 aa;" } } */
+t9 f3(2,1);
+/* { dg-final { scan-file va-opt-7.i "t9 a2a;" } } */
+t10 f4(,);
+/* { dg-final { scan-file va-opt-7.i "t10 aa;" } } */
+t11 f4(,1);
+/* { dg-final { scan-file va-opt-7.i "t11 aa;" } } */
+t12 f4(2,1);
+/* { dg-final { scan-file va-opt-7.i "t12 a22a;" } } */
+t13 f5(,);
+/* { dg-final { scan-file va-opt-7.i "t13 aa;" } } */
+t14 f5(,1);
+/* { dg-final { scan-file va-opt-7.i "t14 a 1a;" } } */
+t15 f5(2,1);
+/* { dg-final { scan-file va-opt-7.i "t15 a22 1a;" } } */
+t16 f6(,);
+/* { dg-final { scan-file va-opt-7.i "t16 aa;" } } */
+t17 f6(,1);
+/* { dg-final { scan-file va-opt-7.i "t17 a1 a;" } } */
+t18 f6(2,1);
+/* { dg-final { scan-file va-opt-7.i "t18 a1 22a;" } } */
+t19 f7(,);
+/* { dg-final { scan-file va-opt-7.i "t19 1;" } } */
+t20 f7(,1);
+/* { dg-final { scan-file va-opt-7.i "t20 f0 1;" } } */
+t21 f7(2,1);
+/* { dg-final { scan-file va-opt-7.i "t21 f0 221;" } } */
+t22 f8(,);
+/* { dg-final { scan-file va-opt-7.i "t22 1;" } } */
+t23 f8(,1);
+/* { dg-final { scan-file va-opt-7.i "t23 f0 1;" } } */
+t24 f8(2,1);
+/* { dg-final { scan-file va-opt-7.i "t24 f0 21;" } } */
+t25 f9(,);
+/* { dg-final { scan-file va-opt-7.i "t25 f01;" } } */
+t26 f9(,1);
+/* { dg-final { scan-file va-opt-7.i "t26 f0 11;" } } */
+t27 f9(2,1);
+/* { dg-final { scan-file va-opt-7.i "t27 f02 11;" } } */
+t28 f10(,);
+/* { dg-final { scan-file va-opt-7.i "t28 f01;" } } */
+t29 f10(,1);
+/* { dg-final { scan-file va-opt-7.i "t29 f0 11;" } } */
+t30 f10(2,1);
+/* { dg-final { scan-file va-opt-7.i "t30 f022 11;" } } */
+t31 f11(,);
+/* { dg-final { scan-file va-opt-7.i "t31 b;" } } */
+t32 f11(,1);
+/* { dg-final { scan-file va-opt-7.i "t32 a b;" } } */
+t33 f11(2,1);
+/* { dg-final { scan-file va-opt-7.i "t33 a 22b;" } } */
+t34 f12(,);
+/* { dg-final { scan-file va-opt-7.i "t34 a;" } } */
+t35 f12(,1);
+/* { dg-final { scan-file va-opt-7.i "t35 a b;" } } */
+t36 f12(2,1);
+/* { dg-final { scan-file va-opt-7.i "t36 a22 b;" } } */
+t37 f14(,);
+/* { dg-final { scan-file va-opt-7.i "t37 ac;" } } */
+t38 f14(,1);
+/* { dg-final { scan-file va-opt-7.i "t38 a b c;" } } */
+t39 f14(f13(),1);
+/* { dg-final { scan-file va-opt-7.i "t39 def b ghi;" } } */
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
index 95c433d..c09c834 100644
--- a/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
@@ -1,9 +1,16 @@
-/* { dg-skip-if "" { ! "powerpc*-*-linux*" } } */
+/* { dg-require-effective-target dfp } */
-/* Test decimal float conversions to and from IBM 128-bit long double.
- Checks are skipped at runtime if long double is not 128 bits.
- Don't force 128-bit long doubles because runtime support depends
- on glibc. */
+/* We need the long double type to be IBM 128-bit because the CONVERT_TO_PINF
+ tests will fail if we use IEEE 128-bit floating point. This is due to IEEE
+ 128-bit having a larger exponent range than IBM 128-bit extended double. So
+ tests that would generate an infinity with IBM 128-bit will generate a
+ normal number with IEEE 128-bit. */
+
+/* { dg-require-effective-target long_double_ibm128 } */
+/* { dg-options "-O2" } */
+/* { dg-add-options long_double_ibm128 } */
+
+/* Test decimal float conversions to and from IBM 128-bit long double. */
#include "convert.h"
@@ -36,9 +43,6 @@ CONVERT_TO_PINF (312, tf, sd, 1.6e+308L, d32)
int
main ()
{
- if (sizeof (long double) != 16)
- return 0;
-
convert_101 ();
convert_102 ();
diff --git a/gcc/testsuite/c-c++-common/dump-ada-spec-14.c b/gcc/testsuite/c-c++-common/dump-ada-spec-14.c
index bfdec61..291eea8 100644
--- a/gcc/testsuite/c-c++-common/dump-ada-spec-14.c
+++ b/gcc/testsuite/c-c++-common/dump-ada-spec-14.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-fdump-ada-spec" } */
-struct __attribute__((packed)) S /* { dg-warning "unsupported record layout" } */
+struct __attribute__((packed)) S /* { dg-warning "packed layout" } */
{
char c;
int t;
diff --git a/gcc/testsuite/c-c++-common/goacc-gomp/atomic.c b/gcc/testsuite/c-c++-common/goacc-gomp/atomic.c
index 4d18f23..e1ab03e 100644
--- a/gcc/testsuite/c-c++-common/goacc-gomp/atomic.c
+++ b/gcc/testsuite/c-c++-common/goacc-gomp/atomic.c
@@ -37,7 +37,8 @@ foo ()
/* { dg-final { scan-tree-dump-times "i = #pragma omp atomic read acquire" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "i = #pragma omp atomic read relaxed" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "#pragma omp atomic release" 2 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp atomic acq_rel" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp atomic release" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "#pragma omp atomic relaxed" 2 "original" } } */
/* { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture acq_rel" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture relaxed" 2 "original" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c
index aaf0e7a..b0b7837 100644
--- a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c
+++ b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c
@@ -1,7 +1,14 @@
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+ testing/documenting aspects of that functionality. */
+
+
void
f_acc_data (void)
{
#pragma acc data
+ /* { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+ /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } */
{
int i;
#pragma omp atomic write
@@ -13,6 +20,8 @@ void
f_acc_kernels (void)
{
#pragma acc kernels
+ /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 }
+ { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-2 } */
{
int i;
#pragma omp atomic write
@@ -27,6 +36,9 @@ f_acc_loop (void)
int i;
#pragma acc loop
+ /* { dg-note {variable 'i\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+ /* { dg-note {variable 'i' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
+ { dg-bogus {note: variable 'i' ought to be adjusted for OpenACC privatization level: 'UNKNOWN'} "TODO" { xfail *-*-* } .-3 } */
for (i = 0; i < 2; ++i)
{
#pragma omp atomic write
@@ -38,6 +50,8 @@ void
f_acc_parallel (void)
{
#pragma acc parallel
+ /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 }
+ { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-2 } */
{
int i;
#pragma omp atomic write
diff --git a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c
index 1a33242..ddbd247 100644
--- a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c
+++ b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c
@@ -162,8 +162,8 @@ f_omp (void)
#pragma acc data /* { dg-error "OpenACC .data. construct inside of OpenMP .target. region" } */
;
#pragma acc update host(i) /* { dg-error "OpenACC .update. construct inside of OpenMP .target. region" } */
-#pragma acc enter data copyin(i) /* { dg-error "OpenACC .enter/exit data. construct inside of OpenMP .target. region" } */
-#pragma acc exit data delete(i) /* { dg-error "OpenACC .enter/exit data. construct inside of OpenMP .target. region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC .enter data. construct inside of OpenMP .target. region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC .exit data. construct inside of OpenMP .target. region" } */
#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
diff --git a/gcc/testsuite/c-c++-common/goacc/acc-icf.c b/gcc/testsuite/c-c++-common/goacc/acc-icf.c
index 98b536c..9cf119b 100644
--- a/gcc/testsuite/c-c++-common/goacc/acc-icf.c
+++ b/gcc/testsuite/c-c++-common/goacc/acc-icf.c
@@ -2,7 +2,12 @@
/* { dg-additional-options "-fopenacc -O2 -fdump-ipa-icf" } */
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
#pragma acc routine gang
+/* { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .+3 }
+ TODO It's the compiler's own decision to not use 'worker' parallelism here, so it doesn't make sense to bother the user about it. */
int
routine1 (int n)
{
@@ -16,6 +21,8 @@ routine1 (int n)
}
#pragma acc routine gang
+/* { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .+3 }
+ TODO It's the compiler's own decision to not use 'worker' parallelism here, so it doesn't make sense to bother the user about it. */
int
routine2 (int n)
{
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
index d4c4b2c..1d12658 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
@@ -5,7 +5,10 @@
{ dg-additional-options "-fopt-info-optimized-omp" }
{ dg-additional-options "-fdump-tree-ompexp" }
{ dg-additional-options "-fdump-tree-parloops1-all" }
- { dg-additional-options "-fdump-tree-oaccdevlow" } */
+ { dg-additional-options "-fdump-tree-oaccloops" } */
+
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
#define N 1024
@@ -35,6 +38,6 @@ void KERNELS ()
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
- { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccdevlow" } } */
+ { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
index 16e9b9e..bdf7b4a 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
@@ -5,7 +5,10 @@
{ dg-additional-options "-fopt-info-optimized-omp" }
{ dg-additional-options "-fdump-tree-ompexp" }
{ dg-additional-options "-fdump-tree-parloops1-all" }
- { dg-additional-options "-fdump-tree-oaccdevlow" } */
+ { dg-additional-options "-fdump-tree-oaccloops" } */
+
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
#define N 1024
@@ -31,6 +34,6 @@ void KERNELS ()
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
- { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccdevlow" } } */
+ { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
index 933d766..9056aa6 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
@@ -4,7 +4,10 @@
/* { dg-additional-options "-O2" }
{ dg-additional-options "-fopt-info-optimized-omp" }
{ dg-additional-options "-fdump-tree-ompexp" }
- { dg-additional-options "-fdump-tree-oaccdevlow" } */
+ { dg-additional-options "-fdump-tree-oaccloops" } */
+
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
#define N 1024
@@ -24,6 +27,6 @@ void PARALLEL ()
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
- { dg-final { scan-tree-dump-times "(?n)Function is OpenACC parallel offload" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint\\)\\)" 1 "oaccdevlow" } } */
+ { dg-final { scan-tree-dump-times "(?n)Function is OpenACC parallel offload" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-routine-nohost.c b/gcc/testsuite/c-c++-common/goacc/classify-routine-nohost.c
new file mode 100644
index 0000000..9985582
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/classify-routine-nohost.c
@@ -0,0 +1,41 @@
+/* Check offloaded function's attributes and classification for OpenACC
+ routine with 'nohost' clause. */
+
+/* { dg-additional-options "-O2" }
+ { dg-additional-options "-fopt-info-optimized-omp" }
+ { dg-additional-options "-fdump-tree-ompexp" }
+ { dg-additional-options "-fdump-tree-oaccloops" } */
+
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
+#define N 1024
+
+extern unsigned int *__restrict a;
+extern unsigned int *__restrict b;
+extern unsigned int *__restrict c;
+#pragma acc declare copyin (a, b) create (c)
+
+#pragma acc routine nohost worker
+void ROUTINE ()
+{
+#pragma acc loop /* { dg-bogus "assigned OpenACC .* loop parallelism" } */
+ for (unsigned int i = 0; i < N; i++)
+ c[i] = a[i] + b[i];
+}
+
+/* Check the offloaded function's attributes.
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(omp declare target \\(nohost worker\\), oacc function \\(0 1, 1 0, 1 0\\)\\)\\)" 1 "ompexp" } } */
+
+/* Check the offloaded function's classification.
+ { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE' has 'nohost' clause" 1 "oaccloops" { target c } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'void ROUTINE\\(\\)' has 'nohost' clause" 1 "oaccloops" { target { c++ && { ! offloading_enabled } } } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE\\(\\)' has 'nohost' clause" 1 "oaccloops" { target { c++ && offloading_enabled } } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE' discarded" 1 "oaccloops" { target c } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'void ROUTINE\\(\\)' discarded" 1 "oaccloops" { target { c++ && { ! offloading_enabled } } } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE\\(\\)' discarded" 1 "oaccloops" { target { c++ && offloading_enabled } } } }
+ TODO See PR101551 for 'offloading_enabled' differences.
+ { dg-final { scan-tree-dump-not "(?n)Compute dimensions" "oaccloops" } }
+ { dg-final { scan-tree-dump-not "(?n)__attribute__\\(.*omp declare target \\(nohost" "oaccloops" } }
+ { dg-final { scan-tree-dump-not "(?n)void ROUTINE \\(\\)" "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-routine.c b/gcc/testsuite/c-c++-common/goacc/classify-routine.c
index 0b9ba6e..f7f0454 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-routine.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-routine.c
@@ -4,7 +4,10 @@
/* { dg-additional-options "-O2" }
{ dg-additional-options "-fopt-info-optimized-omp" }
{ dg-additional-options "-fdump-tree-ompexp" }
- { dg-additional-options "-fdump-tree-oaccdevlow" } */
+ { dg-additional-options "-fdump-tree-oaccloops" } */
+
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
#define N 1024
@@ -26,6 +29,14 @@ void ROUTINE ()
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
- { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(0 1, 1 1, 1 1\\), omp declare target \\(worker\\), oacc function \\(0 1, 1 0, 1 0\\)\\)\\)" 1 "oaccdevlow" } } */
+ { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE' doesn't have 'nohost' clause" 1 "oaccloops" { target c } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'void ROUTINE\\(\\)' doesn't have 'nohost' clause" 1 "oaccloops" { target { c++ && { ! offloading_enabled } } } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE\\(\\)' doesn't have 'nohost' clause" 1 "oaccloops" { target { c++ && offloading_enabled } } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE' not discarded" 1 "oaccloops" { target c } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'void ROUTINE\\(\\)' not discarded" 1 "oaccloops" { target { c++ && { ! offloading_enabled } } } } }
+ { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE\\(\\)' not discarded" 1 "oaccloops" { target { c++ && offloading_enabled } } } }
+ TODO See PR101551 for 'offloading_enabled' differences.
+ { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(0 1, 1 1, 1 1\\), omp declare target \\(worker\\), oacc function \\(0 1, 1 0, 1 0\\)\\)\\)" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)void ROUTINE \\(\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-serial.c b/gcc/testsuite/c-c++-common/goacc/classify-serial.c
index 94ace1b..f41c141 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-serial.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-serial.c
@@ -4,7 +4,10 @@
/* { dg-additional-options "-O2" }
{ dg-additional-options "-fopt-info-optimized-omp" }
{ dg-additional-options "-fdump-tree-ompexp" }
- { dg-additional-options "-fdump-tree-oaccdevlow" } */
+ { dg-additional-options "-fdump-tree-oaccloops" } */
+
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
#define N 1024
@@ -15,6 +18,11 @@ extern unsigned int *__restrict c;
void SERIAL ()
{
#pragma acc serial loop copyin (a[0:N], b[0:N]) copyout (c[0:N]) /* { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } */
+ /* { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 }
+ { dg-bogus "warning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 }
+ { dg-bogus "warning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 }
+ TODO Should we really diagnose this if the user explicitly requested 'serial'?
+ TODO Should we instead diagnose ('-Wextra' category?) that the user may enable use of parallelism if replacing 'serial' with 'parallel', if applicable? */
for (unsigned int i = 0; i < N; i++)
c[i] = a[i] + b[i];
}
@@ -24,6 +32,6 @@ void SERIAL ()
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
- { dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint\\)\\)" 1 "oaccdevlow" } } */
+ { dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/collapse-2.c b/gcc/testsuite/c-c++-common/goacc/collapse-2.c
new file mode 100644
index 0000000..e46028c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/collapse-2.c
@@ -0,0 +1,56 @@
+/* Test for ICE as reported in PR98088. */
+
+int i, j;
+
+void
+f1 (void)
+{
+ #pragma acc parallel
+ #pragma acc loop collapse (2)
+ for (i = 5; i > 5; i--)
+ for (j = 5; j > 0; j--)
+ ;
+}
+
+void
+f2 (void)
+{
+ #pragma acc parallel
+ #pragma acc loop collapse (2)
+ for (i = 0; i < 5; i++)
+ for (j = 5; j > 0; j--)
+ ;
+}
+
+void
+f3 (void)
+{
+ #pragma acc parallel
+ #pragma acc loop collapse (2)
+ for (i = 5; i >= 0; i--)
+ for (j = 5; j >= 0; j--)
+ ;
+}
+
+void f4 ()
+{
+ #pragma acc parallel loop tile(2, 3)
+ for (int i = 0; i > 8; i++)
+ for (int j = 0; j > 8; j++);
+}
+
+void f5 ()
+{
+ #pragma acc parallel loop tile(2, 3)
+ for (int i = 0; i > 8; i++)
+ for (long j = 0; j > 8; j++);
+}
+
+void
+f6 (int a[32][32])
+{
+ #pragma acc parallel loop collapse(2)
+ for (int i = 16; i > 8; i--)
+ for (int j = 16; j > 8; j--)
+ a[i][j] = i + j;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c b/gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c
new file mode 100644
index 0000000..6ee7bd0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c
@@ -0,0 +1,124 @@
+/* Diagnostics about potentially suboptimal choices related to OpenACC
+ parallelism.
+
+ { dg-additional-options "-Wopenacc-parallelism" }
+*/
+
+
+//TODO 'kernels'
+
+//TODO 'serial'
+
+//TODO 'routine'
+
+//TODO Fortran
+
+
+static void f1 ()
+{
+ int ary[10];
+
+
+#pragma acc parallel num_gangs (1)
+ /* { dg-warning "region contains gang partitioned code but is not gang partitioned" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop gang
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel num_workers (1)
+ /* { dg-warning "region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop worker
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel vector_length (1)
+ /* { dg-warning "region contains vector partitioned code but is not vector partitioned" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop vector
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+}
+
+
+static void f2 ()
+{
+ int ary[10];
+
+
+#pragma acc parallel num_gangs (8)
+ /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop worker
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel num_gangs (8)
+ /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop vector
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel num_gangs (8)
+ /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop worker vector
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel num_workers (8)
+ /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop gang
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel num_workers (8)
+ /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop vector
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel num_workers (8)
+ /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop gang vector
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel vector_length (8)
+ /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop gang
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel vector_length (8)
+ /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop worker
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+
+#pragma acc parallel vector_length (8)
+ /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+ {
+ #pragma acc loop gang worker
+ for (int i = 0; i < 10; i++)
+ ary[i] = i;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/finalize-1.c b/gcc/testsuite/c-c++-common/goacc/finalize-1.c
index 3d64b2e..54bf1b7 100644
--- a/gcc/testsuite/c-c++-common/goacc/finalize-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/finalize-1.c
@@ -13,25 +13,25 @@ void f ()
{
#pragma acc exit data delete (del_r)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(release:del_r\\);$" 1 "original" } }
- { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(release:del_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } } */
+ { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(release:del_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } } */
#pragma acc exit data finalize delete (del_f)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(release:del_f\\) finalize;$" 1 "original" } }
- { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(delete:del_f \\\[len: \[0-9\]+\\\]\\) finalize$" 1 "gimple" } } */
+ { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(delete:del_f \\\[len: \[0-9\]+\\\]\\) finalize$" 1 "gimple" } } */
#pragma acc exit data finalize delete (del_f_p[2:5])
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(release:\\*\\(del_f_p \\+ 2\\) \\\[len: 5\\\]\\) map\\(firstprivate:del_f_p \\\[pointer assign, bias: 2\\\]\\) finalize;$" 1 "original" } }
- { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(delete:\[^ \]+ \\\[len: 5\\\]\\) finalize$" 1 "gimple" } } */
+ { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(delete:\[^ \]+ \\\[len: 5\\\]\\) finalize$" 1 "gimple" } } */
#pragma acc exit data copyout (cpo_r)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(from:cpo_r\\);$" 1 "original" } }
- { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(from:cpo_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } } */
+ { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(from:cpo_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } } */
#pragma acc exit data copyout (cpo_f) finalize
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data finalize map\\(from:cpo_f\\);$" 1 "original" } }
- { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data finalize map\\(force_from:cpo_f \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } } */
+ { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data finalize map\\(force_from:cpo_f \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } } */
#pragma acc exit data copyout (cpo_f_p[4:10]) finalize
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data finalize map\\(from:\\*\\(cpo_f_p \\+ 4\\) \\\[len: 10\\\]\\) map\\(firstprivate:cpo_f_p \\\[pointer assign, bias: 4\\\]\\);$" 1 "original" } }
- { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data finalize map\\(force_from:\[^ \]+ \\\[len: 10\\\]\\)$" 1 "gimple" } } */
+ { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data finalize map\\(force_from:\[^ \]+ \\\[len: 10\\\]\\)$" 1 "gimple" } } */
}
diff --git a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
index 7bb1153..a480725 100644
--- a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
@@ -1,5 +1,5 @@
/* { dg-additional-options "-fdump-tree-gimple" } */
-/* { dg-additional-options "-fopenacc-kernels=decompose" }
+/* { dg-additional-options "--param=openacc-kernels=decompose" }
{ dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } */
void
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c
index e906443..f549cba 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c
@@ -2,9 +2,12 @@
/* { dg-additional-options "-fopt-info-omp-all" } */
/* { dg-additional-options "-fdump-tree-gimple" } */
-/* { dg-additional-options "-fopenacc-kernels=decompose" }
+/* { dg-additional-options "--param=openacc-kernels=decompose" }
{ dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } */
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
/* See also '../../gfortran.dg/goacc/kernels-decompose-1.f95'. */
/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c
index ec0f75c..cdf85d4 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c
@@ -1,9 +1,12 @@
/* Test OpenACC 'kernels' construct decomposition. */
/* { dg-additional-options "-fopt-info-omp-all" } */
-/* { dg-additional-options "-fopenacc-kernels=decompose" }
+/* { dg-additional-options "--param=openacc-kernels=decompose" }
/* { dg-additional-options "-O2" } for 'parloops'. */
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
/* See also '../../gfortran.dg/goacc/kernels-decompose-2.f95'. */
/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
@@ -116,6 +119,7 @@ main ()
}
#pragma acc kernels
+ /* { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 } */
{
y = f_g (a[5]); /* { dg-line l_part[incr c_part] } */
/*TODO If such a construct is placed in its own part (like it is, here), can't this actually use gang paralelism, instead of "gang-single"?
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
index 82e7bd1..8c3884b 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
@@ -1,7 +1,7 @@
/* Test OpenACC 'kernels' construct decomposition. */
/* { dg-additional-options "-fopt-info-omp-all" } */
-/* { dg-additional-options "-fopenacc-kernels=decompose" } */
+/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */
/* { dg-ice "TODO" }
{ dg-prune-output "during GIMPLE pass: omplower" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
index 569f87a..8bf60a9 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
@@ -1,6 +1,6 @@
/* Test OpenACC 'kernels' construct decomposition. */
-/* { dg-additional-options "-fopenacc-kernels=decompose" } */
+/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */
/* { dg-ice "TODO" }
{ dg-prune-output "during GIMPLE pass: omplower" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/mdc-1.c b/gcc/testsuite/c-c++-common/goacc/mdc-1.c
index 337c1f7..c2b8dc6 100644
--- a/gcc/testsuite/c-c++-common/goacc/mdc-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/mdc-1.c
@@ -30,7 +30,7 @@ t1 ()
}
#pragma acc enter data copyin(a)
-#pragma acc acc enter data attach(s.e)
+#pragma acc enter data attach(s.e)
#pragma acc exit data detach(s.e)
#pragma acc data attach(s.e)
@@ -43,14 +43,15 @@ t1 ()
}
}
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data map.to:s .len: 32.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_data map.to:s .len: 32.." 1 "omplower" } } */
/* { dg-final { scan-tree-dump-times "pragma omp target oacc_data map.tofrom:.z .len: 40.. map.struct:s .len: 1.. map.alloc:s.a .len: 8.. map.tofrom:._1 .len: 40.. map.attach:s.a .bias: 0.." 1 "omplower" } } */
/* { dg-final { scan-tree-dump-times "pragma omp target oacc_parallel map.attach:s.e .bias: 0.. map.tofrom:s .len: 32" 1 "omplower" } } */
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data map.attach:a .bias: 0.." 1 "omplower" } } */
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data map.detach:a .bias: 0.." 1 "omplower" } } */
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data map.to:a .len: 8.." 1 "omplower" } } */
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data map.detach:s.e .bias: 0.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_data map.attach:a .bias: 0.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_exit_data map.detach:a .bias: 0.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_data map.to:a .len: 8.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_data map.attach:s.e .bias: 0.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_exit_data map.detach:s.e .bias: 0.." 1 "omplower" } } */
/* { dg-final { scan-tree-dump-times "pragma omp target oacc_data map.attach:s.e .bias: 0.." 1 "omplower" } } */
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data map.release:a .len: 8.." 1 "omplower" } } */
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data finalize map.force_detach:a .bias: 0.." 1 "omplower" } } */
-/* { dg-final { scan-tree-dump-times "pragma omp target oacc_enter_exit_data finalize map.force_detach:s.a .bias: 0.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_exit_data map.release:a .len: 8.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_exit_data finalize map.force_detach:a .bias: 0.." 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "pragma omp target oacc_exit_data finalize map.force_detach:s.a .bias: 0.." 1 "omplower" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/mdc-2.c b/gcc/testsuite/c-c++-common/goacc/mdc-2.c
index fae8667..df3ce54 100644
--- a/gcc/testsuite/c-c++-common/goacc/mdc-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/mdc-2.c
@@ -39,7 +39,7 @@ t1 ()
#pragma acc enter data attach(z[3]) /* { dg-error "expected pointer in .attach. clause" } */
#pragma acc exit data detach(z[3]) /* { dg-error "expected pointer in .detach. clause" } */
-#pragma acc acc enter data attach(s.e)
+#pragma acc enter data attach(s.e)
#pragma acc exit data detach(s.e) attach(z) /* { dg-error ".attach. is not valid for" } */
#pragma acc data attach(s.e)
diff --git a/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c b/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c
index 93a9111..5cfb327 100644
--- a/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c
@@ -14,8 +14,8 @@ f_acc_parallel (void)
#pragma acc data /* { dg-error ".data. construct inside of .parallel. region" } */
;
#pragma acc update host(i) /* { dg-error ".update. construct inside of .parallel. region" } */
-#pragma acc enter data copyin(i) /* { dg-error ".enter/exit data. construct inside of .parallel. region" } */
-#pragma acc exit data delete(i) /* { dg-error ".enter/exit data. construct inside of .parallel. region" } */
+#pragma acc enter data copyin(i) /* { dg-error ".enter data. construct inside of .parallel. region" } */
+#pragma acc exit data delete(i) /* { dg-error ".exit data. construct inside of .parallel. region" } */
}
}
@@ -33,8 +33,8 @@ f_acc_kernels (void)
#pragma acc data /* { dg-error ".data. construct inside of .kernels. region" } */
;
#pragma acc update host(i) /* { dg-error ".update. construct inside of .kernels. region" } */
-#pragma acc enter data copyin(i) /* { dg-error ".enter/exit data. construct inside of .kernels. region" } */
-#pragma acc exit data delete(i) /* { dg-error ".enter/exit data. construct inside of .kernels. region" } */
+#pragma acc enter data copyin(i) /* { dg-error ".enter data. construct inside of .kernels. region" } */
+#pragma acc exit data delete(i) /* { dg-error ".exit data. construct inside of .kernels. region" } */
}
}
diff --git a/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c b/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c
index 57f682f..2a8d35d 100644
--- a/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c
@@ -1,11 +1,18 @@
/* Valid use of OpenACC parallelism dimensions clauses: num_gangs, num_workers,
vector_length. */
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
void f(int i)
{
#pragma acc kernels num_gangs(i) num_workers(i) vector_length(i)
;
#pragma acc parallel num_gangs(i) num_workers(i) vector_length(i)
+ /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO runtime" { xfail *-*-* } .-1 }
+ { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO runtime" { xfail *-*-* } .-2 }
+ { dg-bogus "warning: region is vector partitioned but does not contain vector partitioned code" "TODO runtime" { xfail *-*-* } .-3 }
+ TODO 'region is [...] partitioned' isn't correct for 'i == 1'. */
;
}
diff --git a/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c b/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c
index d7cc947..c5c0edc 100644
--- a/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c
+++ b/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c
@@ -1,3 +1,6 @@
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
int
main ()
{
@@ -7,6 +10,7 @@ main ()
#pragma acc data copy (dummy)
{
#pragma acc parallel num_gangs (10) copy (sum) reduction (+:sum)
+ /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */
{
int v = 5;
sum += 10 + v;
diff --git a/gcc/testsuite/c-c++-common/goacc/pr70688.c b/gcc/testsuite/c-c++-common/goacc/pr70688.c
index 5a23665..e96a853 100644
--- a/gcc/testsuite/c-c++-common/goacc/pr70688.c
+++ b/gcc/testsuite/c-c++-common/goacc/pr70688.c
@@ -1,3 +1,6 @@
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
const int n = 100;
int
@@ -22,6 +25,7 @@ parallel_reduction ()
#pragma acc data copy (dummy)
{
#pragma acc parallel num_gangs (10) copy (sum) reduction (+:sum)
+ /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */
{
int v = 5;
sum += 10 + v;
@@ -37,10 +41,12 @@ main ()
int i, s = 0;
#pragma acc parallel num_gangs (10) copy (s) reduction (+:s)
+ /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */
for (i = 0; i < n; i++)
s += i+1;
#pragma acc parallel num_gangs (10) reduction (+:s) copy (s)
+ /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */
for (i = 0; i < n; i++)
s += i+1;
diff --git a/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c b/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c
index d4e3995..38f6b7a 100644
--- a/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c
@@ -1,3 +1,7 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+ { dg-additional-options "--param=openacc-privatization=noisy" } for
+ testing/documenting aspects of that functionality. */
+
int
reduction ()
{
@@ -5,6 +9,8 @@ reduction ()
#pragma acc parallel
#pragma acc loop private (r) reduction (+:r)
+ /* { dg-note {variable 'r' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} r { target *-*-* } .-1 } */
+ /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} i { target *-*-* } .-2 } */
for (i = 0; i < 100; i++)
r += 10;
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c
new file mode 100644
index 0000000..43b39c2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c
@@ -0,0 +1,93 @@
+/* OpenACC privatization: 'loop' construct inside compute construct */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+ testing/documenting aspects of that functionality. */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-compute-loop.f90'. */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+ passed to 'incr' may be unset, and in that case, it will be set to [...]",
+ so to maintain compatibility with earlier Tcl releases, we manually
+ initialize counter variables:
+ { dg-line l_dummy[variable c_loop 0] }
+ { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+ "WARNING: dg-line var l_dummy defined, but not used". */
+
+extern int e;
+static int s;
+int g;
+
+void
+f (int i, int j, int a)
+{
+ extern int ex;
+ static int st;
+ int x, y;
+#pragma acc parallel
+#pragma acc loop collapse(2) private(a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_loop[incr c_loop] } */
+ for (i = 0; i < 20; ++i)
+ for (j = 0; j < 25; ++j)
+ {
+ __label__ ll;
+ /* Nested scopes fun. */
+ {
+ struct s_ss { int i; } ss;
+ {
+ extern int func (int *, int *, int *);
+ /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */
+ /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */
+
+ a = func (&i, &j, &a);
+ }
+ ss.i = a;
+ {
+ extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+ extern int ext;
+ static int sta;
+ a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+ }
+ }
+ x = a;
+#pragma acc atomic write
+ y = a;
+ {
+ int xx, yy;
+ xx = a;
+#pragma acc atomic write
+ yy = a;
+ }
+
+ ll:
+ ;
+ }
+ /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'j\.1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'i\.0' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_loop$c_loop }
+ { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_loop$c_loop } */
+ /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c
new file mode 100644
index 0000000..b7c7bff
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c
@@ -0,0 +1,88 @@
+/* OpenACC privatization: compute construct */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+ testing/documenting aspects of that functionality. */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-compute.f90'. */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+ passed to 'incr' may be unset, and in that case, it will be set to [...]",
+ so to maintain compatibility with earlier Tcl releases, we manually
+ initialize counter variables:
+ { dg-line l_dummy[variable c_compute 0] }
+ { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+ "WARNING: dg-line var l_dummy defined, but not used". */
+
+extern int e;
+static int s;
+int g;
+
+void
+f (int i, int j, int a)
+{
+ extern int ex;
+ static int st;
+ int x, y;
+#pragma acc parallel private(i, j, a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_compute[incr c_compute] } */
+ {
+ __label__ ll;
+ /* Nested scopes fun. */
+ {
+ struct s_ss { int i; } ss;
+ {
+ extern int func (int *, int *, int *);
+ /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */
+ /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */
+
+ a = func (&i, &j, &a);
+ }
+ ss.i = a;
+ {
+ extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+ extern int ext;
+ static int sta;
+ a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+ }
+ }
+ x = a;
+#pragma acc atomic write
+ y = a;
+ {
+ int xx, yy;
+ xx = a;
+#pragma acc atomic write
+ yy = a;
+ }
+
+ ll:
+ ;
+ }
+ /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+ { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+ { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+ { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+ { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+ { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+ { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_compute$c_compute }
+ { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_compute$c_compute } */
+ /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "" { target *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
+ /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+ { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } */
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c
new file mode 100644
index 0000000..816e430
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c
@@ -0,0 +1,93 @@
+/* OpenACC privatization: 'loop' construct inside 'routine' */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+ testing/documenting aspects of that functionality. */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-routine_gang-loop.f90'. */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+ passed to 'incr' may be unset, and in that case, it will be set to [...]",
+ so to maintain compatibility with earlier Tcl releases, we manually
+ initialize counter variables:
+ { dg-line l_dummy[variable c_loop 0] }
+ { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+ "WARNING: dg-line var l_dummy defined, but not used". */
+
+extern int e;
+static int s;
+int g;
+
+#pragma acc routine gang
+void
+f (int i, int j, int a)
+{
+ extern int ex;
+ static int st;
+ int x, y;
+#pragma acc loop collapse(2) private(a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_loop[incr c_loop] } */
+ for (i = 0; i < 20; ++i)
+ for (j = 0; j < 25; ++j)
+ {
+ __label__ ll;
+ /* Nested scopes fun. */
+ {
+ struct s_ss { int i; } ss;
+ {
+ extern int func (int *, int *, int *);
+ /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */
+ /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */
+
+ a = func (&i, &j, &a);
+ }
+ ss.i = a;
+ {
+ extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+ extern int ext;
+ static int sta;
+ a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+ }
+ }
+ x = a;
+#pragma acc atomic write
+ y = a;
+ {
+ int xx, yy;
+ xx = a;
+#pragma acc atomic write
+ yy = a;
+ }
+
+ ll:
+ ;
+ }
+ /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'j\.1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'i\.0' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_loop$c_loop }
+ { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_loop$c_loop } */
+ /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+ /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c
new file mode 100644
index 0000000..f9f316e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c
@@ -0,0 +1,91 @@
+/* OpenACC privatization: 'routine' */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+ testing/documenting aspects of that functionality. */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-routine_gang.f90'. */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+ passed to 'incr' may be unset, and in that case, it will be set to [...]",
+ so to maintain compatibility with earlier Tcl releases, we manually
+ initialize counter variables:
+ { dg-line l_dummy[variable c_routine 0] }
+ { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+ "WARNING: dg-line var l_dummy defined, but not used". */
+
+extern int e;
+static int s;
+int g;
+#pragma acc declare device_resident(e, s, g)
+
+#pragma acc routine gang /* { dg-line l_routine[incr c_routine] } */
+void
+f (int i, int j, int a)
+{
+ extern int ex;
+ static int st;
+#pragma acc declare device_resident(ex /* , st */)
+ int x, y;
+ {
+ __label__ ll;
+ /* Nested scopes fun. */
+ {
+ struct s_ss { int i; } ss;
+ {
+ extern int func (int *, int *, int *);
+ /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */
+ /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */
+
+ a = func (&i, &j, &a);
+ }
+ ss.i = a;
+ {
+ extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+ extern int ext;
+ static int sta;
+#pragma acc declare device_resident(ext /* , sta */)
+ a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+ }
+ }
+ x = a;
+#pragma acc atomic write
+ y = a;
+ {
+ int xx, yy;
+ xx = a;
+#pragma acc atomic write
+ yy = a;
+ }
+
+ ll:
+ ;
+ }
+}
+ /* { dg-note {variable 'y' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'st' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'ex' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'g' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 's' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'e' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'a' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'j' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'i' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
+ /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+ { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
diff --git a/gcc/testsuite/c-c++-common/goacc/routine-1.c b/gcc/testsuite/c-c++-common/goacc/routine-1.c
index a756922..051f793 100644
--- a/gcc/testsuite/c-c++-common/goacc/routine-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/routine-1.c
@@ -1,15 +1,23 @@
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
#pragma acc routine gang
+/* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .+3 }
+ { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .+2 }
+ { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */
void gang (void)
{
}
#pragma acc routine worker
+/* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .+2 }
+ { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */
void worker (void)
{
}
#pragma acc routine vector
+/* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */
void vector (void)
{
}
diff --git a/gcc/testsuite/c-c++-common/goacc/routine-2.c b/gcc/testsuite/c-c++-common/goacc/routine-2.c
index be1510a..3bf33e8 100644
--- a/gcc/testsuite/c-c++-common/goacc/routine-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/routine-2.c
@@ -1,3 +1,7 @@
/* Test invalid use of the OpenACC 'routine' directive. */
#pragma acc routine (nothing) gang /* { dg-error "not been declared" } */
+
+
+#pragma acc routine nohost nohost /* { dg-error "too many 'nohost' clauses" } */
+extern void nohost (void);
diff --git a/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c b/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c
index a066f2b..33678fe 100644
--- a/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c
@@ -2,7 +2,13 @@
with the OpenACC 'routine' directive. The Fortran counterpart is
'../../gfortran.dg/goacc/routine-level-of-parallelism-1.f90'. */
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
#pragma acc routine gang
+/* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .+3 }
+ { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .+2 }
+ { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */
void g_1 (void)
{
}
diff --git a/gcc/testsuite/c-c++-common/goacc/routine-nohost-1.c b/gcc/testsuite/c-c++-common/goacc/routine-nohost-1.c
new file mode 100644
index 0000000..59ebb2b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/routine-nohost-1.c
@@ -0,0 +1,50 @@
+/* Test OpenACC 'routine' with 'nohost' clause, valid use. */
+
+/* { dg-additional-options "-fdump-tree-oaccloops" } */
+
+#pragma acc routine nohost
+int THREE(void)
+{
+ return 3;
+}
+
+#pragma acc routine (THREE) nohost
+
+#pragma acc routine nohost
+extern int THREE(void);
+
+/* { dg-final { scan-tree-dump-times {(?n)^OpenACC routine '[^']*THREE[^']*' has 'nohost' clause\.$} 1 oaccloops } } */
+
+
+#pragma acc routine nohost
+extern void NOTHING(void);
+
+#pragma acc routine (NOTHING) nohost
+
+void NOTHING(void)
+{
+}
+
+#pragma acc routine nohost
+extern void NOTHING(void);
+
+#pragma acc routine (NOTHING) nohost
+
+/* { dg-final { scan-tree-dump-times {(?n)^OpenACC routine '[^']*NOTHING[^']*' has 'nohost' clause\.$} 1 oaccloops } } */
+
+
+extern float ADD(float, float);
+
+#pragma acc routine (ADD) nohost
+
+float ADD(float x, float y)
+{
+ return x + y;
+}
+
+#pragma acc routine nohost
+extern float ADD(float, float);
+
+#pragma acc routine (ADD) nohost
+
+/* { dg-final { scan-tree-dump-times {(?n)^OpenACC routine '[^']*ADD[^']*' has 'nohost' clause\.$} 1 oaccloops } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/routine-nohost-2.c b/gcc/testsuite/c-c++-common/goacc/routine-nohost-2.c
new file mode 100644
index 0000000..d9acb80
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/routine-nohost-2.c
@@ -0,0 +1,96 @@
+/* Test OpenACC 'routine' with 'nohost' clause, invalid use. */
+
+#pragma acc routine /* { dg-note {\.\.\. without 'nohost' clause near to here} } */
+int THREE_1(void)
+{
+ return 3;
+}
+
+#pragma acc routine (THREE_1) \
+ nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+
+#pragma acc routine \
+ nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+extern int THREE_1(void);
+
+
+#pragma acc routine /* { dg-note {\.\.\. without 'nohost' clause near to here} } */
+extern void NOTHING_1(void);
+
+#pragma acc routine (NOTHING_1) \
+ nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+
+void NOTHING_1(void)
+{
+}
+
+#pragma acc routine \
+ nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+extern void NOTHING_1(void);
+
+#pragma acc routine (NOTHING_1) \
+ nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+
+
+extern float ADD_1(float, float);
+
+#pragma acc routine (ADD_1) /* { dg-note {\.\.\. without 'nohost' clause near to here} } */
+
+float ADD_1(float x, float y)
+{
+ return x + y;
+}
+
+#pragma acc routine \
+ nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+extern float ADD_1(float, float);
+
+#pragma acc routine (ADD_1) \
+ nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+
+
+/* The same again, but with/without nohost reversed. */
+
+#pragma acc routine \
+ nohost /* { dg-note {\.\.\. with 'nohost' clause here} } */
+int THREE_2(void)
+{
+ return 3;
+}
+
+#pragma acc routine (THREE_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+
+#pragma acc routine /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+extern int THREE_2(void);
+
+
+#pragma acc routine \
+ nohost /* { dg-note {\.\.\. with 'nohost' clause here} } */
+extern void NOTHING_2(void);
+
+#pragma acc routine (NOTHING_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+
+void NOTHING_2(void)
+{
+}
+
+#pragma acc routine /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+extern void NOTHING_2(void);
+
+#pragma acc routine (NOTHING_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+
+
+extern float ADD_2(float, float);
+
+#pragma acc routine (ADD_2) \
+ nohost /* { dg-note {\.\.\. with 'nohost' clause here} } */
+
+float ADD_2(float x, float y)
+{
+ return x + y;
+}
+
+#pragma acc routine /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
+extern float ADD_2(float, float);
+
+#pragma acc routine (ADD_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
diff --git a/gcc/testsuite/c-c++-common/goacc/struct-enter-exit-data-1.c b/gcc/testsuite/c-c++-common/goacc/struct-enter-exit-data-1.c
index df405e4..9e5d3f2 100644
--- a/gcc/testsuite/c-c++-common/goacc/struct-enter-exit-data-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/struct-enter-exit-data-1.c
@@ -20,8 +20,8 @@ test (int *b, int *c, int *e)
struct str s = { .a = 0, .b = b, .c = c, .d = 0, .e = e, .f = 0 };
#pragma acc enter data copyin(s.a, s.b[0:N], s.c[0:N] /* , s.d */ /* , s.e[0:N] */, s.f)
- /* { dg-final { scan-tree-dump {(?n)#pragma omp target oacc_enter_exit_data map\(struct:s \[len: 4\]\) map\(to:s.a \[len: [0-9]+\]\) map\(alloc:s.b \[len: [0-9]+\]\) map\(alloc:s.c \[len: [0-9]+\]\) map\(to:s.f \[len: [0-9]+\]\) map\(to:\*[_0-9]+ \[len: [0-9]+\]\) map\(attach:s.b \[bias: 0\]\) map\(to:\*[_0-9]+ \[len: [0-9]+\]\) map\(attach:s.c \[bias: 0\]\)$} gimple } } */
+ /* { dg-final { scan-tree-dump {(?n)#pragma omp target oacc_enter_data map\(struct:s \[len: 4\]\) map\(to:s.a \[len: [0-9]+\]\) map\(alloc:s.b \[len: [0-9]+\]\) map\(alloc:s.c \[len: [0-9]+\]\) map\(to:s.f \[len: [0-9]+\]\) map\(to:\*[_0-9]+ \[len: [0-9]+\]\) map\(attach:s.b \[bias: 0\]\) map\(to:\*[_0-9]+ \[len: [0-9]+\]\) map\(attach:s.c \[bias: 0\]\)$} gimple } } */
#pragma acc exit data copyout(s.a, s.b[0:N], s.c[0:N] /* , s.d */ /* , s.e[0:N] */, s.f)
- /* { dg-final { scan-tree-dump {(?n)#pragma omp target oacc_enter_exit_data map\(from:s.a \[len: [0-9]+\]\) map\(release:s.b \[len: [0-9]+\]\) map\(release:s.c \[len: [0-9]+\]\) map\(from:s.f \[len: [0-9]+\]\) map\(from:\*[_0-9]+ \[len: [0-9]+\]\) map\(detach:s.b \[bias: 0\]\) map\(from:\*[_0-9]+ \[len: [0-9]+\]\) map\(detach:s.c \[bias: 0\]\)$} gimple } } */
+ /* { dg-final { scan-tree-dump {(?n)#pragma omp target oacc_exit_data map\(from:s.a \[len: [0-9]+\]\) map\(release:s.b \[len: [0-9]+\]\) map\(release:s.c \[len: [0-9]+\]\) map\(from:s.f \[len: [0-9]+\]\) map\(from:\*[_0-9]+ \[len: [0-9]+\]\) map\(detach:s.b \[bias: 0\]\) map\(from:\*[_0-9]+ \[len: [0-9]+\]\) map\(detach:s.c \[bias: 0\]\)$} gimple } } */
}
diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c
index 827dac7..d9b143b 100644
--- a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c
+++ b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c
@@ -1,16 +1,22 @@
/* { dg-additional-options "-Wuninitialized" } */
+/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+ aspects of that functionality. */
+
void acc_parallel()
{
int i, j, k;
#pragma acc parallel num_gangs(i) /* { dg-warning "is used uninitialized" } */
+ /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */
;
#pragma acc parallel num_workers(j) /* { dg-warning "is used uninitialized" } */
+ /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
;
#pragma acc parallel vector_length(k) /* { dg-warning "is used uninitialized" } */
+ /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
;
}
diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c
index 7f78d72..683ac1b 100644
--- a/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c
+++ b/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c
@@ -1,6 +1,5 @@
/* { dg-do compile } */
/* { dg-additional-options "-Wuninitialized" } */
-/* { dg-excess-errors "PR70392" { xfail c++ } } */
#include <stdbool.h>
@@ -14,25 +13,25 @@ main (void)
#pragma acc parallel if(l) /* { dg-warning "is used uninitialized" } */
;
- #pragma acc parallel if(b) /* { dg-warning "is used uninitialized" "" { xfail c++ } } */
+ #pragma acc parallel if(b) /* { dg-warning "is used uninitialized" } */
;
#pragma acc kernels if(l2) /* { dg-warning "is used uninitialized" } */
;
- #pragma acc kernels if(b2) /* { dg-warning "is used uninitialized" "" { xfail c++ } } */
+ #pragma acc kernels if(b2) /* { dg-warning "is used uninitialized" } */
;
#pragma acc data if(l3) /* { dg-warning "is used uninitialized" } */
;
- #pragma acc data if(b3) /* { dg-warning "is used uninitialized" "" { xfail c++ } } */
+ #pragma acc data if(b3) /* { dg-warning "is used uninitialized" } */
;
#pragma acc update if(l4) self(i) /* { dg-warning "is used uninitialized" } */
;
- #pragma acc update if(b4) self(i2) /* { dg-warning "is used uninitialized" "" { xfail c++ } } */
+ #pragma acc update if(b4) self(i2) /* { dg-warning "is used uninitialized" } */
;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-1.c b/gcc/testsuite/c-c++-common/gomp/affinity-1.c
new file mode 100644
index 0000000..4af52f4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-1.c
@@ -0,0 +1,24 @@
+void
+foo(int x)
+{
+ int a = 1;
+ int b[5] = {1, 0, 1, 1, 0};
+ int cc = 7;
+ int d[5][5] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {1, 2, 3, 4, 5},
+ {6, 7, 8, 9, 10}, {-1, -2, -3, -4,-5}};
+#pragma omp taskgroup
+ {
+ #pragma omp task affinity(a)
+ ;
+ #pragma omp task affinity(iterator(i=(int)__builtin_cos(1.0+a):5, jj =2:5:2) : b[i], d[i][jj])
+ ;
+ #pragma omp task affinity(iterator(i=(int)__builtin_cos(1.0+a):5) : b[i], d[i][i])
+ ;
+ #pragma omp task affinity (iterator(i=1:5): a)
+ ;
+ #pragma omp task affinity (iterator(i=1:5): a) affinity(iterator(i=1:5) : x)
+ ;
+ #pragma omp task affinity (iterator(unsigned long j=1:5, k=7:4:-1) : b[j+k],a) affinity (cc)
+ ;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-2.c b/gcc/testsuite/c-c++-common/gomp/affinity-2.c
new file mode 100644
index 0000000..7f30296
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-2.c
@@ -0,0 +1,232 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+extern int a[][10], a2[][10];
+int b[10], c[10][2], d[10], e[10], f[10];
+int b2[10], c2[10][2], d2[10], e2[10], f2[10];
+int k[10], l[10], m[10], n[10], o;
+int *p;
+void bar (void);
+int t[10];
+#pragma omp threadprivate (t)
+
+void
+foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
+ int g2[3][10], int h2[4][8], int i2[2][10], int j2[][9])
+{
+ #pragma omp task affinity( bar[2:5]) /* { dg-error "is not a variable" } */
+ ;
+ #pragma omp task affinity( t[2:5])
+ ;
+ #pragma omp task affinity( k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task affinity( l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task affinity( m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task affinity( n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task affinity( o[2:5]) /* { dg-error "does not have pointer or array type" } */
+ ;
+ #pragma omp task affinity( a[:][2:4]) /* { dg-error "array type length expression must be specified" } */
+ ;
+ #pragma omp task affinity( b[-1:]) /* { dg-error "negative low bound in array section" } */
+ ;
+ #pragma omp task affinity( c[:-3][1:1]) /* { dg-error "negative length in array section" } */
+ ;
+ #pragma omp task affinity( d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task affinity( e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task affinity( f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task affinity( g[:][2:4]) /* { dg-error "for array function parameter length expression must be specified" } */
+ ;
+ #pragma omp task affinity( h[2:2][-1:]) /* { dg-error "negative low bound in array section" } */
+ ;
+ #pragma omp task affinity( h[:1][:-3]) /* { dg-error "negative length in array section" } */
+ ;
+ #pragma omp task affinity( i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task affinity( j[3:4][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task affinity( j[30:10][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task affinity( a2[:3][2:4])
+ ;
+ #pragma omp task affinity( b2[0:])
+ ;
+ #pragma omp task affinity( c2[:3][1:1])
+ ;
+ #pragma omp task affinity( d2[9:])
+ ;
+ #pragma omp task affinity( e2[:10])
+ ;
+ #pragma omp task affinity( f2[1:9])
+ ;
+ #pragma omp task affinity( g2[:2][2:4])
+ ;
+ #pragma omp task affinity( h2[2:2][0:])
+ ;
+ #pragma omp task affinity( h2[:1][:3])
+ ;
+ #pragma omp task affinity( i2[:1][9:])
+ ;
+ #pragma omp task affinity( j2[3:4][:9])
+ ;
+ #pragma omp task affinity( j2[30:10][5:4])
+ ;
+}
+
+void bar2 (int a[10][10][10]);
+
+void
+foo2 (int a[10][10][10], int **b)
+{
+ int c[10][10][10];
+ #pragma omp task affinity( a[2:4][3:][:7], b[1:7][2:8])
+ bar2 (a);
+ int i = 1, j = 3, k = 2, l = 6;
+ #pragma omp task affinity( a[++i:++j][++k:][:++l])
+ bar2 (a);
+ #pragma omp task affinity( a[7:2][:][:], c[5:2][:][:])
+ {
+ bar2 (c);
+ bar2 (a);
+ }
+}
+
+void
+foo3 (int a[10][10][10], int **b, int x)
+{
+ int c[10][10][10];
+ #pragma omp task affinity( a[2:4][3:0][:7]) /* { dg-error "zero length array section" } */
+ bar2 (a);
+ #pragma omp task affinity( b[:7][0:0][:0]) /* { dg-error "zero length array section" } */
+ bar2 (a);
+ #pragma omp task affinity( c[:][:][10:]) /* { dg-error "zero length array section" } */
+ bar2 (c);
+ #pragma omp task affinity( a[2:4][3:0][:x]) /* { dg-error "zero length array section" } */
+ bar2 (a);
+ #pragma omp task affinity( b[:x][0:0][:0]) /* { dg-error "zero length array section" } */
+ bar2 (a);
+ #pragma omp task affinity( c[:][x-2:x][10:]) /* { dg-error "zero length array section" } */
+ bar2 (c);
+}
+
+void
+foo4 (int *p, int (*q)[10], int r[10], int s[10][10])
+{
+ int a[10], b[10][10];
+ #pragma omp task affinity ( p[-1:2])
+ ;
+ #pragma omp task affinity ( q[-1:2][2:4])
+ ;
+ #pragma omp task affinity ( q[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */
+ ;
+ #pragma omp task affinity ( r[-1:2])
+ ;
+ #pragma omp task affinity ( s[-1:2][2:4])
+ ;
+ #pragma omp task affinity ( s[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */
+ ;
+ #pragma omp task affinity ( a[-1:2]) /* { dg-error "negative low bound in array section in" } */
+ ;
+ #pragma omp task affinity ( b[-1:2][2:4]) /* { dg-error "negative low bound in array section in" } */
+ ;
+ #pragma omp task affinity ( b[1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */
+ ;
+ #pragma omp task affinity ( p[2:-3]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( q[2:-3][:]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( q[2:3][0:-1]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( r[2:-5]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( s[2:-5][:]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( s[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( a[2:-5]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( b[2:-5][0:10]) /* { dg-error "negative length in array section in" } */
+ ;
+ #pragma omp task affinity ( b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
+ ;
+}
+
+struct T { int c[3]; };
+struct S { int a; struct T *b; struct T g; };
+struct S sd[10];
+struct S *se[10];
+struct S *sf;
+struct S sh;
+struct U { int a : 5; };
+struct U si;
+
+
+void
+foo5 (void)
+{
+ #pragma omp task affinity( sd)
+ ;
+ #pragma omp task affinity( sd[2])
+ ;
+ #pragma omp task affinity( sd[:])
+ ;
+ #pragma omp task affinity( sd[2:2])
+ ;
+ #pragma omp task affinity( sd[:2])
+ ;
+ #pragma omp task affinity( sd[1].b->c[2])
+ ;
+ #pragma omp task affinity( sd[0].a)
+ ;
+ #pragma omp task affinity( se[3]->a)
+ ;
+ #pragma omp task affinity( se[2]->b->c)
+ ;
+ #pragma omp task affinity( se[1]->b->c[2])
+ ;
+ #pragma omp task affinity( (*sf).a)
+ ;
+ #pragma omp task affinity( sf->b->c[0])
+ ;
+ #pragma omp task affinity( sf)
+ ;
+ #pragma omp task affinity( *sf)
+ ;
+ #pragma omp task affinity( sf[0])
+ ;
+ #pragma omp task affinity( sf[0].a)
+ ;
+ #pragma omp task affinity( sh.g.c[2])
+ ;
+}
+
+void
+foo6 (void)
+{
+ #pragma omp task affinity( sd[:2].b->c[2]) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( sd[1:].b->c[2]) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( sd[0:1].a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( se[3:2]->a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( se[2:2]->b->c) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( se[1]->b->c[2:1]) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( sf + 0) /* { dg-error "'sf' is not lvalue expression nor array section in 'affinity' clause" } */
+ ;
+ #pragma omp task affinity( sf[0:1].a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( sh.g.c[2:1]) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity( si.a) /* { dg-error "bit-field 'si\\..*a' in 'affinity' clause" } */
+ ;
+}
+/* { dg-additional-options "-Wno-volatile" { target c++ } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-3.c b/gcc/testsuite/c-c++-common/gomp/affinity-3.c
new file mode 100644
index 0000000..1a47654
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-3.c
@@ -0,0 +1,77 @@
+/* { dg-additional-options "-Wno-volatile" { target c++ } } */
+
+int arr[64], arr2[64];
+struct S { int a[4]; } k;
+short arr4[4];
+volatile int v;
+#define TEST_EQ(x,y) ({ int o[x == y ? 1 : -1]; 0; })
+
+void
+foo (unsigned char i, signed char j)
+{
+ #pragma omp task affinity (iterator (j=6:2:-2) : \
+ arr[TEST_EQ (sizeof (j), sizeof (int)), \
+ TEST_EQ (sizeof (i), sizeof (unsigned char)), \
+ TEST_EQ (sizeof (k), sizeof (struct S)), j], \
+ arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
+ TEST_EQ (((__typeof (i)) -1) < 0, 0), \
+ TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
+ affinity(arr[0]) \
+ affinity (iterator (long long i=__LONG_LONG_MAX__ - 4:__LONG_LONG_MAX__ - 2:2, \
+ unsigned short j=~0U-16:~0U-8:3, \
+ short *k=&arr4[1]:&arr4[2]:1) : \
+ arr[TEST_EQ (sizeof (i), sizeof (long long)), \
+ TEST_EQ (sizeof (j), sizeof (unsigned short)), \
+ TEST_EQ (sizeof (k), sizeof (short *)), \
+ TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
+ arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
+ TEST_EQ (((__typeof (j)) -1) < 0, 0), \
+ TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
+ arr2[k - &arr4[0]]) \
+ affinity( k)
+ v++;
+}
+
+void
+bar (unsigned char i, signed char j)
+{
+ int m = j;
+ int n = j + 2;
+ #pragma omp task affinity (iterator (j=6:2:m) : \
+ arr[TEST_EQ (sizeof (j), sizeof (int)), \
+ TEST_EQ (sizeof (i), sizeof (unsigned char)), \
+ TEST_EQ (sizeof (k), sizeof (struct S)), j], \
+ arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
+ TEST_EQ (((__typeof (i)) -1) < 0, 0), \
+ TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
+ affinity( arr[0]) \
+ affinity (iterator (long long i=__LONG_LONG_MAX__ - 4 - n:__LONG_LONG_MAX__ - 2:2, \
+ unsigned short j=~0U-16:~0U-8-n:3, \
+ short *k=&arr4[1]:&arr4[n + 2]:1) : \
+ arr[TEST_EQ (sizeof (i), sizeof (long long)), \
+ TEST_EQ (sizeof (j), sizeof (unsigned short)), \
+ TEST_EQ (sizeof (k), sizeof (short *)), \
+ TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
+ arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
+ TEST_EQ (((__typeof (j)) -1) < 0, 0), \
+ TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
+ arr2[k - &arr4[0]:10]) \
+ affinity( k)
+ v++;
+}
+
+void
+baz (void)
+{
+ #pragma omp parallel
+ #pragma omp master
+ {
+ #pragma omp task affinity(iterator(unsigned long int k = 0 : 2) : \
+ arr[TEST_EQ (sizeof (k), sizeof (unsigned long)), \
+ TEST_EQ (((__typeof (k)) -1) < 0, 0), k]) \
+ affinity(iterator(signed char s = -3 : -12 : -1) : \
+ arr[TEST_EQ (sizeof (s), sizeof (signed char)), \
+ TEST_EQ (((__typeof (s)) -1) < 0, 1), s + 12])
+ v++;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-4.c b/gcc/testsuite/c-c++-common/gomp/affinity-4.c
new file mode 100644
index 0000000..dee3ed9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-4.c
@@ -0,0 +1,103 @@
+int a, b[64];
+struct S { int c; } *d, *e;
+struct T;
+struct T *f, *g;
+int *h;
+
+void
+f1 (void)
+{
+ #pragma omp task affinity (iterator : a)
+ ;
+ /* { dg-error "'iterator' undeclared " "" { target c } .-2 } */
+ /* { dg-error "found ':' in nested-name-specifier, expected '::'" "" { target c++ } .-3 } */
+ /* { dg-error "'iterator' has not been declared" "" { target c++ } .-4 } */
+}
+
+void
+f2 (void)
+{
+ #pragma omp task affinity (iterator (for = 0 : 2) : a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity (iterator (5 = 0 : 2) : a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity (iterator (i : 0 : 2) : a) /* { dg-error "expected '='|name a type|expected" } */
+ ;
+ #pragma omp task affinity (iterator (i = 0, 1 : 2) : a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity (iterator (i = (0, 1) : 2) : a)
+ ;
+ #pragma omp task affinity (iterator (i = 0 : 1 : 2 : 3) : a) /* { dg-error "expected '.'" } */
+ ;
+ #pragma omp task affinity (iterator (i = 0 : 2, 3) : a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity (iterator (i = 0 : 10 : 2, 3) : a) /* { dg-error "expected" } */
+ ;
+ #pragma omp task affinity (iterator (i = 0:1), iterator (j = 0:1) : a)
+ ;
+ /* { dg-error "'iterator' undeclared " "" { target c } .-2 } */
+ /* { dg-error "'i' was not declared in this scope" "" { target c++ } .-3 } */
+ /* { dg-error "'iterator' was not declared in this scope" "" { target c++ } .-4 } */
+ /* { dg-error "'j' was not declared in this scope" "" { target c++ } .-5 } */
+ /* { dg-error "expected '\\)' before ':' token" "" { target c++ } .-6 } */
+}
+
+void
+f3 (void)
+{
+ #pragma omp task affinity (iterator (i = 0:32) : b[i*2:2])
+ ;
+ #pragma omp task affinity (iterator (struct S i = 0:1) : a) /* { dg-error "iterator 'i' has neither integral nor pointer type" } */
+ ;
+ #pragma omp task affinity (iterator (void i = 0:1) : a) /* { dg-error "iterator 'i' has neither integral nor pointer type" } */
+ ;
+ #pragma omp task affinity (iterator (float f = 0.2:0.4) : a) /* { dg-error "iterator 'f' has neither integral nor pointer type" } */
+ ;
+ #pragma omp task affinity (iterator (struct S *p = d:e:2) : a)
+ ;
+ #pragma omp task affinity (iterator (struct T *p = f:g) , a)
+ ;
+ /* { dg-error "'iterator' undeclared " "" { target c } .-2 } */
+ /* { dg-error "expected primary-expression before 'struct'" "" { target c++ } .-3 } */
+ /* { dg-error "'iterator' was not declared in this scope" "" { target c++ } .-4 } */
+}
+
+void
+f4 (void)
+{
+ #pragma omp task affinity (iterator (int i = 0:4, \
+ struct U { int (*p)[i + 2]; } *p = 0:2) : a) /* { dg-error "type of iterator 'p' refers to outer iterator 'i'" "" { target c } } */
+ ; /* { dg-error "types may not be defined in iterator type|not an integral constant" "" { target c++ } .-1 } */
+ #pragma omp task affinity (iterator (i = 0:4, j = i:16) : a) /* { dg-error "begin expression refers to outer iterator 'i'" } */
+ ;
+ #pragma omp task affinity (iterator (i = 0:4, j = 2:i:1) : a) /* { dg-error "end expression refers to outer iterator 'i'" } */
+ ;
+ #pragma omp task affinity (iterator (i = 0:4, j = 2:8:i) : a) /* { dg-error "step expression refers to outer iterator 'i'" } */
+ ;
+ #pragma omp task affinity (iterator (i = *d:2) : a) /* { dg-error "aggregate value used where an integer was expected" "" { target c } } */
+ ; /* { dg-error "invalid cast from type 'S' to type 'int'" "" { target c++ } .-1 } */
+ #pragma omp task affinity (iterator (i = 2:*d:2) : a) /* { dg-error "aggregate value used where an integer was expected" "" { target c } } */
+ ; /* { dg-error "invalid cast from type 'S' to type 'int'" "" { target c++ } .-1 } */
+ #pragma omp task affinity (iterator (i = 2:4:*d) : a) /* { dg-error "iterator step with non-integral type" } */
+ ;
+ #pragma omp task affinity (iterator (i = 1.25:2.5:3) : a)
+ ;
+ #pragma omp task affinity (iterator (i = 1:2:3.5) : a) /* { dg-error "iterator step with non-integral type" } */
+ ;
+ #pragma omp task affinity (iterator (int *p = 23 : h) : a)
+ ;
+ #pragma omp task affinity (iterator (short i=1:3:0) : a) /* { dg-error "iterator 'i' has zero step" } */
+ ;
+ #pragma omp task affinity (iterator (i = 1 : 3 : 3 - 3) : a) /* { dg-error "iterator 'i' has zero step" } */
+ ;
+ #pragma omp task affinity (iterator (int *p = &b[6]:&b[9]:4 - 4) : a) /* { dg-error "iterator 'p' has zero step" } */
+ ;
+ #pragma omp task affinity (iterator (const int i = 0 : 2) : a) /* { dg-error "const qualified" } */
+ ;
+ #pragma omp task affinity (iterator (const long long unsigned i = 0 : 2) : a) /* { dg-error "const qualified" } */
+ ;
+#if !defined (__cplusplus) && __STDC_VERSION__ >= 201112L
+ #pragma omp task affinity (iterator (_Atomic unsigned i = 0 : 2) : a) /* { dg-error "_Atomic" "" { target c } } */
+ ;
+#endif
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-5.c b/gcc/testsuite/c-c++-common/gomp/affinity-5.c
new file mode 100644
index 0000000..194286d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-5.c
@@ -0,0 +1,32 @@
+/* { dg-additional-options "-fdump-tree-gimple" } */
+int bar (int);
+int bar2 (int);
+
+void foobar()
+{
+ int d[64], e[64], f[64];
+#pragma omp task affinity (d, e[bar(5)], f[4:10])
+ ;
+}
+
+void
+foo (void)
+{
+ int a[64];
+#pragma omp task affinity (iterator (j=bar(0):bar(1):bar(2)) : a[bar(j)])
+ ;
+}
+void
+qux (void)
+{
+ int a[64], b[64], c[64];
+#pragma omp task affinity (iterator (j=bar(0):bar(1):bar(2)) : a[bar(j+1)], b[bar(j+2)], c[bar(j+3)])
+ ;
+}
+
+/* { dg-final { scan-tree-dump-times "= bar \\(5\\);" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "= bar \\(0\\);" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "= bar \\(1\\);" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "= bar \\(2\\);" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "= bar \\(j\\);" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "= bar \\(_.\\);" 3 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-6.c b/gcc/testsuite/c-c++-common/gomp/affinity-6.c
new file mode 100644
index 0000000..0c9cd59
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-6.c
@@ -0,0 +1,36 @@
+/* { dg-additional-options "-fdump-tree-gimple" } */
+int bar (int);
+int bar2 (int);
+
+void foobar()
+{
+ int d[64], e[64], f[64];
+#pragma omp parallel default(none) /* { dg-note "enclosing 'parallel'" } */
+#pragma omp task affinity (d, e[bar(5)], f[4:10])
+ ;
+/* { dg-error "'f' not specified in enclosing 'parallel'" "" { target *-*-* } .-2 } */
+/* { dg-error "'e' not specified in enclosing 'parallel'" "" { target *-*-* } .-3 } */
+/* { dg-error "'d' not specified in enclosing 'parallel'" "" { target *-*-* } .-4 } */
+}
+
+void
+foo (void)
+{
+ int a[64];
+#pragma omp parallel default(none) /* { dg-note "enclosing 'parallel'" } */
+#pragma omp task affinity (iterator (j=bar(0):bar(1):bar(2)) : a[bar(j)])
+ ;
+/* { dg-error "'a' not specified in enclosing 'parallel'" "" { target *-*-* } .-2 } */
+}
+
+void
+qux (void)
+{
+ int a[64], b[64], c[64];
+#pragma omp parallel default(none) /* { dg-note "enclosing 'parallel'" } */
+#pragma omp task affinity (iterator (j=bar(0):bar(1):bar(2)) : a[bar(j+1)], b[bar(j+2)], c[bar(j+3)])
+ ;
+/* { dg-error "'a' not specified in enclosing 'parallel'" "" { target *-*-* } .-2 } */
+/* { dg-error "'c' not specified in enclosing 'parallel'" "" { target *-*-* } .-3 } */
+/* { dg-error "'b' not specified in enclosing 'parallel'" "" { target *-*-* } .-4 } */
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-7.c b/gcc/testsuite/c-c++-common/gomp/affinity-7.c
new file mode 100644
index 0000000..11684f5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-7.c
@@ -0,0 +1,37 @@
+/* { dg-additional-options "-fdump-tree-original" } */
+int var[20];
+
+int *
+iterator(int i)
+{
+ return &var[i];
+}
+
+void
+foo (void)
+{
+ int iterator[10], i;
+ #pragma omp task affinity(iterator(i=4:2) : iterator[i] )
+ ;
+ #pragma omp task affinity(iterator)
+ ;
+ #pragma omp task affinity(iterator[4:3])
+ ;
+}
+
+void
+bar (void)
+{
+ int j = 3;
+ ;
+ #pragma omp task affinity(iterator(i=4:2) : iterator(i)[2] )
+ ;
+ #pragma omp task affinity(iterator(j)[4])
+ ;
+}
+
+/* { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(int i=4:2:1\\):iterator\\\[SAVE_EXPR <i>\\\]\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\\[4\\\]\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(int i=4:2:1\\):\\*\\(iterator \\(i\\) \\+ 8\\)\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(\\*\\(iterator \\(j\\) \\+ 16\\)\\)" 1 "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-17.c b/gcc/testsuite/c-c++-common/gomp/atomic-17.c
index d313b29..001887e 100644
--- a/gcc/testsuite/c-c++-common/gomp/atomic-17.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-17.c
@@ -22,8 +22,18 @@ foo ()
v = i = i + 1;
#pragma omp atomic read acquire
v = i;
+ #pragma omp atomic acq_rel read
+ v = i;
#pragma omp atomic release,write
i = v;
+ #pragma omp atomic write,acq_rel
+ i = v;
#pragma omp atomic hint(1),update,release
f = f + 2.0;
+ #pragma omp atomic update ,acquire
+ i = i + 1;
+ #pragma omp atomic acq_rel update
+ i = i + 1;
+ #pragma omp atomic acq_rel,hint(0)
+ i = i + 1;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-18.c b/gcc/testsuite/c-c++-common/gomp/atomic-18.c
index 95fbcd1..b389c6a 100644
--- a/gcc/testsuite/c-c++-common/gomp/atomic-18.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-18.c
@@ -8,28 +8,18 @@ foo (int j)
i = i + 1;
#pragma omp atomic seq_cst release /* { dg-error "too many memory order clauses" } */
i = i + 1;
- #pragma omp atomic read,release /* { dg-error "incompatible with 'acq_rel' or 'release' clauses" } */
+ #pragma omp atomic read,release /* { dg-error "incompatible with 'release' clause" } */
v = i;
- #pragma omp atomic acq_rel read /* { dg-error "incompatible with 'acq_rel' or 'release' clauses" } */
- v = i;
- #pragma omp atomic write acq_rel /* { dg-error "incompatible with 'acq_rel' or 'acquire' clauses" } */
- i = v;
- #pragma omp atomic acquire , write /* { dg-error "incompatible with 'acq_rel' or 'acquire' clauses" } */
+ #pragma omp atomic acquire , write /* { dg-error "incompatible with 'acquire' clause" } */
i = v;
- #pragma omp atomic update ,acquire /* { dg-error "incompatible with 'acq_rel' or 'acquire' clauses" } */
- i = i + 1;
- #pragma omp atomic acq_rel update /* { dg-error "incompatible with 'acq_rel' or 'acquire' clauses" } */
- i = i + 1;
- #pragma omp atomic acq_rel,hint(0) /* { dg-error "incompatible with 'acq_rel' or 'acquire' clauses" } */
- i = i + 1;
- #pragma omp atomic acquire /* { dg-error "incompatible with 'acq_rel' or 'acquire' clauses" } */
- i = i + 1;
- #pragma omp atomic capture hint (0) capture /* { dg-error "too many atomic clauses" } */
+ #pragma omp atomic capture hint (0) capture /* { dg-error "too many 'capture' clauses" "" { target c } } */
+ /* { dg-error "too many atomic clauses" "" { target c++ } .-1 } */
v = i = i + 1;
#pragma omp atomic hint(j + 2) /* { dg-error "constant integer expression" } */
i = i + 1;
#pragma omp atomic hint(f) /* { dg-error "integ" } */
i = i + 1;
- #pragma omp atomic foobar /* { dg-error "expected 'read', 'write', 'update', 'capture', 'seq_cst', 'acq_rel', 'release', 'relaxed' or 'hint' clause" } */
- i = i + 1; /* { dg-error "expected end of line before" "" { target *-*-* } .-1 } */
+ #pragma omp atomic foobar /* { dg-error "expected 'read', 'write', 'update', 'capture', 'compare', 'weak', 'fail', 'seq_cst', 'acq_rel', 'release', 'relaxed' or 'hint' clause" "" { target c } } */
+ /* { dg-error "expected 'read', 'write', 'update', 'capture', 'seq_cst', 'acq_rel', 'release', 'relaxed' or 'hint' clause" "" { target c++ } .-1 } */
+ i = i + 1; /* { dg-error "expected end of line before" "" { target *-*-* } .-2 } */
}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-21.c b/gcc/testsuite/c-c++-common/gomp/atomic-21.c
index 8d052ae..12b1237 100644
--- a/gcc/testsuite/c-c++-common/gomp/atomic-21.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-21.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-original" } */
-/* { dg-final { scan-tree-dump-times "omp atomic release" 4 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp atomic release" 2 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp atomic acq_rel" 2 "original" } } */
/* { dg-final { scan-tree-dump-times "omp atomic read acquire" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "omp atomic capture acq_rel" 1 "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-24.c b/gcc/testsuite/c-c++-common/gomp/atomic-24.c
new file mode 100644
index 0000000..f70c805
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-24.c
@@ -0,0 +1,12 @@
+/* PR c/101297 */
+
+int i;
+
+void
+foo (void)
+{
+ #pragma omp atomic update, /* { dg-error "expected end of line before ',' token" } */
+ i++;
+ #pragma omp atomic update,, /* { dg-error "expected end of line before ',' token" } */
+ i++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-25.c b/gcc/testsuite/c-c++-common/gomp/atomic-25.c
new file mode 100644
index 0000000..a5196a5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-25.c
@@ -0,0 +1,50 @@
+/* { dg-do compile { target c } } */
+
+int x, r, z;
+double d, v;
+long double ld;
+
+void
+foo (int y, double e, long double f)
+{
+ #pragma omp atomic compare update seq_cst
+ x = x > y ? y : x;
+ #pragma omp atomic compare relaxed
+ d = e > d ? e : d;
+ #pragma omp atomic compare
+ d = f < d ? f : d;
+ #pragma omp atomic compare seq_cst fail(relaxed)
+ x = 12U < x ? 12U : x;
+ #pragma omp atomic compare
+ x = x == 7 ? 24 : x;
+ #pragma omp atomic compare
+ x = x == 123UL ? 256LL : x;
+ #pragma omp atomic compare
+ ld = ld == f ? f + 5.0L : ld;
+ #pragma omp atomic compare
+ if (x == 9) { x = 5; }
+ #pragma omp atomic compare
+ if (x > 5) { x = 5; }
+ #pragma omp atomic compare
+ if (7 > x) { x = 7; }
+ #pragma omp atomic compare update capture seq_cst fail(acquire)
+ v = d = f > d ? f : d;
+ #pragma omp atomic update capture compare
+ v = x = x < 24ULL ? 24ULL : x;
+ #pragma omp atomic compare, capture, update
+ v = x = x == e ? f : x;
+ #pragma omp atomic capture compare
+ { v = d; if (d > e) { d = e; } }
+ #pragma omp atomic compare capture
+ { if (e < d) { d = e; } v = d; }
+ #pragma omp atomic compare capture
+ { y = x; if (x == 42) { x = 7; } }
+ #pragma omp atomic capture compare weak
+ { if (x == 42) { x = 7; } y = x; }
+ #pragma omp atomic capture compare fail(seq_cst)
+ if (d == 8.0) { d = 16.0; } else { v = d; }
+ #pragma omp atomic capture compare
+ { r = x == 8; if (r) { x = 24; } }
+ #pragma omp atomic compare capture
+ { r = x == y; if (r) { x = y + 6; } else { z = x; } }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-26.c b/gcc/testsuite/c-c++-common/gomp/atomic-26.c
new file mode 100644
index 0000000..c7e65db
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-26.c
@@ -0,0 +1,63 @@
+/* { dg-do compile { target c } } */
+
+int x;
+double d;
+
+double
+foo (int y, double e, long double f)
+{
+ double v;
+ #pragma omp atomic compare compare /* { dg-error "too many 'compare' clauses" } */
+ x = x > y ? y : x;
+ #pragma omp atomic compare fail(seq_cst) fail(seq_cst) /* { dg-error "too many 'fail' clauses" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare,fail(seq_cst),fail(relaxed) /* { dg-error "too many 'fail' clauses" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare weak weak /* { dg-error "too many 'weak' clauses" } */
+ d = d == e ? e + 1.0 : d;
+ #pragma omp atomic read capture /* { dg-error "'capture' clause is incompatible with 'read' or 'write' clauses" } */
+ v = d;
+ #pragma omp atomic capture, write /* { dg-error "'capture' clause is incompatible with 'read' or 'write' clauses" } */
+ d = v;
+ #pragma omp atomic read compare /* { dg-error "'compare' clause is incompatible with 'read' or 'write' clauses" } */
+ v = d;
+ #pragma omp atomic compare, write /* { dg-error "'compare' clause is incompatible with 'read' or 'write' clauses" } */
+ d = v;
+ #pragma omp atomic read fail(seq_cst) /* { dg-error "'fail' clause requires 'compare' clause" } */
+ v = d;
+ #pragma omp atomic fail(relaxed), write /* { dg-error "'fail' clause requires 'compare' clause" } */
+ d = v;
+ #pragma omp atomic fail(relaxed) update /* { dg-error "'fail' clause requires 'compare' clause" } */
+ d += 3.0;
+ #pragma omp atomic fail(relaxed) /* { dg-error "'fail' clause requires 'compare' clause" } */
+ d += 3.0;
+ #pragma omp atomic capture fail(relaxed) /* { dg-error "'fail' clause requires 'compare' clause" } */
+ v = d += 3.0;
+ #pragma omp atomic read weak /* { dg-error "'weak' clause requires 'compare' clause" } */
+ v = d;
+ #pragma omp atomic weak, write /* { dg-error "'weak' clause requires 'compare' clause" } */
+ d = v;
+ #pragma omp atomic weak update /* { dg-error "'weak' clause requires 'compare' clause" } */
+ d += 3.0;
+ #pragma omp atomic weak /* { dg-error "'weak' clause requires 'compare' clause" } */
+ d += 3.0;
+ #pragma omp atomic capture weak /* { dg-error "'weak' clause requires 'compare' clause" } */
+ v = d += 3.0;
+ #pragma omp atomic compare,weak /* { dg-error "'weak' clause requires atomic equality comparison" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare fail /* { dg-error "expected '\\\(' before end of line" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare fail( /* { dg-error "expected 'seq_cst', 'acquire' or 'relaxed' before end of line" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare fail() /* { dg-error "expected 'seq_cst', 'acquire' or 'relaxed' before '\\\)' token" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare fail(foobar) /* { dg-error "expected 'seq_cst', 'acquire' or 'relaxed' before 'foobar'" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare fail(acq_rel) /* { dg-error "expected 'seq_cst', 'acquire' or 'relaxed' before 'acq_rel'" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare fail(release) /* { dg-error "expected 'seq_cst', 'acquire' or 'relaxed' before 'release'" } */
+ d = e > d ? e : d;
+ #pragma omp atomic compare fail(seq_cst /* { dg-error "expected '\\\)' before end of line" } */
+ d = e > d ? e : d;
+ return v;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-27.c b/gcc/testsuite/c-c++-common/gomp/atomic-27.c
new file mode 100644
index 0000000..3d61717
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-27.c
@@ -0,0 +1,41 @@
+/* PR middle-end/88968 */
+/* { dg-do compile { target c } } */
+
+struct __attribute__((packed)) S {
+ unsigned int a : 16;
+ unsigned int b : 1;
+} s;
+
+void
+foo (int y, int z)
+{
+ #pragma omp atomic compare
+ s.a = s.a == y ? z : s.a;
+}
+
+int
+bar (int y, int z)
+{
+ int r;
+ #pragma omp atomic compare capture
+ { r = s.a == y; if (r) { s.a = z; } }
+ return r;
+}
+
+int
+baz (int y, int z)
+{
+ int v;
+ #pragma omp atomic compare capture
+ if (s.a == y) { s.a = z; } else { v = s.a; }
+ return v;
+}
+
+int
+qux (int y, int z)
+{
+ int v;
+ #pragma omp atomic compare capture
+ v = s.a = s.a == y ? z : s.a;
+ return v;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-28.c b/gcc/testsuite/c-c++-common/gomp/atomic-28.c
new file mode 100644
index 0000000..50cf223
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-28.c
@@ -0,0 +1,43 @@
+/* { dg-do compile { target c } } */
+/* { dg-additional-options "-O2 -fdump-tree-ompexp" } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 4, 5, 5\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 4, 4, 2\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 260, 5, 0\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 4, 0, 0\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-not "__atomic_load_4 \\\(" "ompexp" { target sync_int_long } } } */
+
+int x;
+
+void
+foo (int y, int z)
+{
+ #pragma omp atomic compare seq_cst
+ x = x == y ? z : x;
+}
+
+int
+bar (int y, int z)
+{
+ int r;
+ #pragma omp atomic compare capture acq_rel fail (acquire)
+ { r = x == y; if (r) { x = z; } }
+ return r;
+}
+
+int
+baz (int y, int z)
+{
+ int v;
+ #pragma omp atomic compare capture seq_cst fail (relaxed) weak
+ if (x == y) { x = z; } else { v = x; }
+ return v;
+}
+
+int
+qux (int y, int z)
+{
+ int v;
+ #pragma omp atomic compare capture
+ v = x = x == y ? z : x;
+ return v;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-29.c b/gcc/testsuite/c-c++-common/gomp/atomic-29.c
new file mode 100644
index 0000000..e574c48
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-29.c
@@ -0,0 +1,43 @@
+/* { dg-do compile { target c } } */
+/* { dg-additional-options "-O2 -fdump-tree-ompexp" } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 8, 5, 5\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 8, 4, 2\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 264, 5, 0\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-times "\.ATOMIC_COMPARE_EXCHANGE \\\(\[^\n\r]*, 8, 0, 0\\\);" 1 "ompexp" { target sync_int_long } } } */
+/* { dg-final { scan-tree-dump-not "__atomic_load_8 \\\(" "ompexp" { target sync_int_long } } } */
+
+double x;
+
+void
+foo (double y, double z)
+{
+ #pragma omp atomic compare seq_cst
+ x = x == y ? z : x;
+}
+
+double
+bar (double y, double z)
+{
+ int r;
+ #pragma omp atomic compare capture acq_rel fail (acquire)
+ { r = x == y; if (r) { x = z; } }
+ return r;
+}
+
+double
+baz (double y, double z)
+{
+ double v;
+ #pragma omp atomic compare capture seq_cst fail (relaxed) weak
+ if (x == y) { x = z; } else { v = x; }
+ return v;
+}
+
+double
+qux (double y, double z)
+{
+ double v;
+ #pragma omp atomic compare capture
+ v = x = x == y ? z : x;
+ return v;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-30.c b/gcc/testsuite/c-c++-common/gomp/atomic-30.c
new file mode 100644
index 0000000..f36de70
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-30.c
@@ -0,0 +1,137 @@
+/* { dg-do compile { target c } } */
+
+int x;
+double d, g;
+
+double
+foo (int y, double e, long double f)
+{
+ double v;
+ int r, r2 = 0;
+ #pragma omp atomic capture compare
+ v = if (d == e) { d = f; }; /* { dg-error "expected expression" } */
+ #pragma omp atomic compare
+ if; /* { dg-error "expected '\\\(' before ';' token" } */
+ #pragma omp atomic compare
+ if (d >= e) { d = e; } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic compare
+ if (d <= e) { d = e; } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic compare
+ if (d != e) { d = e; } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic compare
+ if (d + e) { d = e; } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ { r = d >= e; if (r) { d = f; } } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ { r = d <= e; if (r) { d = f; } } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ { r = d > e; if (r) { d = f; } } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ { r = d < e; if (r) { d = f; } } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ { r = d != e; if (r) { d = f; } } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ { r = d + e; if (r) { d = f; } } /* { dg-error "expected '==', '<' or '>' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ { r = d == e; if (r2) { d = f; } } /* { dg-error "invalid form of '#pragma omp atomic compare' before '\{' token" } */
+ #pragma omp atomic capture compare
+ if (d > e) { d = e; } /* { dg-error "expected '==' comparison in 'if' condition" } */
+ #pragma omp atomic capture compare
+ if (d < e) { d = e; } /* { dg-error "expected '==' comparison in 'if' condition" } */
+ #pragma omp atomic compare
+ if (d < e) d = e; /* { dg-error "expected '\{' before 'd'" } */
+ #pragma omp atomic compare
+ if (d == e) d = e + 1.0; /* { dg-error "expected '\{' before 'd'" } */
+ #pragma omp atomic compare
+ if (d < e) { d += e; } /* { dg-error "expected '=' before '\\\+=' token" } */
+ #pragma omp atomic compare
+ if (d < e) { d = e }; /* { dg-error "expected ';' before '\}' token" } */
+ #pragma omp atomic compare
+ if (d < e) { d = e; e = 1.0; } /* { dg-error "expected '\}' before 'e'" } */
+ #pragma omp atomic compare
+ if (e == d) { d = f; }; /* { dg-error "invalid form of '#pragma omp atomic compare' before ';' token" } */
+ #pragma omp atomic compare
+ if (e == d) { g = f; }; /* { dg-error "invalid form of '#pragma omp atomic compare' before ';' token" } */
+ #pragma omp atomic compare
+ if (d < e) { g = e; }; /* { dg-error "invalid form of '#pragma omp atomic compare' before ';' token" } */
+ #pragma omp atomic compare
+ if (d > e) { g = e; }; /* { dg-error "invalid form of '#pragma omp atomic compare' before ';' token" } */
+ #pragma omp atomic compare
+ if (d < e) { d = g; }; /* { dg-error "invalid form of '#pragma omp atomic compare' before ';' token" } */
+ #pragma omp atomic compare
+ if (d > e) { d = g; }; /* { dg-error "invalid form of '#pragma omp atomic compare' before ';' token" } */
+ #pragma omp atomic compare
+ if (d == e) { d = f; } else ; /* { dg-error "unexpected 'else'" } */
+ #pragma omp atomic compare capture
+ { if (d == e) { d = f; } else { v = d; } v = d; } /* { dg-error "unexpected 'else'" } */
+ #pragma omp atomic compare
+ if (d < e) { d = e; } else { v = d; } /* { dg-error "unexpected 'else'" } */
+ #pragma omp atomic compare capture
+ if (d == e) { d = f; } else v = d; /* { dg-error "expected '\{' before 'v'" } */
+ #pragma omp atomic compare capture
+ if (d == e) { d = f; } else { v += d; } /* { dg-error "expected '=' before '\\\+=' token" } */
+ #pragma omp atomic compare capture
+ if (d == e) { d = f; } else { v = e; } /* { dg-error "invalid form of '#pragma omp atomic compare' before ';' token" } */
+ #pragma omp atomic compare capture
+ if (d == e) { d = f; } else { v = d }; /* { dg-error "expected ';' before '\}' token" } */
+ #pragma omp atomic compare capture
+ if (d == e) { d = f; }; /* { dg-error "expected 'else' before ';' token" } */
+ #pragma omp atomic compare
+ x++; /* { dg-error "invalid form of 'pragma omp atomic compare'" } */
+ #pragma omp atomic compare
+ x--; /* { dg-error "invalid form of 'pragma omp atomic compare'" } */
+ #pragma omp atomic compare
+ ++x; /* { dg-error "invalid form of 'pragma omp atomic compare'" } */
+ #pragma omp atomic compare
+ --x; /* { dg-error "invalid form of 'pragma omp atomic compare'" } */
+ #pragma omp atomic compare
+ x += 3; /* { dg-error "expected '=' before '\\\+=' token" } */
+ #pragma omp atomic compare
+ x -= 5; /* { dg-error "expected '=' before '-=' token" } */
+ #pragma omp atomic compare
+ x *= 2; /* { dg-error "expected '=' before '\\\*=' token" } */
+ #pragma omp atomic compare
+ x |= 5; /* { dg-error "expected '=' before '\\\|=' token" } */
+ #pragma omp atomic compare
+ x &= ~5; /* { dg-error "expected '=' before '\\\&=' token" } */
+ #pragma omp atomic compare
+ x ^= 5; /* { dg-error "expected '=' before '\\\^=' token" } */
+ #pragma omp atomic compare
+ x = x + 3; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x - 5; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = 2 * x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = 5 | x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x & ~5; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x | 5; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x >= 5 ? 5 : x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x <= 5 ? 5 : x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x != 5 ? 7 : x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = 5 == x ? 7 : x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x == 5 ? x : 7; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x == 5 ? 9 : 7; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x > 5 ? 6 : x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x < 5 ? 6 : x; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x > 5 ? x : 6; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic compare
+ x = x < 5 ? x : 6; /* { dg-error "invalid form of '#pragma omp atomic' before ';' token" } */
+ #pragma omp atomic capture
+ r = x == 5; /* { dg-error "invalid operator for '#pragma omp atomic' before '==' token" } */
+ #pragma omp atomic capture compare
+ r = x == 5; /* { dg-error "expected '=' before '==' token" } */
+ #pragma omp atomic capture compare /* { dg-error "'#pragma omp atomic compare capture' with non-integral comparison result" } */
+ { v = x == 5; if (v) { x = 6; } }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/attrs-1.c b/gcc/testsuite/c-c++-common/gomp/attrs-1.c
new file mode 100644
index 0000000..e3c0fa6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/attrs-1.c
@@ -0,0 +1,146 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+#if __has_attribute(omp::directive)
+#ifndef __cplusplus
+#error omp::directive supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::directive not supported in C++
+#endif
+#endif
+
+#if __has_attribute(omp::sequence)
+#ifndef __cplusplus
+#error omp::sequence supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::sequence not supported in C++
+#endif
+#endif
+
+#if __has_attribute(omp::unknown)
+#error omp::unknown supported
+#endif
+
+#if __has_cpp_attribute(omp::directive)
+#ifndef __cplusplus
+#error omp::directive supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::directive not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(omp::sequence)
+#ifndef __cplusplus
+#error omp::sequence supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::sequence not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(omp::unknown)
+#error omp::unknown supported
+#endif
+
+#if __has_attribute(__omp__::__directive__)
+#ifndef __cplusplus
+#error __omp__::__directive__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__directive__ not supported in C++
+#endif
+#endif
+
+#if __has_attribute(__omp__::__sequence__)
+#ifndef __cplusplus
+#error __omp__::__sequence__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__sequence__ not supported in C++
+#endif
+#endif
+
+#if __has_attribute(__omp__::__unknown__)
+#error __omp__::__unknown__ supported
+#endif
+
+#if __has_cpp_attribute(__omp__::__directive__)
+#ifndef __cplusplus
+#error __omp__::__directive__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__directive__ not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(__omp__::__sequence__)
+#ifndef __cplusplus
+#error __omp__::__sequence__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__sequence__ not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(__omp__::__unknown__)
+#error __omp__::__unknown__ supported
+#endif
+
+#if __has_attribute(omp::__directive__)
+#ifndef __cplusplus
+#error omp::__directive__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::__directive__ not supported in C++
+#endif
+#endif
+
+#if __has_attribute(__omp__::sequence)
+#ifndef __cplusplus
+#error __omp__::sequence supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::sequence not supported in C++
+#endif
+#endif
+
+#if __has_attribute(omp::__unknown__)
+#error omp::__unknown__ supported
+#endif
+
+#if __has_cpp_attribute(__omp__::directive)
+#ifndef __cplusplus
+#error __omp__::directive supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::directive not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(omp::__sequence__)
+#ifndef __cplusplus
+#error omp::__sequence__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::__sequence__ not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(__omp__::unknown)
+#error __omp__::unknown supported
+#endif
diff --git a/gcc/testsuite/c-c++-common/gomp/attrs-2.c b/gcc/testsuite/c-c++-common/gomp/attrs-2.c
new file mode 100644
index 0000000..21abcdd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/attrs-2.c
@@ -0,0 +1,146 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-openmp -fopenmp-simd" } */
+
+#if __has_attribute(omp::directive)
+#ifndef __cplusplus
+#error omp::directive supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::directive not supported in C++
+#endif
+#endif
+
+#if __has_attribute(omp::sequence)
+#ifndef __cplusplus
+#error omp::sequence supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::sequence not supported in C++
+#endif
+#endif
+
+#if __has_attribute(omp::unknown)
+#error omp::unknown supported
+#endif
+
+#if __has_cpp_attribute(omp::directive)
+#ifndef __cplusplus
+#error omp::directive supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::directive not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(omp::sequence)
+#ifndef __cplusplus
+#error omp::sequence supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::sequence not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(omp::unknown)
+#error omp::unknown supported
+#endif
+
+#if __has_attribute(__omp__::__directive__)
+#ifndef __cplusplus
+#error __omp__::__directive__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__directive__ not supported in C++
+#endif
+#endif
+
+#if __has_attribute(__omp__::__sequence__)
+#ifndef __cplusplus
+#error __omp__::__sequence__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__sequence__ not supported in C++
+#endif
+#endif
+
+#if __has_attribute(__omp__::__unknown__)
+#error __omp__::__unknown__ supported
+#endif
+
+#if __has_cpp_attribute(__omp__::__directive__)
+#ifndef __cplusplus
+#error __omp__::__directive__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__directive__ not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(__omp__::__sequence__)
+#ifndef __cplusplus
+#error __omp__::__sequence__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::__sequence__ not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(__omp__::__unknown__)
+#error __omp__::__unknown__ supported
+#endif
+
+#if __has_attribute(omp::__directive__)
+#ifndef __cplusplus
+#error omp::__directive__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::__directive__ not supported in C++
+#endif
+#endif
+
+#if __has_attribute(__omp__::sequence)
+#ifndef __cplusplus
+#error __omp__::sequence supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::sequence not supported in C++
+#endif
+#endif
+
+#if __has_attribute(omp::__unknown__)
+#error omp::__unknown__ supported
+#endif
+
+#if __has_cpp_attribute(__omp__::directive)
+#ifndef __cplusplus
+#error __omp__::directive supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error __omp__::directive not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(omp::__sequence__)
+#ifndef __cplusplus
+#error omp::__sequence__ supported in C
+#endif
+#else
+#ifdef __cplusplus
+#error omp::__sequence__ not supported in C++
+#endif
+#endif
+
+#if __has_cpp_attribute(__omp__::unknown)
+#error __omp__::unknown supported
+#endif
diff --git a/gcc/testsuite/c-c++-common/gomp/attrs-3.c b/gcc/testsuite/c-c++-common/gomp/attrs-3.c
new file mode 100644
index 0000000..5900244
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/attrs-3.c
@@ -0,0 +1,74 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-openmp -fno-openmp-simd" } */
+
+#if __has_attribute(omp::directive)
+#error omp::directive supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_attribute(omp::sequence)
+#error omp::sequence supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_attribute(omp::unknown)
+#error omp::unknown supported
+#endif
+
+#if __has_cpp_attribute(omp::directive)
+#error omp::directive supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_cpp_attribute(omp::sequence)
+#error omp::sequence supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_cpp_attribute(omp::unknown)
+#error omp::unknown supported
+#endif
+
+#if __has_attribute(__omp__::__directive__)
+#error __omp__::__directive__ supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_attribute(__omp__::__sequence__)
+#error __omp__::__sequence__ supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_attribute(__omp__::__unknown__)
+#error __omp__::__unknown__ supported
+#endif
+
+#if __has_cpp_attribute(__omp__::__directive__)
+#error __omp__::__directive__ supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_cpp_attribute(__omp__::__sequence__)
+#error __omp__::__sequence__ supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_cpp_attribute(__omp__::__unknown__)
+#error __omp__::__unknown__ supported
+#endif
+
+#if __has_attribute(omp::__directive__)
+#error omp::__directive__ supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_attribute(__omp__::sequence)
+#error __omp__::sequence supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_attribute(omp::__unknown__)
+#error omp::__unknown__ supported
+#endif
+
+#if __has_cpp_attribute(__omp__::directive)
+#error __omp__::directive supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_cpp_attribute(omp::__sequence__)
+#error omp::__sequence__ supported even when -fno-openmp{,-simd}
+#endif
+
+#if __has_cpp_attribute(__omp__::unknown)
+#error __omp__::unknown supported
+#endif
diff --git a/gcc/testsuite/c-c++-common/gomp/cancel-1.c b/gcc/testsuite/c-c++-common/gomp/cancel-1.c
index 5255dd3..5d68cd3 100644
--- a/gcc/testsuite/c-c++-common/gomp/cancel-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/cancel-1.c
@@ -39,6 +39,28 @@ f2 (void)
#pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
#pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
}
+ #pragma omp masked
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp scope
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
#pragma omp single
{
#pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/clause-dups-1.c b/gcc/testsuite/c-c++-common/gomp/clause-dups-1.c
index 3dde058..604caf0 100644
--- a/gcc/testsuite/c-c++-common/gomp/clause-dups-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/clause-dups-1.c
@@ -203,7 +203,10 @@ f1 (int *p)
i = p[0]++;
#pragma omp atomic capture hint(0) hint (0) /* { dg-error "too many 'hint' clauses" } */
i = p[0]++;
-
+ #pragma omp masked filter (0) filter (0) /* { dg-error "too many 'filter' clauses" } */
+ f0 ();
+ #pragma omp scope nowait nowait /* { dg-error "too many 'nowait' clauses" } */
+ ;
}
#pragma omp declare simd simdlen (4) simdlen (4) /* { dg-error "too many 'simdlen' clauses" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/clauses-1.c b/gcc/testsuite/c-c++-common/gomp/clauses-1.c
index 105288e..378c7bf 100644
--- a/gcc/testsuite/c-c++-common/gomp/clauses-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/clauses-1.c
@@ -125,20 +125,20 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
#pragma omp target parallel \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f)
+ nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
;
#pragma omp target parallel for \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) nowait depend(inout: dd[0]) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target parallel for \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) nowait depend(inout: dd[0]) order(concurrent) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target parallel for simd \
@@ -146,18 +146,18 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) \
safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3) order(concurrent) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target teams \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0]) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
;
#pragma omp target teams distribute \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
- collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f)
+ collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
;
#pragma omp target teams distribute parallel for \
@@ -166,7 +166,7 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) nowait depend(inout: dd[0]) order(concurrent) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target teams distribute parallel for simd \
@@ -176,7 +176,7 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
if (parallel: i2) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) order(concurrent) \
safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target teams distribute simd \
@@ -184,14 +184,14 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) order(concurrent) \
safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target simd \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
safelen(8) simdlen(4) lastprivate (l) linear(ll: 1) aligned(q: 32) reduction(+:r) \
nowait depend(inout: dd[0]) nontemporal(ntm) if(simd:i3) order(concurrent) \
- allocate (omp_default_mem_alloc:f)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp taskgroup task_reduction(+:r2) allocate (r2)
@@ -215,7 +215,7 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
- #pragma omp target nowait depend(inout: dd[0])
+ #pragma omp target nowait depend(inout: dd[0]) in_reduction(+:r2)
#pragma omp teams distribute \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) allocate (omp_default_mem_alloc: f)
@@ -273,6 +273,10 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) reduction(+:r) \
num_threads (nth) proc_bind(spread) copyin(t) allocate (f)
;
+ #pragma omp parallel masked \
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) reduction(+:r) \
+ num_threads (nth) proc_bind(spread) copyin(t) allocate (f) filter (d)
+ ;
#pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) \
@@ -280,23 +284,47 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
for (int i = 0; i < 64; i++)
ll++;
#pragma omp taskgroup task_reduction (+:r2) allocate (r2)
+ #pragma omp masked taskloop \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) \
+ reduction(default, +:r) in_reduction(+:r2) allocate (f) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) \
order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
+ #pragma omp masked taskloop simd \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) \
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) \
+ order(concurrent) allocate (f) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
#pragma omp parallel master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) \
reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
+ #pragma omp parallel masked taskloop \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) \
+ reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) allocate (f) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
#pragma omp parallel master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) \
order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
+ #pragma omp parallel masked taskloop simd \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) \
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) \
+ order(concurrent) allocate (f) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
#pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
@@ -304,23 +332,47 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
for (int i = 0; i < 64; i++)
ll++;
#pragma omp taskgroup task_reduction (+:r2) allocate (r2)
+ #pragma omp mastked taskloop \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
+ reduction(default, +:r) in_reduction(+:r2) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) \
order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
+ #pragma omp masked taskloop simd \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) \
+ order(concurrent) allocate (f) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
#pragma omp parallel master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
reduction(default, +:r) num_threads (nth) proc_bind(spread) copyin(t) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
+ #pragma omp parallel masked taskloop \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
+ reduction(default, +:r) num_threads (nth) proc_bind(spread) copyin(t) allocate (f) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
#pragma omp parallel master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) num_threads (nth) proc_bind(spread) copyin(t) \
order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
+ #pragma omp parallel masked taskloop simd \
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) num_threads (nth) proc_bind(spread) copyin(t) \
+ order(concurrent) allocate (f) filter (d)
+ for (int i = 0; i < 64; i++)
+ ll++;
#pragma omp loop bind(thread) order(concurrent) \
private (p) lastprivate (l) collapse(1) reduction(+:r)
for (l = 0; l < 64; ++l)
@@ -349,28 +401,28 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
nowait depend(inout: dd[0]) lastprivate (l) bind(parallel) order(concurrent) collapse(1) \
- allocate (omp_default_mem_alloc: f)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2)
for (l = 0; l < 64; ++l)
;
#pragma omp target parallel loop \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
nowait depend(inout: dd[0]) lastprivate (l) order(concurrent) collapse(1) \
- allocate (omp_default_mem_alloc: f)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2)
for (l = 0; l < 64; ++l)
;
#pragma omp target teams loop \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0]) \
lastprivate (l) bind(teams) collapse(1) \
- allocate (omp_default_mem_alloc: f)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2)
for (l = 0; l < 64; ++l)
;
#pragma omp target teams loop \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0]) \
lastprivate (l) order(concurrent) collapse(1) \
- allocate (omp_default_mem_alloc: f)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2)
for (l = 0; l < 64; ++l)
;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/clauses-5.c b/gcc/testsuite/c-c++-common/gomp/clauses-5.c
index 35e16f0..87e53a9 100644
--- a/gcc/testsuite/c-c++-common/gomp/clauses-5.c
+++ b/gcc/testsuite/c-c++-common/gomp/clauses-5.c
@@ -49,4 +49,6 @@ foo (int *p)
;
#pragma omp critical (baz) hint (2, 3) /* { dg-error "expected" } */
;
+ #pragma omp masked filter (3, 4) /* { dg-error "expected" } */
+ ;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/error-1.c b/gcc/testsuite/c-c++-common/gomp/error-1.c
new file mode 100644
index 0000000..6a40f85
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/error-1.c
@@ -0,0 +1,45 @@
+#pragma omp error /* { dg-error "'pragma omp error' encountered" } */
+#pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */
+#pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */
+#pragma omp error message("my msg") /* { dg-error "'pragma omp error' encountered: my msg" } */
+#pragma omp error severity(warning)message("another message")at(compilation) /* { dg-warning "'pragma omp error' encountered: another message" } */
+
+struct S {
+ #pragma omp error /* { dg-error "'pragma omp error' encountered" } */
+ #pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */
+ #pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */
+ #pragma omp error message("42") /* { dg-error "'pragma omp error' encountered: 42" } */
+ #pragma omp error severity(warning), message("foo"), at(compilation) /* { dg-warning "'pragma omp error' encountered: foo" } */
+ int s;
+};
+
+int
+foo (int i, int x)
+{
+ #pragma omp error /* { dg-error "'pragma omp error' encountered" } */
+ #pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */
+ #pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */
+ #pragma omp error message("42 / 1") /* { dg-error "'pragma omp error' encountered: 42 / 1" } */
+ #pragma omp error severity(warning) message("bar") at(compilation) /* { dg-warning "'pragma omp error' encountered: bar" } */
+ if (x)
+ #pragma omp error /* { dg-error "'pragma omp error' encountered" } */
+ i++;
+ if (x)
+ ;
+ else
+ #pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */
+ i++;
+ switch (0)
+ #pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */
+ {
+ default:
+ break;
+ }
+ while (0)
+ #pragma omp error message("42 - 1") /* { dg-error "'pragma omp error' encountered: 42 - 1" } */
+ i++;
+ lab:
+ #pragma omp error severity(warning) message("bar") at(compilation) /* { dg-warning "'pragma omp error' encountered: bar" } */
+ i++;
+ return i;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/error-2.c b/gcc/testsuite/c-c++-common/gomp/error-2.c
new file mode 100644
index 0000000..4e13f03
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/error-2.c
@@ -0,0 +1,24 @@
+void
+foo (int x, const char *msg1, const char *msg2)
+{
+ if (x == 0)
+ {
+ #pragma omp error at(execution)
+ }
+ else if (x == 1)
+ {
+ #pragma omp error severity (warning), at (execution)
+ }
+ else if (x == 2)
+ {
+ #pragma omp error at ( execution ) severity (fatal) message ("baz")
+ }
+ else if (x == 3)
+ {
+ #pragma omp error severity(warning) message (msg1) at(execution)
+ }
+ else
+ {
+ #pragma omp error message (msg2), at(execution), severity(fatal)
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/error-3.c b/gcc/testsuite/c-c++-common/gomp/error-3.c
new file mode 100644
index 0000000..d2b8b83
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/error-3.c
@@ -0,0 +1,70 @@
+#pragma omp error asdf /* { dg-error "expected 'at', 'severity' or 'message' clause" } */
+#pragma omp error at /* { dg-error "expected '\\\(' before end of line" } */
+#pragma omp error at( /* { dg-error "expected 'execution' or 'compilation'" } */
+ /* { dg-error "expected '\\\)' before end of line" "" { target *-*-* } .-1 } */
+#pragma omp error at(runtime) /* { dg-error "expected 'execution' or 'compilation'" } */
+#pragma omp error at(+ /* { dg-error "expected 'execution' or 'compilation'" } */
+ /* { dg-error "expected '\\\)' before '\\\+' token" "" { target *-*-* } .-1 } */
+#pragma omp error at(compilation /* { dg-error "expected '\\\)' before end of line" } */
+ /* { dg-error "'pragma omp error' encountered" "" { target *-*-* } .-1 } */
+#pragma omp error severity /* { dg-error "expected '\\\(' before end of line" } */
+#pragma omp error severity( /* { dg-error "expected 'warning' or 'fatal'" } */
+ /* { dg-error "expected '\\\)' before end of line" "" { target *-*-* } .-1 } */
+#pragma omp error severity(error) /* { dg-error "expected 'warning' or 'fatal'" } */
+#pragma omp error severity(- /* { dg-error "expected 'warning' or 'fatal'" } */
+ /* { dg-error "expected '\\\)' before '-' token" "" { target *-*-* } .-1 } */
+#pragma omp error severity(fatal /* { dg-error "expected '\\\)' before end of line" } */
+ /* { dg-error "'pragma omp error' encountered" "" { target *-*-* } .-1 } */
+#pragma omp error message /* { dg-error "expected '\\\(' before end of line" } */
+#pragma omp error message( /* { dg-error "expected expression before end of line" "" { target c } } */
+ /* { dg-error "expected primary-expression before end of line" "" { target c++ } .-1 } */
+ /* { dg-error "expected '\\\)' before end of line" "" { target c++ } .-2 } */
+ /* { dg-error "'pragma omp error' encountered: <message unknown at compile time>" "" { target *-*-* } .-3 } */
+#pragma omp error message(0 /* { dg-error "expected '\\\)' before end of line" } */
+ /* { dg-error "'pragma omp error' encountered: <message unknown at compile time>" "" { target *-*-* } .-1 } */
+#pragma omp error message("foo" /* { dg-error "expected '\\\)' before end of line" } */
+ /* { dg-error "'pragma omp error' encountered: foo" "" { target *-*-* } .-1 } */
+#pragma omp error message(1) /* { dg-error "'pragma omp error' encountered: <message unknown at compile time>" } */
+ /* { dg-error "invalid conversion from 'int' to 'const char\\*'" "" { target c++ } .-1 } */
+#pragma omp error message(1.2) /* { dg-error "cannot convert to a pointer type" "" { target c } } */
+ /* { dg-error "could not convert" "" { target c++ } .-1 } */
+ /* { dg-error "'pragma omp error' encountered: <message unknown at compile time>" "" { target *-*-* } .-2 } */
+#pragma omp error message(L"bar") /* { dg-error "'pragma omp error' encountered: <message unknown at compile time>" } */
+ /* { dg-error "could not convert" "" { target c++ } .-1 } */
+#pragma omp error message("foo"),at(compilation),severity(fatal), /* { dg-error "expected end of line before ',' token" } */
+ /* { dg-error "'pragma omp error' encountered: foo" "" { target *-*-* } .-1 } */
+#pragma omp error message("foo"),at(compilation),severity(fatal),asdf /* { dg-error "expected 'at', 'severity' or 'message' clause" } */
+#pragma omp error at(compilation) at(compilation) /* { dg-error "too many 'at' clauses" } */
+#pragma omp error severity(fatal) severity(warning) /* { dg-error "too many 'severity' clauses" } */
+#pragma omp error message("foo") message("foo") /* { dg-error "too many 'message' clauses" } */
+#pragma omp error at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */
+
+struct S
+{
+ #pragma omp error at(execution) message("foo")/* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */
+ int s;
+};
+
+int
+foo (int i, int x, const char *msg)
+{
+ #pragma omp error message(msg) /* { dg-error "'pragma omp error' encountered: <message unknown at compile time>" } */
+ if (x)
+ #pragma omp error at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */
+ i++;
+ if (x)
+ ;
+ else
+ #pragma omp error at(execution) severity(warning) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */
+ i++;
+ switch (0)
+ #pragma omp error severity(fatal) at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */
+ ;
+ while (0)
+ #pragma omp error at(execution)message("42 - 1") /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */
+ i++;
+ lab:
+ #pragma omp error severity(warning) message("bar") at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */
+ i++;
+ return i;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/flush-1.c b/gcc/testsuite/c-c++-common/gomp/flush-1.c
index 7c3e529..717b951 100644
--- a/gcc/testsuite/c-c++-common/gomp/flush-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/flush-1.c
@@ -1,4 +1,5 @@
/* { dg-additional-options "-fdump-tree-gimple" } */
+/* { dg-final { scan-tree-dump "foo \\(6\\);\[\n\r]* __sync_synchronize \\(\\);\[\n\r]* foo \\(6\\);" "gimple" } } */
/* { dg-final { scan-tree-dump "foo \\(4\\);\[\n\r]* __atomic_thread_fence \\(4\\);\[\n\r]* foo \\(4\\);" "gimple" } } */
/* { dg-final { scan-tree-dump "foo \\(3\\);\[\n\r]* __atomic_thread_fence \\(3\\);\[\n\r]* foo \\(3\\);" "gimple" } } */
/* { dg-final { scan-tree-dump "foo \\(2\\);\[\n\r]* __atomic_thread_fence \\(2\\);\[\n\r]* foo \\(2\\);" "gimple" } } */
@@ -37,3 +38,11 @@ f4 (void)
#pragma omp flush
foo (5);
}
+
+void
+f5 (void)
+{
+ foo (6);
+ #pragma omp flush seq_cst
+ foo (6);
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/flush-2.c b/gcc/testsuite/c-c++-common/gomp/flush-2.c
index 00baa8a..30ef598 100644
--- a/gcc/testsuite/c-c++-common/gomp/flush-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/flush-2.c
@@ -8,10 +8,11 @@ foo (void)
#pragma omp flush acquire
#pragma omp flush release
#pragma omp flush acq_rel
- #pragma omp flush relaxed /* { dg-error "expected 'acq_rel', 'release' or 'acquire'" } */
- #pragma omp flush seq_cst /* { dg-error "expected 'acq_rel', 'release' or 'acquire'" } */
- #pragma omp flush foobar /* { dg-error "expected 'acq_rel', 'release' or 'acquire'" } */
+ #pragma omp flush seq_cst
+ #pragma omp flush relaxed /* { dg-error "expected 'seq_cst', 'acq_rel', 'release' or 'acquire'" } */
+ #pragma omp flush foobar /* { dg-error "expected 'seq_cst', 'acq_rel', 'release' or 'acquire'" } */
#pragma omp flush acquire (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
#pragma omp flush release (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
#pragma omp flush acq_rel (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
+ #pragma omp flush seq_cst (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
}
diff --git a/gcc/testsuite/c-c++-common/gomp/loop-1.c b/gcc/testsuite/c-c++-common/gomp/loop-1.c
index 4fb995c..3454fa8 100644
--- a/gcc/testsuite/c-c++-common/gomp/loop-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/loop-1.c
@@ -183,6 +183,24 @@ f5 (int *a)
}
#pragma omp loop
for (i = 0; i < 64; i++)
+ {
+ #pragma omp master /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" } */
+ foo ();
+ }
+ #pragma omp loop
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp masked /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" } */
+ foo ();
+ }
+ #pragma omp loop
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp scope /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" } */
+ foo ();
+ }
+ #pragma omp loop
+ for (i = 0; i < 64; i++)
a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
#pragma omp loop
for (i = 0; i < 64; i++)
diff --git a/gcc/testsuite/c-c++-common/gomp/map-6.c b/gcc/testsuite/c-c++-common/gomp/map-6.c
new file mode 100644
index 0000000..6ee5971
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/map-6.c
@@ -0,0 +1,135 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+void
+foo (void)
+{
+ /* Test to ensure that the close modifier is parsed and ignored in map clauses. */
+ int a, b, b1, b2, b3, b4, b5, b6, b7;
+
+ #pragma omp target map (a)
+ ;
+
+ #pragma omp target map (to:a)
+ ;
+
+ #pragma omp target map (a to: b) /* { dg-error "'#pragma omp target' with modifier other than 'always' or 'close'" } */
+ ;
+
+ #pragma omp target map (close, a to: b) /* { dg-error "'#pragma omp target' with modifier other than 'always' or 'close'" } */
+ ;
+
+ #pragma omp target map (close a) /* { dg-error "'close' undeclared" "" { target c } } */
+ /* { dg-error "'close' has not been declared" "" { target c++ } .-1 } */
+ /* { dg-error "expected '\\)' before 'a'" "" { target *-*-* } .-2 } */
+ ;
+
+ #pragma omp target map (always a) /* { dg-error "'always' undeclared" "" { target c } } */
+ /* { dg-error "'always' has not been declared" "" { target c++ } .-1 } */
+ /* { dg-error "expected '\\)' before 'a'" "" { target *-*-* } .-2 } */
+ ;
+
+ #pragma omp target map (close to:a)
+ ;
+
+ #pragma omp target map (close, to:a)
+ ;
+
+ #pragma omp target map (close delete:a) /* { dg-error "'#pragma omp target' with map-type other than 'to', 'from', 'tofrom' or 'alloc' on 'map' clause" } */
+ ;
+
+ #pragma omp target map (close always to:b1)
+ ;
+
+ #pragma omp target map (close, always to:b2)
+ ;
+
+ #pragma omp target map (close, always, to:b3)
+ ;
+
+ #pragma omp target map (always close to:b4)
+ ;
+
+ #pragma omp target map (always, close to:b5)
+ ;
+
+ #pragma omp target map (always, close, to:b6)
+ ;
+
+ #pragma omp target map (always, always, to:a) /* { dg-error "too many 'always' modifiers" } */
+ ;
+
+ #pragma omp target map (always always, to:a) /* { dg-error "too many 'always' modifiers" } */
+ ;
+
+ #pragma omp target map (always, always to:a) /* { dg-error "too many 'always' modifiers" } */
+ ;
+
+ #pragma omp target map (always always to:a) /* { dg-error "too many 'always' modifiers" } */
+ ;
+
+ #pragma omp target map (close, close, to:a) /* { dg-error "too many 'close' modifiers" } */
+ ;
+
+ #pragma omp target map (close close, to:a) /* { dg-error "too many 'close' modifiers" } */
+ ;
+
+ #pragma omp target map (close, close to:a) /* { dg-error "too many 'close' modifiers" } */
+ ;
+
+ #pragma omp target map (close close to:a) /* { dg-error "too many 'close' modifiers" } */
+ ;
+
+ #pragma omp target map (always to : a) map (close to : b)
+ ;
+
+ int close = 0;
+ #pragma omp target map (close)
+ ;
+
+ #pragma omp target map (close a) /* { dg-error "expected '\\)' before 'a'" } */
+ ;
+
+ int always = 0;
+ #pragma omp target map (always)
+ ;
+
+ #pragma omp target map (always a) /* { dg-error "expected '\\)' before 'a'" } */
+ ;
+
+ #pragma omp target map (always, close)
+ ;
+
+ #pragma omp target map (always, always) /* { dg-error "'always' appears more than once in map clauses" } */
+ ;
+
+ #pragma omp target map (always, always, close) /* { dg-error "'always' appears more than once in map clauses" } */
+ ;
+
+ #pragma omp target map (always, close, to: always, close, b7)
+ ;
+
+ int to = 0;
+ #pragma omp target map (always, close, to)
+ ;
+
+ #pragma omp target map (to, always, close)
+ {
+ to = always = close = 1;
+ }
+ if (to != 1 || always != 1 || close != 1)
+ __builtin_abort ();
+ ;
+}
+
+/* { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } } */
+
+/* { dg-final { scan-tree-dump-times "pragma omp target map\\(always,to:" 7 "original" } } */
+
+/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b1" "original" } } */
+/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b2" "original" } } */
+/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b3" "original" } } */
+/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b4" "original" } } */
+/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b5" "original" } } */
+/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b6" "original" } } */
+/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b7\\) map\\(always,to:close\\) map\\(always,to:always\\)" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/map-7.c b/gcc/testsuite/c-c++-common/gomp/map-7.c
new file mode 100644
index 0000000..3f1e972
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/map-7.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+ /* Test to ensure that the close modifier is parsed and ignored in map clauses. */
+
+ #define N 1024
+ int always[N];
+ int close;
+
+ #pragma omp target map(always[:N])
+ ;
+
+ #pragma omp target map(close, always[:N])
+ ;
+
+ #pragma omp target map(always[:N], close)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/masked-1.c b/gcc/testsuite/c-c++-common/gomp/masked-1.c
new file mode 100644
index 0000000..36c2e49
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/masked-1.c
@@ -0,0 +1,23 @@
+void bar (void);
+
+void
+foo (int x, int *a)
+{
+ #pragma omp masked
+ bar ();
+ #pragma omp masked filter (0)
+ bar ();
+ #pragma omp masked filter (7)
+ bar ();
+ #pragma omp masked filter (x)
+ bar ();
+ #pragma omp masked taskloop simd filter (x) grainsize (12) simdlen (4)
+ for (int i = 0; i < 128; i++)
+ a[i] = i;
+ #pragma omp parallel masked filter (x) firstprivate (x)
+ bar ();
+ #pragma omp masked
+ #pragma omp masked filter (0)
+ #pragma omp masked filter (x)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/masked-2.c b/gcc/testsuite/c-c++-common/gomp/masked-2.c
new file mode 100644
index 0000000..7230c82
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/masked-2.c
@@ -0,0 +1,11 @@
+void bar (void);
+struct S { int s; };
+
+void
+foo (float f, struct S s)
+{
+ #pragma omp masked filter (0.0) /* { dg-error "integral|integer" } */
+ bar ();
+ #pragma omp masked filter (s) /* { dg-error "integral|integer" } */
+ bar ();
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/masked-combined-1.c b/gcc/testsuite/c-c++-common/gomp/masked-combined-1.c
new file mode 100644
index 0000000..0b3ff58
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/masked-combined-1.c
@@ -0,0 +1,37 @@
+void bar (int *);
+
+void
+foo (int *a, int f)
+{
+ int i, j, k, u = 0, v = 0, w = 0, x = 0, y = 0, z = 0;
+ #pragma omp parallel masked default(none) private (k) filter (f) firstprivate (f)
+ bar (&k);
+ #pragma omp parallel masked default(none) private (k)
+ bar (&k);
+ #pragma omp parallel default(none) firstprivate(a, f) shared(x, y, z)
+ {
+ #pragma omp masked taskloop reduction (+:x) default(none) firstprivate(a) filter (f)
+ for (i = 0; i < 64; i++)
+ x += a[i];
+ #pragma omp masked taskloop simd reduction (+:y) default(none) firstprivate(a) private (i) filter (f)
+ for (i = 0; i < 64; i++)
+ y += a[i];
+ #pragma omp masked taskloop simd reduction (+:y) default(none) firstprivate(a) private (i)
+ for (i = 0; i < 64; i++)
+ y += a[i];
+ #pragma omp masked taskloop simd collapse(2) reduction (+:z) default(none) firstprivate(a) private (i, j) filter (f)
+ for (j = 0; j < 1; j++)
+ for (i = 0; i < 64; ++i)
+ z += a[i];
+ }
+ #pragma omp parallel masked taskloop reduction (+:u) default(none) firstprivate(a, f) filter (f)
+ for (i = 0; i < 64; i++)
+ u += a[i];
+ #pragma omp parallel masked taskloop simd reduction (+:v) default(none) firstprivate(a, f) filter (f)
+ for (i = 0; i < 64; i++)
+ v += a[i];
+ #pragma omp parallel masked taskloop simd collapse(2) reduction (+:w) default(none) firstprivate(a, f) filter (f)
+ for (j = 0; j < 1; j++)
+ for (i = 0; i < 64; ++i)
+ w += a[i];
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/masked-combined-2.c b/gcc/testsuite/c-c++-common/gomp/masked-combined-2.c
new file mode 100644
index 0000000..1d63969
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/masked-combined-2.c
@@ -0,0 +1,13 @@
+void
+foo (int *a)
+{
+ int i, r = 0, s = 0;
+ #pragma omp taskgroup task_reduction(+:r)
+ #pragma omp parallel masked taskloop in_reduction(+:r) /* { dg-error "'in_reduction' is not valid for '#pragma omp parallel masked taskloop'" } */
+ for (i = 0; i < 64; i++)
+ r += a[i];
+ #pragma omp taskgroup task_reduction(+:s)
+ #pragma omp parallel masked taskloop simd in_reduction(+:s) /* { dg-error "'in_reduction' is not valid for '#pragma omp parallel masked taskloop simd'" } */
+ for (i = 0; i < 64; i++)
+ s += a[i];
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/nesting-2.c b/gcc/testsuite/c-c++-common/gomp/nesting-2.c
index 7a03430..420cfd3 100644
--- a/gcc/testsuite/c-c++-common/gomp/nesting-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/nesting-2.c
@@ -19,6 +19,10 @@ foo (void)
#pragma omp barrier /* { dg-error "region may not be closely nested inside of" } */
#pragma omp master /* { dg-error "region may not be closely nested inside of" } */
;
+ #pragma omp masked /* { dg-error "region may not be closely nested inside of" } */
+ ;
+ #pragma omp scope /* { dg-error "region may not be closely nested inside of" } */
+ ;
#pragma omp ordered /* { dg-error "region may not be closely nested inside of" } */
;
#pragma omp ordered threads /* { dg-error "region may not be closely nested inside of" } */
@@ -55,6 +59,10 @@ foo (void)
#pragma omp barrier
#pragma omp master
;
+ #pragma omp masked
+ ;
+ #pragma omp scope
+ ;
#pragma omp ordered /* { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" } */
;
#pragma omp ordered threads /* { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" } */
@@ -89,6 +97,10 @@ foo (void)
#pragma omp barrier
#pragma omp master
;
+ #pragma omp masked
+ ;
+ #pragma omp scope
+ ;
#pragma omp ordered /* { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" } */
;
#pragma omp ordered threads /* { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/nothing-1.c b/gcc/testsuite/c-c++-common/gomp/nothing-1.c
new file mode 100644
index 0000000..d50c92a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/nothing-1.c
@@ -0,0 +1,37 @@
+#pragma omp nothing
+
+struct S
+{
+ #pragma omp nothing
+ int s;
+};
+
+int
+foo (int i)
+{
+ #pragma omp nothing
+ if (0)
+ #pragma omp nothing
+ i++;
+ if (1)
+ ;
+ else
+ #pragma omp nothing
+ i++;
+ switch (0)
+ #pragma omp nothing
+ {
+ default:
+ break;
+ }
+ while (0)
+ #pragma omp nothing
+ i++;
+ for (; 0;)
+ #pragma omp nothing
+ i++;
+ lab:
+ #pragma omp nothing
+ i++;
+ return i;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/nothing-2.c b/gcc/testsuite/c-c++-common/gomp/nothing-2.c
new file mode 100644
index 0000000..a152035
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/nothing-2.c
@@ -0,0 +1,2 @@
+#pragma omp nothing , /* { dg-error "expected end of line before" } */
+#pragma omp nothing asdf /* { dg-error "expected end of line before" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/pr100450.c b/gcc/testsuite/c-c++-common/gomp/pr100450.c
new file mode 100644
index 0000000..a6d2a28
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr100450.c
@@ -0,0 +1,20 @@
+/* PR c/100450 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -save-temps -Wunknown-pragmas" } */
+
+#define TEST(T) { \
+ {T} \
+}
+#define CLAUSES reduction(+:red)
+#define PARALLEL_FOR(X) TEST({ \
+_Pragma("omp for CLAUSES") \
+X \
+})
+
+void foo()
+{
+ int red = 0;
+ int A[3] = {};
+ #pragma omp parallel shared(red)
+ PARALLEL_FOR( for(int i=0; i < 3; i++) red += A[i]; )
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr100902-1.c b/gcc/testsuite/c-c++-common/gomp/pr100902-1.c
new file mode 100644
index 0000000..babd01a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr100902-1.c
@@ -0,0 +1,17 @@
+/* PR c/100902 */
+
+void
+foo (int *ptr)
+{
+ #pragma omp target map (ptr, ptr[:4])
+ #pragma omp parallel master
+ ptr[0] = 1;
+}
+
+void
+bar (int *ptr)
+{
+ #pragma omp target parallel map (ptr[:4], ptr)
+ #pragma omp master
+ ptr[0] = 1;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr101535-1.c b/gcc/testsuite/c-c++-common/gomp/pr101535-1.c
new file mode 100644
index 0000000..8285ce0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr101535-1.c
@@ -0,0 +1,31 @@
+/* PR middle-end/101535 */
+
+void
+foo (void)
+{
+ int a = 1, i;
+ #pragma omp target data map(to:a)
+ #pragma omp for lastprivate(i) /* { dg-error "lastprivate variable 'i' is private in outer context" } */
+ for (i = 1; i < 2; i++)
+ ;
+}
+
+void
+bar (void)
+{
+ int a = 1, i;
+ #pragma omp target private(i)
+ #pragma omp for lastprivate(i) /* { dg-error "lastprivate variable 'i' is private in outer context" } */
+ for (i = 1; i < 2; i++)
+ ;
+}
+
+void
+baz (void)
+{
+ int a = 1, i;
+ #pragma omp target firstprivate(i)
+ #pragma omp for lastprivate(i) /* { dg-error "lastprivate variable 'i' is private in outer context" } */
+ for (i = 1; i < 2; i++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr101535-2.c b/gcc/testsuite/c-c++-common/gomp/pr101535-2.c
new file mode 100644
index 0000000..23c84af
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr101535-2.c
@@ -0,0 +1,11 @@
+/* PR middle-end/101535 */
+
+void
+foo (void)
+{
+ int a = 1, i;
+ #pragma omp target map(tofrom:i)
+ #pragma omp for lastprivate(i)
+ for (i = 1; i < 2; i++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr61486-2.c b/gcc/testsuite/c-c++-common/gomp/pr61486-2.c
index 4a68023..c86fd91 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr61486-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr61486-2.c
@@ -216,6 +216,19 @@ test (int n, int o, int p, int q, int r, int s, int *pp)
s = i * 10;
}
#pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2])
+ #pragma omp teams distribute parallel for simd if (n != 6)default(shared) \
+ private (p) firstprivate (q) shared (n) reduction (+: r) \
+ thread_limit (n * 2) dist_schedule (static, 4) num_threads (n + 4) \
+ proc_bind (primary) lastprivate (s) schedule (static, 8) \
+ num_teams (n + 4) safelen(16) linear(i:1) aligned (pp:4)
+ for (i = 0; i < 10; i++)
+ {
+ r = r + 1;
+ p = q;
+ a[2+i] = p + q;
+ s = i * 10;
+ }
+ #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2])
#pragma omp teams distribute simd default(shared) \
private (p) firstprivate (q) shared (n) reduction (+: r) \
thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \
diff --git a/gcc/testsuite/c-c++-common/gomp/pr63326.c b/gcc/testsuite/c-c++-common/gomp/pr63326.c
index 3e62723..48ab4f6 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr63326.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr63326.c
@@ -156,64 +156,64 @@ f4 (int x)
{
do
#pragma omp barrier /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
{
do
#pragma omp flush /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
{
do
#pragma omp taskwait /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
{
do
#pragma omp taskyield /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
#pragma omp parallel
{
do
#pragma omp cancel parallel /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
#pragma omp parallel
{
do
#pragma omp cancellation point parallel /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
#pragma omp for ordered(1)
for (i = 0; i < 16; i++)
{
{
do
#pragma omp ordered depend(source) /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
{
do
#pragma omp ordered depend(sink: i-1) /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
}
{
do
#pragma omp target enter data map(to:i) /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
{
do
#pragma omp target update to(i) /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
{
do
#pragma omp target exit data map(from:i) /* { dg-error "may only be used in compound statements" } */
- while (0); /* { dg-error "before" "" { target c++ } } */
- } /* { dg-error "before" "" { target c++ } } */
+ while (0);
+ }
}
void
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-1.c b/gcc/testsuite/c-c++-common/gomp/pr99928-1.c
new file mode 100644
index 0000000..b4aa8dd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-1.c
@@ -0,0 +1,206 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int f00, f01, f02, f03, f04, f05, f06, f07, f08, f09;
+int f12, f13, f14, f15, f16, f17, f18, f19;
+int f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } *//* FIXME. */
+ #pragma omp distribute parallel for firstprivate (f00) default(none)
+ for (int i = 0; i < 64; i++)
+ f00++;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd firstprivate (f01) default(none)
+ for (int i = 0; i < 64; i++)
+ f01++;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f02\\)" "gimple" } } */
+ #pragma omp distribute simd firstprivate (f02)
+ for (int i = 0; i < 64; i++)
+ f02++;
+}
+
+void
+bar (void)
+{
+ int f10 = 0, f11 = 0;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(f03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f03\\)" "gimple" } } */
+ #pragma omp for simd firstprivate (f03)
+ for (int i = 0; i < 64; i++)
+ f03++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f04\\)" "gimple" } } */
+ #pragma omp master taskloop firstprivate (f04) default(none)
+ for (int i = 0; i < 64; i++)
+ f04++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f05\\)" "gimple" } } */
+ #pragma omp master taskloop simd firstprivate (f05) default(none)
+ for (int i = 0; i < 64; i++)
+ f05++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f06\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f06\\)" "gimple" } } *//* FIXME. */
+ #pragma omp parallel for firstprivate (f06) default(none)
+ for (int i = 0; i < 64; i++)
+ f06++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } */
+ #pragma omp parallel for simd firstprivate (f07) default(none)
+ for (int i = 0; i < 64; i++)
+ f07++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f08\\)" "gimple" } } */
+ #pragma omp parallel loop firstprivate (f08) default(none)
+ for (int i = 0; i < 64; i++)
+ f08++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f09\\)" "gimple" } } */
+ #pragma omp parallel master firstprivate (f09) default(none)
+ f09++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f10\\)" "gimple" } } */
+ #pragma omp parallel master taskloop firstprivate (f10) default(none)
+ for (int i = 0; i < 64; i++)
+ f10++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f11\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd firstprivate (f11) default(none)
+ for (int i = 0; i < 64; i++)
+ f11++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*firstprivate\\(f12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*firstprivate\\(f12\\)" "gimple" } } */
+ #pragma omp parallel sections firstprivate (f12) default(none)
+ {
+ f12++;
+ #pragma omp section
+ f12++;
+ }
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f13\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f13\\)" "gimple" } } */
+ #pragma omp target parallel firstprivate (f13) default(none) defaultmap(none)
+ f13++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target parallel for firstprivate (f14) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f14++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } */
+ #pragma omp target parallel for simd firstprivate (f15) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f15++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */
+ #pragma omp target parallel loop firstprivate (f16) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f16++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f17\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f17\\)" "gimple" } } */
+ #pragma omp target teams firstprivate (f17) default(none) defaultmap(none)
+ f17++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target teams distribute firstprivate (f18) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f18++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target teams distribute parallel for firstprivate (f19) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f19++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd firstprivate (f20) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f20++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } */
+ #pragma omp target teams distribute simd firstprivate (f21) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f21++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f22\\)" "gimple" } } *//* NOTE: This is an implementation detail. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */
+ #pragma omp target teams loop firstprivate (f22) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f22++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f23\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f23\\)" "gimple" } } */
+ #pragma omp target simd firstprivate (f23) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ f23++;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f24\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f24\\)" "gimple" } } */
+ #pragma omp taskloop simd firstprivate (f24) default(none)
+ for (int i = 0; i < 64; i++)
+ f24++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f25\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f25\\)" "gimple" } } *//* FIXME. */
+ #pragma omp teams distribute firstprivate (f25) default(none)
+ for (int i = 0; i < 64; i++)
+ f25++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME. */
+ #pragma omp teams distribute parallel for firstprivate (f26) default(none)
+ for (int i = 0; i < 64; i++)
+ f26++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd firstprivate (f27) default(none)
+ for (int i = 0; i < 64; i++)
+ f27++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } */
+ #pragma omp teams distribute simd firstprivate (f28) default(none)
+ for (int i = 0; i < 64; i++)
+ f28++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f29\\)" "gimple" } } *//* NOTE: This is an implementation detail. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */
+ #pragma omp teams loop firstprivate (f29) default(none)
+ for (int i = 0; i < 64; i++)
+ f29++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-10.c b/gcc/testsuite/c-c++-common/gomp/pr99928-10.c
new file mode 100644
index 0000000..4366863
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-10.c
@@ -0,0 +1,231 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int *r00, *r01, *r02, *r03, *r04, *r05;
+int *r13, *r14, *r15, *r16, *r17, *r18, *r19;
+int *r20, *r21, *r22, *r23, *r24;
+int *baz (void);
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r00 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r00 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r00 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp distribute parallel for reduction(+:r00[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r00[1]++;
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } */
+ #pragma omp distribute parallel for simd reduction(+:r01[1:3]) default(none)
+ for (int i = 0; i < 64; i++)
+ r01[1]++;
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r02 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r02 \\+ 4" "gimple" } } */
+ #pragma omp distribute simd reduction(+:r02[1:4])
+ for (int i = 0; i < 64; i++)
+ r02[1]++;
+}
+
+void
+bar (void)
+{
+ int *r06 = baz (), *r07 = baz (), *r08 = baz (), *r09 = baz ();
+ int *r10 = baz (), *r11 = baz (), *r12 = baz ();
+ int *r25 = baz (), *r26 = baz (), *r27 = baz (), *r28 = baz (), *r29 = baz ();
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r03 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r03 \\+ 4" "gimple" } } */
+ #pragma omp for simd reduction(+:r03[1:5])
+ for (int i = 0; i < 64; i++)
+ r03[1]++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r04 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r04 \\+ 4" "gimple" } } */
+ #pragma omp master taskloop reduction(+:r04[1:6]) default(none)
+ for (int i = 0; i < 64; i++)
+ r04[1]++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r05 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r05 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r05 \\+ 4" "gimple" } } */
+ #pragma omp master taskloop simd reduction(+:r05[1:7]) default(none)
+ for (int i = 0; i < 64; i++)
+ r05[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r06 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r06 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp parallel for reduction(+:r06[1:8]) default(none)
+ for (int i = 0; i < 64; i++)
+ r06[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r07 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r07 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r07 \\+ 4" "gimple" } } */
+ #pragma omp parallel for simd reduction(+:r07[1:9]) default(none)
+ for (int i = 0; i < 64; i++)
+ r07[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r08\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp parallel loop reduction(+:r08[1:10]) default(none)
+ for (int i = 0; i < 64; i++)
+ r08[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r09 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r09 \\+ 4" "gimple" } } */
+ #pragma omp parallel master reduction(+:r09[1:11]) default(none)
+ r09[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r10\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r10 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r10 \\+ 4" "gimple" } } */
+ #pragma omp parallel master taskloop reduction(+:r10[1:12]) default(none)
+ for (int i = 0; i < 64; i++)
+ r10[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r11\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r11 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r11 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r11 \\+ 4" "gimple" } } */
+ #pragma omp parallel master taskloop simd reduction(+:r11[1:13]) default(none)
+ for (int i = 0; i < 64; i++)
+ r11[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r12 \\+ 4" "gimple" } } *//* FIXME: This should be on sections instead. */
+ /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r12 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r12 \\+ 4" "gimple" } } */
+ #pragma omp parallel sections reduction(+:r12[1:14]) default(none)
+ {
+ r12[1]++;
+ #pragma omp section
+ r12[1]++;
+ }
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 60\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r13 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r13 \\+ 4" "gimple" } } */
+ #pragma omp target parallel reduction(+:r13[1:15]) default(none) defaultmap(none)
+ r13[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 64\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r14 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r14 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r14 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp target parallel for reduction(+:r14[1:16]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r14[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 68\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r15 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } */
+ #pragma omp target parallel for simd reduction(+:r15[1:17]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r15[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 72\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r16 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target parallel loop reduction(+:r16[1:18]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r16[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 76\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r17 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r17 \\+ 4" "gimple" } } */
+ #pragma omp target teams reduction(+:r17[1:19]) default(none) defaultmap(none)
+ r17[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 80\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r18 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r18 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r18 \\+ 4" "gimple" } } */
+ #pragma omp target teams distribute reduction(+:r18[1:20]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r18[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 84\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r19 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp target teams distribute parallel for reduction(+:r19[1:21]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r19[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 88\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r20 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd reduction(+:r20[1:22]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r20[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 92\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r21 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" } } */
+ #pragma omp target teams distribute simd reduction(+:r21[1:23]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r21[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 96\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r22 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target teams loop reduction(+:r22[1:24]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r22[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 100\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r23 \\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r23 \\+ 4" "gimple" } } */
+ #pragma omp target simd reduction(+:r23[1:25]) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r23[1]++;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r24 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r24 \\+ 4" "gimple" } } */
+ #pragma omp taskloop simd reduction(+:r24[1:26]) default(none)
+ for (int i = 0; i < 64; i++)
+ r24[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r25 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r25 \\+ 4" "gimple" } } */
+ #pragma omp teams distribute reduction(+:r25[1:27]) default(none)
+ for (int i = 0; i < 64; i++)
+ r25[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp teams distribute parallel for reduction(+:r26[1:28]) default(none)
+ for (int i = 0; i < 64; i++)
+ r26[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } */
+ #pragma omp teams distribute parallel for simd reduction(+:r27[1:29]) default(none)
+ for (int i = 0; i < 64; i++)
+ r27[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r28 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r28 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r28 \\+ 4" "gimple" } } */
+ #pragma omp teams distribute simd reduction(+:r28[1:30]) default(none)
+ for (int i = 0; i < 64; i++)
+ r28[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(r29\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp teams loop reduction(+:r29[1:31]) default(none)
+ for (int i = 0; i < 64; i++)
+ r29[1]++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-11.c b/gcc/testsuite/c-c++-common/gomp/pr99928-11.c
new file mode 100644
index 0000000..66c2feb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-11.c
@@ -0,0 +1,28 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int r00, r01, r02;
+
+void
+bar (void)
+{
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*in_reduction\\(\\+:r00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r00\\)" "gimple" } } */
+ #pragma omp master taskloop in_reduction(+:r00)
+ for (int i = 0; i < 64; i++)
+ r00++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } } */
+ #pragma omp master taskloop simd in_reduction(+:r01)
+ for (int i = 0; i < 64; i++)
+ r01++;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*in_reduction\\(\\+:r02\\)" "gimple" } } */
+ #pragma omp taskloop simd in_reduction(+:r02)
+ for (int i = 0; i < 64; i++)
+ r02++;
+ /* FIXME: We don't support in_reduction clause on target yet, once we do, should
+ add testcase coverage for all combined/composite constructs with target as leaf construct. */
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-12.c b/gcc/testsuite/c-c++-common/gomp/pr99928-12.c
new file mode 100644
index 0000000..be0c5c0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-12.c
@@ -0,0 +1,23 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+
+int
+foo (void)
+{
+ int l = 0;
+ #pragma omp parallel master taskloop simd lastprivate (l) default(none) /* { dg-bogus "'l' not specified in enclosing 'parallel'" } */
+ for (int i = 0; i < 16; i++)
+ l = i;
+ return l;
+}
+
+int
+bar (void)
+{
+ int l = 0;
+ #pragma omp parallel master default(none) /* { dg-message "enclosing 'parallel'" } */
+ #pragma omp taskloop simd lastprivate (l) /* { dg-error "'l' not specified in enclosing 'parallel'" } */
+ for (int i = 0; i < 16; i++)
+ l = i;
+ return l;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-13.c b/gcc/testsuite/c-c++-common/gomp/pr99928-13.c
new file mode 100644
index 0000000..d45417f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-13.c
@@ -0,0 +1,171 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int j00a, j00b, j01a, j01b, j02a, j02b, j03a, j03b;
+int j06a, j06b, j07a, j07b, j08a, j08b, j09a, j09b, j10a, j10b;
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j00a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j00b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd collapse(2) lastprivate (j00a, j00b) default(none)
+ for (j00a = 0; j00a < 64; j00a++)
+ for (j00b = 0; j00b < 4; j00b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */
+ #pragma omp distribute simd collapse(2) lastprivate (j01a, j01b)
+ for (j01a = 0; j01a < 64; j01a++)
+ for (j01b = 0; j01b < 4; j01b++)
+ ;
+}
+
+void
+bar (void)
+{
+ int j04a, j04b, j05a, j05b, j11a, j11b, j12a, j12b;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */
+ #pragma omp for simd collapse(2) lastprivate (j02a, j02b)
+ for (j02a = 0; j02a < 64; j02a++)
+ for (j02b = 0; j02b < 4; j02b++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03a\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03b\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */
+ #pragma omp master taskloop simd collapse(2) lastprivate (j03a, j03b) default(none)
+ for (j03a = 0; j03a < 64; j03a++)
+ for (j03b = 0; j03b < 4; j03b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j04a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j04b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } */
+ #pragma omp parallel for simd collapse(2) lastprivate (j04a, j04b) default(none)
+ for (j04a = 0; j04a < 64; j04a++)
+ for (j04b = 0; j04b < 4; j04b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05a\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05b\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd collapse(2) lastprivate (j05a, j05b) default(none)
+ for (j05a = 0; j05a < 64; j05a++)
+ for (j05b = 0; j05b < 4; j05b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j06a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j06b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } */
+ #pragma omp target parallel for simd collapse(2) lastprivate (j06a, j06b) default(none) defaultmap(none)
+ for (j06a = 0; j06a < 64; j06a++)
+ for (j06b = 0; j06b < 4; j06b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07b\\)" "gimple" } } */
+ #pragma omp target simd collapse(2) lastprivate (j07a, j07b) defaultmap(none)
+ for (j07a = 0; j07a < 64; j07a++)
+ for (j07b = 0; j07b < 4; j07b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd collapse(2) lastprivate (j08a, j08b) default(none) defaultmap(none)
+ for (j08a = 0; j08a < 64; j08a++)
+ for (j08b = 0; j08b < 4; j08b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */
+ #pragma omp target teams distribute simd collapse(2) lastprivate (j09a, j09b) default(none) defaultmap(none)
+ for (j09a = 0; j09a < 64; j09a++)
+ for (j09b = 0; j09b < 4; j09b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10a\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10b\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */
+ #pragma omp taskloop simd collapse(2) lastprivate (j10a, j10b) default(none)
+ for (j10a = 0; j10a < 64; j10a++)
+ for (j10b = 0; j10b < 4; j10b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j11b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd collapse(2) lastprivate (j11a, j11b) default(none)
+ for (j11a = 0; j11a < 64; j11a++)
+ for (j11b = 0; j11b < 4; j11b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */
+ #pragma omp teams distribute simd collapse(2) lastprivate (j12a, j12b) default(none)
+ for (j12a = 0; j12a < 64; j12a++)
+ for (j12b = 0; j12b < 4; j12b++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-14.c b/gcc/testsuite/c-c++-common/gomp/pr99928-14.c
new file mode 100644
index 0000000..2df7891
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-14.c
@@ -0,0 +1,171 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int j00a, j00b, j01a, j01b, j02a, j02b, j03a, j03b, j04a, j04b;
+int j06a, j06b, j07a, j07b, j08a, j08b, j09a, j09b, j10a, j10b;
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd collapse(2) default(none)
+ for (j00a = 0; j00a < 64; j00a++)
+ for (j00b = 0; j00b < 4; j00b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */
+ #pragma omp distribute simd collapse(2)
+ for (j01a = 0; j01a < 64; j01a++)
+ for (j01b = 0; j01b < 4; j01b++)
+ ;
+}
+
+void
+bar (void)
+{
+ int j05a, j05b, j11a, j11b, j12a, j12b;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */
+ #pragma omp for simd collapse(2)
+ for (j02a = 0; j02a < 64; j02a++)
+ for (j02b = 0; j02b < 4; j02b++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03a\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03b\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */
+ #pragma omp master taskloop simd collapse(2) default(none)
+ for (j03a = 0; j03a < 64; j03a++)
+ for (j03b = 0; j03b < 4; j03b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } */
+ #pragma omp parallel for simd collapse(2) default(none)
+ for (j04a = 0; j04a < 64; j04a++)
+ for (j04b = 0; j04b < 4; j04b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05a\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05b\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd collapse(2) default(none)
+ for (j05a = 0; j05a < 64; j05a++)
+ for (j05b = 0; j05b < 4; j05b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } */
+ #pragma omp target parallel for simd collapse(2) default(none) defaultmap(none)
+ for (j06a = 0; j06a < 64; j06a++)
+ for (j06b = 0; j06b < 4; j06b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07b\\)" "gimple" } } */
+ #pragma omp target simd collapse(2) defaultmap(none)
+ for (j07a = 0; j07a < 64; j07a++)
+ for (j07b = 0; j07b < 4; j07b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd collapse(2) default(none) defaultmap(none)
+ for (j08a = 0; j08a < 64; j08a++)
+ for (j08b = 0; j08b < 4; j08b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09a" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09b" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */
+ #pragma omp target teams distribute simd collapse(2) default(none) defaultmap(none)
+ for (j09a = 0; j09a < 64; j09a++)
+ for (j09b = 0; j09b < 4; j09b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10a\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10b\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */
+ #pragma omp taskloop simd collapse(2) default(none)
+ for (j10a = 0; j10a < 64; j10a++)
+ for (j10b = 0; j10b < 4; j10b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd collapse(2) default(none)
+ for (j11a = 0; j11a < 64; j11a++)
+ for (j11b = 0; j11b < 4; j11b++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */
+ #pragma omp teams distribute simd collapse(2) default(none)
+ for (j12a = 0; j12a < 64; j12a++)
+ for (j12b = 0; j12b < 4; j12b++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-15.c b/gcc/testsuite/c-c++-common/gomp/pr99928-15.c
new file mode 100644
index 0000000..f0c6232
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-15.c
@@ -0,0 +1,26 @@
+/* PR middle-end/99928 */
+
+int v;
+
+void
+foo (void)
+{
+ #pragma omp target parallel firstprivate (v) map(tofrom: v) /* { dg-bogus "'v' appears both in data and map clauses" } */
+ v++;
+}
+
+void
+bar (void)
+{
+ #pragma omp target firstprivate (v) map (tofrom: v) /* { dg-error "'v' appears both in data and map clauses" } */
+ v++;
+}
+
+void
+baz (void)
+{
+ int j;
+ #pragma omp target simd firstprivate (v) map (tofrom: v) private (j) /* { dg-error "'v' appears both in data and map clauses" } */
+ for (int i = 0; i < 1; i++)
+ j = v;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-16.c b/gcc/testsuite/c-c++-common/gomp/pr99928-16.c
new file mode 100644
index 0000000..84cd85d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-16.c
@@ -0,0 +1,16 @@
+/* PR middle-end/99928 */
+
+void
+foo (void)
+{
+ int a[6] = {};
+ #pragma omp target simd reduction(+:a[:3])
+ for (int i = 0; i < 6; i++)
+ a[0]++;
+ #pragma omp target simd reduction(+:a[:3]) map(always, tofrom: a)
+ for (int i = 0; i < 6; i++)
+ a[0]++;
+ #pragma omp target simd reduction(+:a[:3]) map(always, tofrom: a[:6])
+ for (int i = 0; i < 6; i++)
+ a[0]++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-2.c b/gcc/testsuite/c-c++-common/gomp/pr99928-2.c
new file mode 100644
index 0000000..1af9bd2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-2.c
@@ -0,0 +1,208 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int l00, l01, l02, l03, l04, l05, l06, l07;
+int l10, l11, l12, l13, l14, l15, l16, l17, l18;
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } *//* FIXME. */
+ #pragma omp distribute parallel for lastprivate (l00) default(none)
+ for (int i = 0; i < 64; i++)
+ l00 = i;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd lastprivate (l01) default(none)
+ for (int i = 0; i < 64; i++)
+ l01 = i;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */
+ #pragma omp distribute simd lastprivate (l02)
+ for (int i = 0; i < 64; i++)
+ l02 = i;
+}
+
+void
+bar (void)
+{
+ int j00, j01, j02, j03;
+ int l08 = 0, l09 = 0, l19 = 0, l20 = 0, l21 = 0, l22 = 0;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } */
+ #pragma omp for simd lastprivate (l03)
+ for (int i = 0; i < 64; i++)
+ l03 = i;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l04\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */
+ #pragma omp master taskloop lastprivate (l04) default(none)
+ for (int i = 0; i < 64; i++)
+ l04 = i;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l05\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */
+ #pragma omp master taskloop simd lastprivate (l05) default(none)
+ for (int i = 0; i < 64; i++)
+ l05 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME. */
+ #pragma omp parallel for lastprivate (l06) default(none)
+ for (int i = 0; i < 64; i++)
+ l06 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */
+ #pragma omp parallel for simd lastprivate (l07) default(none)
+ for (int i = 0; i < 64; i++)
+ l07 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp parallel loop lastprivate (j00) default(none)
+ for (j00 = 0; j00 < 64; j00++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l08\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } */
+ #pragma omp parallel master taskloop lastprivate (l08) default(none)
+ for (int i = 0; i < 64; i++)
+ l08 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l09\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd lastprivate (l09) default(none)
+ for (int i = 0; i < 64; i++)
+ l09 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } *//* FIXME: This should be on sections instead. */
+ /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*lastprivate\\(l10\\)" "gimple" } } */
+ #pragma omp parallel sections lastprivate (l10) default(none)
+ {
+ l10 = 1;
+ #pragma omp section
+ l10 = 2;
+ }
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l11" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target parallel for lastprivate (l11) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l11 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l12" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } */
+ #pragma omp target parallel for simd lastprivate (l12) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l12 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j01" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target parallel loop lastprivate (j01) default(none) defaultmap(none)
+ for (j01 = 0; j01 < 64; j01++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l13" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l13\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l13\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l13\\)" "gimple" } } */
+ #pragma omp target teams distribute lastprivate (l13) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l13 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l14" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l14\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l14\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target teams distribute parallel for lastprivate (l14) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l14 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l15" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l15\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l15\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd lastprivate (l15) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l15 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l16" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l16\\)" "gimple" } } */
+ #pragma omp target teams distribute simd lastprivate (l16) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l16 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j02" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target teams loop lastprivate (j02) default(none) defaultmap(none)
+ for (j02 = 0; j02 < 64; j02++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l17" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l17\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l17\\)" "gimple" } } */
+ #pragma omp target simd lastprivate (l17) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l17 = i;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l18\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l18\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l18\\)" "gimple" } } */
+ #pragma omp taskloop simd lastprivate (l18) default(none)
+ for (int i = 0; i < 64; i++)
+ l18 = i;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l19\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l19\\)" "gimple" } } */
+ #pragma omp teams distribute lastprivate (l19) default(none)
+ for (int i = 0; i < 64; i++)
+ l19 = i;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } *//* FIXME. */
+ #pragma omp teams distribute parallel for lastprivate (l20) default(none)
+ for (int i = 0; i < 64; i++)
+ l20 = i;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd lastprivate (l21) default(none)
+ for (int i = 0; i < 64; i++)
+ l21 = i;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l22\\)" "gimple" } } */
+ #pragma omp teams distribute simd lastprivate (l22) default(none)
+ for (int i = 0; i < 64; i++)
+ l22 = i;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp teams loop lastprivate (j03) default(none)
+ for (j03 = 0; j03 < 64; j03++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-3.c b/gcc/testsuite/c-c++-common/gomp/pr99928-3.c
new file mode 100644
index 0000000..8e8cf93
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-3.c
@@ -0,0 +1,119 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int l00, l01, l02, l03, l04, l07, l08, l09;
+int l10, l11;
+
+void
+bar (void)
+{
+ int l05 = 0, l06 = 0;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(l00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */
+ #pragma omp for simd firstprivate (l00) lastprivate (l00)
+ for (int i = 0; i < 64; i++)
+ l00 = i;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */
+ #pragma omp master taskloop firstprivate (l01) lastprivate (l01) default(none)
+ for (int i = 0; i < 64; i++)
+ l01 = i;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */
+ #pragma omp master taskloop simd firstprivate (l02) lastprivate (l02) default(none)
+ for (int i = 0; i < 64; i++)
+ l02 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME. */
+ #pragma omp parallel for firstprivate (l03) lastprivate (l03) default(none)
+ for (int i = 0; i < 64; i++)
+ l03 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */
+ #pragma omp parallel for simd firstprivate (l04) lastprivate (l04) default(none)
+ for (int i = 0; i < 64; i++)
+ l04 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */
+ #pragma omp parallel master taskloop firstprivate (l05) lastprivate (l05) default(none)
+ for (int i = 0; i < 64; i++)
+ l05 = i;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd firstprivate (l06) lastprivate (l06) default(none)
+ for (int i = 0; i < 64; i++)
+ l06 = i;
+ /* FIXME: OpenMP 5.0/5.1 broken here, conceptually it should be shared on parallel and
+ firstprivate+lastprivate on sections, in GCC implementation we put firstprivate+lastprivate
+ on parallel for historic reasons, but OpenMP 5.0/5.1 mistakenly say firstprivate
+ should be on parallel and lastprivate on sections. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */
+ #pragma omp parallel sections firstprivate (l07) lastprivate (l07) default(none)
+ {
+ l07 = 1;
+ #pragma omp section
+ l07 = 2;
+ }
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l08" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target parallel for firstprivate (l08) lastprivate (l08) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l08 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l09" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */
+ #pragma omp target parallel for simd firstprivate (l09) lastprivate (l09) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l09 = i;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l10" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } */
+ #pragma omp target simd firstprivate (l10) lastprivate (l10) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l10 = i;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } */
+ #pragma omp taskloop simd firstprivate (l11) lastprivate (l11) default(none)
+ for (int i = 0; i < 64; i++)
+ l11 = i;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-4.c b/gcc/testsuite/c-c++-common/gomp/pr99928-4.c
new file mode 100644
index 0000000..915a865
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-4.c
@@ -0,0 +1,76 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int l00, l01, l05, l06, l07, l08;
+
+void
+bar (void)
+{
+ int l02 = 0, l03 = 0, l04 = 0;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(l00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l00:1\\)" "gimple" } } */
+ #pragma omp for simd linear (l00)
+ for (int i = 0; i < 64; i++)
+ l00++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l01:1\\)" "gimple" } } */
+ #pragma omp master taskloop simd linear (l01) default(none)
+ for (int i = 0; i < 64; i++)
+ l01++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*linear\\(l02:1\\)" "gimple" } } */
+ #pragma omp parallel for linear (l02) default(none)
+ for (int i = 0; i < 64; i++)
+ l02++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l03:1\\)" "gimple" } } */
+ #pragma omp parallel for simd linear (l03) default(none)
+ for (int i = 0; i < 64; i++)
+ l03++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l04:1\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd linear (l04) default(none)
+ for (int i = 0; i < 64; i++)
+ l04++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l05" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*linear\\(l05:1\\)" "gimple" } } */
+ #pragma omp target parallel for linear (l05) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l05++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l06" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l06:1\\)" "gimple" } } */
+ #pragma omp target parallel for simd linear (l06) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l06++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l07" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l07:1\\)" "gimple" } } */
+ #pragma omp target simd linear (l07) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ l07++;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l08:1\\)" "gimple" } } */
+ #pragma omp taskloop simd linear (l08) default(none)
+ for (int i = 0; i < 64; i++)
+ l08++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-5.c b/gcc/testsuite/c-c++-common/gomp/pr99928-5.c
new file mode 100644
index 0000000..26da0ac
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-5.c
@@ -0,0 +1,107 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int j00, j01, j02, j03, j04, j06, j07, j08, j09;
+int j10;
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd linear (j00) default(none)
+ for (j00 = 0; j00 < 64; j00++)
+ ;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } } */
+ #pragma omp distribute simd linear (j01)
+ for (j01 = 0; j01 < 64; j01++)
+ ;
+}
+
+void
+bar (void)
+{
+ int j05, j11, j12;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } } */
+ #pragma omp for simd linear (j02)
+ for (j02 = 0; j02 < 64; j02++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } } */
+ #pragma omp master taskloop simd linear (j03) default(none)
+ for (j03 = 0; j03 < 64; j03++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } } */
+ #pragma omp parallel for simd linear (j04) default(none)
+ for (j04 = 0; j04 < 64; j04++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd linear (j05) default(none)
+ for (j05 = 0; j05 < 64; j05++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */
+ #pragma omp target parallel for simd linear (j06) default(none) defaultmap(none)
+ for (j06 = 0; j06 < 64; j06++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */
+ #pragma omp target simd linear (j07) defaultmap(none)
+ for (j07 = 0; j07 < 64; j07++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd linear (j08) default(none) defaultmap(none)
+ for (j08 = 0; j08 < 64; j08++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */
+ #pragma omp target teams distribute simd linear (j09) default(none) defaultmap(none)
+ for (j09 = 0; j09 < 64; j09++)
+ ;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } } */
+ #pragma omp taskloop simd linear (j10) default(none)
+ for (j10 = 0; j10 < 64; j10++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd linear (j11) default(none)
+ for (j11 = 0; j11 < 64; j11++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } } */
+ #pragma omp teams distribute simd linear (j12) default(none)
+ for (j12 = 0; j12 < 64; j12++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-6.c b/gcc/testsuite/c-c++-common/gomp/pr99928-6.c
new file mode 100644
index 0000000..d37587c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-6.c
@@ -0,0 +1,107 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int j00, j01, j02, j03, j04, j06, j07, j08, j09;
+int j10;
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd default(none)
+ for (j00 = 0; j00 < 64; j00++)
+ ;
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } } */
+ #pragma omp distribute simd
+ for (j01 = 0; j01 < 64; j01++)
+ ;
+}
+
+void
+bar (void)
+{
+ int j05, j11, j12;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } } */
+ #pragma omp for simd
+ for (j02 = 0; j02 < 64; j02++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } } */
+ #pragma omp master taskloop simd default(none)
+ for (j03 = 0; j03 < 64; j03++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } } */
+ #pragma omp parallel for simd default(none)
+ for (j04 = 0; j04 < 64; j04++)
+ ;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd default(none)
+ for (j05 = 0; j05 < 64; j05++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */
+ #pragma omp target parallel for simd default(none) defaultmap(none)
+ for (j06 = 0; j06 < 64; j06++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */
+ #pragma omp target simd defaultmap(none)
+ for (j07 = 0; j07 < 64; j07++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd default(none) defaultmap(none)
+ for (j08 = 0; j08 < 64; j08++)
+ ;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */
+ #pragma omp target teams distribute simd default(none) defaultmap(none)
+ for (j09 = 0; j09 < 64; j09++)
+ ;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } } */
+ #pragma omp taskloop simd default(none)
+ for (j10 = 0; j10 < 64; j10++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd default(none)
+ for (j11 = 0; j11 < 64; j11++)
+ ;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } } */
+ #pragma omp teams distribute simd default(none)
+ for (j12 = 0; j12 < 64; j12++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-7.c b/gcc/testsuite/c-c++-common/gomp/pr99928-7.c
new file mode 100644
index 0000000..e6e0e92
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-7.c
@@ -0,0 +1,103 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd default(none)
+ for (int j00 = 0; j00 < 64; j00++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } } */
+ #pragma omp distribute simd
+ for (int j01 = 0; j01 < 64; j01++)
+ ;
+}
+
+void
+bar (void)
+{
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } } */
+ #pragma omp for simd
+ for (int j02 = 0; j02 < 64; j02++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } } */
+ #pragma omp master taskloop simd default(none)
+ for (int j03 = 0; j03 < 64; j03++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } } */
+ #pragma omp parallel for simd default(none)
+ for (int j04 = 0; j04 < 64; j04++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd default(none)
+ for (int j05 = 0; j05 < 64; j05++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */
+ #pragma omp target parallel for simd default(none) defaultmap(none)
+ for (int j06 = 0; j06 < 64; j06++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */
+ #pragma omp target simd defaultmap(none)
+ for (int j07 = 0; j07 < 64; j07++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd default(none) defaultmap(none)
+ for (int j08 = 0; j08 < 64; j08++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */
+ #pragma omp target teams distribute simd default(none) defaultmap(none)
+ for (int j09 = 0; j09 < 64; j09++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } } */
+ #pragma omp taskloop simd default(none)
+ for (int j10 = 0; j10 < 64; j10++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd default(none)
+ for (int j11 = 0; j11 < 64; j11++)
+ ;
+ /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } } */
+ #pragma omp teams distribute simd default(none)
+ for (int j12 = 0; j12 < 64; j12++)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-8.c b/gcc/testsuite/c-c++-common/gomp/pr99928-8.c
new file mode 100644
index 0000000..ad36f3e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-8.c
@@ -0,0 +1,219 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int r00, r01, r02, r03, r04, r05;
+int r13, r14, r15, r16, r17, r18, r19;
+int r20, r21, r22, r23, r24;
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } *//* FIXME. */
+ #pragma omp distribute parallel for reduction(+:r00) default(none)
+ for (int i = 0; i < 64; i++)
+ r00++;
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } */
+ #pragma omp distribute parallel for simd reduction(+:r01) default(none)
+ for (int i = 0; i < 64; i++)
+ r01++;
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r02\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r02\\)" "gimple" } } */
+ #pragma omp distribute simd reduction(+:r02)
+ for (int i = 0; i < 64; i++)
+ r02++;
+}
+
+void
+bar (void)
+{
+ int r06 = 0, r07 = 0, r08 = 0, r09 = 0;
+ int r10 = 0, r11 = 0, r12 = 0;
+ int r25 = 0, r26 = 0, r27 = 0, r28 = 0, r29 = 0;
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r03\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r03\\)" "gimple" } } */
+ #pragma omp for simd reduction(+:r03)
+ for (int i = 0; i < 64; i++)
+ r03++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r04\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r04\\)" "gimple" } } */
+ #pragma omp master taskloop reduction(+:r04) default(none)
+ for (int i = 0; i < 64; i++)
+ r04++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } } */
+ #pragma omp master taskloop simd reduction(+:r05) default(none)
+ for (int i = 0; i < 64; i++)
+ r05++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r06\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r06\\)" "gimple" } } *//* FIXME. */
+ #pragma omp parallel for reduction(+:r06) default(none)
+ for (int i = 0; i < 64; i++)
+ r06++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } */
+ #pragma omp parallel for simd reduction(+:r07) default(none)
+ for (int i = 0; i < 64; i++)
+ r07++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r08\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r08\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp parallel loop reduction(+:r08) default(none)
+ for (int i = 0; i < 64; i++)
+ r08++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r09\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r09\\)" "gimple" } } */
+ #pragma omp parallel master reduction(+:r09) default(none)
+ r09++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r10\\)" "gimple" } } */
+ #pragma omp parallel master taskloop reduction(+:r10) default(none)
+ for (int i = 0; i < 64; i++)
+ r10++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } } */
+ #pragma omp parallel master taskloop simd reduction(+:r11) default(none)
+ for (int i = 0; i < 64; i++)
+ r11++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } *//* FIXME: This should be on sections instead. */
+ /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } */
+ #pragma omp parallel sections reduction(+:r12) default(none)
+ {
+ r12++;
+ #pragma omp section
+ r12++;
+ }
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r13\\)" "gimple" } } */
+ #pragma omp target parallel reduction(+:r13) default(none) defaultmap(none)
+ r13++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r14\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r14\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target parallel for reduction(+:r14) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r14++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } */
+ #pragma omp target parallel for simd reduction(+:r15) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r15++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r16\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r16\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target parallel loop reduction(+:r16) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r16++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r17\\)" "gimple" } } */
+ #pragma omp target teams reduction(+:r17) default(none) defaultmap(none)
+ r17++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r18\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r18\\)" "gimple" } } */
+ #pragma omp target teams distribute reduction(+:r18) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r18++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } *//* FIXME. */
+ #pragma omp target teams distribute parallel for reduction(+:r19) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r19++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd reduction(+:r20) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r20++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } } */
+ #pragma omp target teams distribute simd reduction(+:r21) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r21++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target teams loop reduction(+:r22) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r22++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r23\\)" "gimple" } } */
+ #pragma omp target simd reduction(+:r23) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r23++;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r24\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r24\\)" "gimple" } } */
+ #pragma omp taskloop simd reduction(+:r24) default(none)
+ for (int i = 0; i < 64; i++)
+ r24++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r25\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r25\\)" "gimple" } } */
+ #pragma omp teams distribute reduction(+:r25) default(none)
+ for (int i = 0; i < 64; i++)
+ r25++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } *//* FIXME. */
+ #pragma omp teams distribute parallel for reduction(+:r26) default(none)
+ for (int i = 0; i < 64; i++)
+ r26++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } */
+ #pragma omp teams distribute parallel for simd reduction(+:r27) default(none)
+ for (int i = 0; i < 64; i++)
+ r27++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } } */
+ #pragma omp teams distribute simd reduction(+:r28) default(none)
+ for (int i = 0; i < 64; i++)
+ r28++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r29\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp teams loop reduction(+:r29) default(none)
+ for (int i = 0; i < 64; i++)
+ r29++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-9.c b/gcc/testsuite/c-c++-common/gomp/pr99928-9.c
new file mode 100644
index 0000000..a7d970a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-9.c
@@ -0,0 +1,219 @@
+/* PR middle-end/99928 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int r00[4], r01[4], r02[4], r03[4], r04[4], r05[4];
+int r13[4], r14[4], r15[4], r16[4], r17[4], r18[4], r19[4];
+int r20[4], r21[4], r22[4], r23[4], r24[4];
+
+void
+foo (void)
+{
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r00 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r00 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r00 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp distribute parallel for reduction(+:r00[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r00[1]++;
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } */
+ #pragma omp distribute parallel for simd reduction(+:r01[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r01[1]++;
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r02 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r02 \\+ 4" "gimple" } } */
+ #pragma omp distribute simd reduction(+:r02[1:2])
+ for (int i = 0; i < 64; i++)
+ r02[1]++;
+}
+
+void
+bar (void)
+{
+ int r06[4] = {}, r07[4] = {}, r08[4] = {}, r09[4] = {};
+ int r10[4] = {}, r11[4] = {}, r12[4] = {};
+ int r25[4] = {}, r26[4] = {}, r27[4] = {}, r28[4] = {}, r29[4] = {};
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r03 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r03 \\+ 4" "gimple" } } */
+ #pragma omp for simd reduction(+:r03[1:2])
+ for (int i = 0; i < 64; i++)
+ r03[1]++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r04 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r04 \\+ 4" "gimple" } } */
+ #pragma omp master taskloop reduction(+:r04[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r04[1]++;
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r05 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r05 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r05 \\+ 4" "gimple" } } */
+ #pragma omp master taskloop simd reduction(+:r05[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r05[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r06 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r06 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp parallel for reduction(+:r06[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r06[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r07 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r07 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r07 \\+ 4" "gimple" } } */
+ #pragma omp parallel for simd reduction(+:r07[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r07[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r08\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp parallel loop reduction(+:r08[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r08[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r09 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r09 \\+ 4" "gimple" } } */
+ #pragma omp parallel master reduction(+:r09[1:2]) default(none)
+ r09[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r10\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r10 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r10 \\+ 4" "gimple" } } */
+ #pragma omp parallel master taskloop reduction(+:r10[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r10[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r11\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r11 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r11 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r11 \\+ 4" "gimple" } } */
+ #pragma omp parallel master taskloop simd reduction(+:r11[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r11[1]++;
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r12 \\+ 4" "gimple" } } *//* FIXME: This should be on sections instead. */
+ /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r12 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r12 \\+ 4" "gimple" } } */
+ #pragma omp parallel sections reduction(+:r12[1:2]) default(none)
+ {
+ r12[1]++;
+ #pragma omp section
+ r12[1]++;
+ }
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r13 \\+ 4" "gimple" } } */
+ #pragma omp target parallel reduction(+:r13[1:2]) default(none) defaultmap(none)
+ r13[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r14 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r14 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp target parallel for reduction(+:r14[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r14[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } */
+ #pragma omp target parallel for simd reduction(+:r15[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r15[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r16\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target parallel loop reduction(+:r16[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r16[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r17 \\+ 4" "gimple" } } */
+ #pragma omp target teams reduction(+:r17[1:2]) default(none) defaultmap(none)
+ r17[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r18 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r18 \\+ 4" "gimple" } } */
+ #pragma omp target teams distribute reduction(+:r18[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r18[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp target teams distribute parallel for reduction(+:r19[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r19[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */
+ #pragma omp target teams distribute parallel for simd reduction(+:r20[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r20[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" } } */
+ #pragma omp target teams distribute simd reduction(+:r21[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r21[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r22\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp target teams loop reduction(+:r22[1:2]) default(none) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r22[1]++;
+ /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23\\\[1\\\] \\\[len: 8\\\]" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r23 \\+ 4" "gimple" } } */
+ #pragma omp target simd reduction(+:r23[1:2]) defaultmap(none)
+ for (int i = 0; i < 64; i++)
+ r23[1]++;
+ /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r24 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r24 \\+ 4" "gimple" } } */
+ #pragma omp taskloop simd reduction(+:r24[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r24[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r25 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r25 \\+ 4" "gimple" } } */
+ #pragma omp teams distribute reduction(+:r25[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r25[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } *//* FIXME. */
+ #pragma omp teams distribute parallel for reduction(+:r26[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r26[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */
+ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } *//* FIXME. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } */
+ #pragma omp teams distribute parallel for simd reduction(+:r27[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r27[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r28 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r28 \\+ 4" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r28 \\+ 4" "gimple" } } */
+ #pragma omp teams distribute simd reduction(+:r28[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r28[1]++;
+ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r29\\)" "gimple" } } */
+ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */
+ #pragma omp teams loop reduction(+:r29[1:2]) default(none)
+ for (int i = 0; i < 64; i++)
+ r29[1]++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/reduction-task-2.c b/gcc/testsuite/c-c++-common/gomp/reduction-task-2.c
index 1e262d3..225abed 100644
--- a/gcc/testsuite/c-c++-common/gomp/reduction-task-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/reduction-task-2.c
@@ -14,7 +14,9 @@ bar (void)
#pragma omp section
foo (-3);
}
- #pragma omp simd reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for' or 'sections'" } */
+ #pragma omp scope reduction (task, +: v) nowait /* { dg-error "'task' reduction modifier on a construct with a 'nowait' clause" } */
+ foo (-4);
+ #pragma omp simd reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for', 'sections' or 'scope'" } */
for (i = 0; i < 64; i++)
v++;
#pragma omp for simd reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct combined with 'simd'" } */
@@ -26,13 +28,13 @@ bar (void)
#pragma omp teams distribute parallel for simd reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct combined with 'simd'" } */
for (i = 0; i < 64; i++)
v++;
- #pragma omp taskloop reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for' or 'sections'" } */
+ #pragma omp taskloop reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for', 'sections' or 'scope'" } */
for (i = 0; i < 64; i++)
foo (i);
#pragma omp taskloop simd reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct combined with 'simd'" } */
for (i = 0; i < 64; i++)
v++;
- #pragma omp teams reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for' or 'sections'" } */
+ #pragma omp teams reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for', 'sections' or 'scope'" } */
foo (i);
#pragma omp teams distribute reduction (task, +: v) /* { dg-error "invalid 'task' reduction modifier on construct not combined with 'parallel', 'for' or 'sections'" } */
for (i = 0; i < 64; i++)
diff --git a/gcc/testsuite/c-c++-common/gomp/requires-3.c b/gcc/testsuite/c-c++-common/gomp/requires-3.c
index e5a6cbb..bd2479b 100644
--- a/gcc/testsuite/c-c++-common/gomp/requires-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/requires-3.c
@@ -1,3 +1,6 @@
#pragma omp requires atomic_default_mem_order(acquire) /* { dg-error "expected 'seq_cst', 'relaxed' or 'acq_rel'" } */
#pragma omp requires atomic_default_mem_order(release) /* { dg-error "expected 'seq_cst', 'relaxed' or 'acq_rel'" } */
#pragma omp requires atomic_default_mem_order(foobar) /* { dg-error "expected 'seq_cst', 'relaxed' or 'acq_rel'" } */
+#pragma omp requires atomic_default_mem_order ( /* { dg-error "expected 'seq_cst', 'relaxed' or 'acq_rel'" } */
+/* { dg-error "expected '\\\)' before end of line" "" { target *-*-* } .-1 } */
+#pragma omp requires atomic_default_mem_order(seq_cst), /* { dg-error "expected end of line before ',' token" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/scan-1.c b/gcc/testsuite/c-c++-common/gomp/scan-1.c
index 17804e3..95b46cb 100644
--- a/gcc/testsuite/c-c++-common/gomp/scan-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/scan-1.c
@@ -89,6 +89,8 @@ f3 (int *c, int *d)
#pragma omp section
;
}
+ #pragma omp scope reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'scope' construct" } */
+ ;
#pragma omp target parallel for reduction (inscan, +: a) map (c[:64], d[:64]) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */
for (i = 0; i < 64; i++)
{
diff --git a/gcc/testsuite/c-c++-common/gomp/scope-1.c b/gcc/testsuite/c-c++-common/gomp/scope-1.c
new file mode 100644
index 0000000..ab7a778
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/scope-1.c
@@ -0,0 +1,39 @@
+int r, r2, r3;
+
+void
+foo (void)
+{
+ int i = 0, j = 0, k = 0;
+ #pragma omp scope private (i) reduction (+:r) nowait
+ {
+ i = 1;
+ r++;
+ }
+ #pragma omp scope private (i) reduction (task, +:r)
+ #pragma omp scope private (j) reduction (task, +:r2)
+ #pragma omp scope private (k) reduction (task, +:r3)
+ {
+ i = 1;
+ j = 2;
+ k = 3;
+ r++;
+ r2++;
+ r3++;
+ }
+ #pragma omp parallel
+ {
+ #pragma omp scope reduction (+:r) private (i) nowait
+ {
+ #pragma omp scope reduction (+:r2) private (j) nowait
+ {
+ #pragma omp single
+ {
+ i = 1;
+ j = 2;
+ r++;
+ r2++;
+ }
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/scope-2.c b/gcc/testsuite/c-c++-common/gomp/scope-2.c
new file mode 100644
index 0000000..58517be
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/scope-2.c
@@ -0,0 +1,41 @@
+int r, r2, r3 = 1;
+int bar (void);
+
+void
+foo (void)
+{
+ int i = 0, j = 0, k = 0;
+ #pragma omp parallel
+ {
+ if (bar ())
+ {
+ #pragma omp cancel parallel
+ }
+ #pragma omp scope reduction (+:r) private (i)
+ {
+ #pragma omp scope reduction (+:r2) private (j)
+ {
+ #pragma omp single nowait
+ {
+ i = 1;
+ j = 2;
+ r++;
+ r2++;
+ }
+ }
+ }
+ }
+ #pragma omp parallel
+ {
+ if (bar ())
+ {
+ #pragma omp cancel parallel
+ }
+ #pragma omp scope reduction (task, +:r) private (i)
+ #pragma omp scope reduction (task, *:r3)
+ {
+ r++;
+ r3++;
+ }
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/sink-5.c b/gcc/testsuite/c-c++-common/gomp/sink-5.c
new file mode 100644
index 0000000..4fbaa8a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/sink-5.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+void bar (int);
+
+void
+foo ()
+{
+ int i;
+#pragma omp parallel for ordered(1)
+ for (i = 0; i < 100; ++i)
+ {
+#pragma omp ordered depend(sink:i-1,) /* { dg-error "expected '\\\)' before ',' token" } */
+ bar (i);
+#pragma omp ordered depend(source)
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-device-1.c b/gcc/testsuite/c-c++-common/gomp/target-device-1.c
new file mode 100644
index 0000000..9822862
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-device-1.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+
+void
+foo (int n)
+{
+ /* Test to ensure that 'device_num' is parsed correctly in device clauses. */
+
+ #pragma omp target device (1)
+ ;
+
+ #pragma omp target device (n)
+ ;
+
+ #pragma omp target device (n + 1)
+ ;
+
+ #pragma omp target device (device_num : 1)
+ ;
+
+ #pragma omp target device (device_num : n)
+ ;
+
+ #pragma omp target device (device_num : n + 1)
+ ;
+
+ #pragma omp target device (invalid : 1) /* { dg-error "expected 'ancestor' or 'device_num'" "" { target *-*-* } } */
+ /* { dg-error "expected '\\)' before 'invalid'" "" { target c } .-1 } */
+ ;
+
+ #pragma omp target device (device_num : n, n) /* { dg-error "expected '\\)' before ','" } */
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-device-2.c b/gcc/testsuite/c-c++-common/gomp/target-device-2.c
new file mode 100644
index 0000000..b711ea1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-device-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+ /* Test to ensure that device-modifier 'device_num' is parsed correctly in
+ device clauses. */
+
+void
+foo (void)
+{
+ #pragma omp target device (device_num : 42)
+ ;
+}
+
+/* { dg-final { scan-tree-dump "pragma omp target \[^\n\r)]*device\\(42\\)" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-1.c b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-1.c
new file mode 100644
index 0000000..b3c1ce8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+ /* Ensure that a 'requires' directive with the 'reverse_offload' clause was
+ specified. */
+
+ #pragma omp target device (ancestor : 1) /* { dg-error "'ancestor' device modifier not preceded by 'requires' directive with 'reverse_offload' clause" } */
+ /* { dg-error "expected '\\)' before 'ancestor'" "" { target c } .-1 } */
+
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-2.c b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-2.c
new file mode 100644
index 0000000..cf05c50
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-2.c
@@ -0,0 +1,82 @@
+/* { dg-do compile } */
+
+#pragma omp requires reverse_offload /* { dg-message "sorry, unimplemented: 'reverse_offload' clause on 'requires' directive not supported yet" } */
+
+void
+foo (int n)
+{
+ /* The following test is marked with 'xfail' because a previous 'sorry' from
+ 'reverse_offload' suppresses the 'sorry' for 'ancestor'. */
+ #pragma omp target device (ancestor: 1) /* { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } } */
+ ;
+
+
+ /* Ensure that the integer expression in the 'device' clause for
+ device-modifier 'ancestor' evaluates to '1' in case of a constant. */
+
+ #pragma omp target device (ancestor : 1)
+ ;
+ #pragma omp target device (ancestor : 42) /* { dg-error "the 'device' clause expression must evaluate to '1'" } */
+ ;
+
+ #pragma omp target device (ancestor : n) /* { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } } */
+ ;
+ #pragma omp target device (ancestor : n + 1) /* { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } } */
+ ;
+
+
+ /* Ensure that only one 'device' clause appears on the construct. */
+
+ #pragma omp target device (17) device (42) /* { dg-error "too many 'device' clauses" } */
+ ;
+
+
+ /* Ensure that with 'ancestor' only the 'device', 'firstprivate', 'private',
+ 'defaultmap', and 'map' clauses appear on the construct. */
+
+ #pragma omp target nowait device (ancestor: 1) /* { dg-error "with 'ancestor', only the 'device', 'firstprivate', 'private', 'defaultmap', and 'map' clauses may appear on the construct" } */
+ ;
+ #pragma omp target device (ancestor: 1) nowait /* { dg-error "with 'ancestor', only the 'device', 'firstprivate', 'private', 'defaultmap', and 'map' clauses may appear on the construct" } */
+ ;
+ #pragma omp target nowait device (42)
+ ;
+ #pragma omp target nowait device (device_num: 42)
+ ;
+
+ int a = 0, b = 0, c = 0;
+ #pragma omp target device (ancestor: 1) firstprivate (a) private (b) defaultmap (none) map (c)
+ ;
+
+
+ /* Ensure that 'ancestor' is only used with 'target' constructs (not with
+ 'target data', 'target update' etc.). */
+
+ #pragma omp target data map (a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" } */
+ ;
+ #pragma omp target enter data map (to: a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" } */
+ #pragma omp target exit data map (from: a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" } */
+ #pragma omp target update to (a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" "" { target *-*-* } } */
+
+
+ /* Ensure that no OpenMP constructs appear inside target regions with
+ 'ancestor'. */
+
+ #pragma omp target device (ancestor: 1)
+ {
+ #pragma omp teams /* { dg-error "OpenMP constructs are not allowed in target region with 'ancestor'" } */
+ ;
+ }
+
+ #pragma omp target device (device_num: 1)
+ {
+ #pragma omp teams
+ ;
+ }
+
+ #pragma omp target device (1)
+ {
+ #pragma omp teams
+ ;
+ }
+
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-3.c b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-3.c
new file mode 100644
index 0000000..5e3a478
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-3.c
@@ -0,0 +1,37 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int omp_get_num_teams (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* { dg-do compile } */
+
+#pragma omp requires reverse_offload /* { dg-message "sorry, unimplemented: 'reverse_offload' clause on 'requires' directive not supported yet" } */
+
+void
+foo (void)
+{
+ /* Ensure that no calls to OpenMP API runtime routines are allowed inside the
+ corresponding target region. */
+
+ int a;
+
+ #pragma omp target device (ancestor: 1)
+ {
+ a = omp_get_num_teams (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_teams\[^\n\r]*' in a region with 'device\\(ancestor\\)' clause" } */
+ }
+
+ #pragma omp target device (device_num: 1)
+ {
+ a = omp_get_num_teams ();
+ }
+
+ #pragma omp target device (1)
+ {
+ a = omp_get_num_teams ();
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c
new file mode 100644
index 0000000..b4b5620
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+ /* Test to ensure that device-modifier 'ancestor' is parsed correctly in
+ device clauses. */
+
+#pragma omp requires reverse_offload /* { dg-message "sorry, unimplemented: 'reverse_offload' clause on 'requires' directive not supported yet" } */
+
+void
+foo (void)
+{
+ #pragma omp target device (ancestor: 1) /* { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } } */
+ ;
+
+}
+
+/* { dg-final { scan-tree-dump "pragma omp target \[^\n\r)]*device\\(ancestor:1\\)" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/target-in-reduction-1.c b/gcc/testsuite/c-c++-common/gomp/target-in-reduction-1.c
new file mode 100644
index 0000000..23ed300
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-in-reduction-1.c
@@ -0,0 +1,12 @@
+void
+foo (int i, int j, int k)
+{
+ #pragma omp target in_reduction (+:i) private (i) /* { dg-error "'i' appears more than once in data-sharing clauses" } */
+ ;
+ #pragma omp target private (i) in_reduction (+:i) /* { dg-error "'i' appears both in data and map clauses" } */
+ ;
+ #pragma omp target in_reduction (+:i) firstprivate (i) /* { dg-error "'i' appears more than once in data-sharing clauses" } */
+ ; /* { dg-error "'i' appears both in data and map clauses" "" { target *-*-* } .-1 } */
+ #pragma omp target firstprivate (i) in_reduction (+:i) /* { dg-error "'i' appears both in data and map clauses" } */
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/task-detach-3.c b/gcc/testsuite/c-c++-common/gomp/task-detach-3.c
new file mode 100644
index 0000000..97e622d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/task-detach-3.c
@@ -0,0 +1,19 @@
+/* PR c++/100319 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+typedef enum omp_event_handle_t
+{
+ __omp_event_handle_t_max__ = __UINTPTR_MAX__
+} omp_event_handle_t;
+
+extern void omp_fulfill_event (omp_event_handle_t);
+
+void f (omp_event_handle_t x, omp_event_handle_t y, int z)
+{
+ #pragma omp task detach (x) firstprivate (y, z) /* { dg-bogus "the event handle of a 'detach' clause should not be in a data-sharing clause" } */
+ ;
+
+ #pragma omp task detach (x) shared (y) /* { dg-bogus "the event handle of a 'detach' clause should not be in a data-sharing clause" } */
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/modref-dse.c b/gcc/testsuite/c-c++-common/modref-dse.c
new file mode 100644
index 0000000..5f64e8f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/modref-dse.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-dse2-details" } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2" } } */
+
+struct foo { unsigned long bar; };
+
+unsigned y;
+
+static int __attribute__ ((__noinline__, __noclone__))
+wrapped (struct foo *p, int i);
+
+static int wrapper (struct foo *p);
+
+static int __attribute__ ((__noclone__))
+wrapper (struct foo *p) {
+ return wrapped (p, 1);
+}
+
+static int __attribute__ ((__noinline__, __noclone__))
+dind (struct foo **pp);
+
+int __attribute__ ((__noclone__, __no_reorder__))
+xfn () {
+ struct foo x = { 0xBADC0FFE };
+ struct foo *p = &x;
+ return dind (&p);
+}
+
+static int __attribute__ ((__noinline__, __no_reorder__))
+wrapped (struct foo *p, int i) {
+ return p->bar + i == y++;
+}
+
+static int __attribute__ ((__noinline__, __noclone__, __no_reorder__))
+dind (struct foo **pp) {
+ wrapper (*pp);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/pr100785.c b/gcc/testsuite/c-c++-common/pr100785.c
new file mode 100644
index 0000000..37ff0aa
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr100785.c
@@ -0,0 +1,21 @@
+/* PR inline-asm/100785 */
+
+struct S { int a : 1; };
+
+void
+foo (struct S *x)
+{
+ __asm__ ("" : "+m" (x->a)); /* { dg-error "address of bit-field" } */
+}
+
+void
+bar (struct S *x)
+{
+ __asm__ ("" : "=m" (x->a)); /* { dg-error "address of bit-field" } */
+}
+
+void
+baz (struct S *x)
+{
+ __asm__ ("" : : "m" (x->a)); /* { dg-error "address of bit-field" } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr19807-2.c b/gcc/testsuite/c-c++-common/pr19807-2.c
index d2c0101..529b9c9 100644
--- a/gcc/testsuite/c-c++-common/pr19807-2.c
+++ b/gcc/testsuite/c-c++-common/pr19807-2.c
@@ -1,5 +1,4 @@
-/* Some targets can optimize this on RTL. */
-/* { dg-do link { target { x86_64-*-* i?86-*-* } } } */
+/* { dg-do link } */
/* { dg-options "-O -fdump-tree-optimized" } */
extern void link_error(void);
@@ -12,4 +11,4 @@ int main()
return 0;
}
-/* { dg-final { scan-tree-dump-not "link_error" "optimized" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/pr19807-3.c b/gcc/testsuite/c-c++-common/pr19807-3.c
index bb7f982..31c88f3 100644
--- a/gcc/testsuite/c-c++-common/pr19807-3.c
+++ b/gcc/testsuite/c-c++-common/pr19807-3.c
@@ -1,5 +1,4 @@
-/* Some targets can optimize this on RTL. */
-/* { dg-do link { target { x86_64-*-* i?86-*-* } } } */
+/* { dg-do link } */
/* { dg-options "-O -fdump-tree-optimized" } */
extern void link_error(void);
@@ -12,4 +11,4 @@ int main()
return 0;
}
-/* { dg-final { scan-tree-dump-not "link_error" "optimized" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/spellcheck-reserved.c b/gcc/testsuite/c-c++-common/spellcheck-reserved.c
index ed292f2..56e59dc 100644
--- a/gcc/testsuite/c-c++-common/spellcheck-reserved.c
+++ b/gcc/testsuite/c-c++-common/spellcheck-reserved.c
@@ -50,3 +50,21 @@ const char * test_3 (void)
/* { dg-error "did you mean '__FILE__'" "" { target c } misspelled__FILE_ } */
/* { dg-error "'__FILE_' was not declared in this scope; did you mean '__FILE__'\\?" "" { target c++ } misspelled__FILE_ } */
}
+
+/* Verify that we can correct "__FILE_NAME_" to "__FILE_NAME__". */
+
+const char * test_4 (void)
+{
+ return __FILE_NAME_; /* { dg-line misspelled__FILE_NAME_ } */
+ /* { dg-error "did you mean '__FILE_NAME__'" "" { target c } misspelled__FILE_NAME_ } */
+ /* { dg-error "'__FILE_NAME_' was not declared in this scope; did you mean '__FILE_NAME__'\\?" "" { target c++ } misspelled__FILE_NAME_ } */
+}
+
+/* Verify that we can correct "__FILENAME__" to "__FILE_NAME__". */
+
+const char * test_5 (void)
+{
+ return __FILENAME__; /* { dg-line misspelled__FILENAME__ } */
+ /* { dg-error "did you mean '__FILE_NAME__'" "" { target c } misspelled__FILENAME__ } */
+ /* { dg-error "'__FILENAME__' was not declared in this scope; did you mean '__FILE_NAME__'\\?" "" { target c++ } misspelled__FILENAME__ } */
+}
diff --git a/gcc/testsuite/c-c++-common/torture/builtin-shufflevector-1.c b/gcc/testsuite/c-c++-common/torture/builtin-shufflevector-1.c
new file mode 100644
index 0000000..c864736
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/builtin-shufflevector-1.c
@@ -0,0 +1,49 @@
+/* { dg-do run } */
+
+typedef long v4di __attribute__((vector_size(4 * sizeof (long))));
+typedef int v4si __attribute__((vector_size(4 * sizeof (int))));
+typedef int v8si __attribute__((vector_size(8 * sizeof (int))));
+
+v4si res[5], a, b;
+v4di resl, al, bl;
+v8si res8[3], a8, b8;
+void __attribute__((noipa))
+foo (void)
+{
+ res[0] = __builtin_shufflevector (a, b, 0, 1, 4, 5);
+ res[1] = __builtin_shufflevector (a, b, 0, 1, -1, 5);
+ res8[0] = __builtin_shufflevector (a, b, 0, 1, 2, 2 + 1, 4, 5, 6, 7);
+ res[2] = __builtin_shufflevector (a8, b8, 0, 8, 1, 9);
+ res[3] = __builtin_shufflevector (a8, b, 0, 8, 1, 9);
+ res[4] = __builtin_shufflevector (a, b8, 0, 4, 1, 5);
+ res8[1] = __builtin_shufflevector (a8, b, 0, 8, 1, 9, 10, 11, 2, 3);
+ res8[2] = __builtin_shufflevector (a, b8, 0, 4, 1, 5, -1, -1, -1, -1);
+}
+
+#define comp(a, b, n) \
+ for (unsigned i = 0; i < n; ++i) \
+ if ((a)[i] != (b)[i]) \
+ __builtin_abort ();
+
+int main()
+{
+ a = (v4si) { 0, 1, 2, 3 };
+ b = (v4si) { 4, 5, 6, 7 };
+ a8 = (v8si) { 0, 1, 2, 3, 4, 5, 6, 7 };
+ b8 = (v8si) { 8, 9, 10, 11, 12, 13, 14, 15 };
+ foo ();
+ comp (res[0], ((v4si) { 0, 1, 4, 5}), 4)
+ res[1][2] = 9;
+ comp (res[1], ((v4si) { 0, 1, 9, 5}), 4)
+ comp (res8[0], ((v8si) { 0, 1, 2, 3, 4, 5, 6, 7 }), 8)
+ comp (res[2], ((v4si) { 0, 8, 1, 9}), 4)
+ comp (res[3], ((v4si) { 0, 4, 1, 5}), 4)
+ comp (res[4], ((v4si) { 0, 8, 1, 9}), 4)
+ comp (res8[1], ((v8si) { 0, 4, 1, 5, 6, 7, 2, 3 }), 8)
+ res8[2][4] = 42;
+ res8[2][5] = 42;
+ res8[2][6] = 42;
+ res8[2][7] = 42;
+ comp (res8[2], ((v8si) { 0, 8, 1, 9, 42, 42, 42, 42 }), 8)
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c b/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c
index 85acce8..6b612fa 100644
--- a/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c
+++ b/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c
@@ -8,11 +8,11 @@ main ()
{
int x = INT_MIN;
int y;
- asm ("" : "+g" (x));
+ __asm__ volatile ("" : "+g" (x));
y = -(-x);
- asm ("" : "+g" (y));
+ __asm__ volatile ("" : "+g" (y));
y = -(-INT_MIN);
- asm ("" : "+g" (y));
+ __asm__ volatile ("" : "+g" (y));
}
/* { dg-output "negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c b/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c
index d3fb9ba..14ed5fb 100644
--- a/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c
+++ b/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c
@@ -9,10 +9,10 @@ main ()
int x = INT_MIN;
int y = 0;
int z;
- asm ("" : "+g" (y));
- asm ("" : "+g" (x));
+ __asm__ volatile ("" : "+g" (y));
+ __asm__ volatile ("" : "+g" (x));
z = y - (-x);
- asm ("" : "+g" (z));
+ __asm__ volatile ("" : "+g" (z));
}
/* { dg-output "negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/uninit-17.c b/gcc/testsuite/c-c++-common/uninit-17.c
index fd773da..b549536 100644
--- a/gcc/testsuite/c-c++-common/uninit-17.c
+++ b/gcc/testsuite/c-c++-common/uninit-17.c
@@ -9,11 +9,11 @@ static void bar(int a, int *ptr)
{
do
{
- int b; /* { dg-message "declared" } */
+ int b;
if (b < 40) {
- ptr[0] = b; /* { dg-warning "may be used uninitialized" } */
+ ptr[0] = b;
}
- b += 1;
+ b += 1; /* { dg-warning "is used uninitialized" } */
ptr++;
}
while (--a != 0);
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c
index 193db8c..96e0b79 100644
--- a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-skip-if "not implemented" { powerpc*-*-* } } */
+/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* s390*-*-* } } } */
/* { dg-options "-O2" } */
#include <assert.h>
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c
index b04b6a2..0714f95 100644
--- a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-skip-if "not implemented" { powerpc*-*-* } } */
+/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* } } } */
/* { dg-options "-O2 -fzero-call-used-regs=all" } */
#include "zero-scratch-regs-10.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c
index 80f5bbb..b038a25 100644
--- a/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-skip-if "not implemented" { ia64*-*-* } } */
/* { dg-options "-O2 -fzero-call-used-regs=all-gpr-arg" } */
#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c
index 159f35c..2a4c8b2 100644
--- a/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-skip-if "not implemented" { ia64*-*-* } } */
/* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */
#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c
index f612a04..aceda7e 100644
--- a/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-skip-if "not implemented" { powerpc*-*-* } } */
+/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* } } } */
/* { dg-options "-O2 -fzero-call-used-regs=all-arg" } */
#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c
index 2c63a69..f3152a7 100644
--- a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-skip-if "not implemented" { powerpc*-*-* } } */
+/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* } } } */
/* { dg-options "-O2 -fzero-call-used-regs=all" } */
#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/g++.dg/DRs/dr2082.C b/gcc/testsuite/g++.dg/DRs/dr2082.C
new file mode 100644
index 0000000..84bb23f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2082.C
@@ -0,0 +1,12 @@
+// DR 2082
+
+void f() {
+ int i;
+ extern void h(int x = sizeof(i));
+}
+
+class A {
+ void f(A* p = this) { } // { dg-error "this" }
+};
+
+int h(int a, int b = sizeof(a));
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag24a.C b/gcc/testsuite/g++.dg/abi/abi-tag24a.C
new file mode 100644
index 0000000..83f930d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag24a.C
@@ -0,0 +1,18 @@
+// PR c++/98481
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -fabi-version=14 }
+inline namespace N __attribute ((__abi_tag__ ("myabi")))
+{
+ struct A {};
+}
+template <typename T>
+struct B { typedef int size_type; };
+struct S1 { B<A>::size_type foo () const { return 1; } };
+struct S2 { B<A>::size_type foo () const; };
+int S2::foo () const { return 2; }
+int (S1::*f1) () const = &S1::foo;
+int (S2::*f2) () const = &S2::foo;
+
+// { dg-final { scan-assembler-not "_ZNK2S13fooEv" } }
+// { dg-final { scan-assembler "_ZNK2S23fooEv" } }
+// { dg-final { scan-assembler "_ZNK2S13fooB5myabiEv" } }
diff --git a/gcc/testsuite/g++.dg/abi/lambda-defarg1.C b/gcc/testsuite/g++.dg/abi/lambda-defarg1.C
new file mode 100644
index 0000000..8c53858
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/lambda-defarg1.C
@@ -0,0 +1,11 @@
+// PR c++/91241
+// { dg-do compile { target c++11 } }
+
+struct A {
+ int *b(const int & = []() -> int { return 0; }(),
+ const int & = []() -> int { return 0; }());
+};
+int *A::b(const int &, const int &) { b(); return 0; }
+// { dg-final { scan-assembler "_ZN1A1bERKiS1_" } }
+// { dg-final { scan-assembler "_ZZN1A1bERKiS1_Ed_NKUlvE_clEv" } }
+// { dg-final { scan-assembler "_ZZN1A1bERKiS1_Ed0_NKUlvE_clEv" } }
diff --git a/gcc/testsuite/g++.dg/abi/macro0.C b/gcc/testsuite/g++.dg/abi/macro0.C
index 7c3c170..f25f291 100644
--- a/gcc/testsuite/g++.dg/abi/macro0.C
+++ b/gcc/testsuite/g++.dg/abi/macro0.C
@@ -1,6 +1,6 @@
// This testcase will need to be kept in sync with c_common_post_options.
// { dg-options "-fabi-version=0" }
-#if __GXX_ABI_VERSION != 1015
+#if __GXX_ABI_VERSION != 1016
#error "Incorrect value of __GXX_ABI_VERSION"
#endif
diff --git a/gcc/testsuite/g++.dg/abi/mangle71.C b/gcc/testsuite/g++.dg/abi/mangle71.C
index cb9d7d3..038befa 100644
--- a/gcc/testsuite/g++.dg/abi/mangle71.C
+++ b/gcc/testsuite/g++.dg/abi/mangle71.C
@@ -1,4 +1,4 @@
-// Verify manglinng of class literals of types with ctors.
+// Verify mangling of class literals of types with ctors.
// { dg-do compile { target c++2a } }
struct A
@@ -13,16 +13,16 @@ struct B { A a[3]; };
template <B> struct X { };
void f___ (X<B{{ }}>) { }
-// { dg-final { scan-assembler "_Z4f___1XIXtl1BtlA3_1AtlS1_Lc1EEEEEE" } }
+// { dg-final { scan-assembler "_Z4f0001XIXtl1BEEE" } }
void f0__ (X<B{{ 0 }}>) { }
-// { dg-final { scan-assembler "_Z4f0__1XIXtl1BtlA3_1AtlS1_Lc0EEtlS1_Lc1EEEEEE" } }
+// { dg-final { scan-assembler "_Z4f0__1XIXtl1BtlA3_1AtlS1_EtlS1_Lc1EEtlS1_Lc1EEEEEE" } }
void f00_ (X<B{{ 0, 0 }}>) { }
-// { dg-final { scan-assembler "_Z4f00_1XIXtl1BtlA3_1AtlS1_Lc0EEtlS1_Lc0EEtlS1_Lc1EEEEEE" } }
+// { dg-final { scan-assembler "_Z4f00_1XIXtl1BtlA3_1AtlS1_EtlS1_EtlS1_Lc1EEEEEE" } }
void f000 (X<B{{ 0, 0, 0 }}>) { }
-// { dg-final { scan-assembler "_Z4f0001XIXtl1BtlA3_1AtlS1_Lc0EEtlS1_Lc0EEtlS1_Lc0EEEEEE" } }
+// { dg-final { scan-assembler "_Z4f0001XIXtl1BEEE" } }
void f1__ (X<B{{ 1 }}>) { }
-// { dg-final { scan-assembler "_Z4f1__1XIXtl1BtlA3_1AtlS1_Lc1EEtlS1_Lc1EEEEEE" } }
+// { dg-final { scan-assembler "_Z4f1__1XIXtl1BtlA3_1AtlS1_Lc1EEtlS1_Lc1EEtlS1_Lc1EEEEEE" } }
diff --git a/gcc/testsuite/g++.dg/abi/mangle77.C b/gcc/testsuite/g++.dg/abi/mangle77.C
new file mode 100644
index 0000000..1181dc8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle77.C
@@ -0,0 +1,31 @@
+// Test that we handle T{} differently between class non-type template
+// arguments and other expressions in the signature.
+
+// { dg-do compile { target c++20 } }
+
+struct B
+{
+ int i;
+ constexpr B(int i): i(i+1) {}
+};
+
+struct A
+{
+ B b;
+};
+
+template <class T, class... Ts> T sink(T&&, Ts&&...);
+
+// Here A{1} is mangled as A{1}, the source representation, because expressions
+// involving template parameters are compared by ODR (token-based) equivalence
+// [temp.over.link].
+// { dg-final { scan-assembler "_Z1fIiEDTcl4sinktl1ALi1EEcvT__EEES1_" } }
+template <class T>
+decltype(sink(A{1},T())) f(T) { return A{1}; }
+int main() { f(42); }
+
+template <auto> struct C { };
+// Here A{1} is mangled as A{B{2}}, the value representation, because template
+// arguments are compared by value.
+// { dg-final { scan-assembler "_Z1g1CIXtl1Atl1BLi2EEEEE" } }
+void g(C<A{1}>) { }
diff --git a/gcc/testsuite/g++.dg/analyzer/placement-new.C b/gcc/testsuite/g++.dg/analyzer/placement-new.C
index 8250f45..b648a42 100644
--- a/gcc/testsuite/g++.dg/analyzer/placement-new.C
+++ b/gcc/testsuite/g++.dg/analyzer/placement-new.C
@@ -24,3 +24,5 @@ void test_3 (void)
int *p = new(buf) int (42);
delete p; // { dg-warning "memory not on the heap" }
}
+
+// { dg-prune-output "-Wfree-nonheap-object" }
diff --git a/gcc/testsuite/g++.dg/analyzer/pr100244.C b/gcc/testsuite/g++.dg/analyzer/pr100244.C
new file mode 100644
index 0000000..261b3cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/pr100244.C
@@ -0,0 +1,22 @@
+// { dg-additional-options "-O1 -Wno-free-nonheap-object" }
+
+inline void *operator new (__SIZE_TYPE__, void *__p) { return __p; }
+
+struct __aligned_buffer {
+ int _M_storage;
+ int *_M_addr() { return &_M_storage; }
+};
+
+struct _Hashtable_alloc {
+ int _M_single_bucket;
+ int *_M_buckets;
+ _Hashtable_alloc () { _M_buckets = &_M_single_bucket; }
+ ~_Hashtable_alloc () { delete _M_buckets; } // { dg-warning "not on the heap" }
+};
+
+void
+test01 (__aligned_buffer buf)
+{
+ _Hashtable_alloc *tmp = new (buf._M_addr ()) _Hashtable_alloc;
+ tmp->~_Hashtable_alloc ();
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/pr101522.C b/gcc/testsuite/g++.dg/analyzer/pr101522.C
new file mode 100644
index 0000000..634a2ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/pr101522.C
@@ -0,0 +1,31 @@
+// { dg-do compile { target c++11 } }
+
+double
+sqrt ();
+
+namespace std {
+ class gamma_distribution {
+ public:
+ gamma_distribution () : _M_param () {}
+
+ private:
+ struct param_type {
+ param_type () : _M_beta () { _M_a2 = 1 / ::sqrt (); }
+ double _M_beta, _M_a2;
+ };
+ param_type _M_param;
+ int _M_saved_available, _M_saved = 0, _M_param0 = 0;
+ };
+
+ struct fisher_f_distribution {
+ gamma_distribution _M_gd_x, _M_gd_y;
+ };
+}
+
+int
+main ()
+{
+ std::fisher_f_distribution d;
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/pr93212.C b/gcc/testsuite/g++.dg/analyzer/pr93212.C
index 1029e8d..41507e2 100644
--- a/gcc/testsuite/g++.dg/analyzer/pr93212.C
+++ b/gcc/testsuite/g++.dg/analyzer/pr93212.C
@@ -4,8 +4,8 @@
auto lol()
{
int aha = 3;
- return [&aha] {
- return aha; // { dg-warning "dereferencing pointer '.*' to within stale stack frame" }
+ return [&aha] { // { dg-warning "dereferencing pointer '.*' to within stale stack frame" }
+ return aha;
};
/* TODO: may be worth special-casing the reporting of dangling
references from lambdas, to highlight the declaration, and maybe fix
diff --git a/gcc/testsuite/g++.dg/analyzer/pr94011.C b/gcc/testsuite/g++.dg/analyzer/pr94011.C
index 2642aa4..81c0acd 100644
--- a/gcc/testsuite/g++.dg/analyzer/pr94011.C
+++ b/gcc/testsuite/g++.dg/analyzer/pr94011.C
@@ -1,5 +1,5 @@
// { dg-do compile { target c++11 } }
-// { dg-additional-options "-O1" }
+// { dg-additional-options "-O1 -Wno-analyzer-use-of-uninitialized-value" }
template <typename DV> DV
vu (DV j4)
diff --git a/gcc/testsuite/g++.dg/analyzer/pr94503.C b/gcc/testsuite/g++.dg/analyzer/pr94503.C
index 9432ac4..ecf7121 100644
--- a/gcc/testsuite/g++.dg/analyzer/pr94503.C
+++ b/gcc/testsuite/g++.dg/analyzer/pr94503.C
@@ -1,3 +1,5 @@
+// { dg-additional-options "-Wno-analyzer-use-of-uninitialized-value" }
+
template <typename> class allocator {
public:
allocator(const allocator &);
diff --git a/gcc/testsuite/g++.dg/analyzer/vfunc-2.C b/gcc/testsuite/g++.dg/analyzer/vfunc-2.C
new file mode 100644
index 0000000..46b68e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/vfunc-2.C
@@ -0,0 +1,44 @@
+#include <cstdio>
+#include <cstdlib>
+
+struct A
+{
+ int m_data;
+ A() {m_data = 0;}
+ virtual int deallocate (void)
+ {
+ return 42;
+ }
+};
+
+struct B: public A
+{
+ int *ptr;
+ int m_data_b;
+ B() {m_data_b = 0;}
+ void allocate ()
+ {
+ ptr = (int*)malloc(sizeof(int));
+ }
+ int deallocate (void)
+ {
+ free(ptr);
+ return 0;
+ }
+};
+
+void foo(A *a_ptr)
+{
+ printf("%d\n",a_ptr->deallocate());
+}
+
+void test()
+{
+ B b;
+ A a, *aptr;
+ aptr = &b;
+ b.allocate();
+ foo(aptr);
+ aptr = &a;
+ foo(aptr);
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/vfunc-3.C b/gcc/testsuite/g++.dg/analyzer/vfunc-3.C
new file mode 100644
index 0000000..03d3cdc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/vfunc-3.C
@@ -0,0 +1,32 @@
+#include <cstdlib>
+
+struct A
+{
+ virtual int foo (void)
+ {
+ return 42;
+ }
+};
+
+struct B: public A
+{
+ int *ptr;
+ void alloc ()
+ {
+ ptr = (int*)malloc(sizeof(int));
+ }
+ int foo (void)
+ {
+ free(ptr); /* { dg-warning "double-'free' of 'b.B::ptr'" } */
+ return 0;
+ }
+};
+
+int test ()
+{
+ struct B b, *bptr=&b;
+ b.alloc ();
+ bptr->foo (); /* { dg-message "\\(6\\) calling 'B::foo' from 'test'" "event 6" } */
+ /* { dg-message "\\(9\\) returning to 'test' from 'B::foo'" "event 9" { target *-*-* } .-1 } */
+ return bptr->foo ();
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/vfunc-4.C b/gcc/testsuite/g++.dg/analyzer/vfunc-4.C
new file mode 100644
index 0000000..9751084
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/vfunc-4.C
@@ -0,0 +1,28 @@
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
+
+struct A
+{
+ int m_data;
+ virtual char foo ()
+ {
+ return 'A';
+ }
+};
+
+struct B: public A
+{
+ int m_data_b;
+ char foo ()
+ {
+ return 'B';
+ }
+};
+
+void test()
+{
+ A a, *a_ptr = &a;
+ B b;
+ __analyzer_eval (a_ptr->foo () == 'A'); /* { dg-warning "TRUE" } */
+ a_ptr = &b;
+ __analyzer_eval (a_ptr->foo () == 'B'); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/vfunc-5.C b/gcc/testsuite/g++.dg/analyzer/vfunc-5.C
new file mode 100644
index 0000000..2af8465
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/vfunc-5.C
@@ -0,0 +1,103 @@
+/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fanalyzer-checker=malloc -fdiagnostics-show-caret" } */
+/* { dg-enable-nn-line-numbers "" } */
+
+#include <cstdlib>
+
+struct Base
+{
+ virtual void allocate ();
+ virtual void deallocate ();
+};
+
+struct Derived: public Base
+{
+ int *ptr;
+ void allocate ()
+ {
+ ptr = (int*)malloc(sizeof(int));
+ }
+ void deallocate ()
+ {
+ free(ptr);
+ }
+};
+
+void test()
+{
+ Derived D;
+ Base B, *base_ptr;
+ base_ptr = &D;
+
+ D.allocate();
+ base_ptr->deallocate();
+ int n = *D.ptr; /* { dg-warning "use after 'free' of 'D.Derived::ptr'" } */
+}
+
+/* use after 'free' */
+/* { dg-begin-multiline-output "" }
+ NN | int n = *D.ptr;
+ | ^
+ 'void test()': events 1-2
+ |
+ | NN | void test()
+ | | ^~~~
+ | | |
+ | | (1) entry to 'test'
+ |......
+ | NN | D.allocate();
+ | | ~~~~~~~~~~~~
+ | | |
+ | | (2) calling 'Derived::allocate' from 'test'
+ |
+ +--> 'virtual void Derived::allocate()': events 3-4
+ |
+ | NN | void allocate ()
+ | | ^~~~~~~~
+ | | |
+ | | (3) entry to 'Derived::allocate'
+ | NN | {
+ | NN | ptr = (int*)malloc(sizeof(int));
+ | | ~~~~~~~~~~~~~~~~~~~
+ | | |
+ | | (4) allocated here
+ |
+ <------+
+ |
+ 'void test()': events 5-6
+ |
+ | NN | D.allocate();
+ | | ~~~~~~~~~~^~
+ | | |
+ | | (5) returning to 'test' from 'Derived::allocate'
+ | NN | base_ptr->deallocate();
+ | | ~~~~~~~~~~~~~~~~~~~~~~
+ | | |
+ | | (6) calling 'Derived::deallocate' from 'test'
+ |
+ +--> 'virtual void Derived::deallocate()': events 7-8
+ |
+ | NN | void deallocate ()
+ | | ^~~~~~~~~~
+ | | |
+ | | (7) entry to 'Derived::deallocate'
+ | NN | {
+ | NN | free(ptr);
+ | | ~~~~~~~~~
+ | | |
+ | | (8) freed here
+ |
+ <------+
+ |
+ 'void test()': events 9-10
+ |
+ | NN | base_ptr->deallocate();
+ | | ~~~~~~~~~~~~~~~~~~~~^~
+ | | |
+ | | (9) returning to 'test' from 'Derived::deallocate'
+ | NN | int n = *D.ptr;
+ | | ~
+ | | |
+ | | (10) use after 'free' of 'D.Derived::ptr'; freed at (8)
+ |
+ { dg-end-multiline-output "" } */
+
diff --git a/gcc/testsuite/g++.dg/asan/asan_test.C b/gcc/testsuite/g++.dg/asan/asan_test.C
index c62568f..49933ab 100644
--- a/gcc/testsuite/g++.dg/asan/asan_test.C
+++ b/gcc/testsuite/g++.dg/asan/asan_test.C
@@ -2,7 +2,7 @@
// { dg-skip-if "" { *-*-* } { "*" } { "-O2" } }
// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
// { dg-additional-sources "asan_globals_test-wrapper.cc" }
-// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror -Wno-alloc-size-larger-than -Wno-stringop-overflow -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread" }
+// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror -Wno-alloc-size-larger-than -Wno-array-bounds -Wno-stringop-overflow -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread" }
// { dg-additional-options "-ldl" { target { ! *-*-freebsd* } } }
// { dg-additional-options "-DASAN_NEEDS_SEGV=1" { target { ! arm*-*-* } } }
// { dg-additional-options "-DASAN_LOW_MEMORY=1 -DASAN_NEEDS_SEGV=0" { target arm*-*-* } }
diff --git a/gcc/testsuite/g++.dg/asan/pr99877.C b/gcc/testsuite/g++.dg/asan/pr99877.C
new file mode 100644
index 0000000..95a8641
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr99877.C
@@ -0,0 +1,19 @@
+/* PR sanitizer/99877*/
+/* { dg-options "-fsanitize=address -fopenmp -O2" } */
+
+struct vector
+{
+ int size ();
+};
+int
+main ()
+{
+ vector outqueue;
+#pragma omp parallel
+ {
+ goto continueloop;
+ continueloop:;
+ }
+ for (; outqueue.size ();)
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/auto-init-uninit-pred-1_a.C b/gcc/testsuite/g++.dg/auto-init-uninit-pred-1_a.C
new file mode 100644
index 0000000..4300223
--- /dev/null
+++ b/gcc/testsuite/g++.dg/auto-init-uninit-pred-1_a.C
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -O2 -ftrivial-auto-var-init=zero" } */
+#include "uninit-pred-1_a.C"
diff --git a/gcc/testsuite/g++.dg/auto-init-uninit-pred-2_a.C b/gcc/testsuite/g++.dg/auto-init-uninit-pred-2_a.C
new file mode 100644
index 0000000..5551060
--- /dev/null
+++ b/gcc/testsuite/g++.dg/auto-init-uninit-pred-2_a.C
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -O2 -ftrivial-auto-var-init=zero" } */
+#include "uninit-pred-2_a.C"
diff --git a/gcc/testsuite/g++.dg/auto-init-uninit-pred-3_a.C b/gcc/testsuite/g++.dg/auto-init-uninit-pred-3_a.C
new file mode 100644
index 0000000..d6ab4f0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/auto-init-uninit-pred-3_a.C
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -O2 -ftrivial-auto-var-init=zero" } */
+#include "uninit-pred-3_a.C"
diff --git a/gcc/testsuite/g++.dg/auto-init-uninit-pred-4.C b/gcc/testsuite/g++.dg/auto-init-uninit-pred-4.C
new file mode 100644
index 0000000..4747d28
--- /dev/null
+++ b/gcc/testsuite/g++.dg/auto-init-uninit-pred-4.C
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -Og -ftrivial-auto-var-init=zero" } */
+#include "uninit-pred-4.C"
diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
index 990e6f4..e9ece64 100644
--- a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
+++ b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
@@ -983,6 +983,8 @@ subvalues (struct entry *e, char *p, char *letter)
if (e[0].len != 0)
output_FNB ('B', e);
return 1;
+ default:
+ return 0;
}
}
diff --git a/gcc/testsuite/g++.dg/concepts/abbrev10.C b/gcc/testsuite/g++.dg/concepts/abbrev10.C
new file mode 100644
index 0000000..b611346
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/abbrev10.C
@@ -0,0 +1,18 @@
+// PR c++/99806
+// { dg-do compile { target c++14 } }
+// { dg-additional-options "-fconcepts" }
+
+struct S {
+ void f(auto, auto, int = 3);
+ void f2(auto, auto, int = 3) { }
+ template<typename T> static T g(T, auto, int = 3);
+};
+
+void
+g ()
+{
+ S::g(1, 2);
+ S s;
+ s.f(1, 2);
+ s.f2(1, 2);
+}
diff --git a/gcc/testsuite/g++.dg/concepts/abbrev11.C b/gcc/testsuite/g++.dg/concepts/abbrev11.C
new file mode 100644
index 0000000..ddb4793
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/abbrev11.C
@@ -0,0 +1,10 @@
+// PR c++/99806
+// { dg-do compile { target c++14 } }
+// { dg-additional-options "-fconcepts" }
+
+template <typename T> concept C = requires (T a) { a.f(0); };
+struct S {
+ void f(auto) noexcept(B);
+ static constexpr bool B = true;
+};
+static_assert(C<S>, "");
diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic16.C b/gcc/testsuite/g++.dg/concepts/diagnostic16.C
new file mode 100644
index 0000000..fcba535
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/diagnostic16.C
@@ -0,0 +1,45 @@
+// PR c++/97536
+// { dg-do compile { target concepts } }
+
+template<typename>
+concept C1 = true;
+
+concept C2 = true; // { dg-error "non-template variable cannot be .concept." }
+// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 }
+
+template<typename>
+void fn1 ()
+{
+ concept bar = true; // { dg-error "concept must be defined at namespace scope" }
+// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 }
+}
+
+void fn2 ()
+{
+ concept bar = true; // { dg-error "non-template variable cannot be .concept." }
+// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 }
+}
+
+template<typename>
+void fn3 ()
+{
+ template<typename> // { dg-error "template declaration cannot appear at block scope" }
+ concept bar = true;
+}
+
+void fn4 ()
+{
+ template<typename> // { dg-error "template declaration cannot appear at block scope" }
+ concept bar = true;
+}
+
+void fn5 ()
+{
+ C1 auto x = 42;
+}
+
+template<typename>
+void fn6 ()
+{
+ C1 auto x = 42;
+}
diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic17.C b/gcc/testsuite/g++.dg/concepts/diagnostic17.C
new file mode 100644
index 0000000..49d5733
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/diagnostic17.C
@@ -0,0 +1,17 @@
+// PR c++/98767
+// { dg-do compile { target c++20 } }
+
+template <typename Function, typename... Args>
+concept Callable = requires(Function func, Args... args) { func(args...); };
+
+static_assert(Callable<int(*)(), bool>); // { dg-error "failed" }
+// { dg-message {Function = int \(\*\)\(\)} "" { target *-*-* } 5 }
+
+static_assert(Callable<char(*)(int*), bool>); // { dg-error "failed" }
+// { dg-message {Function = char \(\*\)\(int\*\)} "" { target *-*-* } 5 }
+
+static_assert(Callable<short(*)(int*, int), bool>); // { dg-error "failed" }
+// { dg-message {Function = short int \(\*\)\(int\*, int\)} "" { target *-*-* } 5 }
+
+static_assert(Callable<long(*)(int*, int, ...), bool>); // { dg-error "failed" }
+// { dg-message {Function = long int \(\*\)\(int\*, int, \.\.\.\)} "" { target *-*-* } 5 }
diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic18.C b/gcc/testsuite/g++.dg/concepts/diagnostic18.C
new file mode 100644
index 0000000..79f371b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/diagnostic18.C
@@ -0,0 +1,7 @@
+// PR c++/100055
+// { dg-do compile { target concepts } }
+
+void foo(auto&& arg) requires({}); // { dg-error "statement-expressions are not allowed|braced-groups" }
+
+template <auto = 0> requires ([]{}()); // { dg-error "expected unqualified-id" }
+auto f() requires ([]{}());
diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic2.C b/gcc/testsuite/g++.dg/concepts/diagnostic2.C
index 004c7a3..6550ed6 100644
--- a/gcc/testsuite/g++.dg/concepts/diagnostic2.C
+++ b/gcc/testsuite/g++.dg/concepts/diagnostic2.C
@@ -25,6 +25,6 @@ baz()
bar<int>(); // { dg-error "no match" }
/* { dg-begin-multiline-output "" }
bar<int>();
- ^
+ ~~~~~~~~^~
{ dg-end-multiline-output "" } */
}
diff --git a/gcc/testsuite/g++.dg/concepts/explicit-spec1.C b/gcc/testsuite/g++.dg/concepts/explicit-spec1.C
new file mode 100644
index 0000000..d9b6b3d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/explicit-spec1.C
@@ -0,0 +1,9 @@
+// PR c++/101098
+// { dg-do compile { target concepts } }
+
+template<typename T> concept C = __is_class(T);
+struct Y { int n; } y;
+template<C T> void g(T) { }
+int called;
+template<> void g(Y) { called = 3; }
+int main() { g(y); }
diff --git a/gcc/testsuite/g++.dg/conversion/pr100635.C b/gcc/testsuite/g++.dg/conversion/pr100635.C
new file mode 100644
index 0000000..5841215
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/pr100635.C
@@ -0,0 +1,12 @@
+// PR c++/100635
+// { dg-do compile }
+// { dg-additional-options "-Wno-volatile" { target c++2a } }
+
+struct S { };
+volatile S v();
+const volatile S& svol = v(); // { dg-error "cannot bind lvalue reference of type 'const volatile S&' to an rvalue of type 'volatile S'" }
+
+#if __cplusplus >= 201103L
+volatile int&& declvol();
+const volatile int& voli = declvol(); // { dg-error "cannot bind lvalue reference of type 'const volatile int&' to an rvalue of type 'volatile int'" "" { target c++11} }
+#endif
diff --git a/gcc/testsuite/g++.dg/conversion/pr66211.C b/gcc/testsuite/g++.dg/conversion/pr66211.C
index 770e8a0..5c1ae13 100644
--- a/gcc/testsuite/g++.dg/conversion/pr66211.C
+++ b/gcc/testsuite/g++.dg/conversion/pr66211.C
@@ -7,5 +7,5 @@ int main()
{
int x = 0;
double y = 1;
- f(1 > 0 ? x : y); // { dg-error "cannot bind .* to an rvalue" }
+ f(1 > 0 ? x : y); // { dg-error "cannot bind non-const lvalue reference of type .int&. to a value of type .double" }
}
diff --git a/gcc/testsuite/g++.dg/conversion/real-to-int1.C b/gcc/testsuite/g++.dg/conversion/real-to-int1.C
new file mode 100644
index 0000000..f7b990b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/real-to-int1.C
@@ -0,0 +1,17 @@
+// PR c++/97973
+
+void (*foo[1])(const int &);
+void (*foo2[1])(const double &);
+
+template<typename>
+void f ()
+{
+ (foo[0])(1.1);
+ (foo2[0])(1);
+}
+
+void
+g ()
+{
+ f<char> ();
+}
diff --git a/gcc/testsuite/g++.dg/conversion/ref7.C b/gcc/testsuite/g++.dg/conversion/ref7.C
new file mode 100644
index 0000000..99347cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/ref7.C
@@ -0,0 +1,17 @@
+// PR c++/91849
+
+struct A { operator float(); };
+
+void
+g ()
+{
+ float f = 1.f;
+ int &r = f; // { dg-error "float" }
+ int &r2 = A(); // { dg-error "float" }
+}
+
+void
+g2 ()
+{
+ int &r = 1.f; // { dg-error "float" }
+}
diff --git a/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C b/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C
index f9e8a5f..0512f03 100644
--- a/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C
+++ b/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C
@@ -37,7 +37,7 @@ my_coro (std::coroutine_handle<>& h)
{
PRINT ("coro1: about to return");
co_return;
-} // { dg-error {'struct Thing' used where a 'int' was expected} }
+} // { dg-error {cannot convert 'Thing' to 'int' in return} }
int main ()
{
diff --git a/gcc/testsuite/g++.dg/coroutines/pr95520.C b/gcc/testsuite/g++.dg/coroutines/pr95520.C
new file mode 100644
index 0000000..4849b07
--- /dev/null
+++ b/gcc/testsuite/g++.dg/coroutines/pr95520.C
@@ -0,0 +1,29 @@
+// { dg-do run }
+// { dg-output "coroutine name: MyFoo" }
+#include <coroutine>
+#include <cstdio>
+
+struct pt
+{
+ using handle_t = std::coroutine_handle<pt>;
+ auto get_return_object() noexcept { return handle_t::from_promise(*this); }
+
+ std::suspend_never initial_suspend () const noexcept { return {}; }
+ std::suspend_never final_suspend () const noexcept { return {}; }
+ void return_void() const noexcept {}
+ void unhandled_exception() const noexcept {}
+};
+
+template <> struct std::coroutine_traits<pt::handle_t>
+ { using promise_type = pt; };
+
+static pt::handle_t MyFoo ()
+{
+ printf ("coroutine name: %s\n", __builtin_FUNCTION());
+ co_return;
+}
+
+int main()
+{
+ MyFoo ();
+}
diff --git a/gcc/testsuite/g++.dg/coroutines/pr99047.C b/gcc/testsuite/g++.dg/coroutines/pr99047.C
index 124633a..05ce085 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr99047.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr99047.C
@@ -1,4 +1,5 @@
#include <optional>
+#include <utility>
#include <coroutine>
template <typename T>
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C
new file mode 100644
index 0000000..6a61f93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C
@@ -0,0 +1,13 @@
+// PR c++/100592
+// { dg-do compile { target c++11 } }
+
+template<bool>
+struct meta {
+ template<class> using if_c = int&;
+};
+
+template<bool B>
+typename meta<B>::template if_c<void> const f();
+
+using type = decltype(f<true>());
+using type = int&;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
new file mode 100644
index 0000000..8009756
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
@@ -0,0 +1,9 @@
+// PR c++/100102
+// { dg-do compile { target c++11 } }
+
+template<int()> struct ratio;
+template<class T, class U> struct duration {
+ static constexpr int _S_gcd();
+ template<class> using __is_harmonic = ratio<_S_gcd>;
+ using type = __is_harmonic<int>;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
new file mode 100644
index 0000000..a4443e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
@@ -0,0 +1,9 @@
+// PR c++/100102
+// { dg-do compile { target c++11 } }
+
+template<int> struct ratio;
+template<class T> struct duration {
+ static constexpr int _S_gcd();
+ template<class> using __is_harmonic = ratio<(duration::_S_gcd)()>;
+ using type = __is_harmonic<int>;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C
new file mode 100644
index 0000000..aae7786
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C
@@ -0,0 +1,9 @@
+// PR c++/100102
+// { dg-do compile { target c++11 } }
+
+template <bool B1> using a = int;
+template <class T3, class T4> struct k {
+ static long o();
+ template <class T5> using n = a<bool(k::o)>;
+ n<int> q;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C
new file mode 100644
index 0000000..ae27c43
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C
@@ -0,0 +1,13 @@
+// PR c++/100032
+// { dg-do compile { target c++11 } }
+
+template <template<class> class> struct X { };
+template <class> struct Y { };
+template <class T> using Z = const Y<T>;
+
+template <class T> using W = Z<T>;
+using U = X<Z>;
+using U = X<W>;
+
+using T = X<Y>;
+using T = X<Z>; // { dg-error "conflicting declaration" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C
new file mode 100644
index 0000000..d1af8d1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C
@@ -0,0 +1,6 @@
+// PR c++/100372
+// { dg-do compile { target c++14 } }
+
+template <bool> using enable_if_t = int;
+template <class> bool has_P_match_v;
+template <template <class> class... List> enable_if_t<has_P_match_v<List...>> a;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C
new file mode 100644
index 0000000..68b3a7f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C
@@ -0,0 +1,14 @@
+// PR c++/99445
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-fchecking=2 --param=hash-table-verification-limit=1000" }
+
+template <class> struct implicit_conversions;
+template <class T>
+using implicit_conversions_t = typename implicit_conversions<T>::type;
+template <class...> struct response_type;
+
+template <class Handle, class... Ts>
+using type1 = response_type<implicit_conversions_t<Ts>...>;
+
+template <class Handle, class... Ts>
+using type2 = response_type<typename implicit_conversions<Ts>::type...>;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic2.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic2.C
new file mode 100644
index 0000000..4299c7e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic2.C
@@ -0,0 +1,13 @@
+// PR c++/86355
+// { dg-do compile { target c++11 } }
+
+template <int...> struct integral_constant {
+ static const int value = 1;
+};
+template <class... T> using mp_all = integral_constant<T::value...>;
+template <class... T> using check2 = mp_all<mp_all<T..., integral_constant<0>>>;
+check2<> x;
+
+template <class T, class U> struct assert_same;
+template <class T> struct assert_same<T,T> { };
+assert_same<decltype(x),integral_constant<1>> a;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignof7.C b/gcc/testsuite/g++.dg/cpp0x/alignof7.C
index a4d7f24..2369b87 100644
--- a/gcc/testsuite/g++.dg/cpp0x/alignof7.C
+++ b/gcc/testsuite/g++.dg/cpp0x/alignof7.C
@@ -18,5 +18,5 @@ template void f4<int>(std::size_t);
// { dg-final { scan-assembler "_Z2f1IiEvDTatT_E" } }
// { dg-final { scan-assembler "_Z2f2IiEvDTaztlT_EE" } }
-// { dg-final { scan-assembler "_Z2f3IiEvDTv111__alignof__T_E" } }
-// { dg-final { scan-assembler "_Z2f4IiEvDTv111__alignof__tlT_EE" } }
+// { dg-final { scan-assembler "_Z2f3IiEvDTu11__alignof__T_EE" } }
+// { dg-final { scan-assembler "_Z2f4IiEvDTu11__alignof__XtlT_EEEE" } }
diff --git a/gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C b/gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C
new file mode 100644
index 0000000..2fbc8e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C
@@ -0,0 +1,21 @@
+// PR c++/99318
+// { dg-do compile { target c++11 } }
+
+template <typename T>
+struct S {
+ [[deprecated("foo")]] unsigned m_fn (char const chr)
+ {
+ using index_t = unsigned;
+ return T::arr[static_cast<index_t>(chr)]; // { dg-bogus "deprecated" }
+ }
+};
+
+extern unsigned int arr[];
+
+struct R {
+ [[deprecated("foo")]] unsigned m_fn (char const chr)
+ {
+ using index_t = unsigned;
+ return arr[static_cast<index_t>(chr)]; // { dg-bogus "deprecated" }
+ }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto24.C b/gcc/testsuite/g++.dg/cpp0x/auto24.C
index 193f92e..ac1ba24 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto24.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto24.C
@@ -1,5 +1,6 @@
// PR c++/48599
// { dg-do compile { target c++11 } }
+// Allowed since DR2397.
int v[1];
-auto (*p)[1] = &v; // { dg-error "8:.p. declared as array of .auto" }
+auto (*p)[1] = &v;
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto3.C b/gcc/testsuite/g++.dg/cpp0x/auto3.C
index 2cd0520..7cde745 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto3.C
@@ -9,8 +9,8 @@ auto x; // { dg-error "auto" }
// deduction, the program is ill-formed.
auto i = 42, j = 42.0; // { dg-error "auto" }
-// New CWG issue
-auto a[2] = { 1, 2 }; // { dg-error "6:.a. declared as array of .auto" }
+// CWG issue 2397: [dcl.type.auto.deduct]/2: "T shall not be an array type".
+auto a[2] = { 1, 2 }; // { dg-error "20:unable to deduce" }
template<class T>
struct A { };
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto42.C b/gcc/testsuite/g++.dg/cpp0x/auto42.C
index 8d15fc9..5b2f677 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto42.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto42.C
@@ -5,5 +5,5 @@
void foo(int i)
{
- auto x[1] = { 0 }; // { dg-error "8:.x. declared as array of .auto" }
+ auto x[1] = { 0 }; // { dg-error "19:unable to deduce" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C
new file mode 100644
index 0000000..446d21d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C
@@ -0,0 +1,7 @@
+// PR c++/100111
+// { dg-do compile { target c++11 } }
+// { dg-options "-fno-elide-constructors" }
+
+struct A {};
+struct B : A { int b; constexpr B (A x) : A(x), b() {} };
+struct C { B c; constexpr C () : c({}) {} } d;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
index 2c9d2f9..eae0d8c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
@@ -1,5 +1,6 @@
// PR c++/52830
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-fchecking" }
// { dg-ice "comptypes" }
template<bool b> struct eif { typedef void type; };
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C
new file mode 100644
index 0000000..14e026e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C
@@ -0,0 +1,15 @@
+// PR c++/91933
+// { dg-do compile { target c++11 } }
+
+struct NoMut1 { int a, b; };
+struct NoMut3 : NoMut1 {
+ constexpr NoMut3(int a, int b) : NoMut1{a, b} {}
+};
+void mutable_subobjects() {
+ constexpr NoMut3 nm3 = {1, 2};
+ struct A {
+ void f() {
+ static_assert(nm3.a == 1, "");
+ }
+ };
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C
index 7c37f6a..b79e8a9 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C
@@ -6,11 +6,11 @@ static int i;
constexpr void *vp0 = nullptr;
constexpr void *vpi = &i;
constexpr int *p1 = (int *) vp0; // { dg-error "cast from .void\\*. is not allowed" }
-constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } }
+constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" }
constexpr int *p3 = static_cast<int *>(vp0); // { dg-error "cast from .void\\*. is not allowed" }
-constexpr int *p4 = static_cast<int *>(vpi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } }
+constexpr int *p4 = static_cast<int *>(vpi); // { dg-error "cast from .void\\*. is not allowed" }
constexpr void *p5 = vp0;
constexpr void *p6 = vpi;
constexpr int *pi = &i;
-constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } }
+constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-delegating3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-delegating3.C
new file mode 100644
index 0000000..2263ec8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-delegating3.C
@@ -0,0 +1,10 @@
+// PR c++/65816
+// { dg-do compile { target c++11 } }
+
+struct test {
+ int m;
+ test() = default;
+ constexpr test(int) : test() {}
+};
+
+static_assert(test(0).m == 0, "");
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty16.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty16.C
new file mode 100644
index 0000000..79be244
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty16.C
@@ -0,0 +1,10 @@
+// PR c++/101194
+// { dg-do compile { target c++11 } }
+
+struct nodefault {
+ constexpr nodefault(int) { }
+};
+
+constexpr nodefault x[1] = { nodefault{0} };
+
+constexpr nodefault y = x[0];
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C
new file mode 100644
index 0000000..28ffd2c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C
@@ -0,0 +1,6 @@
+// DR 2126
+// { dg-do compile { target c++11 } }
+
+typedef const int CI[3];
+constexpr CI &ci = CI{11, 22, 33};
+static_assert(ci[1] == 22, "");
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C
new file mode 100644
index 0000000..e50218d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C
@@ -0,0 +1,10 @@
+// PR c++/98800
+// { dg-do compile { target c++11 } }
+
+template <bool> struct enable_if_t {};
+struct tmp {
+ template <class> constexpr bool is_integral();
+ template <class E> static auto func() -> enable_if_t<is_integral<E>()>; // { dg-error "without object" }
+};
+template <class> constexpr bool tmp::is_integral() { return true; }
+int main() { tmp::func<int>(); } // { dg-error "no match" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C
new file mode 100644
index 0000000..5c1e865
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C
@@ -0,0 +1,15 @@
+// PR c++/80456
+// { dg-do compile { target c++11 } }
+
+struct A {
+ static constexpr bool test() noexcept { return true; }
+
+ void f() volatile {
+ constexpr bool b = test();
+ }
+};
+
+void g() {
+ A a;
+ a.f();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/dc10.C b/gcc/testsuite/g++.dg/cpp0x/dc10.C
new file mode 100644
index 0000000..c008a17
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/dc10.C
@@ -0,0 +1,19 @@
+// PR c++/65816
+// { dg-do run { target c++11 } }
+
+void* operator new(decltype(sizeof(int)), void* ptr) { return ptr; }
+
+struct test {
+ int i;
+ test() = default;
+ test(int) : test() {}
+};
+
+int main() {
+ alignas(test) unsigned char space[sizeof(test)];
+ for (auto& c : space) c = 0xff;
+
+ auto ptr = ::new(&space) test(42);
+ int& i = static_cast<test&>(*ptr).i;
+ if (i != 0) __builtin_abort();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C
new file mode 100644
index 0000000..bc488ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C
@@ -0,0 +1,16 @@
+// PR c++/100205
+// { dg-do compile { target c++11 } }
+
+struct coordinate_matrix {
+ using index_t = unsigned;
+ struct convert_to_matrix_coordinate {
+ index_t column_id;
+ };
+ index_t column_id;
+
+ // does not work
+ using value_type2 = decltype(convert_to_matrix_coordinate{column_id});
+
+ // does work
+ using value_type5 = decltype(column_id);
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype29.C b/gcc/testsuite/g++.dg/cpp0x/decltype29.C
index 51da8dd..ea97b03 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype29.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype29.C
@@ -10,10 +10,10 @@ ft() {}
template<class F, int N>
decltype (ft<F> (F())) // { dg-error "depth" }
-ft() {}
+ft(F) {}
int main() {
- ft<struct a*, 0>(); // { dg-message "from here" }
+ ft<struct a*, 0>(0); // { dg-message "from here" }
}
// { dg-prune-output "compilation terminated" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted15.C b/gcc/testsuite/g++.dg/cpp0x/deleted15.C
new file mode 100644
index 0000000..06d2171
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/deleted15.C
@@ -0,0 +1,6 @@
+// PR c++/101106
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+int f();
+int f() = delete; // { dg-message "not first declaration" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/depr-copy3.C b/gcc/testsuite/g++.dg/cpp0x/depr-copy3.C
new file mode 100644
index 0000000..c303c9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/depr-copy3.C
@@ -0,0 +1,35 @@
+// PR c++/92145
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wdeprecated-copy" }
+
+struct base
+{
+ base() { }
+ base(const base&) { }
+ base(base&&) { }
+ base& operator=(const base&) { return *this; }
+ base& operator=(base&&) { return *this; }
+};
+
+struct foo : base
+{
+ //using base::base;
+ using base::operator=;
+};
+
+struct bar
+{
+ bar& operator=(foo v)
+ {
+ value = v;
+ return *this;
+ }
+
+ foo value;
+};
+
+int main()
+{
+ foo a;
+ foo{a};
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/depr-copy4.C b/gcc/testsuite/g++.dg/cpp0x/depr-copy4.C
new file mode 100644
index 0000000..42852a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/depr-copy4.C
@@ -0,0 +1,16 @@
+// PR c++/94492
+// { dg-additional-options -Wdeprecated-copy }
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-copy"
+struct expr
+{
+ int a, b;
+ expr& operator=(const expr&) { return *this; }
+};
+#pragma GCC diagnostic pop
+
+expr foo(expr e)
+{
+ return e;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base4.C b/gcc/testsuite/g++.dg/cpp0x/enum_base4.C
new file mode 100644
index 0000000..b301525
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/enum_base4.C
@@ -0,0 +1,8 @@
+// PR c++/96380
+// { dg-do compile { target c++11 } }
+
+extern const int a, b;
+enum struct c;
+template <class>
+enum struct c : union enum struct c { e = b, f = a }; // { dg-error "types may not be defined|expected|elaborated-type-specifier" }
+enum class c {};
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base5.C b/gcc/testsuite/g++.dg/cpp0x/enum_base5.C
new file mode 100644
index 0000000..c01e857
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/enum_base5.C
@@ -0,0 +1,7 @@
+// PR c++/96380
+// { dg-do compile { target c++11 } }
+
+extern const int a, b;
+enum struct c;
+template <class>
+enum struct c : union enum struct c { e = b, f = a }; // { dg-error "types may not be defined|expected|elaborated-type-specifier" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-6.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-6.C
new file mode 100644
index 0000000..8aff3ae
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-6.C
@@ -0,0 +1,17 @@
+// PR c++/99066
+// { dg-do compile { target c++11 } }
+
+template <typename a> struct basic_string {
+ static const int npos = 1;
+};
+template <typename a> const int basic_string<a>::npos;
+
+struct e { template <bool> int f() const; };
+
+template <bool> int e::f() const {
+ return basic_string<char>::npos;
+}
+
+extern template class basic_string<char>;
+
+// { dg-final { scan-assembler-not "_ZN12basic_stringIcE4nposE" } }
diff --git a/gcc/testsuite/g++.dg/cpp0x/friend7.C b/gcc/testsuite/g++.dg/cpp0x/friend7.C
new file mode 100644
index 0000000..e1d5f44
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/friend7.C
@@ -0,0 +1,40 @@
+// PR c++/99032
+// { dg-do compile { target c++11 } }
+
+class X { };
+template<typename T1, typename T2>
+void foo (T1, T2);
+
+struct S {
+ [[deprecated]] friend void f(); // { dg-warning "attribute ignored" }
+ [[deprecated]] friend void f2() { }
+ __attribute__((deprecated)) friend void f3();
+ friend void f3 [[deprecated]] (); // { dg-warning "attribute ignored" }
+ friend void f4 [[deprecated]] () { }
+ [[deprecated]] friend void; // { dg-warning "attribute ignored" }
+ __attribute__((deprecated)) friend int;
+ friend __attribute__((deprecated)) int;
+ friend int __attribute__((deprecated));
+ [[deprecated]] friend X; // { dg-warning "attribute ignored" }
+ [[deprecated]] friend class N; // { dg-warning "attribute ignored" }
+ friend class [[deprecated]] N2; // { dg-warning "attribute ignored" }
+ friend class __attribute__((deprecated)) N3;
+ [[deprecated]] friend void foo<>(int, int); // { dg-warning "attribute ignored" }
+ [[deprecated]] friend void ::foo(int, int); // { dg-warning "attribute ignored" }
+ // { dg-bogus "should have" "PR100339" { xfail *-*-* } .-1 }
+};
+
+template<typename T>
+class node { };
+
+template<typename T>
+struct A {
+ [[deprecated]] friend T; // { dg-warning "attribute ignored" }
+ [[deprecated]] friend class node<T>; // { dg-warning "attribute ignored" }
+ template<typename>
+ [[deprecated]] friend class A; // { dg-warning "attribute ignored" }
+ template<typename>
+ [[deprecated]] friend void bar () { }
+ template<typename>
+ [[deprecated]] friend void baz (); // { dg-warning "attribute ignored" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/friend8.C b/gcc/testsuite/g++.dg/cpp0x/friend8.C
new file mode 100644
index 0000000..8d2a2d3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/friend8.C
@@ -0,0 +1,15 @@
+// PR c++/100596
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ __attribute((deprecated)) friend void f(A); // part of A API, definition in .C
+ [[deprecated]] friend void f2(A); // { dg-warning "ignored" }
+};
+
+int main()
+{
+ A a;
+ f(a); // { dg-warning "is deprecated" }
+ f2(a);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C
index 453fc01..4010ba7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C
@@ -2,7 +2,8 @@
int fragile_block(void) {
typedef
- [[gnu::aligned (16)]] // { dg-warning "ignored" }
+ [[gnu::aligned (16)]] // { dg-error "standard attributes in middle of decl-specifiers" }
+// { dg-warning "attribute ignored" "" { target *-*-* } .-1 }
struct {
int i;
} XmmUint16;
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
index b401c69..c120aed 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
@@ -13,7 +13,8 @@ int one_third [[noreturn]] [[gnu::unused]] (void);
int [[gnu::unused]] one_half(); // { dg-warning "ignored" }
static
-[[noreturn]] // { dg-warning "ignored" }
+[[noreturn]] // { dg-error "standard attributes in middle of decl-specifiers" }
+// { dg-warning "attribute ignored" "" { target *-*-* } .-1 }
void two [[gnu::unused]] (void) {}
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-45.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-45.C
index 573a1ab..2bdd549 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-45.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-45.C
@@ -1,4 +1,4 @@
// PR c++/52906
// { dg-do compile { target c++11 } }
-[[gnu::deprecated]]; // { dg-error "does not declare anything" }
+[[gnu::deprecated]]; // { dg-warning "attribute ignored" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-58.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-58.C
index f760f56..dc01722 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-58.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-58.C
@@ -2,4 +2,4 @@
// { dg-do compile { target c++11 } }
namespace N { int i; }
-using namespace N alignas(int); // { dg-warning "ignored" }
+alignas(int) using namespace N; // { dg-warning "ignored" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-59.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-59.C
index c7839fe..9776dc3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-59.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-59.C
@@ -2,4 +2,11 @@
// { dg-do compile { target c++11 } }
namespace N {}
-using namespace N alignas(X); // { dg-error "declared" }
+alignas(X) using namespace N; // { dg-error "declared" }
+namespace O {}
+using namespace O alignas(X); // { dg-error "expected" }
+// { dg-error "declared" "" { target *-*-* } .-1 }
+// { dg-warning "attribute ignored" "" { target *-*-* } .-2 }
+namespace P {}
+using namespace P alignas(int); // { dg-error "expected" }
+// { dg-warning "attribute ignored" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C
new file mode 100644
index 0000000..75f4077
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C
@@ -0,0 +1,20 @@
+// { dg-do compile { target c++11 } }
+// Test attribute deprecated on :: with class, enum, and namespace.
+
+struct [[deprecated]] S { static void fn(); static const int s = 0; };
+union [[deprecated]] U { static void fn(); static const int u = 0; };
+enum [[deprecated]] E { X };
+enum class [[deprecated]] SE { Y };
+namespace [[deprecated]] N { struct S { }; }
+
+void
+g ()
+{
+ S::fn(); // { dg-warning "deprecated" }
+ (void) S::s; // { dg-warning "deprecated" }
+ U::fn(); // { dg-warning "deprecated" }
+ (void) U::u; // { dg-warning "deprecated" }
+ (void) E::X; // { dg-warning "deprecated" }
+ (void) SE::Y; // { dg-warning "deprecated" }
+ N::S s; // { dg-warning "deprecated" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C
new file mode 100644
index 0000000..7e17bc8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C
@@ -0,0 +1,10 @@
+// { dg-do compile { target c++11 } }
+// A C++11 attribute cannot appear in the middle of the decl-specifier-seq,
+// only before it (in which case it appertains to the declaration) or at
+// the end (in which case it appertains to the type).
+
+struct S {
+ friend [[deprecated]] void; // { dg-error "standard attributes in middle of decl-specifiers" }
+ friend [[deprecated]] int fn(); // { dg-error "standard attributes in middle of decl-specifiers" }
+ // { dg-warning "attribute ignored" "" { target *-*-* } .-1 }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-75.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-75.C
new file mode 100644
index 0000000..bac80aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-75.C
@@ -0,0 +1,35 @@
+// PR c++/101582
+// { dg-do compile }
+// { dg-options "" }
+
+;
+[[]] [[]] [[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+[[foobar]]; // { dg-warning "attribute ignored" }
+// { dg-warning "attributes only available with" "" { target c++98_only } .-1 }
+
+extern "C" ;
+extern "C" [[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+extern "C" extern "C" ;
+extern "C" extern "C" [[]][[]][[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+__extension__ ;
+__extension__ [[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+__extension__ __extension__ ;
+__extension__ __extension__ [[]][[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+
+namespace N {
+
+;
+[[]] [[]] [[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+[[foobar]]; // { dg-warning "attribute ignored" }
+// { dg-warning "attributes only available with" "" { target c++98_only } .-1 }
+
+extern "C" ;
+extern "C" [[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+extern "C" extern "C" ;
+extern "C" extern "C" [[]][[]][[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+__extension__ ;
+__extension__ [[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+__extension__ __extension__ ;
+__extension__ __extension__ [[]][[]]; // { dg-warning "attributes only available with" "" { target c++98_only } }
+
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-76.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-76.C
new file mode 100644
index 0000000..72cd4b3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-76.C
@@ -0,0 +1,34 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-attributes" }
+
+namespace N {}
+namespace O { typedef int T; };
+namespace P {}
+
+void
+foo ()
+{
+ [[]] asm (""); // { dg-error "expected" }
+ [[]] __extension__ asm (""); // { dg-error "expected" }
+ __extension__ [[]] asm (""); // { dg-error "expected" }
+ [[]] namespace M = ::N; // { dg-error "expected" }
+ [[]] using namespace N; // { dg-bogus "expected" }
+ using namespace P [[]]; // { dg-error "expected" }
+ [[]] using O::T; // { dg-error "expected" }
+ [[]] __label__ foo; // { dg-error "expected" }
+ [[]] static_assert (true, ""); // { dg-error "expected" }
+}
+
+void
+bar ()
+{
+ [[gnu::unused]] asm (""); // { dg-error "expected" }
+ [[gnu::unused]] __extension__ asm (""); // { dg-error "expected" }
+ __extension__ [[gnu::unused]] asm (""); // { dg-error "expected" }
+ [[gnu::unused]] namespace M = ::N; // { dg-error "expected" }
+ [[gnu::unused]] using namespace N; // { dg-bogus "expected" }
+ using namespace P [[gnu::unused]]; // { dg-error "expected" }
+ [[gnu::unused]] using O::T; // { dg-error "expected" }
+ [[gnu::unused]] __label__ foo; // { dg-error "expected" }
+ [[gnu::unused]] static_assert (true, ""); // { dg-error "expected" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C
new file mode 100644
index 0000000..6dcced4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C
@@ -0,0 +1,20 @@
+// PR c++/100644
+// { dg-do compile { target c++11 } }
+
+struct NonMovable {
+ NonMovable(NonMovable&&) = delete;
+};
+
+template <class T>
+struct Maybe {
+ NonMovable mMember;
+
+ template <typename U>
+ Maybe(Maybe<U>&&);
+};
+
+void foo(Maybe<int>);
+
+void unlucky(Maybe<int>&& x) {
+ Maybe<int> var{(Maybe<int>&&)x};
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C
new file mode 100644
index 0000000..a14874f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C
@@ -0,0 +1,26 @@
+// PR c++/94751
+// { dg-do compile }
+// { dg-options "-w" }
+
+struct A {
+ A(float);
+};
+
+template<typename T>
+struct B : A {
+ using A::A;
+
+ struct C {
+ C(int);
+ };
+
+ C c{ "foo" }; // { dg-error "invalid conversion" }
+};
+
+struct S { S(B<A> *); };
+
+S
+fn ()
+{
+ return S(new B<A>(10.5));
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-base4.C b/gcc/testsuite/g++.dg/cpp0x/initlist-base4.C
new file mode 100644
index 0000000..4a02af9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-base4.C
@@ -0,0 +1,26 @@
+// PR c++/65816
+// { dg-do run { target c++11 } }
+
+void* operator new(decltype(sizeof(int)), void* ptr) { return ptr; }
+
+struct item { int i; };
+
+struct collector : item {
+ int j;
+ collector() = default;
+ collector(int) {}
+};
+
+struct tuple : collector {
+ tuple() : collector() {}
+};
+
+int main() {
+ alignas(tuple) unsigned char space[sizeof(tuple)];
+ for (auto& c : space) c = 0xff;
+
+ auto ptr = ::new(&space) tuple;
+ int& i = static_cast<tuple&>(*ptr).i;
+ int& j = static_cast<tuple&>(*ptr).j;
+ if (i != 0 || j != 0) __builtin_abort();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-new5.C b/gcc/testsuite/g++.dg/cpp0x/initlist-new5.C
new file mode 100644
index 0000000..da54d89
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-new5.C
@@ -0,0 +1,9 @@
+// PR c++/99643
+// { dg-do compile { target c++11 } }
+
+struct Foo {};
+Foo get_foo();
+
+int main() {
+ new Foo[1]{get_foo()};
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist124.C b/gcc/testsuite/g++.dg/cpp0x/initlist124.C
new file mode 100644
index 0000000..45dcbb3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist124.C
@@ -0,0 +1,13 @@
+// PR c++/100963
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+struct B {
+ B(int) = delete;
+ template<class T> B(std::initializer_list<T>);
+};
+
+int main() {
+ B({0});
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist48.C b/gcc/testsuite/g++.dg/cpp0x/initlist48.C
index 7a79c67..cd9027e 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist48.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist48.C
@@ -2,6 +2,7 @@
// { dg-do compile { target c++11 } }
#include <memory>
+#include <initializer_list>
struct Foo{
int i;
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist75.C b/gcc/testsuite/g++.dg/cpp0x/initlist75.C
index 9a45087..f572f51 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist75.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist75.C
@@ -3,4 +3,4 @@
#include <initializer_list>
-auto foo[] = {}; // { dg-error "6:.foo. declared as array of .auto" }
+auto foo[] = {}; // { dg-error "15:unable to deduce" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist80.C b/gcc/testsuite/g++.dg/cpp0x/initlist80.C
index 15723be..a6ab40c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist80.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist80.C
@@ -3,4 +3,4 @@
#include <initializer_list>
-auto x[2] = {}; // { dg-error "6:.x. declared as array of .auto" }
+auto x[2] = {}; // { dg-error "14:unable to deduce" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C
new file mode 100644
index 0000000..810ed53
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C
@@ -0,0 +1,12 @@
+// PR c++/95870
+// { dg-do compile { target c++11 } }
+
+template <typename> struct S {
+ S();
+ int b = []() -> int { enum E {}; return 1; }();
+};
+struct C : S<int> {
+ C();
+};
+template <typename T> S<T>::S() = default;
+C::C() {}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C
new file mode 100644
index 0000000..6746157
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C
@@ -0,0 +1,9 @@
+// PR c++/99583
+// { dg-do compile { target c++11 } }
+
+void f(...);
+
+template <bool... B>
+void g() {
+ f([]() noexcept(B) {} ...);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C
new file mode 100644
index 0000000..ac4e631
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C
@@ -0,0 +1,11 @@
+// PR c++/100006
+// { dg-do compile { target c++14 } }
+
+template <class... Ts>
+void f() {
+ [] { struct S : Ts { }; }; // { dg-error "not expanded" }
+}
+
+int main() {
+ f<>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C
new file mode 100644
index 0000000..185aa03
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C
@@ -0,0 +1,8 @@
+// PR c++/100109
+// { dg-do compile { target c++11 } }
+
+template <int... E>
+void f() {
+ [] { enum e { e = E }; }; // { dg-error "not expanded" }
+}
+template void f<>();
diff --git a/gcc/testsuite/g++.dg/cpp0x/new5.C b/gcc/testsuite/g++.dg/cpp0x/new5.C
new file mode 100644
index 0000000..b5a9ca2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/new5.C
@@ -0,0 +1,21 @@
+// PR c++/99705
+// { dg-do compile { target c++11 } }
+
+template <typename T>
+struct C
+{
+ C () { f (); }
+ ~C () {}
+ static void f () {}
+};
+
+struct X
+{
+ X ();
+ int n = 10;
+ C<int> *p = new C<int>[n];
+};
+
+X::X ()
+{
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept66.C b/gcc/testsuite/g++.dg/cpp0x/noexcept66.C
new file mode 100644
index 0000000..6c76d91
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept66.C
@@ -0,0 +1,13 @@
+// PR c++/99844
+// { dg-do compile { target c++11 } }
+
+template <bool... B>
+struct S {
+ void fn() noexcept(B); // { dg-error "parameter packs not expanded" }
+};
+
+void fn ()
+{
+ S<true> s;
+ s.fn();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept67.C b/gcc/testsuite/g++.dg/cpp0x/noexcept67.C
new file mode 100644
index 0000000..7f06103
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept67.C
@@ -0,0 +1,26 @@
+// PR c++/100101
+// { dg-do compile { target c++11 } }
+
+template <typename T> struct A
+{
+ template <typename U> static char foo(U*, int* = 0);
+ static const bool value = sizeof(foo(static_cast<T*>(nullptr))) > 0;
+};
+
+template <bool b> struct B
+{
+ static const bool value = b;
+};
+
+template <typename T> struct C
+{
+ typedef B<A<T>::value> type;
+};
+
+template <typename T>
+void bar() noexcept(A<T>::value && C<T>::type::value) {}
+
+void baz()
+{
+ bar<void>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept68.C b/gcc/testsuite/g++.dg/cpp0x/noexcept68.C
new file mode 100644
index 0000000..086899a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept68.C
@@ -0,0 +1,8 @@
+// PR c++/97420
+// { dg-do compile { target c++11 } }
+
+int f(int) noexcept;
+template<int (&)(int)> void A();
+int main() {
+ A<f>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept69.C b/gcc/testsuite/g++.dg/cpp0x/noexcept69.C
new file mode 100644
index 0000000..9b87ba0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept69.C
@@ -0,0 +1,12 @@
+// PR c++/100752
+// { dg-do compile { target c++11 } }
+
+struct S {
+ void f() noexcept {}
+ S &g() noexcept(noexcept(f())) { f(); return *this; }
+};
+
+struct X {
+ int& f() noexcept(noexcept(i));
+ int i;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept70.C b/gcc/testsuite/g++.dg/cpp0x/noexcept70.C
new file mode 100644
index 0000000..45a6137
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept70.C
@@ -0,0 +1,5 @@
+// PR c++/101087
+// { dg-do compile { target c++11 } }
+
+int f();
+static_assert(noexcept(sizeof(f())), "");
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-virtual1a.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-virtual1a.C
new file mode 100644
index 0000000..dc847cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-virtual1a.C
@@ -0,0 +1,28 @@
+// PR c++/80431
+// { dg-do run { target c++11 } }
+
+// A variant of nsdmi-virtual1.C where A is only a morally virtual base of B.
+
+struct A
+{
+ A(): i(42) { }
+ int i;
+ int f() { return i; }
+};
+
+struct D : A { int pad; };
+
+struct B : virtual D
+{
+ int j = i + f();
+ int k = A::i + A::f();
+};
+
+struct C: B { int pad; };
+
+int main()
+{
+ C c;
+ if (c.j != 84 || c.k != 84)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi17.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi17.C
new file mode 100644
index 0000000..e69d6ce
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi17.C
@@ -0,0 +1,8 @@
+// PR c++/98352
+// { dg-do compile }
+
+struct A {
+ int i = (A(), 42); // { dg-error "default member initializer" }
+// { dg-error "only available" "" { target c++98_only } .-1 }
+};
+A a;
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr11.C b/gcc/testsuite/g++.dg/cpp0x/nullptr11.C
index f81f0c3..b8bc682 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr11.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr11.C
@@ -9,31 +9,15 @@ void fun()
{
assert_true(nullptr == nullptr);
assert_false(nullptr != nullptr);
- assert_false(nullptr < nullptr);
- assert_false(nullptr > nullptr);
- assert_true(nullptr <= nullptr);
- assert_true(nullptr >= nullptr);
decltype(nullptr) mynull = 0;
assert_true(mynull == nullptr);
assert_false(mynull != nullptr);
- assert_false(mynull < nullptr);
- assert_false(mynull > nullptr);
- assert_true(mynull <= nullptr);
- assert_true(mynull >= nullptr);
assert_true(nullptr == mynull);
assert_false(nullptr != mynull);
- assert_false(nullptr < mynull);
- assert_false(nullptr > mynull);
- assert_true(nullptr <= mynull);
- assert_true(nullptr >= mynull);
assert_true(mynull == mynull);
assert_false(mynull != mynull);
- assert_false(mynull < mynull);
- assert_false(mynull > mynull);
- assert_true(mynull <= mynull);
- assert_true(mynull >= mynull);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr46.C b/gcc/testsuite/g++.dg/cpp0x/nullptr46.C
new file mode 100644
index 0000000..6c08eaa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr46.C
@@ -0,0 +1,12 @@
+// PR c++/101443
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2" }
+
+decltype(nullptr) foo ();
+
+bool
+bar ()
+{
+ return foo () > nullptr // { dg-error "ordered comparison" }
+ || foo () < nullptr; // { dg-error "ordered comparison" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr60209-neg.C b/gcc/testsuite/g++.dg/cpp0x/pr60209-neg.C
index 77fd3d8..6c3ad0c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr60209-neg.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr60209-neg.C
@@ -17,7 +17,7 @@ void operator L"" "" _x(unsigned long long); // { dg-error "invalid encoding pre
void operator u8"" "" _y(unsigned long long); // { dg-error "invalid encoding prefix in literal operator" }
-void operator u"" L"" _z(unsigned long long); // { dg-error "unsupported non-standard concatenation of string literals" }
+void operator u"" L"" _z(unsigned long long); // { dg-error "concatenation of string literals with conflicting encoding prefixes" }
void operator ""_p ""_q(unsigned long long); // { dg-error "inconsistent user-defined literal suffixes" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr68724.C b/gcc/testsuite/g++.dg/cpp0x/pr68724.C
index 4e99d53..6df7f71 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr68724.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr68724.C
@@ -9,7 +9,7 @@ struct integral_constant
integral_constant<bool, true> inst;
template <typename _Tp>
-struct integral_constant<bool, __is_enum(_Tp)> // { dg-error "32:template argument" }
+struct integral_constant<bool, __is_enum(_Tp)> // { dg-error "not deducible" }
{
};
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78765.C b/gcc/testsuite/g++.dg/cpp0x/pr78765.C
index 6b66d26..4c63fdd 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr78765.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr78765.C
@@ -8,7 +8,7 @@ struct ValueType {
int field;
};
-static constexpr ValueType var = 0; // { dg-error "conversion" }
+static constexpr ValueType var = 0; // { dg-error "conversion|convert" }
template <int> class ValueTypeInfo;
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr94616.C b/gcc/testsuite/g++.dg/cpp0x/pr94616.C
new file mode 100644
index 0000000..a8fe700
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr94616.C
@@ -0,0 +1,23 @@
+// PR c++/94616
+// { dg-do compile { target c++11 } }
+
+struct Bar {
+ Bar(int n) { if (n > 0) throw 2; }
+ ~Bar() {}
+};
+
+struct Foo {
+ Bar b1 = 0;
+ Bar b2 = 1;
+ Foo() {}
+ ~Foo() {}
+};
+
+int
+main()
+{
+ try {
+ Foo f;
+ } catch(int) {
+ }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C b/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C
index c173576..5402e82 100644
--- a/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C
@@ -6,5 +6,5 @@ struct S { };
void
foo ()
{
- auto a = reinterpret_cast<S&&>(foo ()); // { dg-error "12:invalid cast of an rvalue expression of type 'void' to type" }
+ auto a = reinterpret_cast<S&&>(foo ()); // { dg-error "12:invalid cast of a prvalue expression of type 'void' to type" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C b/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C
index 3ae5691..3adf683 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C
@@ -5,7 +5,7 @@ struct A { virtual void f(); };
struct B : A {};
auto && a = static_cast<A&&>(B());
-auto && b = reinterpret_cast<A&&>(B());
+auto && b = reinterpret_cast<A&&>(B()); // { dg-error "prvalue" }
auto && c = dynamic_cast<A&&>(B());
auto && d = dynamic_cast<B&&>(static_cast<A&&>(B()));
auto && e = const_cast<B&&>(B());
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-life.C b/gcc/testsuite/g++.dg/cpp0x/rv-life.C
new file mode 100644
index 0000000..0fd1119
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/rv-life.C
@@ -0,0 +1,12 @@
+// Core 1376
+// PR c++/52202
+// { dg-do run { target c++11 } }
+
+extern "C" void abort();
+bool x;
+struct T { ~T() { if (!x) abort (); } };
+int main()
+{
+ T&& r = static_cast<T&&>(T());
+ x = true;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae67.C b/gcc/testsuite/g++.dg/cpp0x/sfinae67.C
new file mode 100644
index 0000000..cfed92a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae67.C
@@ -0,0 +1,20 @@
+// PR c++/84689
+// { dg-do compile { target c++11 } }
+
+struct base {
+ void operator()();
+};
+
+struct a : base { };
+struct b : base { };
+
+struct f : a, b {
+ using a::operator();
+ using b::operator();
+};
+
+template <class T> auto g(int) -> decltype(T()());
+template <class T> auto g(...) -> int;
+
+using type = decltype(g<f>(0));
+using type = int;
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae68.C b/gcc/testsuite/g++.dg/cpp0x/sfinae68.C
new file mode 100644
index 0000000..d292b68
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae68.C
@@ -0,0 +1,23 @@
+// PR c++/90019
+// { dg-do compile { target c++11 } }
+
+template<bool, typename T = void>
+struct enable_if { };
+template<typename T>
+struct enable_if<true, T> { typedef T type; };
+template<bool C, typename T = void>
+using __enable_if_t = typename enable_if<C, T>::type;
+template<bool C, typename T = void>
+using enable_if_t = typename enable_if<C, T>::type;
+
+template <int I, enable_if_t<I == 0, int>...> void foo() {}
+template <int I, enable_if_t<I != 0, int>...> void foo() {}
+template <int I, int=0, enable_if_t<I == 0, int>...> void bar() {}
+template <int I, int=0, enable_if_t<I != 0, int>...> void bar() {}
+
+void test()
+{
+ bar<0>();
+ bar<0,0>();
+ foo<0>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert17.C b/gcc/testsuite/g++.dg/cpp0x/static_assert17.C
new file mode 100644
index 0000000..28cbebe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert17.C
@@ -0,0 +1,9 @@
+// PR c++/99893
+// { dg-do compile { target c++11 } }
+
+void f(...);
+
+template<class... Ts>
+void g() {
+ f([] { static_assert(Ts::value, ""); }...);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic181.C b/gcc/testsuite/g++.dg/cpp0x/variadic181.C
new file mode 100644
index 0000000..0bb6fe7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic181.C
@@ -0,0 +1,9 @@
+// PR c++/99745
+// { dg-do compile { target c++11 } }
+
+template <typename... Ts>
+struct S { int a : sizeof(Ts); }; // { dg-error "parameter packs not expanded with '\.\.\.':" }
+S<int> s; // { dg-message "'Ts'" "" { target *-*-* } .-1 }
+template <int... Ns>
+struct T { int a : Ns; }; // { dg-error "parameter packs not expanded with '\.\.\.':" }
+T<0> t; // { dg-message "'Ns'" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic182.C b/gcc/testsuite/g++.dg/cpp0x/variadic182.C
new file mode 100644
index 0000000..078de74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic182.C
@@ -0,0 +1,18 @@
+// PR c++/88580
+// { dg-do compile { target c++11 } }
+
+template <class... Bases>
+struct Derived : Bases... {
+ template <class... Ts>
+ Derived(Ts... args) : Bases(args, args..., args)... { }
+};
+
+struct A { };
+struct B { };
+struct C { };
+
+struct Base1 { Base1(A, A, B, C, A); };
+struct Base2 { Base2(B, A, B, C, B); };
+struct Base3 { Base3(C, A, B, C, C); };
+
+Derived<Base1, Base2, Base3> d(A{}, B{}, C{});
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic38.C b/gcc/testsuite/g++.dg/cpp0x/variadic38.C
index b569404..49fa48c3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic38.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic38.C
@@ -3,4 +3,4 @@ template<int... Values>
struct int_vec {};
template<int... Values>
-struct int_vec<0, (Values+1)...> {}; // { dg-error "26:template argument" }
+struct int_vec<0, (Values+1)...> {}; // { dg-error "not deducible" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
index cb9530d..7a86823 100644
--- a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
@@ -1,5 +1,6 @@
// PR c++/88982
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-fchecking" }
// { dg-ice "tsubst_pack_expansion" }
template<typename...Ts> struct A {
diff --git a/gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.C b/gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.C
new file mode 100644
index 0000000..048d484
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.C
@@ -0,0 +1,4 @@
+// { dg-do compile { target c++14 } }
+
+#include "Wnarrowing2.h"
+// { dg-error "narrowing conversion" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.h b/gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.h
new file mode 100644
index 0000000..7dafa51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/Wnarrowing2.h
@@ -0,0 +1,2 @@
+#pragma GCC system_header
+constexpr unsigned f() { constexpr int n = -1; return unsigned{n}; }
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
index c24c3b8..bed5ea0 100644
--- a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
@@ -1,5 +1,6 @@
// PR c++/88003
// { dg-do compile { target c++14 } }
+// { dg-additional-options "-fchecking" }
// { dg-ice "poplevel_class" }
auto test() {
diff --git a/gcc/testsuite/g++.dg/cpp1y/builtin_location.C b/gcc/testsuite/g++.dg/cpp1y/builtin_location.C
index b3b9b43..1f8a7fd 100644
--- a/gcc/testsuite/g++.dg/cpp1y/builtin_location.C
+++ b/gcc/testsuite/g++.dg/cpp1y/builtin_location.C
@@ -103,10 +103,10 @@ A (0 == __builtin_strcmp (f3, FILE_3));
#define FILE_4 "next_file_name.another_suffix"
#line 1 "foobar"
constexpr const char* f4 = this_file
- (
#line 1 FILE_4
- )
+ (
#line 1 "foobar"
+ )
;
A (0 == __builtin_strcmp (f4, FILE_4));
@@ -167,9 +167,9 @@ A (n5 == 9);
// of the function call.
#line 1
constexpr int n6 = this_line
- (
#line 99
- )
+ (
#line 1
+ )
;
A (n6 == 99);
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-101371-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-101371-2.C
new file mode 100644
index 0000000..fb67b67
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-101371-2.C
@@ -0,0 +1,23 @@
+// PR c++/101371
+// { dg-do compile { target c++14 } }
+
+struct A {
+ int i;
+};
+struct B {
+ A a{};
+ constexpr B() : a() {}
+ constexpr B(const B &rhs) : a(rhs.a) {}
+};
+struct C {
+ B arr[1];
+};
+
+constexpr C
+fn ()
+{
+ C c{};
+ return c;
+}
+
+constexpr C c = fn();
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-101371.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-101371.C
new file mode 100644
index 0000000..b6351b8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-101371.C
@@ -0,0 +1,29 @@
+// PR c++/101371
+// { dg-do compile { target c++14 } }
+
+struct A {
+ int i;
+};
+struct B {
+ A a{};
+ constexpr B() : a() {}
+ constexpr B(const B &rhs) : a(rhs.a) {}
+};
+struct C {
+ B arr[1];
+};
+
+struct X {
+ constexpr C fn () const
+ {
+ C c{};
+ return c;
+ }
+};
+
+void
+g ()
+{
+ X x;
+ constexpr auto z = x.fn();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C
new file mode 100644
index 0000000..dea5a5b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C
@@ -0,0 +1,24 @@
+// PR c++/99859
+// { dg-do compile { target c++14 } }
+
+constexpr int
+foo (int *x)
+{
+ return ++*x;
+}
+
+struct S { constexpr S () : a(0) { foo (&a); foo (&a); } int a; };
+constexpr S s = S ();
+static_assert (s.a == 2, "");
+
+struct R { int *p; };
+
+constexpr int
+bar (R x)
+{
+ return ++*x.p;
+}
+
+struct T { int a = 0; constexpr T () { bar (R{&a}); bar (R{&a}); } };
+constexpr T t = T ();
+static_assert (t.a == 2, "");
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C
new file mode 100644
index 0000000..a249f47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C
@@ -0,0 +1,12 @@
+// PR c++/99859
+// { dg-do compile { target c++14 } }
+
+struct A
+{
+ int i;
+ constexpr int f() { return i; }
+ constexpr A() : i(0) { i = f(); i = 1; i = f(); }
+};
+
+constexpr A a = A();
+static_assert (a.i == 1, "");
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C
new file mode 100644
index 0000000..3c93aa8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C
@@ -0,0 +1,28 @@
+// PR c++/100209
+// { dg-do compile { target c++14 } }
+
+template<typename Derived>
+struct __a_t
+{
+ unsigned char A = 0;
+ constexpr Derived & SetA(const unsigned char & value) {
+ A = value;
+ return *static_cast<Derived *>(this);
+ }
+};
+
+template<typename Derived>
+struct __b_t
+{
+ unsigned char B = 0;
+ constexpr Derived & SetB(const unsigned char & value) {
+ B = value;
+ return *static_cast<Derived *>(this);
+ }
+};
+
+struct __ab_t : __a_t<__ab_t>, __b_t<__ab_t> { };
+
+constexpr auto AB = __ab_t().SetA(100).SetB(10);
+static_assert(AB.A == 100, "");
+static_assert(AB.B == 10, "");
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C
new file mode 100644
index 0000000..d6cb6ad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C
@@ -0,0 +1,23 @@
+// PR c++/100209
+// { dg-do compile { target c++14 } }
+
+struct A {
+ int x = 1;
+};
+
+struct B : A {
+ int y = 2;
+ int z = 3;
+ int w = 4;
+};
+
+constexpr bool f() {
+ B b;
+ if (&b.w - &b.x != 3)
+ /* Effectively disable this test if the layout of B isn't
+ what we expect. */
+ return true;
+ const int* w = &b.w;
+ return *w-- == 4 && *w-- == 3 && *w-- == 2 && *w-- == 1;
+}
+static_assert(f(), "");
diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C
new file mode 100644
index 0000000..239d028
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C
@@ -0,0 +1,5 @@
+// Test digit separators in #line (bug 82359). Test invalid usage.
+// { dg-do preprocess { target c++14 } }
+
+#line 0''123 // { dg-error "is not a positive integer" }
+// { dg-error "adjacent digit separators" "adjacent" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C
new file mode 100644
index 0000000..48846e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C
@@ -0,0 +1,8 @@
+// Test digit separators in #line (bug 82359).
+// { dg-do compile { target c++14 } }
+
+#line 0'123
+static_assert (__LINE__ == 123, "#line with digit separator");
+
+#line 4'56'7'8'9
+static_assert (__LINE__ == 456789, "#line with digit separator");
diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C
new file mode 100644
index 0000000..09393aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C
@@ -0,0 +1,4 @@
+// Test adjacent digit separators rejected in exponent (bug 83873).
+// { dg-do compile { target c++14 } }
+
+double d = 1.0e1''0; /* { dg-error "adjacent digit separators" } */
diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C
index 5343e52..300fe51 100644
--- a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C
+++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C
@@ -16,7 +16,7 @@ main()
unsigned u = 0b0001'0000'0000'0000'0000'0000'U; // { dg-error "digit separator outside digit sequence" }
double d = 0.0;
- d = 1'.602'176'565e-19; // { dg-error "digit separator adjacent to decimal point" }
+ d = 1'.602'176'565e-19; // { dg-warning "multi-character" }
d = 1.'602'176'565e-19; // { dg-error "digit separator adjacent to decimal point" }
d = 1.602''176'565e-19; // { dg-error "adjacent digit separators" }
d = 1.602'176'565'e-19; // { dg-error "digit separator adjacent to exponent" }
@@ -29,4 +29,5 @@ main()
// { dg-error "exponent has no digits" "exponent has no digits" { target *-*-* } 23 }
// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 15 }
+// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 19 }
// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 26 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C
new file mode 100644
index 0000000..41fb967
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C
@@ -0,0 +1,11 @@
+// Test token pasting with digit separators avoided for preprocessed output.
+// { dg-do compile { target c++14 } }
+// { dg-options "-save-temps" }
+
+#define ZERO 0
+
+int
+f ()
+{
+ return ZERO'0'0; /* { dg-error "expected" } */
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C
new file mode 100644
index 0000000..9777382
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C
@@ -0,0 +1,17 @@
+// Test lexing of pp-numbers does not allow digit separators that do
+// not form part of the pp-number syntax, when the code is valid with
+// correct lexing but not with too many characters accepted in the
+// pp-number (bug 97604).
+// { dg-do compile { target c++14 } }
+
+static_assert (0x0'e-0xe == 0, "signs");
+
+#define a0 '.' -
+#define acat(x) a ## x
+static_assert (acat (0'.') == 0, ".");
+
+// This case was not actually buggy.
+#define c0(x) 0
+#define b0 c0 (
+#define bcat(x) b ## x
+static_assert (bcat (0'\u00c0')) == 0, "identifier-nondigit");
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C
new file mode 100644
index 0000000..283c2c9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C
@@ -0,0 +1,25 @@
+// PR c++/100362
+// { dg-do compile { target c++14 } }
+
+template <class>
+struct Qux {
+ struct A { } a_;
+ A f();
+
+ void AsyncOp() {
+ [](auto) {
+ struct local : decltype(a_) {};
+ local ptr;
+ }(0);
+
+ [](auto) {
+ struct local : decltype(f()) {};
+ local ptr;
+ }(0);
+ }
+};
+
+void corge() {
+ Qux<int> qux;
+ qux.AsyncOp();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C
new file mode 100644
index 0000000..b43cbe6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C
@@ -0,0 +1,18 @@
+// PR c++/96311
+// { dg-do compile { target c++14 } }
+// { dg-additional-options -Wunused }
+
+auto foo()
+{
+ constexpr int used = 0;
+ return
+ [](auto unused)
+ {
+ return used;
+ };
+}
+
+int main()
+{
+ foo()(42);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C
new file mode 100644
index 0000000..de15443
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C
@@ -0,0 +1,10 @@
+// PR c++/95317
+// { dg-do compile { target c++14 } }
+
+template <typename> void fn1() {
+ [](auto) {
+ enum { VALUE };
+ VALUE;
+ };
+}
+int main() { fn1<void>; }
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C
new file mode 100644
index 0000000..7498327
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C
@@ -0,0 +1,10 @@
+// PR c++/100054
+// { dg-do compile { target c++14 } }
+
+template <class T>
+void f() {
+ struct A { T m{}; };
+ [](auto){ return A{}; };
+}
+
+template void f<int>();
diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C
new file mode 100644
index 0000000..845e26f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C
@@ -0,0 +1,33 @@
+// PR c++/96673
+// { dg-do compile { target c++11 } }
+
+template <class T>
+class A {};
+
+template <class T>
+class B;
+
+template <class T>
+class C {
+ private:
+
+ friend class B<T>;
+
+ explicit C(A<T>&) {};
+};
+
+
+template <class T>
+class B {
+ public:
+ B() = default;
+ //B() {}; // << This implementation of the constructor makes it work
+
+ A<T> a = {};
+ C<T> c = C<T>{a};
+};
+
+int main() {
+ auto b = B<int>{};
+ auto &c = b.c;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr88872.C b/gcc/testsuite/g++.dg/cpp1y/pr88872.C
new file mode 100644
index 0000000..3719e39
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr88872.C
@@ -0,0 +1,24 @@
+// PR c++/88872
+// { dg-do compile { target c++14 } }
+
+struct a {
+ template <typename b> constexpr a(b) : c() {}
+ int c;
+};
+void d();
+template <char...> constexpr a operator"" _n() { return d; }
+struct e;
+struct f {
+ e operator[](int);
+};
+struct g {
+ void h();
+ f i;
+};
+template <typename> struct j {
+ void k() { [](auto) { constexpr auto l = 2_n; }(keywords); }
+ int keywords;
+};
+using m = j<int>;
+class e : public m {};
+void g::h() { i[0].k(); }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr95226.C b/gcc/testsuite/g++.dg/cpp1y/pr95226.C
new file mode 100644
index 0000000..614c83c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr95226.C
@@ -0,0 +1,17 @@
+// PR c++/95226
+// { dg-do run { target c++14 } }
+
+#include <vector>
+
+struct T {
+ unsigned a;
+ float b {8.};
+};
+
+int main()
+{
+ T t = {1};
+ std::vector<T> tt = {{1}, {2}};
+ if (t.a != 1 || t.b != 8.0f || tt[0].a != 1 || tt[0].b != 8.0f || tt[1].a != 2 || tt[1].b != 8.0f)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction-access1.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access1.C
new file mode 100644
index 0000000..2424abb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access1.C
@@ -0,0 +1,18 @@
+// { dg-do compile { target c++17 } }
+
+template<typename T>
+struct Base
+{
+protected:
+ using type = T;
+};
+
+template<typename T>
+struct Cont : Base<T>
+{
+ using argument_type = typename Base<T>::type;
+
+ Cont(T, argument_type) { }
+};
+
+Cont c(1, 1);
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction-access2.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access2.C
new file mode 100644
index 0000000..87f2031
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access2.C
@@ -0,0 +1,10 @@
+// { dg-do compile { target c++17 } }
+
+struct B {
+protected:
+ struct type {};
+};
+template<typename T> struct D : B {
+ D(T, typename T::type);
+};
+D c = {B(), {}};
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction-access3.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access3.C
new file mode 100644
index 0000000..9df9480
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access3.C
@@ -0,0 +1,20 @@
+// { dg-do compile { target c++17 } }
+
+template<class>
+struct Cont;
+
+template<class T>
+class Base
+{
+ using type = T;
+ friend Cont<T>;
+};
+
+template<class T>
+struct Cont
+{
+ using argument_type = typename Base<T>::type;
+ Cont(T, argument_type);
+};
+
+Cont c(1, 1);
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction84.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction84.C
new file mode 100644
index 0000000..29f25e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction84.C
@@ -0,0 +1,9 @@
+// PR c++/99008
+// { dg-do compile { target c++17 } }
+
+template <class> struct A { A(int = 0); };
+template <class = void> using B = A<int>;
+auto x = B{}; // { dg-error "alias template deduction only available with" "" { target c++17_only } }
+auto y = B(); // { dg-error "alias template deduction only available with" "" { target c++17_only } }
+auto z = B{1}; // { dg-error "alias template deduction only available with" "" { target c++17_only } }
+auto w = B(1); // { dg-error "alias template deduction only available with" "" { target c++17_only } }
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C
new file mode 100644
index 0000000..0b22f8e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C
@@ -0,0 +1,16 @@
+// PR c++/99885
+// { dg-do compile { target c++17 } }
+
+template <auto const& A>
+struct Foo {};
+
+template <auto const& A>
+struct Bar {
+ constexpr auto foo() const -> Foo<A> {
+ return {};
+ }
+};
+
+constexpr int a = 1;
+constexpr Bar<a> bar;
+Foo foo = bar.foo(); // <-- CTAD failure
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction86.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction86.C
new file mode 100644
index 0000000..a198ed2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction86.C
@@ -0,0 +1,16 @@
+// PR c++/87709
+// { dg-do compile { target c++17 } }
+
+template <class T>
+struct lit {
+ lit(T) { }
+};
+
+template <class T>
+int operator+(lit<T>, lit<T>) {
+ return 0;
+}
+
+auto r2 = (lit(0)) + lit(0);
+
+static_assert(sizeof(lit(0)));
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction87.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction87.C
new file mode 100644
index 0000000..37296a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction87.C
@@ -0,0 +1,15 @@
+// PR c++/94102
+// { dg-do compile { target c++17 } }
+
+namespace std {
+ template <typename _Tp> using decay_t = _Tp;
+}
+template <typename... B> struct Merged : B... {
+ template <typename... T> Merged(T... t) : B(t)... {}
+};
+template <typename... T> Merged(T...) -> Merged<std::decay_t<T>...>;
+int main() {
+ auto l1 = [] {};
+ auto l2 = [](int i) { return i; };
+ Merged(l1, l2);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction88.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction88.C
new file mode 100644
index 0000000..be38fed
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction88.C
@@ -0,0 +1,18 @@
+// PR c++/86439
+// { dg-do compile { target c++17 } }
+
+struct NC {
+ NC() = default;
+ NC(NC const&) = delete;
+ NC& operator=(NC const&) = delete;
+};
+
+template <int>
+struct C {
+ C(NC const&);
+};
+
+C(NC) -> C<0>;
+
+NC nc;
+C c(nc);
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction89.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction89.C
new file mode 100644
index 0000000..dd89857
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction89.C
@@ -0,0 +1,15 @@
+// PR c++/86439
+// { dg-do compile { target c++17 } }
+
+struct B { };
+struct C { };
+
+template<class T>
+struct A {
+ A(T, B);
+};
+
+template<class T>
+A(T, C) -> A<T>;
+
+A a(0, {});
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction90.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction90.C
new file mode 100644
index 0000000..8b93193
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction90.C
@@ -0,0 +1,16 @@
+// PR c++/86439
+// { dg-do compile { target c++17 } }
+
+struct less { };
+struct allocator { };
+
+template<class T, class U = less, class V = allocator>
+struct A {
+ A(T, U);
+ A(T, V);
+};
+
+template<class T, class U = less>
+A(T, U) -> A<T>;
+
+A a(0, {}); // { dg-error "ambiguous" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction91.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction91.C
new file mode 100644
index 0000000..f474c8e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction91.C
@@ -0,0 +1,16 @@
+// PR c++/101174
+// { dg-do compile { target c++17 } }
+
+struct S { using type = int; };
+
+template<class T = int, class U = S>
+struct multiset {
+ using type = typename U::type;
+ multiset(T);
+ multiset(U);
+};
+
+template<class T>
+multiset(T) -> multiset<T>;
+
+multiset c(42);
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction92.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction92.C
new file mode 100644
index 0000000..4920ca4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction92.C
@@ -0,0 +1,17 @@
+// PR c++/79501
+// { dg-do compile { target c++17 } }
+
+template<auto V>
+struct X {
+ template<class T, auto>
+ struct B { T t; };
+
+ template<class T> B(T, decltype(V)=V) -> B<const T, V>;
+
+ auto foo() { return B{V}; }
+};
+
+X<42> x;
+using type = decltype(x.foo());
+using type = decltype(decltype(x)::B{42});
+using type = X<42>::B<const int, 42>;
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction93.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction93.C
new file mode 100644
index 0000000..9d2db7a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction93.C
@@ -0,0 +1,25 @@
+// PR c++/79501
+// { dg-do compile { target c++17 } }
+// A variant of class-deduction78.C where List and its deduction guides are
+// defined at class scope.
+
+using size_t = decltype(sizeof(42));
+
+struct A {
+ template<typename T, size_t N = 0>
+ struct List {
+ T head;
+ List<T, N-1> tail;
+ };
+
+ template<typename T>
+ struct List<T, 0> {};
+
+ template<typename T> List(T) -> List<T, 1>;
+ template<typename T, size_t N> List(T, List<T, N>) -> List<T, N+1>;
+};
+
+int main() {
+ using type = decltype(A::List{0, A::List{1, A::List{2}}});
+ using type = A::List<int, 3>;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction94.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction94.C
new file mode 100644
index 0000000..f29ebd2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction94.C
@@ -0,0 +1,19 @@
+// PR c++/79501
+// { dg-do compile { target c++17 } }
+
+struct X {
+protected:
+ template<class T>
+ struct B { T t; };
+
+ template<class T> B(T) -> B<T>;
+};
+
+struct Y {
+protected:
+ template<class T>
+ struct B { T t; };
+
+private:
+ template<class T> B(T) -> B<T>; // { dg-error "access" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction95.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction95.C
new file mode 100644
index 0000000..05cbb2b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction95.C
@@ -0,0 +1,11 @@
+// PR c++/100983
+// { dg-do compile { target c++17 } }
+
+struct X {
+ template<int N>
+ struct Y { template<class... Ts> Y(Ts...); };
+
+ template<class... Ts> Y(Ts...) -> Y<sizeof...(Ts)>;
+};
+
+X::Y y{1,2,3};
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction96.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction96.C
new file mode 100644
index 0000000..7fa8400
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction96.C
@@ -0,0 +1,34 @@
+// PR c++/88252
+// { dg-do compile { target c++17 } }
+
+template<class T>
+struct A {
+ A(T&&);
+ template<class U> A(T&&, U&&);
+ template<class U> struct B;
+};
+
+template<class T>
+A<T>::A(T&&) { }
+
+template<class T>
+template<class U>
+A<T>::A(T&&, U&&) { }
+
+template<class T>
+template<class U>
+struct A<T>::B {
+ B(U&&);
+ template<class V> B(U&&, V&&);
+};
+
+int i;
+
+int main() {
+ A{i}; // { dg-error "deduction|no match|rvalue reference" }
+ A{i, 0}; // { dg-error "deduction|no match|rvalue reference" }
+ A{0, i};
+ A<int>::B{i}; // { dg-error "deduction|no match|rvalue reference" }
+ A<int>::B{i, 0}; // { dg-error "deduction|no match|rvalue reference" }
+ A<int>::B{0, i};
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction97.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction97.C
new file mode 100644
index 0000000..3281868
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction97.C
@@ -0,0 +1,6 @@
+// PR c++/89062
+// { dg-do compile { target c++17 } }
+
+template<class T> struct Foo { Foo(T); };
+
+Foo<int> x(Foo{1});
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction98.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction98.C
new file mode 100644
index 0000000..bee0ce4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction98.C
@@ -0,0 +1,10 @@
+// PR c++/79501
+// { dg-do compile { target c++17 } }
+
+template<class T>
+struct A {
+ template<class U> struct B { template<class V> B(V); };
+ B(T) -> B<T>;
+};
+
+A<int>::B b(0);
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C
new file mode 100644
index 0000000..9940802
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C
@@ -0,0 +1,22 @@
+// PR c++/99201
+// { dg-do compile { target c++17 } }
+
+template <typename RefF>
+ auto
+ make_tester(const RefF& reffun)
+ {
+ return [=](auto in) {
+ auto&& expected = [&](const auto&... vs) {
+ if constexpr (sizeof(in) > 0)
+ return [&](int i) { return reffun(vs[i]...); }(0);
+ else
+ return [&](int i) { return reffun(vs[i]...); }(0);
+ };
+ };
+ }
+
+int main()
+{
+ make_tester([](int x) { return x; })(0);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if35.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if35.C
new file mode 100644
index 0000000..b1248fe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if35.C
@@ -0,0 +1,18 @@
+// PR c++/101764
+// { dg-do compile { target c++17 } }
+
+void g(...);
+
+template<class>
+auto f() {
+ return [](auto... ts) {
+ g([] { if constexpr (sizeof(ts)); }...);
+#if __cpp_concepts
+ g(requires { decltype(ts){0}; }...);
+#endif
+ };
+}
+
+int main() {
+ f<int>()('a', true);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
index d6c8bae..0cdb400 100644
--- a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
@@ -1,5 +1,6 @@
// PR c++/87765
// { dg-do compile { target c++17 } }
+// { dg-additional-options "-fchecking" }
// { dg-ice "cxx_eval_constant_expression" }
template <int N>
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp55.C b/gcc/testsuite/g++.dg/cpp1z/decomp55.C
new file mode 100644
index 0000000..bb4bf75
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp55.C
@@ -0,0 +1,19 @@
+// PR c++/99650
+// { dg-do compile { target c++17 } }
+
+namespace std {
+ template<typename T> struct tuple_size;
+ template<int, typename> struct tuple_element;
+}
+
+struct A {
+ int i;
+ template <int I> void get() { }
+};
+
+template<> struct std::tuple_size<A> { static const int value = 2; };
+template<int I> struct std::tuple_element<I,A> { using type = void; };
+
+A a = { 42 };
+auto [ x, y ] = a; // { dg-error ".std::tuple_element<0, A>::type. is .void." }
+// { dg-message "in initialization of structured binding variable 'x'" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C
new file mode 100644
index 0000000..5b94a8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C
@@ -0,0 +1,8 @@
+// DR 2374
+// { dg-do compile { target c++17 } }
+
+enum class Orange;
+enum class Apple;
+
+extern Orange o;
+Apple a{o}; // { dg-error "cannot convert" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/elide6.C b/gcc/testsuite/g++.dg/cpp1z/elide6.C
new file mode 100644
index 0000000..399e1a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/elide6.C
@@ -0,0 +1,16 @@
+// PR c++/100368
+// { dg-do compile { target c++11 } }
+
+struct A {
+ A() = default;
+ A(const A&) = delete;
+};
+
+struct B { A a; }; // { dg-error "deleted" "" { target c++14_down } }
+
+constexpr B f() { return {}; }
+
+struct C {
+ constexpr C() : b(f()) {} // { dg-error "deleted" "" { target c++14_down } }
+ B b;
+};
diff --git a/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C b/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C
new file mode 100644
index 0000000..b8bae86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C
@@ -0,0 +1,30 @@
+// PR c++/90215
+// { dg-do compile { target c++17 } }
+
+struct X
+{
+ template <class F>
+ void f(F f)
+ {
+ f(0);
+ }
+};
+
+template <class... Xs>
+void bug(Xs... xs)
+{
+ int i;
+
+ [&](auto&... ys)
+ {
+ (xs.f([&](auto)
+ {
+ ys;
+ }), ...);
+ }(i);
+}
+
+int main()
+{
+ bug(X{});
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var9.C b/gcc/testsuite/g++.dg/cpp1z/inline-var9.C
new file mode 100644
index 0000000..43c9748
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/inline-var9.C
@@ -0,0 +1,40 @@
+// PR c++/99901
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler-not "_ZN1A1aE" } }
+// { dg-final { scan-assembler-not "_ZN2A21aE" } }
+// { dg-final { scan-assembler-not "_ZN1CIiE1cE" } }
+// { dg-final { scan-assembler "_ZN1B1bE" } }
+// { dg-final { scan-assembler "_ZN2B21bE" } }
+// { dg-final { scan-assembler "_ZN2B31bE" } }
+
+struct A {
+ static const int a = 5;
+};
+
+struct A2 {
+ static constexpr int a = 5;
+};
+
+struct B {
+ static const int b;
+};
+constexpr int B::b = 5;
+
+struct B2 {
+ static const int b = 5;
+};
+constexpr int B2::b;
+
+struct B3 {
+ static constexpr int b = 5;
+};
+const int B3::b;
+
+template <class T>
+struct C {
+ static constexpr int c = 5;
+};
+template <class T>
+constexpr int C<T>::c;
+
+int i = C<int>::c;
diff --git a/gcc/testsuite/g++.dg/cpp1z/nodiscard8.C b/gcc/testsuite/g++.dg/cpp1z/nodiscard8.C
new file mode 100644
index 0000000..b5096ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/nodiscard8.C
@@ -0,0 +1,15 @@
+// PR c++/100666
+// { dg-do compile { target c++11 } }
+
+[[nodiscard]] decltype(nullptr) bar ();
+extern void foo (...);
+template <typename T> void qux (T);
+
+void
+baz ()
+{
+ foo (bar ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ bar (); // { dg-warning "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ auto x = bar (); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ qux (bar ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/nodiscard9.C b/gcc/testsuite/g++.dg/cpp1z/nodiscard9.C
new file mode 100644
index 0000000..1315ccd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/nodiscard9.C
@@ -0,0 +1,22 @@
+// PR c++/100666
+// { dg-do compile { target c++11 } }
+
+struct S {};
+[[nodiscard]] S bar ();
+struct U { S s; };
+[[nodiscard]] U corge ();
+extern void foo (...);
+template <typename T> void qux (T);
+
+void
+baz ()
+{
+ foo (bar ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ bar (); // { dg-warning "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ auto x = bar (); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ qux (bar ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ foo (corge ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ corge (); // { dg-warning "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ auto y = corge (); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+ qux (corge ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C
new file mode 100644
index 0000000..df16ea7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C
@@ -0,0 +1,22 @@
+// PR c++/90664
+// { dg-do compile { target c++11 } }
+
+template <typename TT, typename MFP, MFP> struct OpM;
+
+template <typename TR, typename TT, TR (TT::*f)()>
+struct OpM<TT, TR (TT::*)(), f>
+{};
+
+class Class {
+public:
+ int address() noexcept { return 0; }
+ void address(int) noexcept {}
+};
+
+struct Sk {
+ template <class C, typename R> Sk(R (C::*p)()) {
+ typedef OpM<C, R (C::*)() /* noexcept */, &Class::address> OP;
+ }
+};
+
+Sk sk(static_cast<int (Class::*)()>(&Class::address));
diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto19.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto19.C
new file mode 100644
index 0000000..d6b904f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto19.C
@@ -0,0 +1,8 @@
+// Verify top-level cv-qualifiers are dropped from the deduced
+// type of a non-type template parameter, as per [temp.param]/6.
+// { dg-do compile { target c++17 } }
+
+constexpr int x = 42;
+template<decltype(auto) V> decltype(V)& f();
+using type = decltype(f<x>());
+using type = int&;
diff --git a/gcc/testsuite/g++.dg/cpp1z/pr81016.C b/gcc/testsuite/g++.dg/cpp1z/pr81016.C
index 358b120..a17afcc 100644
--- a/gcc/testsuite/g++.dg/cpp1z/pr81016.C
+++ b/gcc/testsuite/g++.dg/cpp1z/pr81016.C
@@ -1,4 +1,4 @@
// { dg-do compile { target c++17 } }
template <typename a, a> struct b;
-template <typename c> struct b<bool, c::d>; // { dg-error "template parameter" }
+template <typename c> struct b<bool, c::d>; // { dg-error "not deducible" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/pr99790.C b/gcc/testsuite/g++.dg/cpp1z/pr99790.C
new file mode 100644
index 0000000..99961f5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/pr99790.C
@@ -0,0 +1,9 @@
+// PR c++/99790
+// { dg-do compile { target c++17 } }
+
+struct A;
+struct B { void (*fn) (A *); };
+template <typename T>
+int foo (const T &);
+struct A { int a; static constexpr B b{[] (A *n) { n->*&A::a = 2; }}; };
+int a = foo (A::b);
diff --git a/gcc/testsuite/g++.dg/cpp1z/pr99833.C b/gcc/testsuite/g++.dg/cpp1z/pr99833.C
new file mode 100644
index 0000000..f7c9958
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/pr99833.C
@@ -0,0 +1,11 @@
+// PR c++/99833
+// { dg-do compile { target c++17 } }
+
+struct S { int a, b; };
+template <class>
+void
+foo ()
+{
+ [](auto d) { if constexpr (auto [a, b]{d}; sizeof (a) > 0) a++; } (S{});
+}
+template void foo<S> ();
diff --git a/gcc/testsuite/g++.dg/cpp1z/using9.C b/gcc/testsuite/g++.dg/cpp1z/using9.C
new file mode 100644
index 0000000..98e36ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/using9.C
@@ -0,0 +1,49 @@
+/* { dg-do compile { target c++17 } } */
+// Created for c++ PR19377
+
+class A2
+{
+ protected:
+ int separate(int a);
+ int separate(int a, int b);
+ int separate(int a, int b, int c);
+ int comma(int a);
+ int alone;
+};
+
+class A1
+{
+ protected:
+ int separate();
+ int comma();
+};
+
+class A3
+{
+ protected:
+ int comma(int a, int b);
+};
+
+class B:private A3, private A1, private A2
+{
+ // Using decls in a comma-separated list.
+ using A2::comma, A3::comma, A1::comma; // { dg-message "declared" }
+ // Separate using statements.
+ using A2::separate; // { dg-message "declared" }
+ using A1::separate; // { dg-message "declared" }
+ // No ambiguity, just for the sake of it.
+ using A2::alone; // { dg-message "declared" }
+};
+
+class C:public B
+{
+ void f()
+ {
+ comma(); // { dg-error "private" }
+ separate(); // { dg-error "private" }
+ separate(1); // { dg-error "private" }
+ separate(1, 2); // { dg-error "private" }
+ separate(1, 2, 3); // { dg-error "private" }
+ alone = 5; // { dg-error "private" }
+ }
+};
diff --git a/gcc/testsuite/g++.dg/cpp23/auto-array.C b/gcc/testsuite/g++.dg/cpp23/auto-array.C
new file mode 100644
index 0000000..42f2b0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/auto-array.C
@@ -0,0 +1,36 @@
+// PR c++/100975
+// DR 2397 - auto specifier for pointers and references to arrays
+// { dg-do compile { target c++11 } }
+
+struct false_type { static constexpr bool value = false; };
+struct true_type { static constexpr bool value = true; };
+template<class T, class U>
+struct is_same : false_type {};
+template<class T>
+struct is_same<T, T> : true_type {};
+
+using U = int[3];
+
+void
+g ()
+{
+ int a[3];
+ auto (*p)[3] = &a;
+ auto (&r)[3] = a;
+ int aa[3][3];
+ auto (*pp)[3][3] = &aa;
+ auto (&rr)[3][3] = aa;
+
+ auto (&&rv)[3] = U{};
+
+ static_assert (is_same<decltype (p), int(*)[3]>::value, "");
+ static_assert (is_same<decltype (pp), int(*)[3][3]>::value, "");
+ static_assert (is_same<decltype (r), int(&)[3]>::value, "");
+ static_assert (is_same<decltype (rv), int(&&)[3]>::value, "");
+ static_assert (is_same<decltype (rr), int(&)[3][3]>::value, "");
+
+#if __cplusplus >= 201402L
+ // In a generic lambda parameter this was OK even before.
+ auto l = [](auto (&arr)[5]) { return arr[0]; };
+#endif
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if1.C b/gcc/testsuite/g++.dg/cpp23/consteval-if1.C
new file mode 100644
index 0000000..cff9946
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if1.C
@@ -0,0 +1,103 @@
+// P1938R3
+// { dg-do run { target c++20 } }
+// { dg-options "" }
+
+extern "C" void abort ();
+
+namespace std {
+ constexpr inline bool
+ is_constant_evaluated () noexcept
+ {
+ if consteval { // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
+
+consteval int foo (int x) { return x; }
+consteval int bar () { return 2; }
+
+constexpr int
+baz (int x)
+{
+ int r = 0;
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (x);
+ }
+ else
+ {
+ r += bar ();
+ }
+ if ! consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 2 * bar ();
+ }
+ else
+ {
+ r += foo (8 * x);
+ }
+ if (std::is_constant_evaluated ())
+ r = -r;
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (32 * x);
+ }
+ if not consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 32 * bar ();
+ }
+ return r;
+}
+
+template <typename T>
+constexpr int
+qux (T x)
+{
+ T r = 0;
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (x);
+ }
+ else
+ {
+ r += bar ();
+ }
+ if ! consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 2 * bar ();
+ }
+ else
+ {
+ r += foo (8 * x);
+ }
+ if (std::is_constant_evaluated ())
+ r = -r;
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (32 * x);
+ }
+ if not consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 32 * bar ();
+ }
+ return r;
+}
+
+constexpr int a = baz (1);
+static_assert (a == 23);
+int b = baz (1);
+constexpr int c = qux (1);
+static_assert (c == 23);
+int d = qux<int> (1);
+
+int
+main ()
+{
+ if (b != 23 || d != 23)
+ abort ();
+ if (baz (1) != 70 || qux (1) != 70 || qux (1LL) != 70)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if10.C b/gcc/testsuite/g++.dg/cpp23/consteval-if10.C
new file mode 100644
index 0000000..4c0523f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if10.C
@@ -0,0 +1,36 @@
+// P1938R3
+// { dg-do compile { target c++20 } }
+// { dg-options "" }
+
+consteval int foo (int x) { return x; }
+
+constexpr int
+bar (int x)
+{
+ int r = 0;
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ auto y = [=] { foo (x); }; // { dg-error "'x' is not a constant expression" }
+ y ();
+ }
+ return r;
+}
+
+template <typename T>
+constexpr T
+baz (T x)
+{
+ T r = 0;
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ auto y = [=] { foo (x); }; // { dg-error "'x' is not a constant expression" }
+ y ();
+ }
+ return r;
+}
+
+int
+qux (int x)
+{
+ return baz (x);
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if2.C b/gcc/testsuite/g++.dg/cpp23/consteval-if2.C
new file mode 100644
index 0000000..f7053b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if2.C
@@ -0,0 +1,129 @@
+// P1938R3
+// { dg-do compile { target c++20 } }
+// { dg-options "" }
+
+constexpr bool f()
+{
+ if consteval (true) {} // { dg-error "'if consteval' requires compound statement" }
+ // { dg-error "expected" "" { target *-*-* } .-1 }
+ // { dg-warning "'if consteval' only available with" "" { target c++20_only } .-2 }
+ if not consteval (false) {} // { dg-error "'if consteval' requires compound statement" }
+ // { dg-error "expected" "" { target *-*-* } .-1 }
+ // { dg-warning "'if consteval' only available with" "" { target c++20_only } .-2 }
+ if consteval if (true) {} // { dg-error "'if consteval' requires compound statement" }
+ // { dg-warning "'if consteval' only available with" "" { target c++20_only } .-1 }
+ if ! consteval {} else ; // { dg-error "'if consteval' requires compound statement" }
+ // { dg-warning "'if consteval' only available with" "" { target c++20_only } .-1 }
+ if consteval {} else if (true) {} // { dg-error "'if consteval' requires compound statement" }
+ // { dg-warning "'if consteval' only available with" "" { target c++20_only } .-1 }
+ if (true)
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ }
+ else ; // { dg-error "'if consteval' requires compound statement" }
+ return false;
+}
+
+consteval int foo (int x) { return x; }
+consteval int bar () { return 2; }
+
+constexpr int
+baz (int x)
+{
+ int r = 0;
+ if not consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (x); // { dg-error "'x' is not a constant expression" }
+ }
+ else
+ {
+ r += bar ();
+ }
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 2 * bar ();
+ }
+ else
+ {
+ r += foo (8 * x); // { dg-error "'x' is not a constant expression" }
+ }
+ if ! consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (32 * x);// { dg-error "'x' is not a constant expression" }
+ }
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 32 * bar ();
+ }
+ return r;
+}
+
+template <typename T>
+constexpr int
+qux (int x)
+{
+ int r = 0;
+ if not consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (x); // { dg-error "'x' is not a constant expression" }
+ }
+ else
+ {
+ r += bar ();
+ }
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 2 * bar ();
+ }
+ else
+ {
+ r += foo (8 * x); // { dg-error "is not a constant expression" }
+ }
+ if ! consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (32 * x);// { dg-error "is not a constant expression" }
+ }
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 32 * bar ();
+ }
+ return r;
+}
+
+template <typename T>
+constexpr T
+corge (T x)
+{
+ T r = 0;
+ if not consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (x); // { dg-error "'x' is not a constant expression" }
+ }
+ else
+ {
+ r += bar ();
+ }
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 2 * bar ();
+ }
+ else
+ {
+ r += foo (8 * x); // { dg-error "is not a constant expression" }
+ }
+ if ! consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += foo (32 * x);// { dg-error "is not a constant expression" }
+ }
+ if consteval // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+ {
+ r += 32 * bar ();
+ }
+ return r;
+}
+
+int
+garply (int x)
+{
+ return corge (x);
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if3.C b/gcc/testsuite/g++.dg/cpp23/consteval-if3.C
new file mode 100644
index 0000000..9c7e3aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if3.C
@@ -0,0 +1,73 @@
+// P1938R3
+// { dg-do run { target c++20 } }
+// { dg-options "" }
+
+constexpr inline bool
+is_constant_evaluated () noexcept
+{
+ if consteval { return true; } else { return false; } // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
+}
+
+template<int N> struct X { int v = N; };
+X<is_constant_evaluated ()> x; // type X<true>
+int y = 4;
+int a = is_constant_evaluated () ? y : 1; // initializes a to 1
+int b = is_constant_evaluated () ? 2 : y; // initializes b to 2
+int c = y + (is_constant_evaluated () ? 2 : y); // initializes c to 2*y
+int d = is_constant_evaluated (); // initializes d to 1
+int e = d + is_constant_evaluated (); // initializes e to 1 + 0
+
+struct false_type { static constexpr bool value = false; };
+struct true_type { static constexpr bool value = true; };
+template<class T, class U>
+struct is_same : false_type {};
+template<class T>
+struct is_same<T, T> : true_type {};
+
+constexpr int
+foo (int x)
+{
+ const int n = is_constant_evaluated () ? 13 : 17; // n == 13
+ int m = is_constant_evaluated () ? 13 : 17; // m might be 13 or 17 (see below)
+ char arr[n] = {}; // char[13]
+ return m + sizeof (arr) + x;
+}
+
+constexpr int
+bar ()
+{
+ const int n = is_constant_evaluated() ? 13 : 17;
+ X<n> x1;
+ X<is_constant_evaluated() ? 13 : 17> x2;
+ static_assert (is_same<decltype (x1), decltype (x2)>::value, "x1/x2's type");
+ return x1.v + x2.v;
+}
+
+int p = foo (0); // m == 13; initialized to 26
+int q = p + foo (0); // m == 17 for this call; initialized to 56
+static_assert (bar () == 26, "bar");
+
+struct S { int a, b; };
+
+S s = { is_constant_evaluated () ? 2 : 3, y };
+S t = { is_constant_evaluated () ? 2 : 3, 4 };
+
+static_assert (is_same<decltype (x), X<true> >::value, "x's type");
+
+int
+main ()
+{
+ if (a != 1 || b != 2 || c != 8 || d != 1 || e != 1 || p != 26 || q != 56)
+ __builtin_abort ();
+ if (s.a != 3 || s.b != 4 || t.a != 2 || t.b != 4)
+ __builtin_abort ();
+ if (foo (y) != 34)
+ __builtin_abort ();
+#if __cplusplus >= 201703L
+ if constexpr (foo (0) != 26)
+ __builtin_abort ();
+#endif
+ constexpr int w = foo (0);
+ if (w != 26)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if4.C b/gcc/testsuite/g++.dg/cpp23/consteval-if4.C
new file mode 100644
index 0000000..2760c1c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if4.C
@@ -0,0 +1,44 @@
+// { dg-do compile { target c++20 } }
+// { dg-options "-w" }
+
+void f()
+{
+ goto l; // { dg-message "from here" }
+ if consteval // { dg-message "enters 'consteval if'" }
+ {
+ l:; // { dg-error "jump to label" }
+ }
+}
+
+void g()
+{
+ goto l; // { dg-message "from here" }
+ if not consteval // { dg-message "enters 'consteval if'" }
+ {
+ l:; // { dg-error "jump to label" }
+ }
+}
+
+void h()
+{
+ goto l; // { dg-message "from here" }
+ if consteval // { dg-message "enters 'consteval if'" }
+ {
+ }
+ else
+ {
+ l:; // { dg-error "jump to label" }
+ }
+}
+
+void i()
+{
+ goto l; // { dg-message "from here" }
+ if not consteval // { dg-message "enters 'consteval if'" }
+ {
+ }
+ else
+ {
+ l:; // { dg-error "jump to label" }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if5.C b/gcc/testsuite/g++.dg/cpp23/consteval-if5.C
new file mode 100644
index 0000000..b1c6192
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if5.C
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++20 } }
+// { dg-options "-w" }
+
+void f()
+{
+ if consteval // { dg-message "enters 'consteval if'" }
+ {
+ goto l; // { dg-message "from here" }
+ }
+ else
+ {
+ l:; // { dg-error "jump to label" }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if6.C b/gcc/testsuite/g++.dg/cpp23/consteval-if6.C
new file mode 100644
index 0000000..2b92ccc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if6.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++20 } }
+// { dg-options "-w" }
+
+void f()
+{
+ if consteval
+ {
+ goto l;
+ l:;
+ }
+ else
+ {
+ goto l2;
+ l2:;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if7.C b/gcc/testsuite/g++.dg/cpp23/consteval-if7.C
new file mode 100644
index 0000000..ab9da08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if7.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++20 } }
+// { dg-options "-w" }
+
+void f()
+{
+ if not consteval
+ {
+ l:;
+ goto l;
+ }
+ else
+ {
+ l2:;
+ goto l2;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if8.C b/gcc/testsuite/g++.dg/cpp23/consteval-if8.C
new file mode 100644
index 0000000..36adaf9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if8.C
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++20 } }
+// { dg-options "-w" }
+
+void f()
+{
+ if consteval
+ {
+ l:; // { dg-error "jump to label" }
+ }
+ else
+ {
+ goto l; // { dg-message "from here" }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/consteval-if9.C b/gcc/testsuite/g++.dg/cpp23/consteval-if9.C
new file mode 100644
index 0000000..1c7db1a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/consteval-if9.C
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++20 } }
+// { dg-options "-w" }
+
+constexpr void f(int i)
+{
+ switch (i)
+ if consteval // { dg-message "enters 'consteval if'" }
+ {
+ case 42:; // { dg-error "jump to case label" }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C
index 4a342e9..7070f59 100644
--- a/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C
+++ b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C
@@ -520,13 +520,11 @@
# error "__cpp_constexpr_in_decltype != 201711"
#endif
-/* Not supported fully yet:
#ifndef __cpp_consteval
# error "__cpp_consteval"
#elif __cpp_consteval != 201811
# error "__cpp_consteval != 201811"
#endif
-*/
#ifndef __cpp_concepts
# error "__cpp_concepts"
@@ -547,3 +545,9 @@
#elif __cpp_size_t_suffix != 202011
# error "__cpp_size_t_suffix != 202011"
#endif
+
+#ifndef __cpp_if_consteval
+# error "__cpp_if_consteval"
+#elif __cpp_if_consteval != 202106
+# error "__cpp_if_consteval != 202106"
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C b/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C
new file mode 100644
index 0000000..0cc69be
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C
@@ -0,0 +1,7 @@
+// PR c++/99850
+// P1102R2 - Down with ()!
+// { dg-do compile { target c++23 } }
+
+auto l = []<auto> requires true -> void {};
+template <typename...> concept C = true;
+auto m = []<typename... Ts> requires (C<Ts> && ...) -> void {};
diff --git a/gcc/testsuite/g++.dg/cpp23/mixed-concat1.C b/gcc/testsuite/g++.dg/cpp23/mixed-concat1.C
new file mode 100644
index 0000000..d69fafc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/mixed-concat1.C
@@ -0,0 +1,21 @@
+// Test from P2201R1
+// { dg-do compile { target c++11 } }
+
+void f() {
+
+ { auto a = L"" u""; } // { dg-error "concatenation" }
+ { auto a = L"" u8""; } // { dg-error "concatenation" }
+ { auto a = L"" U""; } // { dg-error "concatenation" }
+
+ { auto a = u8"" L""; } // { dg-error "concatenation" }
+ { auto a = u8"" u""; } // { dg-error "concatenation" }
+ { auto a = u8"" U""; } // { dg-error "concatenation" }
+
+ { auto a = u"" L""; } // { dg-error "concatenation" }
+ { auto a = u"" u8""; } // { dg-error "concatenation" }
+ { auto a = u"" U""; } // { dg-error "concatenation" }
+
+ { auto a = U"" L""; } // { dg-error "concatenation" }
+ { auto a = U"" u""; } // { dg-error "concatenation" }
+ { auto a = U"" u8""; } // { dg-error "concatenation" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/narrowing-bool1.C b/gcc/testsuite/g++.dg/cpp23/narrowing-bool1.C
new file mode 100644
index 0000000..54906c9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/narrowing-bool1.C
@@ -0,0 +1,22 @@
+// P1401R5: Narrowing contextual conversions to bool
+// { dg-do compile { target c++11 } }
+
+void f() noexcept(sizeof(char[2])); // { dg-error "narrowing" } conversion of value 2 to type bool
+void g() noexcept(sizeof(char)); // OK, conversion of value 1 to type bool is non-narrowing
+
+#if __cpp_conditional_explicit
+struct S {
+ explicit(sizeof(char[2])) S(char); // { dg-error "narrowing" "" { target c++20 } }
+ explicit(sizeof(char)) S(bool); // OK, conversion of value 1 to type bool is non-narrowing
+};
+#endif
+
+static_assert(sizeof(int[2]), ""); // OK, narrowing allowed
+
+#if __cpp_if_constexpr
+int main()
+{
+ if constexpr (sizeof(int[2])) // OK, narrowing allowed
+ {}
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize1.C b/gcc/testsuite/g++.dg/cpp23/normalize1.C
new file mode 100644
index 0000000..8357ed3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/normalize1.C
@@ -0,0 +1,66 @@
+// { dg-do preprocess { target { c++11 && { ! c++23 } } } }
+// { dg-options "" }
+
+\u00AA
+\u00B7
+\u0F43 // { dg-warning "not in NFC" }
+a\u05B8\u05B9\u05B9\u05BBb
+ a\u05BB\u05B9\u05B8\u05B9b // { dg-warning "not in NFC" }
+\u09CB
+\u09C7\u09BE // { dg-warning "not in NFC" }
+\u0B4B
+\u0B47\u0B3E // { dg-warning "not in NFC" }
+\u0BCA
+\u0BC6\u0BBE // { dg-warning "not in NFC" }
+\u0BCB
+\u0BC7\u0BBE // { dg-warning "not in NFC" }
+\u0CCA
+\u0CC6\u0CC2 // { dg-warning "not in NFC" }
+\u0D4A
+\u0D46\u0D3E // { dg-warning "not in NFC" }
+\u0D4B
+\u0D47\u0D3E // { dg-warning "not in NFC" }
+
+K
+\u212A // { dg-warning "not in NFC" }
+
+\u03AC
+\u1F71 // { dg-warning "not in NFC" }
+
+\uAC00
+\u1100\u1161 // { dg-warning "not in NFC" }
+\uAC01
+\u1100\u1161\u11A8 // { dg-warning "not in NFC" }
+\uAC00\u11A8 // { dg-warning "not in NFC" }
+
+གྷ // { dg-warning "not in NFC" }
+aָֹֹֻb
+ aָֹֹֻb // { dg-warning "not in NFC" }
+ো
+ো // { dg-warning "not in NFC" }
+ୋ
+ୋ // { dg-warning "not in NFC" }
+ொ
+ொ // { dg-warning "not in NFC" }
+ோ
+ோ // { dg-warning "not in NFC" }
+ೊ
+ೊ // { dg-warning "not in NFC" }
+ൊ
+ൊ // { dg-warning "not in NFC" }
+ോ
+ോ // { dg-warning "not in NFC" }
+
+K
+K // { dg-warning "not in NFC" }
+
+ά // { dg-warning "not in NFC" }
+
+가
+가 // { dg-warning "not in NFC" }
+각
+각 // { dg-warning "not in NFC" }
+각 // { dg-warning "not in NFC" }
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize2.C b/gcc/testsuite/g++.dg/cpp23/normalize2.C
new file mode 100644
index 0000000..ad14e64
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/normalize2.C
@@ -0,0 +1,66 @@
+// { dg-do preprocess { target { c++23 } } }
+// { dg-options "" }
+
+\u00AA
+\u00B7
+\u0F43 // { dg-warning "not in NFC" }
+a\u05B8\u05B9\u05B9\u05BBb
+ a\u05BB\u05B9\u05B8\u05B9b // { dg-warning "not in NFC" }
+\u09CB
+\u09C7\u09BE // { dg-warning "not in NFC" }
+\u0B4B
+\u0B47\u0B3E // { dg-warning "not in NFC" }
+\u0BCA
+\u0BC6\u0BBE // { dg-warning "not in NFC" }
+\u0BCB
+\u0BC7\u0BBE // { dg-warning "not in NFC" }
+\u0CCA
+\u0CC6\u0CC2 // { dg-warning "not in NFC" }
+\u0D4A
+\u0D46\u0D3E // { dg-warning "not in NFC" }
+\u0D4B
+\u0D47\u0D3E // { dg-warning "not in NFC" }
+
+K
+\u212A // { dg-warning "not in NFC" }
+
+\u03AC
+\u1F71 // { dg-warning "not in NFC" }
+
+\uAC00
+\u1100\u1161 // { dg-warning "not in NFC" }
+\uAC01
+\u1100\u1161\u11A8 // { dg-warning "not in NFC" }
+\uAC00\u11A8 // { dg-warning "not in NFC" }
+
+གྷ // { dg-warning "not in NFC" }
+aָֹֹֻb
+ aָֹֹֻb // { dg-warning "not in NFC" }
+ো
+ো // { dg-warning "not in NFC" }
+ୋ
+ୋ // { dg-warning "not in NFC" }
+ொ
+ொ // { dg-warning "not in NFC" }
+ோ
+ோ // { dg-warning "not in NFC" }
+ೊ
+ೊ // { dg-warning "not in NFC" }
+ൊ
+ൊ // { dg-warning "not in NFC" }
+ോ
+ോ // { dg-warning "not in NFC" }
+
+K
+K // { dg-warning "not in NFC" }
+
+ά // { dg-warning "not in NFC" }
+
+가
+가 // { dg-warning "not in NFC" }
+각
+각 // { dg-warning "not in NFC" }
+각 // { dg-warning "not in NFC" }
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize3.C b/gcc/testsuite/g++.dg/cpp23/normalize3.C
new file mode 100644
index 0000000..bf4bb3a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/normalize3.C
@@ -0,0 +1,80 @@
+// { dg-do preprocess { target { c++23 } } }
+// { dg-options "-pedantic-errors" }
+
+\u00AA
+\u00B7 // { dg-error "is not valid at the start of an identifier" }
+\u0F43 // { dg-error "not in NFC" }
+a\u05B8\u05B9\u05B9\u05BBb
+ a\u05BB\u05B9\u05B8\u05B9b // { dg-error "not in NFC" }
+\u09CB // { dg-error "is not valid at the start of an identifier" }
+\u09C7\u09BE // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+\u0B4B // { dg-error "is not valid at the start of an identifier" }
+\u0B47\u0B3E // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+\u0BCA // { dg-error "is not valid at the start of an identifier" }
+\u0BC6\u0BBE // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+\u0BCB // { dg-error "is not valid at the start of an identifier" }
+\u0BC7\u0BBE // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+\u0CCA // { dg-error "is not valid at the start of an identifier" }
+\u0CC6\u0CC2 // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+\u0D4A // { dg-error "is not valid at the start of an identifier" }
+\u0D46\u0D3E // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+\u0D4B // { dg-error "is not valid at the start of an identifier" }
+\u0D47\u0D3E // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+
+K
+\u212A // { dg-error "not in NFC" }
+
+\u03AC
+\u1F71 // { dg-error "not in NFC" }
+
+\uAC00
+\u1100\u1161 // { dg-error "not in NFC" }
+\uAC01
+\u1100\u1161\u11A8 // { dg-error "not in NFC" }
+\uAC00\u11A8 // { dg-error "not in NFC" }
+
+· // { dg-error "is not valid at the start of an identifier" }
+གྷ // { dg-error "not in NFC" }
+aָֹֹֻb
+ aָֹֹֻb // { dg-error "not in NFC" }
+ো // { dg-error "is not valid at the start of an identifier" }
+ো // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+ୋ // { dg-error "is not valid at the start of an identifier" }
+ୋ // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+ொ // { dg-error "is not valid at the start of an identifier" }
+ொ // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+ோ // { dg-error "is not valid at the start of an identifier" }
+ோ // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+ೊ // { dg-error "is not valid at the start of an identifier" }
+ೊ // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+ൊ // { dg-error "is not valid at the start of an identifier" }
+ൊ // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+ോ // { dg-error "is not valid at the start of an identifier" }
+ോ // { dg-error "not in NFC" }
+ // { dg-error "is not valid at the start of an identifier" "" { target *-*-* } .-1 }
+
+K
+K // { dg-error "not in NFC" }
+
+ά // { dg-error "not in NFC" }
+
+가
+가 // { dg-error "not in NFC" }
+각
+각 // { dg-error "not in NFC" }
+각 // { dg-error "not in NFC" }
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize4.C b/gcc/testsuite/g++.dg/cpp23/normalize4.C
new file mode 100644
index 0000000..9f83cd7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/normalize4.C
@@ -0,0 +1,66 @@
+// { dg-do preprocess { target { c++23 } } }
+// { dg-options "" }
+
+\u00AA
+x\u00B7
+\u0F43 // { dg-warning "not in NFC" }
+a\u05B8\u05B9\u05B9\u05BBb
+ a\u05BB\u05B9\u05B8\u05B9b // { dg-warning "not in NFC" }
+x\u09CB
+x\u09C7\u09BE // { dg-warning "not in NFC" }
+x\u0B4B
+x\u0B47\u0B3E // { dg-warning "not in NFC" }
+x\u0BCA
+x\u0BC6\u0BBE // { dg-warning "not in NFC" }
+x\u0BCB
+x\u0BC7\u0BBE // { dg-warning "not in NFC" }
+x\u0CCA
+x\u0CC6\u0CC2 // { dg-warning "not in NFC" }
+x\u0D4A
+x\u0D46\u0D3E // { dg-warning "not in NFC" }
+x\u0D4B
+x\u0D47\u0D3E // { dg-warning "not in NFC" }
+
+K
+\u212A // { dg-warning "not in NFC" }
+
+\u03AC
+\u1F71 // { dg-warning "not in NFC" }
+
+\uAC00
+\u1100\u1161 // { dg-warning "not in NFC" }
+\uAC01
+\u1100\u1161\u11A8 // { dg-warning "not in NFC" }
+\uAC00\u11A8 // { dg-warning "not in NFC" }
+
+x·
+གྷ // { dg-warning "not in NFC" }
+aָֹֹֻb
+ aָֹֹֻb // { dg-warning "not in NFC" }
+xো
+xো // { dg-warning "not in NFC" }
+xୋ
+xୋ // { dg-warning "not in NFC" }
+xொ
+xொ // { dg-warning "not in NFC" }
+xோ
+xோ // { dg-warning "not in NFC" }
+xೊ
+xೊ // { dg-warning "not in NFC" }
+xൊ
+xൊ // { dg-warning "not in NFC" }
+xോ
+xോ // { dg-warning "not in NFC" }
+
+K
+K // { dg-warning "not in NFC" }
+
+ά // { dg-warning "not in NFC" }
+
+가
+가 // { dg-warning "not in NFC" }
+각
+각 // { dg-warning "not in NFC" }
+각 // { dg-warning "not in NFC" }
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize5.C b/gcc/testsuite/g++.dg/cpp23/normalize5.C
new file mode 100644
index 0000000..afe339a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/normalize5.C
@@ -0,0 +1,66 @@
+// { dg-do preprocess { target { c++23 } } }
+// { dg-options "-pedantic-errors" }
+
+\u00AA
+x\u00B7
+\u0F43 // { dg-error "not in NFC" }
+a\u05B8\u05B9\u05B9\u05BBb
+ a\u05BB\u05B9\u05B8\u05B9b // { dg-error "not in NFC" }
+x\u09CB
+x\u09C7\u09BE // { dg-error "not in NFC" }
+x\u0B4B
+x\u0B47\u0B3E // { dg-error "not in NFC" }
+x\u0BCA
+x\u0BC6\u0BBE // { dg-error "not in NFC" }
+x\u0BCB
+x\u0BC7\u0BBE // { dg-error "not in NFC" }
+x\u0CCA
+x\u0CC6\u0CC2 // { dg-error "not in NFC" }
+x\u0D4A
+x\u0D46\u0D3E // { dg-error "not in NFC" }
+x\u0D4B
+x\u0D47\u0D3E // { dg-error "not in NFC" }
+
+K
+\u212A // { dg-error "not in NFC" }
+
+\u03AC
+\u1F71 // { dg-error "not in NFC" }
+
+\uAC00
+\u1100\u1161 // { dg-error "not in NFC" }
+\uAC01
+\u1100\u1161\u11A8 // { dg-error "not in NFC" }
+\uAC00\u11A8 // { dg-error "not in NFC" }
+
+x·
+གྷ // { dg-error "not in NFC" }
+aָֹֹֻb
+ aָֹֹֻb // { dg-error "not in NFC" }
+xো
+xো // { dg-error "not in NFC" }
+xୋ
+xୋ // { dg-error "not in NFC" }
+xொ
+xொ // { dg-error "not in NFC" }
+xோ
+xோ // { dg-error "not in NFC" }
+xೊ
+xೊ // { dg-error "not in NFC" }
+xൊ
+xൊ // { dg-error "not in NFC" }
+xോ
+xോ // { dg-error "not in NFC" }
+
+K
+K // { dg-error "not in NFC" }
+
+ά // { dg-error "not in NFC" }
+
+가
+가 // { dg-error "not in NFC" }
+각
+각 // { dg-error "not in NFC" }
+각 // { dg-error "not in NFC" }
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize6.C b/gcc/testsuite/g++.dg/cpp23/normalize6.C
new file mode 100644
index 0000000..4c2b141
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/normalize6.C
@@ -0,0 +1,10 @@
+// P1949R7
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+constexpr int À = 1; // U+00C0
+constexpr int À = 2; // U+0041 U+0300 { dg-warning "is not in NFC" }
+constexpr int gv1 = \u00c0;
+constexpr int gv2 = A\u0300; // { dg-warning "is not in NFC" }
+static_assert(gv1 == 1, "");
+static_assert(gv2 == 2, "");
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize7.C b/gcc/testsuite/g++.dg/cpp23/normalize7.C
new file mode 100644
index 0000000..f639d65
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/normalize7.C
@@ -0,0 +1,12 @@
+// P1949R7
+// { dg-do compile { target c++11 } }
+// { dg-options "-pedantic-errors" }
+
+constexpr int À = 1; // U+00C0
+constexpr int À = 2; // U+0041 U+0300 { dg-warning "is not in NFC" "" { target { ! c++23 } } }
+// { dg-error "is not in NFC" "" { target c++23 } .-1 }
+constexpr int gv1 = \u00c0;
+constexpr int gv2 = A\u0300; // { dg-warning "is not in NFC" "" { target { ! c++23 } } }
+// { dg-error "is not in NFC" "" { target c++23 } .-1 }
+static_assert(gv1 == 1, "");
+static_assert(gv2 == 2, "");
diff --git a/gcc/testsuite/g++.dg/cpp23/ucnid-1-utf8.C b/gcc/testsuite/g++.dg/cpp23/ucnid-1-utf8.C
new file mode 100644
index 0000000..61acc82
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/ucnid-1-utf8.C
@@ -0,0 +1,18 @@
+// P1949R7
+// { dg-do compile }
+// { dg-options "" }
+
+bool 👷 = true;
+bool 👷‍♀ = false; // { dg-error "is not valid in an identifier" }
+int ⏰ = 0; // { dg-error "is not valid in an identifier" }
+int 🕐 = 0;
+int ☠ = 0; // { dg-error "is not valid in an identifier" }
+int 💀 = 0;
+int ✋ = 0; // { dg-error "is not valid in an identifier" }
+int 👊 = 0;
+int ✈ = 0; // { dg-error "is not valid in an identifier" }
+int 🚀 = 0;
+int ☹ = 0; // { dg-error "is not valid in an identifier" }
+int 😀 = 0;
+struct E {};
+class 💩 : public E {};
diff --git a/gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C b/gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C
new file mode 100644
index 0000000..6c8aa6a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C
@@ -0,0 +1,18 @@
+// P1949R7
+// { dg-do compile }
+// { dg-options "-pedantic-errors" }
+
+bool 👷 = true; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+bool 👷‍♀ = false; // { dg-error "is not valid in an identifier" }
+int ⏰ = 0; // { dg-error "is not valid in an identifier" }
+int 🕐 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int ☠ = 0; // { dg-error "is not valid in an identifier" }
+int 💀 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int ✋ = 0; // { dg-error "is not valid in an identifier" }
+int 👊 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int ✈ = 0; // { dg-error "is not valid in an identifier" }
+int 🚀 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int ☹ = 0; // { dg-error "is not valid in an identifier" }
+int 😀 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+struct E {};
+class 💩 : public E {}; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
diff --git a/gcc/testsuite/g++.dg/cpp23/whitespace-splice1.C b/gcc/testsuite/g++.dg/cpp23/whitespace-splice1.C
new file mode 100644
index 0000000..f115ce0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/whitespace-splice1.C
@@ -0,0 +1,15 @@
+// Tests from P2223R2
+// { dg-additional-options -w }
+// { dg-do compile { target c++11 } }
+
+constexpr auto str = "\
+";
+
+static_assert(__builtin_strlen(str) == 0, "");
+
+constexpr int i = 1
+ // \
+ + 42
+ ;
+
+static_assert(i == 1, "");
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr11.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr11.C
new file mode 100644
index 0000000..c4806de
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr11.C
@@ -0,0 +1,29 @@
+// PR c++/101344
+// { dg-do compile { target c++20 } }
+
+template<class T=void>
+struct A { int m; int t[2]; };
+
+A a1{1, {2, 3}}; // previously rejected
+A a2{1, 2, 3};
+
+struct B { int x, y; };
+
+template<class T=void>
+struct C { int m; struct { int x, y; } t; };
+
+A b1{1, {2, 3}}; // previously rejected
+A b2{1, 2, 3};
+
+template<class T>
+struct D { T t[2]; };
+
+D d1{1, 2};
+D d2{{1, 2}}; // previously rejected
+
+template<class T>
+struct E { T t[2][2]; };
+
+E e1{1, 2, 3, 4};
+E e2{{{1, 2}, {3, 4}}}; // previously rejected
+E e3{{1, 2, 3, 4}}; // { dg-error "deduction|no match" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C
new file mode 100644
index 0000000..3e330ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C
@@ -0,0 +1,15 @@
+// PR c++/101803
+// { dg-do compile { target c++20 } }
+
+struct Inner { int i = 0; };
+
+template <typename T = void>
+struct Outer { Inner s{}; };
+
+Outer o1{ .s = {} }; // works
+Outer o2{ .s = Inner{ .i = 1} }; // works
+Outer o3{ .s = { .i = 1} }; // does not
+
+Outer o4{ .s{} }; // works
+Outer o5{ .s{Inner{ .i = 1} } }; // works
+Outer o6{ .s{ .i = 1} }; // does not
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C
new file mode 100644
index 0000000..a473fff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C
@@ -0,0 +1,10 @@
+// PR c++/101233
+// { dg-do compile { target c++20 } }
+
+template<class T, class U>
+struct A { A(T, U); };
+
+template<class T, class U>
+using B = A<U, T>;
+
+using type = decltype(B{0, 0});
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C
new file mode 100644
index 0000000..69143a3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C
@@ -0,0 +1,18 @@
+// PR c++/99180
+// { dg-do compile { target c++17 } }
+
+template <bool, typename... Ts>
+struct A {
+ A(Ts...) {}
+};
+
+template <typename... Ts>
+using B = A<false, Ts...>;
+
+template <typename... Ts>
+A(Ts...) -> A<true, Ts...>;
+
+int main() {
+ B{}; // { dg-error "alias" "" { target c++17_down } }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C
new file mode 100644
index 0000000..26a38641
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C
@@ -0,0 +1,11 @@
+// PR c++/93295
+// { dg-do compile { target c++20 } }
+
+template<typename T, bool B = false>
+struct Foo {
+ Foo(T) {}
+};
+
+template<typename T> Foo(T) -> Foo<T>;
+template<typename T> using Bar = Foo<T, true>;
+Bar b{0};
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C
new file mode 100644
index 0000000..0d8bff7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C
@@ -0,0 +1,32 @@
+// PR c++/93867
+// { dg-do compile { target c++20 } }
+
+template <typename CharT, unsigned N>
+struct basic_fixed_string
+{
+ constexpr basic_fixed_string(const CharT *p) {
+ for (int i = 0; i < N; ++i) {
+ m_data[i] = p[i];
+ }
+ }
+
+ CharT m_data[N] {};
+};
+
+template <typename CharT, unsigned N>
+basic_fixed_string(const CharT (&)[N]) -> basic_fixed_string<CharT,N>;
+
+template <unsigned N>
+using fixed_string = basic_fixed_string<char, N>;
+
+template <fixed_string path>
+constexpr int foo()
+{
+ return 42;
+}
+
+int main(int argc, char const *argv[])
+{
+ foo<"hello">();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C
new file mode 100644
index 0000000..ec005956
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C
@@ -0,0 +1,14 @@
+// PR c++/95486
+// { dg-do compile { target c++20 } }
+
+template<class T, class U>
+struct X { X(U) requires __is_same(U, int) {} };
+
+template<class U>
+X(U) -> X<char, U>;
+
+template<class U>
+using Y = X<void, U>;
+
+Y y{1};
+Y z{'a'}; // { dg-error "failed|no match" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias9.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias9.C
new file mode 100644
index 0000000..5cc7b7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias9.C
@@ -0,0 +1,6 @@
+// PR c++/98832
+// { dg-do compile { target c++20 } }
+
+template<class T, class U> struct X { U u; };
+template<class T> using Y = X<int, T>;
+Y y{0};
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-access2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-access2.C
new file mode 100644
index 0000000..8ddcad2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-access2.C
@@ -0,0 +1,13 @@
+// { dg-do compile { target concepts } }
+
+template<class T> requires T::value struct A { };
+template<class T> requires T::value struct B { }; // { dg-error "private" }
+
+struct S {
+private:
+ static constexpr bool value = true;
+ template<class T> requires T::value friend struct A;
+};
+
+A<S> x;
+B<S> y; // { dg-error "constraint" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C
new file mode 100644
index 0000000..3546b74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C
@@ -0,0 +1,16 @@
+// PR c++/97679
+// { dg-do compile { target c++20 } }
+
+template <bool V> struct A {
+ template <class T> struct B {
+ B(T) requires V;
+ template <class U> B(T, U) requires V || (__is_same(T, char) && __is_same(U, int));
+ };
+};
+
+A<true>::B x1(0);
+A<false>::B x2(0); // { dg-error "deduction|no match" }
+
+A<true>::B y1(0, '0');
+A<false>::B y2(0, '0'); // { dg-error "deduction|no match" }
+A<false>::B y3('0', 0);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C
new file mode 100644
index 0000000..4f04cb3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C
@@ -0,0 +1,25 @@
+// PR c++/100138
+// { dg-do compile { target c++20 } }
+
+template <class T>
+struct A {
+ A(T, auto... xs) requires (sizeof...(xs) != 0);
+};
+
+constexpr bool f(...) { return true; }
+
+template <class T>
+struct B {
+ B(T, auto... xs) requires (f(xs...)); // { dg-error "constant expression" }
+};
+
+template <class T>
+struct C {
+ C(T, auto x) requires (f(x)); // { dg-error "constant expression" }
+};
+
+int main() {
+ A x{1, 2}; // { dg-bogus "" }
+ B y{1, 2}; // { dg-error "deduction|no match" }
+ C z{1, 2}; // { dg-error "deduction|no match" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-decltype.C b/gcc/testsuite/g++.dg/cpp2a/concepts-decltype.C
index 13733c6..b375f74 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-decltype.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-decltype.C
@@ -61,7 +61,7 @@ constexpr int Z = 10;
static_assert(deduced_as<0, int>);
static_assert(deduced_as<0, int&>); // { dg-error "invalid variable template" }
-static_assert(deduced_as<Z, const int>);
+static_assert(deduced_as<Z, int>);
static_assert(deduced_as<(Z), const int>); // { dg-error "invalid variable template" }
static_assert(deduced_as<(Z), const int&>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-err3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-err3.C
new file mode 100644
index 0000000..9427fd5c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-err3.C
@@ -0,0 +1,4 @@
+// PR c++/99500
+// { dg-do compile { target c++20 } }
+
+bool b = requires (bool a, int a) { requires true; }; // { dg-error "conflicting declaration" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda14.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda14.C
index bdc893d..02b6b6a 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda14.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda14.C
@@ -11,9 +11,9 @@ void foo() noexcept(!__is_same(T, void)) { }
template<typename U>
auto f() {
- return []<typename T>(T, bool a = requires { C<T>; }){
+ return []<typename T>(T, bool a = requires { C<T>; }){ // { dg-warning Wmissing-requires }
static_assert(requires { requires C<U> && (C<T> || C<T>); }); // { dg-error "assert" }
- static_assert(requires { C<T>; });
+ static_assert(requires { C<T>; }); // { dg-warning Wmissing-requires }
static_assert(requires { { foo<T>() } noexcept -> C; });
static_assert(!requires { typename T::blah; }); // { dg-error "assert" }
return 0;
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C
new file mode 100644
index 0000000..01fda6e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C
@@ -0,0 +1,61 @@
+// PR c++/99874
+// { dg-do compile { target c++20 } }
+
+template <class T>
+struct A {
+ static inline auto a = [] <class U> (U) {
+ return [] <class V> (V) requires requires (T t, U u, V v) { t + u + v; } { };
+ };
+
+ template <class W>
+ static inline auto b = [] <class U> (U) {
+ return [] <class V> (V) requires requires (T t, U u, V v, W w) { t + u + v + w; } { };
+ };
+
+ static auto f() {
+ return [] <class U> (U) {
+ return [] <class V> (V) requires requires (T t, U u, V v) { t + u + v; } { };
+ };
+ }
+
+ template <class W>
+ static auto g() {
+ return [] <class U> (U) {
+ return [] <class V> (V) requires requires (T t, U u, V v, W w) { t + u + v + w; } { };
+ };
+ }
+};
+
+template <class T>
+auto a = [] <class U> (U) {
+ return [] <class V> (V) requires requires (T t, U u, V v) { t + u + v; } { };
+};
+
+template <class T>
+auto b = [] <class U> (U) {
+ return [] <class V> (V) {
+ return [] {
+ return [] () requires requires (T t, U u, V v) { t + u + v; } { };
+ };
+ };
+};
+
+int main() {
+ A<int>::a(0)(0);
+ A<int>::a(0)(nullptr); // { dg-error "no match" }
+
+ A<int>::b<int>(0)(0);
+ A<int>::b<int>(0)(nullptr); // { dg-error "no match" }
+
+ A<int>::f()(0)(0);
+ A<int>::f()(0)(nullptr); // { dg-error "no match" }
+
+ A<int>::g<int>()(0)(0);
+ A<int>::g<int>()(0)(nullptr); // { dg-error "no match" }
+
+ a<int>(0)(0);
+ a<int>(0)(nullptr); // { dg-error "no match" }
+
+ b<int>(0)(0)();
+ b<int>(0)(nullptr)()(); // { dg-error "no match" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C
new file mode 100644
index 0000000..32ae1e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++20 } }
+
+template<class T>
+struct A { static const bool value = T::value; };
+
+template<class T>
+void f() {
+ // Verify we don't substitute into a lambda's constraints when
+ // regenerating it, which would lead to a hard error here.
+ [] () requires (T::value && A<T>::value) || true { }();
+ [] <class U> (U) requires (U::value && A<T>::value) || true { }(0);
+}
+
+template void f<int>();
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C
new file mode 100644
index 0000000..f990ae1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C
@@ -0,0 +1,28 @@
+// PR c++/101247
+// { dg-do compile { target concepts } }
+// A variant of concepts-memtmpl3.C where f is defined outside A's definition.
+
+template <typename> struct A {
+ template <typename c> static constexpr bool d = true;
+ struct B;
+ template <typename> struct C;
+};
+
+template <typename a>
+struct A<a>::B {
+ template <typename c> static void f(c) requires d<c>;
+};
+
+template <typename a>
+template <typename b>
+struct A<a>::C {
+ template <typename c> static void f(c) requires d<c>;
+ static void g() requires d<b>;
+};
+
+int main()
+{
+ A<void>::B::f(0);
+ A<void>::C<int>::f(0);
+ A<void>::C<int>::g();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C
new file mode 100644
index 0000000..3c83bb8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C
@@ -0,0 +1,11 @@
+// PR c++/101247
+// { dg-do compile { target concepts } }
+
+template<class T, class U> struct A {
+ template<class> static constexpr bool d = true;
+ static void g() requires d<U>;
+};
+
+int main() {
+ A<int, char>::g();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C
new file mode 100644
index 0000000..458f1cd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C
@@ -0,0 +1,15 @@
+// PR c++/101247
+// { dg-do compile { target concepts } }
+// A variant of concepts-memtmpl5.C that uses a partial specialization
+// of A instead of the primary template.
+
+template<class, class> struct A;
+
+template<class T, class U> requires true struct A<T, U> {
+ template<class V> static constexpr bool d = true;
+ static void g() requires d<U>;
+};
+
+int main() {
+ A<int, char>::g();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C
new file mode 100644
index 0000000..eaea41a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C
@@ -0,0 +1,32 @@
+// PR c++/99815
+// { dg-do compile { target c++20 } }
+
+template <class T, class U>
+struct is_same { static constexpr bool value = false; };
+
+template <class T>
+struct is_same<T, T> { static constexpr bool value = true; };
+
+template <class... Ts>
+concept C = is_same<Ts...>::value; // { dg-error "wrong number" }
+
+template <class... Ts> void f() {
+ C<Ts...> auto x = 0; // { dg-error "constraints" }
+}
+
+template void f<int>(); // { dg-bogus "" }
+template void f<char>(); // { dg-message "required from here" }
+template void f<>(); // { dg-message "required from here" }
+template void f<int, int>(); // { dg-message "required from here" }
+
+template <class... Ts> void g() {
+ C<Ts..., int> auto x = 0; // { dg-error "constraints" }
+}
+
+template void g<>(); // { dg-bogus "" }
+template void g<int>(); // { dg-message "required from here" }
+
+template <class> void h() {
+ C<char> auto x = 0; // { dg-error "constraints" }
+ C<int> auto y = 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C
new file mode 100644
index 0000000..fe1e392
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C
@@ -0,0 +1,10 @@
+// PR c++/99869
+// { dg-do compile { target c++20 } }
+
+template <class T, class U> concept same_as = __is_same(T, U);
+
+template <class>
+void f() {
+ for (same_as<int> auto c : "") {} // { dg-error "constraint" }
+ for (same_as<char> auto c : "") {}
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C
new file mode 100644
index 0000000..93219ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C
@@ -0,0 +1,32 @@
+// PR c++/99899
+// { dg-do compile { target c++20 } }
+
+template <class T> concept C1 = sizeof(T) > sizeof(int[1]);
+
+template <class>
+void f() {
+ int x[] = {1,2};
+ int y[] = {3};
+ C1 auto [a,b] = x;
+ C1 auto [c] = y; // { dg-error "constraints" }
+}
+
+template <class T>
+void g() {
+ T x[] = {1,2};
+ T y[] = {3};
+ C1 auto [a,b] = x;
+ C1 auto [c] = y; // { dg-error "constraints" }
+}
+template void g<int>();
+
+
+template <class... Ts> concept C2 = sizeof...(Ts) > 1;
+
+struct S { int a, b; } s;
+
+template <class T>
+void h() {
+ const C2<T> auto& [a, b] = s;
+}
+template void h<int>();
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C
new file mode 100644
index 0000000..e786592
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C
@@ -0,0 +1,10 @@
+// { dg-do compile { target c++20 } }
+
+template <class T> concept is_const = __is_same(T, const T);
+
+void f() {
+ int x[] = {1,2};
+ const int y[] = {3};
+ const is_const auto [a,b] = x; // { dg-error "constraints" }
+ const is_const auto [c] = y;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires25.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires25.C
new file mode 100644
index 0000000..90cbedb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires25.C
@@ -0,0 +1,10 @@
+// PR c++/101182
+// { dg-do compile { target concepts } }
+
+int a;
+void g(bool);
+
+bool f() {
+ g(requires { a++; });
+ return requires { a++; };
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires26.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires26.C
new file mode 100644
index 0000000..824d234
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires26.C
@@ -0,0 +1,18 @@
+// PR c++/101181
+// { dg-do compile { target c++20 } }
+
+template<class T,
+ bool = requires { typename T::type; }>
+struct p { using type = void; };
+
+template<class T>
+struct p<T, true> { using type = typename T::type; };
+
+template<class T> using P = typename p<T>::type;
+
+using type1 = P<int>;
+using type1 = void;
+
+struct A { using type = char; };
+using type2 = P<A>;
+using type2 = char;
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires27.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires27.C
new file mode 100644
index 0000000..99d4500
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires27.C
@@ -0,0 +1,10 @@
+// PR c++/82110
+// { dg-do compile { target c++20 } }
+
+struct X { X() = delete; };
+
+template<class T> concept C = requires(T t) { new T; };
+template<class T> concept D = requires(T t) { new T[1]; };
+
+static_assert(!C<X>);
+static_assert(!D<X>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-return-req3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-return-req3.C
new file mode 100644
index 0000000..a546c64
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-return-req3.C
@@ -0,0 +1,6 @@
+// PR c++/100946
+// { dg-do compile { target c++20 } }
+
+template<class T> concept C = __is_same(T, int);
+static_assert(requires { { 0 } -> C; });
+static_assert(requires { { true } -> C; }); // { dg-error "failed" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C
new file mode 100644
index 0000000..4c5f1b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C
@@ -0,0 +1,10 @@
+// PR c++/99961
+// { dg-do compile { target c++20 } }
+
+struct A { static const int x = 42; bool y; };
+
+void f(auto a) requires (a.x == 42) { }
+template void f(A);
+
+template <bool V> concept C = V || A::y;
+static_assert(C<true>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C
new file mode 100644
index 0000000..4793bd6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C
@@ -0,0 +1,8 @@
+// PR c++/99994
+// { dg-do compile { target c++20 } }
+
+int main() {
+ auto f = [](int) { return true; };
+ int n = [&](auto i) requires (f(sizeof(i))) { return 99; }(12);
+ int m = [](auto i) requires (f(sizeof(i))) { return 99; }(12);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C
new file mode 100644
index 0000000..7fc4065
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C
@@ -0,0 +1,9 @@
+// PR c++/94508
+// { dg-do compile { target c++20 } }
+
+template <class T>
+struct A {
+ void f() requires (this, true) { }
+};
+
+template struct A<int>;
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval4.C
new file mode 100644
index 0000000..1be27d1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval4.C
@@ -0,0 +1,12 @@
+// PR c++/101725
+// { dg-do compile { target c++20 } }
+
+template<class T, bool V = requires (T t) { x(t); }> void f();
+
+struct A {
+ int m;
+ void f(int a, int b = requires (int t) { a + m + t; });
+};
+
+void g();
+static_assert(noexcept(requires { g(); }));
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C
index 193ae93..7700bb7 100644
--- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C
@@ -149,9 +149,9 @@ constexpr int x3 = f3 ();
constexpr int
f4 ()
{
- W7 w13 = 5; // { dg-message "in 'constexpr' expansion of" }
+ W7 w13 = 5;
return 0;
-}
+} // { dg-message "in 'constexpr' expansion of" }
constexpr int x4 = f4 (); // { dg-message "in 'constexpr' expansion of" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C
new file mode 100644
index 0000000..f5e1b3e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C
@@ -0,0 +1,27 @@
+// PR c++/99700
+// { dg-do compile { target c++20 } }
+
+template <class T>
+struct A {
+ T c[5];
+ constexpr A(int skip = -1) {
+ for (int i = 0; i < 5; i++)
+ if (i != skip)
+ c[i] = {};
+ }
+};
+
+constexpr A<int> a;
+constexpr A<int> a0(0); // { dg-error "not a constant expression|incompletely initialized" }
+constexpr A<int> a1(1); // { dg-error "not a constant expression|incompletely initialized" }
+constexpr A<int> a2(2); // { dg-error "not a constant expression|incompletely initialized" }
+constexpr A<int> a3(3); // { dg-error "not a constant expression|incompletely initialized" }
+constexpr A<int> a4(4); // { dg-error "not a constant expression|incompletely initialized" }
+
+struct s { int n; };
+constexpr A<s> b;
+constexpr A<s> b0(0); // { dg-error "not a constant expression|incompletely initialized" }
+
+struct empty {};
+constexpr A<empty> c;
+constexpr A<empty> c0(0);
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-init22.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-init22.C
new file mode 100644
index 0000000..50e4a95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-init22.C
@@ -0,0 +1,14 @@
+// PR c++/65816
+// { dg-do compile { target c++20 } }
+
+struct X {
+ int i;
+ X() = default;
+ constexpr X(int) { }
+};
+
+struct Y : X {
+ constexpr Y() : X() { }
+};
+
+static_assert(Y().i == 0);
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C
index fd6f607..2603739 100644
--- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C
@@ -1,65 +1,7 @@
// PR c++/97195
// { dg-do compile { target c++20 } }
-namespace std
-{
- typedef __SIZE_TYPE__ size_t;
-
- template <typename T>
- struct allocator
- {
- constexpr allocator () noexcept {}
-
- constexpr T *allocate (size_t n)
- { return static_cast<T *> (::operator new (n * sizeof(T))); }
-
- constexpr void
- deallocate (T *p, size_t n)
- { ::operator delete (p); }
- };
-
- template <typename T, typename U = T &&>
- U __declval (int);
- template <typename T>
- T __declval (long);
- template <typename T>
- auto declval () noexcept -> decltype (__declval<T> (0));
-
- template <typename T>
- struct remove_reference
- { typedef T type; };
- template <typename T>
- struct remove_reference<T &>
- { typedef T type; };
- template <typename T>
- struct remove_reference<T &&>
- { typedef T type; };
-
- template <typename T>
- constexpr T &&
- forward (typename std::remove_reference<T>::type &t) noexcept
- { return static_cast<T&&> (t); }
-
- template<typename T>
- constexpr T &&
- forward (typename std::remove_reference<T>::type &&t) noexcept
- { return static_cast<T&&> (t); }
-
- template <typename T, typename... A>
- constexpr auto
- construct_at (T *l, A &&... a)
- noexcept (noexcept (::new ((void *) 0) T (std::declval<A> ()...)))
- -> decltype (::new ((void *) 0) T (std::declval<A> ()...))
- { return ::new ((void *) l) T (std::forward<A> (a)...); }
-
- template <typename T>
- constexpr inline void
- destroy_at (T *l)
- { l->~T (); }
-}
-
-inline void *operator new (std::size_t, void *p) noexcept
-{ return p; }
+#include "construct_at.h"
constexpr bool
foo ()
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C
new file mode 100644
index 0000000..24b298a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C
@@ -0,0 +1,45 @@
+// PR c++/99859
+// { dg-do compile { target c++20 } }
+
+template <class T>
+struct intrusive_ptr
+{
+ T *ptr = nullptr;
+ constexpr explicit intrusive_ptr(T* p) : ptr(p) {
+ ++ptr->count_;
+ }
+ constexpr ~intrusive_ptr() {
+ if (ptr->dec() == 0)
+ delete ptr;
+ }
+ constexpr intrusive_ptr(intrusive_ptr const& a) : ptr(a.ptr) {
+ ++ptr->count_;
+ }
+};
+
+struct Foo {
+ int count_ = 0;
+ constexpr int dec() {
+ return --count_;
+ }
+};
+
+constexpr bool baz() {
+ Foo f { 4 };
+ intrusive_ptr a(&f);
+ return true;
+}
+constexpr bool x = baz();
+
+constexpr void bar(intrusive_ptr<Foo> a)
+{
+ if (a.ptr->count_ != 2) throw 1;
+}
+
+constexpr bool foo() {
+ intrusive_ptr a(new Foo());
+ bar(a);
+ return true;
+}
+
+static_assert(foo());
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C
new file mode 100644
index 0000000..7a73dee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C
@@ -0,0 +1,43 @@
+// PR c++/99859
+// { dg-do compile { target c++20 } }
+
+constexpr void
+foo (int *x)
+{
+ ++*x;
+}
+
+constexpr int
+bar ()
+{
+ int *x = new int (0);
+ foo (x);
+ foo (x);
+ int y = *x;
+ delete x;
+ return y;
+}
+
+static_assert (bar () == 2);
+
+struct R { int a, *b; };
+
+constexpr void
+baz (R x)
+{
+ ++*x.b;
+}
+
+constexpr int
+qux ()
+{
+ int *x = new int (0);
+ R r{1, x};
+ baz (r);
+ baz (r);
+ int y = *x;
+ delete x;
+ return y;
+}
+
+static_assert (qux () == 2);
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new20.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new20.C
new file mode 100644
index 0000000..88bc442
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new20.C
@@ -0,0 +1,18 @@
+// PR c++/101663
+// { dg-do compile { target c++20 } }
+
+#include "construct_at.h"
+
+template <typename _Tp> struct __box {
+ [[no_unique_address]] _Tp _M_value;
+};
+
+struct Empty {};
+
+constexpr bool test() {
+ __box<Empty> a;
+ std::construct_at(&a._M_value);
+ return true;
+}
+
+static_assert(test());
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new21.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new21.C
new file mode 100644
index 0000000..8231e99
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new21.C
@@ -0,0 +1,17 @@
+// PR c++/100495
+// { dg-do compile { target c++20 } }
+
+struct S {
+ constexpr virtual ~S () {}
+};
+
+constexpr bool
+foo ()
+{
+ S *p = new S ();
+ delete p;
+ return true;
+}
+
+constexpr bool x = foo ();
+static_assert (x);
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new5.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new5.C
index 2bb407a..eeaee96 100644
--- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new5.C
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new5.C
@@ -1,65 +1,7 @@
// P0784R7
// { dg-do compile { target c++20 } }
-namespace std
-{
- typedef __SIZE_TYPE__ size_t;
-
- template <typename T>
- struct allocator
- {
- constexpr allocator () noexcept {}
-
- constexpr T *allocate (size_t n)
- { return static_cast<T *> (::operator new (n * sizeof(T))); }
-
- constexpr void
- deallocate (T *p, size_t n)
- { ::operator delete (p); }
- };
-
- template <typename T, typename U = T &&>
- U __declval (int);
- template <typename T>
- T __declval (long);
- template <typename T>
- auto declval () noexcept -> decltype (__declval<T> (0));
-
- template <typename T>
- struct remove_reference
- { typedef T type; };
- template <typename T>
- struct remove_reference<T &>
- { typedef T type; };
- template <typename T>
- struct remove_reference<T &&>
- { typedef T type; };
-
- template <typename T>
- constexpr T &&
- forward (typename std::remove_reference<T>::type &t) noexcept
- { return static_cast<T&&> (t); }
-
- template<typename T>
- constexpr T &&
- forward (typename std::remove_reference<T>::type &&t) noexcept
- { return static_cast<T&&> (t); }
-
- template <typename T, typename... A>
- constexpr auto
- construct_at (T *l, A &&... a)
- noexcept (noexcept (::new ((void *) 0) T (std::declval<A> ()...)))
- -> decltype (::new ((void *) 0) T (std::declval<A> ()...))
- { return ::new ((void *) l) T (std::forward<A> (a)...); }
-
- template <typename T>
- constexpr inline void
- destroy_at (T *l)
- { l->~T (); }
-}
-
-inline void *operator new (std::size_t, void *p) noexcept
-{ return p; }
+#include "construct_at.h"
constexpr bool
foo ()
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new6.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new6.C
index d51bdbb..eeaee96 100644
--- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new6.C
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new6.C
@@ -1,69 +1,7 @@
// P0784R7
// { dg-do compile { target c++20 } }
-namespace std
-{
- inline namespace _8 { }
- namespace _8 {
-
- typedef __SIZE_TYPE__ size_t;
-
- template <typename T>
- struct allocator
- {
- constexpr allocator () noexcept {}
-
- constexpr T *allocate (size_t n)
- { return static_cast<T *> (::operator new (n * sizeof(T))); }
-
- constexpr void
- deallocate (T *p, size_t n)
- { ::operator delete (p); }
- };
-
- template <typename T, typename U = T &&>
- U __declval (int);
- template <typename T>
- T __declval (long);
- template <typename T>
- auto declval () noexcept -> decltype (__declval<T> (0));
-
- template <typename T>
- struct remove_reference
- { typedef T type; };
- template <typename T>
- struct remove_reference<T &>
- { typedef T type; };
- template <typename T>
- struct remove_reference<T &&>
- { typedef T type; };
-
- template <typename T>
- constexpr T &&
- forward (typename std::remove_reference<T>::type &t) noexcept
- { return static_cast<T&&> (t); }
-
- template<typename T>
- constexpr T &&
- forward (typename std::remove_reference<T>::type &&t) noexcept
- { return static_cast<T&&> (t); }
-
- template <typename T, typename... A>
- constexpr auto
- construct_at (T *l, A &&... a)
- noexcept (noexcept (::new ((void *) 0) T (std::declval<A> ()...)))
- -> decltype (::new ((void *) 0) T (std::declval<A> ()...))
- { return ::new ((void *) l) T (std::forward<A> (a)...); }
-
- template <typename T>
- constexpr inline void
- destroy_at (T *l)
- { l->~T (); }
- }
-}
-
-inline void *operator new (std::size_t, void *p) noexcept
-{ return p; }
+#include "construct_at.h"
constexpr bool
foo ()
diff --git a/gcc/testsuite/g++.dg/cpp2a/constinit16.C b/gcc/testsuite/g++.dg/cpp2a/constinit16.C
new file mode 100644
index 0000000..dda81d5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constinit16.C
@@ -0,0 +1,21 @@
+// PR c++/101786
+// { dg-do compile { target c++20 } }
+// { dg-add-options tls }
+// { dg-require-alias "" }
+// { dg-require-effective-target tls_runtime }
+// { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar1" } }
+// { dg-final { scan-assembler "_ZTH17mythreadlocalvar2" } }
+// { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar3" } }
+// { dg-final { scan-assembler "_ZTH17mythreadlocalvar4" } }
+
+extern thread_local constinit int mythreadlocalvar1;
+struct S;
+extern thread_local constinit S mythreadlocalvar2;
+struct T { int t; };
+extern thread_local constinit T mythreadlocalvar3;
+struct U { int u; ~U (); };
+extern thread_local constinit U mythreadlocalvar4;
+int foo () { return mythreadlocalvar1; }
+S *bar () { return &mythreadlocalvar2; }
+T *baz () { return &mythreadlocalvar3; }
+U *qux () { return &mythreadlocalvar4; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/construct_at.h b/gcc/testsuite/g++.dg/cpp2a/construct_at.h
new file mode 100644
index 0000000..27e92cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/construct_at.h
@@ -0,0 +1,62 @@
+// A minimal conforming implementation of std::construct_at/destroy_at,
+// used by some C++20 constexpr tests to avoid including all of <memory>.
+
+namespace std
+{
+ typedef __SIZE_TYPE__ size_t;
+
+ template <typename T>
+ struct allocator
+ {
+ constexpr allocator () noexcept {}
+
+ constexpr T *allocate (size_t n)
+ { return static_cast<T *> (::operator new (n * sizeof(T))); }
+
+ constexpr void
+ deallocate (T *p, size_t n)
+ { ::operator delete (p); }
+ };
+
+ template <typename T, typename U = T &&>
+ U __declval (int);
+ template <typename T>
+ T __declval (long);
+ template <typename T>
+ auto declval () noexcept -> decltype (__declval<T> (0));
+
+ template <typename T>
+ struct remove_reference
+ { typedef T type; };
+ template <typename T>
+ struct remove_reference<T &>
+ { typedef T type; };
+ template <typename T>
+ struct remove_reference<T &&>
+ { typedef T type; };
+
+ template <typename T>
+ constexpr T &&
+ forward (typename std::remove_reference<T>::type &t) noexcept
+ { return static_cast<T&&> (t); }
+
+ template<typename T>
+ constexpr T &&
+ forward (typename std::remove_reference<T>::type &&t) noexcept
+ { return static_cast<T&&> (t); }
+
+ template <typename T, typename... A>
+ constexpr auto
+ construct_at (T *l, A &&... a)
+ noexcept (noexcept (::new ((void *) 0) T (std::declval<A> ()...)))
+ -> decltype (::new ((void *) 0) T (std::declval<A> ()...))
+ { return ::new ((void *) l) T (std::forward<A> (a)...); }
+
+ template <typename T>
+ constexpr inline void
+ destroy_at (T *l)
+ { l->~T (); }
+}
+
+inline void *operator new (std::size_t, void *p) noexcept
+{ return p; }
diff --git a/gcc/testsuite/g++.dg/cpp2a/desig18.C b/gcc/testsuite/g++.dg/cpp2a/desig18.C
new file mode 100644
index 0000000..4851579
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/desig18.C
@@ -0,0 +1,17 @@
+// PR c++/100489
+// { dg-options "" }
+
+union U
+{
+ union
+ {
+ unsigned char a;
+ };
+
+ unsigned char b[1];
+};
+
+void f(unsigned char a)
+{
+ union U u = { .a = a };
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/desig19.C b/gcc/testsuite/g++.dg/cpp2a/desig19.C
new file mode 100644
index 0000000..3321da8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/desig19.C
@@ -0,0 +1,33 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A
+{
+ int i;
+ constexpr operator int() { return 42; }
+};
+
+#define SA(X) static_assert ((X),#X)
+constexpr A a1 { A() };
+SA(a1.i == 0);
+constexpr A a2 { i: A() };
+SA(a2.i == 42);
+#if __cpp_constexpr >= 201304L
+constexpr int f3 () { A const &r { A() }; return r.i; }
+SA(f3() == 0);
+constexpr int f4 () { A const &r { i: A() }; return r.i; }
+SA(f4() == 42);
+constexpr int f5 () { A ar[1]{{ A() }}; return ar[0].i; }
+SA(f5() == 0);
+constexpr int f5a () { A ar[1]{{ i: A() }}; return ar[0].i; }
+SA(f5a() == 42);
+#if __cpp_constexpr >= 201907L
+constexpr int f6 () { A* p = new A{A()}; int i = p->i; delete p; return i; }
+SA(f6() == 0);
+constexpr int f6a () { A* p = new A{i:A()}; int i = p->i; delete p; return i; }
+SA(f6a() == 42);
+#endif
+#endif
+constexpr int f7 (A a) { return a.i; }
+SA(f7({A()}) == 0);
+SA(f7({i:A()}) == 42);
diff --git a/gcc/testsuite/g++.dg/cpp2a/destroying-delete5.C b/gcc/testsuite/g++.dg/cpp2a/destroying-delete5.C
new file mode 100644
index 0000000..553c964
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/destroying-delete5.C
@@ -0,0 +1,36 @@
+// PR c++/91859
+// { dg-do run { target c++20 } }
+// { dg-additional-options -O2 }
+
+#include <cstdlib>
+#include <new>
+
+struct Expression {
+ int i = 0;
+ void *operator new(std::size_t);
+ void operator delete(Expression *, std::destroying_delete_t);
+};
+
+void * Expression::operator new(std::size_t sz)
+{
+ return std::malloc(sz);
+}
+
+int i;
+
+void Expression::operator delete(Expression *p, std::destroying_delete_t)
+{
+ Expression * e = p;
+ ::i = e->i;
+ p->~Expression();
+ std::free(p);
+}
+
+int main()
+{
+ auto p = new Expression();
+ p->i = 1;
+ delete p;
+ if (i != 1)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit16.C b/gcc/testsuite/g++.dg/cpp2a/explicit16.C
index 9d95b0d..9c20f63 100644
--- a/gcc/testsuite/g++.dg/cpp2a/explicit16.C
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit16.C
@@ -1,5 +1,5 @@
// PR c++/95066 - explicit malfunction with dependent expression.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T>
struct Foo {
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit17.C b/gcc/testsuite/g++.dg/cpp2a/explicit17.C
new file mode 100644
index 0000000..38a61f4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit17.C
@@ -0,0 +1,9 @@
+// PR c++/99844
+// { dg-do compile { target c++20 } }
+
+template <bool... B>
+struct S {
+ constexpr explicit(B) S() {} // { dg-error "parameter packs not expanded" }
+};
+
+constexpr S<true> s;
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit18.C b/gcc/testsuite/g++.dg/cpp2a/explicit18.C
new file mode 100644
index 0000000..c8916fa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit18.C
@@ -0,0 +1,23 @@
+// PR c++/100065
+// { dg-do compile { target c++20 } }
+
+template<bool B>
+struct bool_constant {
+ static constexpr bool value = B;
+ constexpr operator bool() const { return value; }
+};
+
+using true_type = bool_constant<true>;
+using false_type = bool_constant<false>;
+
+template<bool>
+struct X {
+ template<typename T>
+ X(T);
+};
+
+template<bool b>
+explicit(b) X(bool_constant<b>) -> X<b>;
+
+X false_ = false_type{}; // OK
+X true_ = true_type{}; // { dg-error "explicit deduction guide" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
index dc46e48..3239df8 100644
--- a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
+++ b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
@@ -520,13 +520,11 @@
# error "__cpp_constexpr_in_decltype != 201711"
#endif
-/* Not supported fully yet:
#ifndef __cpp_consteval
# error "__cpp_consteval"
#elif __cpp_consteval != 201811
# error "__cpp_consteval != 201811"
#endif
-*/
#ifndef __cpp_concepts
# error "__cpp_concepts"
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated12.C b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated12.C
new file mode 100644
index 0000000..0de6bf7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated12.C
@@ -0,0 +1,79 @@
+// PR c++/100995
+// { dg-do compile { target c++20 } }
+// { dg-options "-Wtautological-compare" }
+
+namespace std {
+ constexpr inline bool
+ is_constant_evaluated () noexcept
+ {
+ return __builtin_is_constant_evaluated ();
+ }
+}
+
+template <int I = []() constexpr { if (std::is_constant_evaluated()) return 1; return 0; }()>
+struct X { };
+
+template <int I = [](){ if (std::is_constant_evaluated()) return 1; return 0; }()>
+struct Y { };
+
+template <int I = [](){ if constexpr (std::is_constant_evaluated()) return 1; return 0; }()> // { dg-warning "always evaluates to true" }
+struct Z { };
+
+constexpr bool b = true;
+
+#define __glibcxx_assert(cond) \
+ if (__builtin_is_constant_evaluated() && !bool(cond)) \
+__builtin_unreachable()
+#define CHECK __builtin_is_constant_evaluated() // { dg-warning "always evaluates to false" }
+#define CHECK2 __builtin_is_constant_evaluated()
+
+int
+foo ()
+{
+ if (std::is_constant_evaluated ()) // { dg-warning "always evaluates to false" }
+ return 1;
+ __glibcxx_assert(b);
+ if (CHECK && b)
+ return 2;
+ if (CHECK2)
+ return 3;
+ return 0;
+}
+
+constexpr int
+bar ()
+{
+ if (std::is_constant_evaluated ())
+ return 1;
+ if constexpr (std::is_constant_evaluated ()) // { dg-warning "always evaluates to true" }
+ return 2;
+ if constexpr (std::is_constant_evaluated () && b) // { dg-warning "always evaluates to true" }
+ return 3;
+ if constexpr (!std::is_constant_evaluated ()) // { dg-warning "always evaluates to true" }
+ return 4;
+ return 0;
+}
+
+consteval int
+baz ()
+{
+ if (std::is_constant_evaluated ()) // { dg-warning "always evaluates to true" }
+ return 1;
+ return 0;
+}
+
+int
+qux ()
+{
+ if (({ static bool a = std::is_constant_evaluated (); a; }))
+ return 1;
+ if (({ bool a = std::is_constant_evaluated (); a; }))
+ return 2;
+ if (static bool a = std::is_constant_evaluated (); a)
+ return 3;
+ if (bool a = std::is_constant_evaluated (); a)
+ return 4;
+ if constexpr (constexpr bool a = std::is_constant_evaluated (); a)
+ return 5;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated9.C b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated9.C
index 0e96a1a..5e405e7 100644
--- a/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated9.C
+++ b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated9.C
@@ -32,7 +32,7 @@ constexpr int
foo3(int i)
{
// I is not a constant expression but we short-circuit it.
- if constexpr (__builtin_is_constant_evaluated () || i)
+ if constexpr (__builtin_is_constant_evaluated () || i) // { dg-warning ".std::is_constant_evaluated. always evaluates to true in .if constexpr." }
return 42;
else
return i;
@@ -42,7 +42,7 @@ constexpr int
foo4(int i)
{
const int j = 0;
- if constexpr (j && __builtin_is_constant_evaluated ())
+ if constexpr (j && __builtin_is_constant_evaluated ()) // { dg-warning ".std::is_constant_evaluated. always evaluates to true in .if constexpr." }
return 42;
else
return i;
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member1.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member1.C
new file mode 100644
index 0000000..dd14c44
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member1.C
@@ -0,0 +1,61 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <class S1, class S2, class M1, class M2>
+constexpr bool
+is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
+{
+ return __builtin_is_corresponding_member (m1, m2);
+}
+}
+
+struct A { int a; };
+struct B { const int b; };
+struct C { int a; unsigned int b; int f; A c; int : 0; int d; double e; };
+struct D { const int x; unsigned int y; int g; B z; int u; double w; };
+struct E { int a; [[no_unique_address]] int b; };
+struct F { int c; const int d; };
+struct G { double a; int b; double c; };
+struct H { const volatile double d; int e : 16; double f; };
+struct I { const double g; int h : 15; const double i; };
+struct J : public A {};
+struct K {};
+struct L : public K, public B {};
+union U { int a; };
+struct V { void foo () {}; };
+struct W { int a; private: int b; public: int c; };
+struct Z : public A, public B {};
+
+static_assert (std::is_corresponding_member (&A::a, &A::a));
+static_assert (std::is_corresponding_member (&A::a, &B::b));
+static_assert (std::is_corresponding_member (&C::a, &D::x));
+static_assert (std::is_corresponding_member (&C::b, &D::y));
+static_assert (std::is_corresponding_member (&C::f, &D::g));
+static_assert (std::is_corresponding_member (&C::c, &D::z));
+static_assert (!std::is_corresponding_member (&C::d, &D::u));
+static_assert (!std::is_corresponding_member (&C::e, &D::w));
+static_assert (!std::is_corresponding_member (&C::f, &D::x));
+static_assert (!std::is_corresponding_member (&C::a, &D::g));
+static_assert (std::is_corresponding_member (&E::a, &F::c));
+static_assert (!std::is_corresponding_member (&E::b, &F::d));
+static_assert (std::is_corresponding_member (&G::a, &H::d));
+static_assert (!std::is_corresponding_member (&G::c, &H::f));
+static_assert (std::is_corresponding_member (&H::d, &I::g));
+static_assert (!std::is_corresponding_member (&H::f, &I::i));
+static_assert (std::is_corresponding_member (&J::a, &B::b));
+static_assert (std::is_corresponding_member<J, B, int, const int> (&J::a, &B::b));
+static_assert (std::is_corresponding_member (&J::a, &L::b));
+static_assert (std::is_corresponding_member<J, L, int, const int> (&J::a, &L::b));
+static_assert (std::is_corresponding_member (&L::b, &B::b));
+static_assert (std::is_corresponding_member<L, B, const int, const int> (&L::b, &B::b));
+static_assert (!std::is_corresponding_member (&U::a, &U::a));
+static_assert (!std::is_corresponding_member (&A::a, (int A::*) nullptr));
+static_assert (!std::is_corresponding_member ((int A::*) nullptr, &A::a));
+static_assert (!std::is_corresponding_member ((int A::*) nullptr, (int A::*) nullptr));
+static_assert (!std::is_corresponding_member (&V::foo, &V::foo));
+static_assert (!std::is_corresponding_member (&W::a, &W::a));
+static_assert (!std::is_corresponding_member (&W::c, &W::c));
+static_assert (std::is_corresponding_member (&Z::a, &Z::b));
+static_assert (!std::is_corresponding_member<Z, Z, int, const int> (&Z::a, &Z::b));
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member2.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member2.C
new file mode 100644
index 0000000..1cedbcb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member2.C
@@ -0,0 +1,158 @@
+// P0466R5
+// { dg-do run { target c++20 } }
+
+namespace std
+{
+template <class S1, class S2, class M1, class M2>
+constexpr bool
+is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
+{
+ return __builtin_is_corresponding_member (m1, m2);
+}
+}
+
+struct A { int a; };
+struct B { const int b; };
+struct C { int a; unsigned int b; int f; A c; int : 0; int d; double e; };
+struct D { const int x; unsigned int y; int g; B z; int u; double w; };
+struct E { int a; [[no_unique_address]] int b; };
+struct F { int c; const int d; };
+struct G { double a; int b; double c; };
+struct H { const volatile double d; int e : 16; double f; };
+struct I { const double g; int h : 15; const double i; };
+struct J : public A {};
+struct K {};
+struct L : public K, public B {};
+union U { int a; };
+struct V { void foo () {}; };
+struct W { int a; private: int b; public: int c; };
+struct Z : public A, public B {};
+
+int
+main ()
+{
+ auto t1 = &A::a;
+ auto t2 = &A::a;
+ if (!std::is_corresponding_member (t1, t2))
+ __builtin_abort ();
+ auto t3 = &A::a;
+ auto t4 = &B::b;
+ if (!std::is_corresponding_member (t3, t4))
+ __builtin_abort ();
+ auto t5 = &C::a;
+ auto t6 = &D::x;
+ if (!std::is_corresponding_member (t5, t6))
+ __builtin_abort ();
+ auto t9 = &C::b;
+ auto t10 = &D::y;
+ if (!std::is_corresponding_member (t9, t10))
+ __builtin_abort ();
+ auto t11 = &C::f;
+ auto t12 = &D::g;
+ if (!std::is_corresponding_member (t11, t12))
+ __builtin_abort ();
+ auto t13 = &C::c;
+ auto t14 = &D::z;
+ if (!std::is_corresponding_member (t13, t14))
+ __builtin_abort ();
+ auto t15 = &C::d;
+ auto t16 = &D::u;
+ if (std::is_corresponding_member (t15, t16))
+ __builtin_abort ();
+ auto t17 = &C::e;
+ auto t18 = &D::w;
+ if (std::is_corresponding_member (t17, t18))
+ __builtin_abort ();
+ auto t19 = &C::f;
+ auto t20 = &D::x;
+ if (std::is_corresponding_member (t19, t20))
+ __builtin_abort ();
+ auto t21 = &C::a;
+ auto t22 = &D::g;
+ if (std::is_corresponding_member (t21, t22))
+ __builtin_abort ();
+ auto t23 = &E::a;
+ auto t24 = &F::c;
+ if (!std::is_corresponding_member (t23, t24))
+ __builtin_abort ();
+ auto t25 = &E::b;
+ auto t26 = &F::d;
+ if (std::is_corresponding_member (t25, t26))
+ __builtin_abort ();
+ auto t27 = &G::a;
+ auto t28 = &H::d;
+ if (!std::is_corresponding_member (t27, t28))
+ __builtin_abort ();
+ auto t29 = &G::c;
+ auto t30 = &H::f;
+ if (std::is_corresponding_member (t29, t30))
+ __builtin_abort ();
+ auto t31 = &H::d;
+ auto t32 = &I::g;
+ if (!std::is_corresponding_member (t31, t32))
+ __builtin_abort ();
+ auto t33 = &H::f;
+ auto t34 = &I::i;
+ if (std::is_corresponding_member (t33, t34))
+ __builtin_abort ();
+ auto t35 = &J::a;
+ auto t36 = &B::b;
+ if (!std::is_corresponding_member (t35, t36))
+ __builtin_abort ();
+ int J::*t37 = &J::a;
+ const int B::*t38 = &B::b;
+ if (!std::is_corresponding_member (t37, t38))
+ __builtin_abort ();
+ auto t39 = &J::a;
+ auto t40 = &L::b;
+ if (!std::is_corresponding_member (t39, t40))
+ __builtin_abort ();
+ int J::*t41 = &J::a;
+ const int L::*t42 = &L::b;
+ if (!std::is_corresponding_member (t41, t42))
+ __builtin_abort ();
+ auto t43 = &L::b;
+ auto t44 = &B::b;
+ if (!std::is_corresponding_member (t43, t44))
+ __builtin_abort ();
+ const int L::*t45 = &L::b;
+ const int B::*t46 = &B::b;
+ if (!std::is_corresponding_member (t45, t46))
+ __builtin_abort ();
+ auto t47 = &U::a;
+ auto t48 = &U::a;
+ if (std::is_corresponding_member (t47, t48))
+ __builtin_abort ();
+ auto t49 = &A::a;
+ auto t50 = (int A::*) nullptr;
+ if (std::is_corresponding_member (t49, t50))
+ __builtin_abort ();
+ auto t51 = (int A::*) nullptr;
+ auto t52 = &A::a;
+ if (std::is_corresponding_member (t51, t52))
+ __builtin_abort ();
+ auto t53 = (int A::*) nullptr;
+ auto t54 = (int A::*) nullptr;
+ if (std::is_corresponding_member (t53, t54))
+ __builtin_abort ();
+ auto t55 = &V::foo;
+ auto t56 = &V::foo;
+ if (std::is_corresponding_member (t55, t56))
+ __builtin_abort ();
+ auto t57 = &W::a;
+ auto t58 = &W::a;
+ if (std::is_corresponding_member (t57, t58))
+ __builtin_abort ();
+ auto t59 = &W::c;
+ auto t60 = &W::c;
+ if (std::is_corresponding_member (t59, t60))
+ __builtin_abort ();
+ auto t61 = &Z::a;
+ auto t62 = &Z::b;
+ if (!std::is_corresponding_member (t61, t62))
+ __builtin_abort ();
+ int Z::*t63 = &Z::a;
+ const int Z::*t64 = &Z::b;
+ if (std::is_corresponding_member (t63, t64))
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member3.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member3.C
new file mode 100644
index 0000000..1ff510c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member3.C
@@ -0,0 +1,14 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+struct A { int a; };
+struct B;
+
+bool a = __builtin_is_corresponding_member (); // { dg-error "needs two arguments" }
+bool b = __builtin_is_corresponding_member (&A::a); // { dg-error "needs two arguments" }
+bool c = __builtin_is_corresponding_member (&A::a, &A::a, &A::a); // { dg-error "needs two arguments" }
+bool d = __builtin_is_corresponding_member (&A::a, 1); // { dg-error "argument is not pointer to member" }
+bool e = __builtin_is_corresponding_member (1.0, &A::a); // { dg-error "argument is not pointer to member" }
+bool f = __builtin_is_corresponding_member (1, A{}); // { dg-error "argument is not pointer to member" }
+bool g = __builtin_is_corresponding_member (&A::a, (int B::*) nullptr); // { dg-error "invalid use of incomplete type" }
+bool h = __builtin_is_corresponding_member ((int B::*) nullptr, &A::a); // { dg-error "invalid use of incomplete type" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C
new file mode 100644
index 0000000..6b74090
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C
@@ -0,0 +1,25 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <class S1, class S2, class M1, class M2>
+constexpr bool
+is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
+{
+ return __builtin_is_corresponding_member (m1, m2); // { dg-error "invalid use of incomplete type 'struct B'" }
+}
+}
+
+struct A { int a; };
+struct B;
+constexpr int B::*n = nullptr;
+constexpr auto a = std::is_corresponding_member (&A::a, n); // { dg-error "invalid use of incomplete type 'struct B'" }
+constexpr auto b = std::is_corresponding_member (n, &A::a); // { dg-error "invalid use of incomplete type 'struct B'" }
+
+void
+foo (int B::*m)
+{
+ std::is_corresponding_member (&A::a, m);
+ std::is_corresponding_member (m, &A::a);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member5.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member5.C
new file mode 100644
index 0000000..b956309
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member5.C
@@ -0,0 +1,95 @@
+// P0466R5
+// { dg-do run { target c++20 } }
+
+namespace std
+{
+template <class S1, class S2, class M1, class M2>
+constexpr bool
+is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
+{
+ return __builtin_is_corresponding_member (m1, m2);
+}
+}
+
+struct S {};
+struct T {};
+struct I { int a; };
+struct alignas(16) J { const int b; };
+struct K { char b; char s[15]; I c; short d; };
+struct L { char d; char t[15]; J e; short f; };
+struct U { int a0; [[no_unique_address]] S a1; [[no_unique_address]] S a2; [[no_unique_address]] S a3; short a4; };
+struct V { int b0; [[no_unique_address]] S b1; [[no_unique_address]] T b2; [[no_unique_address]] S b3; short b4; };
+struct U1 { int a0; [[no_unique_address]] S a1; [[no_unique_address]] S a2; [[no_unique_address]] S a3; short a4; };
+struct V1 { int b0; [[no_unique_address]] S b1; [[no_unique_address]] T b2; [[no_unique_address]] S b3; short b4; };
+struct A { int a; union { short b; long c; }; int d; signed char e; int f; };
+struct B { const int a; union { signed long b; short c; }; volatile int d; unsigned char e; int f; };
+struct A1 { int a; union { short b; long c; }; int d; short e; int f; };
+struct B1 { const int a; union { signed long b; short c; }; volatile int d; unsigned short e; int f; };
+
+static_assert (std::is_corresponding_member (&I::a, &J::b));
+static_assert (std::is_corresponding_member (&K::b, &L::d));
+static_assert (!std::is_corresponding_member (&K::c, &L::e));
+static_assert (std::is_corresponding_member (&U::a0, &V::b0));
+static_assert (!std::is_corresponding_member (&U::a4, &V::b4));
+static_assert (std::is_corresponding_member (&A::a, &B::a));
+static_assert (std::is_corresponding_member (&A::d, &B::d));
+static_assert (!std::is_corresponding_member (&A::e, &B::e));
+static_assert (!std::is_corresponding_member (&A::f, &B::f));
+static_assert (!std::is_corresponding_member (&A::a, &B::f));
+static_assert (!std::is_corresponding_member (&A::d, &B::a));
+static_assert (!std::is_corresponding_member (&A::a, &B::d));
+static_assert (!std::is_corresponding_member (&A::f, &B::a));
+static_assert (!std::is_corresponding_member (&A1::e, &B1::e));
+
+int
+main ()
+{
+ auto t1 = &I::a;
+ auto t2 = &J::b;
+ if (!std::is_corresponding_member (t1, t2))
+ __builtin_abort ();
+ auto t3 = &K::b;
+ auto t4 = &L::d;
+ if (!std::is_corresponding_member (t3, t4))
+ __builtin_abort ();
+ auto t5 = &K::c;
+ auto t6 = &L::e;
+ if (std::is_corresponding_member (t5, t6))
+ __builtin_abort ();
+ auto t7 = &U::a0;
+ auto t8 = &V::b0;
+ if (!std::is_corresponding_member (t7, t8))
+ __builtin_abort ();
+ auto t9 = &U::a4;
+ auto t10 = &V::b4;
+ if (std::is_corresponding_member (t9, t10))
+ __builtin_abort ();
+ auto t11 = &A::a;
+ auto t12 = &B::a;
+ auto t13 = &A::d;
+ auto t14 = &B::d;
+ auto t15 = &A::e;
+ auto t16 = &B::e;
+ auto t17 = &A::f;
+ auto t18 = &B::f;
+ if (!std::is_corresponding_member (t11, t12))
+ __builtin_abort ();
+ if (!std::is_corresponding_member (t13, t14))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t15, t16))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t17, t18))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t11, t18))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t13, t12))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t11, t14))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t17, t12))
+ __builtin_abort ();
+ auto t19 = &A1::e;
+ auto t20 = &B1::e;
+ if (std::is_corresponding_member (t19, t20))
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member6.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member6.C
new file mode 100644
index 0000000..e4f53bb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member6.C
@@ -0,0 +1,34 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <class S1, class S2, class M1, class M2>
+constexpr bool
+is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
+{
+ return __builtin_is_corresponding_member (m1, m2);
+}
+// { dg-message "'__builtin_is_corresponding_member' not well defined for anonymous unions" "" { target *-*-* } .-2 }
+}
+
+struct S {};
+struct T {};
+struct I { int a; };
+struct alignas(16) J { const int b; };
+struct K { char b; char s[15]; alignas(16) I c; short d; };
+struct L { char d; char t[15]; J e; short f; };
+struct U { int a0; [[no_unique_address]] S a1; [[no_unique_address]] S a2; [[no_unique_address]] S a3; short a4; };
+struct V { int b0; [[no_unique_address]] S b1; [[no_unique_address]] T b2; [[no_unique_address]] S b3; short b4; };
+struct U1 { int a0; [[no_unique_address]] S a1; [[no_unique_address]] S a2; [[no_unique_address]] S a3; short a4; };
+struct V1 { int b0; [[no_unique_address]] S b1; [[no_unique_address]] T b2; [[no_unique_address]] S b3; short b4; };
+struct A { int a; union { short b; long c; }; int d; signed char e; int f; };
+struct B { const int a; union { signed long b; short c; }; volatile int d; unsigned char e; int f; };
+
+static_assert (!std::is_corresponding_member (&K::d, &L::f));
+static_assert (std::is_corresponding_member (&U::a1, &V::b1));
+static_assert (!std::is_corresponding_member (&U::a2, &V::b2));
+static_assert (!std::is_corresponding_member (&U::a3, &V::b3));
+static_assert (!std::is_corresponding_member (&U1::a3, &V1::b3));
+static_assert (!std::is_corresponding_member (&A::b, &B::c));
+constexpr auto a = std::is_corresponding_member (&A::c, &B::b); // { dg-message "required from here" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member7.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member7.C
new file mode 100644
index 0000000..602ca01
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member7.C
@@ -0,0 +1,71 @@
+// P0466R5
+// { dg-do run { target c++20 } }
+// { dg-options "" }
+
+namespace std
+{
+template <class S1, class S2, class M1, class M2>
+constexpr bool
+is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
+{
+ return __builtin_is_corresponding_member (m1, m2);
+}
+}
+
+struct A { int a; struct { int b; short c; long d; }; int : 0; int e; };
+struct B { const signed int a; struct { int b; signed short c; signed long d; }; volatile int e; };
+struct C { int a; union { struct { short b; long c; }; long d; short e; }; signed int f; };
+struct D { int a; union { long b; short c; struct { short d; signed long e; }; }; int f; };
+
+static_assert (std::is_corresponding_member (&A::a, &B::a));
+static_assert (std::is_corresponding_member (&A::b, &B::b));
+static_assert (std::is_corresponding_member (&A::c, &B::c));
+static_assert (std::is_corresponding_member (&A::d, &B::d));
+static_assert (!std::is_corresponding_member (&A::e, &B::e));
+static_assert (!std::is_corresponding_member (&A::a, &B::b));
+static_assert (!std::is_corresponding_member (&A::b, &B::a));
+static_assert (std::is_corresponding_member (&C::a, &D::a));
+static_assert (std::is_corresponding_member (&C::f, &D::f));
+static_assert (!std::is_corresponding_member (&C::a, &D::f));
+static_assert (!std::is_corresponding_member (&C::f, &D::a));
+
+int
+main ()
+{
+ auto t1 = &A::a;
+ auto t2 = &B::a;
+ auto t3 = &A::b;
+ auto t4 = &B::b;
+ auto t5 = &A::c;
+ auto t6 = &B::c;
+ auto t7 = &A::d;
+ auto t8 = &B::d;
+ auto t9 = &A::e;
+ auto t10 = &B::e;
+ if (!std::is_corresponding_member (t1, t2))
+ __builtin_abort ();
+ if (!std::is_corresponding_member (t3, t4))
+ __builtin_abort ();
+ if (!std::is_corresponding_member (t5, t6))
+ __builtin_abort ();
+ if (!std::is_corresponding_member (t7, t8))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t9, t10))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t1, t4))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t3, t2))
+ __builtin_abort ();
+ auto t11 = &C::a;
+ auto t12 = &D::a;
+ auto t13 = &C::f;
+ auto t14 = &D::f;
+ if (!std::is_corresponding_member (t11, t12))
+ __builtin_abort ();
+ if (!std::is_corresponding_member (t13, t14))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t11, t14))
+ __builtin_abort ();
+ if (std::is_corresponding_member (t13, t12))
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member8.C b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member8.C
new file mode 100644
index 0000000..1a33908
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member8.C
@@ -0,0 +1,25 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+// { dg-options "" }
+
+namespace std
+{
+template <class S1, class S2, class M1, class M2>
+constexpr bool
+is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
+{
+ return __builtin_is_corresponding_member (m1, m2);
+}
+// { dg-message "'__builtin_is_corresponding_member' not well defined for anonymous unions" "" { target *-*-* } .-2 }
+}
+
+struct A { int a; struct { short b; short c; long d; }; int : 0; int e; };
+struct B { const signed int a; struct alignas(16) { short b; signed short c; signed long d; }; volatile int e; };
+struct C { int a; union { struct { int b; long c; }; long d; short e; }; signed int f; };
+struct D { int a; union { long b; short c; struct { int d; signed long e; }; }; int f; };
+
+static_assert (std::is_corresponding_member (&A::a, &B::a));
+static_assert (!std::is_corresponding_member (&A::b, &B::b));
+static_assert (!std::is_corresponding_member (&A::c, &B::c));
+static_assert (!std::is_corresponding_member (&A::d, &B::d));
+auto a = std::is_corresponding_member (&C::a, &D::a); // { dg-message "required from here" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible1.C b/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible1.C
new file mode 100644
index 0000000..dbc2a9a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible1.C
@@ -0,0 +1,80 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <typename T, T v>
+struct integral_constant
+{
+ static constexpr T value = v;
+};
+
+template <typename, typename>
+struct is_layout_compatible;
+
+template<typename T, typename U>
+struct is_layout_compatible
+ : public integral_constant <bool, __is_layout_compatible (T, U)>
+{
+};
+
+template <typename T, typename U>
+inline constexpr bool is_layout_compatible_v = __is_layout_compatible (T, U);
+}
+
+struct A { int a; char b; };
+struct B { const int c; volatile char d; };
+struct C { int a : 1; int : 7; int : 0; int b : 2; };
+struct D { int : 1; int c : 7; int : 0; int : 2; };
+struct E { int f : 1; int : 7; int g : 2; };
+struct F { int a; signed char b; };
+union G { int a; long long b; signed char c; unsigned char d; int e; };
+union H { long long f; unsigned char g; int h; int i; signed char j; };
+struct I : public A {};
+struct J {};
+struct K : public J {};
+struct L {};
+struct M : public K, L { const int a; volatile char b; };
+struct N {};
+struct O : public N, M {};
+struct P { int a; private: int b; public: int c; };
+struct Q { int a; private: int b; public: int c; };
+union U1 { int a; private: int b; public: int c; };
+union U2 { int a; private: int b; public: int c; };
+struct S {};
+struct T {};
+struct W;
+struct X;
+enum E1 : int { E11, E12 };
+enum E2 : int { E21, E22 };
+enum E3 : long { E31, E32 };
+enum E4 { E41, E42 };
+enum E5 { E51, E52 };
+
+static_assert (std::is_layout_compatible<int, const int>::value);
+static_assert (std::is_layout_compatible_v<double, volatile double>);
+static_assert (std::is_layout_compatible_v<A, B>);
+static_assert (std::is_layout_compatible_v<C, D>);
+static_assert (!std::is_layout_compatible_v<int, unsigned int>);
+static_assert (!std::is_layout_compatible_v<A, F>);
+static_assert (std::is_layout_compatible_v<G, H>);
+static_assert (std::is_layout_compatible_v<S, T>);
+static_assert (std::is_layout_compatible_v<A[3], A[3]>);
+static_assert (std::is_layout_compatible_v<A[], A[]>);
+static_assert (!std::is_layout_compatible_v<S[1], T[1]>);
+static_assert (std::is_layout_compatible_v<W[], W[]>);
+static_assert (!std::is_layout_compatible_v<W[], X[]>);
+static_assert (!std::is_layout_compatible_v<D, E>);
+static_assert (std::is_layout_compatible_v<void, const void>);
+static_assert (std::is_layout_compatible_v<I, const A>);
+static_assert (std::is_layout_compatible_v<volatile A, const I>);
+static_assert (std::is_layout_compatible_v<M, A>);
+static_assert (std::is_layout_compatible_v<O, M>);
+static_assert (std::is_layout_compatible_v<A, O>);
+static_assert (std::is_layout_compatible_v<P, P>);
+static_assert (!std::is_layout_compatible_v<P, Q>);
+static_assert (std::is_layout_compatible_v<U1, U1>);
+static_assert (!std::is_layout_compatible_v<U1, U2>);
+static_assert (std::is_layout_compatible_v<E1, E2>);
+static_assert (!std::is_layout_compatible_v<E1, E3>);
+static_assert (std::is_layout_compatible_v<E4, E5>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible2.C b/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible2.C
new file mode 100644
index 0000000..bf902f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible2.C
@@ -0,0 +1,36 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <typename T, T v>
+struct integral_constant
+{
+ static constexpr T value = v;
+};
+
+template <typename, typename>
+struct is_layout_compatible;
+
+template<typename T, typename U>
+struct is_layout_compatible
+ : public integral_constant <bool, __is_layout_compatible (T, U)>
+{
+};
+
+template <typename T, typename U>
+inline constexpr bool is_layout_compatible_v = __is_layout_compatible (T, U);
+}
+// { dg-error "invalid use of incomplete type 'struct W'" "" { target *-*-* } .-2 }
+// { dg-error "invalid use of incomplete type 'struct \[XY]'" "" { target *-*-* } .-3 }
+// { dg-error "invalid use of incomplete type 'struct Z'" "" { target *-*-* } .-4 }
+
+struct W;
+struct X;
+struct Y;
+struct Z;
+struct A {};
+
+auto a = std::is_layout_compatible_v<W, W>;
+auto b = std::is_layout_compatible_v<X, Y>;
+auto c = std::is_layout_compatible_v<A, Z>;
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible3.C b/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible3.C
new file mode 100644
index 0000000..c548587
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-layout-compatible3.C
@@ -0,0 +1,64 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <typename T, T v>
+struct integral_constant
+{
+ static constexpr T value = v;
+};
+
+template <typename, typename>
+struct is_layout_compatible;
+
+template<typename T, typename U>
+struct is_layout_compatible
+ : public integral_constant <bool, __is_layout_compatible (T, U)>
+{
+};
+
+template <typename T, typename U>
+inline constexpr bool is_layout_compatible_v = __is_layout_compatible (T, U);
+}
+
+// Weird cases.
+struct S {};
+struct T {};
+struct I { int a; };
+struct alignas(16) J { const int b; };
+struct K { I c; int d; };
+struct L { J e; int f; };
+union M { I u; };
+union N { J v; };
+union O { int a; int b; };
+union P { int a : 1; int b : 12; };
+enum Q : int { Q1, Q2 };
+enum alignas(16) R : int { R1, R2 };
+struct U { [[no_unique_address]] S a1; [[no_unique_address]] S a2; [[no_unique_address]] S a3; };
+struct V { [[no_unique_address]] S b1; [[no_unique_address]] T b2; [[no_unique_address]] S b3; };
+struct alignas(16) A : public I {};
+struct alignas(16) B {};
+struct C : public B, public I {};
+union D { int a : 3; int b : 9; };
+struct alignas(16) E { alignas(16) int a; alignas(16) int b; };
+struct alignas(16) F { int c; alignas(16) int d; };
+union alignas(16) G { int a; alignas(16) short b; };
+union alignas(16) H { short c; int d; };
+struct A1 { int a; };
+struct B1 { signed int b; };
+struct alignas (16) C1 : public A1 {};
+struct alignas (16) D1 : public B1 {};
+
+static_assert (!std::is_layout_compatible_v<I, J>);
+static_assert (!std::is_layout_compatible_v<K, L>);
+static_assert (!std::is_layout_compatible_v<M, N>);
+static_assert (!std::is_layout_compatible_v<O, P>);
+static_assert (!std::is_layout_compatible_v<P, D>);
+static_assert (!std::is_layout_compatible_v<Q, R>);
+static_assert (!std::is_layout_compatible_v<U, V>);
+static_assert (!std::is_layout_compatible_v<A, I>);
+static_assert (!std::is_layout_compatible_v<C, I>);
+static_assert (std::is_layout_compatible_v<E, F>);
+static_assert (std::is_layout_compatible_v<G, H>);
+static_assert (std::is_layout_compatible_v<C1, D1>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-base-of1.C b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-base-of1.C
new file mode 100644
index 0000000..d94f18f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-base-of1.C
@@ -0,0 +1,55 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <typename T, T v>
+struct integral_constant
+{
+ static constexpr T value = v;
+};
+
+template <typename, typename>
+struct is_pointer_interconvertible_base_of;
+
+template<typename T, typename U>
+struct is_pointer_interconvertible_base_of
+ : public integral_constant <bool, __is_pointer_interconvertible_base_of (T, U)>
+{
+};
+
+template <typename T, typename U>
+inline constexpr bool is_pointer_interconvertible_base_of_v = __is_pointer_interconvertible_base_of (T, U);
+}
+
+struct A;
+struct B { int b; };
+struct C : virtual B { int c; };
+struct D {};
+struct E {};
+struct F : public B, D, E {};
+struct G : public D, E { int g; };
+struct H {};
+struct I : public G, H {};
+struct J { int j1; private: int j2; };
+struct K : public J {};
+union U { int a; };
+
+static_assert (std::is_pointer_interconvertible_base_of<A, A>::value);
+static_assert (std::is_pointer_interconvertible_base_of_v<A, A>);
+static_assert (std::is_pointer_interconvertible_base_of_v<const A, volatile A>);
+static_assert (std::is_pointer_interconvertible_base_of_v<B, const B>);
+static_assert (std::is_pointer_interconvertible_base_of_v<C, const volatile C>);
+static_assert (!std::is_pointer_interconvertible_base_of_v<D, E>);
+static_assert (!std::is_pointer_interconvertible_base_of_v<D, const B>);
+static_assert (std::is_pointer_interconvertible_base_of_v<const B, F>);
+static_assert (std::is_pointer_interconvertible_base_of_v<D, const F>);
+static_assert (std::is_pointer_interconvertible_base_of_v<E, F>);
+static_assert (std::is_pointer_interconvertible_base_of_v<D, volatile G>);
+static_assert (std::is_pointer_interconvertible_base_of_v<const E, volatile G>);
+static_assert (std::is_pointer_interconvertible_base_of_v<D, I>);
+static_assert (std::is_pointer_interconvertible_base_of_v<const E, const I>);
+static_assert (std::is_pointer_interconvertible_base_of_v<G, I>);
+static_assert (std::is_pointer_interconvertible_base_of_v<H, volatile I>);
+static_assert (!std::is_pointer_interconvertible_base_of_v<volatile J, const K>);
+static_assert (!std::is_pointer_interconvertible_base_of_v<U, U>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class1.C b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class1.C
new file mode 100644
index 0000000..efce355
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class1.C
@@ -0,0 +1,65 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <class S, class M>
+constexpr bool
+is_pointer_interconvertible_with_class (M S::*m) noexcept
+{
+ return __builtin_is_pointer_interconvertible_with_class (m);
+}
+}
+
+struct A;
+struct B { int b; double b2; };
+struct C : virtual B { int c; };
+struct D {};
+struct E {};
+struct F : public B, D, E {};
+struct G : public D, E { int g; };
+struct H {};
+struct I : public G, H {};
+struct J { int j1; private: int j2; public: int j3; };
+struct K : public J {};
+struct L : public B, D, E {};
+struct M { D d [[no_unique_address]]; E e [[no_unique_address]]; int f; };
+union U { int a; double b; long long c; };
+struct V { union { int a; long b; }; int c; };
+union X { int a; union { short b; long c; }; long long d; };
+struct Y { void foo () {} };
+union Z { int a; private: int b; protected: int c; public: int d; };
+
+static_assert (std::is_pointer_interconvertible_with_class (&B::b));
+static_assert (!std::is_pointer_interconvertible_with_class (&B::b2));
+static_assert (std::is_pointer_interconvertible_with_class (&C::b));
+static_assert (std::is_pointer_interconvertible_with_class (&F::b));
+static_assert (std::is_pointer_interconvertible_with_class<F, int> (&F::b));
+static_assert (std::is_pointer_interconvertible_with_class (&G::g));
+static_assert (std::is_pointer_interconvertible_with_class<G, int> (&G::g));
+static_assert (std::is_pointer_interconvertible_with_class (&I::g));
+static_assert (std::is_pointer_interconvertible_with_class<I, int> (&I::g));
+static_assert (!std::is_pointer_interconvertible_with_class (&J::j1));
+static_assert (!std::is_pointer_interconvertible_with_class (&J::j3));
+static_assert (!std::is_pointer_interconvertible_with_class (&K::j1));
+static_assert (!std::is_pointer_interconvertible_with_class (&K::j3));
+static_assert (std::is_pointer_interconvertible_with_class (&L::b));
+static_assert (std::is_pointer_interconvertible_with_class<L, int> (&L::b));
+static_assert (std::is_pointer_interconvertible_with_class (&L::b));
+static_assert (std::is_pointer_interconvertible_with_class (&M::d));
+static_assert (!std::is_pointer_interconvertible_with_class (&M::e));
+static_assert (!std::is_pointer_interconvertible_with_class (&M::f));
+static_assert (std::is_pointer_interconvertible_with_class (&U::a));
+static_assert (std::is_pointer_interconvertible_with_class (&U::b));
+static_assert (std::is_pointer_interconvertible_with_class (&U::c));
+static_assert (std::is_pointer_interconvertible_with_class (&V::a));
+static_assert (std::is_pointer_interconvertible_with_class (&V::b));
+static_assert (!std::is_pointer_interconvertible_with_class (&V::c));
+static_assert (std::is_pointer_interconvertible_with_class (&X::a));
+static_assert (std::is_pointer_interconvertible_with_class (&X::b));
+static_assert (std::is_pointer_interconvertible_with_class (&X::c));
+static_assert (std::is_pointer_interconvertible_with_class (&X::d));
+static_assert (!std::is_pointer_interconvertible_with_class ((int B::*) nullptr));
+static_assert (!std::is_pointer_interconvertible_with_class (&Y::foo));
+static_assert (std::is_pointer_interconvertible_with_class (&Z::a));
+static_assert (std::is_pointer_interconvertible_with_class (&Z::d));
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class2.C b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class2.C
new file mode 100644
index 0000000..b663a39
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class2.C
@@ -0,0 +1,135 @@
+// P0466R5
+// { dg-do run { target c++20 } }
+
+namespace std
+{
+template <class S, class M>
+constexpr bool
+is_pointer_interconvertible_with_class (M S::*m) noexcept
+{
+ return __builtin_is_pointer_interconvertible_with_class (m);
+}
+}
+
+struct A;
+struct B { int b; double b2; };
+struct C : virtual B { int c; };
+struct D {};
+struct E {};
+struct F : public B, D, E {};
+struct G : public D, E { int g; };
+struct H {};
+struct I : public G, H {};
+struct J { int j1; private: int j2; public: int j3; };
+struct K : public J {};
+struct L : public B, D, E {};
+struct M { D d [[no_unique_address]]; E e [[no_unique_address]]; int f; };
+union U { int a; double b; long long c; };
+struct V { union { int a; long b; }; int c; };
+union X { int a; union { short b; long c; }; long long d; };
+struct Y { void foo () {} };
+union Z { int a; private: int b; protected: int c; public: int d; };
+
+int
+main ()
+{
+ auto t1 = &B::b;
+ if (!std::is_pointer_interconvertible_with_class (t1))
+ __builtin_abort ();
+ auto t2 = &B::b2;
+ if (std::is_pointer_interconvertible_with_class (t2))
+ __builtin_abort ();
+ auto t3 = &C::b;
+ if (!std::is_pointer_interconvertible_with_class (t3))
+ __builtin_abort ();
+ auto t4 = &F::b;
+ if (!std::is_pointer_interconvertible_with_class (t4))
+ __builtin_abort ();
+ int F::*t5 = &F::b;
+ if (!std::is_pointer_interconvertible_with_class (t5))
+ __builtin_abort ();
+ auto t6 = &G::g;
+ if (!std::is_pointer_interconvertible_with_class (t6))
+ __builtin_abort ();
+ int G::*t7 = &G::g;
+ if (!std::is_pointer_interconvertible_with_class (t7))
+ __builtin_abort ();
+ auto t8 = &I::g;
+ if (!std::is_pointer_interconvertible_with_class (t8))
+ __builtin_abort ();
+ int I::*t9 = &I::g;
+ if (!std::is_pointer_interconvertible_with_class (t9))
+ __builtin_abort ();
+ auto t10 = &J::j1;
+ if (std::is_pointer_interconvertible_with_class (t10))
+ __builtin_abort ();
+ auto t11 = &J::j3;
+ if (std::is_pointer_interconvertible_with_class (t11))
+ __builtin_abort ();
+ auto t12 = &K::j1;
+ if (std::is_pointer_interconvertible_with_class (t12))
+ __builtin_abort ();
+ auto t13 = &K::j3;
+ if (std::is_pointer_interconvertible_with_class (t13))
+ __builtin_abort ();
+ auto t14 = &L::b;
+ if (!std::is_pointer_interconvertible_with_class (t14))
+ __builtin_abort ();
+ int L::*t15 = &L::b;
+ if (!std::is_pointer_interconvertible_with_class (t15))
+ __builtin_abort ();
+ auto t16 = &L::b;
+ if (!std::is_pointer_interconvertible_with_class (t16))
+ __builtin_abort ();
+ auto t17 = &M::d;
+ if (!std::is_pointer_interconvertible_with_class (t17))
+ __builtin_abort ();
+ auto t18 = &M::e;
+ if (std::is_pointer_interconvertible_with_class (t18))
+ __builtin_abort ();
+ auto t19 = &M::f;
+ if (std::is_pointer_interconvertible_with_class (t19))
+ __builtin_abort ();
+ auto t20 = &U::a;
+ if (!std::is_pointer_interconvertible_with_class (t20))
+ __builtin_abort ();
+ auto t21 = &U::b;
+ if (!std::is_pointer_interconvertible_with_class (t21))
+ __builtin_abort ();
+ auto t22 = &U::c;
+ if (!std::is_pointer_interconvertible_with_class (t22))
+ __builtin_abort ();
+ auto t23 = &V::a;
+ if (!std::is_pointer_interconvertible_with_class (t23))
+ __builtin_abort ();
+ auto t24 = &V::b;
+ if (!std::is_pointer_interconvertible_with_class (t24))
+ __builtin_abort ();
+ auto t25 = &V::c;
+ if (std::is_pointer_interconvertible_with_class (t25))
+ __builtin_abort ();
+ auto t26 = &X::a;
+ if (!std::is_pointer_interconvertible_with_class (t26))
+ __builtin_abort ();
+ auto t27 = &X::b;
+ if (!std::is_pointer_interconvertible_with_class (t27))
+ __builtin_abort ();
+ auto t28 = &X::c;
+ if (!std::is_pointer_interconvertible_with_class (t28))
+ __builtin_abort ();
+ auto t29 = &X::d;
+ if (!std::is_pointer_interconvertible_with_class (t29))
+ __builtin_abort ();
+ auto t30 = (int B::*) nullptr;
+ if (std::is_pointer_interconvertible_with_class (t30))
+ __builtin_abort ();
+ auto t31 = &Y::foo;
+ if (std::is_pointer_interconvertible_with_class (t31))
+ __builtin_abort ();
+ auto t32 = &Z::a;
+ if (!std::is_pointer_interconvertible_with_class (t32))
+ __builtin_abort ();
+ auto t33 = &Z::d;
+ if (!std::is_pointer_interconvertible_with_class (t33))
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class3.C b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class3.C
new file mode 100644
index 0000000..b02f1b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class3.C
@@ -0,0 +1,11 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+struct A { int a; };
+struct B;
+
+bool a = __builtin_is_pointer_interconvertible_with_class (); // { dg-error "needs a single argument" }
+bool b = __builtin_is_pointer_interconvertible_with_class (&A::a, &A::a); // { dg-error "needs a single argument" }
+bool c = __builtin_is_pointer_interconvertible_with_class (1); // { dg-error "argument is not pointer to member" }
+bool d = __builtin_is_pointer_interconvertible_with_class (1.0); // { dg-error "argument is not pointer to member" }
+bool e = __builtin_is_pointer_interconvertible_with_class ((int B::*) nullptr); // { dg-error "invalid use of incomplete type" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class4.C b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class4.C
new file mode 100644
index 0000000..e5e2451
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class4.C
@@ -0,0 +1,31 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+// { dg-options "" }
+
+namespace std
+{
+template <class S, class M>
+constexpr bool
+is_pointer_interconvertible_with_class (M S::*m) noexcept
+{
+ return __builtin_is_pointer_interconvertible_with_class (m);
+}
+}
+
+struct W { struct { int a; long b; }; int c; };
+union X { int a; struct { short b; long c; }; long long d; };
+struct D { int x; private: int y; };
+union Y { int a; struct { short b; long c; D z; }; long long d; };
+
+static_assert (std::is_pointer_interconvertible_with_class (&W::a));
+static_assert (!std::is_pointer_interconvertible_with_class (&W::b));
+static_assert (!std::is_pointer_interconvertible_with_class (&W::c));
+static_assert (std::is_pointer_interconvertible_with_class (&X::a));
+static_assert (std::is_pointer_interconvertible_with_class (&X::b));
+static_assert (!std::is_pointer_interconvertible_with_class (&X::c));
+static_assert (std::is_pointer_interconvertible_with_class (&X::d));
+static_assert (std::is_pointer_interconvertible_with_class (&Y::a));
+static_assert (!std::is_pointer_interconvertible_with_class (&Y::b));
+static_assert (!std::is_pointer_interconvertible_with_class (&Y::c));
+static_assert (!std::is_pointer_interconvertible_with_class (&Y::z));
+static_assert (std::is_pointer_interconvertible_with_class (&Y::d));
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class5.C b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class5.C
new file mode 100644
index 0000000..246ff92
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class5.C
@@ -0,0 +1,59 @@
+// P0466R5
+// { dg-do run { target c++20 } }
+// { dg-options "" }
+
+namespace std
+{
+template <class S, class M>
+constexpr bool
+is_pointer_interconvertible_with_class (M S::*m) noexcept
+{
+ return __builtin_is_pointer_interconvertible_with_class (m);
+}
+}
+
+struct W { struct { int a; long b; }; int c; };
+union X { int a; struct { short b; long c; }; long long d; };
+struct D { int x; private: int y; };
+union Y { int a; struct { short b; long c; D z; }; long long d; };
+
+int
+main ()
+{
+ auto t1 = &W::a;
+ if (!std::is_pointer_interconvertible_with_class (t1))
+ __builtin_abort ();
+ auto t2 = &W::b;
+ if (std::is_pointer_interconvertible_with_class (t2))
+ __builtin_abort ();
+ auto t3 = &W::c;
+ if (std::is_pointer_interconvertible_with_class (t3))
+ __builtin_abort ();
+ auto t4 = &X::a;
+ if (!std::is_pointer_interconvertible_with_class (t4))
+ __builtin_abort ();
+ auto t5 = &X::b;
+ if (!std::is_pointer_interconvertible_with_class (t5))
+ __builtin_abort ();
+ auto t6 = &X::c;
+ if (std::is_pointer_interconvertible_with_class (t6))
+ __builtin_abort ();
+ auto t7 = &X::d;
+ if (!std::is_pointer_interconvertible_with_class (t7))
+ __builtin_abort ();
+ auto t8 = &Y::a;
+ if (!std::is_pointer_interconvertible_with_class (t8))
+ __builtin_abort ();
+ auto t9 = &Y::b;
+ if (std::is_pointer_interconvertible_with_class (t9))
+ __builtin_abort ();
+ auto t10 = &Y::c;
+ if (std::is_pointer_interconvertible_with_class (t10))
+ __builtin_abort ();
+ auto t11 = &Y::z;
+ if (std::is_pointer_interconvertible_with_class (t11))
+ __builtin_abort ();
+ auto t12 = &Y::d;
+ if (!std::is_pointer_interconvertible_with_class (t12))
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class6.C b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class6.C
new file mode 100644
index 0000000..4b6801c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class6.C
@@ -0,0 +1,19 @@
+// P0466R5
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+template <class S, class M>
+constexpr bool
+is_pointer_interconvertible_with_class (M S::*m) noexcept
+{
+ return __builtin_is_pointer_interconvertible_with_class (m);
+}
+}
+
+struct A { int a; };
+
+double A::*a = nullptr;
+constexpr double A::*b = nullptr;
+constexpr auto c = std::is_pointer_interconvertible_with_class (a); // { dg-error "is not usable in a constant expression" }
+constexpr auto d = std::is_pointer_interconvertible_with_class (b);
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C b/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C
new file mode 100644
index 0000000..3ee500e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C
@@ -0,0 +1,27 @@
+// PR c++/97938
+// { dg-do compile { target c++20 } }
+
+template <typename... Args>
+int sink(Args&&... args) { return 2; }
+
+auto fwd1(const auto&&... ts1) {
+ return
+ [...ts1 = ts1] {
+ return sink(ts1...);
+ }();
+}
+
+template <typename T1>
+auto fwd2(const T1& t1) {
+ return
+ [] (auto&&... ts1) {
+ return
+ [...ts1 = ts1] {
+ return sink(ts1...);
+ }();
+ }();
+}
+
+int main() {
+ return fwd1() + fwd2(1);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C
new file mode 100644
index 0000000..a180359
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C
@@ -0,0 +1,6 @@
+// PR c++/99478
+// { dg-do compile { target c++20 } }
+
+template <decltype ([] {})> auto f() {} // { dg-error "lambda" }
+
+int main() { f<{}>(); } // { dg-prune-output "no match" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C
new file mode 100644
index 0000000..ae72ea3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C
@@ -0,0 +1,5 @@
+// PR c++/100091
+// { dg-do compile { target c++20 } }
+
+template<typename = decltype([]{})>
+void f() {}
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval16.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval16.C
new file mode 100644
index 0000000..1113c6f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval16.C
@@ -0,0 +1,22 @@
+// PR c++/101181
+// { dg-do compile { target c++20 } }
+
+template<class T,
+ bool = [] () -> bool {
+ if constexpr (requires { typename T::type; })
+ return true;
+ return false;
+ }()>
+struct p { using type = void; };
+
+template<class T>
+struct p<T, true> { using type = typename T::type; };
+
+template<class T> using P = typename p<T>::type;
+
+using type1 = P<int>;
+using type = void;
+
+struct A { using type = char; };
+using type2 = P<A>;
+using type2 = char;
diff --git a/gcc/testsuite/g++.dg/cpp2a/no_unique_address13.C b/gcc/testsuite/g++.dg/cpp2a/no_unique_address13.C
new file mode 100644
index 0000000..66b83d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/no_unique_address13.C
@@ -0,0 +1,24 @@
+// PR c++/101040
+// { dg-do compile { target c++11 } }
+
+// This class has to be empty.
+struct empty
+{};
+
+// This class has to be empty.
+struct single
+{
+ // This member has to be no_unique_address.
+ [[no_unique_address]] empty obj;
+};
+
+// This class has to be empty and derived from single.
+struct derived : single
+{
+ // This constructor has to be constexpr and take a forwarding reference.
+ template <typename Arg>
+ constexpr derived(Arg&& arg) : single{arg}
+ {}
+};
+
+auto obj = derived{empty{}};
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C
deleted file mode 100644
index 038d46f..0000000
--- a/gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C
+++ /dev/null
@@ -1,25 +0,0 @@
-// { dg-do compile { target c++20 } }
-
-template <auto N> struct A {};
-template <class,class> struct assert_same;
-template <class T> struct assert_same<T,T> {};
-
-#define TEQ(X,Y) static_assert(__is_same(A<(X)>,A<(Y)>))
-#define TNEQ(X,Y) static_assert(!__is_same(A<(X)>,A<(Y)>))
-
-union U {
- int i; int j;
- constexpr U(int i): i(i) {}
- constexpr U(unsigned u): j(u) {}
-};
-
-TEQ(U(0),U(0));
-
-// Calling the other constructor initializes a different member with the same
-// value. We need to distinguish these.
-TNEQ(U(0),U(0u));
-
-// { dg-final { scan-assembler "_Z1f1AIXtl1Udi1iLi0EEEE" } }
-void f(A<U(0)>) { }
-// { dg-final { scan-assembler "_Z1g1AIXtl1Udi1jLi0EEEE" } }
-void g(A<U(0u)>) { }
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C
index 038d46f..df91325 100644
--- a/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C
@@ -19,7 +19,7 @@ TEQ(U(0),U(0));
// value. We need to distinguish these.
TNEQ(U(0),U(0u));
-// { dg-final { scan-assembler "_Z1f1AIXtl1Udi1iLi0EEEE" } }
+// { dg-final { scan-assembler "_Z1f1AIXtl1UEEE" } }
void f(A<U(0)>) { }
// { dg-final { scan-assembler "_Z1g1AIXtl1Udi1jLi0EEEE" } }
void g(A<U(0u)>) { }
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C
index f5f79a7..9b4da4f 100644
--- a/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C
@@ -1,6 +1,5 @@
// PR c++/89565
// { dg-do compile { target c++20 } }
-// { dg-ice "resolve_args" }
template <auto>
struct N{};
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class42.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class42.C
new file mode 100644
index 0000000..c2e04b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class42.C
@@ -0,0 +1,8 @@
+// PR c++/99586
+// { dg-do compile { target c++20 } }
+
+template <class T>
+struct B { constexpr B(T); };
+
+template <auto> struct A{};
+template <auto V> auto a = A<B{V}>{};
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class43.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class43.C
new file mode 100644
index 0000000..f51684f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class43.C
@@ -0,0 +1,11 @@
+// PR c++/97134
+// { dg-do compile { target c++20 } }
+
+template<typename T>
+struct templ {};
+
+template<templ... Vs>
+struct wrapper {};
+
+template<templ... Vs> requires true
+struct wrapper<Vs...> {};
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class44.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class44.C
new file mode 100644
index 0000000..0316f79
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class44.C
@@ -0,0 +1,25 @@
+// PR c++/100079
+// { dg-do compile { target c++20 } }
+
+template <auto value>
+struct Foo {
+ using SomeTypeAlias = int;
+
+ Foo() {}
+};
+
+template <class T>
+struct Bar {
+ T value;
+
+ constexpr Bar(const T& value)
+ : value{value}
+ {}
+};
+
+template <int N>
+struct Baz {};
+
+constexpr auto baz = Baz<42>{};
+
+const Foo<Bar<Baz<42>>{baz}> test{};
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class45.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class45.C
new file mode 100644
index 0000000..e7addf5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class45.C
@@ -0,0 +1,32 @@
+// PR c++/99200
+// { dg-do compile { target c++20 } }
+
+template <int N>
+struct A
+{
+ constexpr A (const char (&s)[N]) { for (int i = 0; i < N; i++) v[i] = s[i]; v[N] = 0; }
+ char v[N + 1];
+};
+
+template <A s>
+struct B
+{
+ constexpr operator const char *() { return s.v; }
+};
+
+template <typename T>
+const char *
+foo ()
+{
+ return B<__PRETTY_FUNCTION__>{};
+}
+
+template <typename T>
+const char *
+bar ()
+{
+ return B<__FUNCTION__>{};
+}
+
+auto a = foo <int> ();
+auto b = bar <double> ();
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class46.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class46.C
new file mode 100644
index 0000000..d91e800
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class46.C
@@ -0,0 +1,11 @@
+// PR c++/93383
+// { dg-do compile { target c++20 } }
+
+template <int> struct A {};
+
+template <A a> struct B {
+ void foo(B<+a>);
+ void bar(B<a.x>);
+ template <class T> using type = B<T{}>;
+ template <class> static inline auto y = A{0}; // { dg-error "deduction|no match" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class47.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class47.C
new file mode 100644
index 0000000..1f31b9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class47.C
@@ -0,0 +1,11 @@
+// PR c++/95291
+// { dg-do compile { target c++20 } }
+
+template <typename T = int>
+class xy { };
+
+template <xy _size>
+struct window_root { };
+
+template <typename minion>
+struct flip_horizontally : window_root<minion::size> { };
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class48.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class48.C
new file mode 100644
index 0000000..9024436
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class48.C
@@ -0,0 +1,36 @@
+// PR c++/99683
+// { dg-do compile { target c++20 } }
+
+template<auto V>
+struct nttp_tag {};
+
+template<typename T>
+struct type_tag {};
+
+
+/************************************************/
+template<bool is_type>
+struct use_ctad
+{
+ template<auto V> requires (!is_type)
+ constexpr use_ctad(nttp_tag<V>) {}
+};
+
+template<auto V>
+use_ctad(nttp_tag<V>) -> use_ctad<false>;
+
+/**********************************************/
+template<use_ctad t>
+struct wrapper
+{
+ template<typename Tag>
+ wrapper(Tag);
+};
+
+template<typename Tag>
+wrapper(Tag) -> wrapper<use_ctad{Tag()}>;
+
+int main()
+{
+ wrapper t{nttp_tag<42>{}};
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class49.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class49.C
new file mode 100644
index 0000000..c83e407
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class49.C
@@ -0,0 +1,8 @@
+// PR c++/101883
+// { dg-do compile { target c++20 } }
+
+template<class T> struct C { constexpr C(int) { } };
+explicit C(int) -> C<int>;
+
+template<C c> struct X { };
+X<1> x; // { dg-error "deduction|no match" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-complex1.C b/gcc/testsuite/g++.dg/cpp2a/nontype-complex1.C
new file mode 100644
index 0000000..4de2168
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-complex1.C
@@ -0,0 +1,8 @@
+// PR c++/100634
+// { dg-do compile { target c++20 } }
+// { dg-options "" }
+
+// We could support _Complex template arguments, but better I think to make
+// people use a standard type instead.
+template<_Complex int> struct ComplexInt {}; // { dg-error "not a valid type" }
+using CI = ComplexInt<1 + 3i>;
diff --git a/gcc/testsuite/g++.dg/cpp2a/pr99833.C b/gcc/testsuite/g++.dg/cpp2a/pr99833.C
new file mode 100644
index 0000000..3323053
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/pr99833.C
@@ -0,0 +1,18 @@
+// PR c++/99833
+// { dg-do compile { target c++20 } }
+
+#include <tuple>
+
+auto f(auto&& x)
+{
+ [&](auto...) {
+ auto y = std::tuple{ "what's happening here?", x };
+ if constexpr (auto [_, z] = y; requires { z; })
+ return;
+ }();
+}
+
+int main()
+{
+ f(42);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C
new file mode 100644
index 0000000..57fbdb33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C
@@ -0,0 +1,20 @@
+// PR c++/97121
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+class MyClass
+{
+ int mValue; // { dg-error "three-way comparison of 'MyClass::mValue' has type 'std::strong_ordering', which does not convert to 'bool'" }
+
+public:
+ MyClass(int value): mValue(value) {}
+
+ bool operator<=>(const MyClass&) const = default;
+};
+
+int main()
+{
+ MyClass a = 10, b = 15;
+ return (a < b); // { dg-error "use of deleted function 'constexpr bool MyClass::operator<=>\\\(const MyClass&\\\) const'" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-err7.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-err7.C
new file mode 100644
index 0000000..bc30923
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-err7.C
@@ -0,0 +1,14 @@
+// PR c++/99701
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+decltype(nullptr) foo ();
+
+auto b0 = nullptr <=> nullptr; // { dg-error "ordered comparison" }
+auto b1 = 0 <=> nullptr; // { dg-error "ordered comparison" }
+auto b2 = nullptr <=> 0; // { dg-error "ordered comparison" }
+auto b3 = foo () <=> 0; // { dg-error "ordered comparison" }
+auto b4 = 0 <=> foo (); // { dg-error "ordered comparison" }
+auto b5 = foo () <=> nullptr; // { dg-error "ordered comparison" }
+auto b6 = nullptr <=> foo (); // { dg-error "ordered comparison" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-fallback1.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-fallback1.C
new file mode 100644
index 0000000..5ce4949
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-fallback1.C
@@ -0,0 +1,17 @@
+// PR c++/100367
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+struct iter {
+ bool current;
+ iter(iter &);
+};
+
+constexpr bool operator==(const iter &, const iter &y) {
+ return y.current;
+}
+
+void lexicographical_compare_three_way(iter a) {
+ (a == a) <=> true;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg6.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg6.C
new file mode 100644
index 0000000..d3f95e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg6.C
@@ -0,0 +1,11 @@
+// PR c++/94162
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+struct S {
+ int a; // { dg-error "three-way comparison of 'S::a' has type 'std::strong_ordering', which does not convert to 'int\\*'" }
+ int *operator<=>(const S&) const = default;
+};
+
+bool b = S{} < S{}; // { dg-error "use of deleted function 'constexpr int\\* S::operator<=>\\\(const S&\\\) const'" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth11.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth11.C
new file mode 100644
index 0000000..37c8157
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth11.C
@@ -0,0 +1,29 @@
+// PR c++/99429
+// { dg-do compile { target c++20 } }
+
+namespace std {
+struct strong_ordering {
+ int _v;
+ constexpr strong_ordering (int v) :_v(v) {}
+ constexpr operator int (void) const { return _v; }
+ static const strong_ordering less;
+ static const strong_ordering equal;
+ static const strong_ordering greater;
+};
+constexpr strong_ordering strong_ordering::less = -1;
+constexpr strong_ordering strong_ordering::equal = 0;
+constexpr strong_ordering strong_ordering::greater = 1;
+}
+
+template <unsigned long N>
+struct duration {
+ static constexpr const long period = N;
+ constexpr duration (void) = default;
+ constexpr duration (const duration& d) = default;
+ constexpr bool operator== (const duration& d) const = default;
+ constexpr bool operator<=> (const duration& d) const = default;
+ long _d;
+};
+
+using nanoseconds = duration<1>;
+using microseconds = duration<nanoseconds::period * 1000>;
diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc1.C b/gcc/testsuite/g++.dg/cpp2a/srcloc1.C
index 029a037..2e97974 100644
--- a/gcc/testsuite/g++.dg/cpp2a/srcloc1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/srcloc1.C
@@ -80,7 +80,7 @@ constexpr source_location s2 = baz <1> ();
const source_location *p1 = &s1;
const source_location *p2 = &s2;
static_assert (source_location::current ().line () == __LINE__);
-static_assert (source_location::current ().column () == 42);
+static_assert (source_location::current ().column () == 41);
constexpr bool
quux ()
@@ -106,7 +106,7 @@ quux ()
return false;
if (line1 != line2)
return false;
- if (column != 33)
+ if (column != 32)
return false;
return true;
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc15.C b/gcc/testsuite/g++.dg/cpp2a/srcloc15.C
index d02617e..3bb3958 100644
--- a/gcc/testsuite/g++.dg/cpp2a/srcloc15.C
+++ b/gcc/testsuite/g++.dg/cpp2a/srcloc15.C
@@ -69,8 +69,8 @@ bar ()
source_location a = foo ();
source_location b = source_location::current ();
source_location c = foo ();
- // ^ column 28
- // ^ column 49
+ // ^ column 27
+ // ^ column 48
const source_location *d[3] = { &a, &b, &c };
const char *file1 = __FILE__;
const char *function1 = __PRETTY_FUNCTION__;
@@ -83,7 +83,7 @@ bar ()
return false;
if (d[j]->line () != line + j + 1)
return false;
- if (d[j]->column () != (j == 1 ? 49 : 28))
+ if (d[j]->column () != (j == 1 ? 48 : 27))
return false;
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc16.C b/gcc/testsuite/g++.dg/cpp2a/srcloc16.C
index c8bd281..0ecd636 100644
--- a/gcc/testsuite/g++.dg/cpp2a/srcloc16.C
+++ b/gcc/testsuite/g++.dg/cpp2a/srcloc16.C
@@ -79,10 +79,10 @@ foo ()
|| u.u.line () + 1 != v.line ()
|| s.a.column () != 18
|| s.b.column () != 18
- || s.c.column () != 50
+ || s.c.column () != 49
|| t.u.column () != 21
|| u.u.column () != 13
- || v.column () != 49)
+ || v.column () != 48)
return false;
return true;
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc19.C b/gcc/testsuite/g++.dg/cpp2a/srcloc19.C
new file mode 100644
index 0000000..b7e8c37
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/srcloc19.C
@@ -0,0 +1,44 @@
+// PR c++/99672
+// { dg-do compile { target c++20 } }
+
+namespace std {
+ struct source_location {
+ struct __impl {
+ const char *_M_file_name;
+ const char *_M_function_name;
+ unsigned int _M_line, _M_column;
+ };
+ const __impl *__ptr;
+ constexpr source_location () : __ptr (nullptr) {}
+ static consteval source_location
+ current (const void *__p = __builtin_source_location ()) {
+ source_location __ret;
+ __ret.__ptr = static_cast <const __impl *> (__p);
+ return __ret;
+ }
+ constexpr const char *file_name () const {
+ return __ptr ? __ptr->_M_file_name : "";
+ }
+ constexpr const char *function_name () const {
+ return __ptr ? __ptr->_M_function_name : "";
+ }
+ constexpr unsigned line () const {
+ return __ptr ? __ptr->_M_line : 0;
+ }
+ constexpr unsigned column () const {
+ return __ptr ? __ptr->_M_column : 0;
+ }
+ };
+}
+
+constexpr int g(auto...) {
+return std::source_location::current().column();
+}
+
+constexpr int f() {
+return std::source_location::current().column();
+}
+
+constexpr int a = g();
+constexpr int b = f();
+static_assert (a == b);
diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc2.C b/gcc/testsuite/g++.dg/cpp2a/srcloc2.C
index 4e0b960..3f91a64 100644
--- a/gcc/testsuite/g++.dg/cpp2a/srcloc2.C
+++ b/gcc/testsuite/g++.dg/cpp2a/srcloc2.C
@@ -84,7 +84,7 @@ const source_location *p1 = &s1;
const source_location *p2 = &s2;
static_assert (source_location::current ().line () == __LINE__);
-static_assert (source_location::current ().column () == 42);
+static_assert (source_location::current ().column () == 41);
constexpr bool
quux ()
@@ -110,7 +110,7 @@ quux ()
return false;
if (line1 != line2)
return false;
- if (column != 33)
+ if (column != 32)
return false;
return true;
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/typename14.C b/gcc/testsuite/g++.dg/cpp2a/typename14.C
index 8d82b6b..ba7dad8 100644
--- a/gcc/testsuite/g++.dg/cpp2a/typename14.C
+++ b/gcc/testsuite/g++.dg/cpp2a/typename14.C
@@ -8,7 +8,7 @@ template<typename> struct A
template<typename T>
template<typename U>
-A<T>::A<U> () // { dg-error "partial specialization" }
+A<T>::A<U> () // { dg-error "" }
{
}
@@ -19,7 +19,7 @@ template<typename> struct B
template<typename T>
template<typename U>
-B<T>::foo<int>(int) // { dg-error "partial specialization|declaration" }
+B<T>::foo<int>(int) // { dg-error "" }
{
return 1;
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/typename19.C b/gcc/testsuite/g++.dg/cpp2a/typename19.C
new file mode 100644
index 0000000..320a14d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/typename19.C
@@ -0,0 +1,5 @@
+// PR c++/99803
+// { dg-do compile { target c++20 } }
+
+struct A { template<typename T> A(T); };
+auto A(unsigned) -> A::template A<int>; // { dg-error "not a type" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/using-enum-9.C b/gcc/testsuite/g++.dg/cpp2a/using-enum-9.C
new file mode 100644
index 0000000..3e02605
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/using-enum-9.C
@@ -0,0 +1,28 @@
+// PR c++/100862
+// { dg-do compile { target c++20 } }
+
+enum class fruit { orange, apple };
+
+struct A {
+public:
+ using enum fruit;
+private:
+};
+
+struct B {
+protected:
+ using enum fruit;
+public:
+};
+
+struct C {
+private:
+ using enum fruit;
+public:
+};
+
+int main() {
+ A::orange, A::apple;
+ B::orange, B::apple; // { dg-error "protected" }
+ C::orange, C::apple; // { dg-error "private" }
+}
diff --git a/gcc/testsuite/g++.dg/debug/cleanup1.C b/gcc/testsuite/g++.dg/debug/cleanup1.C
new file mode 100644
index 0000000..ae0515a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/cleanup1.C
@@ -0,0 +1,41 @@
+// PR c++/88742
+// { dg-additional-options -fdump-tree-gimple-lineno }
+
+
+class C {
+public:
+ C() {}
+ ~C() {}
+ operator int() { return 1; }
+};
+
+int main() {
+ C a;
+ C b;
+ C c;
+
+ if (C e = C())
+ {
+ if (C d = C())
+ {
+ }
+ else
+ {
+ return 42;
+ } // { dg-final { scan-tree-dump-times ":25:9. C::~C" 1 "gimple" } }
+ } // { dg-final { scan-tree-dump-times ":26:5. C::~C" 1 "gimple" } }
+
+ while (C f = C())
+ {
+ break;
+ } // { dg-final { scan-tree-dump-times ":31:5. C::~C" 1 "gimple" } }
+
+ for (C h = C(); C i = C(); )
+ break; // { dg-final { scan-tree-dump-times ":34:10. C::~C" 2 "gimple" } }
+
+ switch (C g = C())
+ {
+ default:
+ break;
+ } // { dg-final { scan-tree-dump-times ":40:5. C::~C" 1 "gimple" } }
+} // { dg-final { scan-tree-dump-times ":41:1. C::~C" 3 "gimple" } }
diff --git a/gcc/testsuite/g++.dg/debug/defaulted1.C b/gcc/testsuite/g++.dg/debug/defaulted1.C
new file mode 100644
index 0000000..3ea7ae7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/defaulted1.C
@@ -0,0 +1,10 @@
+// PR c++/90674
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct C {
+ C() {}
+};
+
+template<>
+C<int>::C() = default;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/deallocator.C b/gcc/testsuite/g++.dg/debug/dwarf2/deallocator.C
index d895e78..c1d3879 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/deallocator.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/deallocator.C
@@ -29,7 +29,7 @@ void foo(int i)
return;
}
}
- if (i)
+ if (i) // Threader makes everything after here disappear.
{
t test;
if (i == 10)
@@ -42,5 +42,4 @@ void foo(int i)
}
// { dg-final { scan-assembler "deallocator.C:29" } }
// { dg-final { scan-assembler "deallocator.C:24" } }
-// { dg-final { scan-assembler "deallocator.C:34" } }
// { dg-final { scan-assembler "deallocator.C:21" } }
diff --git a/gcc/testsuite/g++.dg/dfp/mangle-6.C b/gcc/testsuite/g++.dg/dfp/mangle-6.C
new file mode 100644
index 0000000..9cfb2a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/dfp/mangle-6.C
@@ -0,0 +1,19 @@
+// PR c++/100261
+// { dg-do compile }
+
+#include <typeinfo>
+
+namespace std {
+ namespace decimal {
+ class decimal32 {
+ float private__decfloat32;
+ };
+ }
+}
+
+void
+foo ()
+{
+ typeid (float);
+ typeid (std::decimal::decimal32);
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/auto1.C b/gcc/testsuite/g++.dg/diagnostic/auto1.C
index ee2eefd..9d9979e 100644
--- a/gcc/testsuite/g++.dg/diagnostic/auto1.C
+++ b/gcc/testsuite/g++.dg/diagnostic/auto1.C
@@ -1,4 +1,5 @@
// PR c++/86915
// { dg-do compile { target c++17 } }
+// Allowed since DR2397.
-template<auto [1]> struct S; // { dg-error "creating array of .auto." }
+template<auto [1]> struct S;
diff --git a/gcc/testsuite/g++.dg/diagnostic/enum3.C b/gcc/testsuite/g++.dg/diagnostic/enum3.C
new file mode 100644
index 0000000..d51aa8a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/enum3.C
@@ -0,0 +1,9 @@
+// PR c++/100879
+// { dg-additional-options -Werror=sign-compare }
+
+enum e1 { e1val };
+enum e2 { e3val };
+
+int main( int, char * [] ) {
+ if ( e1val == e3val ) return 1; // { dg-warning -Wenum-compare }
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/maybe_unused1.C b/gcc/testsuite/g++.dg/diagnostic/maybe_unused1.C
new file mode 100644
index 0000000..70a8ec9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/maybe_unused1.C
@@ -0,0 +1,17 @@
+/* [dcl.attr.unused] The attribute may be applied to the declaration of a
+ class, a typedef-name, a variable (including a structured binding
+ declaration), a non-static data member, a function, an enumeration, or an
+ enumerator. */
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wunused -Wextra" }
+
+class [[maybe_unused]] Test {
+ [[maybe_unused]] int a_;
+ void b() {};
+};
+
+[[maybe_unused]] typedef Test Test2;
+
+[[maybe_unused]] int i;
+[[maybe_unused]] void f();
+enum [[maybe_unused]] E { e [[maybe_unused]] = 42 };
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr100716-1.C b/gcc/testsuite/g++.dg/diagnostic/pr100716-1.C
new file mode 100644
index 0000000..93490da
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr100716-1.C
@@ -0,0 +1,54 @@
+// { dg-options "-fno-pretty-templates" }
+
+template<typename T>
+ struct A
+ {
+ template<typename U>
+ void f() {} // { dg-line Af }
+
+ template<typename U>
+ void g(U) {} // { dg-line Ag }
+ };
+
+template<typename T>
+ struct B
+ {
+ template<typename U>
+ void f(U) {} // { dg-line Bf }
+
+ template<typename U>
+ void g(U, T) {} // { dg-line Bg }
+ };
+
+struct C
+{
+ template<typename U>
+ void f(U) {} // { dg-line Cf }
+
+ template<typename U>
+ void g() {} // { dg-line Cg }
+};
+
+int main()
+{
+ A<int>().f(0); // { dg-error "no matching function for call to 'A<int>::f\\(int\\)'" }
+ // { dg-message "candidate: 'template<class U> void A<int>::f\\(\\)'" "" { target *-*-* } Af }
+
+ A<int>().g(); // { dg-error "no matching function for call to 'A<int>::g\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void A<int>::g\\(U\\)'" "" { target *-*-* } Ag }
+
+ B<int>().f(); // { dg-error "no matching function for call to 'B<int>::f\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void B<int>::f\\(U\\)'" "" { target *-*-* } Bf }
+
+ B<int>().g(); // { dg-error "no matching function for call to 'B<int>::g\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void B<int>::g\\(U, int\\)'" "" { target *-*-* } Bg }
+
+ B<float>().g(0); // { dg-error "no matching function for call to 'B<float>::g\\(int\\)'" }
+ // { dg-message "candidate: 'template<class U> void B<float>::g\\(U, float\\)'" "" { target *-*-* } Bg }
+
+ C().f(); // { dg-error "no matching function for call to 'C::f\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void C::f\\(U\\)'" "" { target *-*-* } Cf }
+
+ C().g(0); // { dg-error "no matching function for call to 'C::g\\(int\\)'" }
+ // { dg-message "candidate: 'template<class U> void C::g\\(\\)'" "" { target *-*-* } Cg }
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr100716.C b/gcc/testsuite/g++.dg/diagnostic/pr100716.C
new file mode 100644
index 0000000..4a1f0a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr100716.C
@@ -0,0 +1,54 @@
+// { dg-options "-fpretty-templates" }
+
+template<typename T>
+ struct A
+ {
+ template<typename U>
+ void f() {} // { dg-line Af }
+
+ template<typename U>
+ void g(U) {} // { dg-line Ag }
+ };
+
+template<typename T>
+ struct B
+ {
+ template<typename U>
+ void f(U) {} // { dg-line Bf }
+
+ template<typename U>
+ void g(U, T) {} // { dg-line Bg }
+ };
+
+struct C
+{
+ template<typename U>
+ void f(U) {} // { dg-line Cf }
+
+ template<typename U>
+ void g() {} // { dg-line Cg }
+};
+
+int main()
+{
+ A<int>().f(0); // { dg-error "no matching function for call to 'A<int>::f\\(int\\)'" }
+ // { dg-message "candidate: 'template<class U> void A<T>::f\\(\\) \\\[with T = int\\\]'" "" { target *-*-* } Af }
+
+ A<int>().g(); // { dg-error "no matching function for call to 'A<int>::g\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void A<T>::g\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Ag }
+
+ B<int>().f(); // { dg-error "no matching function for call to 'B<int>::f\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void B<T>::f\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Bf }
+
+ B<int>().g(); // { dg-error "no matching function for call to 'B<int>::g\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = int\\\]'" "" { target *-*-* } Bg }
+
+ B<float>().g(0); // { dg-error "no matching function for call to 'B<float>::g\\(int\\)'" }
+ // { dg-message "candidate: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = float\\\]'" "" { target *-*-* } Bg }
+
+ C().f(); // { dg-error "no matching function for call to 'C::f\\(\\)'" }
+ // { dg-message "candidate: 'template<class U> void C::f\\(U\\)'" "" { target *-*-* } Cf }
+
+ C().g(0); // { dg-error "no matching function for call to 'C::g\\(int\\)'" }
+ // { dg-message "candidate: 'template<class U> void C::g\\(\\)'" "" { target *-*-* } Cg }
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C b/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C
index bb1327f..9f9b77a 100644
--- a/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C
+++ b/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C
@@ -19,7 +19,7 @@ void f2(T)
{ }
template<typename T>
-requires (sizeof(T)==1) // dg-message {\[with T = int \(X::\*\)\[5\]\]} }
+requires (sizeof(T)==1) // { dg-message {\[with T = int \(X::\*\)\[5\]\]} }
void f3(T)
{ }
diff --git a/gcc/testsuite/g++.dg/diagnostic/static_assert4.C b/gcc/testsuite/g++.dg/diagnostic/static_assert4.C
new file mode 100644
index 0000000..c539016
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/static_assert4.C
@@ -0,0 +1,30 @@
+// PR c++/92193
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+ struct has_foo
+ { static constexpr bool value = false; };
+
+template<typename T>
+#ifndef NO_CONSTEXPR
+ constexpr
+#endif
+ bool
+ foo(T t) noexcept(noexcept(t.foo()))
+ { return t.foo(); }
+
+template<typename T>
+ void
+ maybe_foo(T t)
+ {
+ static_assert( has_foo<T>::value, "has foo" ); // { dg-error "has foo" }
+ foo(t);
+ }
+
+struct X { };
+
+int main()
+{
+ X x;
+ maybe_foo(x);
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/string-literal-concat.C b/gcc/testsuite/g++.dg/diagnostic/string-literal-concat.C
index 4ede799..326520e 100644
--- a/gcc/testsuite/g++.dg/diagnostic/string-literal-concat.C
+++ b/gcc/testsuite/g++.dg/diagnostic/string-literal-concat.C
@@ -1,12 +1,12 @@
/* { dg-options "-fdiagnostics-show-caret -std=c++11" } */
-const void *s = u8"a" u"b"; // { dg-error "24: non-standard concatenation" }
+const void *s = u8"a" u"b"; // { dg-error "24: concatenation" }
/* { dg-begin-multiline-output "" }
const void *s = u8"a" u"b";
~~~~~ ^~~~
{ dg-end-multiline-output "" } */
-const void *s2 = u"a" u"b" u8"c"; // { dg-error "30: non-standard concatenation" }
+const void *s2 = u"a" u"b" u8"c"; // { dg-error "30: concatenation" }
/* { dg-begin-multiline-output "" }
const void *s2 = u"a" u"b" u8"c";
~~~~ ^~~~~
@@ -16,7 +16,7 @@ const void *s2 = u"a" u"b" u8"c"; // { dg-error "30: non-standard concatenati
const void *s3 = TEST_U8_LITERAL u8"b";
-const void *s4 = TEST_U8_LITERAL u"b"; // { dg-error "34: non-standard concatenation" }
+const void *s4 = TEST_U8_LITERAL u"b"; // { dg-error "34: concatenation" }
/* { dg-begin-multiline-output "" }
const void *s4 = TEST_U8_LITERAL u"b";
^~~~
diff --git a/gcc/testsuite/g++.dg/expr/ptr-comp4.C b/gcc/testsuite/g++.dg/expr/ptr-comp4.C
new file mode 100644
index 0000000..da49518
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/ptr-comp4.C
@@ -0,0 +1,21 @@
+// PR c++/99701
+// DR 1512
+// { dg-do compile { target c++11 } }
+
+/* Relational comparisons between null pointer constants and pointers are
+ ill-formed. */
+
+decltype(nullptr) foo ();
+
+auto lt = nullptr < nullptr; // { dg-error "ordered comparison" }
+auto gt = nullptr > nullptr; // { dg-error "ordered comparison" }
+auto le = nullptr <= nullptr; // { dg-error "ordered comparison" }
+auto ge = nullptr >= nullptr; // { dg-error "ordered comparison" }
+auto eq = nullptr == nullptr;
+auto ne = nullptr != nullptr;
+auto a1 = nullptr > 0; // { dg-error "ordered comparison" }
+auto a2 = 0 < nullptr; // { dg-error "ordered comparison" }
+auto a3 = foo () > 0; // { dg-error "ordered comparison" }
+auto a4 = 0 < foo (); // { dg-error "ordered comparison" }
+auto a5 = 0 <= foo (); // { dg-error "ordered comparison" }
+auto a6 = foo () >= 0; // { dg-error "ordered comparison" }
diff --git a/gcc/testsuite/g++.dg/ext/anon-struct8.C b/gcc/testsuite/g++.dg/ext/anon-struct8.C
new file mode 100644
index 0000000..f4e3f11
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/anon-struct8.C
@@ -0,0 +1,9 @@
+// { dg-options "" }
+
+struct A { };
+struct B {
+ struct: A { int i; }; // { dg-error "anonymous struct with base" }
+};
+union U {
+ struct: A { int i; }; // { dg-error "anonymous struct with base" }
+};
diff --git a/gcc/testsuite/g++.dg/ext/anon-struct9.C b/gcc/testsuite/g++.dg/ext/anon-struct9.C
new file mode 100644
index 0000000..5675942
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/anon-struct9.C
@@ -0,0 +1,9 @@
+// PR c++/96636
+// { dg-options "" }
+
+typedef class {
+ class a {};
+ class : virtual a {}; // { dg-error "anonymous struct with base" }
+} b;
+void foo(){ b();}
+
diff --git a/gcc/testsuite/g++.dg/ext/array4.C b/gcc/testsuite/g++.dg/ext/array4.C
new file mode 100644
index 0000000..0068ea8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/array4.C
@@ -0,0 +1,172 @@
+// PR c++/101029
+// { dg-do compile { target c++11 } }
+// { dg-options "" } allow [0]
+
+template <int __v> struct integral_constant {
+ static constexpr int value = __v;
+ typedef int value_type;
+ constexpr operator value_type() { return __v; }
+};
+template <bool __v> using __bool_constant = integral_constant<__v>;
+template <bool, typename> struct conditional;
+template <typename...> struct __and_;
+template <typename _B1, typename _B2, typename _B3, typename... _Bn>
+struct __and_<_B1, _B2, _B3, _Bn...> : conditional<_B1::value, _B1> {};
+template <typename _Tp>
+constexpr integral_constant<true> __is_complete_or_unbounded(_Tp) {
+ return {};
+}
+struct Trans_NS_std_formatter;
+template <typename _Tp>
+struct is_default_constructible : integral_constant<false> {
+ static_assert(__is_complete_or_unbounded(_Tp{}), "");
+};
+template <typename _Tp, typename _Up>
+struct is_same : integral_constant<__is_same_as(_Tp, _Up)> {};
+template <bool> struct enable_if;
+template <typename _Iffalse> struct conditional<false, _Iffalse> {
+ typedef _Iffalse type;
+};
+struct pair {
+ template <typename _U1 = int, typename _U2 = int,
+ typename enable_if<__and_<is_default_constructible<_U1>, _U2,
+ int>::valuebool>::type>
+ pair();
+};
+
+class BucketLogger;
+struct __shared_ptr_access {
+ using element_type = BucketLogger;
+ element_type *operator->();
+};
+struct DcpProducer {
+ __shared_ptr_access logger;
+ void bufferAcknowledgement();
+};
+struct atomic {
+ atomic(long);
+};
+inline namespace v7 {
+template <bool B, class, class F>
+using conditional_t = typename conditional<B, F>::type;
+template <typename> struct basic_string_view { basic_string_view(int, int); };
+template <typename, typename> struct formatter;
+template <typename, typename>
+using has_formatter =
+ __bool_constant<__is_constructible(Trans_NS_std_formatter)>;
+struct fallback_formatter;
+template <typename Context> struct custom_value {
+ using parse_context = typename Context::parse_context_type;
+ void (*format)(const void *, parse_context &, Context &);
+};
+template <typename Context> struct value {
+ float float_value;
+ custom_value<Context> custom;
+ template <typename T> value(T) {
+ custom.format =
+ format_custom_arg<T, conditional_t<has_formatter<T, Context>::value,
+ typename Context::formatter_type<T>,
+ fallback_formatter>>;
+ }
+ template <typename, typename Formatter>
+ static void format_custom_arg(const void *arg,
+ typename Context::parse_context_type &,
+ Context &ctx) {
+ Formatter f;
+ f.format(*static_cast<const int *>(arg), ctx);
+ }
+};
+enum { max_packed_args };
+template <typename Context> struct basic_format_arg { value<Context> value_; };
+template <typename Visitor, typename Context>
+void visit_format_arg(Visitor vis, Context arg) {
+ vis(arg.value_.float_value);
+}
+template <typename Context, typename T> basic_format_arg<Context> make_arg(T);
+struct basic_format_context {
+ using char_type = int;
+ using parse_context_type = int;
+ template <typename T> using formatter_type = formatter<T, char_type>;
+};
+struct format_arg_store {
+ using value_type = conditional_t<max_packed_args, basic_format_context,
+ basic_format_arg<basic_format_context>>;
+ value_type data_;
+};
+template <typename... Args, typename S>
+auto make_args_checked(S, Args... args) -> format_arg_store {
+ return {args...};
+}
+struct basic_format_specs {};
+template <typename Char, typename OutputIt, typename T>
+void write(OutputIt, T, Char) {
+ if (is_same<T, float>())
+ ;
+}
+struct arg_formatter_base {
+ using iterator = int;
+ using format_specs = basic_format_specs;
+ iterator out_;
+ template <typename T> void operator()(T value) {
+ auto specs = format_specs();
+ write(out_, value, specs);
+ }
+};
+struct arg_formatter : arg_formatter_base {
+ using context_type = basic_format_context;
+ arg_formatter(context_type, int *, format_specs *);
+};
+template <typename T, typename> struct formatter {
+ template <typename FormatContext> void format(T val, FormatContext ctx) {
+ using af = arg_formatter;
+ basic_format_arg<FormatContext> __trans_tmp_2 = make_arg<FormatContext>(val);
+ visit_format_arg(af(ctx, nullptr, &specs_), __trans_tmp_2);
+ }
+ basic_format_specs specs_;
+};
+} // namespace v7
+namespace level {
+enum level_enum { warn };
+}
+struct BucketLogger {
+ template <typename S, typename... Args>
+ void log(level::level_enum, const S &, Args &&...);
+ template <typename... Args> void warn(const char *, const Args &...);
+};
+namespace v7 {
+struct fallback_formatter : formatter<basic_string_view<int>, int> {
+ template <typename OutputIt> void format(int, OutputIt ctx) {
+ basic_string_view<int> str(0, 0);
+ formatter::format(str, ctx);
+ }
+};
+} // namespace v7
+template <typename S, typename... Args>
+void BucketLogger::log(level::level_enum, const S &fmt, Args &&...args) {
+ make_args_checked(fmt, args...);
+}
+template <typename... Args>
+void BucketLogger::warn(const char *fmt, const Args &...args) {
+ log(level::warn, fmt, args...);
+}
+template <class KeyT> struct AtomicHashArray {
+ static void create();
+ atomic isFull_;
+ atomic numErases_;
+ pair cells_[0];
+ AtomicHashArray(int, KeyT, KeyT, KeyT, double, unsigned);
+};
+template <class KeyT>
+AtomicHashArray<KeyT>::AtomicHashArray(int, KeyT, KeyT, KeyT, double, unsigned)
+ : isFull_(0), numErases_(0) {}
+template <class KeyT> void AtomicHashArray<KeyT>::create() {
+ int c_4, capacity;
+ double c_3;
+ char c_2, c_1, c_0;
+ AtomicHashArray(capacity, c_0, c_1, c_2, c_3, c_4);
+}
+int bufferAcknowledgement_vbucket;
+void DcpProducer::bufferAcknowledgement() {
+ logger->warn("", bufferAcknowledgement_vbucket);
+}
+void (*makeStreamsMap_p)() = AtomicHashArray<char>::create;
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-1.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-1.C
new file mode 100644
index 0000000..862651f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-1.C
@@ -0,0 +1,113 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef int INT1 __attribute__((unavailable));
+typedef INT1 INT2 __attribute__ ((__unavailable__));
+
+typedef INT1 INT1a; /* { dg-error "'INT1' is unavailable" "" } */
+typedef INT1 INT1b __attribute__ ((unavailable));
+
+INT1 should_be_unavailable; /* { dg-error "'INT1' is unavailable" "" } */
+INT1a should_not_be_unavailable;
+
+INT1 f1(void) __attribute__ ((unavailable));
+INT1 f2(void) { return 0; } /* { dg-error "'INT1' is unavailable" "" } */
+
+INT2 f3(void) __attribute__ ((__unavailable__));
+INT2 f4(void) { return 0; } /* { dg-error "'INT2' is unavailable" "" } */
+int f5(INT2 x); /* { dg-error "'INT2' is unavailable" "" } */
+int f6(INT2 x) __attribute__ ((__unavailable__));
+
+typedef enum Color {red, green, blue} Color __attribute__((unavailable));
+
+int g1;
+int g2 __attribute__ ((unavailable));
+int g3 __attribute__ ((__unavailable__));
+Color k; /* { dg-error "'Color' is unavailable" "" } */
+
+typedef struct {
+ int field1;
+ int field2 __attribute__ ((unavailable));
+ int field3;
+ int field4 __attribute__ ((__unavailable__));
+ union {
+ int field5;
+ int field6 __attribute__ ((unavailable));
+ } u1;
+ int field7:1;
+ int field8:1 __attribute__ ((unavailable));
+ union {
+ int field9;
+ int field10;
+ } u2 __attribute__ ((unavailable));
+} S1;
+
+int func1()
+{
+ INT1 w; /* { dg-error "'INT1' is unavailable" "" } */
+ int x __attribute__ ((unavailable));
+ int y __attribute__ ((__unavailable__));
+ int z;
+ int (*pf)() = f1; /* { dg-error "'INT1 f1\\(\\)' is unavailable" "" } */
+
+ z = w + x + y + g1 + g2 + g3; /* { dg-error "'x' is unavailable" "" } */
+ /* { dg-error "'y' is unavailable" "y" { target *-*-* } .-1 } */
+ /* { dg-error "'g2' is unavailable" "g2" { target *-*-* } .-2 } */
+ /* { dg-error "'g3' is unavailable" "g3" { target *-*-* } .-3 } */
+ return f1(); /* { dg-error "'INT1 f1\\(\\)' is unavailable" "f1" } */
+}
+
+int func2(S1 *p)
+{
+ S1 lp;
+
+ if (p->field1)
+ return p->field2; /* { dg-error "'S1::field2' is unavailable" "" } */
+ else if (lp.field4) /* { dg-error "'S1::field4' is unavailable" "" } */
+ return p->field3;
+
+ p->u1.field5 = g1 + p->field7;
+ p->u2.field9; /* { dg-error "'S1::u2' is unavailable" "" } */
+ return p->u1.field6 + p->field8; /* { dg-error "'S1::<unnamed union>::field6' is unavailable" "" } */
+ /* { dg-error "'S1::field8' is unavailable" "field8" { target *-*-* } .-1 } */
+}
+
+struct SS1 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable" "" } */
+} __attribute__ ((unavailable));
+
+struct SS1 *p1; /* { dg-error "'SS1' is unavailable" "" } */
+
+struct __attribute__ ((__unavailable__)) SS2 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable" "" } */
+};
+
+struct SS2 *p2; /* { dg-error "'SS2' is unavailable" "" } */
+
+#ifdef __cplusplus
+class T {
+ public:
+ void member1(int) __attribute__ ((unavailable));
+ void member2(INT1) __attribute__ ((__unavailable__));
+ int member3(T *);
+ int x;
+} __attribute__ ((unavailable));
+
+T *p3; // { dg-error "'T' is unavailable" }
+
+inline void T::member1(int) {}
+
+int T::member3(T *p) // { dg-error "'T' is unavailable" }
+{
+ p->member1(1); /* { dg-error "'void T::member1\\(int\\)' is unavailable" "" } */
+ (*p).member1(2); /* { dg-error "'void T::member1\\(int\\)' is unavailable" "" } */
+ p->member2(1); /* { dg-error "'void T::member2\\(INT1\\)' is unavailable" "" } */
+ (*p).member2(2); /* { dg-error "'void T::member2\\(INT1\\)' is unavailable" "" } */
+ p->member3(p);
+ (*p).member3(p);
+ return f1(); /* { dg-error "'INT1 f1\\(\\)' is unavailable" "" } */
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-2.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-2.C
new file mode 100644
index 0000000..3de5532
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-2.C
@@ -0,0 +1,10 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void func(void);
+void func(void) __attribute__((unavailable));
+
+void f(void) {
+ func(); /* { dg-error "'void func\\(\\)' is unavailable" } */
+}
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-3.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-3.C
new file mode 100644
index 0000000..1f267ea
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-3.C
@@ -0,0 +1,14 @@
+/* Check operator with __attribute__((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct Foo
+{
+ operator int() __attribute__((unavailable));
+};
+
+void g(void)
+{
+ Foo f;
+ (int)f; // { dg-error "'Foo::operator int\\(\\)' is unavailable" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-4.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-4.C
new file mode 100644
index 0000000..b7f352e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-4.C
@@ -0,0 +1,11 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct B {
+ virtual int foo() __attribute__((unavailable));
+};
+
+int main(void) {
+ ((B*)0)->foo(); // { dg-error "unavailable" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-5.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-5.C
new file mode 100644
index 0000000..3beea5d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-5.C
@@ -0,0 +1,6 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct Foo { int i; } __attribute__ ((unavailable));
+void foo() { Foo f; } // { dg-error "unavailable" }
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-6.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-6.C
new file mode 100644
index 0000000..8a57ea0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-6.C
@@ -0,0 +1,110 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef int INT1 __attribute__((unavailable("You can't use INT1")));
+typedef INT1 INT2 __attribute__ ((__unavailable__("You can't use INT2")));
+
+typedef INT1 INT1a; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+
+INT1 should_be_unavailable; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+INT1a should_not_be_unavailable;
+
+INT1 f1(void) __attribute__ ((unavailable("You can't use f1")));
+INT1 f2(void) { return 0; } /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+
+INT2 f3(void) __attribute__ ((__unavailable__("You can't use f3")));
+INT2 f4(void) { return 0; } /* { dg-error "'INT2' is unavailable: You can't use INT2" "" } */
+int f5(INT2 x); /* { dg-error "'INT2' is unavailable" "" } */
+int f6(INT2 x) __attribute__ ((__unavailable__("You can't use f6")));
+
+typedef enum Color {red, green, blue} Color __attribute__((unavailable("You can't use Color")));
+
+int g1;
+int g2 __attribute__ ((unavailable("You can't use g2")));
+int g3 __attribute__ ((__unavailable__("You can't use g3")));
+Color k; /* { dg-error "'Color' is unavailable: You can't use Color" "" } */
+
+typedef struct {
+ int field1;
+ int field2 __attribute__ ((unavailable("You can't use field2")));
+ int field3;
+ int field4 __attribute__ ((__unavailable__("You can't use field4")));
+ union {
+ int field5;
+ int field6 __attribute__ ((unavailable("You can't use field6")));
+ } u1;
+ int field7:1;
+ int field8:1 __attribute__ ((unavailable("You can't use field8")));
+ union {
+ int field9;
+ int field10;
+ } u2 __attribute__ ((unavailable("You can't use u2")));
+} S1;
+
+int func1()
+{
+ INT1 w; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+ int x __attribute__ ((unavailable("You can't use x")));
+ int y __attribute__ ((__unavailable__("You can't use y")));
+ int z;
+ int (*pf)() = f1; /* { dg-error "'INT1 f1\\(\\)' is unavailable: You can't use f1" "" } */
+
+ z = w + x + y + g1 + g2 + g3; /* { dg-error "'x' is unavailable: You can't use x" "" } */
+ /* { dg-error "'y' is unavailable: You can't use y" "y" { target *-*-* } .-1 } */
+ /* { dg-error "'g2' is unavailable: You can't use g2" "g2" { target *-*-* } .-2 } */
+ /* { dg-error "'g3' is unavailable: You can't use g3" "g3" { target *-*-* } .-3 } */
+ return f1(); /* { dg-error "'INT1 f1\\(\\)' is unavailable: You can't use f1" "f1" } */
+}
+
+int func2(S1 *p)
+{
+ S1 lp;
+
+ if (p->field1)
+ return p->field2; /* { dg-error "'S1::field2' is unavailable: You can't use field2" "" } */
+ else if (lp.field4) /* { dg-error "'S1::field4' is unavailable: You can't use field4" "" } */
+ return p->field3;
+
+ p->u1.field5 = g1 + p->field7;
+ p->u2.field9; /* { dg-error "'S1::u2' is unavailable: You can't use u2" "" } */
+ return p->u1.field6 + p->field8; /* { dg-error "'S1::<unnamed union>::field6' is unavailable: You can't use field6" "" } */
+ /* { dg-error "'S1::field8' is unavailable: You can't use field8" "field8" { target *-*-* } .-1 } */
+}
+
+struct SS1 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+} __attribute__ ((unavailable("You can't use SS1")));
+
+struct SS1 *p1; /* { dg-error "'SS1' is unavailable: You can't use SS1" "" } */
+
+struct __attribute__ ((__unavailable__("You can't use SS2"))) SS2 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+};
+
+struct SS2 *p2; /* { dg-error "'SS2' is unavailable: You can't use SS2" "" } */
+
+class T {
+ public:
+ void member1(int) __attribute__ ((unavailable("You can't use member1")));
+ void member2(INT1) __attribute__ ((__unavailable__("You can't use member2")));
+ int member3(T *);
+ int x;
+} __attribute__ ((unavailable("You can't use T")));
+
+T *p3; // { dg-error "'T' is unavailable: You can't use T" }
+
+inline void T::member1(int) {}
+
+int T::member3(T *p) // { dg-error "'T' is unavailable: You can't use T" }
+{
+ p->member1(1); /* { dg-error "'void T::member1\\(int\\)' is unavailable: You can't use member1" "" } */
+ (*p).member1(2); /* { dg-error "'void T::member1\\(int\\)' is unavailable: You can't use member1" "" } */
+ p->member2(1); /* { dg-error "'void T::member2\\(INT1\\)' is unavailable: You can't use member2" "" } */
+ (*p).member2(2); /* { dg-error "'void T::member2\\(INT1\\)' is unavailable: You can't use member2" "" } */
+ p->member3(p);
+ (*p).member3(p);
+ return f1(); /* { dg-error "'INT1 f1\\(\\)' is unavailable: You can't use f1" "" } */
+}
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-7.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-7.C
new file mode 100644
index 0000000..c061aa3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-7.C
@@ -0,0 +1,19 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int g_nn;
+int& g_n __attribute__((unavailable)) = g_nn;
+
+void f()
+{
+ int f_nn;
+ int& f_n __attribute__((unavailable)) = f_nn;
+ f_n = 1; // { dg-error "'f_n' is unavailable" }
+}
+
+int main()
+{
+ g_n = 1; // { dg-error "'g_n' is unavailable" }
+ f();
+}
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-8.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-8.C
new file mode 100644
index 0000000..334a2cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-8.C
@@ -0,0 +1,17 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+class ToBeunavailable {
+} __attribute__ ((unavailable ("unavailable!")));
+
+typedef ToBeunavailable NotToBeunavailable; // { dg-error "'ToBeunavailable' is unavailable" }
+
+int main() {
+
+ ToBeunavailable(); // { dg-error "'ToBeunavailable' is unavailable" }
+ ToBeunavailable x; // { dg-error "'ToBeunavailable' is unavailable" }
+
+ NotToBeunavailable();
+ NotToBeunavailable y;
+}
diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-9.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-9.C
new file mode 100644
index 0000000..4416133
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-9.C
@@ -0,0 +1,17 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+template<typename T> struct __attribute__ ((unavailable)) S {};
+S<int> s;
+
+template <template <class> class T> struct A { };
+A<S> a;
+
+template <class T> void f() __attribute__ ((unavailable));
+
+int main()
+{
+ f<int>(); // { dg-error "unavailable" }
+ void (*p)() = f<char>; // { dg-error "unavailable" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/attrib62.C b/gcc/testsuite/g++.dg/ext/attrib62.C
index 116ee82..d34cd25 100644
--- a/gcc/testsuite/g++.dg/ext/attrib62.C
+++ b/gcc/testsuite/g++.dg/ext/attrib62.C
@@ -3,5 +3,5 @@
template<typename T> struct A
{
- T a, __attribute((unused)) b; // { dg-warning "attribute ignored" }
+ T a, __attribute((unused)) b;
};
diff --git a/gcc/testsuite/g++.dg/ext/attrib63.C b/gcc/testsuite/g++.dg/ext/attrib63.C
new file mode 100644
index 0000000..583779a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib63.C
@@ -0,0 +1,34 @@
+// { dg-do compile }
+// { dg-additional-options "-Wno-psabi" }
+
+#define vector __attribute__((vector_size(16)))
+class A {
+ friend vector float f();
+ __attribute__((deprecated)) friend void f2();
+ friend __attribute__((deprecated, vector_size(16))) float f3();
+ friend __attribute__((vector_size(16), deprecated)) float f4();
+};
+
+vector float vf;
+vector float
+f ()
+{
+ return vf;
+}
+
+void
+f2 ()
+{
+}
+
+vector float
+f3 ()
+{
+ return vf;
+}
+
+vector float
+f4 ()
+{
+ return vf;
+}
diff --git a/gcc/testsuite/g++.dg/ext/builtin-shufflevector-1.C b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-1.C
new file mode 100644
index 0000000..3869531
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-1.C
@@ -0,0 +1,19 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-psabi -w" }
+
+template <typename T1, typename T2, int ...args>
+struct shufflevector
+{
+ static auto shuffle (T1 a, T2 b)
+ -> decltype (__builtin_shufflevector (a, b, args...))
+ {
+ return __builtin_shufflevector (a, b, args...);
+ }
+};
+
+typedef int v4si __attribute__((vector_size (16)));
+v4si a, b, c;
+int main()
+{
+ c = shufflevector<v4si, v4si, 0, 1, 4, 5>::shuffle (a, b);
+}
diff --git a/gcc/testsuite/g++.dg/ext/builtin-shufflevector-2.C b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-2.C
new file mode 100644
index 0000000..fdf223e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-2.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-additional-options "-Wno-psabi" }
+
+typedef double v2df __attribute__((vector_size(2 * sizeof (double))));
+
+template<typename T, typename U, int N, int M>
+struct Shuffle {
+ void f(T t, U u, v2df a, v2df b) {
+ (void)__builtin_shufflevector(t, u, N, M); // { dg-error "invalid" }
+ }
+};
+
+template struct Shuffle<v2df, v2df, 4, 3>;
diff --git a/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C b/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C
index b6e7c69..ab5fd17 100644
--- a/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C
+++ b/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C
@@ -15,9 +15,9 @@ cleanup2 (int *x)
constexpr bool
foo ()
{
- int a __attribute__((cleanup (cleanup))) = 1; // { dg-message "in 'constexpr' expansion of" }
+ int a __attribute__((cleanup (cleanup))) = 1;
return true;
-}
+} // { dg-message "in 'constexpr' expansion of" }
constexpr bool
bar ()
diff --git a/gcc/testsuite/g++.dg/ext/flexary13.C b/gcc/testsuite/g++.dg/ext/flexary13.C
index f0603f9..1acfa2e 100644
--- a/gcc/testsuite/g++.dg/ext/flexary13.C
+++ b/gcc/testsuite/g++.dg/ext/flexary13.C
@@ -17,44 +17,40 @@ int32_t i = 12345678;
int main ()
{
{
+ // OK. Does not assign any elements to flexible array.
Ax s = { 0 };
ASSERT (s.n == 0);
}
{
- static Ax s =
- { 0, { } }; // dg-warning "initialization of a flexible array member" }
+ // OK only for statically allocated objects, otherwise error.
+ static Ax s = { 0, { } };
ASSERT (s.n == 0);
}
{
- static Ax s =
- { 1, { 2 } }; // dg-warning "initialization of a flexible array member" }
+ static Ax s = { 1, { 2 } };
ASSERT (s.n == 1 && s.a [0] == 2);
}
{
- static Ax s =
- { 2, { 3, 4 } }; // dg-warning "initialization of a flexible array member" }
+ static Ax s = { 2, { 3, 4 } };
ASSERT (s.n = 2 && s.a [0] == 3 && s.a [1] == 4);
}
{
- static Ax s =
- { 123, i }; // dg-warning "initialization of a flexible array member" }
+ static Ax s = { 123, i };
ASSERT (s.n == 123 && s.a [0] == i);
}
{
- static Ax s =
- { 456, { i } }; // dg-warning "initialization of a flexible array member" }
+ static Ax s = { 456, { i } };
ASSERT (s.n == 456 && s.a [0] == i);
}
{
int32_t j = i + 1, k = j + 1;
- static Ax s =
- { 3, { i, j, k } }; // dg-warning "initialization of a flexible array member" }
+ static Ax s = { 3, { i, j, k } };
ASSERT (s.n == 3 && s.a [0] == i && s.a [1] == j && s.a [2] == k);
}
{
- AAx s =
- { 1, { 2 } }; // dg-warning "initialization of a flexible array member" }
+ // OK. Does not assign any elements to flexible array.
+ AAx s = { 1, { 2 } };
ASSERT (s.i == 1 && s.ax.n == 2);
}
}
diff --git a/gcc/testsuite/g++.dg/ext/utf-badconcat.C b/gcc/testsuite/g++.dg/ext/utf-badconcat.C
index 4079b83..550e0da 100644
--- a/gcc/testsuite/g++.dg/ext/utf-badconcat.C
+++ b/gcc/testsuite/g++.dg/ext/utf-badconcat.C
@@ -4,15 +4,15 @@
const void *s0 = u"a" "b";
const void *s1 = "a" u"b";
-const void *s2 = u"a" U"b"; /* { dg-error "non-standard concatenation" } */
-const void *s3 = U"a" u"b"; /* { dg-error "non-standard concatenation" } */
-const void *s4 = u"a" L"b"; /* { dg-error "non-standard concatenation" } */
-const void *s5 = L"a" u"b"; /* { dg-error "non-standard concatenation" } */
+const void *s2 = u"a" U"b"; /* { dg-error "concatenation" } */
+const void *s3 = U"a" u"b"; /* { dg-error "concatenation" } */
+const void *s4 = u"a" L"b"; /* { dg-error "concatenation" } */
+const void *s5 = L"a" u"b"; /* { dg-error "concatenation" } */
const void *s6 = u"a" u"b";
const void *s7 = U"a" "b";
const void *s8 = "a" U"b";
-const void *s9 = U"a" L"b"; /* { dg-error "non-standard concatenation" } */
-const void *sa = L"a" U"b"; /* { dg-error "non-standard concatenation" } */
+const void *s9 = U"a" L"b"; /* { dg-error "concatenation" } */
+const void *sa = L"a" U"b"; /* { dg-error "concatenation" } */
const void *sb = U"a" U"b";
const void *sc = L"a" "b";
const void *sd = "a" L"b";
diff --git a/gcc/testsuite/g++.dg/ext/utf-badconcat2.C b/gcc/testsuite/g++.dg/ext/utf-badconcat2.C
index 0d3fe33..535d926 100644
--- a/gcc/testsuite/g++.dg/ext/utf-badconcat2.C
+++ b/gcc/testsuite/g++.dg/ext/utf-badconcat2.C
@@ -4,11 +4,11 @@
const void *s0 = u8"a" "b";
const void *s1 = "a" u8"b";
const void *s2 = u8"a" u8"b";
-const void *s3 = u8"a" u"b"; // { dg-error "non-standard concatenation" }
-const void *s4 = u"a" u8"b"; // { dg-error "non-standard concatenation" }
-const void *s5 = u8"a" U"b"; // { dg-error "non-standard concatenation" }
-const void *s6 = U"a" u8"b"; // { dg-error "non-standard concatenation" }
-const void *s7 = u8"a" L"b"; // { dg-error "non-standard concatenation" }
-const void *s8 = L"a" u8"b"; // { dg-error "non-standard concatenation" }
+const void *s3 = u8"a" u"b"; // { dg-error "concatenation" }
+const void *s4 = u"a" u8"b"; // { dg-error "concatenation" }
+const void *s5 = u8"a" U"b"; // { dg-error "concatenation" }
+const void *s6 = U"a" u8"b"; // { dg-error "concatenation" }
+const void *s7 = u8"a" L"b"; // { dg-error "concatenation" }
+const void *s8 = L"a" u8"b"; // { dg-error "concatenation" }
int main () {}
diff --git a/gcc/testsuite/g++.dg/ext/va-arg-pack-3.C b/gcc/testsuite/g++.dg/ext/va-arg-pack-3.C
new file mode 100644
index 0000000..0e8203c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/va-arg-pack-3.C
@@ -0,0 +1,18 @@
+// PR middle-end/100898
+
+int a;
+int bar (int, ...);
+
+static inline __attribute__((always_inline)) int
+foo (...)
+{
+ while (a)
+ return bar (0, __builtin_va_arg_pack ());
+ return 0;
+}
+
+void
+baz (void)
+{
+ foo ();
+}
diff --git a/gcc/testsuite/g++.dg/ext/vector40.C b/gcc/testsuite/g++.dg/ext/vector40.C
new file mode 100644
index 0000000..66b6b64
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector40.C
@@ -0,0 +1,11 @@
+// PR c++/97900
+// { dg-options "-Wno-psabi -w" }
+
+template<typename T>
+T test(T __attribute__((vector_size(2 * sizeof(T)))) vec) {
+ return vec[0] + vec[1];
+}
+typedef int v2si __attribute__((vector_size(2 * sizeof(int))));
+int run(v2si vec) {
+ return test<int>(vec);
+}
diff --git a/gcc/testsuite/g++.dg/ext/vector41.C b/gcc/testsuite/g++.dg/ext/vector41.C
new file mode 100644
index 0000000..bfc3bb6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector41.C
@@ -0,0 +1,12 @@
+// PR c++/100517
+// { dg-options "" }
+
+typedef int __v2si __attribute__ ((__vector_size__ (8)));
+
+struct S { };
+
+void
+f (S s)
+{
+ (void) reinterpret_cast<__v2si> (s); // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C b/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C
index ebce2ba..0450af5 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C
@@ -6,7 +6,7 @@
/* { dg-final { scan-not-hidden "_ZZ3barvE1n" } } */
/* { dg-final { scan-not-hidden "_Z3fooIiEvv" } } */
/* { dg-final { scan-hidden "_Z3fooIvEvv" } } */
-/* { dg-final { scan-hidden "_ZZN1A5innerEvE1n" } } */
+/* { dg-final { scan-hidden "_ZZN1A5innerEvE1n(\\\[BS\\\])?" } } */
inline int * bar()
{
diff --git a/gcc/testsuite/g++.dg/ext/visibility/noPLT.C b/gcc/testsuite/g++.dg/ext/visibility/noPLT.C
index 38af05f..b888303 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/noPLT.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/noPLT.C
@@ -1,5 +1,5 @@
/* Test that -fvisibility=hidden prevents PLT. */
-/* { dg-do compile { target fpic } } */
+/* { dg-do compile { target { fpic && { ! s390x-*-* } } } } */
/* { dg-require-visibility "" } */
/* { dg-options "-fPIC -fvisibility=hidden" } */
/* { dg-final { scan-assembler-not "methodEv@PLT|indirect_symbol.*methodEv" } } */
diff --git a/gcc/testsuite/g++.dg/ext/vla22.C b/gcc/testsuite/g++.dg/ext/vla22.C
index 2308ee7..967adb9 100644
--- a/gcc/testsuite/g++.dg/ext/vla22.C
+++ b/gcc/testsuite/g++.dg/ext/vla22.C
@@ -6,4 +6,4 @@ void
f ()
{
const int tbl[(long) "h"] = { 12 }; // { dg-error "size of array .tbl. is not an integral constant-expression" }
-}
+} // { dg-warning "narrowing conversion" "" { target c++11 } .-1 }
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-2.C b/gcc/testsuite/g++.dg/gcov/gcov-2.C
index 6d002f5..2b4cdd8 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-2.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-2.C
@@ -20,9 +20,9 @@ private:
void foo()
{
- C c; /* count(2) */
+ C c; /* count(1) */
c.seti (1); /* count(1) */
-}
+} /* count(1) */
int main()
{
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
index b020dd8..3ae0078 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
@@ -36,7 +36,7 @@ int main(int argc, char **argv) {
assert (r == 0); /* count(5*) */
}
- int ret;
+ void *ret;
for (int i = 0; i < NR; i++)
{
int r = pthread_join (t[i], (void**)&ret);
diff --git a/gcc/testsuite/g++.dg/goacc/mdc.C b/gcc/testsuite/g++.dg/goacc/mdc.C
index b3abab3..e8ba1cc 100644
--- a/gcc/testsuite/g++.dg/goacc/mdc.C
+++ b/gcc/testsuite/g++.dg/goacc/mdc.C
@@ -45,7 +45,7 @@ t1 ()
#pragma acc enter data attach(rz[3]) /* { dg-error "expected pointer in .attach. clause" } */
#pragma acc exit data detach(rz[3]) /* { dg-error "expected pointer in .detach. clause" } */
-#pragma acc acc enter data attach(rs.e)
+#pragma acc enter data attach(rs.e)
#pragma acc exit data detach(rs.e) attach(rz) /* { dg-error ".attach. is not valid for" } */
#pragma acc data attach(rs.e)
diff --git a/gcc/testsuite/g++.dg/goacc/pr101759.C b/gcc/testsuite/g++.dg/goacc/pr101759.C
new file mode 100644
index 0000000..522a5d4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/goacc/pr101759.C
@@ -0,0 +1,5 @@
+// PR c++/101759
+// { dg-do compile { target c++11 } }
+
+#pragma acc routine
+int foo (int x = []() { extern int bar (int); return 1; }());
diff --git a/gcc/testsuite/g++.dg/goacc/template.C b/gcc/testsuite/g++.dg/goacc/template.C
index 8bcd2a1..10d3f44 100644
--- a/gcc/testsuite/g++.dg/goacc/template.C
+++ b/gcc/testsuite/g++.dg/goacc/template.C
@@ -1,4 +1,6 @@
-#pragma acc routine
+/* { dg-additional-options "-fdump-tree-oaccloops" } */
+
+#pragma acc routine nohost
template <typename T> T
accDouble(int val)
{
@@ -55,7 +57,7 @@ oacc_parallel_copy (T a)
#pragma acc atomic capture
c = b++;
-#pragma atomic update
+#pragma acc atomic update
c++;
#pragma acc atomic read
@@ -153,3 +155,14 @@ main ()
return b + c;
}
+
+/* { dg-final { scan-tree-dump-times {(?n)^OpenACC routine '[^']+' has 'nohost' clause\.$} 4 oaccloops } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'T accDouble\(int\) \[with T = char\]' has 'nohost' clause\.$} 1 oaccloops { target { ! offloading_enabled } } } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'accDouble<char>\(int\)char' has 'nohost' clause\.$} 1 oaccloops { target offloading_enabled } } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'T accDouble\(int\) \[with T = int\]' has 'nohost' clause\.$} 1 oaccloops { target { ! offloading_enabled } } } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'accDouble<int>\(int\)int' has 'nohost' clause\.$} 1 oaccloops { target offloading_enabled } } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'T accDouble\(int\) \[with T = float\]' has 'nohost' clause\.$} 1 oaccloops { target { ! offloading_enabled } } } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'accDouble<float>\(int\)float' has 'nohost' clause\.$} 1 oaccloops { target offloading_enabled } } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'T accDouble\(int\) \[with T = double\]' has 'nohost' clause\.$} 1 oaccloops { target { ! offloading_enabled } } } }
+ { dg-final { scan-tree-dump-times {(?n)^OpenACC routine 'accDouble<double>\(int\)double' has 'nohost' clause\.$} 1 oaccloops { target offloading_enabled } } }
+ TODO See PR101551 for 'offloading_enabled' differences. */
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-18.C b/gcc/testsuite/g++.dg/gomp/atomic-18.C
index 896cf46..adaee84 100644
--- a/gcc/testsuite/g++.dg/gomp/atomic-18.C
+++ b/gcc/testsuite/g++.dg/gomp/atomic-18.C
@@ -1,6 +1,7 @@
// { dg-do compile }
// { dg-additional-options "-fdump-tree-original" }
-// { dg-final { scan-tree-dump-times "omp atomic release" 5 "original" } }
+// { dg-final { scan-tree-dump-times "omp atomic release" 4 "original" } }
+// { dg-final { scan-tree-dump-times "omp atomic acq_rel" 1 "original" } }
// { dg-final { scan-tree-dump-times "omp atomic seq_cst" 1 "original" } }
// { dg-final { scan-tree-dump-times "omp atomic relaxed" 2 "original" } }
// { dg-final { scan-tree-dump-times "omp atomic capture acq_rel" 3 "original" } }
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-1.C b/gcc/testsuite/g++.dg/gomp/attrs-1.C
new file mode 100644
index 0000000..c871c51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-1.C
@@ -0,0 +1,628 @@
+// { dg-do compile { target c++11 } }
+
+typedef enum omp_allocator_handle_t
+: __UINTPTR_TYPE__
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
+typedef enum omp_sync_hint_t {
+omp_sync_hint_none = 0x0,
+omp_lock_hint_none = omp_sync_hint_none,
+omp_sync_hint_uncontended = 0x1,
+omp_lock_hint_uncontended = omp_sync_hint_uncontended,
+omp_sync_hint_contended = 0x2,
+omp_lock_hint_contended = omp_sync_hint_contended,
+omp_sync_hint_nonspeculative = 0x4,
+omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
+omp_sync_hint_speculative = 0x8,
+omp_lock_hint_speculative = omp_sync_hint_speculative
+} omp_sync_hint_t;
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+ char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+
+int t;
+#pragma omp threadprivate (t)
+
+#pragma omp declare target
+int f, l, ll, r, r2;
+
+void
+foo (int d, int m, int i1, int i2, int p, int *idp, int s,
+ int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int ntm)
+{
+ [[omp::directive (distribute parallel for
+ private (p) firstprivate (f) collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) order(concurrent) allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute parallel for simd
+ private (p) firstprivate (f) collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) if(simd: i1) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) nontemporal(ntm)
+ safelen(8) simdlen(4) aligned(q: 32) order(concurrent) allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute simd
+ private (p) firstprivate (f) collapse(1) dist_schedule(static, 16)
+ safelen(8) simdlen(4) aligned(q: 32) reduction(+:r) if(i1) nontemporal(ntm)
+ order(concurrent) allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute
+ private (p) firstprivate (f) collapse(1) dist_schedule(static, 16)
+ allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+}
+
+void
+qux (int p)
+{
+ [[omp::directive (loop bind(teams) order(concurrent)
+ private (p) lastprivate (l) collapse(1) reduction(+:r))]]
+ for (l = 0; l < 64; ++l)
+ ll++;
+}
+#pragma omp end declare target
+
+void
+baz (int d, int m, int i1, int i2, int p, int *idp, int s,
+ int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int ntm)
+{
+ [[omp::directive (distribute parallel for
+ private (p) firstprivate (f) collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) copyin(t) order(concurrent) allocate (p))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute parallel for simd
+ private (p) firstprivate (f) collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) if(simd: i1) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) nontemporal(ntm)
+ safelen(8) simdlen(4) aligned(q: 32) copyin(t) order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute simd
+ private (p) firstprivate (f) collapse(1) dist_schedule(static, 16)
+ safelen(8) simdlen(4) aligned(q: 32) reduction(+:r) if(i1) nontemporal(ntm)
+ order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (loop bind(parallel) order(concurrent)
+ private (p) lastprivate (l) collapse(1) reduction(+:r))]]
+ for (l = 0; l < 64; ++l)
+ ll++;
+}
+
+void
+bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
+ int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm,
+ const char *msg)
+{
+ [[omp::directive (nothing)]];
+ [[omp::directive (error at (execution) severity (warning) message (msg))]];
+ [[omp::directive (for simd
+ private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait
+ safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) if(i1) order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (for
+ private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait
+ order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (simd
+ private (p) lastprivate (l) linear (ll:1) reduction(+:r) collapse(1) safelen(8) simdlen(4) aligned(q: 32)
+ nontemporal(ntm) if(i1) order(concurrent))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel for
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel for
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel for simd
+ private (p) firstprivate (f) if (i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1)
+ safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel sections
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) allocate (f))]]
+ {
+ [[omp::directive (section)]]
+ {}
+ [[omp::sequence (omp::directive (section))]]
+ {}
+ }
+ [[omp::directive (sections private (p) firstprivate (f) reduction(+:r) lastprivate (l) allocate (f) nowait)]]
+ {
+ ;
+ [[omp::sequence (sequence (directive (section)))]]
+ ;
+ [[omp::directive (section)]]
+ {}
+ }
+ [[omp::directive (barrier)]];
+ [[omp::sequence (omp::directive (single private (p) firstprivate (f) allocate (f) nowait))]]
+ ;
+ [[omp::sequence (directive (barrier))]];
+ [[omp::sequence (directive (parallel private (p)),
+ omp::directive (single copyprivate (p) firstprivate (f) allocate (f)))]]
+ p = 6;
+ [[omp::directive (target parallel
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f) in_reduction(+:r2))]]
+ ;
+ [[omp::directive (target parallel for
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) nowait depend(inout: dd[0])
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (target parallel for
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) nowait depend(inout: dd[0]) order(concurrent)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (target parallel for simd
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1)
+ safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3) order(concurrent)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (target teams
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0])
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)))]]
+ ;
+ [[omp::sequence (directive (target
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f) in_reduction(+:r2)))]]
+ ;
+ [[omp::sequence (omp::directive (target teams distribute
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f) in_reduction(+:r2)))]]
+ for (int i = 0; i < 64; i++)
+ ;
+ [[omp::directive (target teams distribute parallel for
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) nowait depend(inout: dd[0]) order(concurrent)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (target teams distribute parallel for simd
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (target teams distribute simd
+ device(d) map (tofrom: m) if (i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (target simd
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ safelen(8) simdlen(4) lastprivate (l) linear(ll: 1) aligned(q: 32) reduction(+:r)
+ nowait depend(inout: dd[0]) nontemporal(ntm) if(simd:i3) order(concurrent)
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup task_reduction(+:r2) allocate (r2)),
+ omp::directive (taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm)
+ order(concurrent) allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (taskgroup task_reduction(+:r) allocate (r)),
+ directive (taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(i1) final(fi) mergeable nogroup priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) in_reduction(+:r) nontemporal(ntm)
+ order(concurrent) allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (taskwait)]];
+ [[omp::directive (taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) if(taskloop: i1) final(fi) priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(+:r) if (simd: i3) nontemporal(ntm)
+ order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup task_reduction(+:r2) allocate (r2)),
+ omp::directive (taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) in_reduction(+:r2) allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup task_reduction(+:r2) allocate (r2)),
+ omp::directive (task
+ private (p) firstprivate (f) shared (s) default(shared) untied if(task: i1) final(fi) mergeable priority (pp)
+ in_reduction(+:r2) allocate (f)))]]
+ ;
+ [[omp::directive (taskyield)]];
+ [[omp::directive (target data if (target data: i1) device(d) map (tofrom: m) use_device_ptr (q) use_device_addr (p))]]
+ ;
+ [[omp::directive (target enter data if (target enter data: i1) device(d) map (to: m) depend(inout: dd[0]) nowait)]]
+ ;
+ [[omp::directive (target exit data if (target exit data: i1) device(d) map (from: m) depend(inout: dd[0]) nowait)]]
+ ;
+ [[omp::directive (target update if (target update: i1) device(d) to (m) depend(inout: dd[0]) nowait)]]
+ ;
+ [[omp::directive (target update if (target update: i1) device(d) from (m) depend(inout: dd[0]) nowait)]]
+ ;
+ [[omp::directive (taskwait)]];
+ [[omp::sequence (directive (target nowait depend(inout: dd[0]) in_reduction(+:r2)),
+ directive (teams distribute
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16) allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ;
+ [[omp::directive (teams
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ allocate (omp_default_mem_alloc: f))]]
+ ;
+ [[omp::sequence (omp::directive (target),
+ omp::directive (teams distribute parallel for
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) order(concurrent) allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (target),
+ directive (teams distribute parallel for simd
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) if (simd: i3) nontemporal(ntm)
+ allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (target),
+ directive (teams distribute simd
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) if(i3) nontemporal(ntm)
+ allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (teams distribute parallel for
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16) order(concurrent)
+ if (parallel: i2) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) copyin(t) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (teams distribute parallel for simd
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16)
+ if (parallel: i2) num_threads (nth) proc_bind(spread)
+ lastprivate (l) schedule(static, 4) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) if (simd: i3) nontemporal(ntm) copyin(t)
+ allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (teams distribute simd
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) dist_schedule(static, 16) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) if(i3) nontemporal(ntm) allocate(f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) reduction(+:r)
+ num_threads (nth) proc_bind(spread) copyin(t) allocate (f))]]
+ ;
+ [[omp::directive (parallel masked
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) reduction(+:r)
+ num_threads (nth) proc_bind(spread) copyin(t) allocate (f) filter (d))]]
+ ;
+ [[omp::directive (parallel
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) reduction(+:r)
+ num_threads (nth) proc_bind(spread) copyin(t) allocate (f))]]
+ ;
+ [[omp::sequence (directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ omp::directive (master taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) in_reduction(+:r2) allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ omp::directive (masked taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) in_reduction(+:r2) allocate (f) filter (d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (master)]];
+ [[omp::directive (masked)]];
+ [[omp::directive (masked filter (d))]];
+ [[omp::sequence (omp::directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ directive (master taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm)
+ order(concurrent) allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ directive (masked taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm)
+ order(concurrent) allocate (f) filter (d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) allocate (f) filter (d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t)
+ order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t)
+ order(concurrent) allocate (f) filter (d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ directive (master taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) in_reduction(+:r2)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ directive (masked taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) in_reduction(+:r2) filter (d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ omp::directive (master taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm)
+ order(concurrent) allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (taskgroup task_reduction (+:r2) allocate (r2)),
+ omp::directive (masked taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm)
+ order(concurrent) allocate (f) filter (d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) num_threads (nth) proc_bind(spread) copyin(t) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ reduction(default, +:r) num_threads (nth) proc_bind(spread) copyin(t) allocate (f) filter (d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) num_threads (nth) proc_bind(spread) copyin(t)
+ order(concurrent) allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop simd
+ private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp)
+ safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) num_threads (nth) proc_bind(spread) copyin(t)
+ order(concurrent) allocate (f) filter (d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (loop bind(thread) order(concurrent)
+ private (p) lastprivate (l) collapse(1) reduction(+:r))]]
+ for (l = 0; l < 64; ++l)
+ ll++;
+ [[omp::directive (parallel loop
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) collapse(1) bind(parallel) order(concurrent) allocate (f))]]
+ for (l = 0; l < 64; l++)
+ ll++;
+ [[omp::directive (parallel loop
+ private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread)
+ lastprivate (l) collapse(1) allocate (f))]]
+ for (l = 0; l < 64; l++)
+ ll++;
+ [[omp::directive (teams loop
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) lastprivate (l) bind(teams) allocate (f))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (teams loop
+ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl)
+ collapse(1) lastprivate (l) order(concurrent) allocate (f))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target parallel loop
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ nowait depend(inout: dd[0]) lastprivate (l) bind(parallel) order(concurrent) collapse(1)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target parallel loop
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread)
+ nowait depend(inout: dd[0]) lastprivate (l) order(concurrent) collapse(1)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target teams loop
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0])
+ lastprivate (l) bind(teams) collapse(1)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target teams loop
+ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp)
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0])
+ lastprivate (l) order(concurrent) collapse(1)
+ allocate (omp_default_mem_alloc: f) in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (critical)]] {
+ }
+ [[omp::directive (critical (foobar) hint(omp_sync_hint_none))]]
+ ;
+ [[omp::directive (taskwait depend (inout: dd[0]))]]
+ ;
+ [[omp::directive (taskgroup task_reduction(+:r2) allocate (r2))]]
+ ;
+ [[omp::directive (atomic update seq_cst hint(omp_sync_hint_none))]]
+ p++;
+ [[omp::directive (atomic read hint(omp_sync_hint_none) relaxed)]]
+ f = p;
+ [[omp::directive (atomic write release hint(omp_sync_hint_none))]]
+ p = f;
+ [[omp::directive (flush)]]
+ ;
+ [[omp::directive (flush acq_rel)]]
+ ;
+ [[omp::directive (flush acquire)]]
+ ;
+ [[omp::directive (flush release)]]
+ ;
+ [[omp::directive (flush seq_cst)]]
+ ;
+ [[omp::directive (flush (p, f))]]
+ ;
+ [[omp::directive (simd
+ private (p) lastprivate (l) linear (ll:1) reduction(+:r) collapse(1) safelen(8) simdlen(4) aligned(q: 32)
+ nontemporal(ntm) if(i1))]]
+ for (int i = 0; i < 64; i++)
+ [[omp::directive (ordered simd)]]
+ ll++;
+ [[omp::directive (for
+ private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait
+ ordered allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ [[omp::directive (ordered threads)]]
+ ll++;
+ [[omp::directive(for ordered (1))]]
+ for (l = 0; l < 64; l++)
+ {
+ [[omp::directive(ordered depend (sink: l - 1))]];
+ [[omp::directive(ordered depend (source))]];
+ }
+ extern omp_depend_t depobj;
+ [[omp::directive (depobj(depobj) depend(in : dd[0]))]];
+ [[omp::directive (parallel)]] {
+ if (p) {
+ [[omp::directive (cancel parallel)]];
+ } else {
+ [[omp::directive (cancellation point parallel)]];
+ }
+ }
+ [[omp::directive (scope private (p) reduction(+:r) nowait)]]
+ ;
+ [[omp::directive (scope private (p) reduction(task, +:r))]]
+ ;
+ extern int t2;
+ [[omp::directive (threadprivate (t2))]];
+ extern int t2;
+ [[omp::directive (declare reduction (dr: int: omp_out += omp_in) initializer (omp_priv = 0))]]
+ ;
+ [[omp::directive (parallel)]]
+ if (0)
+ ;
+ [[omp::directive (parallel)]]
+ while (0)
+ ;
+ [[omp::directive (parallel)]]
+ switch (0) { case 1: break; default: break; }
+}
+
+void corge1 ();
+
+void
+corge ()
+{
+ [[omp::directive (declare variant (corge1) match (construct={parallel,for}))]]
+ extern void corge2 ();
+ [[omp::sequence (directive (parallel), directive (for))]]
+ for (int i = 0; i < 5; i++)
+ corge2 ();
+ [[omp::directive (declare simd simdlen(4) linear(l) aligned(p:4) uniform(p) inbranch),
+ omp::directive (declare simd simdlen(8) notinbranch)]]
+ extern int corge3 (int l, int *p);
+ [[omp::directive (declare simd simdlen(4) linear(l) aligned(p:4) uniform(p) inbranch),
+ omp::directive (declare simd simdlen(8) notinbranch)]]
+ extern int corge4 (int l, int *p);
+ [[omp::sequence (directive (declare simd simdlen(4) linear(l) aligned(p:4) uniform(p) inbranch),
+ omp::directive (declare simd simdlen(8) notinbranch))]]
+ extern int corge5 (int l, int *p);
+ [[omp::directive (declare target)]];
+ extern void corge6 ();
+ [[omp::directive (end declare target)]];
+}
+
+int
+garply (int a, int *c, int *d, int *e, int *f)
+{
+ int i;
+ [[omp::directive (simd reduction (inscan, +: a))]]
+ for (i = 0; i < 64; i++)
+ {
+ d[i] = a;
+ [[omp::directive (scan exclusive (a))]]
+ a += c[i];
+ }
+ [[omp::directive (simd reduction (inscan, +: a))]]
+ for (i = 0; i < 64; i++)
+ {
+ a += c[i];
+ [[omp::sequence (omp::sequence (omp::directive (scan inclusive (a))))]]
+ d[i] = a;
+ }
+ return a;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-10.C b/gcc/testsuite/g++.dg/gomp/attrs-10.C
new file mode 100644
index 0000000..a78f892
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-10.C
@@ -0,0 +1,240 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-fopenmp -ffat-lto-objects -fdump-tree-gimple" }
+
+extern "C" void abort ();
+
+[[omp::directive (declare simd, linear (l))]] extern int f1 (int l);
+extern int f2 (int), f3 [[omp::directive (declare simd, uniform (m))]] (int m), f4 (int), z;
+[[omp::directive (declare simd, linear (l), simdlen(4))]] extern int f5 [[omp::directive (declare simd uniform (l) simdlen (8) notinbranch)]] (int l);
+
+int
+f1 (int l)
+{
+ return l;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbM4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM8l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM16l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN16l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+int
+f2 (int l)
+{
+ return l + 1;
+}
+
+// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f2i:" { target { i?86-*-* x86_64-*-* } } } }
+
+int
+f3 (int l)
+{
+ return l + 2;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbM4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM8u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM16u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN16u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+int
+f4 (int l)
+{
+ return l + 3;
+}
+
+// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f4i:" { target { i?86-*-* x86_64-*-* } } } }
+
+int
+f5 (int l)
+{ // { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-1 }
+ return l + 4;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-not "_ZGV\[bcde]M8u__Z2f5i:" { target { i?86-*-* x86_64-*-* } } } }
+
+[[omp::directive (declare simd, linear (l), simdlen(4), notinbranch),
+ omp::directive (declare simd, uniform (l), simdlen(4), inbranch)]]
+int
+f6 [[omp::sequence (directive (declare simd uniform (l) simdlen (8), notinbranch),
+ omp::directive (declare simd linear (l) simdlen (8) inbranch))]] (int l)
+{ // { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-2 }
+ return l + 5;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-not "_ZGV\[bcde]M4l__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-not "_ZGV\[bcde]N4u__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-not "_ZGV\[bcde]M8u__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-not "_ZGV\[bcde]N8l__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } }
+
+int
+f7 (int l)
+{
+ return l + 6;
+}
+
+// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f7i:" { target { i?86-*-* x86_64-*-* } } } }
+
+int
+f8 (int l)
+{
+ return l + 7;
+}
+
+// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f8i:" { target { i?86-*-* x86_64-*-* } } } }
+
+[[omp::sequence (omp::directive (declare variant (f7), match (construct={parallel})),
+ directive (declare simd uniform (l), simdlen(4)))]]
+int
+f9 [[omp::directive (declare simd uniform (l) simdlen (8)),
+ omp::directive (declare variant (f8) match (construct={parallel,for}))]] (int l)
+{ // { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-2 }
+ return l + 8;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVbN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+int z;
+
+void
+test ()
+{
+ [[omp::directive (parallel)]]
+ if (f9 (3) != 9)
+ abort ();
+ [[omp::directive (parallel for)]]
+ for (int i = 0; i < 1; i++)
+ if (f9 (4) != 11)
+ abort ();
+ if (f9 (5) != 13)
+ abort ();
+}
+
+// { dg-final { scan-tree-dump-times " = f7 \\\(3\\\);" 1 "gimple" } }
+// { dg-final { scan-tree-dump-times " = f8 \\\(4\\\);" 1 "gimple" } }
+// { dg-final { scan-tree-dump-times " = f9 \\\(5\\\);" 1 "gimple" } }
+
+template <int N>
+int
+f10 (int x)
+{
+ return x + N;
+}
+
+template [[omp::directive (declare simd, notinbranch)]] int f10<0> (int);
+
+// { dg-final { scan-assembler-times "_ZGVbN4v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN16v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+template int f10<1> [[omp::directive (declare simd inbranch linear(x))]] (int x);
+
+// { dg-final { scan-assembler-times "_ZGVbM4l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM8l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM16l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+template <int N>
+int f11 (int);
+
+template <> [[omp::directive (declare simd, inbranch)]] int
+f11<0> (int x)
+{
+ return x;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbM4v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM8v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM16v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+template <> int
+f11<1> [[omp::directive (declare simd, notinbranch, linear (y))]] (int y)
+{
+ return y;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbN4l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN16l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+struct S
+{
+ [[omp::sequence (directive (declare simd, inbranch, uniform (this)))]] int f12 (int x);
+ int f13 [[gnu::noinline, omp::directive (declare simd notinbranch uniform (this) linear (y))]] (int y) { return y; }
+};
+
+int
+S::f12 (int x)
+{
+ return x;
+}
+
+// { dg-final { scan-assembler-times "_ZGVbM4uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcM4uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdM8uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeM16uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+// { dg-final { scan-assembler-times "_ZGVbN4ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVcN4ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVdN8ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+// { dg-final { scan-assembler-times "_ZGVeN16ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } }
+
+int
+f14 (S &p, int x)
+{
+ return p.f13 (x);
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-11.C b/gcc/testsuite/g++.dg/gomp/attrs-11.C
new file mode 100644
index 0000000..44e025e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-11.C
@@ -0,0 +1,86 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-fopenmp -Wno-attributes" }
+
+namespace N {}
+namespace O { typedef int T; };
+
+void
+foo ()
+{
+ [[omp::directive (parallel)]] asm (""); // { dg-error "expected" }
+ [[omp::directive (parallel)]] __extension__ asm (""); // { dg-error "expected" }
+ __extension__ [[omp::directive (parallel)]] asm (""); // { dg-error "expected" }
+ [[omp::directive (parallel)]] namespace M = ::N; // { dg-error "expected" }
+ [[omp::directive (parallel)]] using namespace N; // { dg-error "not allowed to be specified in this context" }
+ [[omp::directive (parallel)]] using O::T; // { dg-error "expected" }
+ [[omp::directive (parallel)]] __label__ foo; // { dg-error "expected" }
+ [[omp::directive (parallel)]] static_assert (true, ""); // { dg-error "expected" }
+ [[omp::directive (parallel)]] int a = 5; // { dg-error "not allowed to be specified in this context" }
+ int b = 0;
+ [[omp::directive (parallel)]] l: b++; // { dg-error "not allowed to be specified in this context" }
+ switch (0)
+ {
+ [[omp::directive (parallel)]] case 6: break; // { dg-error "not allowed to be specified in this context" }
+ [[omp::directive (parallel)]] default: break; // { dg-error "not allowed to be specified in this context" }
+ }
+}
+
+void
+bar ()
+{
+ [[omp::directive (declare simd)]] int a; // { dg-error "not allowed to be specified in this context|not immediately followed by function declaration or definition" }
+ [[omp::directive (declare simd)]] int b, f1 (int); // { dg-error "not allowed to be specified in this context|not immediately followed by function declaration or definition" }
+ [[omp::directive (declare simd)]] int f2 (int), c; // { dg-error "not immediately followed by function declaration or definition" }
+ int d [[omp::directive (declare simd)]]; // { dg-error "not allowed to be specified in this context" }
+ int f3 [[omp::directive (declare simd)]] (int), f4 [[omp::directive (declare simd)]] (int);
+ __extension__ [[omp::directive (declare simd)]] int f5 (int);
+ __extension__ int f6 [[omp::directive (declare simd, notinbranch)]] (int);
+ #pragma omp declare simd notinbranch
+ [[omp::directive (declare simd inbranch)]] int f7 (int); // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same declaration" }
+ [[omp::directive (declare simd notinbranch)]]
+ #pragma omp declare simd inbranch // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ int f8 (int);
+ static int t1, t2, t3, t4;
+ [[omp::directive (declare simd), omp::directive (foobar)]] int f9 (int); // { dg-error "unknown OpenMP directive name" }
+ [[omp::directive (foobar), omp::directive (declare simd)]] int f10 (int); // { dg-error "unknown OpenMP directive name" }
+ [[omp::directive (threadprivate (t1)), omp::directive (declare simd)]] int f10 (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+ [[omp::directive (declare simd), omp::directive (threadprivate (t2))]] int f11 (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+ int f12 [[omp::directive (declare simd), omp::directive (foobar)]] (int); // { dg-error "unknown OpenMP directive name" }
+ int f13 [[omp::directive (foobar), omp::directive (declare simd)]] (int); // { dg-error "unknown OpenMP directive name" }
+ int f14 [[omp::directive (threadprivate (t3)), omp::directive (declare simd)]] (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+ int f15 [[omp::directive (declare simd), omp::directive (threadprivate (t4))]] (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+}
+
+[[omp::directive (declare simd)]] int a; // { dg-error "not allowed to be specified in this context|not immediately followed by function declaration or definition" }
+[[omp::directive (declare simd)]] int b, f16 (int); // { dg-error "not allowed to be specified in this context|not immediately followed by function declaration or definition" }
+[[omp::directive (declare simd)]] int f17 (int), c; // { dg-error "not immediately followed by function declaration or definition" }
+int d [[omp::directive (declare simd)]]; // { dg-error "not allowed to be specified in this context" }
+int f18 [[omp::directive (declare simd)]] (int), f19 [[omp::directive (declare simd)]] (int);
+__extension__ [[omp::directive (declare simd)]] int f20 (int);
+__extension__ int f21 [[omp::directive (declare simd, notinbranch)]] (int);
+#pragma omp declare simd notinbranch
+[[omp::directive (declare simd inbranch)]] int f22 (int); // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same declaration" }
+[[omp::directive (declare simd notinbranch)]] // { dg-error "'declare simd' directive not immediately followed by function declaration or definition" }
+#pragma omp declare simd inbranch // { dg-error "'#pragma' is not allowed here" }
+int f23 (int);
+int t5, t6, t7, t8;
+[[omp::directive (declare simd), omp::directive (foobar)]] int f24 (int); // { dg-error "unknown OpenMP directive name" }
+[[omp::directive (foobar), omp::directive (declare simd)]] int f25 (int); // { dg-error "unknown OpenMP directive name" }
+[[omp::directive (threadprivate (t5)), omp::directive (declare simd)]] int f26 (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+[[omp::directive (declare simd), omp::directive (threadprivate (t6))]] int f27 (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+int f28 [[omp::directive (declare simd), omp::directive (foobar)]] (int); // { dg-error "unknown OpenMP directive name" }
+int f29 [[omp::directive (foobar), omp::directive (declare simd)]] (int); // { dg-error "unknown OpenMP directive name" }
+int f30 [[omp::directive (threadprivate (t7)), omp::directive (declare simd)]] (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+int f31 [[omp::directive (declare simd), omp::directive (threadprivate (t8))]] (int); // { dg-error "OpenMP directive other than 'declare simd' or 'declare variant' appertains to a declaration" }
+
+void
+baz ()
+{
+ #pragma omp parallel
+ [[omp::directive (declare simd)]] extern int f32 (int); // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ #pragma omp parallel
+ extern int f33 [[omp::directive (declare simd)]] (int); // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ [[omp::directive (parallel)]]
+ #pragma omp declare simd // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ extern int f34 (int);
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-12.C b/gcc/testsuite/g++.dg/gomp/attrs-12.C
new file mode 100644
index 0000000..b613872
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-12.C
@@ -0,0 +1,41 @@
+// { dg-do compile { target c++11 } }
+
+#pragma omp declare target
+#pragma omp declare target
+[[omp::directive (declare target)]];
+int a;
+[[omp::directive (end declare target)]];
+#pragma omp end declare target
+#pragma omp end declare target
+[[omp::directive (declare target)]];
+int b;
+#pragma omp end declare target // { dg-error "'declare target' in attribute syntax terminated with 'end declare target' in pragma syntax" }
+#pragma omp declare target
+int c;
+[[omp::directive (end declare target)]];// { dg-error "'declare target' in pragma syntax terminated with 'end declare target' in attribute syntax" }
+#pragma omp declare target
+[[omp::directive (declare target)]];
+int d;
+#pragma omp end declare target // { dg-error "'declare target' in attribute syntax terminated with 'end declare target' in pragma syntax" }
+#pragma omp declare target
+int e;
+[[omp::directive (end declare target)]];// { dg-error "'declare target' in pragma syntax terminated with 'end declare target' in attribute syntax" }
+#pragma omp end declare target
+[[omp::directive (declare target)]];
+[[omp::directive (declare target)]];
+int f;
+#pragma omp end declare target // { dg-error "'declare target' in attribute syntax terminated with 'end declare target' in pragma syntax" }
+#pragma omp declare target
+int g;
+[[omp::directive (end declare target)]];// { dg-error "'declare target' in pragma syntax terminated with 'end declare target' in attribute syntax" }
+[[omp::directive (end declare target)]];
+[[omp::directive (declare target)]];
+#pragma omp declare target
+int h;
+#pragma omp end declare target
+#pragma omp end declare target // { dg-error "'declare target' in attribute syntax terminated with 'end declare target' in pragma syntax" }
+#pragma omp declare target
+[[omp::directive (declare target)]];
+int i;
+[[omp::directive (end declare target)]];
+[[omp::directive (end declare target)]];// { dg-error "'declare target' in pragma syntax terminated with 'end declare target' in attribute syntax" }
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-13.C b/gcc/testsuite/g++.dg/gomp/attrs-13.C
new file mode 100644
index 0000000..35e2435c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-13.C
@@ -0,0 +1,34 @@
+// { dg-do compile { target c++11 } }
+
+[[omp::directive(error)]]; // { dg-error "'pragma omp error' encountered" }
+[[omp::directive(error, at(compilation))]]; // { dg-error "'pragma omp error' encountered" }
+[[omp::directive(error severity(fatal))]]; // { dg-error "'pragma omp error' encountered" }
+[[omp::directive(error, message("my msg"))]]; // { dg-error "'pragma omp error' encountered: my msg" }
+[[omp::directive(error severity(warning)message("another message")at(compilation))]]; // { dg-warning "'pragma omp error' encountered: another message" }
+
+int
+foo (int i, int x)
+{
+ [[omp::directive(error)]]; // { dg-error "'pragma omp error' encountered" }
+ [[omp::directive(error, at(compilation))]]; // { dg-error "'pragma omp error' encountered" }
+ [[omp::directive(error severity(fatal))]]; // { dg-error "'pragma omp error' encountered" }
+ [[omp::directive(error, message("42 / 1"))]]; // { dg-error "'pragma omp error' encountered: 42 / 1" }
+ [[omp::directive(error severity(warning) message("bar") at(compilation))]]; // { dg-warning "'pragma omp error' encountered: bar" }
+ if (x)
+ [[omp::directive(error)]]; // { dg-error "'pragma omp error' encountered" }
+ i++;
+ if (x)
+ ;
+ else
+ [[omp::directive(error at(compilation))]]; // { dg-error "'pragma omp error' encountered" }
+ i++;
+ switch (0)
+ [[omp::directive(error, severity(fatal))]]; // { dg-error "'pragma omp error' encountered" }
+ while (0)
+ [[omp::directive(error, message("42 - 1"))]]; // { dg-error "'pragma omp error' encountered: 42 - 1" }
+ i++;
+ lab:
+ [[omp::directive(error, severity(warning) message("bar"), at(compilation))]]; // { dg-warning "'pragma omp error' encountered: bar" }
+ i++;
+ return i;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-2.C b/gcc/testsuite/g++.dg/gomp/attrs-2.C
new file mode 100644
index 0000000..5ec19b3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-2.C
@@ -0,0 +1,620 @@
+// { dg-do compile { target c++17 } }
+
+typedef enum omp_allocator_handle_t
+: __UINTPTR_TYPE__
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
+typedef enum omp_sync_hint_t {
+omp_sync_hint_none = 0x0,
+omp_lock_hint_none = omp_sync_hint_none,
+omp_sync_hint_uncontended = 0x1,
+omp_lock_hint_uncontended = omp_sync_hint_uncontended,
+omp_sync_hint_contended = 0x2,
+omp_lock_hint_contended = omp_sync_hint_contended,
+omp_sync_hint_nonspeculative = 0x4,
+omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
+omp_sync_hint_speculative = 0x8,
+omp_lock_hint_speculative = omp_sync_hint_speculative
+} omp_sync_hint_t;
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+ char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+
+int t;
+#pragma omp threadprivate (t)
+
+#pragma omp declare target
+int f, l, ll, r, r2;
+
+void
+foo (int d, int m, int i1, int i2, int p, int *idp, int s,
+ int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int ntm)
+{
+ [[omp::directive (distribute parallel for,
+ private (p),firstprivate (f),collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),order(concurrent),allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute parallel for simd,
+ private (p),firstprivate (f),collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),if(simd: i1),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),nontemporal(ntm),
+ safelen(8),simdlen(4),aligned(q: 32),order(concurrent),allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute simd,
+ private (p),firstprivate (f),collapse(1),dist_schedule(static, 16),
+ safelen(8),simdlen(4),aligned(q: 32),reduction(+:r),if(i1),nontemporal(ntm),
+ order(concurrent),allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute,
+ private (p),firstprivate (f),collapse(1),dist_schedule(static, 16),
+ allocate (omp_default_mem_alloc:f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+}
+
+void
+qux (int p)
+{
+ [[omp::directive (loop, bind(teams),order(concurrent),
+ private (p),lastprivate (l),collapse(1),reduction(+:r))]]
+ for (l = 0; l < 64; ++l)
+ ll++;
+}
+#pragma omp end declare target
+
+void
+baz (int d, int m, int i1, int i2, int p, int *idp, int s,
+ int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int ntm)
+{
+ [[omp::directive (distribute parallel for,
+ private (p),firstprivate (f),collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),copyin(t),order(concurrent),allocate (p))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute parallel for simd,
+ private (p),firstprivate (f),collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),if(simd: i1),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),nontemporal(ntm),
+ safelen(8),simdlen(4),aligned(q: 32),copyin(t),order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (distribute simd,
+ private (p),firstprivate (f),collapse(1),dist_schedule(static, 16),
+ safelen(8),simdlen(4),aligned(q: 32),reduction(+:r),if(i1),nontemporal(ntm),
+ order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (loop, bind(parallel),order(concurrent),
+ private (p),lastprivate (l),collapse(1),reduction(+:r))]]
+ for (l = 0; l < 64; ++l)
+ ll++;
+}
+
+void
+bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
+ int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm,
+ const char *msg)
+{
+ [[omp::directive (nothing)]];
+ [[omp::directive (error, at (execution), severity (warning), message (msg))]];
+ [[omp::directive (for simd,
+ private (p),firstprivate (f),lastprivate (l),linear (ll:1),reduction(+:r),schedule(static, 4),collapse(1),nowait,
+ safelen(8),simdlen(4),aligned(q: 32),nontemporal(ntm),if(i1),order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (for,
+ private (p),firstprivate (f),lastprivate (l),linear (ll:1),reduction(+:r),schedule(static, 4),collapse(1),nowait,
+ order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (simd,
+ private (p),lastprivate (l),linear (ll:1),reduction(+:r),collapse(1),safelen(8),simdlen(4),aligned(q: 32),
+ nontemporal(ntm),if(i1),order(concurrent))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel for,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),copyin(t),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),linear (ll:1),ordered schedule(static, 4),collapse(1),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel for,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),copyin(t),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),linear (ll:1),schedule(static, 4),collapse(1),order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel for simd,
+ private (p),firstprivate (f),if (i2),default(shared),shared(s),copyin(t),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),linear (ll:1),schedule(static, 4),collapse(1),
+ safelen(8),simdlen(4),aligned(q: 32),nontemporal(ntm),order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel sections,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),copyin(t),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),allocate (f))]]
+ {
+ [[using omp:directive (section)]]
+ {}
+ [[omp::sequence (omp::directive (section))]]
+ {}
+ }
+ [[omp::directive (sections, private (p),firstprivate (f),reduction(+:r),lastprivate (l),allocate (f),nowait)]]
+ {
+ ;
+ [[omp::sequence (sequence (directive (section)))]]
+ ;
+ [[omp::directive (section)]]
+ {}
+ }
+ [[omp::directive (barrier)]];
+ [[using omp:sequence (omp::directive (single, private (p),firstprivate (f),allocate (f),nowait))]]
+ ;
+ [[omp::sequence (directive (barrier))]];
+ [[using omp:sequence (directive (parallel, private (p)),
+ omp::directive (single, copyprivate (p),firstprivate (f),allocate (f)))]]
+ p = 6;
+ [[omp::directive (target parallel,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread)
+ nowait depend(inout: dd[0]),allocate (omp_default_mem_alloc:f),in_reduction(+:r2))]]
+ ;
+ [[omp::directive (target parallel for,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),linear (ll:1),ordered schedule(static, 4),collapse(1),nowait depend(inout: dd[0]),
+ allocate (omp_default_mem_alloc:f),in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[using omp:directive (target parallel for,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),linear (ll:1),schedule(static, 4),collapse(1),nowait depend(inout: dd[0]),order(concurrent),
+ allocate (omp_default_mem_alloc:f),in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (target parallel for simd,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),linear (ll:1),schedule(static, 4),collapse(1),
+ safelen(8),simdlen(4),aligned(q: 32),nowait depend(inout: dd[0]),nontemporal(ntm),if (simd: i3),order(concurrent),
+ allocate (omp_default_mem_alloc:f),in_reduction(+:r2)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[using omp:sequence (directive (target teams,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),nowait, depend(inout: dd[0]),
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)))]]
+ ;
+ [[using omp:sequence (directive (target,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ nowait depend(inout: dd[0]),allocate (omp_default_mem_alloc:f),in_reduction(+:r2)))]]
+ ;
+ [[omp::sequence (omp::directive (target teams distribute,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),nowait depend(inout: dd[0]),allocate (omp_default_mem_alloc:f),in_reduction(+:r2)))]]
+ for (int i = 0; i < 64; i++)
+ ;
+ [[omp::directive (target teams distribute parallel for,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),nowait depend(inout: dd[0]),order(concurrent),
+ allocate (omp_default_mem_alloc:f),in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (target teams distribute parallel for simd,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),order(concurrent),
+ safelen(8),simdlen(4),aligned(q: 32),nowait depend(inout: dd[0]),nontemporal(ntm),if (simd: i3),
+ allocate (omp_default_mem_alloc:f),in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (target teams distribute simd,
+ device(d),map (tofrom: m),if (i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),order(concurrent),
+ safelen(8),simdlen(4),aligned(q: 32),nowait depend(inout: dd[0]),nontemporal(ntm),
+ allocate (omp_default_mem_alloc:f),in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (target simd,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ safelen(8),simdlen(4),lastprivate (l),linear(ll: 1),aligned(q: 32),reduction(+:r),
+ nowait depend(inout: dd[0]),nontemporal(ntm),if(simd:i3),order(concurrent),
+ allocate (omp_default_mem_alloc:f),in_reduction(+:r2))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup, task_reduction(+:r2), allocate (r2)),
+ omp::directive (taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(taskloop: i1),if(simd: i2),final(fi),mergeable,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),in_reduction(+:r2),nontemporal(ntm),
+ order(concurrent),allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[using omp:sequence (omp::directive (taskgroup, task_reduction(+:r), allocate (r)),
+ directive (taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(i1),final(fi),mergeable,nogroup,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),in_reduction(+:r),nontemporal(ntm),
+ order(concurrent),allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (taskwait)]];
+ [[omp::directive (taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),if(taskloop: i1),final(fi),priority (pp)
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(+:r),if (simd: i3),nontemporal(ntm),
+ order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup, task_reduction(+:r2), allocate (r2)),
+ omp::directive (taskloop
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied, if(taskloop: i1),final(fi),mergeable, priority (pp),
+ reduction(default, +:r),in_reduction(+:r2),allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup, task_reduction(+:r2),allocate (r2)),
+ omp::directive (task,
+ private (p),firstprivate (f),shared (s),default(shared),untied,if(task: i1),final(fi),mergeable,priority (pp),
+ in_reduction(+:r2),allocate (f)))]]
+ ;
+ [[omp::directive (taskyield)]];
+ [[omp::directive (target data, if (target data: i1),device(d),map (tofrom: m),use_device_ptr (q),use_device_addr (p))]]
+ ;
+ [[omp::directive (target enter data, if (target enter data: i1),device(d),map (to: m),depend(inout: dd[0]),nowait)]]
+ ;
+ [[omp::directive (target exit data, if (target exit data: i1),device(d),map (from: m),depend(inout: dd[0]),nowait)]]
+ ;
+ [[omp::directive (target update, if (target update: i1),device(d),to (m),depend(inout: dd[0]),nowait)]]
+ ;
+ [[omp::directive (target update, if (target update: i1),device(d),from (m),depend(inout: dd[0]),nowait)]]
+ ;
+ [[omp::directive (taskwait)]];
+ [[omp::sequence (directive (target, nowait,depend(inout: dd[0]),in_reduction(+:r2)),
+ directive (teams distribute,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ;
+ [[omp::directive (teams,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ allocate (omp_default_mem_alloc: f))]]
+ ;
+ [[omp::sequence (omp::directive (target),
+ omp::directive (teams distribute parallel for,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),order(concurrent),allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[using omp:sequence (directive (target),
+ directive (teams distribute parallel for simd,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),order(concurrent),
+ safelen(8),simdlen(4),aligned(q: 32),if (simd: i3),nontemporal(ntm),
+ allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (target),
+ directive (teams distribute simd,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),order(concurrent),
+ safelen(8),simdlen(4),aligned(q: 32),if(i3),nontemporal(ntm),
+ allocate (omp_default_mem_alloc: f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (teams distribute parallel for,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),order(concurrent),
+ if (parallel: i2),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),copyin(t),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (teams distribute parallel for simd,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),
+ if (parallel: i2),num_threads (nth),proc_bind(spread),
+ lastprivate (l),schedule(static, 4),order(concurrent),
+ safelen(8),simdlen(4),aligned(q: 32),if (simd: i3),nontemporal(ntm),copyin(t),
+ allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (teams distribute simd,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),dist_schedule(static, 16),order(concurrent),
+ safelen(8),simdlen(4),aligned(q: 32),if(i3),nontemporal(ntm),allocate(f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),reduction(+:r),
+ num_threads (nth),proc_bind(spread),copyin(t),allocate (f))]]
+ ;
+ [[omp::directive (parallel masked,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),reduction(+:r),
+ num_threads (nth),proc_bind(spread),copyin(t),allocate (f),filter(d))]]
+ ;
+ [[omp::directive (parallel,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),reduction(+:r),
+ num_threads (nth),proc_bind(spread),copyin(t),allocate (f))]]
+ ;
+ [[using omp:sequence (directive (taskgroup, task_reduction (+:r2),allocate (r2)),
+ omp::directive (master taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied, if(taskloop: i1),final(fi),mergeable, priority (pp),
+ reduction(default, +:r),in_reduction(+:r2),allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[using omp:sequence (directive (taskgroup, task_reduction (+:r2),allocate (r2)),
+ omp::directive (masked taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied, if(taskloop: i1),final(fi),mergeable, priority (pp),
+ reduction(default, +:r),in_reduction(+:r2),allocate (f),filter(d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[using omp:directive (master)]];
+ [[using omp:directive (masked)]];
+ [[using omp:directive (masked,filter(d))]];
+ [[omp::sequence (omp::directive (taskgroup task_reduction (+:r2),allocate (r2)),
+ directive (master taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(taskloop: i1),if(simd: i2),final(fi),mergeable,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),in_reduction(+:r2),nontemporal(ntm),
+ order(concurrent),allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (taskgroup task_reduction (+:r2),allocate (r2)),
+ directive (masked taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(taskloop: i1),if(simd: i2),final(fi),mergeable,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),in_reduction(+:r2),nontemporal(ntm),
+ order(concurrent),allocate (f),filter(d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(taskloop: i1),final(fi),mergeable,priority (pp),
+ reduction(default, +:r),if (parallel: i2),num_threads (nth),proc_bind(spread),copyin(t),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(taskloop: i1),final(fi),mergeable,priority (pp),
+ reduction(default, +:r),if (parallel: i2),num_threads (nth),proc_bind(spread),copyin(t),allocate (f),filter(d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(taskloop: i1),if(simd: i2),final(fi),mergeable,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),nontemporal(ntm),if (parallel: i2),num_threads (nth),proc_bind(spread),copyin(t),
+ order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),grainsize (g),collapse(1),untied,if(taskloop: i1),if(simd: i2),final(fi),mergeable,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),nontemporal(ntm),if (parallel: i2),num_threads (nth),proc_bind(spread),copyin(t),
+ order(concurrent),allocate (f),filter(d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup,task_reduction (+:r2),allocate (r2)),
+ directive (master taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied,if(i1),final(fi),mergeable,priority (pp),
+ reduction(default, +:r),in_reduction(+:r2)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (directive (taskgroup,task_reduction (+:r2),allocate (r2)),
+ directive (masked taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied,if(i1),final(fi),mergeable,priority (pp),
+ reduction(default, +:r),in_reduction(+:r2),filter(d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (taskgroup,task_reduction (+:r2),allocate (r2)),
+ omp::directive (master taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied,if(i1),final(fi),mergeable,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),in_reduction(+:r2),nontemporal(ntm),
+ order(concurrent),allocate (f)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::sequence (omp::directive (taskgroup,task_reduction (+:r2),allocate (r2)),
+ omp::directive (masked taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied,if(i1),final(fi),mergeable,priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),in_reduction(+:r2),nontemporal(ntm),
+ order(concurrent),allocate (f),filter(d)))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied if(i1),final(fi),mergeable priority (pp),
+ reduction(default, +:r),num_threads (nth),proc_bind(spread),copyin(t),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied if(i1),final(fi),mergeable priority (pp),
+ reduction(default, +:r),num_threads (nth),proc_bind(spread),copyin(t),allocate (f),filter(d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel master taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied if(i1),final(fi),mergeable priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),nontemporal(ntm),num_threads (nth),proc_bind(spread),copyin(t),
+ order(concurrent),allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (parallel masked taskloop simd,
+ private (p),firstprivate (f),lastprivate (l),shared (s),default(shared),num_tasks (nta),collapse(1),untied if(i1),final(fi),mergeable priority (pp),
+ safelen(8),simdlen(4),linear(ll: 1),aligned(q: 32),reduction(default, +:r),nontemporal(ntm),num_threads (nth),proc_bind(spread),copyin(t),
+ order(concurrent),allocate (f),filter(d))]]
+ for (int i = 0; i < 64; i++)
+ ll++;
+ [[omp::directive (loop, bind(thread),order(concurrent),
+ private (p),lastprivate (l),collapse(1),reduction(+:r))]]
+ for (l = 0; l < 64; ++l)
+ ll++;
+ [[omp::directive (parallel loop,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),copyin(t),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),collapse(1),bind(parallel),order(concurrent),allocate (f))]]
+ for (l = 0; l < 64; l++)
+ ll++;
+ [[omp::directive (parallel loop,
+ private (p),firstprivate (f),if (parallel: i2),default(shared),shared(s),copyin(t),reduction(+:r),num_threads (nth),proc_bind(spread),
+ lastprivate (l),collapse(1),allocate (f))]]
+ for (l = 0; l < 64; l++)
+ ll++;
+ [[omp::directive (teams loop,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),lastprivate (l),bind(teams),allocate (f))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (teams loop,
+ private(p),firstprivate (f),shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),
+ collapse(1),lastprivate (l),order(concurrent),allocate (f))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target parallel loop,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ nowait depend(inout: dd[0]),lastprivate (l),bind(parallel),order(concurrent),collapse(1),
+ allocate (omp_default_mem_alloc: f),in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target parallel loop,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ if (parallel: i2),default(shared),shared(s),reduction(+:r),num_threads (nth),proc_bind(spread),
+ nowait depend(inout: dd[0]),lastprivate (l),order(concurrent),collapse(1),
+ allocate (omp_default_mem_alloc: f),in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target teams loop,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),nowait,depend(inout: dd[0]),
+ lastprivate (l),bind(teams),collapse(1),
+ allocate (omp_default_mem_alloc: f),in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (target teams loop,
+ device(d),map (tofrom: m),if (target: i1),private (p),firstprivate (f),defaultmap(tofrom: scalar),is_device_ptr (idp),
+ shared(s),default(shared),reduction(+:r),num_teams(nte),thread_limit(tl),nowait,depend(inout: dd[0]),
+ lastprivate (l),order(concurrent),collapse(1)
+ allocate (omp_default_mem_alloc: f),in_reduction(+:r2))]]
+ for (l = 0; l < 64; ++l)
+ ;
+ [[omp::directive (critical)]] {
+ }
+ [[omp::directive (critical (foobar),hint(omp_sync_hint_none))]]
+ ;
+ [[using omp:directive (taskwait, depend (inout: dd[0]))]]
+ ;
+ [[omp::directive (taskgroup, task_reduction(+:r2),allocate (r2))]]
+ ;
+ [[omp::directive (atomic, update,seq_cst,hint(omp_sync_hint_none))]]
+ p++;
+ [[omp::directive (atomic, read, hint(omp_sync_hint_none),relaxed)]]
+ f = p;
+ [[omp::directive (atomic,write, release hint(omp_sync_hint_none))]]
+ p = f;
+ [[omp::directive (flush)]]
+ ;
+ [[omp::directive (flush, acq_rel)]]
+ ;
+ [[omp::directive (flush, acquire)]]
+ ;
+ [[omp::directive (flush, release)]]
+ ;
+ [[omp::directive (flush, seq_cst)]]
+ ;
+ [[omp::directive (flush (p, f))]]
+ ;
+ [[omp::directive (simd,
+ private (p),lastprivate (l),linear (ll:1),reduction(+:r),collapse(1),safelen(8),simdlen(4),aligned(q: 32),
+ nontemporal(ntm),if(i1))]]
+ for (int i = 0; i < 64; i++)
+ [[omp::directive (ordered, simd)]]
+ ll++;
+ [[omp::directive (for,
+ private (p),firstprivate (f),lastprivate (l),linear (ll:1),reduction(+:r),schedule(static, 4),collapse(1),nowait,
+ ordered, allocate (f))]]
+ for (int i = 0; i < 64; i++)
+ [[omp::directive (ordered, threads)]]
+ ll++;
+ [[omp::directive(for, ordered (1))]]
+ for (l = 0; l < 64; l++)
+ {
+ [[omp::directive(ordered, depend (sink: l - 1))]];
+ [[omp::directive(ordered, depend (source))]];
+ }
+ extern omp_depend_t depobj;
+ [[omp::directive (depobj(depobj),depend(in : dd[0]))]];
+ [[omp::directive (parallel)]] {
+ if (p) {
+ [[omp::directive (cancel, parallel)]];
+ } else {
+ [[omp::directive (cancellation point, parallel)]];
+ }
+ }
+ [[omp::directive (scope, private (p), reduction(+:r), nowait)]]
+ ;
+ [[using omp:directive (scope, private (p), reduction(task, +:r))]]
+ ;
+ extern int t2;
+ [[omp::directive (threadprivate (t2))]];
+ extern int t2;
+ [[omp::directive (declare reduction (dr: int: omp_out += omp_in),initializer (omp_priv = 0))]]
+ ;
+}
+
+void corge1 ();
+
+void
+corge ()
+{
+ [[omp::directive (declare variant (corge1),match (construct={parallel,for}))]]
+ extern void corge2 ();
+ [[omp::sequence (directive (parallel), directive (for))]]
+ for (int i = 0; i < 5; i++)
+ corge2 ();
+ [[omp::directive (declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch),
+ omp::directive (declare simd,simdlen(8),notinbranch)]]
+ extern int corge3 (int l, int *p);
+ [[using omp:directive (declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch),
+ directive (declare simd, simdlen(8),notinbranch)]]
+ extern int corge4 (int l, int *p);
+ [[omp::sequence (directive (declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch),
+ omp::directive (declare simd, simdlen(8),notinbranch))]]
+ extern int corge5 (int l, int *p);
+ [[omp::directive (declare target)]];
+ extern void corge6 ();
+ [[omp::directive (end declare target)]];
+}
+
+int
+garply (int a, int *c, int *d, int *e, int *f)
+{
+ int i;
+ [[omp::directive (simd, reduction (inscan, +: a))]]
+ for (i = 0; i < 64; i++)
+ {
+ d[i] = a;
+ [[omp::directive (scan, exclusive (a))]]
+ a += c[i];
+ }
+ [[omp::directive (simd, reduction (inscan, +: a))]]
+ for (i = 0; i < 64; i++)
+ {
+ a += c[i];
+ [[using omp : sequence (sequence (directive (scan inclusive (a))))]]
+ d[i] = a;
+ }
+ return a;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-3.C b/gcc/testsuite/g++.dg/gomp/attrs-3.C
new file mode 100644
index 0000000..7aab637
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-3.C
@@ -0,0 +1,40 @@
+// { dg-do compile { target c++11 } }
+
+int i;
+int t1, t2, t3, t4, t5, t6, t7;
+
+void
+foo ()
+{
+ [[omp::directive]]; // { dg-error "'omp::directive' attribute requires argument" }
+ [[omp::directive ()]]; // { dg-error "expected OpenMP directive name" }
+ [[omp::directive (nonexistent foobar)]]; // { dg-error "unknown OpenMP directive name in 'omp::directive' attribute argument" }
+ [[omp::sequence]]; // { dg-error "'omp::sequence' attribute requires argument" }
+ [[omp::sequence()]]; // { dg-error "expected 'directive' or 'sequence'" }
+ [[omp::sequence(foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
+ [[omp::sequence(omp::foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
+ [[omp::sequence(directive(taskwait), foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
+ [[omp::sequence(omp::directive(taskwait), omp::foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
+ [[omp::sequence(directive(taskwait) foobar())]]; // { dg-error "expected '\\\)' before 'foobar'" }
+ [[omp::sequence(directive)]]; // { dg-error "expected '\\\(' before '\\\)' token" }
+ [[omp::sequence(omp::sequence)]]; // { dg-error "expected '\\\(' before '\\\)' token" }
+ [[omp::directive (parallel), omp::directive (single)]] // { dg-error "OpenMP construct among 'omp::directive' attributes requires all 'omp::directive' attributes on the same statement to be in the same 'omp::sequence'" }
+ ;
+ [[omp::directive (parallel)]] // { dg-error "OpenMP construct among 'omp::directive' attributes requires all 'omp::directive' attributes on the same statement to be in the same 'omp::sequence'" }
+ [[omp::directive (single)]]
+ ;
+ [[omp::directive (taskwait), omp::directive (taskyield)]] // { dg-error "multiple OpenMP standalone directives among 'omp::directive' attributes must be all within the same 'omp::sequence'" }
+ ;
+ [[omp::directive (taskwait)]]
+ [[omp::directive (taskyield)]] // { dg-error "multiple OpenMP standalone directives among 'omp::directive' attributes must be all within the same 'omp::sequence'" }
+ ;
+ [[omp::directive (flush)]] // { dg-error "standalone OpenMP directives in 'omp::directive' attribute can only appear on an empty statement" }
+ i++;
+ auto a = [] () [[omp::directive (threadprivate (t1))]] {}; // { dg-error "'omp::directive' not allowed to be specified in this context" }
+ int [[omp::directive (threadprivate (t2))]] b; // { dg-warning "attribute ignored" }
+ int *[[omp::directive (threadprivate (t3))]] c; // { dg-warning "'omp::directive' scoped attribute directive ignored" }
+ int &[[omp::directive (threadprivate (t4))]] d = b; // { dg-warning "'omp::directive' scoped attribute directive ignored" }
+ typedef int T [[omp::directive (threadprivate (t5))]]; // { dg-error "'omp::directive' not allowed to be specified in this context" }
+ int e[10] [[omp::directive (threadprivate (t6))]]; // { dg-error "'omp::directive' not allowed to be specified in this context" }
+ struct [[omp::directive (threadprivate (t7))]] S {}; // { dg-error "'omp::directive' not allowed to be specified in this context" }
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-4.C b/gcc/testsuite/g++.dg/gomp/attrs-4.C
new file mode 100644
index 0000000..005add82
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-4.C
@@ -0,0 +1,61 @@
+// { dg-do compile { target c++11 } }
+
+void
+foo (int x)
+{
+ [[omp::directive (parallel)]]
+ #pragma omp for // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ for (int i = 0; i < 16; i++)
+ ;
+ [[omp::directive (barrier)]] // { dg-error "standalone OpenMP directives in 'omp::directive' attribute can only appear on an empty statement" }
+ #pragma omp flush
+ ;
+ #pragma omp parallel
+ [[omp::directive (master)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp teams
+ [[omp::sequence (directive (parallel), directive (master))]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp task
+ [[omp::directive (flush)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp master
+ [[omp::directive (flush)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp for ordered
+ for (int i = 0; i < 16; i++)
+ #pragma omp ordered
+ [[omp::directive (flush)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp single
+ [[omp::directive (flush)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp taskgroup
+ [[omp::directive (taskyield)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp target data map (tofrom: x)
+ [[omp::directive (flush)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp target
+ [[omp::directive (teams)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ [[omp::directive (parallel)]]
+ #pragma omp master // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ [[omp::sequence (omp::directive (taskloop))]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ for (int i = 0; i < 16; i++)
+ ;
+ #pragma omp parallel
+ [[omp::directive (for)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ for (int i = 0; i < 16; i++)
+ ;
+ #pragma omp for
+ [[omp::directive (master)]] // { dg-error "for statement expected before '\\\[' token" }
+ ;
+ #pragma omp target teams
+ [[omp::directive (parallel)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ ;
+ #pragma omp parallel master
+ [[omp::directive (taskloop)]] // { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" }
+ for (int i = 0; i < 16; i++)
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-5.C b/gcc/testsuite/g++.dg/gomp/attrs-5.C
new file mode 100644
index 0000000..f6d24b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-5.C
@@ -0,0 +1,46 @@
+// { dg-do compile { target c++11 } }
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+ char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+
+void
+foo (int x)
+{
+ #pragma omp barrier
+ [[omp::directive (barrier)]];
+ #pragma omp parallel
+ {
+ #pragma omp cancel parallel
+ [[omp::directive (cancellation point, parallel)]];
+ }
+ #pragma omp parallel
+ {
+ #pragma omp cancellation point parallel
+ [[omp::directive (cancel parallel)]];
+ }
+ #pragma omp parallel
+ {
+ [[omp::directive (cancel, parallel)]];
+ #pragma omp cancellation point parallel
+ }
+ omp_depend_t depobj;
+ #pragma omp depobj(depobj) update(inout)
+ [[omp::directive (depobj(depobj), destroy)]];
+ #pragma omp flush
+ [[omp::directive (flush)]];
+ #pragma omp target enter data map (to: x)
+ [[omp::directive (target exit data, map (from: x))]];
+ [[omp::directive (target enter data, map (to: x))]];
+ #pragma omp target exit data map (from: x)
+ [[omp::directive (flush)]];
+ #pragma omp target update to (x)
+ [[omp::directive (flush)]];
+ #pragma omp taskwait
+ [[omp::directive (flush)]];
+ #pragma omp taskyield
+ [[omp::directive (flush)]];
+ extern int t;
+ #pragma omp threadprivate (t)
+ [[omp::directive (flush)]];
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-6.C b/gcc/testsuite/g++.dg/gomp/attrs-6.C
new file mode 100644
index 0000000..30b47e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-6.C
@@ -0,0 +1,50 @@
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+ int a[10] = {};
+ #pragma omp parallel sections
+ {
+ #pragma omp section
+ a[0]++;
+ [[omp::directive (section)]] {
+ a[1]++;
+ } [[omp::directive (section)]]
+ a[2]++;
+ #pragma omp section
+ { a[3]++; }
+ }
+ [[omp::directive (parallel sections)]]
+ {
+ #pragma omp section
+ a[0]++;
+ [[omp::directive (section)]] {
+ a[1]++;
+ } [[omp::directive (section)]]
+ a[2]++;
+ #pragma omp section
+ { a[3]++; }
+ }
+}
+
+int
+bar (int a, int *c, int *d, int *e, int *f)
+{
+ int i;
+ #pragma omp simd reduction (inscan, +: a)
+ for (i = 0; i < 64; i++)
+ {
+ d[i] = a;
+ [[omp::directive (scan, exclusive (a))]]
+ a += c[i];
+ }
+ [[omp::directive (simd reduction (inscan, +: a))]]
+ for (i = 0; i < 64; i++)
+ {
+ a += c[i];
+ #pragma omp scan inclusive (a)
+ d[i] = a;
+ }
+ return a;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-7.C b/gcc/testsuite/g++.dg/gomp/attrs-7.C
new file mode 100644
index 0000000..cf84281
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-7.C
@@ -0,0 +1,63 @@
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+
+ [[omp::directive (parallel sections)]]
+ {
+ [[omp::directive (parallel)]];
+ [[omp::sequence (directive (section), directive (flush))]]; // { dg-error "must be the only specified attribute on a statement" }
+ // { dg-error "#pragma omp section" "" { target *-*-* } .-1 }
+ // { dg-error "#pragma omp flush" "" { target *-*-* } .-2 }
+ [[omp::sequence (directive (flush), omp::directive (section))]]; // { dg-error "must be the only specified attribute on a statement" }
+ // { dg-error "#pragma omp flush" "" { target *-*-* } .-1 }
+ [[gnu::cold, omp::directive (section)]]; // { dg-error "must be the only specified attribute on a statement" }
+ // { dg-error "#pragma omp section" "" { target *-*-* } .-1 }
+ [[omp::directive (section)]] [[gnu::cold]]; // { dg-error "must be the only specified attribute on a statement" }
+ // { dg-error "#pragma omp section" "" { target *-*-* } .-1 }
+ [[omp::directive (section foo)]]; // { dg-error "expected end of line before 'foo'" }
+ }
+}
+
+int
+bar (int a, int *c, int *d, int *e, int *f)
+{
+ int i;
+ [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
+ for (i = 0; i < 64; i++)
+ {
+ d[i] = a;
+ [[omp::sequence (omp::directive (parallel), omp::directive (scan, exclusive (a)))]] // { dg-error "must be the only specified attribute on a statement" }
+ a += c[i]; // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
+ }
+ [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
+ for (i = 0; i < 64; i++)
+ {
+ a += c[i];
+ [[omp::sequence (directive (scan inclusive (a)), directive (critical))]] // { dg-error "must be the only specified attribute on a statement" }
+ d[i] = a; // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
+ }
+ [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
+ for (i = 0; i < 64; i++)
+ {
+ d[i] = a;
+ [[gnu::cold]] [[omp::directive (scan, exclusive (a))]] // { dg-error "must be the only specified attribute on a statement" }
+ a += c[i]; // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
+ }
+ [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
+ for (i = 0; i < 64; i++)
+ {
+ d[i] = a;
+ [[omp::directive (scan, exclusive (a)), gnu::cold]] // { dg-error "must be the only specified attribute on a statement" }
+ a += c[i]; // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
+ }
+ [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
+ for (i = 0; i < 64; i++)
+ {
+ d[i] = a;
+ [[omp::directive (scan)]] // { dg-error "expected 'inclusive' or 'exclusive' clause before end of line" }
+ a += c[i];
+ }
+ return a;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-8.C b/gcc/testsuite/g++.dg/gomp/attrs-8.C
new file mode 100644
index 0000000..30cfe99
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-8.C
@@ -0,0 +1,10 @@
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+ // Unsure if this shouldn't be invalid, whether we shouldn't require
+ // that each standalone directive sits on its own empty statement.
+ [[omp::sequence (omp::directive (barrier), omp::directive (barrier))]];
+ [[omp::sequence (omp::directive (taskyield), omp::directive (taskwait))]];
+}
diff --git a/gcc/testsuite/g++.dg/gomp/attrs-9.C b/gcc/testsuite/g++.dg/gomp/attrs-9.C
new file mode 100644
index 0000000..08cd2b1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/attrs-9.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++11 } }
+
+[[omp::sequence (directive (requires, atomic_default_mem_order (seq_cst)))]];
+[[omp::directive (declare reduction (plus: int: omp_out += omp_in) initializer (omp_priv = 0))]];
+int a;
+[[omp::directive (declare target (a))]];
+int t;
+[[omp::sequence (omp::directive (threadprivate (t)))]];
+int b, c;
+[[omp::directive (declare target, to (b), link (c))]];
+[[omp::directive (declare target)]];
+[[omp::directive (declare target)]];
+int d;
+[[omp::directive (end declare target)]];
+[[omp::directive (end declare target)]];
+[[omp::directive (nothing)]];
diff --git a/gcc/testsuite/g++.dg/gomp/barrier-2.C b/gcc/testsuite/g++.dg/gomp/barrier-2.C
index 1d929d2..6f3fded 100644
--- a/gcc/testsuite/g++.dg/gomp/barrier-2.C
+++ b/gcc/testsuite/g++.dg/gomp/barrier-2.C
@@ -9,4 +9,4 @@ void f3(bool p)
{
if (p)
#pragma omp barrier // { dg-error "compound statements" }
-} // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/gomp/block-11.C b/gcc/testsuite/g++.dg/gomp/block-11.C
index c280006..cf4b0d3 100644
--- a/gcc/testsuite/g++.dg/gomp/block-11.C
+++ b/gcc/testsuite/g++.dg/gomp/block-11.C
@@ -1,3 +1,21 @@
+// { dg-do compile }
+
+void foo()
+{
+ #pragma omp masked
+ {
+ goto bad1; // { dg-message "from here" }
+ }
+
+ #pragma omp masked filter(1)
+ {
+ bad1: // { dg-error "jump" }
+ // { dg-message "exits OpenMP" "" { target *-*-* } .-1 }
+ return; // { dg-error "invalid exit" }
+ }
+}
+
+// { dg-message "error: invalid branch to/from OpenMP structured block" "" { target *-*-* } 7 }
/* PR c++/24516 */
/* { dg-do compile } */
diff --git a/gcc/testsuite/g++.dg/gomp/clause-3.C b/gcc/testsuite/g++.dg/gomp/clause-3.C
index e0edc87..aad97d6 100644
--- a/gcc/testsuite/g++.dg/gomp/clause-3.C
+++ b/gcc/testsuite/g++.dg/gomp/clause-3.C
@@ -56,7 +56,7 @@ foo (int x)
;
#pragma omp p reduction (|:d) // { dg-error "user defined reduction not found for" }
;
-#pragma omp p reduction (&&:d) // { dg-error "user defined reduction not found for" }
+#pragma omp p reduction (&:d) // { dg-error "user defined reduction not found for" }
;
#pragma omp p copyin (d) // { dg-error "must be 'threadprivate'" }
;
diff --git a/gcc/testsuite/g++.dg/gomp/declare-simd-8.C b/gcc/testsuite/g++.dg/gomp/declare-simd-8.C
new file mode 100644
index 0000000..01c91e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/declare-simd-8.C
@@ -0,0 +1,15 @@
+// PR c++/100872
+
+template <int N, typename T>
+struct S {
+ #pragma omp declare simd aligned(a : N * 2) aligned(b) linear(ref(b): N)
+ float foo (float *a, T *&b) { return *a + *b; }
+};
+
+S<16, float> s;
+
+float
+bar (float *a, float *p)
+{
+ return s.foo (a, p);
+}
diff --git a/gcc/testsuite/g++.dg/gomp/depend-iterator-3.C b/gcc/testsuite/g++.dg/gomp/depend-iterator-3.C
new file mode 100644
index 0000000..1a7f29a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/depend-iterator-3.C
@@ -0,0 +1,43 @@
+// PR c++/100859
+
+struct S {
+ S () {}
+};
+
+struct W {
+ S c[10];
+ W () {
+#pragma omp task affinity (iterator (i = 0 : 10 : 1): c[i])
+ ;
+#pragma omp task depend (iterator (i = 0 : 10 : 1), inout: c[i])
+ ;
+#pragma omp task affinity (this[0])
+ ;
+#pragma omp task depend (inout: this[0])
+ ;
+#pragma omp taskwait
+ }
+};
+
+template <typename T>
+struct U {
+ T c[10];
+ U () {
+#pragma omp task affinity (iterator (i = 0 : 10 : 1): c[i])
+ ;
+#pragma omp task depend (iterator (i = 0 : 10 : 1), inout: c[i])
+ ;
+#pragma omp task affinity (this[0])
+ ;
+#pragma omp task depend (inout: this[0])
+ ;
+#pragma omp taskwait
+ }
+};
+
+struct V : public U<S> {
+ V () : U<S> () {}
+};
+
+W w;
+V v;
diff --git a/gcc/testsuite/g++.dg/gomp/doacross-2.C b/gcc/testsuite/g++.dg/gomp/doacross-2.C
new file mode 100644
index 0000000..1fd6357
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/doacross-2.C
@@ -0,0 +1,16 @@
+// PR c++/100957
+// { dg-do compile }
+
+struct S {
+ S ()
+ {
+ #pragma omp for ordered(2)
+ for (int i = 0; i < 32; ++i)
+ for (int j = 0; j < 32; ++j)
+ {
+ #pragma omp ordered depend(source)
+ ;
+ #pragma omp ordered depend(sink: i - 1, j - 1)
+ }
+ }
+};
diff --git a/gcc/testsuite/g++.dg/gomp/error-1.C b/gcc/testsuite/g++.dg/gomp/error-1.C
new file mode 100644
index 0000000..a636550
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/error-1.C
@@ -0,0 +1,42 @@
+// { dg-do compile { target c++17 } }
+
+void
+foo ()
+{
+ if constexpr (false)
+ {
+ #pragma omp error // { dg-bogus "'pragma omp error' encountered" }
+ }
+ else
+ {
+ #pragma omp error at(compilation) severity(warning) message("foo") // { dg-warning "'pragma omp error' encountered: foo" }
+ }
+ if constexpr (true)
+ {
+ #pragma omp error message("bar") // { dg-error "'pragma omp error' encountered: bar" }
+ }
+ else
+ {
+ #pragma omp error message("baz") // { dg-bogus "'pragma omp error' encountered" }
+ }
+}
+
+template <typename T>
+bool
+bar (T x)
+{
+ #pragma omp error at(execution) message (x)
+ return false;
+}
+
+bool a = bar ("foo");
+
+template <typename T>
+bool
+baz (T x)
+{
+ #pragma omp error at(execution) message (x) // { dg-error "could not convert" }
+ return false;
+}
+
+bool b = baz (L"foo");
diff --git a/gcc/testsuite/g++.dg/gomp/pr101516.C b/gcc/testsuite/g++.dg/gomp/pr101516.C
new file mode 100644
index 0000000..48f60de
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr101516.C
@@ -0,0 +1,8 @@
+// PR c++/101516
+
+void
+foo (int (&v) [])
+{
+ #pragma omp parallel reduction (+:v) // { dg-error "invalid use of array with unspecified bounds" }
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/pr101759.C b/gcc/testsuite/g++.dg/gomp/pr101759.C
new file mode 100644
index 0000000..905b875
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr101759.C
@@ -0,0 +1,8 @@
+// PR c++/101759
+// { dg-do compile { target c++11 } }
+
+#pragma omp declare simd
+int foo (int x = []() { extern int bar (int); return 1; }());
+int corge (int = 1);
+#pragma omp declare variant (corge) match (user={condition(true)})
+int baz (int x = []() { extern int qux (int); return 1; }());
diff --git a/gcc/testsuite/g++.dg/gomp/this-1.C b/gcc/testsuite/g++.dg/gomp/this-1.C
index 30ab8b3..1bffc91 100644
--- a/gcc/testsuite/g++.dg/gomp/this-1.C
+++ b/gcc/testsuite/g++.dg/gomp/this-1.C
@@ -3,7 +3,7 @@
struct S
{
- #pragma omp declare simd linear(this) // { dg-error "is not a function argument" }
+ #pragma omp declare simd linear(this) // { dg-error "invalid use of .this" }
static void foo ();
void bar ();
};
@@ -21,9 +21,13 @@ S::bar ()
#pragma omp for linear (this) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
for (int i = 0; i < 10; i++)
;
- #pragma omp task depend(inout: this) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
+ #pragma omp task depend(inout: this) // { dg-error ".this. is not lvalue expression nor array section in .depend. clause" }
;
- #pragma omp task depend(inout: this[0]) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
+ #pragma omp task depend(inout: this[0])
+ ;
+ #pragma omp task affinity(this) // { dg-error ".this. is not lvalue expression nor array section in .affinity. clause" }
+ ;
+ #pragma omp task affinity(this[0])
;
#pragma omp parallel private (this) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
{
@@ -35,7 +39,7 @@ S::bar ()
template <int N>
struct T
{
- #pragma omp declare simd linear(this) // { dg-error "is not a function argument" }
+ #pragma omp declare simd linear(this) // { dg-error "invalid use of .this" }
static void foo ();
void bar ();
};
@@ -54,9 +58,13 @@ T<N>::bar ()
#pragma omp for linear (this) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
for (int i = 0; i < 10; i++)
;
- #pragma omp task depend(inout: this) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
+ #pragma omp task depend(inout: this) // { dg-error ".this. is not lvalue expression nor array section in .depend. clause" }
+ ;
+ #pragma omp task depend(inout: this[0])
+ ;
+ #pragma omp task affinity(this) // { dg-error ".this. is not lvalue expression nor array section in .affinity. clause" }
;
- #pragma omp task depend(inout: this[0]) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
+ #pragma omp task affinity(this[0])
;
#pragma omp parallel private (this) // { dg-error ".this. allowed in OpenMP only in .declare simd. clauses" }
{
diff --git a/gcc/testsuite/g++.dg/gomp/tls-5.C b/gcc/testsuite/g++.dg/gomp/tls-5.C
index eb187b6..81431e8 100644
--- a/gcc/testsuite/g++.dg/gomp/tls-5.C
+++ b/gcc/testsuite/g++.dg/gomp/tls-5.C
@@ -1,7 +1,7 @@
// The reference temp should be TLS, not normal data.
// { dg-require-effective-target c++11 }
// { dg-final { scan-assembler-not "\\.data" { target tls_native xfail powerpc-*-aix* } } }
-// { dg-final { scan-assembler-symbol-section {^_?ir$} {^\.tbss|\[TL\]} { target tls_native } } }
+// { dg-final { scan-assembler-symbol-section {^_?ir$} {^\.tbss} { target tls_native xfail powerpc-*-aix* } } }
// { dg-final { scan-assembler-symbol-section {^_?_ZGR2ir_$} {^\.tdata|\[TL\]} { target tls_native } } }
extern int&& ir;
diff --git a/gcc/testsuite/g++.dg/gomp/tpl-masked-1.C b/gcc/testsuite/g++.dg/gomp/tpl-masked-1.C
new file mode 100644
index 0000000..8574861
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/tpl-masked-1.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-fopenmp -fdump-tree-gimple" }
+
+int i;
+
+template <typename T> void f1 (bool p, T t)
+{
+ if (p)
+ {
+ #pragma omp masked filter (t)
+ i++;
+ }
+}
+
+void f2 ()
+{
+ f1<int> (true, 0);
+ f1<long> (true, 0L);
+}
+
+// { dg-final { scan-tree-dump-times "#pragma omp masked" 2 "gimple" } }
diff --git a/gcc/testsuite/g++.dg/inherit/covariant23.C b/gcc/testsuite/g++.dg/inherit/covariant23.C
new file mode 100644
index 0000000..b27be15
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/covariant23.C
@@ -0,0 +1,14 @@
+// PR c++/99664
+// { dg-do compile { target c++11 } }
+
+struct Res { };
+
+struct A {
+ virtual Res &&f();
+ virtual Res &g();
+};
+
+struct B : A {
+ Res &f() override; // { dg-error "return type" }
+ Res &&g() override; // { dg-error "return type" }
+};
diff --git a/gcc/testsuite/g++.dg/inherit/virtual15.C b/gcc/testsuite/g++.dg/inherit/virtual15.C
new file mode 100644
index 0000000..ebd8e3a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/virtual15.C
@@ -0,0 +1,18 @@
+// PR c++/100797
+// { dg-do run }
+
+bool ok = false;
+struct S1 { virtual ~S1() {} };
+struct S2 { virtual void f1() = 0; };
+struct S3: S1, S2 {
+ void f1() { f2(); }
+ virtual void f2() = 0;
+};
+struct S4: S3 {
+ void f2() { ok = true; }
+ using S2::f1;
+};
+int main() {
+ S4().f1();
+ if (!ok) __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/inherit/virtual15a.C b/gcc/testsuite/g++.dg/inherit/virtual15a.C
new file mode 100644
index 0000000..6139385
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/virtual15a.C
@@ -0,0 +1,19 @@
+// PR c++/100797 plus diamond inheritance
+// { dg-do run }
+
+bool ok = false;
+struct S1 { virtual ~S1() {} };
+struct S2 { virtual void f1() = 0; };
+struct S3: S1, virtual S2 {
+ void f1() { f2(); }
+ virtual void f2() = 0;
+};
+struct SX: virtual S2 { };
+struct S4: SX, S3 {
+ void f2() { ok = true; }
+ using S2::f1;
+};
+int main() {
+ S4().f1();
+ if (!ok) __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/init/no-elide2.C b/gcc/testsuite/g++.dg/init/no-elide2.C
new file mode 100644
index 0000000..9a0ba19
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/no-elide2.C
@@ -0,0 +1,32 @@
+// PR c++/100838
+// { dg-do run }
+// { dg-additional-options -fno-elide-constructors }
+
+extern "C" int puts (const char *);
+
+int c,d;
+class MyString {
+public:
+ MyString(const char* s = "") {
+ puts ("ctor");
+ ++c;
+ }
+ ~MyString() {
+ puts ("dtor");
+ ++d;
+ }
+ MyString(const MyString& s) {
+ puts ("copy ctor");
+ ++c;
+ }
+ MyString& operator=(const MyString& s);
+};
+
+int main() {
+ {
+ MyString s1 = "Hello";
+ puts ("main");
+ }
+ if (c != d)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/g++.dg/ipa/ipa-sra-4.C b/gcc/testsuite/g++.dg/ipa/ipa-sra-4.C
new file mode 100644
index 0000000..56d59f9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/ipa-sra-4.C
@@ -0,0 +1,37 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2 -fipa-sra" } */
+
+void __throw_bad_alloc() __attribute__((__noreturn__));
+void __throw_bad_array_new_length();
+template <typename> class allocator {};
+template <typename> struct allocator_traits;
+int *allocate___trans_tmp_2;
+template <typename _Tp> struct allocator_traits<allocator<_Tp>> {
+ using allocator_type = allocator<_Tp>;
+ using pointer = _Tp *;
+ using size_type = long;
+ static pointer allocate(allocator_type &, size_type __n) {
+ long __trans_tmp_3 = __n;
+ if (__builtin_expect(__trans_tmp_3, false))
+ if (__trans_tmp_3)
+ __throw_bad_array_new_length();
+ operator new(sizeof(int));
+ return allocate___trans_tmp_2;
+ }
+};
+class throw_allocator_base {
+ allocator<int> _M_allocator;
+public:
+ int *allocate(long __n) {
+ if (__n)
+ __throw_bad_alloc();
+ int *a = allocator_traits<allocator<int>>::allocate(_M_allocator, __n);
+ return a;
+ }
+};
+template <typename Alloc> void check_allocate_max_size() {
+ Alloc a;
+ long __trans_tmp_1 = 0;
+ a.allocate(__trans_tmp_1 + 1);
+}
+int main() { check_allocate_max_size<throw_allocator_base>(); }
diff --git a/gcc/testsuite/g++.dg/ipa/pr45572-2.C b/gcc/testsuite/g++.dg/ipa/pr45572-2.C
index 8b583d9..9bf49ac 100644
--- a/gcc/testsuite/g++.dg/ipa/pr45572-2.C
+++ b/gcc/testsuite/g++.dg/ipa/pr45572-2.C
@@ -1,5 +1,5 @@
// { dg-do compile }
-// { dg-options "-finline-small-functions -findirect-inlining -finline-function+
+// { dg-options "-finline-small-functions -findirect-inlining -finline-functions -O" }
typedef struct
{} __mpf_struct;
typedef __mpf_struct mpf_t[1];
diff --git a/gcc/testsuite/g++.dg/ipa/pr82352.C b/gcc/testsuite/g++.dg/ipa/pr82352.C
index 08516da..7c8d0eb 100644
--- a/gcc/testsuite/g++.dg/ipa/pr82352.C
+++ b/gcc/testsuite/g++.dg/ipa/pr82352.C
@@ -17,7 +17,7 @@ private :
class B
{
public :
- void *operator new(size_t t) { return (void*)(42); };
+ void *operator new(size_t);
};
class C
diff --git a/gcc/testsuite/g++.dg/ipa/pure-const-3.C b/gcc/testsuite/g++.dg/ipa/pure-const-3.C
index 4cf9a6a..172a36b 100644
--- a/gcc/testsuite/g++.dg/ipa/pure-const-3.C
+++ b/gcc/testsuite/g++.dg/ipa/pure-const-3.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-ipa-vrp -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-ipa-vrp -fdump-tree-optimized -fno-tree-ccp" } */
int *ptr;
static int barvar;
static int b(int a);
diff --git a/gcc/testsuite/g++.dg/lookup/operator-3.C b/gcc/testsuite/g++.dg/lookup/operator-3.C
new file mode 100644
index 0000000..bc5eb3d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/operator-3.C
@@ -0,0 +1,109 @@
+// PR c++/51577
+
+template <class T> void f (T x) {
+ +x; // { dg-error "no match" }
+ -x; // { dg-error "no match" }
+ *x; // { dg-error "no match" }
+ ~x; // { dg-error "no match" }
+ &x;
+ !x; // { dg-error "no match" }
+ ++x; // { dg-error "no match" }
+ --x; // { dg-error "no match" }
+ x++; // { dg-error "declared for postfix" }
+ x--; // { dg-error "declared for postfix" }
+
+ x->*x; // { dg-error "no match" }
+ x / x; // { dg-error "no match" }
+ x * x; // { dg-error "no match" }
+ x + x; // { dg-error "no match" }
+ x - x; // { dg-error "no match" }
+ x % x; // { dg-error "no match" }
+ x & x; // { dg-error "no match" }
+ x | x; // { dg-error "no match" }
+ x ^ x; // { dg-error "no match" }
+ x << x; // { dg-error "no match" }
+ x >> x; // { dg-error "no match" }
+ x && x; // { dg-error "no match" }
+ x || x; // { dg-error "no match" }
+ x, x;
+
+ x == x; // { dg-error "no match" }
+ x != x; // { dg-error "no match" }
+ x < x; // { dg-error "no match" }
+ x > x; // { dg-error "no match" }
+ x <= x; // { dg-error "no match" }
+ x >= x; // { dg-error "no match" }
+#if __cplusplus > 201703L
+ x <=> x; // { dg-error "no match" "" { target c++20 } }
+#endif
+
+ x += x; // { dg-error "no match" }
+ x -= x; // { dg-error "no match" }
+ x *= x; // { dg-error "no match" }
+ x /= x; // { dg-error "no match" }
+ x %= x; // { dg-error "no match" }
+ x |= x; // { dg-error "no match" }
+ x ^= x; // { dg-error "no match" }
+ x <<= x; // { dg-error "no match" }
+ x >>= x; // { dg-error "no match" }
+}
+
+namespace N { struct A { }; }
+
+void operator+(N::A);
+void operator-(N::A);
+void operator*(N::A);
+void operator~(N::A);
+#if __cplusplus >= 201103L
+void operator&(N::A) = delete;
+#else
+void operator&(N::A);
+#endif
+void operator!(N::A);
+void operator++(N::A);
+void operator--(N::A);
+void operator++(N::A, int);
+void operator--(N::A, int);
+
+void operator->*(N::A, N::A);
+void operator/(N::A, N::A);
+void operator*(N::A, N::A);
+void operator+(N::A, N::A);
+void operator-(N::A, N::A);
+void operator%(N::A, N::A);
+void operator&(N::A, N::A);
+void operator|(N::A, N::A);
+void operator^(N::A, N::A);
+void operator<<(N::A, N::A);
+void operator>>(N::A, N::A);
+void operator&&(N::A, N::A);
+void operator||(N::A, N::A);
+#if __cplusplus >= 201103L
+void operator,(N::A, N::A) = delete;
+#else
+void operator,(N::A, N::A);
+#endif
+
+void operator==(N::A, N::A);
+void operator!=(N::A, N::A);
+void operator<(N::A, N::A);
+void operator>(N::A, N::A);
+void operator<=(N::A, N::A);
+void operator>=(N::A, N::A);
+#if __cplusplus > 201703L
+void operator<=>(N::A, N::A);
+#endif
+
+void operator+=(N::A, N::A);
+void operator-=(N::A, N::A);
+void operator*=(N::A, N::A);
+void operator/=(N::A, N::A);
+void operator%=(N::A, N::A);
+void operator|=(N::A, N::A);
+void operator^=(N::A, N::A);
+void operator<<=(N::A, N::A);
+void operator>>=(N::A, N::A);
+
+int main() {
+ f(N::A());
+}
diff --git a/gcc/testsuite/g++.dg/lookup/pr84962.C b/gcc/testsuite/g++.dg/lookup/pr84962.C
index b9b7a31..c22b95c 100644
--- a/gcc/testsuite/g++.dg/lookup/pr84962.C
+++ b/gcc/testsuite/g++.dg/lookup/pr84962.C
@@ -9,6 +9,6 @@ struct X {
// { dg-error "public non-static data member" "" { target *-*-* } .-1 }
};
- int : a; // { dg-error "non-integral" }
+ int : a; // { dg-error "" }
};
diff --git a/gcc/testsuite/g++.dg/lookup/strong-using.C b/gcc/testsuite/g++.dg/lookup/strong-using.C
index 9d58fdd..2bd821e 100644
--- a/gcc/testsuite/g++.dg/lookup/strong-using.C
+++ b/gcc/testsuite/g++.dg/lookup/strong-using.C
@@ -8,3 +8,12 @@ namespace A
using namespace B __attribute__ ((strong)); // { dg-warning "no longer supported" "" }
}
+
+namespace C
+{
+ namespace D // { dg-message "inline namespace" }
+ {
+ }
+
+ [[gnu::strong]] using namespace D; // { dg-warning "no longer supported" "" }
+}
diff --git a/gcc/testsuite/g++.dg/lookup/strong-using2.C b/gcc/testsuite/g++.dg/lookup/strong-using2.C
index 1728494..989827c 100644
--- a/gcc/testsuite/g++.dg/lookup/strong-using2.C
+++ b/gcc/testsuite/g++.dg/lookup/strong-using2.C
@@ -9,3 +9,12 @@ namespace A
using namespace B __attribute__ ((strong)); // { dg-bogus "no longer supported" }
}
+
+namespace C
+{
+ namespace D // { dg-bogus "inline namespace" }
+ {
+ }
+
+ [[gnu::strong]] using namespace D; // { dg-bogus "no longer supported" }
+}
diff --git a/gcc/testsuite/g++.dg/lookup/using-decl1.C b/gcc/testsuite/g++.dg/lookup/using-decl1.C
new file mode 100644
index 0000000..7ccb4fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using-decl1.C
@@ -0,0 +1,38 @@
+// Testcase from [namespace.udecl] updated by P1787
+
+namespace A {
+ int x;
+ int f(int);
+ int g;
+ void h();
+}
+
+namespace B {
+ int i;
+ struct g { };
+ struct x { };
+ void f(int);
+ void f(double);
+ void g(char); // OK: hides struct g
+}
+
+void func() {
+ int i;
+ using B::i; // { dg-error "" } i conflicts
+ void f(char);
+ using B::f; // OK: each f is a function
+ using A::f; // OK, but interferes with B::f(int)
+ f(1); // { dg-error "" } ambiguous
+ static_cast<int(*)(int)>(f)(1); // OK: calls A::f
+ f(3.5); // calls B::f(double)
+ using B::g;
+ g('a'); // calls B::g(char)
+ struct g g1; // g1 has class type B::g
+ using A::g; // { dg-error "" } conflicts with B::g
+ void h();
+ using A::h; // { dg-error "" } conflicts
+ using B::x;
+ using A::x; // OK: hides struct B::x
+ x = 99; // assigns to A::x
+ struct x x1; // x1 has class type B::x
+}
diff --git a/gcc/testsuite/g++.dg/lookup/using66.C b/gcc/testsuite/g++.dg/lookup/using66.C
new file mode 100644
index 0000000..02383bb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using66.C
@@ -0,0 +1,23 @@
+// PR c++/92918
+// { dg-do compile { target c++11 } }
+
+struct Base03
+{
+ static void impl();
+};
+
+struct Problem : Base03
+{
+ using Base03::impl;
+ static int impl(char const *);
+
+ template <typename T>
+ auto f(const T &t) const
+ -> decltype(impl(t))
+ {
+ return impl(t);
+ }
+};
+
+Problem t;
+int i = t.f("42");
diff --git a/gcc/testsuite/g++.dg/lto/odr-1_0.C b/gcc/testsuite/g++.dg/lto/odr-1_0.C
index 6fff888..318a047 100644
--- a/gcc/testsuite/g++.dg/lto/odr-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/odr-1_0.C
@@ -1,8 +1,10 @@
// PR c++/82414
// { dg-lto-do link }
enum vals {aa,cc}; // { dg-lto-warning "6: type 'vals' violates the C\\+\\+ One Definition Rule" }
+// { dg-lto-note "name 'cc' differs from name 'bb' defined in another translation unit" "" { target *-*-* } .-1 }
struct a { // { dg-lto-warning "8: type 'struct a' violates the C\\+\\+ One Definition Rule" }
- struct b *ptr; // { dg-lto-message "13: the first difference of corresponding definitions is field 'ptr'" }
+ struct b *ptr; // { dg-lto-note "13: the first difference of corresponding definitions is field 'ptr'" }
+ // { dg-lto-note "the incompatible type defined in another translation unit" "" { target *-*-* } .-1 }
enum vals vals;
};
void test(struct a *a)
diff --git a/gcc/testsuite/g++.dg/lto/odr-1_1.C b/gcc/testsuite/g++.dg/lto/odr-1_1.C
index 494436a..a57bb38 100644
--- a/gcc/testsuite/g++.dg/lto/odr-1_1.C
+++ b/gcc/testsuite/g++.dg/lto/odr-1_1.C
@@ -1,9 +1,10 @@
namespace {
- struct b; // { dg-lto-message "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" }
+ struct b; // { dg-lto-note "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" }
}
-enum vals {aa,bb,cc}; // { dg-lto-message "an enum with different value name is defined in another translation unit" }
-struct a { // { dg-lto-message "a different type is defined in another translation unit" }
- struct b *ptr; // { dg-lto-message "a field of same name but different type is defined in another translation unit" }
+enum vals {aa,bb,cc}; // { dg-lto-note "an enum with different value name is defined in another translation unit" }
+// { dg-lto-note "mismatching definition" "" { target *-*-* } .-1 }
+struct a { // { dg-lto-note "a different type is defined in another translation unit" }
+ struct b *ptr; // { dg-lto-note "a field of same name but different type is defined in another translation unit" }
enum vals vals;
} a;
void test(struct a *);
diff --git a/gcc/testsuite/g++.dg/lto/odr-2_1.C b/gcc/testsuite/g++.dg/lto/odr-2_1.C
index f384ae8..23cfccc 100644
--- a/gcc/testsuite/g++.dg/lto/odr-2_1.C
+++ b/gcc/testsuite/g++.dg/lto/odr-2_1.C
@@ -1,4 +1,4 @@
-class a { // { dg-lto-message "a different type is defined in another translation unit" }
+class a { // { dg-lto-note "a different type is defined in another translation unit" }
int *b() const;
};
int *a::b() const { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/pr101396_0.C b/gcc/testsuite/g++.dg/lto/pr101396_0.C
new file mode 100644
index 0000000..b7a2947
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr101396_0.C
@@ -0,0 +1,12 @@
+/* { dg-lto-do link } */
+
+enum A : __UINT32_TYPE__ { // { dg-lto-warning "6: type 'A' violates the C\\+\\+ One Definition Rule" }
+ a, // { dg-lto-note "3: name 'a' is defined as 32-bit while another translation unit defines it as 64-bit" }
+ b,
+ c
+};
+
+int main()
+{
+ return (int) A::a;
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr101396_1.C b/gcc/testsuite/g++.dg/lto/pr101396_1.C
new file mode 100644
index 0000000..a6d032d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr101396_1.C
@@ -0,0 +1,10 @@
+enum A : __UINT64_TYPE__ { // { dg-lto-note "6: an enum with different value name is defined in another translation unit" }
+ a, // { dg-lto-note "3: mismatching definition" }
+ b,
+ c
+};
+
+int f(enum A x)
+{
+ return (int) x;
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr89335_0.C b/gcc/testsuite/g++.dg/lto/pr89335_0.C
index df2d2ba..95bf4b3 100644
--- a/gcc/testsuite/g++.dg/lto/pr89335_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr89335_0.C
@@ -1,15 +1,20 @@
// { dg-lto-do link }
-// { dg-lto-options {{-O2 -flto -Wsuggest-final-methods}} }
+// { dg-lto-options { {-O2 -flto -Wsuggest-final-methods}} }
// { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
+// { dg-require-linker-plugin "" }
+
class Container
{
public:
virtual ~Container ();
};
+
class List : public Container // { dg-lto-message "final would enable devirtualization" }
{
};
+
static List cache[256];
+
int main (void)
{
return 0;
diff --git a/gcc/testsuite/g++.dg/lto/pr97565_0.C b/gcc/testsuite/g++.dg/lto/pr97565_0.C
new file mode 100644
index 0000000..f4572e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr97565_0.C
@@ -0,0 +1,7 @@
+// { dg-lto-do link }
+// { dg-lto-options { "-O -flto -fipa-pta" } }
+
+extern "C" void abort(void)
+{
+ abort();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr97565_1.C b/gcc/testsuite/g++.dg/lto/pr97565_1.C
new file mode 100644
index 0000000..ff7b638
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr97565_1.C
@@ -0,0 +1,6 @@
+extern "C" void abort(void);
+
+int main(int argc, char * argv[])
+{
+ abort();
+}
diff --git a/gcc/testsuite/g++.dg/modules/adhoc-1_b.C b/gcc/testsuite/g++.dg/modules/adhoc-1_b.C
index 59907a0..7fd5701 100644
--- a/gcc/testsuite/g++.dg/modules/adhoc-1_b.C
+++ b/gcc/testsuite/g++.dg/modules/adhoc-1_b.C
@@ -6,7 +6,7 @@ void foo ()
massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea ();
}
-// { dg-regexp "\n\[^\n]*adhoc-1_b.C:6:74: error: no matching function for call to 'massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea\\(\\)'\n massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(\\);\n \\^$" }
+// { dg-regexp "\n\[^\n]*adhoc-1_b.C:6:73: error: no matching function for call to 'massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea\\(\\)'\n massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(\\);\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\^~$" }
// { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:5:12: note: candidate: 'int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(int\\)'\n export int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(int\\);\n \\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$" }
// { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:6:188: note: candidate: 'void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(float\\)'\n\[ \t]*export void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(float\\);\n\[ \t]*\\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~?$" }
// For some reason dg-regexp inserts a blank line
diff --git a/gcc/testsuite/g++.dg/modules/builtin-3_a.C b/gcc/testsuite/g++.dg/modules/builtin-3_a.C
index fb7da61..66f7129 100644
--- a/gcc/testsuite/g++.dg/modules/builtin-3_a.C
+++ b/gcc/testsuite/g++.dg/modules/builtin-3_a.C
@@ -1,4 +1,4 @@
-// { dg-additional-options "-fmodules-ts -fdump-lang-module-blocks-alias-uid" }
+// { dg-additional-options -fmodules-ts }
module;
#include <stdarg.h>
export module builtins;
@@ -21,24 +21,3 @@ export inline int count (int a, ...)
return c;
}
-
-// { dg-final { scan-lang-dump-not {Cluster members:\n \[0\]=decl declaration '::__builtin_strlen'\n \[1\]=binding '::__builtin_strlen'\n} module } }
-// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* function_decl:'::__builtin_strlen'@builtins} module } }
-// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) function_decl:'::__builtin_strlen'} module } }
-// { dg-final { scan-lang-dump-not {Writing tree:-[0-9]* function_decl:'__builtin_strlen'\(strlen\)} module } }
-
-// The implementation details of va_list's are target-specific.
-// Usually one of two patterns though
-// { dg-final { scan-lang-dump-not { Cluster members:\n \[0\]=decl declaration '::__builtin_va_list'\n \[1\]=binding '::__builtin_va_list'\n} module { target i?86-*-linux* x86_64-*-linux* } } }
-// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::__builtin_va_list'@builtins} module { target { { x86_64-*-linux* i?86-*-linux* } && lp64 } } } }
-// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::__builtin_va_list'} module { target { { x86_64-*-linux* i?86-*-linux* } && lp64 } } } }
-
-// { dg-final { scan-lang-dump {Writing:-1's named merge key \(decl\) type_decl:'::__gnuc_va_list'} module { target i?86-*-linux* *-*-darwin* } } }
-// { dg-final { scan-lang-dump {Wrote GMF:-3 type_decl:'::__gnuc_va_list'@builtins} module { target i?86-*-linux* *-*-darwin* } } }
-
-// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* record_type:'__va_list'} module { target aarch64*-*-linux* } } }
-// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* pointer_type:'::__builtin_va_list'} module { target powerpc*-*-linux* } } }
-
-// { dg-final { scan-lang-dump-not { Cluster members:\n \[0\]=decl declaration '::va_list'\n \[1\]=binding '::va_list'\n} module } }
-// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::va_list'@builtins} module } }
-// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::va_list'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/builtin-3_b.C b/gcc/testsuite/g++.dg/modules/builtin-3_b.C
index e0e6306..7ba933d 100644
--- a/gcc/testsuite/g++.dg/modules/builtin-3_b.C
+++ b/gcc/testsuite/g++.dg/modules/builtin-3_b.C
@@ -1,4 +1,4 @@
-// { dg-additional-options "-fmodules-ts -fdump-lang-module-alias" }
+// { dg-additional-options -fmodules-ts }
import builtins;
int main ()
@@ -6,8 +6,3 @@ int main ()
length ("");
count (1, "", "", nullptr);
}
-
-// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) function_decl:'::__builtin_strlen'} module } }
-// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) type_decl:'::__builtin_va_list'} module { target { { x86_64-*-linux* i?86-*-linux* } && lp64 } } } }
-// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) type_decl:'::va_list'} module } }
-// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) type_decl:'::__gnuc_va_list'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C b/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C
index efcc485..2a103c3 100644
--- a/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C
+++ b/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C
@@ -17,8 +17,8 @@ int main ()
// { dg-final { scan-lang-dump-times {Reading 1 initializers} 2 module } }
-// { dg-final { scan-lang-dump {Read:-1's named merge key \(new\) var_decl:'::var'} module } }
+// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) var_decl:'::var'} module } }
// { dg-final { scan-lang-dump-times {Reading definition var_decl '::var@[^\n]*/hdr-init-1_a.H:1'} 2 module } }
-// { dg-final { scan-lang-dump {Read:-1's named merge key \(matched\) var_decl:'::var'} module } }
+// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) var_decl:'::var'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/indirect-3_c.C b/gcc/testsuite/g++.dg/modules/indirect-3_c.C
index 9c5cb23..ec2fc76 100644
--- a/gcc/testsuite/g++.dg/modules/indirect-3_c.C
+++ b/gcc/testsuite/g++.dg/modules/indirect-3_c.C
@@ -19,6 +19,6 @@ int main ()
// { dg-final { scan-lang-dump-not {Instantiation:-[0-9]* function_decl:'::foo::X@foo:.::frob@.()<0x0>'} module } }
// { dg-final { scan-lang-dump {Lazily binding '::bar@bar:.::toto'@'bar' section:} module } }
-// { dg-final { scan-lang-dump {>Loading entity foo\[1\] section:1} module } }
+// { dg-final { scan-lang-dump {>Loading entity foo\[.\] section:1} module } }
// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo@foo:.::template TPL@foo:.'@foo} module } }
// { dg-final { scan-lang-dump {Reading definition type_decl '::foo@foo:.::TPL@bar:.<0x0>'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/indirect-4_c.C b/gcc/testsuite/g++.dg/modules/indirect-4_c.C
index 7efcc11..d55a221 100644
--- a/gcc/testsuite/g++.dg/modules/indirect-4_c.C
+++ b/gcc/testsuite/g++.dg/modules/indirect-4_c.C
@@ -10,7 +10,7 @@ int main ()
}
// { dg-final { scan-lang-dump {Lazily binding '::bar@bar:.::quux'@'bar' section:} module } }
-// { dg-final { scan-lang-dump {>Loading entity foo\[2\] section:1} module } }
+// { dg-final { scan-lang-dump {>Loading entity foo\[.\] section:1} module } }
// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo@foo:.::template TPL@foo:.'@foo} module } }
// { dg-final { scan-lang-dump {Reading definition function_decl '::foo@foo:.::TPL@bar:.<0x1>::frob@bar:.<0x2>'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/lambda-3_b.C b/gcc/testsuite/g++.dg/modules/lambda-3_b.C
index 25a418b..17afd96 100644
--- a/gcc/testsuite/g++.dg/modules/lambda-3_b.C
+++ b/gcc/testsuite/g++.dg/modules/lambda-3_b.C
@@ -4,6 +4,6 @@
import "lambda-3_a.H";
// { dg-final { scan-lang-dump-not {merge key \(new\)} module } }
-// { dg-final { scan-lang-dump {Read -1\[0\] matched attached decl '::template ._anon_0<#unnamed#>'} module } }
-// { dg-final { scan-lang-dump {Read -1\[0\] matched attached decl '::._anon_2'} module } }
-// { dg-final { scan-lang-dump {Read -1\[0\] matched attached decl '::._anon_1'} module } }
+// { dg-final { scan-lang-dump {Read -[0-9]*\[0\] matched attached decl '::template ._anon_0<#unnamed#>'} module } }
+// { dg-final { scan-lang-dump {Read -[0-9]*\[0\] matched attached decl '::._anon_2'} module } }
+// { dg-final { scan-lang-dump {Read -[0-9]*\[0\] matched attached decl '::._anon_1'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/late-ret-3_c.C b/gcc/testsuite/g++.dg/modules/late-ret-3_c.C
index fae9565..8ab23a9 100644
--- a/gcc/testsuite/g++.dg/modules/late-ret-3_c.C
+++ b/gcc/testsuite/g++.dg/modules/late-ret-3_c.C
@@ -19,4 +19,4 @@ int main ()
return 0;
}
-// { dg-final { scan-lang-dump {Read:-1's named merge key \(matched\) template_decl:'::template Foo'\n Deduping '::template Foo@[^\n]*/late-ret-3_a.H:.'\n} module } }
+// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template Foo'\n Deduping '::template Foo@[^\n]*/late-ret-3_a.H:.'\n} module } }
diff --git a/gcc/testsuite/g++.dg/modules/macloc-1_c.C b/gcc/testsuite/g++.dg/modules/macloc-1_c.C
index 9b8f7fb..5865a34 100644
--- a/gcc/testsuite/g++.dg/modules/macloc-1_c.C
+++ b/gcc/testsuite/g++.dg/modules/macloc-1_c.C
@@ -8,6 +8,6 @@ void gru ()
you (1);
}
-// { dg-regexp "\[^\n]*macloc-1_c.C:7:8: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
+// { dg-regexp "\[^\n]*macloc-1_c.C:7:6: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
-// { dg-regexp "\[^\n]*macloc-1_c.C:8:9: error: too many arguments to function 'int you@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:12:14: note: declared here\n\[^\n]*macloc-1_a.C:9:22: note: in definition of macro 'KEVIN'\n" }
+// { dg-regexp "\[^\n]*macloc-1_c.C:8:7: error: too many arguments to function 'int you@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:12:14: note: declared here\n\[^\n]*macloc-1_a.C:9:22: note: in definition of macro 'KEVIN'\n" }
diff --git a/gcc/testsuite/g++.dg/modules/macloc-1_d.C b/gcc/testsuite/g++.dg/modules/macloc-1_d.C
index 5b2b7ba..282a31c 100644
--- a/gcc/testsuite/g++.dg/modules/macloc-1_d.C
+++ b/gcc/testsuite/g++.dg/modules/macloc-1_d.C
@@ -9,5 +9,5 @@ void margo ()
gru (2);
}
-// { dg-regexp "\[^\n]*macloc-1_d.C:8:8: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_d.C:4:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
-// { dg-regexp "\[^\n]*macloc-1_d.C:9:9: error: too many arguments to function 'void gru@edith\\(\\)'\nIn module edith, imported at \[^\n]*macloc-1_d.C:3:\n\[^\n]*macloc-1_b.C:10:20: note: declared here\n\[^\n]*macloc-1_b.C:6:19: note: in definition of macro 'STUART'\n" }
+// { dg-regexp "\[^\n]*macloc-1_d.C:8:6: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_d.C:4:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
+// { dg-regexp "\[^\n]*macloc-1_d.C:9:7: error: too many arguments to function 'void gru@edith\\(\\)'\nIn module edith, imported at \[^\n]*macloc-1_d.C:3:\n\[^\n]*macloc-1_b.C:10:20: note: declared here\n\[^\n]*macloc-1_b.C:6:19: note: in definition of macro 'STUART'\n" }
diff --git a/gcc/testsuite/g++.dg/modules/omp-1_a.C b/gcc/testsuite/g++.dg/modules/omp-1_a.C
index 722720a..7ddb776 100644
--- a/gcc/testsuite/g++.dg/modules/omp-1_a.C
+++ b/gcc/testsuite/g++.dg/modules/omp-1_a.C
@@ -1,7 +1,8 @@
// { dg-additional-options "-fmodules-ts -fopenmp" }
+// { dg-require-effective-target pthread }
export module foo;
-// { dg-module-cmi foo }
+// { dg-module-cmi foo { target pthread } }
export inline void frob (unsigned (&ary)[64])
{
diff --git a/gcc/testsuite/g++.dg/modules/omp-1_b.C b/gcc/testsuite/g++.dg/modules/omp-1_b.C
index f3f5d92..09d97e4a 100644
--- a/gcc/testsuite/g++.dg/modules/omp-1_b.C
+++ b/gcc/testsuite/g++.dg/modules/omp-1_b.C
@@ -1,4 +1,5 @@
// { dg-additional-options "-fmodules-ts -fopenmp" }
+// { dg-require-effective-target pthread }
import foo;
diff --git a/gcc/testsuite/g++.dg/modules/omp-1_c.C b/gcc/testsuite/g++.dg/modules/omp-1_c.C
index f30f611..71a24f6 100644
--- a/gcc/testsuite/g++.dg/modules/omp-1_c.C
+++ b/gcc/testsuite/g++.dg/modules/omp-1_c.C
@@ -1,8 +1,9 @@
// { dg-additional-options "-fmodules-ts" }
+// { dg-require-effective-target pthread }
import foo;
-// { dg-regexp "In module imported at \[^\n]*omp-1_c.C:3:1:\nfoo: error: module contains OpenMP, use '-fopenmp' to enable\n" }
+// { dg-regexp "In module imported at \[^\n]*omp-1_c.C:4:1:\nfoo: error: module contains OpenMP, use '-fopenmp' to enable\n" }
// { dg-prune-output "failed to read" }
// { dg-prune-output "fatal error:" }
// { dg-prune-output "compilation terminated" }
diff --git a/gcc/testsuite/g++.dg/modules/omp-2_a.C b/gcc/testsuite/g++.dg/modules/omp-2_a.C
index d2291b6..e030ac7 100644
--- a/gcc/testsuite/g++.dg/modules/omp-2_a.C
+++ b/gcc/testsuite/g++.dg/modules/omp-2_a.C
@@ -1,7 +1,8 @@
// { dg-additional-options "-fmodules-ts -fopenmp" }
+// { dg-require-effective-target pthread }
export module foo;
-// { dg-module-cmi foo }
+// { dg-module-cmi foo { target pthread } }
// The OpenMPness doesn't escape to the interface.
export void frob (unsigned (&ary)[64])
diff --git a/gcc/testsuite/g++.dg/modules/omp-2_b.C b/gcc/testsuite/g++.dg/modules/omp-2_b.C
index 39f34c7..aeee4d1 100644
--- a/gcc/testsuite/g++.dg/modules/omp-2_b.C
+++ b/gcc/testsuite/g++.dg/modules/omp-2_b.C
@@ -1,4 +1,5 @@
// { dg-additional-options "-fmodules-ts" }
+// { dg-require-effective-target pthread }
import foo;
diff --git a/gcc/testsuite/g++.dg/modules/pr101582-1.C b/gcc/testsuite/g++.dg/modules/pr101582-1.C
new file mode 100644
index 0000000..1d3a3fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr101582-1.C
@@ -0,0 +1,9 @@
+// PR c++/101582
+// { dg-additional-options "-fmodules-ts" }
+export module pr101582;
+// { dg-module-cmi "pr101582" }
+export ; // { dg-error "export declaration does not declare anything" "" { xfail *-*-* } }
+export [[]]; // { dg-error "export declaration does not declare anything" "" { xfail *-*-* } }
+export // { dg-error "export declaration does not declare anything" "" { xfail *-*-* } }
+{
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr99239_a.H b/gcc/testsuite/g++.dg/modules/pr99239_a.H
new file mode 100644
index 0000000..35f006f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99239_a.H
@@ -0,0 +1,13 @@
+// PR 99239 ICE on catch clause
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+inline void Foo ()
+{
+ try
+ {}
+ catch(...)
+ {
+ }
+}
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99239_b.H b/gcc/testsuite/g++.dg/modules/pr99239_b.H
new file mode 100644
index 0000000..92638d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99239_b.H
@@ -0,0 +1,12 @@
+// { dg-additional-options {-fmodule-header -fno-module-lazy} }
+// { dg-module-cmi {} }
+import "pr99239_a.H";
+
+inline void
+ _M_remove_reference() throw()
+{
+ try
+ { }
+ catch(...)
+ { }
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-1_a.H b/gcc/testsuite/g++.dg/modules/pr99283-1_a.H
new file mode 100644
index 0000000..95c8c06
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-1_a.H
@@ -0,0 +1,6 @@
+// PR 99283 part 1 ICE on specialization
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+template<typename _Facet>
+_Facet &use_facet ();
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-1_b.H b/gcc/testsuite/g++.dg/modules/pr99283-1_b.H
new file mode 100644
index 0000000..cd15a1b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-1_b.H
@@ -0,0 +1,10 @@
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+import "pr99283-1_a.H";
+
+template<typename _Facet>
+_Facet &use_facet ();
+
+extern template
+char &use_facet<char> ();
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-2_a.H b/gcc/testsuite/g++.dg/modules/pr99283-2_a.H
new file mode 100644
index 0000000..c5faf1d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-2_a.H
@@ -0,0 +1,12 @@
+// PR 99283 part 2 ICE on definition with qualified-name
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+inline namespace __cxx11 {
+
+template<typename _CharT>
+class collate;
+
+}
+
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-2_b.H b/gcc/testsuite/g++.dg/modules/pr99283-2_b.H
new file mode 100644
index 0000000..a1b7d60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-2_b.H
@@ -0,0 +1,22 @@
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+import "pr99283-2_a.H";
+
+inline namespace __cxx11 {
+template<typename _CharT>
+class collate
+{
+};
+}
+
+template<typename _CharT>
+void Check ()
+{
+ typedef collate<char> __collate_type;
+}
+
+
+
+
+
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-2_c.H b/gcc/testsuite/g++.dg/modules/pr99283-2_c.H
new file mode 100644
index 0000000..8263928
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-2_c.H
@@ -0,0 +1,20 @@
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+import "pr99283-2_a.H";
+
+template<typename _CharT>
+class __cxx11::collate
+{
+};
+
+template<typename _CharT>
+void Check ()
+{
+ typedef collate<char> __collate_type;
+}
+
+
+
+
+
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-3_a.H b/gcc/testsuite/g++.dg/modules/pr99283-3_a.H
new file mode 100644
index 0000000..5926b9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-3_a.H
@@ -0,0 +1,31 @@
+// PR 99283 part 2 ICE on definition with qualified-name
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+template<bool, typename _Tp>
+struct enable_if;
+
+template<typename _Tp>
+struct enable_if<true, _Tp>
+{ typedef _Tp type; };
+
+template<typename _CharT>
+class basic_string;
+
+typedef basic_string<char> string;
+
+template<typename _CharT>
+class basic_string
+{
+private:
+ template<typename _Tp>
+ using _If_sv = typename enable_if<true, int>::type;
+
+public:
+ const _CharT *c_str() const noexcept;
+};
+
+inline void stoi(const string& __str)
+{
+ __str.c_str ();
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-3_b.H b/gcc/testsuite/g++.dg/modules/pr99283-3_b.H
new file mode 100644
index 0000000..cb14de6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-3_b.H
@@ -0,0 +1,9 @@
+// { dg-additional-options {-fmodule-header -fno-module-lazy} }
+// { dg-module-cmi {} }
+
+template<typename _CharT>
+class basic_string;
+
+typedef basic_string<char> string;
+
+import "pr99283-3_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-4.H b/gcc/testsuite/g++.dg/modules/pr99283-4.H
new file mode 100644
index 0000000..d15ccc4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-4.H
@@ -0,0 +1,20 @@
+// PR 99283 part 3, ICE with template alias as default template parm
+// of member template
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+template<typename _Traits>
+struct _Insert
+{
+ using size_type = int;
+
+ template<typename _Pair>
+ using _IFconsp = bool;
+
+ template<typename _Pair, typename = _IFconsp<_Pair>>
+ int insert (_Pair&& __v);
+};
+
+void Foo (typename _Insert<int>::size_type);
+
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5.h b/gcc/testsuite/g++.dg/modules/pr99283-5.h
new file mode 100644
index 0000000..3c3421f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-5.h
@@ -0,0 +1,9 @@
+template<typename _Value>
+struct __traits
+{
+ static const int __digits = 8;
+ static const _Value __min = 0;
+};
+
+template<typename _Value>
+const _Value __traits<_Value>::__min;
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5_a.H b/gcc/testsuite/g++.dg/modules/pr99283-5_a.H
new file mode 100644
index 0000000..6406dfe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-5_a.H
@@ -0,0 +1,14 @@
+// PR 99283 part 5
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+#include "pr99283-5.h"
+
+template<typename _Value>
+const int __traits<_Value>::__digits;
+
+template<typename _Tp>
+void Foo ()
+{
+ __traits<unsigned>::__digits;
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5_b.H b/gcc/testsuite/g++.dg/modules/pr99283-5_b.H
new file mode 100644
index 0000000..3f4237e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-5_b.H
@@ -0,0 +1,12 @@
+// { dg-additional-options {-fmodule-header -fno-module-lazy} }
+// { dg-module-cmi {} }
+
+#include "pr99283-5.h"
+
+template<typename _Tp>
+void Bar ()
+{
+ __traits<unsigned>::__min;
+}
+
+import "pr99283-5_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5_c.C b/gcc/testsuite/g++.dg/modules/pr99283-5_c.C
new file mode 100644
index 0000000..cc7e795
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-5_c.C
@@ -0,0 +1,5 @@
+// { dg-additional-options {-fmodules-ts -fno-module-lazy} }
+
+import "pr99283-5_b.H";
+
+static_assert(!__traits<unsigned>::__min);
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6.h b/gcc/testsuite/g++.dg/modules/pr99283-6.h
new file mode 100644
index 0000000..383b66c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-6.h
@@ -0,0 +1,23 @@
+template<bool, typename, typename>
+struct conditional;
+
+template<typename> struct incrementable_traits;
+
+template<typename _Iter, typename _Tp>
+struct __iter_traits_impl;
+
+class __max_diff_type;
+
+template<typename _Iter>
+concept weakly_incrementable
+ = __is_same (__iter_traits_impl<_Iter, incrementable_traits<_Iter>>,
+ __max_diff_type);
+
+template<typename _Iterator>
+class reverse_iterator
+{
+public:
+ using iterator_concept
+ = typename conditional<weakly_incrementable<_Iterator>,
+ int, int>::type;
+};
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_a.H b/gcc/testsuite/g++.dg/modules/pr99283-6_a.H
new file mode 100644
index 0000000..176ad9e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-6_a.H
@@ -0,0 +1,33 @@
+// { dg-additional-options {-std=c++2a -fmodule-header} }
+// { dg-module-cmi {}
+
+#include "pr99283-6.h"
+
+template<typename _IteratorL, typename _IteratorR>
+constexpr bool
+ operator<(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y);
+
+template<typename _Tp>
+ struct numeric_limits;
+
+class __max_size_type
+{
+public:
+ template<typename _Tp>
+ constexpr
+ __max_size_type(_Tp __i) noexcept
+ : _M_val(__i), _M_msb(__i < 0)
+ { }
+
+ using __rep = __UINT64_TYPE__;
+private:
+ __rep _M_val = 0;
+ unsigned _M_msb:1 = 0;
+};
+
+class __max_diff_type
+{
+private:
+ __max_size_type _M_rep = 0;
+};
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_b.H b/gcc/testsuite/g++.dg/modules/pr99283-6_b.H
new file mode 100644
index 0000000..123f353
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-6_b.H
@@ -0,0 +1,164 @@
+// { dg-additional-options {-std=c++2a -fmodule-header} }
+// { dg-module-cmi {}
+
+#include "pr99283-6.h"
+
+template<typename _Tp>
+void __addressof(_Tp& __r) ;
+
+template<typename _Tp, _Tp __v>
+struct integral_constant
+{
+ static constexpr _Tp value = __v;
+};
+
+template<typename _Tp, _Tp __v>
+constexpr _Tp integral_constant<_Tp, __v>::value;
+
+typedef integral_constant<bool, true> true_type;
+typedef integral_constant<bool, false> false_type;
+
+template<typename _B1, typename _B2>
+struct __and_
+ : public conditional<_B1::value, _B2, _B1>::type
+{ };
+
+template<typename _From, typename _To>
+struct is_convertible
+ : public true_type
+{ };
+
+template<bool, typename _Tp = void>
+struct enable_if
+{ };
+
+template<typename _Tp>
+struct enable_if<true, _Tp>
+{ typedef _Tp type; };
+
+template<bool _Cond, typename _Tp = void>
+using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
+
+template<typename A, typename B>
+using _Require = __enable_if_t<__and_<A, B>::value>;
+
+template<bool _Cond, typename _Iftrue, typename _Iffalse>
+struct conditional
+{ typedef _Iftrue type; };
+
+template<typename> struct iterator_traits;
+
+
+template<typename _IteratorL, typename _IteratorR>
+constexpr bool
+ operator!=(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y);
+
+typedef __INT64_TYPE__ int64_t;
+typedef int64_t intmax_t;
+
+template<intmax_t _Num>
+struct ratio
+{
+};
+
+namespace chrono
+{
+template<typename _Rep>
+struct duration;
+
+template<typename _ToDur, typename _Rep>
+constexpr _ToDur
+ duration_cast(const duration<_Rep>& __d)
+{
+ typedef typename _ToDur::rep __to_rep;
+ return _ToDur(static_cast<__to_rep>(static_cast<intmax_t>(__d.count())));
+}
+
+template<typename _Rep>
+struct duration
+{
+
+public:
+ using rep = _Rep;
+
+ constexpr duration() = default;
+
+ duration(const duration&) = default;
+
+ template<typename _Rep2, typename
+ = _Require<is_convertible<const _Rep2&, rep>,
+ true_type>>
+ constexpr explicit duration(const _Rep2& __rep)
+ : __r (__rep) {}
+
+ ~duration() = default;
+ duration& operator=(const duration&) = default;
+
+ rep count() const;
+
+private:
+ rep __r;
+};
+
+using seconds = duration<int64_t>;
+
+template<typename _Clock, typename _Dur>
+struct time_point
+{
+ typedef _Dur duration;
+
+ duration time_since_epoch() const;
+
+private:
+ duration __d;
+};
+
+struct system_clock
+{
+ typedef chrono::seconds duration;
+
+ typedef chrono::time_point<system_clock, duration> time_point;
+
+ static void
+ to_time_t(const time_point& __t) noexcept
+ {
+ duration_cast<chrono::seconds>
+ (__t.time_since_epoch()).count();
+ }
+};
+
+}
+
+template<typename>
+class allocator;
+
+template<typename _ForwardIterator>
+constexpr void
+ __destroy(_ForwardIterator __first, _ForwardIterator __last)
+{
+ for (; __first != __last; ++__first)
+ __addressof (*__first);
+}
+
+template<typename _Alloc>
+struct allocator_traits
+{
+private:
+ template<typename _Alloc2, typename _Tp>
+ static constexpr void
+ _S_destroy(_Alloc2&, _Tp* __p, ...)
+ noexcept
+ {
+ __destroy(__p);
+ }
+};
+
+template<typename _Tp>
+struct allocator_traits<allocator<_Tp>>
+{
+ using value_type = _Tp;
+ using pointer = _Tp*;
+};
+
+import "pr99283-6_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_c.C b/gcc/testsuite/g++.dg/modules/pr99283-6_c.C
new file mode 100644
index 0000000..9492554
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-6_c.C
@@ -0,0 +1,10 @@
+// { dg-additional-options {-std=c++2a -fmodules-ts} }
+
+import "pr99283-6_b.H";
+
+template<typename _Alloc>
+struct __allocated_ptr
+{
+ using value_type = allocator_traits<_Alloc>;
+};
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_d.H b/gcc/testsuite/g++.dg/modules/pr99283-6_d.H
new file mode 100644
index 0000000..e811471
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-6_d.H
@@ -0,0 +1,10 @@
+// { dg-additional-options {-std=c++2a -fmodule-header} }
+
+import "pr99283-6_b.H";
+
+template<typename _Alloc>
+struct __allocated_ptr
+{
+ using value_type = allocator_traits<_Alloc>;
+};
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7-swap.h b/gcc/testsuite/g++.dg/modules/pr99283-7-swap.h
new file mode 100644
index 0000000..d725fea
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-7-swap.h
@@ -0,0 +1,17 @@
+template<typename _Tp>
+constexpr typename remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept;
+
+template<typename _Tp>
+constexpr inline
+typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
+ is_move_constructible<_Tp>,
+ is_move_assignable<_Tp>>::value>::type
+ swap(_Tp& __a, _Tp& __b)
+ noexcept(__and_<is_nothrow_move_constructible<_Tp>,
+ is_nothrow_move_assignable<_Tp>>::value)
+{
+ _Tp __tmp = move(__a);
+ __a = move(__b);
+ __b = move(__tmp);
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7-traits.h b/gcc/testsuite/g++.dg/modules/pr99283-7-traits.h
new file mode 100644
index 0000000..8f6bce0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-7-traits.h
@@ -0,0 +1,41 @@
+template<typename...>
+struct __and_;
+
+template<typename _Pp>
+struct __not_;
+
+template<typename _Tp>
+struct is_move_constructible;
+
+template<typename _Tp>
+struct is_nothrow_move_constructible;
+
+template<typename _Tp>
+struct is_move_assignable;
+
+template<typename _Tp>
+struct is_nothrow_move_assignable;
+
+template<typename _Tp>
+struct remove_reference;
+
+template<bool, typename _Tp = void>
+struct enable_if;
+
+template<bool _Cond, typename _Tp = void>
+using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
+
+template<typename... _Cond>
+using _Require = __enable_if_t<__and_<_Cond...>::value>;
+
+template<typename _Tp>
+struct __is_tuple_like;
+
+template<typename _Tp>
+constexpr inline
+ _Require<__not_<__is_tuple_like<_Tp>>,
+ is_move_constructible<_Tp>,
+ is_move_assignable<_Tp>>
+swap(_Tp&, _Tp&)
+ noexcept(__and_<is_nothrow_move_constructible<_Tp>,
+ is_nothrow_move_assignable<_Tp>>::value);
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_a.H b/gcc/testsuite/g++.dg/modules/pr99283-7_a.H
new file mode 100644
index 0000000..b52d44d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-7_a.H
@@ -0,0 +1,97 @@
+// PR 99283,
+// { dg-additional-options "-std=c++2a -fmodule-header" }
+// { dg-module-cmi {} }
+
+#include "pr99283-7-traits.h"
+
+template<class _CharT>
+struct char_traits;
+
+template<typename _CharT, typename _Traits = char_traits<_CharT>>
+class basic_string;
+
+typedef basic_string<char> string;
+
+template<typename _Tp, _Tp __v>
+struct integral_constant
+{
+ static constexpr _Tp value = __v;
+ typedef _Tp value_type;
+ typedef integral_constant<_Tp, __v> type;
+ constexpr operator value_type() const noexcept { return value; }
+ constexpr value_type operator()() const noexcept { return value; }
+};
+
+template<typename _Tp, _Tp __v>
+constexpr _Tp integral_constant<_Tp, __v>::value;
+
+typedef integral_constant<bool, true> true_type;
+
+typedef integral_constant<bool, false> false_type;
+
+template<bool __v>
+using __bool_constant = integral_constant<bool, __v>;
+
+template<typename _Tp, typename _Up = _Tp&&>
+_Up __declval(int);
+
+template<typename _Tp>
+_Tp __declval(long);
+
+template<typename _Tp>
+auto declval() noexcept -> decltype(__declval<_Tp>(0));
+
+struct __do_is_nothrow_swappable_impl
+{
+ template<typename _Tp>
+ static __bool_constant<
+ noexcept(swap(declval<_Tp&>(), declval<_Tp&>()))
+ > __test(int);
+};
+
+
+
+template<typename _Tp>
+struct __is_nothrow_swappable_impl
+ : public __do_is_nothrow_swappable_impl
+{
+ typedef decltype(__test<_Tp>(0)) type;
+};
+
+template<typename _Tp>
+struct __is_nothrow_swappable
+ : public __is_nothrow_swappable_impl<_Tp>::type
+{ };
+
+#include "pr99283-7-swap.h"
+
+class partial_ordering
+{
+public:
+ friend constexpr bool
+ operator==(partial_ordering, partial_ordering) noexcept = default;
+};
+
+class strong_ordering
+{
+public:
+ constexpr operator partial_ordering() const noexcept;
+};
+
+template<typename _T1, typename _T2>
+struct pair
+{
+ constexpr void
+ swap(pair& __p)
+ noexcept(__is_nothrow_swappable<_T1>::value);
+};
+
+template<typename _T1, typename _T2>
+inline constexpr bool
+ operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y);
+
+template<typename _CharT>
+struct char_traits
+{
+ using comparison_category = strong_ordering;
+};
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_b.H b/gcc/testsuite/g++.dg/modules/pr99283-7_b.H
new file mode 100644
index 0000000..50c780e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-7_b.H
@@ -0,0 +1,4 @@
+// { dg-additional-options "-std=c++2a -fmodule-header" }
+// { dg-module-cmi {} }
+
+#include "pr99283-7-traits.h"
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_c.C b/gcc/testsuite/g++.dg/modules/pr99283-7_c.C
new file mode 100644
index 0000000..195bc68
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-7_c.C
@@ -0,0 +1,8 @@
+// { dg-additional-options "-std=c++2a -fmodules-ts" }
+import "pr99283-7_b.H";
+
+#include "pr99283-7-swap.h"
+
+import "pr99283-7_a.H";
+
+void Xlocale(const string& __s);
diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_d.H b/gcc/testsuite/g++.dg/modules/pr99283-7_d.H
new file mode 100644
index 0000000..ef4934b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99283-7_d.H
@@ -0,0 +1,8 @@
+// { dg-additional-options "-std=c++2a -fmodule-header" }
+import "pr99283-7_b.H";
+
+#include "pr99283-7-swap.h"
+
+import "pr99283-7_a.H";
+
+void Xlocale(const string& __s);
diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1.h b/gcc/testsuite/g++.dg/modules/pr99425-1.h
new file mode 100644
index 0000000..de167a6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99425-1.h
@@ -0,0 +1,11 @@
+template<typename T>
+struct make_signed
+{
+ using type = int;
+};
+
+template<typename S>
+using make_signed_t = typename make_signed<S>::type;
+
+template<typename U>
+auto ssize (U &parm) -> make_signed_t<decltype(parm.call())>;
diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_a.H b/gcc/testsuite/g++.dg/modules/pr99425-1_a.H
new file mode 100644
index 0000000..6117d4a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99425-1_a.H
@@ -0,0 +1,4 @@
+// PR 99425 alias dependent specializations
+// { dg-additional-options {-fmodule-header} }
+// { dg-module-cmi {} }
+#include "pr99425-1.h"
diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_b.H b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H
new file mode 100644
index 0000000..53d28b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H
@@ -0,0 +1,19 @@
+// { dg-additional-options {-fmodule-header -fdump-lang-module-alias} }
+// { dg-module-cmi {} }
+
+#include "pr99425-1.h"
+
+import "pr99425-1_a.H";
+
+struct Cont
+{
+ int call ();
+};
+
+inline void widget (Cont parm)
+{
+ ssize (parm);
+}
+
+// { dg-final { scan-lang-dump {Read:-[0-9]*'s alias spec merge key \(new\) type_decl:'::make_signed_t'\n ... Read:-[0-9]*'s type spec merge key \(new\) type_decl:'::make_signed'\n Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template ssize'} module } }
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_c.C b/gcc/testsuite/g++.dg/modules/pr99425-1_c.C
new file mode 100644
index 0000000..77a35a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99425-1_c.C
@@ -0,0 +1,11 @@
+// { dg-additional-options {-fmodules-ts -fdump-lang-module-alias} }
+import "pr99425-1_a.H";
+import "pr99425-1_b.H";
+
+void frob (Cont parm)
+{
+ ssize (parm);
+}
+
+// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) template_decl:'::template ssize'} module } }
+// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template ssize'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/pr99425-2_a.X b/gcc/testsuite/g++.dg/modules/pr99425-2_a.X
new file mode 100644
index 0000000..9a44dc3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99425-2_a.X
@@ -0,0 +1,7 @@
+// PR 99425 template aliases can cause equivalences in the hash
+// tables, and for extra excitement be reordered on rehash.
+
+// { dg-additional-options {-x c++-system-header stdexcept -fmodules-ts} }
+// { dg-prune-output {linker input file unused} }
+
+No! DO NOT COMPILE;
diff --git a/gcc/testsuite/g++.dg/modules/pr99425-2_b.X b/gcc/testsuite/g++.dg/modules/pr99425-2_b.X
new file mode 100644
index 0000000..5e45354
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99425-2_b.X
@@ -0,0 +1,4 @@
+// { dg-additional-options {-x c++-system-header mutex -fmodules-ts} }
+// { dg-prune-output {linker input file unused} }
+
+No! DO NOT COMPILE;
diff --git a/gcc/testsuite/g++.dg/modules/pr99480_a.H b/gcc/testsuite/g++.dg/modules/pr99480_a.H
new file mode 100644
index 0000000..8f48493
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99480_a.H
@@ -0,0 +1,10 @@
+// PR 99480 ICE on instantiation definition
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+template<typename _Tp>
+struct atomic;
+
+template<typename _Tp>
+struct atomic<_Tp*>;
+
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99480_b.H b/gcc/testsuite/g++.dg/modules/pr99480_b.H
new file mode 100644
index 0000000..ea8800d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99480_b.H
@@ -0,0 +1,9 @@
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+import "pr99480_a.H";
+
+template<typename _Tp>
+struct atomic<_Tp*>
+{
+};
diff --git a/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H b/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H
index 502a649..37002ee 100644
--- a/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H
+++ b/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H
@@ -3,7 +3,7 @@
#include "tpl-alias-1.h"
-// { dg-final { scan-lang-dump {Writing named:-[0-9]* template_decl:'::allocator_traits<::allocator<long int>>::template rebind_alloc<_Up>'} module } }
-// { dg-final { scan-lang-dump {Writing decl spec:-[0-9]* type_decl:'::allocator_traits<::allocator<long int>>::rebind_alloc<_Up>'} module } }
-// { dg-final { scan-lang-dump {Writing:-[0-9]*'s decl spec merge key \(specialization\) type_decl:'::allocator_traits<::allocator<long int>>::rebind_alloc<_Up>'} module } }
-// { dg-final { scan-lang-dump {Wrote\(-[0-9]*\) alias template type_decl:'::allocator_traits<::allocator<long int>>::rebind_alloc<_Up>'} module } }
+// { dg-final { scan-lang-dump {Writing decl tmpl spec:-[0-9]* template_decl:'::allocator_traits<::allocator<long int>>::template rebind_alloc<_Up>'} module } }
+// { dg-final { scan-lang-dump {Writing decl tmpl spec:-[0-9]* type_decl:'::allocator_traits<::allocator<long int>>::template rebind_alloc<_Up>'} module } }
+
+// { dg-final { scan-lang-dump {Writing:-[0-9]*'s alias spec merge key \(specialization\) type_decl:'::allocator_traits<::allocator<long int>>::rebind_alloc<long int>'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C b/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C
index 59fd09c..cc9499f 100644
--- a/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C
+++ b/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C
@@ -3,7 +3,8 @@
#include "tpl-alias-1.h"
import "tpl-alias-1_a.H";
-// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) template_decl:'::allocator_traits<::allocator<long int>>::template rebind_alloc'} module } }
-// { dg-final { scan-lang-dump {Read:-[0-9]*'s decl spec merge key \(matched\) type_decl:'::allocator_traits<::allocator<_Tp>>::rebind_alloc'} module } }
-// { dg-final { scan-lang-dump {Read alias template type_decl:'::allocator_traits<::allocator<long int>>::rebind_alloc<_Up>'} module } }
+// { dg-final { scan-lang-dump {Deduping '::allocator_traits<::allocator<_Tp>>::template rebind_alloc'} module } }
+// { dg-final { scan-lang-dump {Deduping '::allocator_traits<::allocator<long int>>::template rebind_alloc<_Up>'} module } }
+// { dg-final { scan-lang-dump {Deduping '::allocator_traits<::allocator<long int>>::rebind_alloc<long int>'} module } }
+
// { dg-final { scan-lang-dump-not {merge key \(new\)} module } }
diff --git a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
index 56a4e74..76a5ec0 100644
--- a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
+++ b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
@@ -20,4 +20,5 @@ int __attribute__((stack_protect)) bar()
return 0;
}
-/* { dg-final { scan-assembler-times "stack_chk_fail" 1 } } */
+/* { dg-final { scan-assembler-times "stack_chk_fail" 1 { target { ! mips*-*-* } } } }*/
+/* { dg-final { scan-assembler-times "stack_chk_fail" 2 { target { mips*-*-* } } } }*/
diff --git a/gcc/testsuite/g++.dg/opt/nrv20.C b/gcc/testsuite/g++.dg/opt/nrv20.C
new file mode 100644
index 0000000..ade0c28
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/nrv20.C
@@ -0,0 +1,20 @@
+// PR c++/91217
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -fdump-tree-gimple }
+// { dg-final { scan-tree-dump-not "<retval> = a" "gimple" } }
+
+struct A
+{
+ int ar[42];
+};
+
+template <class T>
+A f()
+{
+ return [] { A a; return a; }();
+}
+
+int main()
+{
+ f<int>();
+}
diff --git a/gcc/testsuite/g++.dg/opt/nrv21.C b/gcc/testsuite/g++.dg/opt/nrv21.C
new file mode 100644
index 0000000..ff33852
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/nrv21.C
@@ -0,0 +1,14 @@
+// PR c++/67302
+// { dg-additional-options -fdump-tree-gimple }
+// { dg-final { scan-tree-dump-not "<retval> = a" "gimple" } }
+
+struct A
+{
+ int ar[42];
+ A();
+};
+
+A f() {
+ A a;
+ return (a); // The parens should not inhibit NRVO.
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr100148.C b/gcc/testsuite/g++.dg/opt/pr100148.C
new file mode 100644
index 0000000..d038879
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr100148.C
@@ -0,0 +1,27 @@
+// PR rtl-optimization/100148
+// { dg-do compile }
+// { dg-options "-O2 -fno-dce -fno-tree-dce -fno-tree-dominator-opts -fno-tree-sink -fcompare-debug" }
+
+int i;
+enum E { } e, ee;
+
+bool
+baz (int)
+{
+ return ee;
+}
+
+bool bar ();
+bool a, b;
+
+void
+foo ()
+{
+ switch (ee)
+ {
+ case 0:
+ e = E (a ? : i);
+ case 1:
+ !(b || baz (0) && bar ());
+ }
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr100254.C b/gcc/testsuite/g++.dg/opt/pr100254.C
new file mode 100644
index 0000000..dbdac16
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr100254.C
@@ -0,0 +1,101 @@
+// PR rtl-optimization/100254
+// { dg-do compile }
+// { dg-options "-O2 -fno-guess-branch-probability -fipa-pta -fnon-call-exceptions -fcompare-debug" }
+// { dg-additional-options "-mtune=goldmont" { target i?86-*-* x86_64-*-* } }
+
+struct _Rb_tree_node_base {
+ typedef _Rb_tree_node_base *_Base_ptr;
+ typedef _Rb_tree_node_base *_Const_Base_ptr;
+ _Base_ptr _M_left;
+};
+template <typename _Key_compare> struct _Rb_tree_key_compare {
+ _Key_compare _M_key_compare;
+};
+struct _Rb_tree_header {
+ _Rb_tree_node_base _M_header;
+};
+struct _Rb_tree_iterator {
+ _Rb_tree_iterator(_Rb_tree_node_base::_Base_ptr);
+ friend bool operator==(_Rb_tree_iterator, _Rb_tree_iterator);
+};
+template <typename _Tp> struct _Rb_tree_const_iterator {
+ typedef _Rb_tree_const_iterator _Self;
+ _Rb_tree_const_iterator(_Rb_tree_node_base::_Const_Base_ptr) {}
+ _Tp operator*();
+ template <typename _Up>
+ friend bool operator!=(_Rb_tree_const_iterator<_Up>, _Rb_tree_const_iterator<_Up>);
+};
+template <typename _Key, typename _Val, typename _Compare> struct _Rb_tree {
+ template <typename _Key_compare>
+ struct _Rb_tree_impl : _Rb_tree_key_compare<_Key_compare>, _Rb_tree_header {};
+ _Rb_tree_impl<_Compare> _M_impl;
+ _Key _S_key();
+ typedef _Rb_tree_const_iterator<_Val> const_iterator;
+ const_iterator begin() { return _M_impl._M_header._M_left; }
+ _Rb_tree_iterator find(const _Key &);
+};
+template <typename _Key, typename _Val, typename _Compare>
+_Rb_tree_iterator _Rb_tree<_Key, _Val, _Compare>::find(const _Key &__k) {
+ _Rb_tree_iterator __j = 0;
+ return __j == 0 || _M_impl._M_key_compare(__k, _S_key()) ? 0 : __j;
+}
+template <typename _Key, typename _Compare = _Key> struct set {
+ typedef _Key key_type;
+ typedef _Rb_tree<key_type, _Key, _Compare> _Rep_type;
+ _Rep_type _M_t;
+ typedef typename _Rep_type::const_iterator iterator;
+ iterator begin() { return _M_t.begin(); }
+ iterator end();
+ void find(key_type __x) { _M_t.find(__x); }
+};
+struct WindowDesc {
+ WindowDesc(short);
+} _station_view_desc(0);
+struct Window {
+ void IsWidgetLowered();
+ virtual void OnClick(int, int, int);
+};
+int AllocateWindowDescFront_window_number;
+template <typename Wcls> void AllocateWindowDescFront(WindowDesc *desc, bool) {
+ Wcls(desc, AllocateWindowDescFront_window_number);
+}
+class CargoDataEntry;
+struct CargoSorter {
+ bool operator()(const CargoDataEntry *, const CargoDataEntry *) const;
+};
+struct CargoDataEntry {
+ ~CargoDataEntry();
+ char Retrieve_cargo;
+ void Retrieve() {
+ CargoDataEntry t(Retrieve_cargo);
+ children->find(&t);
+ }
+ CargoDataEntry(char);
+ set<CargoDataEntry *, CargoSorter> *children;
+};
+CargoDataEntry::CargoDataEntry(char) : children() {}
+CargoDataEntry::~CargoDataEntry() {
+ if (children)
+ for (set<CargoDataEntry *>::iterator i = children->begin();
+ i != children->end();)
+ delete *i;
+}
+bool CargoSorter::operator()(const CargoDataEntry *,
+ const CargoDataEntry *) const { return false; }
+struct StationViewWindow : Window {
+ StationViewWindow(WindowDesc *, int);
+ CargoDataEntry HandleCargoWaitingClick_filter;
+ void OnClick(int, int widget, int) {
+ switch (widget) {
+ case 0:
+ HandleCargoWaitingClick_filter.Retrieve();
+ HandleCargoWaitingClick_filter.Retrieve();
+ case 1:
+ IsWidgetLowered();
+ }
+ }
+};
+void ShowStationViewWindow_station() {
+ AllocateWindowDescFront<StationViewWindow>(&_station_view_desc,
+ ShowStationViewWindow_station);
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr100852.C b/gcc/testsuite/g++.dg/opt/pr100852.C
new file mode 100644
index 0000000..9d9a9f0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr100852.C
@@ -0,0 +1,25 @@
+// PR debug/100852
+// { dg-do compile }
+// { dg-options "-Og -fif-conversion -fno-tree-ccp -fno-tree-copy-prop -fcompare-debug" }
+
+static inline int
+min (unsigned a, int b)
+{
+ return a < b ? a : b;
+}
+
+struct S { S (char); };
+
+static inline S
+foo (unsigned x)
+{
+ int h;
+ h += min (x * 4, h);
+ return h;
+}
+
+void
+bar ()
+{
+ foo (0);
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr101162.C b/gcc/testsuite/g++.dg/opt/pr101162.C
new file mode 100644
index 0000000..4032189
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr101162.C
@@ -0,0 +1,21 @@
+// PR tree-optimization/101162
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A { int i1, i2, i3, i4, i5, i6; };
+
+int A::*
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: return &A::i1;
+ case 2: return &A::i2;
+ case 3: return &A::i3;
+ case 4: return &A::i4;
+ case 5: return &A::i5;
+ case 6: return &A::i6;
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr94589-1.C b/gcc/testsuite/g++.dg/opt/pr94589-1.C
new file mode 100644
index 0000000..d1cc505
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr94589-1.C
@@ -0,0 +1,33 @@
+// PR tree-optimization/94589
+// { dg-do compile { target c++20 } }
+// { dg-options "-O2 -g0 -fdump-tree-optimized" }
+// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 12 "optimized" } }
+// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[45]" 12 "optimized" } }
+
+#include <compare>
+
+#define A __attribute__((noipa))
+A bool f1 (int i, int j) { auto c = i <=> j; return c == 0; }
+A bool f2 (int i, int j) { auto c = i <=> j; return c != 0; }
+A bool f3 (int i, int j) { auto c = i <=> j; return c > 0; }
+A bool f4 (int i, int j) { auto c = i <=> j; return c < 0; }
+A bool f5 (int i, int j) { auto c = i <=> j; return c >= 0; }
+A bool f6 (int i, int j) { auto c = i <=> j; return c <= 0; }
+A bool f7 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::less; }
+A bool f8 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::less; }
+A bool f9 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::equal; }
+A bool f10 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::equal; }
+A bool f11 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::greater; }
+A bool f12 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::greater; }
+A bool f13 (int i) { auto c = i <=> 5; return c == 0; }
+A bool f14 (int i) { auto c = i <=> 5; return c != 0; }
+A bool f15 (int i) { auto c = i <=> 5; return c > 0; }
+A bool f16 (int i) { auto c = i <=> 5; return c < 0; }
+A bool f17 (int i) { auto c = i <=> 5; return c >= 0; }
+A bool f18 (int i) { auto c = i <=> 5; return c <= 0; }
+A bool f19 (int i) { auto c = i <=> 5; return c == std::strong_ordering::less; }
+A bool f20 (int i) { auto c = i <=> 5; return c != std::strong_ordering::less; }
+A bool f21 (int i) { auto c = i <=> 5; return c == std::strong_ordering::equal; }
+A bool f22 (int i) { auto c = i <=> 5; return c != std::strong_ordering::equal; }
+A bool f23 (int i) { auto c = i <=> 5; return c == std::strong_ordering::greater; }
+A bool f24 (int i) { auto c = i <=> 5; return c != std::strong_ordering::greater; }
diff --git a/gcc/testsuite/g++.dg/opt/pr94589-2.C b/gcc/testsuite/g++.dg/opt/pr94589-2.C
new file mode 100644
index 0000000..e9ef84b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr94589-2.C
@@ -0,0 +1,33 @@
+// PR tree-optimization/94589
+// { dg-do compile { target c++20 } }
+// { dg-options "-O2 -g0 -ffast-math -fdump-tree-optimized" }
+// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 12 "optimized" } }
+// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 12 "optimized" } }
+
+#include <compare>
+
+#define A __attribute__((noipa))
+A bool f1 (double i, double j) { auto c = i <=> j; return c == 0; }
+A bool f2 (double i, double j) { auto c = i <=> j; return c != 0; }
+A bool f3 (double i, double j) { auto c = i <=> j; return c > 0; }
+A bool f4 (double i, double j) { auto c = i <=> j; return c < 0; }
+A bool f5 (double i, double j) { auto c = i <=> j; return c >= 0; }
+A bool f6 (double i, double j) { auto c = i <=> j; return c <= 0; }
+A bool f7 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::less; }
+A bool f8 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::less; }
+A bool f9 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::equivalent; }
+A bool f10 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::equivalent; }
+A bool f11 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::greater; }
+A bool f12 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::greater; }
+A bool f13 (double i) { auto c = i <=> 5.0; return c == 0; }
+A bool f14 (double i) { auto c = i <=> 5.0; return c != 0; }
+A bool f15 (double i) { auto c = i <=> 5.0; return c > 0; }
+A bool f16 (double i) { auto c = i <=> 5.0; return c < 0; }
+A bool f17 (double i) { auto c = i <=> 5.0; return c >= 0; }
+A bool f18 (double i) { auto c = i <=> 5.0; return c <= 0; }
+A bool f19 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::less; }
+A bool f20 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::less; }
+A bool f21 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::equivalent; }
+A bool f22 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::equivalent; }
+A bool f23 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::greater; }
+A bool f24 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::greater; }
diff --git a/gcc/testsuite/g++.dg/opt/pr94589-3.C b/gcc/testsuite/g++.dg/opt/pr94589-3.C
new file mode 100644
index 0000000..725b81f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr94589-3.C
@@ -0,0 +1,84 @@
+// { dg-do run { target c++20 } }
+// { dg-options "-O2 -g" }
+
+#include "pr94589-1.C"
+
+#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort ()
+#define D(fn, i, r) if (fn (i) != r) __builtin_abort ()
+
+int
+main ()
+{
+ C (f1, 7, 8, false);
+ C (f1, 8, 8, true);
+ C (f1, 9, 8, false);
+ C (f2, 7, 8, true);
+ C (f2, 8, 8, false);
+ C (f2, 9, 8, true);
+ C (f3, 7, 8, false);
+ C (f3, 8, 8, false);
+ C (f3, 9, 8, true);
+ C (f4, 7, 8, true);
+ C (f4, 8, 8, false);
+ C (f4, 9, 8, false);
+ C (f5, 7, 8, false);
+ C (f5, 8, 8, true);
+ C (f5, 9, 8, true);
+ C (f6, 7, 8, true);
+ C (f6, 8, 8, true);
+ C (f6, 9, 8, false);
+ C (f7, 7, 8, true);
+ C (f7, 8, 8, false);
+ C (f7, 9, 8, false);
+ C (f8, 7, 8, false);
+ C (f8, 8, 8, true);
+ C (f8, 9, 8, true);
+ C (f9, 7, 8, false);
+ C (f9, 8, 8, true);
+ C (f9, 9, 8, false);
+ C (f10, 7, 8, true);
+ C (f10, 8, 8, false);
+ C (f10, 9, 8, true);
+ C (f11, 7, 8, false);
+ C (f11, 8, 8, false);
+ C (f11, 9, 8, true);
+ C (f12, 7, 8, true);
+ C (f12, 8, 8, true);
+ C (f12, 9, 8, false);
+ D (f13, 4, false);
+ D (f13, 5, true);
+ D (f13, 6, false);
+ D (f14, 4, true);
+ D (f14, 5, false);
+ D (f14, 6, true);
+ D (f15, 4, false);
+ D (f15, 5, false);
+ D (f15, 6, true);
+ D (f16, 4, true);
+ D (f16, 5, false);
+ D (f16, 6, false);
+ D (f17, 4, false);
+ D (f17, 5, true);
+ D (f17, 6, true);
+ D (f18, 4, true);
+ D (f18, 5, true);
+ D (f18, 6, false);
+ D (f19, 4, true);
+ D (f19, 5, false);
+ D (f19, 6, false);
+ D (f20, 4, false);
+ D (f20, 5, true);
+ D (f20, 6, true);
+ D (f21, 4, false);
+ D (f21, 5, true);
+ D (f21, 6, false);
+ D (f22, 4, true);
+ D (f22, 5, false);
+ D (f22, 6, true);
+ D (f23, 4, false);
+ D (f23, 5, false);
+ D (f23, 6, true);
+ D (f24, 4, true);
+ D (f24, 5, true);
+ D (f24, 6, false);
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr94589-4.C b/gcc/testsuite/g++.dg/opt/pr94589-4.C
new file mode 100644
index 0000000..256a455
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr94589-4.C
@@ -0,0 +1,84 @@
+// { dg-do run { target c++20 } }
+// { dg-options "-O2 -g -ffast-math" }
+
+#include "pr94589-2.C"
+
+#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort ()
+#define D(fn, i, r) if (fn (i) != r) __builtin_abort ()
+
+int
+main ()
+{
+ C (f1, 7.0, 8.0, false);
+ C (f1, 8.0, 8.0, true);
+ C (f1, 9.0, 8.0, false);
+ C (f2, 7.0, 8.0, true);
+ C (f2, 8.0, 8.0, false);
+ C (f2, 9.0, 8.0, true);
+ C (f3, 7.0, 8.0, false);
+ C (f3, 8.0, 8.0, false);
+ C (f3, 9.0, 8.0, true);
+ C (f4, 7.0, 8.0, true);
+ C (f4, 8.0, 8.0, false);
+ C (f4, 9.0, 8.0, false);
+ C (f5, 7.0, 8.0, false);
+ C (f5, 8.0, 8.0, true);
+ C (f5, 9.0, 8.0, true);
+ C (f6, 7.0, 8.0, true);
+ C (f6, 8.0, 8.0, true);
+ C (f6, 9.0, 8.0, false);
+ C (f7, 7.0, 8.0, true);
+ C (f7, 8.0, 8.0, false);
+ C (f7, 9.0, 8.0, false);
+ C (f8, 7.0, 8.0, false);
+ C (f8, 8.0, 8.0, true);
+ C (f8, 9.0, 8.0, true);
+ C (f9, 7.0, 8.0, false);
+ C (f9, 8.0, 8.0, true);
+ C (f9, 9.0, 8.0, false);
+ C (f10, 7.0, 8.0, true);
+ C (f10, 8.0, 8.0, false);
+ C (f10, 9.0, 8.0, true);
+ C (f11, 7.0, 8.0, false);
+ C (f11, 8.0, 8.0, false);
+ C (f11, 9.0, 8.0, true);
+ C (f12, 7.0, 8.0, true);
+ C (f12, 8.0, 8.0, true);
+ C (f12, 9.0, 8.0, false);
+ D (f13, 4.0, false);
+ D (f13, 5.0, true);
+ D (f13, 6.0, false);
+ D (f14, 4.0, true);
+ D (f14, 5.0, false);
+ D (f14, 6.0, true);
+ D (f15, 4.0, false);
+ D (f15, 5.0, false);
+ D (f15, 6.0, true);
+ D (f16, 4.0, true);
+ D (f16, 5.0, false);
+ D (f16, 6.0, false);
+ D (f17, 4.0, false);
+ D (f17, 5.0, true);
+ D (f17, 6.0, true);
+ D (f18, 4.0, true);
+ D (f18, 5.0, true);
+ D (f18, 6.0, false);
+ D (f19, 4.0, true);
+ D (f19, 5.0, false);
+ D (f19, 6.0, false);
+ D (f20, 4.0, false);
+ D (f20, 5.0, true);
+ D (f20, 6.0, true);
+ D (f21, 4.0, false);
+ D (f21, 5.0, true);
+ D (f21, 6.0, false);
+ D (f22, 4.0, true);
+ D (f22, 5.0, false);
+ D (f22, 6.0, true);
+ D (f23, 4.0, false);
+ D (f23, 5.0, false);
+ D (f23, 6.0, true);
+ D (f24, 4.0, true);
+ D (f24, 5.0, true);
+ D (f24, 6.0, false);
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr99456.C b/gcc/testsuite/g++.dg/opt/pr99456.C
new file mode 100644
index 0000000..66f19c8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr99456.C
@@ -0,0 +1,33 @@
+// PR c++/99456
+// { dg-do compile { target c++17 } }
+// { dg-options "-g0" }
+// { dg-final { scan-assembler-not "PR99456Var0\[1234]" } }
+// { dg-final { scan-assembler-not "__static_initialization_and_destruction" } }
+// { dg-final { scan-assembler-not "_GLOBAL__sub_I" } }
+// { dg-final { scan-assembler-not "_ZGV12PR99456Var1\[1234]" } }
+
+typedef __UINTPTR_TYPE__ uintptr_t;
+
+class Container
+{
+public:
+ uintptr_t m;
+};
+
+extern unsigned desc;
+static constexpr unsigned &descRef = desc;
+
+inline Container PR99456Var01 {reinterpret_cast<uintptr_t> (&descRef)};
+inline Container PR99456Var02 {reinterpret_cast<uintptr_t> (&desc)};
+inline uintptr_t PR99456Var03 {reinterpret_cast<uintptr_t> (&descRef)};
+inline uintptr_t PR99456Var04 {reinterpret_cast<uintptr_t> (&desc)};
+
+inline Container PR99456Var11 {reinterpret_cast<uintptr_t> (&descRef)};
+inline Container PR99456Var12 {reinterpret_cast<uintptr_t> (&desc)};
+inline uintptr_t PR99456Var13 {reinterpret_cast<uintptr_t> (&descRef)};
+inline uintptr_t PR99456Var14 {reinterpret_cast<uintptr_t> (&desc)};
+
+auto *PR99456Ref11 = &PR99456Var11;
+auto *PR99456Ref12 = &PR99456Var12;
+auto *PR99456Ref13 = &PR99456Var13;
+auto *PR99456Ref14 = &PR99456Var14;
diff --git a/gcc/testsuite/g++.dg/opt/pr99728.C b/gcc/testsuite/g++.dg/opt/pr99728.C
new file mode 100644
index 0000000..d439323
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr99728.C
@@ -0,0 +1,50 @@
+// PR/99728
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-lim2-details -w -Wno-psabi" }
+
+typedef double __m256d __attribute__((vector_size(sizeof (double) * 4)));
+extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_set1_pd (double __A)
+{
+ return __extension__ (__m256d){ __A, __A, __A, __A };
+}
+
+// simple OO wrapper around __m256d
+struct Tvsimple
+ {
+ __m256d v;
+ Tvsimple &operator+=(const Tvsimple &other) {v+=other.v; return *this;}
+ Tvsimple operator*(double val) const { Tvsimple res; res.v = v*_mm256_set1_pd(val); return res;}
+ Tvsimple operator*(Tvsimple val) const { Tvsimple res; res.v = v*val.v; return res; }
+ Tvsimple operator+(Tvsimple val) const { Tvsimple res; res.v = v+val.v; return res; }
+ Tvsimple operator+(double val) const { Tvsimple res; res.v = v+_mm256_set1_pd(val); return res;}
+ };
+
+template<typename vtype> struct s0data_s
+ { vtype sth, corfac, scale, lam1, lam2, csq, p1r, p1i, p2r, p2i; };
+
+template<typename vtype> void foo(s0data_s<vtype> & __restrict__ d,
+ const double * __restrict__ coef, const double * __restrict__ alm,
+ unsigned long l, unsigned long il, unsigned long lmax)
+ {
+// critical loop
+ while (l<=lmax)
+ {
+ d.p1r += d.lam2*alm[2*l];
+ d.p1i += d.lam2*alm[2*l+1];
+ d.p2r += d.lam2*alm[2*l+2];
+ d.p2i += d.lam2*alm[2*l+3];
+ Tvsimple tmp = d.lam2*(d.csq*coef[2*il] + coef[2*il+1]) + d.lam1;
+ d.lam1 = d.lam2;
+ d.lam2 = tmp;
+ ++il; l+=2;
+ }
+ }
+
+// this version has dead stores at the end of the loop
+template void foo<>(s0data_s<Tvsimple> & __restrict__ d,
+ const double * __restrict__ coef, const double * __restrict__ alm,
+ unsigned long l, unsigned long il, unsigned long lmax);
+
+// The aggregate copy in the IL should not prevent all store-motion
+// { dg-final { scan-tree-dump-times "Executing store motion" 4 "lim2" } }
diff --git a/gcc/testsuite/g++.dg/other/anon-union5.C b/gcc/testsuite/g++.dg/other/anon-union5.C
new file mode 100644
index 0000000..616dea8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/anon-union5.C
@@ -0,0 +1,9 @@
+// PR c++/97974
+
+struct A {
+ union {
+ operator int (); // { dg-error "anonymous union" }
+ int a;
+ };
+ operator int; // { dg-error "" }
+};
diff --git a/gcc/testsuite/g++.dg/other/gc6.C b/gcc/testsuite/g++.dg/other/gc6.C
new file mode 100644
index 0000000..ff45dd3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/gc6.C
@@ -0,0 +1,16 @@
+// PR c++/99831
+// { dg-do compile { target c++20 } }
+// { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0" }
+
+template <int N> struct S {
+ constexpr S(const char (&str)[N]) : value{} { }
+ char value[N];
+};
+template <S> struct string {
+ constexpr bool operator==(const string &) const = default;
+};
+template <S L2> void operator+(string<L2>) {
+ char value[1];
+ S{value};
+}
+static_assert(string<"a">{} == string<"a">{});
diff --git a/gcc/testsuite/g++.dg/other/gc7.C b/gcc/testsuite/g++.dg/other/gc7.C
new file mode 100644
index 0000000..ab436ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/gc7.C
@@ -0,0 +1,16 @@
+// PR c++/91416 - GC during late parsing collects live data.
+// { dg-do compile }
+// { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0" }
+
+__attribute__ ((unused)) struct S {
+ S() { }
+} s;
+
+__attribute__ ((unused)) struct X {
+ void fn ()
+ {
+ __attribute__ ((unused)) struct N {
+ N() { }
+ } n;
+ }
+} x;
diff --git a/gcc/testsuite/g++.dg/other/i386-2.C b/gcc/testsuite/g++.dg/other/i386-2.C
index 62b2132..fba3d1a 100644
--- a/gcc/testsuite/g++.dg/other/i386-2.C
+++ b/gcc/testsuite/g++.dg/other/i386-2.C
@@ -1,5 +1,5 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni" } */
+/* { dg-options "-O -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni -mavx512fp16" } */
/* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h, fma4intrin.h,
xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h, lwpintrin.h,
diff --git a/gcc/testsuite/g++.dg/other/i386-3.C b/gcc/testsuite/g++.dg/other/i386-3.C
index 843aa2b..5cc0fa8 100644
--- a/gcc/testsuite/g++.dg/other/i386-3.C
+++ b/gcc/testsuite/g++.dg/other/i386-3.C
@@ -1,5 +1,5 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni" } */
+/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni -mavx512fp16" } */
/* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h, fma4intrin.h,
xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h, lwpintrin.h,
diff --git a/gcc/testsuite/g++.dg/other/pr100580.C b/gcc/testsuite/g++.dg/other/pr100580.C
new file mode 100644
index 0000000..d6cc0a6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr100580.C
@@ -0,0 +1,8 @@
+// PR c++/100580
+// { dg-do compile }
+// { dg-require-weak "" }
+// { dg-options "-fdump-passes" }
+// { dg-prune-output ".*" }
+
+int foo;
+static __typeof(foo) bar __attribute__((__weakref__("foo")));
diff --git a/gcc/testsuite/g++.dg/parse/access13.C b/gcc/testsuite/g++.dg/parse/access13.C
new file mode 100644
index 0000000..41463c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/access13.C
@@ -0,0 +1,7 @@
+// PR c++/100659
+
+template <typename> struct A
+{
+ A::E::V; // { dg-warning "access decl" }
+ enum { V }; // { dg-error "conflicts with a previous decl" }
+};
diff --git a/gcc/testsuite/g++.dg/parse/saved1.C b/gcc/testsuite/g++.dg/parse/saved1.C
index 979a056..1deaa93 100644
--- a/gcc/testsuite/g++.dg/parse/saved1.C
+++ b/gcc/testsuite/g++.dg/parse/saved1.C
@@ -1,7 +1,7 @@
// Test that the parser doesn't go into an infinite loop from ignoring the
// PRE_PARSED_FUNCTION_DECL token.
-class C { static void* operator new(size_t); }; // { dg-error "24:declaration of .operator new. as non-function" }
-// { dg-error "expected|ISO C\\+\\+ forbids" "" { target *-*-* } .-1 }
+class C { static void* operator new(size_t); }; // { dg-error "37:.size_t. has not been declared" }
+// { dg-error ".operator new. takes type .size_t." "" { target *-*-* } .-1 }
void* C::operator new(size_t) { return 0; } // { dg-error "" }
class D { D(int i): integer(i){}}; // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/parse/template2.C b/gcc/testsuite/g++.dg/parse/template2.C
index 3cb27a8..3cafd9f 100644
--- a/gcc/testsuite/g++.dg/parse/template2.C
+++ b/gcc/testsuite/g++.dg/parse/template2.C
@@ -3,6 +3,6 @@ namespace N {
}
int main() {
- N::C(); // { dg-error "6:cannot deduce template arguments" "" { target c++17 } }
+ N::C(); // { dg-error "8:class template argument deduction failed|no match" "" { target c++17 } }
// { dg-error "7:missing template arguments" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.dg/parse/uneval1.C b/gcc/testsuite/g++.dg/parse/uneval1.C
new file mode 100644
index 0000000..dfc1bb4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/uneval1.C
@@ -0,0 +1,14 @@
+// PR c++/93314
+
+struct S {
+ int m;
+ static int f() {
+ return sizeof(char[m]); // { dg-error "S::m" }
+ }
+};
+
+int main()
+{
+ return S().f()
+ + sizeof(char[S::m]); // { dg-error "S::m" }
+}
diff --git a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
index 288da2c..70778e9 100644
--- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
+++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
@@ -900,7 +900,7 @@ void test_methods ()
((base *)1)->priv (); // { dg-error " is private " }
/* { dg-begin-multiline-output "" }
((base *)1)->priv ();
- ^
+ ~~~~~~~~~~~~~~~~~~^~
{ dg-end-multiline-output "" }
{ dg-begin-multiline-output "" }
int priv ();
diff --git a/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr100796.c b/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr100796.c
new file mode 100644
index 0000000..7fa964c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr100796.c
@@ -0,0 +1,25 @@
+// PR c++/100796
+// { dg-additional-options "-Wsuggest-override -fplugin-arg-location_overflow_plugin-value=0x60000001" }
+// Passing LINE_MAP_MAX_LOCATION_WITH_COLS meant we stopped distinguishing between lines in a macro.
+
+#define DO_PRAGMA(text) _Pragma(#text)
+#define WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
+#define WARNING_POP DO_PRAGMA(GCC diagnostic pop)
+#define WARNING_DISABLE(text) DO_PRAGMA(GCC diagnostic ignored text)
+#define NO_OVERRIDE_WARNING WARNING_DISABLE("-Wsuggest-override")
+
+#define BOILERPLATE \
+ WARNING_PUSH \
+ NO_OVERRIDE_WARNING \
+ void f(); \
+ WARNING_POP
+
+struct B
+{
+ virtual void f();
+};
+
+struct D: B
+{
+ BOILERPLATE
+};
diff --git a/gcc/testsuite/g++.dg/plugin/plugin.exp b/gcc/testsuite/g++.dg/plugin/plugin.exp
index 5cd4b4b..74e12df 100644
--- a/gcc/testsuite/g++.dg/plugin/plugin.exp
+++ b/gcc/testsuite/g++.dg/plugin/plugin.exp
@@ -73,7 +73,8 @@ set plugin_test_list [list \
../../gcc.dg/plugin/diagnostic-test-string-literals-3.c \
../../gcc.dg/plugin/diagnostic-test-string-literals-4.c } \
{ ../../gcc.dg/plugin/location_overflow_plugin.c \
- location-overflow-test-pr96391.c } \
+ location-overflow-test-pr96391.c \
+ location-overflow-test-pr100796.c } \
{ show_template_tree_color_plugin.c \
show-template-tree-color.C \
show-template-tree-color-labels.C \
diff --git a/gcc/testsuite/g++.dg/pr100253.C b/gcc/testsuite/g++.dg/pr100253.C
new file mode 100644
index 0000000..0102caa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr100253.C
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-tree-bit-ccp -ftree-slp-vectorize" } */
+
+#include <vector>
+
+struct T
+{
+};
+
+struct S
+{
+ std::vector < std::vector < T > > v;
+ char x;
+ char y[16];
+ char z[16];
+};
+
+S s, g[1];
+
+void
+foo (char *buf)
+{
+ s = g[*buf];
+}
+
+char c;
+
+int
+main ()
+{
+ foo (&c);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pr100574.C b/gcc/testsuite/g++.dg/pr100574.C
new file mode 100644
index 0000000..0df62aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr100574.C
@@ -0,0 +1,68 @@
+/* PR middle-end/100574 - ICE: in size_remaining, at builtins.c:413 with
+ -O3 -ftracer -fno-tree-dominator-opts -fno-tree-fre
+ { dg-do compile { target c++11 } }
+ { dg-options "-O3 -ftracer -fno-tree-dominator-opts -fno-tree-fre" } */
+
+void *operator new (__SIZE_TYPE__, void *__p) { return __p; }
+
+template <typename> struct allocator_traits;
+template <typename> class allocator {};
+template <typename _Tp> struct allocator_traits<allocator<_Tp> >
+{
+ using allocator_type = allocator<_Tp>;
+ using pointer = _Tp *;
+ using size_type = long;
+ template <typename _Up> using rebind_alloc = allocator<_Up>;
+ static pointer allocate(allocator_type, size_type);
+ template <typename _Up> static void construct(_Up __p) { new (__p) _Up(); }
+};
+
+struct __alloc_traits : allocator_traits<allocator<char>> {
+ struct rebind {
+ typedef rebind_alloc<char> other;
+ };
+};
+
+struct _Vector_base {
+ struct : __alloc_traits::rebind::other {
+ } _M_impl;
+ long _M_allocate___n;
+};
+
+template <typename, typename = char> class vector : _Vector_base {
+ long max_size();
+public:
+ void push_back() { _M_realloc_insert(); }
+ template <typename...> void _M_realloc_insert();
+};
+
+template <typename _Tp, typename _Alloc>
+template <typename...>
+void vector<_Tp, _Alloc>::_M_realloc_insert() {
+ __alloc_traits::pointer __trans_tmp_5;
+ /* __len is used uninitialized below, which might trigger warnings,
+ even without -Wall (and other than -Wuninitialized). */
+ long __len(__len || max_size()), __elems_before;
+ __trans_tmp_5 = _M_allocate___n
+ ? __alloc_traits::allocate(_M_impl, _M_allocate___n)
+ : __alloc_traits::pointer();
+ __alloc_traits::construct(__trans_tmp_5 + __elems_before);
+}
+
+enum { MIDIST_PITCHBEND };
+struct DataBlock {
+ vector<char> data;
+};
+
+char ReadTrackChunk_status;
+
+void ReadTrackChunk()
+{
+ DataBlock block;
+ while (!0)
+ switch (ReadTrackChunk_status)
+ case MIDIST_PITCHBEND:
+ block.data.push_back();
+}
+
+// { dg-prune-output "warning" }
diff --git a/gcc/testsuite/g++.dg/pr100774.C b/gcc/testsuite/g++.dg/pr100774.C
new file mode 100644
index 0000000..345fcfa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr100774.C
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-forwprop --param=evrp-mode=ranger -fcompare-debug " } */
+
+extern void __attribute__((noreturn)) error();
+
+int x;
+
+static inline int bar(void) {
+ char n = 1;
+ int i = x & 1U << n - 1;
+ return i;
+}
+
+void foo()
+{
+ int a = bar();
+ for (;;) {
+ bool b;
+ int d = a;
+ b = a < 2;
+ if (!b)
+ error();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/pr101331.C b/gcc/testsuite/g++.dg/pr101331.C
new file mode 100644
index 0000000..015aba2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr101331.C
@@ -0,0 +1,7 @@
+// PR c++/101331
+// { dg-do compile }
+// { dg-options "-fsanitize-coverage=trace-pc -O2 -std=c++11" }
+
+int a[2];
+int b = 1;
+int c { b && (a[b] = 0) };
diff --git a/gcc/testsuite/g++.dg/pr101511.C b/gcc/testsuite/g++.dg/pr101511.C
new file mode 100644
index 0000000..ee2c7fd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr101511.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-O2 -Wno-div-by-zero" }
+
+void __assert_fail(const char *, const char *, int, const char *)
+ __attribute__((__noreturn__));
+template <typename T> void test_uint() {
+ long __trans_tmp_3, __trans_tmp_1;
+ int Error;
+ for (;;) {
+ {
+ unsigned long Tmp = -1;
+ __trans_tmp_3 = Tmp - Tmp % 0;
+ }
+ Error += 0 == __trans_tmp_3 ? 0 : 1;
+ !Error ? void() : __assert_fail("", "", 3, __PRETTY_FUNCTION__);
+ T Tmp = -1;
+ __trans_tmp_1 = Tmp - Tmp % 0;
+ Error += 0 == __trans_tmp_1 ? 0 : 1;
+ !Error ? void() : __assert_fail("", "", 7, __PRETTY_FUNCTION__);
+ }
+}
+void test() { test_uint<unsigned long>(); }
diff --git a/gcc/testsuite/g++.dg/pr71389.C b/gcc/testsuite/g++.dg/pr71389.C
index 023abe1..8c376e9 100644
--- a/gcc/testsuite/g++.dg/pr71389.C
+++ b/gcc/testsuite/g++.dg/pr71389.C
@@ -1,7 +1,7 @@
// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-std=c++11 -O3 -march=ivybridge" }
-#include <functional>
+#include <array>
extern int le_s6, le_s9, le_s11;
long foo_v14[16][16];
diff --git a/gcc/testsuite/g++.dg/pr71655.C b/gcc/testsuite/g++.dg/pr71655.C
index 8ed3371..4594306 100644
--- a/gcc/testsuite/g++.dg/pr71655.C
+++ b/gcc/testsuite/g++.dg/pr71655.C
@@ -5,6 +5,7 @@
#include <functional>
#include <valarray>
+#include <array>
extern int var_16, le_s5, le_s6, le_s9;
std::array<std::array<std::array<long, 8>, 4>, 24> v4;
extern std::array<std::array<int, 48>, 18> v15;
diff --git a/gcc/testsuite/g++.dg/pr90773-1.h b/gcc/testsuite/g++.dg/pr90773-1.h
new file mode 100644
index 0000000..abdb78b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr90773-1.h
@@ -0,0 +1,14 @@
+class fixed_wide_int_storage {
+public:
+ long val[10];
+ int len;
+ fixed_wide_int_storage ()
+ {
+ len = sizeof (val) / sizeof (val[0]);
+ for (int i = 0; i < len; i++)
+ val[i] = i;
+ }
+};
+
+extern void foo (fixed_wide_int_storage);
+extern int record_increment(void);
diff --git a/gcc/testsuite/g++.dg/pr90773-1a.C b/gcc/testsuite/g++.dg/pr90773-1a.C
new file mode 100644
index 0000000..3ab8d92
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr90773-1a.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+// { dg-additional-options "-mno-avx -msse2 -mtune=skylake" { target { i?86-*-* x86_64-*-* } } }
+
+#include "pr90773-1.h"
+
+int
+record_increment(void)
+{
+ fixed_wide_int_storage x;
+ foo (x);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pr90773-1b.C b/gcc/testsuite/g++.dg/pr90773-1b.C
new file mode 100644
index 0000000..9713b2d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr90773-1b.C
@@ -0,0 +1,5 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+// { dg-additional-options "-mno-avx512f -march=skylake" { target { i?86-*-* x86_64-*-* } } }
+
+#include "pr90773-1a.C"
diff --git a/gcc/testsuite/g++.dg/pr90773-1c.C b/gcc/testsuite/g++.dg/pr90773-1c.C
new file mode 100644
index 0000000..699357a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr90773-1c.C
@@ -0,0 +1,5 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+// { dg-additional-options "-march=skylake-avx512" { target { i?86-*-* x86_64-*-* } } }
+
+#include "pr90773-1a.C"
diff --git a/gcc/testsuite/g++.dg/pr90773-1d.C b/gcc/testsuite/g++.dg/pr90773-1d.C
new file mode 100644
index 0000000..bf9d854
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr90773-1d.C
@@ -0,0 +1,19 @@
+// { dg-do run }
+// { dg-options "-O2" }
+// { dg-additional-options "-march=native" { target { i?86-*-* x86_64-*-* } } }
+// { dg-additional-sources "pr90773-1a.C" }
+
+#include "pr90773-1.h"
+
+void
+foo (fixed_wide_int_storage x)
+{
+ for (int i = 0; i < x.len; i++)
+ if (x.val[i] != i)
+ __builtin_abort ();
+}
+
+int main ()
+{
+ return record_increment ();
+}
diff --git a/gcc/testsuite/g++.dg/pr93195a.C b/gcc/testsuite/g++.dg/pr93195a.C
index 26d265d..b14f1b3 100644
--- a/gcc/testsuite/g++.dg/pr93195a.C
+++ b/gcc/testsuite/g++.dg/pr93195a.C
@@ -1,4 +1,5 @@
/* { dg-do link { target { ! { nvptx*-*-* visium-*-* } } } } */
+/* { dg-skip-if "not supported" { { powerpc*-*-* } && lp64 } } */
// { dg-require-effective-target o_flag_in_section }
/* { dg-options "-O0 -fpatchable-function-entry=1" } */
/* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */
diff --git a/gcc/testsuite/g++.dg/pr94314-3.C b/gcc/testsuite/g++.dg/pr94314-3.C
index 846a5d6..3160418 100644
--- a/gcc/testsuite/g++.dg/pr94314-3.C
+++ b/gcc/testsuite/g++.dg/pr94314-3.C
@@ -38,7 +38,7 @@ volatile int c = 1;
int
main ()
{
- for (int i; i < c; i++)
+ for (int i = 0; i < c; i++)
{
idx = 0;
delete new B;
diff --git a/gcc/testsuite/g++.dg/pr95768.C b/gcc/testsuite/g++.dg/pr95768.C
index 5e2c8c4..d34d513 100644
--- a/gcc/testsuite/g++.dg/pr95768.C
+++ b/gcc/testsuite/g++.dg/pr95768.C
@@ -1,6 +1,6 @@
/* PR c++/95768 - pretty-printer ICE on -Wuninitialized with allocated storage
{ dg-do compile }
- { dg-options "-O2 -Wall" } */
+ { dg-options "-O2 -Wall -Wno-array-bounds" } */
extern "C" void *malloc (__SIZE_TYPE__);
diff --git a/gcc/testsuite/g++.dg/pr98032.C b/gcc/testsuite/g++.dg/pr98032.C
new file mode 100644
index 0000000..d7eef27
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr98032.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+
+namespace osl {
+class Thread {
+public:
+ virtual ~Thread();
+ virtual void join();
+};
+} // namespace osl
+class SimpleReferenceObject {
+protected:
+ virtual ~SimpleReferenceObject();
+};
+class Thread : SimpleReferenceObject, osl::Thread {
+public:
+ using osl::Thread::join;
+};
+class RenderThread : Thread {
+ RenderThread() { join(); }
+};
diff --git a/gcc/testsuite/g++.dg/pr98136.C b/gcc/testsuite/g++.dg/pr98136.C
new file mode 100644
index 0000000..f3c27f6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr98136.C
@@ -0,0 +1,26 @@
+// { dg-do compile { target { ilp32 || lp64 } } }
+
+struct AddIn
+{
+ virtual ~AddIn() {}
+ virtual void AddInCall()=0;
+};
+
+struct Base
+{
+ char b[32*1024*1024]; // Anything bigger than 16mb causes internal compiler error
+ virtual ~Base() {}
+};
+
+struct Deriv : public Base,
+ public AddIn
+{
+ void AddInCall() {}
+};
+
+int main (int argc, char **argv)
+{
+ Deriv deriv;
+ deriv.AddInCall();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/spellcheck-stdlib.C b/gcc/testsuite/g++.dg/spellcheck-stdlib.C
index 31e91fe..87736b2 100644
--- a/gcc/testsuite/g++.dg/spellcheck-stdlib.C
+++ b/gcc/testsuite/g++.dg/spellcheck-stdlib.C
@@ -138,6 +138,24 @@ void test_cstdlib (void *q)
// { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
q = realloc (q, 1024); // { dg-error "was not declared" }
// { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
+ q = calloc (8, 8); // { dg-error "was not declared" }
+ // { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
+
+ void callback ();
+ atexit (callback); // { dg-error "was not declared" }
+ // { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
+ int i;
+ i = EXIT_SUCCESS; // { dg-error "was not declared" }
+ // { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
+ i = EXIT_FAILURE; // { dg-error "was not declared" }
+ // { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
+ exit (i); // { dg-error "was not declared" }
+ // { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
+ abort (); // { dg-error "was not declared" }
+ // { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
+
+ getenv ("foo"); // { dg-error "was not declared" }
+ // { dg-message "'#include <cstdlib>'" "" { target *-*-* } .-1 }
}
/* Verify that we don't offer suggestions to stdlib globals names when
diff --git a/gcc/testsuite/g++.dg/template/access2.C b/gcc/testsuite/g++.dg/template/access2.C
index 0620c10..4a80bb4 100644
--- a/gcc/testsuite/g++.dg/template/access2.C
+++ b/gcc/testsuite/g++.dg/template/access2.C
@@ -5,6 +5,9 @@
template <class T> struct A {
typename T::X x; // { dg-error "this context" }
+};
+
+template <class T> struct A2 {
int f() { return T::i; } // { dg-error "this context" }
};
@@ -16,5 +19,6 @@ class B {
int main()
{
A<B> ab; // { dg-message "required" }
- ab.f(); // { dg-message "required" }
+ A2<B> a2b;
+ a2b.f(); // { dg-message "required" }
}
diff --git a/gcc/testsuite/g++.dg/template/access36.C b/gcc/testsuite/g++.dg/template/access36.C
new file mode 100644
index 0000000..72ca23c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access36.C
@@ -0,0 +1,25 @@
+// PR c++/16617
+
+class B
+{
+ protected:
+ int i;
+};
+
+template <class T> void fr ();
+
+class D2 : public B
+{
+ friend void fr<int> ();
+};
+
+template<int B::*> struct X
+{};
+
+template <class T> void fr ()
+{
+ X<&B::i> x1; // { dg-error "protected" }
+ X<&D2::i> x2; // { dg-error "protected" }
+}
+
+template void fr<char>();
diff --git a/gcc/testsuite/g++.dg/template/access37.C b/gcc/testsuite/g++.dg/template/access37.C
new file mode 100644
index 0000000..5be532c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access37.C
@@ -0,0 +1,26 @@
+// PR c++/100502
+
+template <class T>
+struct EnumeratorRange {
+ struct Iterator {
+ EnumeratorRange range_;
+
+ friend void f(Iterator i) {
+ i.range_.end_reached_; // { dg-error "private" }
+ i.range_.EnumeratorRange::end_reached_; // { dg-error "private" }
+ &i.range_.end_reached_; // { dg-error "private" }
+ &i.range_.EnumeratorRange::end_reached_; // { dg-error "private" }
+ }
+ };
+
+ private:
+ bool end_reached_;
+#if DECLARE_FRIEND
+ friend void f(Iterator);
+#endif
+};
+
+int main() {
+ EnumeratorRange<int>::Iterator i;
+ f(i);
+}
diff --git a/gcc/testsuite/g++.dg/template/access37a.C b/gcc/testsuite/g++.dg/template/access37a.C
new file mode 100644
index 0000000..4ce1b27
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access37a.C
@@ -0,0 +1,6 @@
+// PR c++/100502
+// { dg-additional-options "-DDECLARE_FRIEND -Wno-non-template-friend" }
+
+// Verify that access37.C is accepted if the appropriate friend relation
+// is declared (controlled by the macro DECLARE_FRIEND).
+#include "access37.C"
diff --git a/gcc/testsuite/g++.dg/template/access38.C b/gcc/testsuite/g++.dg/template/access38.C
new file mode 100644
index 0000000..488f865
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access38.C
@@ -0,0 +1,15 @@
+// PR c++/100918
+
+struct Outer {
+ template<class T>
+ struct Inner { ~Inner(); };
+};
+
+template<>
+Outer::Inner<int>::~Inner<int>() { } // { dg-error "template-id" "" { target c++20 } }
+
+template<class T>
+Outer::Inner<T>::~Inner<T>() { } // { dg-error "template-id" "" { target c++20 } }
+
+Outer::Inner<int> x;
+Outer::Inner<char> y;
diff --git a/gcc/testsuite/g++.dg/template/access39.C b/gcc/testsuite/g++.dg/template/access39.C
new file mode 100644
index 0000000..d941555
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access39.C
@@ -0,0 +1,17 @@
+// PR c++/101078
+
+struct A {
+ static void f();
+};
+
+template<class>
+struct B : private A {
+ struct C {
+ void g() { f(); }
+ void g2() { B::f(); }
+ };
+};
+
+int main() {
+ B<int>::C().g();
+}
diff --git a/gcc/testsuite/g++.dg/template/access40.C b/gcc/testsuite/g++.dg/template/access40.C
new file mode 100644
index 0000000..d035e99
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access40.C
@@ -0,0 +1,28 @@
+// PR c++/96204
+
+template<class, class = void>
+struct has_type_member {
+ static const bool value = false;
+};
+
+template<class T>
+struct has_type_member<T, typename T::type> {
+ static const bool value = true;
+};
+
+struct Parent;
+
+struct Child {
+private:
+ friend struct Parent;
+ typedef void type;
+};
+
+struct Parent {
+ static void f() {
+ // The partial specialization does not match despite Child::type
+ // being accessible from the current scope.
+ extern int x[1];
+ extern int x[!has_type_member<Child>::value];
+ }
+};
diff --git a/gcc/testsuite/g++.dg/template/access40a.C b/gcc/testsuite/g++.dg/template/access40a.C
new file mode 100644
index 0000000..94025c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access40a.C
@@ -0,0 +1,28 @@
+// PR c++/96204
+
+template<class, class = void>
+struct has_type_member {
+ static const bool value = false;
+};
+
+template<class T>
+struct has_type_member<T, typename T::type> {
+ static const bool value = true;
+};
+
+struct Parent;
+
+struct Child {
+private:
+ friend struct has_type_member<Child>;
+ typedef void type;
+};
+
+struct Parent {
+ static void f() {
+ // The partial specialization matches because has_type_member<Child>
+ // is a friend of Child.
+ extern int x[1];
+ extern int x[has_type_member<Child>::value];
+ }
+};
diff --git a/gcc/testsuite/g++.dg/template/access41.C b/gcc/testsuite/g++.dg/template/access41.C
new file mode 100644
index 0000000..1ab9a1a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access41.C
@@ -0,0 +1,24 @@
+// PR c++/96204
+// { dg-do compile { target c++14 } }
+// A variant of access40.C where has_type_member is a variable template instead
+// of a class template.
+
+template<class, class = void>
+constexpr bool has_type_member = false;
+
+template<class T>
+constexpr bool has_type_member<T, typename T::type> = true;
+
+struct Parent;
+
+struct Child {
+private:
+ friend struct Parent;
+ typedef void type;
+};
+
+struct Parent {
+ // The partial specialization does not match despite Child::type
+ // being accessible from the current scope.
+ static_assert(!has_type_member<Child>, "");
+};
diff --git a/gcc/testsuite/g++.dg/template/access41a.C b/gcc/testsuite/g++.dg/template/access41a.C
new file mode 100644
index 0000000..e108049
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access41a.C
@@ -0,0 +1,29 @@
+// PR c++/96204
+// { dg-do compile { target c++14 } }
+// A variant of access40a.C where has_type_member is a variable template instead
+// of a class template.
+
+template<class T>
+struct A {
+ template<class, class = void>
+ static constexpr bool has_type_member = false;
+};
+
+template<class T>
+template<class U>
+constexpr int A<T>::has_type_member<U, typename U::type> = true;
+
+struct Child {
+private:
+ friend struct A<int>;
+ typedef void type;
+};
+
+// The partial specialization matches because A<int> is a friend of Child.
+static_assert(A<int>::has_type_member<Child>, "");
+using type1 = const int;
+using type1 = decltype(A<int>::has_type_member<Child>);
+
+static_assert(!A<char>::has_type_member<Child>, "");
+using type2 = const bool;
+using type2 = decltype(A<char>::has_type_member<Child>);
diff --git a/gcc/testsuite/g++.dg/template/call8.C b/gcc/testsuite/g++.dg/template/call8.C
new file mode 100644
index 0000000..04609dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/call8.C
@@ -0,0 +1,14 @@
+// PR c++/100344
+// { dg-do compile { target c++11 } }
+
+template <class> constexpr int find_index() { return 1; }
+
+template <int, class T> void foo(T);
+
+template <class T> void get(T v) {
+ foo<find_index<T>()>(v);
+}
+
+int main() {
+ get(0);
+}
diff --git a/gcc/testsuite/g++.dg/template/conv17.C b/gcc/testsuite/g++.dg/template/conv17.C
new file mode 100644
index 0000000..ba012c9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/conv17.C
@@ -0,0 +1,56 @@
+// PR c++/101904
+// Verify we stop at the first bad argument conversion when considering a
+// candidate during overload resolution.
+
+template<class T>
+struct A { typedef typename T::type type; };
+
+struct B {
+ // A conversion function that always induces a hard error when instantiated.
+ template<class T> B(T, typename A<T>::type = 0);
+};
+
+struct C {
+ template<class T> void f(T, typename A<T>::type); // #1
+ template<class T> void f(T, T) const; // #2
+
+ static void g(int*, B); // #3
+ static void g(int, int); // #4
+
+#if __cpp_ref_qualifiers
+ void h(B) &; // #5
+ void h(int) &&; // #6
+#endif
+};
+
+int main() {
+ const C c;
+
+ // The bad conversion for the 'this' argument should preclude us from further
+ // considering the non-const #1 (which would have caused a hard error during
+ // instantiation). This behavior is essentially DR 1391 extended to the
+ // 'this' argument.
+ c.f(0, 0); // resolves to #2
+ c.f<int>(0, 0);
+
+ // Likewise for the bad conversion for the 1st argument in #3.
+ C::g(42, 42); // resolves to #4
+
+#if __cpp_ref_qualifiers
+ // Likewise for the bad 'this' conversion in #5.
+ C().h(0); // resolves to #6
+#endif
+}
+
+#if __cpp_concepts
+// Test the same calls in a SFINAE context.
+template<class T>
+concept D = requires (const T t) {
+ t.f(0, 0);
+ t.template f<int>(0, 0);
+ T::g(42, 42);
+ T().h(0);
+};
+
+static_assert(D<C>);
+#endif
diff --git a/gcc/testsuite/g++.dg/template/crash50.C b/gcc/testsuite/g++.dg/template/crash50.C
index 286685a..4b846cd 100644
--- a/gcc/testsuite/g++.dg/template/crash50.C
+++ b/gcc/testsuite/g++.dg/template/crash50.C
@@ -3,5 +3,5 @@
struct A
{
- template<int> void* foo(; // { dg-error "primary-expression|initialization|static|template" }
+ template<int> void* foo(; // { dg-error "expected|initialization|static|template" }
};
diff --git a/gcc/testsuite/g++.dg/template/dependent-tmpl1.C b/gcc/testsuite/g++.dg/template/dependent-tmpl1.C
new file mode 100644
index 0000000..7b800b6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-tmpl1.C
@@ -0,0 +1,9 @@
+// PR c++/93085
+// { dg-do compile { target c++11 } }
+
+template<class T>
+struct G {
+ template<T> static int foo(); // #1
+ template<int> static int foo(); // #2
+ int x = foo<42>(); // OK
+};
diff --git a/gcc/testsuite/g++.dg/template/dependent-tmpl2.C b/gcc/testsuite/g++.dg/template/dependent-tmpl2.C
new file mode 100644
index 0000000..040ddb4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-tmpl2.C
@@ -0,0 +1,10 @@
+// PR c++/100078
+// { dg-do compile { target c++11 } }
+
+template <bool> struct enable_if;
+template <typename Data> struct HashMapBucket {
+ template <typename T = Data>
+ static typename enable_if<T ::value>::type selectStructure() {
+ selectStructure();
+ }
+};
diff --git a/gcc/testsuite/g++.dg/template/error56.C b/gcc/testsuite/g++.dg/template/error56.C
index e85471a..71206a1 100644
--- a/gcc/testsuite/g++.dg/template/error56.C
+++ b/gcc/testsuite/g++.dg/template/error56.C
@@ -3,12 +3,12 @@
struct A
{
template <class T> void f(T);
- void f();
+ void f(int);
};
int main()
{
- A().f<1>(); // { dg-error "f<1>" }
+ A().f<1>(0); // { dg-error "f<1>" }
// { dg-error "type/value mismatch at argument 1" "" { target *-*-* } .-1 }
// { dg-message "expected a type, got .1." "" { target *-*-* } .-2 }
}
diff --git a/gcc/testsuite/g++.dg/template/error8.C b/gcc/testsuite/g++.dg/template/error8.C
index 6cae360..de1534c 100644
--- a/gcc/testsuite/g++.dg/template/error8.C
+++ b/gcc/testsuite/g++.dg/template/error8.C
@@ -3,6 +3,6 @@
template <typename T> struct S {};
void f() {
- throw S (); // { dg-error "9:cannot deduce template arguments" "" { target c++17 } }
+ throw S (); // { dg-error "12:class template argument deduction failed|no match" "" { target c++17 } }
// { dg-error "11:missing template arguments" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.dg/template/explicit-args6.C b/gcc/testsuite/g++.dg/template/explicit-args6.C
new file mode 100644
index 0000000..d853564
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/explicit-args6.C
@@ -0,0 +1,34 @@
+// PR c++/101460
+// { dg-do compile { target c++11 } }
+
+template<bool> struct enable_if { };
+template<> struct enable_if<true> { using type = void; };
+
+template<bool B>
+using enable_if_t = typename enable_if<B>::type;
+
+struct tuple { };
+struct pair { };
+
+template<unsigned N> enable_if_t<N == 1> get(tuple&) { } // { dg-bogus "candidate" }
+template<unsigned N> enable_if_t<N == 1> get(const tuple&) { } // { dg-bogus "candidate" }
+template<unsigned N> enable_if_t<N == 1> get(pair&) { } // { dg-bogus "candidate" }
+template<unsigned N> enable_if_t<N == 1> get(const pair&) { } // { dg-bogus "candidate" }
+
+template<int N>
+constexpr unsigned
+frob()
+{
+ static_assert(N == 1, "user-friendly diagnostic"); // { dg-error "user-friendly" }
+ // narrowing check, reject negative values
+ return unsigned{N}; // { dg-prune-output "narrowing" }
+} // { dg-prune-output "flows off the end" }
+// { dg-prune-output "not a return-statement" }
+
+template<int N> void get_n(tuple& t) { get<frob<N>()>(t); } // { dg-error "" }
+
+int main()
+{
+ tuple t;
+ get_n<-1>(t);
+}
diff --git a/gcc/testsuite/g++.dg/template/explicit-args7.C b/gcc/testsuite/g++.dg/template/explicit-args7.C
new file mode 100644
index 0000000..fb5e89e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/explicit-args7.C
@@ -0,0 +1,33 @@
+// PR c++/12672
+// Verify we don't substitute explicit template arguments into
+// candidate function templates when the arity of the function
+// template disagrees with the arity of the call.
+
+template<class T>
+struct A { typedef typename T::type type; };
+
+template<class T> void f(T); // arity 1
+template<class T> void f(T, T, T); // arity 3
+
+template<class T> typename A<T>::type f(T, T); // arity 2
+template<class T, class U> typename A<T>::type f(U, U); // arity 2
+
+struct B {
+ template<class T> void f(T); // arity 1
+ template<class T> void f(T, T, T); // arity 3
+
+ template<class T> typename A<T>::type f(T, T); // arity 2
+ template<class T, class U> typename A<T>::type f(U, U); // arity 2
+};
+
+int main() {
+ // If overload resolution attempts deduction for any of the arity-2 function
+ // templates, the substitution of explicit arguments into the template would
+ // cause a hard error.
+ f<int>(1);
+ f<int>(1, 1, 1);
+
+ B b;
+ b.f<int>(1);
+ b.f<int>(1, 1, 1);
+}
diff --git a/gcc/testsuite/g++.dg/template/friend70.C b/gcc/testsuite/g++.dg/template/friend70.C
new file mode 100644
index 0000000..5496548
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend70.C
@@ -0,0 +1,9 @@
+// PR c++/52625
+
+template<class>
+class base {};
+
+class derived : public base<derived>
+{
+ template<class> friend class base;
+};
diff --git a/gcc/testsuite/g++.dg/template/friend71.C b/gcc/testsuite/g++.dg/template/friend71.C
new file mode 100644
index 0000000..939ea6b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend71.C
@@ -0,0 +1,8 @@
+// PR c++/41723
+
+template<class T>
+class C {
+ template <class U> class D {};
+
+ friend class C::D<int>;
+};
diff --git a/gcc/testsuite/g++.dg/template/koenig12.C b/gcc/testsuite/g++.dg/template/koenig12.C
new file mode 100644
index 0000000..fd05ef5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/koenig12.C
@@ -0,0 +1,15 @@
+// PR c++/68942
+// { dg-do compile { target c++11 } }
+
+void foo(...) = delete;
+
+template <class T> void lookup(T t) { foo(t); }
+
+namespace N {
+ struct A { };
+ int foo(A);
+}
+
+int main() {
+ lookup(N::A{});
+}
diff --git a/gcc/testsuite/g++.dg/template/koenig12a.C b/gcc/testsuite/g++.dg/template/koenig12a.C
new file mode 100644
index 0000000..96b98b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/koenig12a.C
@@ -0,0 +1,16 @@
+// PR c++/68942
+// { dg-do compile { target c++11 } }
+// A template-id analogue of koenig12.C.
+
+template <int> void foo(...) = delete;
+
+template <class T> void lookup(T t) { foo<0>(t); }
+
+namespace N {
+ struct A { };
+ template <int> int foo(A);
+}
+
+int main() {
+ lookup(N::A{});
+}
diff --git a/gcc/testsuite/g++.dg/template/lookup17.C b/gcc/testsuite/g++.dg/template/lookup17.C
new file mode 100644
index 0000000..b8571b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/lookup17.C
@@ -0,0 +1,18 @@
+// PR c++/91706
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -g }
+
+template <bool> struct A;
+
+struct B { static constexpr bool g = false; };
+
+struct C {
+ template <typename> static B c ();
+};
+
+template <class T> struct D : C {
+ using c = decltype (c<T>());
+ using E = A<c::g>;
+};
+
+D<int> g;
diff --git a/gcc/testsuite/g++.dg/template/mem-spec2.C b/gcc/testsuite/g++.dg/template/mem-spec2.C
new file mode 100644
index 0000000..bc96159
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/mem-spec2.C
@@ -0,0 +1,11 @@
+// PR c++/94529
+
+template <class T>
+struct foo {
+ // the issue is const here
+ void bar(T& foobar) const { foobar = 0; } // { dg-message "candidate" }
+};
+
+template <> void
+foo<int>::bar(int& foobar) { foobar = 9; } // { dg-error "does not match" }
+// { dg-bogus "member function template" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/template/nontype29.C b/gcc/testsuite/g++.dg/template/nontype29.C
index 18a3058..dd4e20f 100644
--- a/gcc/testsuite/g++.dg/template/nontype29.C
+++ b/gcc/testsuite/g++.dg/template/nontype29.C
@@ -3,7 +3,7 @@
// { dg-do compile }
// { dg-options "-Wall" }
-#if __cpluspls >= 201103L
+#if __cplusplus >= 201103L
// C++ 11 test case from comment #0.
namespace comment_0 {
@@ -60,7 +60,7 @@ void h ()
} // comment_2
-#if __cpluspls >= 201103L
+#if __cplusplus >= 201103L
// C++ 11 test case from comment #5.
namespace comment_5 {
diff --git a/gcc/testsuite/g++.dg/template/param4.C b/gcc/testsuite/g++.dg/template/param4.C
new file mode 100644
index 0000000..8061ff7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/param4.C
@@ -0,0 +1,10 @@
+// PR c++/100893
+
+template<class T, typename T::type F> void g() { }
+
+struct A { typedef void (*const type)(); };
+void f();
+template void g<A, &f>();
+
+struct B { typedef void (B::*const type)(); void f(); };
+template void g<B, &B::f>();
diff --git a/gcc/testsuite/g++.dg/template/param5.C b/gcc/testsuite/g++.dg/template/param5.C
new file mode 100644
index 0000000..89a5c04
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/param5.C
@@ -0,0 +1,7 @@
+// Verify top-level cv-qualifiers are dropped when determining the substituted
+// type of a non-type template parameter, as per [temp.param]/6.
+// { dg-do compile { target c++11 } }
+
+template<class T, T V> decltype(V)& f();
+using type = decltype(f<const volatile int, 0>());
+using type = int&;
diff --git a/gcc/testsuite/g++.dg/template/partial-specialization9.C b/gcc/testsuite/g++.dg/template/partial-specialization9.C
new file mode 100644
index 0000000..49f3500
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial-specialization9.C
@@ -0,0 +1,7 @@
+// PR c++/77435
+
+template<int, class T, T> struct S;
+template<class T, T A> struct S<0, T, A> {};
+int i;
+S<0, int*, &i> r; // OK
+S<0, int&, i> s; // error: aggregate 'S<0, int&, i> s' has incomplete type
diff --git a/gcc/testsuite/g++.dg/template/partial16.C b/gcc/testsuite/g++.dg/template/partial16.C
new file mode 100644
index 0000000..30c34c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial16.C
@@ -0,0 +1,8 @@
+// [temp.spec.partial.general]/9
+
+template <class T, T t> struct C {};
+template <class T> struct C<T, 1>; // { dg-error "depends on a template parameter" }
+
+template< int X, int (*array_ptr)[X] > class A {};
+int array[5];
+template< int X > class A<X,&array> { }; // { dg-error "depends on a template parameter" }
diff --git a/gcc/testsuite/g++.dg/template/partial17.C b/gcc/testsuite/g++.dg/template/partial17.C
new file mode 100644
index 0000000..d5c82d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial17.C
@@ -0,0 +1,14 @@
+// [temp.spec.partial.match]/3
+
+template <int I, int J> struct A;
+template <int I> struct A<I+5, I*2> {}; // { dg-error "not deducible" }
+
+template <int I> struct A<I, I> {}; // OK
+
+template <int I, int J, int K> struct B;
+template <int I> struct B<I, I*2, I> {}; // OK
+template <int I> struct B<I, I*2, 2> { typedef int type; }; // OK
+
+B<1, 2, 1> b1;
+B<1, 2, 2>::type b2;
+B<1, 2, 3> b3; // { dg-error "incomplete" }
diff --git a/gcc/testsuite/g++.dg/template/partial18.C b/gcc/testsuite/g++.dg/template/partial18.C
new file mode 100644
index 0000000..7b7614e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial18.C
@@ -0,0 +1,19 @@
+// PR c++/96555
+
+template<class T, int i>
+struct X;
+
+template<class T>
+struct X<T, sizeof(T)> {};
+
+X<int, sizeof(int)> x1;
+X<int, sizeof(int)+1> x2; // { dg-error "incomplete" }
+
+
+struct A { int x; } a;
+template<int, int> struct B;
+template<int y>
+struct B<y, sizeof(a.x)> { };
+
+B<0, sizeof(int)> b1;
+B<0, sizeof(int)+1> b2; // { dg-error "incomplete" }
diff --git a/gcc/testsuite/g++.dg/template/partial19.C b/gcc/testsuite/g++.dg/template/partial19.C
new file mode 100644
index 0000000..39149d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial19.C
@@ -0,0 +1,11 @@
+// PR c++/67593
+// { dg-do compile { target c++11 } }
+
+template<class T>
+struct outer {
+ template<T...> struct inner;
+ template<T... Vs> struct inner<T{}, Vs...> {};
+};
+
+outer<int>::inner<0, 0> x1;
+outer<int>::inner<1, 0> x2; // { dg-error "incomplete" }
diff --git a/gcc/testsuite/g++.dg/template/partial5.C b/gcc/testsuite/g++.dg/template/partial5.C
index 40d8c45..037f684 100644
--- a/gcc/testsuite/g++.dg/template/partial5.C
+++ b/gcc/testsuite/g++.dg/template/partial5.C
@@ -21,4 +21,4 @@ template<typename T, T V>
struct Z { };
template<typename T>
-struct Z<T, (T)0> { }; // { dg-error "13:template argument" }
+struct Z<T, (T)0> { }; // { dg-error "depends on a template parameter" }
diff --git a/gcc/testsuite/g++.dg/template/pr99425.C b/gcc/testsuite/g++.dg/template/pr99425.C
new file mode 100644
index 0000000..fd49c86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/pr99425.C
@@ -0,0 +1,45 @@
+// { dg-do compile { target c++20 } }
+// a potential fix for 99425 generated an ICE here.
+
+template<typename _Tp>
+struct is_nothrow_destructible;
+
+template<typename _Tp>
+struct common_reference;
+
+template<typename _Tp>
+concept same_as
+ = true;
+
+template<typename _Sent, typename _Iter>
+concept sentinel_for
+ = same_as<common_reference<_Sent>>
+ && is_nothrow_destructible<_Iter>::value;
+
+template<typename _Tp>
+concept __member_end
+ = requires (_Tp& __t)
+ {
+ { true }
+ -> sentinel_for<decltype(__t)>;
+ };
+
+template<typename _Tp>
+concept __adl_end
+ = requires (_Tp& __t)
+ {
+ { true }
+ -> sentinel_for<decltype(__t)>;
+ };
+
+template<typename _Tp>
+requires __member_end<_Tp> || __adl_end<_Tp>
+ void
+ Bar (_Tp&& __t)
+{
+}
+
+void test03 ()
+{
+ Bar (1); // { dg-error "no matching function" }
+}
diff --git a/gcc/testsuite/g++.dg/template/ref11.C b/gcc/testsuite/g++.dg/template/ref11.C
new file mode 100644
index 0000000..c43c67e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ref11.C
@@ -0,0 +1,9 @@
+// PR c++/83476
+
+int n;
+template <int& V> struct A {};
+template <int& V> void f(A<V>);
+int main() {
+ A<n> a;
+ f(a);
+}
diff --git a/gcc/testsuite/g++.dg/template/sfinae-dr1227.C b/gcc/testsuite/g++.dg/template/sfinae-dr1227.C
new file mode 100644
index 0000000..821ff03
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/sfinae-dr1227.C
@@ -0,0 +1,23 @@
+// PR c++/96560
+// DR 1227
+// Test that we substitute function parameter types in lexical order.
+
+template <class T>
+struct A { typedef typename T::type type; }; // { dg-error "void" }
+
+template <class T> void f(typename T::type, typename A<T>::type);
+template <class T> long f(...);
+
+long x = f<int>(0, 0); // { dg-bogus "" } OK
+
+
+template <class T> void g(T, typename A<T>::type);
+template <class T> long g(...);
+
+long y = g<void>(0, 0); // { dg-bogus "" } OK
+
+
+template <class T> void h(typename A<T>::type, T);
+template <class T> long h(...);
+
+long z = h<void>(0, 0); // { dg-message "required from here" } hard error
diff --git a/gcc/testsuite/g++.dg/template/sfinae14.C b/gcc/testsuite/g++.dg/template/sfinae14.C
index 93eba43a..0c59dad 100644
--- a/gcc/testsuite/g++.dg/template/sfinae14.C
+++ b/gcc/testsuite/g++.dg/template/sfinae14.C
@@ -76,4 +76,4 @@ STATIC_ASSERT(!(has_new_one_arg<X, int X::*>::value));
STATIC_ASSERT((has_array_new<Y, int, 5>::value));
STATIC_ASSERT(!(has_array_new<X, int Y::*, &Y::foo>::value));
-STATIC_ASSERT((has_array_new<X, int, 5>::value));
+STATIC_ASSERT(!(has_array_new<X, int, 5>::value));
diff --git a/gcc/testsuite/g++.dg/template/spec26.C b/gcc/testsuite/g++.dg/template/spec26.C
index 3d18707..fad8e3e 100644
--- a/gcc/testsuite/g++.dg/template/spec26.C
+++ b/gcc/testsuite/g++.dg/template/spec26.C
@@ -1,4 +1,4 @@
-// dg-do run
+// { dg-do run }
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 16 Sep 2005 <nathan@codesourcery.com>
diff --git a/gcc/testsuite/g++.dg/template/ttp34.C b/gcc/testsuite/g++.dg/template/ttp34.C
new file mode 100644
index 0000000..6709406
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ttp34.C
@@ -0,0 +1,14 @@
+// PR c++/67829
+
+template<class> class Purr;
+
+template<template<class> class, class, class>
+class Meow;
+
+template<template<class> class P>
+class Meow<P, P<int>, int> { }; // 1
+
+template<template<class> class P, class T>
+class Meow<P, P<int>, T>; // 2
+
+Meow<Purr, Purr<int>, int> kitty;
diff --git a/gcc/testsuite/g++.dg/template/ttp34a.C b/gcc/testsuite/g++.dg/template/ttp34a.C
new file mode 100644
index 0000000..e3303dc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ttp34a.C
@@ -0,0 +1,14 @@
+// PR c++/67829
+
+template<class> class Purr;
+
+template<template<class> class, class>
+class Meow;
+
+template<template<class> class P>
+class Meow<P, P<int> > { }; // 1
+
+template<template<class> class P, class T>
+class Meow<P, P<T> >; // 2
+
+Meow<Purr, Purr<int> > kitty;
diff --git a/gcc/testsuite/g++.dg/template/ttp34b.C b/gcc/testsuite/g++.dg/template/ttp34b.C
new file mode 100644
index 0000000..ed3b3e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ttp34b.C
@@ -0,0 +1,14 @@
+// PR c++/67829
+
+template<class> class Purr;
+
+template<class, template<class> class>
+class Meow;
+
+template<template<class> class P>
+class Meow<P<int>, P> { }; // 1
+
+template<template<class> class P, class T>
+class Meow<P<T>, P>; // 2
+
+Meow<Purr<int>, Purr> kitty;
diff --git a/gcc/testsuite/g++.dg/tm/inherit2.C b/gcc/testsuite/g++.dg/tm/inherit2.C
index 3b696a9..366f9b3 100644
--- a/gcc/testsuite/g++.dg/tm/inherit2.C
+++ b/gcc/testsuite/g++.dg/tm/inherit2.C
@@ -26,8 +26,8 @@ int main()
B b; // ok
D1 d1; // ok
B& b1 = d1;
- D2 x; // { dg-error "" "destructor of D2 is not transaction-safe" }
+ D2 x;
b1.f(); // ok, calls D1::f()
delete b2; // undefined behavior: calls unsafe destructor of D2
- }
+ } // { dg-error "" "destructor of D2 is not transaction-safe" }
}
diff --git a/gcc/testsuite/g++.dg/tm/unsafe1.C b/gcc/testsuite/g++.dg/tm/unsafe1.C
index 49dd564..710fb1a 100644
--- a/gcc/testsuite/g++.dg/tm/unsafe1.C
+++ b/gcc/testsuite/g++.dg/tm/unsafe1.C
@@ -5,8 +5,8 @@ struct S {
virtual ~S();
};
void f() transaction_safe {
- S s; // { dg-error "unsafe" "invocation of unsafe destructor" }
-}
+ S s;
+} // { dg-error "unsafe" "invocation of unsafe destructor" }
int g(int x) { // is transaction-safe
if (x <= 0)
diff --git a/gcc/testsuite/g++.dg/torture/builtin-clear-padding-4.C b/gcc/testsuite/g++.dg/torture/builtin-clear-padding-4.C
new file mode 100644
index 0000000..5936cdf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/builtin-clear-padding-4.C
@@ -0,0 +1,44 @@
+// PR middle-end/101586
+
+struct A { char a; };
+struct B : virtual A {};
+struct C : B {};
+struct D : virtual A, C {};
+
+__attribute__((noipa)) A *
+baz (C *p, D *q)
+{
+ if (p)
+ return dynamic_cast <A *> (p);
+ else
+ return dynamic_cast <A *> (q);
+}
+
+void
+foo ()
+{
+ C c;
+ c.a = 42;
+ __builtin_clear_padding (&c);
+ A *p = baz (&c, 0);
+ if (c.a != 42 || p->a != 42)
+ __builtin_abort ();
+}
+
+void
+bar ()
+{
+ D d;
+ d.a = 42;
+ __builtin_clear_padding (&d);
+ A *p = baz (0, &d);
+ if (d.a != 42 || p->a != 42)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ foo ();
+ bar ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr100303.C b/gcc/testsuite/g++.dg/torture/pr100303.C
new file mode 100644
index 0000000..5af9412
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr100303.C
@@ -0,0 +1,112 @@
+/* { dg-additional-options "-w -fcompare-debug -fno-dce -ftracer" } */
+
+template < typename _T1 > struct pair
+{
+ _T1 first;
+ int second;
+};
+struct __aligned_membuf
+{
+ void _M_ptr ();
+};
+struct _Rb_tree_node_base
+{
+ typedef _Rb_tree_node_base *_Base_ptr;
+};
+struct _Rb_tree_node:_Rb_tree_node_base
+{
+ __aligned_membuf _M_storage;
+ void _M_valptr ()
+ {
+ _M_storage._M_ptr ();
+ }
+};
+struct _Rb_tree_iterator
+{
+ typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
+ _Rb_tree_iterator (_Base_ptr __x):_M_node (__x)
+ {
+ }
+ void operator* ()
+ {
+ static_cast < _Rb_tree_node * >(_M_node)->_M_valptr ();
+ }
+ friend bool operator== (_Rb_tree_iterator __x, _Rb_tree_iterator)
+ {
+ return __x._M_node;
+ }
+ _Base_ptr _M_node;
+};
+
+template < typename, typename, typename, typename, typename =
+ int >class _Rb_tree
+{
+ typedef _Rb_tree_node_base *_Base_ptr;
+public:
+ pair < _Base_ptr > _M_get_insert_hint_unique_pos (int);
+ void _M_insert_node (_Base_ptr, int);
+ template < typename ... _Args >
+ _Rb_tree_iterator _M_emplace_hint_unique (_Args && ...);
+ _Rb_tree_iterator lower_bound ()
+ {
+ _Rb_tree_node_base __trans_tmp_2;
+ return &__trans_tmp_2;
+ }
+};
+template < typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare,
+ typename _Alloc > template < typename ... _Args >
+ _Rb_tree_iterator _Rb_tree < _Key, _Val, _KeyOfValue, _Compare,
+ _Alloc >::_M_emplace_hint_unique (_Args && ...)
+{
+ int __z;
+ try
+ {
+ auto __res = _M_get_insert_hint_unique_pos (0);
+ _Rb_tree_node_base *__res_1;
+ if (__res_1)
+ _M_insert_node (__res.first, __z);
+ return __res.first;
+ }
+ catch ( ...)
+ {
+ }
+}
+
+class map
+{
+ _Rb_tree < int, int, int, int >_M_t;
+public:
+ _Rb_tree_iterator end ();
+ void operator[] (int)
+ {
+ _Rb_tree_iterator __i = lower_bound ();
+ if (__i == end ())
+ __i = _M_t._M_emplace_hint_unique (__i);
+ *__i;
+ }
+ _Rb_tree_iterator lower_bound ()
+ {
+ return _M_t.lower_bound ();
+ }
+};
+
+class FlowStat
+{
+public:
+ int FlowStat_flow;
+ FlowStat ()
+ {
+ shares[FlowStat_flow];
+ }
+ map shares;
+};
+
+class LinkGraphJob
+{
+ ~LinkGraphJob ();
+};
+LinkGraphJob::~LinkGraphJob ()
+{
+ FlowStat ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr100382.C b/gcc/testsuite/g++.dg/torture/pr100382.C
new file mode 100644
index 0000000..eac5743
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr100382.C
@@ -0,0 +1,25 @@
+// { dg-do run }
+// { dg-additional-options -fno-delete-dead-exceptions }
+
+int x, y;
+int __attribute__((pure,noinline)) foo () { if (x) throw 1; return y; }
+
+int __attribute__((noinline)) bar()
+{
+ int a[2];
+ x = 1;
+ try {
+ int res = foo ();
+ a[0] = res;
+ } catch (...) {
+ return 0;
+ }
+ return 1;
+}
+
+int main()
+{
+ if (bar ())
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr100925.C b/gcc/testsuite/g++.dg/torture/pr100925.C
new file mode 100644
index 0000000..de13950
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr100925.C
@@ -0,0 +1,24 @@
+// { dg-do compile }
+
+struct QScopedPointerDeleter {
+ static void cleanup(int *);
+};
+class QScopedPointer {
+ typedef int *QScopedPointer::*RestrictedBool;
+
+public:
+ operator RestrictedBool() { return d ? nullptr : &QScopedPointer::d; }
+ void reset() {
+ if (d)
+ QScopedPointerDeleter::cleanup(d);
+ }
+ int *d;
+};
+class DOpenGLPaintDevicePrivate {
+public:
+ QScopedPointer fbo;
+} DOpenGLPaintDeviceresize_d;
+void DOpenGLPaintDeviceresize() {
+ if (DOpenGLPaintDeviceresize_d.fbo)
+ DOpenGLPaintDeviceresize_d.fbo.reset();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr101256.C b/gcc/testsuite/g++.dg/torture/pr101256.C
new file mode 100644
index 0000000..973a8b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr101256.C
@@ -0,0 +1,28 @@
+// { dg-do run }
+
+template<class T>
+const T& max(const T& a, const T& b)
+{
+ return (a < b) ? b : a;
+}
+
+signed char var_5 = -128;
+unsigned int var_11 = 2144479212U;
+unsigned long long int arr [22];
+
+void
+__attribute__((noipa))
+test(signed char var_5, unsigned var_11) {
+ for (short i_61 = 0; i_61 < var_5 + 149; i_61 += 10000)
+ arr[i_61] = max((signed char)0, var_5) ? max((signed char)1, var_5) : var_11;
+}
+
+int main() {
+ for (int i_0 = 0; i_0 < 22; ++i_0)
+ arr [i_0] = 11834725929543695741ULL;
+
+ test(var_5, var_11);
+ if (arr [0] != 2144479212ULL && arr [0] != 11834725929543695741ULL)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr101373.C b/gcc/testsuite/g++.dg/torture/pr101373.C
new file mode 100644
index 0000000..f8c8097
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr101373.C
@@ -0,0 +1,33 @@
+// { dg-do run }
+// { dg-xfail-run-if "PR100409" { *-*-* } }
+
+int __attribute__((const,noipa)) foo (int j)
+{
+ if (j != 0)
+ throw 1;
+ return 0;
+}
+
+int __attribute__((noipa)) bar (int *p, int n)
+{
+ int ret = 0;
+ if (n)
+ {
+ foo (n);
+ ret = *p;
+ }
+ ret += *p;
+ return ret;
+}
+
+int main()
+{
+ try
+ {
+ return bar (nullptr, 1);
+ }
+ catch (...)
+ {
+ return 0;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr102142.C b/gcc/testsuite/g++.dg/torture/pr102142.C
new file mode 100644
index 0000000..8e3ea5d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr102142.C
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+extern short arr_597[];
+extern bool arr_601[];
+int test_var_13;
+void test(short arr_391[][9][2][2]) {
+ for (int i_60 = 0; i_60 < 11; i_60 += test_var_13)
+ arr_597[22] = arr_601[i_60] = arr_391[0][0][1][4];
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr99777.C b/gcc/testsuite/g++.dg/torture/pr99777.C
new file mode 100644
index 0000000..3cddde5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr99777.C
@@ -0,0 +1,44 @@
+// PR tree-optimization/99777
+
+template <typename T>
+inline const T &
+min (const T &a, const T &b)
+{
+ if (b < a)
+ return b;
+ return a;
+}
+
+template <typename T>
+inline const T &
+max (const T &a, const T &b)
+{
+ if (a < b)
+ return b;
+ return a;
+}
+
+extern int o, a, c;
+long h;
+unsigned long long e;
+signed char d;
+extern short p[][7][5][30];
+
+void
+test (long long b, short f[][17][25][22][20])
+{
+ for (char i = 0; i < 7; i += 3)
+ for (unsigned char l = e; l < 5; l += 2)
+ {
+ if (max (0LL, min (7LL, b)))
+ for (bool j = 0; j < 1; j = b)
+ {
+ for (unsigned k = d; k < 20; k++)
+ h = f[0][i][l][b][k];
+ for (int m = 0; m < 5; m++)
+ p[c][i][l][m] = 0;
+ }
+ for (int n = 0; n < 4; n += a)
+ o = n;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C
index 3374744..b454171 100644
--- a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C
+++ b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */
struct A {
A () {}
@@ -26,7 +26,7 @@ main (void)
int i;
- for (i = 0; i < 1000000; i++)
+ for (i = 0; i < 10000000; i++)
{
p = (A *)wrap ((void *)&a);
p->AA ();
diff --git a/gcc/testsuite/g++.dg/tree-prof/morefunc.C b/gcc/testsuite/g++.dg/tree-prof/morefunc.C
index 621d09a..96e0073 100644
--- a/gcc/testsuite/g++.dg/tree-prof/morefunc.C
+++ b/gcc/testsuite/g++.dg/tree-prof/morefunc.C
@@ -1,4 +1,5 @@
-/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */
+/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */
+
#include "reorder_class1.h"
#include "reorder_class2.h"
@@ -19,7 +20,7 @@ static __attribute__((always_inline))
void test1 (A *tc)
{
int i;
- for (i = 0; i < 1000; i++)
+ for (i = 0; i < 10000000; i++)
g += tc->foo();
if (g<100) g++;
}
@@ -28,7 +29,7 @@ static __attribute__((always_inline))
void test2 (B *tc)
{
int i;
- for (i = 0; i < 1000000; i++)
+ for (i = 0; i < 10000000; i++)
g += tc->foo();
}
diff --git a/gcc/testsuite/g++.dg/tree-prof/reorder.C b/gcc/testsuite/g++.dg/tree-prof/reorder.C
index 000fb65..5049096 100644
--- a/gcc/testsuite/g++.dg/tree-prof/reorder.C
+++ b/gcc/testsuite/g++.dg/tree-prof/reorder.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo -Wno-coverage-mismatch -Wno-attributes" } */
+/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized -Wno-coverage-mismatch -Wno-attributes" } */
#ifdef _PROFILE_USE
#include "reorder_class1.h"
@@ -13,7 +13,7 @@ static __attribute__((always_inline))
void test1 (A *tc)
{
int i;
- for (i = 0; i < 1000000; i++)
+ for (i = 0; i < 10000000; i++)
g += tc->foo();
if (g<100) g++;
}
@@ -22,7 +22,7 @@ static __attribute__((always_inline))
void test2 (B *tc)
{
int i;
- for (i = 0; i < 1000000; i++)
+ for (i = 0; i < 10000000; i++)
g += tc->foo();
}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C b/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C
index 97c2e05..3df7aad 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C
@@ -13,9 +13,3 @@ int f()
using AR = const int[];
return AR{ 1,42,3,4,5,6,7,8,9,0 }[5];
}
-
-int g()
-{
- std::initializer_list<int> a = {1,42,3};
- return a.begin()[0];
-}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/modref-1.C b/gcc/testsuite/g++.dg/tree-ssa/modref-1.C
new file mode 100644
index 0000000..b9b9f6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/modref-1.C
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+struct S { int a; char b[20]; S(); S(S const&); };
+volatile int global;
+
+__attribute__ ((noinline,noclone))
+struct S noescape (int *b)
+{
+ struct S a;
+ a.a = b!=0;
+ global = 1;
+ return a;
+}
+
+void escape (struct S *p);
+
+__attribute__ ((noinline,noclone))
+int
+test(int *b)
+{
+ struct S s = noescape (b);
+ escape (&s);
+ return *b;
+}
+int test2()
+{
+ int b=1234;
+ test (&b);
+ return b;
+}
+// ipa-modref should analyze parameter B of test as noescape.
+// { dg-final { scan-tree-dump "return 1234" "optimized" } }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr101769.C b/gcc/testsuite/g++.dg/tree-ssa/pr101769.C
new file mode 100644
index 0000000..4979c42
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr101769.C
@@ -0,0 +1,56 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-options "-O2 -fdump-tree-optimized" }
+
+struct Node
+{
+ Node* right;
+ Node* down;
+};
+
+inline
+void free_node(Node*)
+{
+}
+
+void free_all(Node* n_)
+{
+ if (n_ == nullptr) {
+ return;
+ }
+ free_all(n_->right);
+ do {
+ Node* t = n_->down;
+ free_node(n_);
+ n_ = t;
+ } while (n_);
+}
+
+void free_all2_r(Node* n_)
+{
+ if (n_->right) {
+ free_all2_r(n_->right);
+ }
+ do {
+ Node* t = n_->down;
+ free_node(n_);
+ n_ = t;
+ } while (n_);
+}
+
+void free_all2(Node* n_)
+{
+ if (n_) {
+ free_all2_r(n_);
+ }
+}
+
+void loop(Node* n_)
+{
+ do {
+ n_ = n_->down;
+ } while (n_);
+}
+
+// All functions should be empty.
+// { dg-final { scan-tree-dump-times "<bb " 4 "optimized" } }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr83518.C b/gcc/testsuite/g++.dg/tree-ssa/pr83518.C
index 3e153c5..b8a2bd1 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr83518.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr83518.C
@@ -24,4 +24,4 @@ unsigned test()
return sum;
}
-/* { dg-final { scan-tree-dump "return 15;" "optimized" } } */
+/* { dg-final { scan-tree-dump "return 15;" "optimized" { xfail vect_variable_length } } } */
diff --git a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
new file mode 100644
index 0000000..82d6a5c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
@@ -0,0 +1,31 @@
+// Test pthread_cond_clockwait not generating false positives with tsan
+// { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && pthread } } }
+// { dg-options "-fsanitize=thread -lpthread" }
+
+#include <pthread.h>
+
+pthread_cond_t cv;
+pthread_mutex_t mtx;
+
+void *fn(void *vp) {
+ pthread_mutex_lock(&mtx);
+ pthread_cond_signal(&cv);
+ pthread_mutex_unlock(&mtx);
+ return NULL;
+}
+
+int main() {
+ pthread_mutex_lock(&mtx);
+
+ pthread_t tid;
+ pthread_create(&tid, NULL, fn, NULL);
+
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ ts.tv_sec += 10;
+ pthread_cond_clockwait(&cv, &mtx, CLOCK_MONOTONIC, &ts);
+ pthread_mutex_unlock(&mtx);
+
+ pthread_join(tid, NULL);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr101210.C b/gcc/testsuite/g++.dg/ubsan/pr101210.C
new file mode 100644
index 0000000..955b820
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr101210.C
@@ -0,0 +1,13 @@
+// PR c++/101210
+// { dg-do run }
+// { dg-options "-fsanitize=null,alignment -fno-sanitize-recover=null,alignment" }
+
+int v[2];
+int
+main ()
+{
+ int x;
+ int &y = x;
+ v[0] = reinterpret_cast<__INTPTR_TYPE__>(&y) == 0;
+ v[1] = reinterpret_cast<__INTPTR_TYPE__>(&y) == 1;
+}
diff --git a/gcc/testsuite/g++.dg/uninit-pr74762.C b/gcc/testsuite/g++.dg/uninit-pr74762.C
new file mode 100644
index 0000000..ce1bc59
--- /dev/null
+++ b/gcc/testsuite/g++.dg/uninit-pr74762.C
@@ -0,0 +1,24 @@
+/* PR c++/74762 - missing uninitialized warning (C++, parenthesized expr)
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+struct tree2;
+struct tree_vector2
+{
+ tree2 *elts[1];
+};
+
+struct tree2
+{
+ struct
+ {
+ tree_vector2 vector;
+ } u;
+};
+
+tree2 *
+const_with_all_bytes_same (tree2 *val)
+{
+ int i;
+ return ((val->u.vector.elts[i])); // { dg-warning "\\\[-Wuninitialized" }
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr102226.cc b/gcc/testsuite/g++.dg/vect/pr102226.cc
new file mode 100644
index 0000000..ddf5e46
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr102226.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve } }
+
+template <typename a> struct b { using c = a; };
+template <typename a, template <typename> class> using f = b<a>;
+template <typename a, template <typename> class g>
+using h = typename f<a, g>::c;
+struct i {
+ template <typename j> using k = typename j::l;
+};
+struct m : i {
+ using l = h<char *, k>;
+};
+class n {
+public:
+ char operator[](long o) {
+ m::l s;
+ return s[o];
+ }
+} p;
+n r;
+int q() {
+ long d;
+ for (long e; e; e++)
+ if (p[e] == r[e])
+ d++;
+ return d;
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr99149.cc b/gcc/testsuite/g++.dg/vect/pr99149.cc
index 00ebe9d..9d58426 100755
--- a/gcc/testsuite/g++.dg/vect/pr99149.cc
+++ b/gcc/testsuite/g++.dg/vect/pr99149.cc
@@ -11,7 +11,7 @@ public:
a operator*(a d) { return a(b * b - c * c, b * c + c * d.b); }
};
int f, g;
-class {
+class mp {
a *h;
a *i;
diff --git a/gcc/testsuite/g++.dg/vect/slp-pr98855.cc b/gcc/testsuite/g++.dg/vect/slp-pr98855.cc
index 0b4e479..b101032 100644
--- a/gcc/testsuite/g++.dg/vect/slp-pr98855.cc
+++ b/gcc/testsuite/g++.dg/vect/slp-pr98855.cc
@@ -81,4 +81,6 @@ void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks, uint32_t *EK)
}
}
-// { dg-final { scan-tree-dump-times "not vectorized: vectorization is not profitable" 2 "slp1" { target x86_64-*-* i?86-*-* } } }
+// This used to work on { target x86_64-*-* i?86-*-* } but a fix in SLP
+// discovery makes us trip over the threshold again.
+// { dg-final { scan-tree-dump-times "not vectorized: vectorization is not profitable" 2 "slp1" { xfail *-*-* } } }
diff --git a/gcc/testsuite/g++.dg/vect/slp-pr99971.cc b/gcc/testsuite/g++.dg/vect/slp-pr99971.cc
new file mode 100644
index 0000000..cf22b33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/slp-pr99971.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// { dg-require-effective-target vect_int }
+
+struct A
+{
+ unsigned int a, b, c, d;
+
+ A& operator+= (A const& that)
+ {
+ a += that.a;
+ b += that.b;
+ c += that.c;
+ d += that.d;
+ return *this;
+ }
+
+ A& operator-= (A const& that)
+ {
+ a -= that.a;
+ b -= that.b;
+ c -= that.c;
+ d -= that.d;
+ return *this;
+ }
+} __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
+
+void test(A& x, A const& y1, A const& y2)
+{
+ x += y1;
+ x -= y2;
+}
+
+// We want to SLP vectorize a single connected SLP subgraph with two instances
+// { dg-final { scan-tree-dump-not "removing SLP instance" "slp2" } }
+// { dg-final { scan-tree-dump-times "SLPing BB part" 1 "slp2" } }
+// { dg-final { scan-tree-dump-times "Vectorizing SLP" 2 "slp2" } }
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-10.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-10.C
index 4deea31..4b758aa 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-10.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-10.C
@@ -18,7 +18,7 @@ void sink (void*);
void warn_op_new ()
{
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
@@ -44,7 +44,7 @@ void warn_op_array_new ()
#define OP_NEW(n) operator new[] (n)
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
index 45d2719..9670898 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
@@ -4,7 +4,24 @@
{ dg-do compile }
{ dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
-#include <new>
+#if 0
+// Avoid including <new> to make cross-compiler testing easy.
+// #include <new>
+#else
+namespace std {
+
+typedef __SIZE_TYPE__ size_t;
+struct nothrow_t { };
+extern const nothrow_t nothrow;
+
+}
+
+void* operator new (std::size_t, const std::nothrow_t &) throw ()
+ __attribute__ ((__alloc_size__ (1), __malloc__));
+void* operator new[] (std::size_t, const std::nothrow_t &) throw ()
+ __attribute__ ((__alloc_size__ (1), __malloc__));
+
+#endif
typedef __INT32_TYPE__ int32_t;
@@ -20,7 +37,7 @@ void sink (void*);
void warn_op_new ()
{
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(std::size_t, const std::nothrow_t.\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
@@ -46,7 +63,7 @@ void warn_op_array_new ()
#define OP_NEW(n) operator new[] (n, std::nothrow)
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(std::size_t, const std::nothrow_t&\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-12.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-12.C
index 3f1555b..07fa351 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-12.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-12.C
@@ -20,7 +20,7 @@ void sink (void*);
void warn_new ()
{
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
@@ -46,7 +46,7 @@ void warn_array_new ()
#define NEW(n) new char [n]
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
index 890620d..449324a 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
@@ -4,7 +4,24 @@
{ dg-do compile }
{ dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
-#include <new>
+#if 0
+// Avoid including <new> to make cross-compiler testing easy.
+// #include <new>
+#else
+namespace std {
+
+typedef __SIZE_TYPE__ size_t;
+struct nothrow_t { };
+extern const nothrow_t nothrow;
+
+}
+
+void* operator new (std::size_t, const std::nothrow_t &) throw ()
+ __attribute__ ((__alloc_size__ (1), __malloc__));
+void* operator new[] (std::size_t, const std::nothrow_t &) throw ()
+ __attribute__ ((__alloc_size__ (1), __malloc__));
+
+#endif
typedef __INT32_TYPE__ int32_t;
@@ -24,7 +41,7 @@ void sink (void*);
void warn_nothrow_new ()
{
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(std::size_t, const std::nothrow_t.\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
@@ -50,7 +67,7 @@ void warn_nothrow_array_new ()
#define NEW(n) new (std::nothrow) char [n]
T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
- // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(std::size_t, const std::nothrow_t&\\\)'" "note" { target *-*-* } .-1 }
+ // { dg-message "object of size \\d allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" { target *-*-* } .-1 }
T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka (long )?int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-17.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-17.C
index 64fbd08..518f9bb 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-17.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-17.C
@@ -8,7 +8,7 @@ void foo (int *);
void
bar (void)
{
- A b; // { dg-message "while referencing" }
+ A b; // { dg-message "at offset -\\d into object 'b' of size 4" "note" }
int *p = &b;
int *x = (p - 1); // { dg-warning "outside array bounds" }
foo (x);
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-20.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-20.C
index e142ea1..f4876d8 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-20.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-20.C
@@ -27,7 +27,7 @@ struct D1: virtual B, virtual C
to the opening brace. */
D1 ()
{ // { dg-warning "\\\[-Warray-bounds" "brace" }
- ci = 0; // { dg-warning "\\\[-Warray-bounds" "assign" { xfail *-*-* } }
+ ci = 0; // { dg-warning "\\\[-Warray-bounds" "assign" { xfail lp64 } }
}
};
@@ -35,7 +35,8 @@ void sink (void*);
void warn_derived_ctor_access_new_decl ()
{
- char a[sizeof (D1)]; // { dg-message "referencing 'a'" "note" }
+ char a[sizeof (D1)]; // { dg-message "at offset 1 into object 'a' of size 40" "LP64 note" { target lp64} }
+ // { dg-message "at offset 1 into object 'a' of size 20" "LP64 note" { target ilp32} .-1 }
char *p = a;
++p;
D1 *q = new (p) D1;
@@ -44,7 +45,7 @@ void warn_derived_ctor_access_new_decl ()
void warn_derived_ctor_access_new_alloc ()
{
- char *p = (char*)operator new (sizeof (D1)); // { dg-message "referencing an object of size \\d+ allocated by 'void\\\* operator new\\\(" "note" }
+ char *p = (char*)operator new (sizeof (D1)); // { dg-message "at offset 1 into object of size \\d+ allocated by '\[^\n\r]*operator new\[^\n\r]*'" "note" }
++p;
D1 *q = new (p) D1;
sink (q);
@@ -52,7 +53,8 @@ void warn_derived_ctor_access_new_alloc ()
void warn_derived_ctor_access_new_array_decl ()
{
- char b[sizeof (D1) * 2]; // { dg-message "referencing 'b'" "note" }
+ char b[sizeof (D1) * 2]; // { dg-message "at offset \\d+ into object 'b' of size 80" "LP64 note" { target lp64 } }
+ // { dg-message "at offset \\d+ into object 'b' of size 40" "LP64 note" { target ilp32 } .-1 }
char *p = b;
++p;
D1 *q = new (p) D1[2];
@@ -61,7 +63,7 @@ void warn_derived_ctor_access_new_array_decl ()
void warn_derived_ctor_access_new_array_alloc ()
{
- char *p = new char[sizeof (D1) * 2]; // { dg-message "referencing an object of size \\d+ allocated by 'void\\\* operator new \\\[]\\\(" "note" }
+ char *p = new char[sizeof (D1) * 2]; // { dg-message "at offset \\d+ into object of size \\d+ allocated by '\[^\n\r]*operator new\[^\n\r]*" "note" }
++p;
D1 *q = new (p) D1[2];
sink (q);
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-22.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-22.C
new file mode 100644
index 0000000..77cdb5e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-22.C
@@ -0,0 +1,105 @@
+/* PR middle-end/99502 - missing -Warray-bounds on partial out of bounds
+ access in C++
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef __INT8_TYPE__ int8_t;
+typedef __INT16_TYPE__ int16_t;
+typedef __INT32_TYPE__ int32_t;
+
+struct POD32
+{
+ int32_t i32;
+};
+
+int8_t a16[2];
+int8_t apod32[sizeof (POD32)];
+
+void nowarn_pod32_assign ()
+{
+ POD32 *p = (POD32*)apod32;
+ *p = POD32 ();
+}
+
+void nowarn_pod32_assign_member ()
+{
+ POD32 *p = (POD32*)apod32;
+ p->i32 = __LINE__;
+}
+
+
+void warn_pod32_assign ()
+{
+ POD32 *p = (POD32*)a16;
+ *p = POD32 (); // { dg-warning "-Warray-bounds" }
+}
+
+void warn_pod32_assign_member ()
+{
+ POD32 *p = (POD32*)a16;
+ p->i32 = __LINE__; // { dg-warning "-Warray-bounds" }
+}
+
+
+struct BV32 // { dg-warning "-Warray-bounds" "due to pr99525" }
+{
+ int32_t i32;
+
+ virtual ~BV32 ();
+};
+
+int8_t abv32[sizeof (BV32)];
+
+void nowarn_bv32_assign ()
+{
+ BV32 *p = (BV32*)abv32;
+ *p = BV32 ();
+}
+
+void nowarn_bv32_assign_member ()
+{
+ BV32 *p = (BV32*)abv32;
+ p->i32 = __LINE__;
+}
+
+void warn_bv32_assign ()
+{
+ BV32 *p = (BV32*)a16;
+ *p = BV32 (); // { dg-warning "-Warray-bounds" "pr99525" { xfail *-*-* } }
+}
+
+void warn_bv32_assign_member ()
+{
+ BV32 *p = (BV32*)a16;
+ p->i32 = __LINE__; // { dg-warning "-Warray-bounds" }
+}
+
+
+struct DV32: virtual BV32 { };
+
+int8_t adv32[sizeof (DV32)];
+int8_t adv32_m1[sizeof adv32 - 1];
+
+void nowarn_dv32_assign ()
+{
+ DV32 *p = (DV32*)adv32;
+ *p = DV32 ();
+}
+
+void nowarn_dv32_assign_member ()
+{
+ DV32 *p = (DV32*)adv32;
+ p->i32 = __LINE__;
+}
+
+void warn_dv32_assign ()
+{
+ DV32 *p = (DV32*)adv32_m1;
+ *p = DV32 (); // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+void warn_dv32_assign_member ()
+{
+ DV32 *p = (DV32*)adv32_m1;
+ p->i32 = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-23.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-23.C
new file mode 100644
index 0000000..c43a7de
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-23.C
@@ -0,0 +1,345 @@
+/* PR middle-end/99502 - missing -Warray-bounds on partial out of bounds
+ access in C++
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+inline void* operator new (__SIZE_TYPE__, void *p) { return p; }
+
+struct B0 { int b0i; };
+struct B1: virtual B0 { int b1i; };
+struct B2: virtual B0 { int b2i; };
+struct D1: B1, B2 { int d1i; };
+struct D2: D1 { int d2i; };
+struct D3: D2 { long d3i, d3ax[]; };
+
+void sink (void*);
+
+
+void test_D1 ()
+{
+ {
+ char *p = new char[sizeof (D1)];
+ new (p) D1 ();
+ sink (p);
+ }
+
+ {
+ char *p = new char[sizeof (D1) - 1];
+ new (p) D1 (); // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_b0i ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ p->b0i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ p->b0i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_b1i ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ p->b1i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ p->b1i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_b2i ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ p->b2i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ p->b2i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_d1i ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ p->d1i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ p->d1i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+
+void test_D2 ()
+{
+ {
+ char *p = new char[sizeof (D2)];
+ new (p) D2 ();
+ sink (p);
+ }
+
+ {
+ char *p = new char[sizeof (D2) - 1];
+ new (p) D2 (); // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_b0i ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ p->b0i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ p->b0i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_b1i ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ p->b1i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ p->b1i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_b2i ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ p->b2i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ p->b2i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_d1i ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ p->d1i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ p->d1i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_d2i ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ p->d2i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ p->d2i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+
+void test_D3 ()
+{
+ {
+ char *p = new char[sizeof (D3)];
+ new (p) D3 ();
+ sink (p);
+ }
+
+ {
+ char *p = new char[sizeof (D3) - 1];
+ new (p) D3 (); // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_b0i ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ p->b0i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ p->b0i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_b1i ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ p->b1i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ p->b1i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_b2i ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ p->b2i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ p->b2i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_d1i ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ p->d1i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ p->d1i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_d2i ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ p->d2i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ p->d2i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_d3i ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ p->d3i = __LINE__;
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ p->d3i = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_d3ax ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ *p->d3ax = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } }
+ p->d3ax[9] = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[sizeof (D3) + sizeof (D3::d3ax[0])];
+ p->d3ax[0] = __LINE__;
+ p->d3ax[1] = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ *p->d3ax = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+struct D4: D2
+{
+ // D4:d4a0 overlaps with B0:b0i!
+ long d4i, d4a0[0];
+};
+
+void test_D4_d3a0 ()
+{
+ {
+ D4 *p = (D4*)new char[sizeof (D4)];
+ *p->d4a0 = __LINE__; // { dg-warning "-Warray-bounds" }
+ p->d4a0[1] = __LINE__; // { dg-warning "-Warray-bounds" }
+ p->d4a0[9] = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D4 *p = (D4*)new char[sizeof (D4) + sizeof (D4::d4a0[0])];
+ /* The access to d4a0[0] should get a -Wzero-length-bounds because
+ it's in bounds but overlaps p->b0i. */
+ p->d4a0[0] = __LINE__; // { dg-warning "-Wzero-length-bounds" "pr99635" { xfail *-*-* } }
+ // { dg-warning "-Warray-bounds" "actual" { target *-*-* } .-1 }
+ p->d4a0[1] = __LINE__; // { dg-warning "-Warray-bounds" }
+ p->d4a0[9] = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D4 *p = (D4*)new char[3];
+ *p->d4a0 = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-24.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-24.C
new file mode 100644
index 0000000..071453a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-24.C
@@ -0,0 +1,289 @@
+/* PR middle-end/99502 - missing -Warray-bounds on partial out of bounds
+ access in C++
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+inline void* operator new (__SIZE_TYPE__, void *p) { return p; }
+
+struct B0 { int b0i, b0a[0]; };
+struct B1: virtual B0 { int b1i, b1a[0]; };
+struct B2: virtual B0 { int b2i, b2a[0]; };
+struct D1: B1, B2 { int d1i, d1a[0]; };
+struct D2: D1 { int d2i, d2a[0]; };
+struct D3: D2 { int d3i, d3a[0]; };
+
+void sink (void*);
+
+
+void test_D1 ()
+{
+ {
+ char *p = new char[sizeof (D1)];
+ new (p) D1 ();
+ sink (p);
+ }
+
+ {
+ char *p = new char[sizeof (D1) - 1];
+ new (p) D1 (); // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_b0a ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" "pr99630" { xfail *-*-* } }
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_b1a ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_b2a ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D1_d1a ()
+{
+ {
+ D1 *p = (D1*)new char[sizeof (D1)];
+ *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D1 *p = (D1*)new char[3];
+ *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+
+void test_D2 ()
+{
+ {
+ char *p = new char[sizeof (D2)];
+ new (p) D2 ();
+ sink (p);
+ }
+
+ {
+ char *p = new char[sizeof (D2) - 1];
+ new (p) D2 (); // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_b0a ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" "pr99630" { xfail *-*-* } }
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_b1a ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_b2a ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_d1a ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D2_d2a ()
+{
+ {
+ D2 *p = (D2*)new char[sizeof (D2)];
+ *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D2 *p = (D2*)new char[3];
+ *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+
+void test_D3 ()
+{
+ {
+ char *p = new char[sizeof (D3)];
+ new (p) D3 ();
+ sink (p);
+ }
+
+ {
+ char *p = new char[sizeof (D3) - 1];
+ new (p) D3 (); // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_b0a ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" "pr99630" { xfail *-*-* } }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_b1a ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_b2a ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_d1a ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_d2a ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
+void test_D3_d3a ()
+{
+ {
+ D3 *p = (D3*)new char[sizeof (D3)];
+ *p->d3a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+
+ {
+ D3 *p = (D3*)new char[3];
+ *p->d3a = __LINE__; // { dg-warning "-Warray-bounds" }
+ sink (p);
+ }
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-25.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-25.C
new file mode 100644
index 0000000..a93da03
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-25.C
@@ -0,0 +1,59 @@
+/* PR middle-end/101601 - [12 Regression] -Warray-bounds triggers error:
+ arrays of functions are not meaningful
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef void Fvv (void);
+
+extern Fvv* pf; // { dg-message "'pf'" }
+
+void f (...);
+
+void test_funptr (void)
+{
+ f (&pf);
+ f (&pf + 1);
+ f (&pf + 2); // { dg-warning "subscript 2 is outside array bounds of 'void \\\(\\\* ?\\\[1]\\\)\\\(\\\)'" }
+}
+
+typedef int Fii_ (int, ...);
+
+extern Fii_* pfa[3]; // { dg-message "'pfa'" }
+
+void test_funptr_array (void)
+{
+ f (pfa);
+ f (pfa + 1);
+ f (pfa + 2);
+ f (pfa + 3);
+ f (pfa + 4); // { dg-warning "subscript 4 is outside array bounds of 'int \\\(\\\* ?\\\[3]\\\)\\\(int, ...\\\)'" }
+}
+
+
+struct A;
+typedef void (A::*MFvv)(void);
+
+MFvv pmf;
+
+void test_memfunptr (void)
+{
+ f (&pmf);
+ f (&pmf + 1);
+ f (&pmf + 2); // { dg-warning "subscript 2 is outside array bounds of 'void \\\(A::\\\* ?\\\[1]\\\)\\\(\\\)'" }
+}
+
+
+typedef int (A::*MFii)(int);
+
+MFii pmfa[4];
+
+void test_memfunptr_array (void)
+{
+ f (pmfa);
+ f (pmfa + 1);
+ f (pmfa + 2);
+ f (pmfa + 3);
+ f (pmfa + 4);
+ f (pmfa + 5); // { dg-warning "subscript 5 is outside array bounds of 'int \\\(A::\\\* ?\\\[4]\\\)\\\(int\\\)'" }
+
+}
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-26.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-26.C
new file mode 100644
index 0000000..f72ac9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-26.C
@@ -0,0 +1,27 @@
+/* PR middle-end/101600 - Spurious -Warray-bounds downcasting a polymorphic
+ pointer
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct S1 { virtual ~S1(); };
+struct S2 { int m; };
+struct S3 { virtual ~S3(); };
+struct S4: S1, S2, S3 {};
+
+int f1 ();
+
+void f2 (S3 *);
+
+void f3 (S2 *p)
+{
+ for (int i = f1 (); f1 (); )
+ {
+ if (i == 0)
+ {
+ p = 0;
+ break;
+ }
+ }
+
+ f2 (static_cast<S4 *>(p)); // { dg-bogus "-Warray-bounds" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion5.C b/gcc/testsuite/g++.dg/warn/Wconversion5.C
new file mode 100644
index 0000000..f5ae631
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wconversion5.C
@@ -0,0 +1,19 @@
+// PR c++/99331
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wconversion" }
+// Don't issue -Wconversion warnings for value-dependent expressions.
+
+template <int> struct X {};
+template <signed char> struct Y {};
+template <typename T> X<sizeof(T)> foo();
+template <typename T> X<alignof(T)> foo2();
+template<int I> Y<I> foo3();
+template<int> Y<1024> foo4(); // { dg-error "narrowing conversion" }
+template<int> Y<1u> foo5();
+template<int> X<__INT_MAX__ + 1U> foo6(); // { dg-error "narrowing conversion" }
+
+template <typename T>
+struct S {
+ using t = X<sizeof(T)>;
+ using u = X<alignof(T)>;
+};
diff --git a/gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C b/gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C
new file mode 100644
index 0000000..70f0bee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C
@@ -0,0 +1,9 @@
+// PR c++/99565
+// { dg-do compile }
+// { dg-options "-Wduplicated-branches" }
+
+struct A {
+ union { int a; int b; };
+ int& foo (bool x) { return x ? a : b; } // { dg-bogus "this condition has identical branches" }
+ void bar (bool x, int y) { if (x) a = y; else b = y; }
+};
diff --git a/gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C b/gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C
new file mode 100644
index 0000000..bbc0793
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C
@@ -0,0 +1,11 @@
+// PR c++/99565
+// { dg-do compile }
+// { dg-options "-Wduplicated-branches" }
+
+int a;
+
+void
+foo (bool x)
+{
+ x ? ++a : ++a; // { dg-warning "this condition has identical branches" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wfree-nonheap-object-6.C b/gcc/testsuite/g++.dg/warn/Wfree-nonheap-object-6.C
new file mode 100644
index 0000000..83b6ff9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wfree-nonheap-object-6.C
@@ -0,0 +1,45 @@
+/* { dg-do compile }
+ { dg-options "-O0 -Wall" } */
+
+#if __cplusplus < 201103L
+# define noexcept throw ()
+#endif
+
+void* operator new (__SIZE_TYPE__, void* __p) noexcept;
+void operator delete (void*, void*);
+
+void* operator new[] (__SIZE_TYPE__, void* __p) noexcept;
+void operator delete[] (void*, void*) noexcept;
+
+struct A { A (); ~A (); int i; };
+
+extern void *p;
+
+void nowarn_placement_new ()
+{
+ char a[sizeof (A)];
+ p = new (a) A (); // { dg-bogus "-Wfree-nonheap-object" }
+}
+
+
+void warn_placement_new ()
+{
+ char a[sizeof (A)];
+ p = new (a + 1) A (); // { dg-warning "\\\[-Wplacement-new" }
+ // { dg-bogus "-Wfree-nonheap-object" "bogus" { target *-*-* } .-1 }
+}
+
+
+void nowarn_placement_new_array ()
+{
+ char a[sizeof (A)];
+ p = new (a) A[1]; // { dg-bogus "-Wfree-nonheap-object" }
+}
+
+
+void warn_placement_new_array ()
+{
+ char a[sizeof (A)];
+ p = new (a + 1) A[1]; // { dg-warning "\\\[-Wplacement-new" }
+ // { dg-bogus "-Wfree-nonheap-object" "bogus" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C b/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C
index 053ed68..b5ebd3d 100644
--- a/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C
@@ -25,8 +25,8 @@ fn2 ()
switch (0) {
case 0:
{
- A b; // { dg-warning "statement may fall through" }
- }
+ A b;
+ } // { dg-warning "statement may fall through" }
default:
a = 0;
}
diff --git a/gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C b/gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C
new file mode 100644
index 0000000..6cb482d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wint-in-bool-context" }
+
+unsigned hb(unsigned i) { return ~i; }
+
+template<typename T>
+void f(int i)
+{
+ auto l = [i]() { return T(2 * hb(i)); }; // { dg-bogus "in boolean context" }
+ (void) l;
+}
+
+int main()
+{
+ f<bool>(0);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Winterference-2.C b/gcc/testsuite/g++.dg/warn/Winterference-2.C
new file mode 100644
index 0000000..2af75c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Winterference-2.C
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++20 } }
+// { dg-additional-options -fmodules-ts }
+
+module ;
+
+#include <new>
+
+export module foo;
+
+export {
+ struct A {
+ alignas(std::hardware_destructive_interference_size) int x; // { dg-warning Winterference-size }
+ };
+}
diff --git a/gcc/testsuite/g++.dg/warn/Winterference.C b/gcc/testsuite/g++.dg/warn/Winterference.C
new file mode 100644
index 0000000..57c001b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Winterference.C
@@ -0,0 +1,6 @@
+// Test that we warn about use of std::hardware_destructive_interference_size
+// in a header.
+// { dg-do compile { target c++17 } }
+
+// { dg-warning Winterference-size "" { target *-*-* } 0 }
+#include "Winterference.H"
diff --git a/gcc/testsuite/g++.dg/warn/Winterference.H b/gcc/testsuite/g++.dg/warn/Winterference.H
new file mode 100644
index 0000000..36f0ad5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Winterference.H
@@ -0,0 +1,7 @@
+#include <new>
+
+struct A
+{
+ alignas(std::hardware_destructive_interference_size) int i;
+ alignas(std::hardware_destructive_interference_size) int j;
+};
diff --git a/gcc/testsuite/g++.dg/warn/Wlogical-op-3.C b/gcc/testsuite/g++.dg/warn/Wlogical-op-3.C
new file mode 100644
index 0000000..50b09d5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wlogical-op-3.C
@@ -0,0 +1,12 @@
+// PR c++/101592
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -Wlogical-op" }
+
+decltype(nullptr) foo ();
+
+bool
+bar ()
+{
+ return foo () > nullptr // { dg-error "ordered comparison" }
+ || foo () < nullptr; // { dg-error "ordered comparison" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C
new file mode 100644
index 0000000..4320181
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C
@@ -0,0 +1,37 @@
+/* PR c++/100876 - -Wmismatched-new-delete should either look through
+ or ignore placement new
+ { dg-do compile }
+ { dg-options "-O0 -Wall" } */
+
+extern "C" {
+ void* malloc (__SIZE_TYPE__);
+ void free (void*);
+}
+
+void* operator new (__SIZE_TYPE__, void*);
+void* operator new[] (__SIZE_TYPE__, void*);
+
+void nowarn_placement_new ()
+{
+ free (new (malloc (sizeof (int))) int ()); // { dg-bogus "-Wmismatched-new-delete" }
+}
+
+void nowarn_placement_array_new ()
+{
+ free (new (malloc (sizeof (int) * 2)) int[2]); // { dg-bogus "-Wmismatched-new-delete" }
+}
+
+
+void warn_placement_new ()
+{
+ void *p = malloc (sizeof (int));
+ int *q = new (p) int ();
+ delete q; // { dg-warning "-Wmismatched-new-delete" }
+}
+
+void warn_placement_array_new ()
+{
+ void *p = malloc (sizeof (int));
+ int *q = new (p) int[2];
+ delete q; // { dg-warning "-Wmismatched-new-delete" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C
new file mode 100644
index 0000000..92c75df
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C
@@ -0,0 +1,37 @@
+/* PR c++/100876 - -Wmismatched-new-delete should either look through
+ or ignore placement new
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+extern "C" {
+ void* malloc (__SIZE_TYPE__);
+ void free (void*);
+}
+
+inline void* operator new (__SIZE_TYPE__, void *p) { return p; }
+inline void* operator new[] (__SIZE_TYPE__, void *p) { return p; }
+
+void nowarn_placement_new ()
+{
+ free (new (malloc (sizeof (int))) int ()); // { dg-bogus "-Wmismatched-new-delete" }
+}
+
+void nowarn_placement_array_new ()
+{
+ free (new (malloc (sizeof (int) * 2)) int[2]); // { dg-bogus "-Wmismatched-new-delete" }
+}
+
+
+void warn_placement_new ()
+{
+ void *p = malloc (sizeof (int));
+ int *q = new (p) int ();
+ delete q; // { dg-warning "-Wmismatched-new-delete" }
+}
+
+void warn_placement_array_new ()
+{
+ void *p = malloc (sizeof (int));
+ int *q = new (p) int[2];
+ delete q; // { dg-warning "-Wmismatched-new-delete" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-6.C b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-6.C
new file mode 100644
index 0000000..e19d000
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-6.C
@@ -0,0 +1,158 @@
+/* PR middle-end/101791 - missing warning on a mismatch between scalar
+ and array forms of new and delete
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+namespace std
+{
+#if __cplusplus >= 201703L
+enum class align_val_t: size_t { };
+#else
+enum align_val_t { };
+#endif
+
+struct nothrow_t { };
+const nothrow_t nothrow = { };
+
+}
+
+void* operator new (size_t);
+void* operator new (size_t, std::align_val_t);
+void* operator new (size_t, std::nothrow_t) throw ();
+void* operator new (size_t, std::align_val_t, std::nothrow_t) throw ();
+
+void* operator new[] (size_t);
+void* operator new[] (size_t, std::align_val_t);
+void* operator new[] (size_t, std::nothrow_t) throw ();
+void* operator new[] (size_t, std::align_val_t, std::nothrow_t) throw ();
+
+void operator delete (void*);
+void operator delete (void*, size_t);
+void operator delete (void*, std::align_val_t);
+void operator delete (void*, size_t, std::align_val_t);
+void operator delete (void*, std::nothrow_t) throw ();
+void operator delete (void*, std::align_val_t, std::nothrow_t) throw ();
+
+void operator delete[] (void*);
+void operator delete[] (void*, size_t);
+void operator delete[] (void*, std::align_val_t);
+void operator delete[] (void*, size_t, std::align_val_t);
+void operator delete[] (void*, std::nothrow_t) throw ();
+void operator delete[] (void*, std::align_val_t, std::nothrow_t) throw ();
+
+
+void sink (void*, ...);
+
+
+void nowarn_scalar_scalar ()
+{
+ {
+ int *p = new int;
+ sink (p);
+ delete p;
+ }
+
+ {
+ int *p = new (std::align_val_t (8)) int;
+ sink (p);
+ delete p;
+ }
+
+ {
+ int *p = new (std::nothrow) int;
+ sink (p);
+ delete p;
+ }
+
+ {
+ int *p = new (std::align_val_t (8), std::nothrow) int;
+ sink (p);
+ delete p;
+ }
+}
+
+void nowarn_array_array ()
+{
+ {
+ int *p = new int[__LINE__];
+ sink (p);
+ delete[] p;
+ }
+
+ {
+ int *p = new (std::align_val_t (8)) int[__LINE__];
+ sink (p);
+ delete[] p;
+ }
+
+ {
+ int *p = new (std::nothrow) int[__LINE__];
+ sink (p);
+ delete[] p;
+ }
+
+ {
+ int *p = new (std::align_val_t (8), std::nothrow) int[__LINE__];
+ sink (p);
+ delete[] p;
+ }
+}
+
+
+
+void nowarn_scalar_array ()
+{
+ {
+ int *p = new int; // { dg-message "returned from" }
+ sink (p);
+ delete[] p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+
+ {
+ int *p = new (std::align_val_t (8)) int;
+ sink (p);
+ delete[] p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+
+ {
+ int *p = new (std::nothrow) int;
+ sink (p);
+ delete[] p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+
+ {
+ int *p = new (std::align_val_t (8), std::nothrow) int;
+ sink (p);
+ delete[] p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+}
+
+
+void nowarn_array_scalar ()
+{
+ {
+ int *p = new int[__LINE__];
+ sink (p);
+ delete p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+
+ {
+ int *p = new (std::align_val_t (8)) int[__LINE__];
+ sink (p);
+ delete p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+
+ {
+ int *p = new (std::nothrow) int[__LINE__];
+ sink (p);
+ delete p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+
+ {
+ int *p = new (std::align_val_t (8), std::nothrow) int[__LINE__];
+ sink (p);
+ delete p; // { dg-warning "\\\[-Wmismatched-new-delete" }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-7.C b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-7.C
new file mode 100644
index 0000000..67a5354
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-7.C
@@ -0,0 +1,91 @@
+/* PR middle-end/101791 - missing warning on a mismatch between scalar
+ and array forms of new and delete
+ Verify that likely safe calls to technically mismatched member operator
+ new and delete are not diagnosed. This test might need to be adjusted
+ if it turns out the assumptions GCC makes are overly conservative.
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+namespace std
+{
+#if __cplusplus >= 201703L
+enum class align_val_t: size_t { };
+#else
+enum align_val_t { };
+#endif
+
+struct nothrow_t { };
+const nothrow_t nothrow = { };
+
+}
+
+void sink (void*, ...);
+
+struct X { } x;
+struct Y { } y;
+
+struct A
+{
+ void* operator new (size_t);
+ void* operator new (size_t, std::align_val_t);
+
+ void* operator new (size_t, X);
+ void* operator new (size_t, Y);
+
+ void* operator new (size_t, std::align_val_t, X);
+ void* operator new (size_t, std::nothrow_t, Y);
+
+ /* A single operator delete callable on the result of calls to any
+ of the operator new overloads above (this may be too optimistic). */
+ void operator delete (void*);
+};
+
+A* nowarn_align ()
+{
+ /* The following are likely okay given A's definition above but would
+ not be if A also defined an align_val_t overload of operator delete. */
+ A *p = new (std::align_val_t (8)) A;
+ delete p;
+
+ return new (std::align_val_t (16)) A;
+}
+
+A* nowarn_X ()
+{
+ /* The following are also likely okay given A's definition above but
+ also would not be if A also defined an overload of operator delete
+ for X. */
+ A *p = new (x) A;
+ delete p;
+ return new (x) A;
+}
+
+A* nowarn_Y ()
+{
+ // Same as above.
+ A *p = new (y) A;
+ delete p;
+ return new (y) A;
+}
+
+
+A* nowarn_align_X ()
+{
+ // Same as above.
+ A *p = new (std::align_val_t (32), x) A;
+ delete p;
+
+ return new (std::align_val_t (64), x) A;
+}
+
+
+A* nowarn_nothrow_Y ()
+{
+ // Same as above.
+ A *p = new (std::nothrow, y) A;
+ delete p;
+ return new (std::nothrow, y) A;
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull13.C b/gcc/testsuite/g++.dg/warn/Wnonnull13.C
new file mode 100644
index 0000000..e327976
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wnonnull13.C
@@ -0,0 +1,28 @@
+/* PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda
+ { dg-do compile { target c++11 } }
+ { dg-options "-O0 -Wall -fsanitize=undefined" } */
+
+#define NONNULL __attribute__ ((nonnull))
+
+typedef int F (const char *);
+
+NONNULL int f (const char *);
+
+int nowarn_O0 ()
+{
+ return static_cast<F*>([](const char *s){ return f (s); })("O0");
+ // { dg-bogus "\\\[-Wnonnull" "" { target *-*-* } .-1 }
+}
+
+int warn_O0 ()
+{
+ return static_cast<F*>([] NONNULL (const char *){ return 0; })(0);
+ // { dg-warning "\\\[-Wnonnull" "" { target *-*-* } .-1 }
+}
+
+int warn_O0_inline ()
+{
+ return static_cast<F*>([](const char *s){ return f (s); })(0);
+ // { dg-warning "\\\[-Wnonnull" "lambda not inlined" { xfail *-*-* } .-1 }
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull14.C b/gcc/testsuite/g++.dg/warn/Wnonnull14.C
new file mode 100644
index 0000000..16d7ec3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wnonnull14.C
@@ -0,0 +1,28 @@
+/* PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda
+ { dg-do compile { target c++11 } }
+ { dg-options "-Og -Wall -fsanitize=undefined" } */
+
+#define NONNULL __attribute__ ((nonnull))
+
+typedef int F (const char *);
+
+__attribute__ ((nonnull)) int f (const char *);
+
+int nowarn_Og ()
+{
+ return static_cast<F*>([](const char *s){ return f (s); })("Og");
+ // { dg-bogus "'this' pointer is null" "" { target *-*-* } .-1 }
+}
+
+int warn_Og ()
+{
+ return static_cast<F*>([] NONNULL (const char *){ return 0; })(0);
+ // { dg-warning "\\\[-Wnonnull" "" { target *-*-* } .-1 }
+}
+
+int warn_Og_inline ()
+{
+ const char *p = 0;
+ return static_cast<F*>([](const char *s){ return f (s); })(p);
+ // { dg-warning "\\\[-Wnonnull" "lambda not inlined" { xfail *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull15.C b/gcc/testsuite/g++.dg/warn/Wnonnull15.C
new file mode 100644
index 0000000..36a2ab4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wnonnull15.C
@@ -0,0 +1,28 @@
+/* PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda
+ { dg-do compile { target c++11 } }
+ { dg-options "-O1 -Wall -fsanitize=undefined" } */
+
+#define NONNULL __attribute__ ((nonnull))
+
+typedef int F (const char *);
+
+NONNULL int f (const char *);
+
+int nowarn_O1 ()
+{
+ return static_cast<F*>([](const char *s){ return f (s); })("O1");
+ // { dg-bogus "\\\[-Wnonnull" "" { target *-*-* } .-1 }
+}
+
+int warn_O1 ()
+{
+ return static_cast<F*>([] NONNULL (const char *){ return 0; })(0);
+ // { dg-warning "\\\[-Wnonnull" "" { target *-*-* } .-1 }
+}
+
+int warn_O1_inline ()
+{
+ const char *p = 0;
+ return static_cast<F*>([](const char *s){ return f (s); })(p);
+ // { dg-warning "\\\[-Wnonnull" "lambda not inlined" { xfail *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C
new file mode 100644
index 0000000..a6b5870b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C
@@ -0,0 +1,39 @@
+/* PR middle-end/100307 - spurious -Wplacement-new with negative pointer
+ offset
+ { dg-do compile }
+ { dg-options "-O0 -Wall" } */
+
+void* operator new (__SIZE_TYPE__, void *p) { return p; }
+void* operator new[] (__SIZE_TYPE__, void *p) { return p; }
+
+static char a[2];
+
+void* nowarn_scalar ()
+{
+ char* p = a + 1;
+ char *q = new (p - 1) char (); // { dg-bogus "-Wplacement-new" }
+ return q;
+}
+
+
+void* nowarn_array ()
+{
+ char* p = a + 1;
+ char *q = new (p - 1) char[2]; // { dg-bogus "-Wplacement-new" }
+ return q;
+}
+
+void* warn_scalar ()
+{
+ char* p = a + 1;
+ char *q = new (p - 2) char (); // { dg-warning "-Wplacement-new" "pr100325" { xfail *-*-* } }
+ return q;
+}
+
+
+void* warn_array ()
+{
+ char* p = a + 1;
+ char *q = new (p - 1) char[2]; // { dg-warning "-Wplacement-new" "pr100325" { xfail *-*-* } }
+ return q;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-5.C b/gcc/testsuite/g++.dg/warn/Wreturn-5.C
new file mode 100644
index 0000000..543e33e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wreturn-5.C
@@ -0,0 +1,15 @@
+// PR C++/66590
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+struct A{ ~A();};
+
+int f(int x)
+{
+ A a;
+ switch (x)
+ {
+ case 1: { A tmp; return 1; } break;
+ default: return 0;
+ }
+} // { dg-bogus "control reaches end of non-void function" }
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C
index 121239a..c80977d 100644
--- a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C
@@ -145,7 +145,12 @@ void test_strcpy_new_int16_t (size_t n, const size_t vals[])
T (S (9), new int16_t[r_imin_imax * 2 + 1]);
int r_0_imax = SR (0, INT_MAX);
- T (S (1), new int16_t[r_0_imax]);
+
+ if (sizeof (int) < sizeof (size_t))
+ /* The code below might emit a warning when int is the same size
+ as size_t as a result of threading. See PR 101688 comment #2. */
+ T (S (1), new int16_t[r_0_imax]);
+
T (S (2), new int16_t[r_0_imax + 1]);
T (S (9), new int16_t[r_0_imax * 2 + 1]);
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-7.C b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-7.C
new file mode 100644
index 0000000..d3d28f4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-7.C
@@ -0,0 +1,42 @@
+/* PR c++/100876 - -Wmismatched-new-delete should either look through
+ or ignore placement new
+ { dg-do compile }
+ { dg-options "-O0 -Wall -Wno-array-bounds" } */
+
+inline void* operator new (__SIZE_TYPE__, void *p) { return p; }
+inline void* operator new[] (__SIZE_TYPE__, void *p) { return p; }
+
+void* nowarn_placement_new_memset ()
+{
+ struct S { int i; };
+ void *p = __builtin_malloc (sizeof (S));
+ S *q = new (p) S;
+ __builtin_memset (q, 0, sizeof (S));
+ return q;
+}
+
+void* warn_placement_new_memset ()
+{
+ struct S { int i; };
+ void *p = __builtin_malloc (sizeof (S));
+ S *q = new (p) S;
+ __builtin_memset (q, 0, sizeof (S) + 1); // { dg-warning "\\\[-Wstringop-overflow" }
+ return q;
+}
+
+void* nowarn_placement_new_array_strncpy (const char *s)
+{
+ void *p = __builtin_malloc (5);
+ char *q = new (p) char[5];
+ __builtin_strncpy (q, s, 5);
+ return q;
+
+}
+
+void* warn_placement_new_array_strncpy (const char *s)
+{
+ void *p = __builtin_malloc (4);
+ char *q = new (p) char[5];
+ __builtin_strncpy (q, s, 5); // { dg-warning "\\\[-Wstringop-overflow" }
+ return q;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits6.C b/gcc/testsuite/g++.dg/warn/Wtype-limits6.C
new file mode 100644
index 0000000..9d5886d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits6.C
@@ -0,0 +1,17 @@
+// PR c++/100161
+// { dg-additional-options "-Wtype-limits" }
+
+void f(unsigned);
+
+template<unsigned n>
+void g()
+{
+ for (unsigned i = 0; i < n; i++) { // { dg-bogus "always false" }
+ f(i);
+ }
+}
+
+void h()
+{
+ g<0>();
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-18.C b/gcc/testsuite/g++.dg/warn/Wunused-18.C
new file mode 100644
index 0000000..06d1a05
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-18.C
@@ -0,0 +1,13 @@
+// PR c++/14199
+// { dg-options "-W -Wall -Wunused" }
+
+struct X {
+ static void foo ();
+};
+
+template <typename T>
+void foo (const T &t) {
+ t.foo();
+}
+
+template void foo (const X &);
diff --git a/gcc/testsuite/g++.dg/warn/pr101219.C b/gcc/testsuite/g++.dg/warn/pr101219.C
new file mode 100644
index 0000000..0d23d73
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr101219.C
@@ -0,0 +1,11 @@
+/* PR c++/101219 - ICE on use of uninitialized memfun pointer
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+struct S { void m(); };
+
+template <int> bool f() {
+ void (S::*mp)();
+
+ return &S::m == mp; // no warning emitted here (no instantiation)
+}
diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr48483.C b/gcc/testsuite/g++.dg/warn/uninit-pr48483.C
new file mode 100644
index 0000000..41e8513
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/uninit-pr48483.C
@@ -0,0 +1,56 @@
+/* PR tree-optimization/48483 - Construct from yourself w/o warning
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+void sink (int);
+
+struct B
+{
+ int x;
+};
+
+struct A
+{
+ B& b;
+ A (B &x): b(x) { }
+};
+
+__attribute__ ((noipa)) void test_c0_O0 ()
+{
+ A a (a.b); // { dg-warning "'a.A::b' is used uninitialized" }
+ sink (a.b.x);
+}
+
+__attribute__ ((noipa)) int test_c3_O0 (void)
+{
+ struct S { int a; } s;
+ return s.a; // { dg-warning "s.test_c3_O0\\\(\\\)::S::a' is used uninitialized" }
+}
+
+#pragma GCC optimize ("1")
+
+__attribute__ ((noipa)) void test_c0_O1 ()
+{
+ A a (a.b); // { dg-warning "'a.A::b' is used uninitialized" }
+ sink (a.b.x);
+}
+
+__attribute__ ((noipa)) int test_c3_O1 (void)
+{
+ struct S { int a; } s;
+ return s.a; // { dg-warning "s.test_c3_O1\\\(\\\)::S::a' is used uninitialized" }
+}
+
+#pragma GCC optimize ("2")
+
+__attribute__ ((noipa)) void test_c0_O2 ()
+{
+ A a (a.b); // { dg-warning "'a.A::b' is used uninitialized" }
+ sink (a.b.x);
+}
+
+__attribute__ ((noipa)) int test_c3_O2 (void)
+{
+ struct S { int a; } s;
+ return s.a; // { dg-warning "s.test_c3_O2\\\(\\\)::S::a' is used uninitialized" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr55288.C b/gcc/testsuite/g++.dg/warn/uninit-pr55288.C
new file mode 100644
index 0000000..12fbc56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/uninit-pr55288.C
@@ -0,0 +1,43 @@
+/* PR tree-optimization/55288 - Improve handling/suppression of
+ maybe-uninitialized warnings
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct iterator
+{
+ operator int ();
+ iterator operator++ (int);
+};
+
+void bar (int);
+
+static void foo (int x)
+{
+ bar (x); // { dg-bogus "uninitialized" }
+}
+
+int baz (iterator j, iterator end, int p)
+{
+ bool valid = false;
+ int q;
+ for (; j != end; j++) {
+ if (p > j) {
+ if (not valid)
+ p = j;
+ break;
+ }
+ else if (p == j) {
+ valid = true;
+ q = -1;
+ }
+ else {
+ valid = true;
+ q = j;
+ }
+ }
+
+ if (valid)
+ foo (q);
+
+ return p;
+}
diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr55881.C b/gcc/testsuite/g++.dg/warn/uninit-pr55881.C
new file mode 100644
index 0000000..b01f4e7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/uninit-pr55881.C
@@ -0,0 +1,34 @@
+/* PR middle-end/55881 - #pragma GCC diagnostic ignored ignored when inlining
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct I
+{
+ int i;
+ int foo (struct I *n)
+ {
+ return n->i + 10; // { dg-bogus "-Wmaybe-uninitialized" }
+ }
+
+ I () : i (5) {}
+};
+
+int main (int argc, char **)
+{
+ struct I i, *n;
+
+ if (argc > 10)
+ {
+ n = new I;
+ i.i = i.foo (n);
+ }
+
+ if (argc > 2)
+ {
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+ return i.foo (n);
+#pragma GCC diagnostic pop
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr74765.C b/gcc/testsuite/g++.dg/warn/uninit-pr74765.C
new file mode 100644
index 0000000..1b8c124
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/uninit-pr74765.C
@@ -0,0 +1,24 @@
+/* PR c++/74765 - missing uninitialized warning (parenthesis,
+ TREE_NO_WARNING abuse)
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+int warn_equal_parens (int x, int y)
+{
+ int i;
+
+ if ((i == 0)) // { dg-warning "\\\[-Wuninitialized" }
+ return x;
+
+ return y;
+}
+
+int warn_equal (int x, int y)
+{
+ int i;
+
+ if (i == 0) // { dg-warning "\\\[-Wuninitialized" }
+ return x;
+
+ return y;
+}
diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr82800.C b/gcc/testsuite/g++.dg/warn/uninit-pr82800.C
new file mode 100644
index 0000000..dc3ce5d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/uninit-pr82800.C
@@ -0,0 +1,43 @@
+/* PR 82800 - Incorrect warning on "may be used uninitialized in
+ variadic template code
+ { dg-do compile { target c++11 } }
+ { dg-options "-O2 -Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+extern "C" int rand ();
+
+struct Maker
+{
+ double makeConst()
+ {
+ return pick<double>(0, 0, 0, 0, 0, 0, 1); // { dg-bogus "uninitialized" }
+ }
+
+ template<typename T, typename... Args>
+ T pick(T first, Args... args)
+ {
+ return pickGivenNum<T>(rand(), first, args...);
+ }
+
+ template<typename T>
+ T pickGivenNum(size_t num, T first)
+ {
+ if (num != 0) __builtin_abort();
+ return first;
+ }
+
+ template<typename T, typename... Args>
+ T pickGivenNum(size_t num, T first, Args... args)
+ {
+ if (num == 0) return first;
+ return pickGivenNum<T>(num - 1, args...);
+ }
+};
+
+int main ()
+{
+ Maker maker;
+ maker.makeConst();
+ maker.makeConst();
+}
diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr93100.C b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C
new file mode 100644
index 0000000..56dc894
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C
@@ -0,0 +1,60 @@
+/* PR tree-optimization/98508 - Sanitizer disable -Wall and -Wextra
+ { dg-do compile }
+ { dg-require-effective-target no_fsanitize_address }
+ { dg-options "-O0 -Wall -fsanitize=address" } */
+
+struct S
+{
+ int a;
+};
+
+void warn_init_self_O0 ()
+{
+ S s = S (s); // { dg-warning "\\\[-Wuninitialized" }
+ (void)&s;
+}
+
+
+void warn_init_self_use_O0 ()
+{
+ S s = S (s); // { dg-warning "\\\[-Wuninitialized" }
+
+ void sink (void*);
+ sink (&s);
+}
+
+
+#pragma GCC optimize ("1")
+
+void warn_init_self_O1 ()
+{
+ S s = S (s); // { dg-warning "\\\[-Wuninitialized" }
+ (void)&s;
+}
+
+
+void warn_init_self_use_O1 ()
+{
+ S s = S (s); // { dg-warning "\\\[-Wuninitialized" }
+
+ void sink (void*);
+ sink (&s);
+}
+
+
+#pragma GCC optimize ("2")
+
+void warn_init_self_O2 ()
+{
+ S s = S (s); // { dg-warning "\\\[-Wuninitialized" }
+ (void)&s;
+}
+
+
+void warn_init_self_use_O2 ()
+{
+ S s = S (s); // { dg-warning "\\\[-Wuninitialized" }
+
+ void sink (void*);
+ sink (&s);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C
index 49191c9..77969bc 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C
@@ -2,5 +2,5 @@
int main ()
{
int i;
- int &ir = (int&)(int)i; // { dg-error "14:invalid cast of an rvalue expression" } casting rvalue to reference type
+ int &ir = (int&)(int)i; // { dg-error "14:invalid cast of a prvalue expression" } casting rvalue to reference type
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/union4.C b/gcc/testsuite/g++.old-deja/g++.law/union4.C
index 958ff0a..ec30d1e 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/union4.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/union4.C
@@ -7,7 +7,7 @@
// Message-ID: <m0pA49A-0000LdC@piano.veritas.com>
static union {
- struct SS {
+ struct SS { // { dg-error "anonymous union" }
int ss;
};
};// { dg-error "no members" }
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/crash3.C b/gcc/testsuite/g++.old-deja/g++.ns/crash3.C
index 189298d..b5e6323 100644
--- a/gcc/testsuite/g++.old-deja/g++.ns/crash3.C
+++ b/gcc/testsuite/g++.old-deja/g++.ns/crash3.C
@@ -6,6 +6,6 @@ namespace N {
void f()
{
- N::S(); // { dg-error "6:cannot deduce template arguments" "" { target c++17 } } invalid use of template
+ N::S(); // { dg-error "8:class template argument deduction failed|no match" "" { target c++17 } } invalid use of template
// { dg-error "7:missing template arguments" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template7.C b/gcc/testsuite/g++.old-deja/g++.ns/template7.C
index 71366b7..441a412 100644
--- a/gcc/testsuite/g++.old-deja/g++.ns/template7.C
+++ b/gcc/testsuite/g++.old-deja/g++.ns/template7.C
@@ -8,6 +8,6 @@ namespace foo {
}
void baz() {
- foo::bar(); // { dg-error "8:cannot deduce template arguments" "" { target c++17 } } template used as expression
+ foo::bar(); // { dg-error "12:class template argument deduction failed|no match" "" { target c++17 } } template used as expression
// { dg-error "11:missing template arguments" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline7.C b/gcc/testsuite/g++.old-deja/g++.other/inline7.C
index a3723cf..6260000 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/inline7.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/inline7.C
@@ -8,7 +8,7 @@ std::list<int*> li;
void f ()
{
- li.size ();
+ (void) li.size ();
}
int main ()
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash8.C b/gcc/testsuite/g++.old-deja/g++.pt/crash8.C
index 7b4eff5..678a728 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash8.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash8.C
@@ -21,11 +21,11 @@ void doit(T x) {
q2 = TestClass2<T>();
TestClass1<T> p1;
- p1 = TestClass1(); // { dg-error "8:cannot deduce template arguments" "" { target c++17 } } template used as expression
+ p1 = TestClass1(); // { dg-error "19:class template argument deduction failed|no match" "" { target c++17 } } template used as expression
// { dg-error "18:missing template arguments" "" { target c++14_down } .-1 }
TestClass2<T> p2;
- p2 = TestClass2(); // { dg-error "8:cannot deduce template arguments" "" { target c++17 } } template used as expression
+ p2 = TestClass2(); // { dg-error "19:class template argument deduction failed|no match" "" { target c++17 } } template used as expression
// { dg-error "18:missing template arguments" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec21.C b/gcc/testsuite/g++.old-deja/g++.pt/spec21.C
index cf89d6b..bf25c0e 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/spec21.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec21.C
@@ -4,8 +4,7 @@ template <class T> struct S {};
template <class T = int> struct S<T*> {}; // { dg-error "" } default argument
template <int I, int J> struct A {};
-template <int I> struct A<I+5, I*2> {}; // { dg-error "28:template argument" }
-// { dg-error "33:template argument" "" { target *-*-* } .-1 }
+template <int I> struct A<I+5, I*2> {}; // { dg-error "not deducible" }
template <class T, T t> struct C {};
template <class T> struct C<T, 1>; // { dg-error "" } type depends on parameter
int i;
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify6.C b/gcc/testsuite/g++.old-deja/g++.pt/unify6.C
index d122ec2..ee14cea 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/unify6.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/unify6.C
@@ -23,8 +23,8 @@ template<class T> void foo(T const *){} // { dg-error "pointer to reference" }
void f()
{
- foo<int &>(); // { dg-error "" } attempt to build int & const *
- foo<void ()>(); // { dg-error "" } attempt to build void (const *)()
+ foo<int &>(0); // { dg-error "" } attempt to build int & const *
+ foo<void ()>(0); // OK by [dcl.fct]/7, the const is silently dropped
}
typedef void (*Fptr)();
diff --git a/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp
new file mode 100644
index 0000000..268e221
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp
@@ -0,0 +1,72 @@
+# Copyright (C) 2014-2021 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an ARM or AArch64 target.
+if {![istarget arm*-*-*]
+ && ![istarget aarch64*-*-*]} then {
+ return
+}
+
+# Load support procs.
+load_lib g++-dg.exp
+
+# Initialize `dg'.
+load_lib c-torture.exp
+
+dg-init
+
+# The default action for a test is 'run'. Save current default.
+global dg-do-what-default
+set save-dg-do-what-default ${dg-do-what-default}
+
+# For ARM, make sure that we have a target compatible with NEON, and do
+# not attempt to run execution tests if the hardware doesn't support it.
+if {[istarget arm*-*-*]} then {
+ if {![check_effective_target_arm_neon_ok]} then {
+ return
+ }
+ if {![is-effective-target arm_neon_hw]} then {
+ set dg-do-what-default compile
+ } else {
+ set dg-do-what-default run
+ }
+} else {
+ set dg-do-what-default run
+}
+
+torture-init
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
+
+# Make sure Neon flags are provided, if necessary. Use fp16 if we can.
+# Use fp16 arithmetic operations if the hardware supports it.
+if {[check_effective_target_arm_v8_2a_fp16_neon_hw]} then {
+ set additional_flags [add_options_for_arm_v8_2a_fp16_neon ""]
+} elseif {[check_effective_target_arm_neon_fp16_ok]} then {
+ set additional_flags [add_options_for_arm_neon_fp16 ""]
+} else {
+ set additional_flags [add_options_for_arm_neon ""]
+}
+
+# Main loop.
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \
+ "" ${additional_flags}
+
+# All done.
+set dg-do-what-default ${save-dg-do-what-default}
+torture-finish
+dg-finish
diff --git a/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C
new file mode 100644
index 0000000..0cb5c89
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C
@@ -0,0 +1,110 @@
+/* { dg-do compile } */
+
+#include <arm_neon.h>
+
+using int32_elt = __typeof(((int32x4_t *) nullptr)[0][0]);
+using uint32_elt = __typeof(((uint32x4_t *) nullptr)[0][0]);
+
+typedef int32_elt gnu_int32x4_t __attribute__((vector_size(16)));
+typedef uint32_elt gnu_uint32x4_t __attribute__((vector_size(16)));
+
+template<typename T> struct id;
+template<> struct id<gnu_int32x4_t> { static const int value = 1; };
+template<> struct id<gnu_uint32x4_t> { static const int value = 2; };
+template<> struct id<int32x4_t> { static const int value = 3; };
+template<> struct id<uint32x4_t> { static const int value = 4; };
+
+#define CHECK_TYPE(EXPR, TYPE) \
+ static_assert(id<decltype(EXPR)>::value == id<TYPE>::value, "foo")
+
+void
+f (gnu_int32x4_t sg, gnu_uint32x4_t ug, int32x4_t sn, uint32x4_t un, bool c)
+{
+ CHECK_TYPE (sg, gnu_int32x4_t);
+ CHECK_TYPE (ug, gnu_uint32x4_t);
+ CHECK_TYPE (sn, int32x4_t);
+ CHECK_TYPE (un, uint32x4_t);
+
+ CHECK_TYPE (sg + 1, gnu_int32x4_t);
+ CHECK_TYPE (ug + 1, gnu_uint32x4_t);
+ CHECK_TYPE (sn + 1, int32x4_t);
+ CHECK_TYPE (un + 1, uint32x4_t);
+
+ CHECK_TYPE (1 + sg, gnu_int32x4_t);
+ CHECK_TYPE (1 + ug, gnu_uint32x4_t);
+ CHECK_TYPE (1 + sn, int32x4_t);
+ CHECK_TYPE (1 + un, uint32x4_t);
+
+ CHECK_TYPE (sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (sn + sn, int32x4_t);
+ CHECK_TYPE (un + un, uint32x4_t);
+
+ // In C++, unlike C, the behavior is to prefer unsigned types over
+ // signed types.
+ CHECK_TYPE (sg + ug, gnu_uint32x4_t);
+ CHECK_TYPE (ug + sg, gnu_uint32x4_t);
+ CHECK_TYPE (sn + un, uint32x4_t);
+ CHECK_TYPE (un + sn, uint32x4_t);
+
+ // That being the case, it seems more consistent to do the same thing
+ // for mixed GNU and arm_neon.h operations.
+ CHECK_TYPE (sg + un, uint32x4_t);
+ CHECK_TYPE (un + sg, uint32x4_t);
+ CHECK_TYPE (sn + ug, gnu_uint32x4_t);
+ CHECK_TYPE (ug + sn, gnu_uint32x4_t);
+
+ // If the types have the same signedness, the traditional behavior is
+ // to pick the first type if it is unsigned and the second type otherwise.
+ // This is not necessarily sensible, but dates back to at least GCC 9.1.
+ // We could probably change it.
+ CHECK_TYPE (sg + sn, int32x4_t);
+ CHECK_TYPE (sn + sg, gnu_int32x4_t);
+ CHECK_TYPE (un + ug, uint32x4_t);
+ CHECK_TYPE (ug + un, gnu_uint32x4_t);
+
+ CHECK_TYPE (c ? sg + sg : sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + ug : ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + sn : sn, int32x4_t);
+ CHECK_TYPE (c ? un + un : un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg + 1 : sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + 1 : ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + 1 : sn, int32x4_t);
+ CHECK_TYPE (c ? un + 1 : un, uint32x4_t);
+
+ CHECK_TYPE (c ? 1 + sg : sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? 1 + ug : ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? 1 + sn : sn, int32x4_t);
+ CHECK_TYPE (c ? 1 + un : un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg : sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug : ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn : sn + sn, int32x4_t);
+ CHECK_TYPE (c ? un : un + un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg : sg + 1, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug : ug + 1, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn : sn + 1, int32x4_t);
+ CHECK_TYPE (c ? un : un + 1, uint32x4_t);
+
+ CHECK_TYPE (c ? sg : 1 + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug : 1 + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn : 1 + sn, int32x4_t);
+ CHECK_TYPE (c ? un : 1 + un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg + sg : sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + ug : ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + sn : sn + sn, int32x4_t);
+ CHECK_TYPE (c ? un + un : un + un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg + sg : sg + 1, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + ug : ug + 1, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + sn : sn + 1, int32x4_t);
+ CHECK_TYPE (c ? un + un : un + 1, uint32x4_t);
+
+ CHECK_TYPE (c ? 1 + sg : sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? 1 + ug : ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? 1 + sn : sn + sn, int32x4_t);
+ CHECK_TYPE (c ? 1 + un : un + un, uint32x4_t);
+}
diff --git a/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C b/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C
index 9203d91..e112a38 100644
--- a/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C
+++ b/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C
@@ -7,8 +7,8 @@
void foo (void)
{
- bfloat16_t (); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" { xfail *-*-* } } */
- bfloat16_t a = bfloat16_t(); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" { xfail *-*-* } } */
+ bfloat16_t (); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" } */
+ bfloat16_t a = bfloat16_t(); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" } */
bfloat16_t (0x1234); /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
bfloat16_t (0.1); /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
}
diff --git a/gcc/testsuite/g++.target/aarch64/interference.C b/gcc/testsuite/g++.target/aarch64/interference.C
new file mode 100644
index 0000000..0fc0165
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/interference.C
@@ -0,0 +1,9 @@
+// Test C++17 hardware interference size constants
+// { dg-do compile { target c++17 } }
+
+#include <new>
+
+// Most AArch64 CPUs have an L1 cache line size of 64, but some recent ones use
+// 128 or even 256.
+static_assert(std::hardware_destructive_interference_size == 256);
+static_assert(std::hardware_constructive_interference_size == 64);
diff --git a/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp b/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp
index 4bbe2f5..2b85023 100644
--- a/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp
+++ b/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp
@@ -38,8 +38,10 @@ if { [check_effective_target_aarch64_sve] } {
set sve_flags "-march=armv8.2-a+sve"
}
-# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] $sve_flags ""
+aarch64-with-arch-dg-options $sve_flags {
+ # Main loop.
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" $sve_flags
+}
# All done.
dg-finish
diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp
index 0734268..070a049 100644
--- a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp
+++ b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp
@@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve] } {
set sve_flags "-march=armv8.2-a+sve"
}
+# Turn off any codegen tweaks by default that may affect expected assembly.
+# Tests relying on those should turn them on explicitly.
+set sve_flags "$sve_flags -mtune=generic -moverride=tune=none"
+
global gcc_runtest_parallelize_limit_minor
if { [info exists gcc_runtest_parallelize_limit_minor] } {
set old_limit_minor $gcc_runtest_parallelize_limit_minor
diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp
index cb9de75..8d3d8b4 100644
--- a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp
+++ b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp
@@ -44,6 +44,10 @@ if { [check_effective_target_aarch64_sve] } {
set sve_flags "-march=armv8.2-a+sve"
}
+# Turn off any codegen tweaks by default that may affect expected assembly.
+# Tests relying on those should turn them on explicitly.
+set sve_flags "$sve_flags -moverride=tune=none"
+
# Main loop.
set gcc_subdir [string replace $subdir 0 2 gcc]
set files [glob -nocomplain \
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr102252.C b/gcc/testsuite/g++.target/aarch64/sve/pr102252.C
new file mode 100644
index 0000000..f90f121
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr102252.C
@@ -0,0 +1,37 @@
+/* PR target/102252. */
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-march=armv8.2-a+sve -msve-vector-bits=512" } */
+
+/* We used to generate invalid assembly for SVE predicate loads. */
+
+#include <arm_sve.h>
+
+class SimdBool
+{
+private:
+ typedef svbool_t simdInternalType_ __attribute__((arm_sve_vector_bits(512)));
+
+public:
+ SimdBool() {}
+
+ simdInternalType_ simdInternal_;
+
+};
+
+static svfloat32_t selectByMask(svfloat32_t a, SimdBool m) {
+ return svsel_f32(m.simdInternal_, a, svdup_f32(0.0));
+}
+
+struct s {
+ SimdBool array[1];
+};
+
+
+
+void foo(struct s* const work, int offset)
+{
+ svfloat32_t tz_S0;
+
+ tz_S0 = selectByMask(tz_S0, work->array[offset]);
+}
+
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr96974.C b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C
new file mode 100644
index 0000000..54000f5
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast -march=armv8.2-a+sve -fdisable-tree-fre4 -fdump-tree-slp-details" } */
+
+float a;
+int
+b ()
+{ return __builtin_lrintf(a); }
+
+struct c {
+ float d;
+ c() {
+ for (int e = 0; e < 9; e++)
+ coeffs[e] = d ? b() : 0;
+ }
+ int coeffs[10];
+} f;
+
+/* { dg-final { scan-tree-dump "Not vectorized: Incompatible number of vector subparts between" "slp1" { target lp64 } } } */
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99216.C b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C
new file mode 100644
index 0000000..61a58a7
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C
@@ -0,0 +1,5 @@
+/* { dg-do link { target aarch64_asm_sve_ok } } */
+/* { dg-additional-options "-flto" } */
+#include <arm_sve.h>
+bool a;
+int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); }
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99766.C b/gcc/testsuite/g++.target/aarch64/sve/pr99766.C
new file mode 100644
index 0000000..0ca8aee
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr99766.C
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3 -march=armv8.2-a+sve" } */
+typedef float a __attribute__((__mode__(HF)));
+typedef struct {
+ a b;
+ a c;
+} d;
+int e;
+d *f, *g;
+__fp16 h;
+void j() {
+ for (int i;; ++i) {
+ auto l = &f[i];
+ for (int k; k < e;) {
+ k = 0;
+ for (; k < e; ++k)
+ g[k].b = l[k].b * l[k].c;
+ }
+ for (int k; k < e; ++k) {
+ g[k].b *= h;
+ g[k].c *= h;
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99781.C b/gcc/testsuite/g++.target/aarch64/sve/pr99781.C
new file mode 100644
index 0000000..21da8e0
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr99781.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv8-a+sve" } */
+
+#include <stdint.h>
+
+typedef int32_t vnx4si __attribute__((vector_size(32)));
+
+void
+foo (int32_t val)
+{
+ register vnx4si x asm ("z0");
+ register vnx4si y asm ("z1");
+ asm volatile ("" : "=w" (y));
+ val += 1;
+ vnx4si z = { val, val, val, val, val, val, val, val };
+ x = (vnx4si) { -1, 0, 0, -1, 0, -1, 0, -1 } ? z : y;
+ asm volatile ("" :: "w" (x));
+}
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99813.C b/gcc/testsuite/g++.target/aarch64/sve/pr99813.C
new file mode 100644
index 0000000..f98b17c
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr99813.C
@@ -0,0 +1,27 @@
+// PR target/99813
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O3 -march=armv8.2-a+sve -fvect-cost-model=unlimited -fno-tree-dominator-opts -mtune=cortex-a72" } */
+
+long a, b;
+bool c[2][14][2][16], f[2][14][2][16];
+bool d;
+char e[2][4][2][6];
+void g() {
+ a = 0;
+ for (int h = 0; h < 2; ++h)
+ for (int i = 0; i < 14; ++i)
+ for (int j = 0; j < 2; ++j)
+ for (int k = 0; k < 16; ++k)
+ c[h][i][j][k] = 0;
+ d = 0;
+ for (int h; h < 2; ++h)
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < 2; ++j)
+ for (int k = 0; k < 6; ++k)
+ e[h][i][j][k] = 6;
+ for (int h = 0; h < 2; ++h)
+ for (int i = 0; i < 14; ++i)
+ for (int j = 0; j < 2; ++j)
+ for (int k = 0; k < 16; ++k)
+ f[h][i][j][k] = b = 9;
+}
diff --git a/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp b/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp
index c3a3a01..4989818 100644
--- a/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp
+++ b/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp
@@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve2] } {
set sve2_flags "-march=armv8.5-a+sve2"
}
+# Turn off any codegen tweaks by default that may affect expected assembly.
+# Tests relying on those should turn them on explicitly.
+set sve2_flags "$sve2_flags -mtune=generic -moverride=tune=none"
+
set gcc_subdir [string replace $subdir 0 2 gcc]
lappend extra_flags "-fno-ipa-icf" "-I$srcdir/$gcc_subdir/../../sve/acle/asm"
diff --git a/gcc/testsuite/g++.target/arm/arm.exp b/gcc/testsuite/g++.target/arm/arm.exp
index 182c1e9..7d873a4 100644
--- a/gcc/testsuite/g++.target/arm/arm.exp
+++ b/gcc/testsuite/g++.target/arm/arm.exp
@@ -35,7 +35,7 @@ if ![info exists DEFAULT_CXXFLAGS] then {
global dg_runtest_extra_prunes
set dg_runtest_extra_prunes ""
-lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch"
+lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'"
# Initialize `dg'.
dg-init
diff --git a/gcc/testsuite/g++.target/arm/interference.C b/gcc/testsuite/g++.target/arm/interference.C
new file mode 100644
index 0000000..34fe8a5
--- /dev/null
+++ b/gcc/testsuite/g++.target/arm/interference.C
@@ -0,0 +1,9 @@
+// Test C++17 hardware interference size constants
+// { dg-do compile { target c++17 } }
+
+#include <new>
+
+// Recent ARM CPUs have a cache line size of 64. Older ones have
+// a size of 32, but I guess they're old enough that we don't care?
+static_assert(std::hardware_destructive_interference_size == 64);
+static_assert(std::hardware_constructive_interference_size == 64);
diff --git a/gcc/testsuite/g++.target/arm/mve.exp b/gcc/testsuite/g++.target/arm/mve.exp
index 82cf928..ed62561 100644
--- a/gcc/testsuite/g++.target/arm/mve.exp
+++ b/gcc/testsuite/g++.target/arm/mve.exp
@@ -33,7 +33,7 @@ if ![info exists DEFAULT_CXXFLAGS] then {
# This variable should only apply to tests called in this exp file.
global dg_runtest_extra_prunes
set dg_runtest_extra_prunes ""
-lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch"
+lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'"
set save-dg-do-what-default ${dg-do-what-default}
set dg-do-what-default "assemble"
diff --git a/gcc/testsuite/g++.target/arm/pr99593.C b/gcc/testsuite/g++.target/arm/pr99593.C
new file mode 100644
index 0000000..ba2bb98
--- /dev/null
+++ b/gcc/testsuite/g++.target/arm/pr99593.C
@@ -0,0 +1,129 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c++17 -O2 -mfloat-abi=hard -mcpu=generic-armv7-a" } */
+// { dg-require-effective-target arm_hard_ok }
+// { dg-require-effective-target arm_neon_ok }
+// { dg-add-options arm_neon }
+
+#include <arm_neon.h>
+
+typedef uint16x4_t e;
+typedef int16x4_t f;
+typedef int32x4_t g;
+typedef float32x4_t h;
+typedef uint32x4_t i;
+g j, p;
+g k(int l) { return vdupq_n_s32(l); }
+i n(f l) { return (i)vmovl_u16((e)l); }
+template <int, typename> struct q;
+template <int r, typename aa> q<r, aa> operator<(aa s, q<r, aa> t) {
+ return q<r, aa>(s) < t;
+}
+template <typename ab, typename ac, int r> q<r, ab> ad(const q<r, ac> &);
+typedef q<4, int> ae;
+template <> class q<4, float> {
+ public:
+ q(h af) : ag(af) {}
+ q(float) {}
+ static q ah(void *ai) {
+ float *l = (float *)ai;
+ return vld1q_f32(l);
+ }
+ q operator+(q o) {
+ h l = ag, m = o.ag;
+ return vaddq_f32(l, m);
+ }
+ q operator*(q) {
+ h l = ag, m;
+ return vmulq_f32(l, m);
+ }
+ h ag;
+};
+template <> class q<4, unsigned short> {
+ public:
+ q(f af) : ag(af) {}
+ static q ah(void *ai) {
+ unsigned short *l = (unsigned short *)ai;
+ return (f)vld1_s16((int16_t *)l);
+ }
+ void aj() {
+ f m = ag;
+ vst1_u16(0, (e)m);
+ }
+ f ag;
+};
+template <> class q<4, int> {
+ public:
+ q(g af) : ag(af) {}
+ q(int u) { ag = k(u); }
+ static q ah(void *ai) {
+ int32_t *l = (int32_t *)ai;
+ return vld1q_s32(l);
+ }
+ q operator&(q o) {
+ g v = ag & o.ag;
+ return v;
+ }
+ q operator|(q o) {
+ g w = ag | o.ag;
+ return w;
+ }
+ q operator^(q) {
+ g x = ag ^ p;
+ return x;
+ }
+ q operator>>(int ak) { return ag >> q(ak).ag; }
+ q operator<(q) {
+ g y, z = j < ag;
+ y = (g)z;
+ return y;
+ }
+ g ag;
+};
+template <> ae ad(const q<4, unsigned short> &al) { return g(n(al.ag)); }
+template <> q<4, unsigned short> ad(const ae &al) {
+ i l(i(al.ag));
+ return (f)vmovn_s32((g)l);
+}
+q<4, float> am(long long an) {
+ q ao = q<4, unsigned short>::ah(&an);
+ ae ak = ad<int>(ao), ap = ak & 8000, aq = ak ^ ap, ar = 55 < aq, as(aq);
+ q at = as & ar;
+ ae au = ap | at;
+ return q<4, float>::ah(&au);
+}
+q<4, unsigned short> av(q<4, float> aw) {
+ ae ak = ae::ah(&aw), ap = ak & 80000000, aq = ap, ax = 5, as = aq >> 3,
+ ay = 6;
+ q az = ax & as;
+ ae au = ay | az;
+ return ad<unsigned short>(au);
+}
+struct ba {
+ typedef int bb;
+ static q<4, float> bc(int s) { return am(s); }
+};
+q<4, float> bd(q<4, float> s) { return s * 0; }
+template <typename be> void bf(void *bg, void *al, int bh, int bi) {
+ int bj;
+ auto bk(static_cast<typename be::bb *>(al) + bh),
+ d = static_cast<typename be::bb *>(bg),
+ bl = be::bc(static_cast<typename be::bb *>(al)[0]), bm = be::bc(0),
+ c = bm;
+ for (; bi;) {
+ auto a = c, bn = be::bc(static_cast<typename be::bb *>(al)[1]),
+ bo = be::bc(1);
+ q bp = bn;
+ q bq = bp;
+ auto b = bq + bo;
+ bl = be::bc(static_cast<typename be::bb *>(al)[2]);
+ bm = be::bc(bk[2]);
+ c = bl + bm;
+ q br = a + b;
+ auto bs = br;
+ q bt = bd(bs);
+ av(bt).aj();
+ d[0] = bj;
+ }
+}
+int bu;
+void bv() { bf<ba>(0, 0, 0, bu); }
diff --git a/gcc/testsuite/g++.target/i386/avx2-pr54700-2.C b/gcc/testsuite/g++.target/i386/avx2-pr54700-2.C
index c9054e5..e7a85c3 100644
--- a/gcc/testsuite/g++.target/i386/avx2-pr54700-2.C
+++ b/gcc/testsuite/g++.target/i386/avx2-pr54700-2.C
@@ -2,9 +2,15 @@
/* { dg-do run { target avx2 } } */
/* { dg-options "-O2 -std=c++14 -mavx2 -mno-xop -mno-avx512f" } */
-#include "avx2-check.h"
+#ifndef CHECK_H
+#define CHECK_H "avx2-check.h"
+#endif
+#ifndef TEST
#define TEST avx2_test
+#endif
+
+#include CHECK_H
#include "avx2-pr54700-1.C"
diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr54700-1a.C b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-1a.C
new file mode 100644
index 0000000..fedc3aa
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-1a.C
@@ -0,0 +1,9 @@
+/* PR target/100648 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=c++14 -mavx2 -mno-xop -mavx512vl -mavx512bw" } */
+/* { dg-final { scan-assembler-not "vpcmpgt\[bdq]" } } */
+/* { dg-final { scan-assembler-times "vpblendvb" 2 } } */
+/* { dg-final { scan-assembler-times "vblendvps" 4 } } */
+/* { dg-final { scan-assembler-times "vblendvpd" 4 } } */
+
+#include "avx2-pr54700-1.C"
diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr54700-1b.C b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-1b.C
new file mode 100644
index 0000000..03f9343
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-1b.C
@@ -0,0 +1,9 @@
+/* PR target/100648 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=c++14 -mavx512vl -mavx512bw -mno-xop" } */
+/* { dg-final { scan-assembler-not "pcmpgt\[bdq]" } } */
+/* { dg-final { scan-assembler-times "pblendvb" 2 } } */
+/* { dg-final { scan-assembler-times "blendvps" 4 } } */
+/* { dg-final { scan-assembler-times "blendvpd" 4 } } */
+
+#include "sse4_1-pr54700-1.C"
diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr54700-2a.C b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-2a.C
new file mode 100644
index 0000000..687a8c4
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-2a.C
@@ -0,0 +1,17 @@
+/* PR target/100648 */
+/* { dg-do run { target avx2 } } */
+/* { dg-options "-O2 -std=c++14 -mavx2 -mavx512vl -mavx512bw" } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx512f-helper.h"
+#endif
+
+#ifndef TEST
+#define TEST_test_256
+#endif
+
+#include CHECK_H
+#include "avx2-pr54700-2.C"
+
+#define AVX512VL
+#define AVX512BW
diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr54700-2b.C b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-2b.C
new file mode 100644
index 0000000..40450a9
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/avx512vl-pr54700-2b.C
@@ -0,0 +1,17 @@
+/* PR target/pr100648 */
+/* { dg-do run { target sse4 } } */
+/* { dg-options "-O2 -std=c++14 -msse4 -mavx512vl -mavx512bw -mno-xop" } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx512f-helper.h"
+#endif
+
+#ifndef TEST
+#define TEST_test_128
+#endif
+
+#include CHECK_H
+#include "sse4_1-pr54700-2.C"
+
+#define AVX512VL
+#define AVX512BW
diff --git a/gcc/testsuite/g++.target/i386/empty-class1.C b/gcc/testsuite/g++.target/i386/empty-class1.C
new file mode 100644
index 0000000..96a1fad
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/empty-class1.C
@@ -0,0 +1,9 @@
+// PR target/88529
+// { dg-do compile { target { c++11 && lp64 } } }
+// { dg-additional-options -fdump-rtl-expand }
+// { dg-final { scan-rtl-dump-not "set" "expand" } }
+// The x86_64 psABI says that f() doesn't put the return value anywhere.
+
+class A{};
+
+A f() { return {}; }
diff --git a/gcc/testsuite/g++.target/i386/empty-class2.C b/gcc/testsuite/g++.target/i386/empty-class2.C
new file mode 100644
index 0000000..b9317c5
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/empty-class2.C
@@ -0,0 +1,20 @@
+// PR middle-end/101160
+// Test passing aligned empty aggregate
+// { dg-do compile }
+// { dg-options "-O2" }
+// { dg-additional-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+
+struct S { union {} a; } __attribute__((aligned));
+
+S
+foo (S arg)
+{
+ return arg;
+}
+
+void
+bar (void)
+{
+ S arg;
+ foo (arg);
+}
diff --git a/gcc/testsuite/g++.target/i386/float16-1.C b/gcc/testsuite/g++.target/i386/float16-1.C
new file mode 100644
index 0000000..95d1ac2
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/float16-1.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-sse2" } */
+
+_Float16/* { dg-error "does not name a type" } */
+foo (_Float16 x)
+{
+ return x;
+}
diff --git a/gcc/testsuite/g++.target/i386/float16-2.C b/gcc/testsuite/g++.target/i386/float16-2.C
new file mode 100644
index 0000000..99eb797
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/float16-2.C
@@ -0,0 +1,14 @@
+/* { dg-do assemble { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+union flt
+{
+ _Float16 flt;
+ short s;
+};
+
+_Float16
+foo (union flt x)
+{
+ return x.flt;
+}
diff --git a/gcc/testsuite/g++.target/i386/float16-3.C b/gcc/testsuite/g++.target/i386/float16-3.C
new file mode 100644
index 0000000..9408785
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/float16-3.C
@@ -0,0 +1,10 @@
+/* { dg-do assemble { target avx512fp16 } } */
+/* { dg-options "-O0 -mavx512fp16" } */
+
+template <typename> void a(char *) {}
+char b, d;
+void c()
+{
+ a<unsigned char>(&d);
+ a<_Float16>(&b);
+}
diff --git a/gcc/testsuite/g++.target/i386/interference.C b/gcc/testsuite/g++.target/i386/interference.C
new file mode 100644
index 0000000..c7b910e
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/interference.C
@@ -0,0 +1,8 @@
+// Test C++17 hardware interference size constants
+// { dg-do compile { target c++17 } }
+
+#include <new>
+
+// It is generally agreed that these are the right values for all x86.
+static_assert(std::hardware_destructive_interference_size == 64);
+static_assert(std::hardware_constructive_interference_size == 64);
diff --git a/gcc/testsuite/g++.target/i386/mv16.C b/gcc/testsuite/g++.target/i386/mv16.C
index 9b29a1a..6839287 100644
--- a/gcc/testsuite/g++.target/i386/mv16.C
+++ b/gcc/testsuite/g++.target/i386/mv16.C
@@ -88,6 +88,10 @@ int __attribute__ ((target("arch=alderlake"))) foo () {
return 23;
}
+int __attribute__ ((target("arch=rocketlake"))) foo () {
+ return 24;
+}
+
int main ()
{
int val = foo ();
@@ -124,6 +128,8 @@ int main ()
assert (val == 22);
else if (__builtin_cpu_is ("alderlake"))
assert (val == 23);
+ else if (__builtin_cpu_is ("rocketlake"))
+ assert (val == 24);
else
assert (val == 0);
diff --git a/gcc/testsuite/g++.target/i386/mv30.C b/gcc/testsuite/g++.target/i386/mv30.C
new file mode 100644
index 0000000..b4947f0
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/mv30.C
@@ -0,0 +1,50 @@
+// PR target/101696
+// Test that dispatching can choose the right multiversion
+// for x86-64 microarchitecture levels.
+
+// { dg-do run }
+// { dg-require-ifunc "" }
+// { dg-options "-O2" }
+
+#include <assert.h>
+
+int __attribute__ ((target("default")))
+foo ()
+{
+ return 0;
+}
+
+int __attribute__ ((target("arch=x86-64"))) foo () {
+ return 1;
+}
+
+int __attribute__ ((target("arch=x86-64-v2"))) foo () {
+ return 2;
+}
+
+int __attribute__ ((target("arch=x86-64-v3"))) foo () {
+ return 3;
+}
+
+int __attribute__ ((target("arch=x86-64-v4"))) foo () {
+ return 4;
+}
+
+
+int main ()
+{
+ int val = foo ();
+
+ if (__builtin_cpu_supports ("x86-64-v4"))
+ assert (val == 4);
+ else if (__builtin_cpu_supports ("x86-64-v3"))
+ assert (val == 3);
+ else if (__builtin_cpu_supports ("x86-64-v2"))
+ assert (val == 2);
+ else if (__builtin_cpu_supports ("x86-64"))
+ assert (val == 1);
+ else
+ assert (val == 0);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.target/i386/pr100581.C b/gcc/testsuite/g++.target/i386/pr100581.C
new file mode 100644
index 0000000..37cc9f1
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr100581.C
@@ -0,0 +1,9 @@
+/* PR target/100581 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mxop" } */
+
+typedef float __attribute__((__vector_size__(8))) v64f32;
+
+v64f32 af, bf, ff_a, ff_b;
+
+v64f32 f() { return ff_a > ff_b ? af : bf; }
diff --git a/gcc/testsuite/g++.target/i386/pr100637-1b.C b/gcc/testsuite/g++.target/i386/pr100637-1b.C
new file mode 100644
index 0000000..35b5df7
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr100637-1b.C
@@ -0,0 +1,17 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef unsigned char __attribute__((__vector_size__ (4))) __v4qu;
+typedef char __attribute__((__vector_size__ (4))) __v4qi;
+
+__v4qu au, bu;
+__v4qi as, bs;
+
+__v4qu uu (__v4qu a, __v4qu b) { return (a > b) ? au : bu; }
+__v4qu us (__v4qi a, __v4qi b) { return (a > b) ? au : bu; }
+__v4qi su (__v4qu a, __v4qu b) { return (a > b) ? as : bs; }
+__v4qi ss (__v4qi a, __v4qi b) { return (a > b) ? as : bs; }
+
+/* { dg-final { scan-assembler-times "pcmpeqb" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpgtb" 2 } } */
diff --git a/gcc/testsuite/g++.target/i386/pr100637-1w.C b/gcc/testsuite/g++.target/i386/pr100637-1w.C
new file mode 100644
index 0000000..a3ed06f
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr100637-1w.C
@@ -0,0 +1,17 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef unsigned short __attribute__((__vector_size__ (4))) __v2hu;
+typedef short __attribute__((__vector_size__ (4))) __v2hi;
+
+__v2hu au, bu;
+__v2hi as, bs;
+
+__v2hu uu (__v2hu a, __v2hu b) { return (a > b) ? au : bu; }
+__v2hu us (__v2hi a, __v2hi b) { return (a > b) ? au : bu; }
+__v2hi su (__v2hu a, __v2hu b) { return (a > b) ? as : bs; }
+__v2hi ss (__v2hi a, __v2hi b) { return (a > b) ? as : bs; }
+
+/* { dg-final { scan-assembler-times "pcmpeqw" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpgtw" 2 } } */
diff --git a/gcc/testsuite/g++.target/i386/pr100885.C b/gcc/testsuite/g++.target/i386/pr100885.C
new file mode 100644
index 0000000..bec08f7
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr100885.C
@@ -0,0 +1,144 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mavx512vl -mno-avx512bw -O2 -Wno-int-to-pointer-cast -std=c++14" } */
+
+#include<x86intrin.h>
+typedef unsigned char byte;
+enum ZoomLevel { ZOOM_LVL_COUNT };
+struct Colour {
+ unsigned data;
+ Colour(int data) : data(data) {}
+};
+struct Palette {
+ Colour palette[6];
+};
+enum BlitterMode { BM_COLOUR_REMAP };
+class Blitter {
+public:
+ struct BlitterParams {
+ int width;
+ int height;
+ int left;
+ int top;
+ void *dst;
+ };
+ virtual void Draw();
+};
+class Blitter_32bppAnim : public Blitter {
+protected:
+ unsigned short anim_buf;
+ Palette palette;
+ int LookupColourInPalette_index;
+ Colour LookupColourInPalette() {
+ return palette.palette[LookupColourInPalette_index];
+ }
+};
+__m128i _mm_set_epi64(__m64 __q0) {
+ __m128i __trans_tmp_5{(long long)__q0};
+ return __trans_tmp_5;
+}
+long _mm_storel_epi64___P, Draw_dsts;
+__m128i _mm_packus_epi16___B, _mm_subs_epu16___B, _mm_hadd_epi16___Y,
+ Draw_srcABCD, Draw___trans_tmp_10, Draw___trans_tmp_29, Draw___trans_tmp_7,
+ AlphaBlendTwoPixels___trans_tmp_12, AlphaBlendTwoPixels___trans_tmp_11,
+ AdjustBrightnessOfTwoPixels_from;
+int _mm_srli_epi16___B;
+class Blitter_32bppSSE_Base {
+public:
+ enum ReadMode { RM_WITH_MARGIN };
+ enum BlockType { BT_NONE };
+ struct SpriteData {
+ int infos[ZOOM_LVL_COUNT];
+ byte data;
+ };
+};
+byte *Draw_remap;
+short Draw_si_0;
+class Blitter_32bppSSE4_Anim : Blitter_32bppAnim, Blitter_32bppSSE_Base {
+ template <BlitterMode, ReadMode, BlockType, bool, bool>
+ void Draw(const BlitterParams *, ZoomLevel);
+ void Draw();
+};
+__m128i AdjustBrightnessOfTwoPixels() {
+ __m128i __trans_tmp_28, __trans_tmp_27, __trans_tmp_26, __trans_tmp_24,
+ __trans_tmp_23, __trans_tmp_22, __trans_tmp_21, __trans_tmp_20,
+ __trans_tmp_19, __trans_tmp_18, __trans_tmp_17, __trans_tmp_16,
+ __trans_tmp_14 = _mm_srli_epi16(AdjustBrightnessOfTwoPixels_from,
+ _mm_srli_epi16___B),
+ __trans_tmp_7;
+ char __trans_tmp_8;
+ __trans_tmp_7 = __m128i{__trans_tmp_8};
+ {
+ __m128i __trans_tmp_7;
+ char __trans_tmp_8;
+ __trans_tmp_7 = __m128i{__trans_tmp_8};
+ __trans_tmp_26 = __trans_tmp_7;
+ }
+ __trans_tmp_16 = (__v8hi)__trans_tmp_14 > (__v8hi)__trans_tmp_26;
+ __trans_tmp_17 = _mm_hadd_epi16(__trans_tmp_16, _mm_hadd_epi16___Y);
+ __trans_tmp_18 = _mm_hadd_epi16(__trans_tmp_17, _mm_hadd_epi16___Y);
+ __trans_tmp_19 = _mm_srli_epi16(__trans_tmp_18, _mm_srli_epi16___B);
+ {
+ __m128i __trans_tmp_7;
+ char __trans_tmp_8;
+ __trans_tmp_7 = __m128i{__trans_tmp_8};
+ __trans_tmp_27 = __trans_tmp_7;
+ }
+ __trans_tmp_20 = _mm_shuffle_epi8(__trans_tmp_19,
+ __trans_tmp_27);
+ {
+ __m128i __trans_tmp_7;
+ char __trans_tmp_8;
+ __trans_tmp_7 = __m128i{__trans_tmp_8};
+ __trans_tmp_28 = __trans_tmp_7;
+ }
+ __trans_tmp_21 = _mm_subs_epu16(__trans_tmp_28, _mm_subs_epu16___B);
+ __trans_tmp_22 = __m128i((__v8hu)__trans_tmp_21 * (__v8hu)__trans_tmp_20);
+ __trans_tmp_23 = __m128i((__v8hu)__trans_tmp_22 + (__v8hu)__trans_tmp_7);
+ __trans_tmp_24 = _mm_packus_epi16(__trans_tmp_23, _mm_packus_epi16___B);
+ return __trans_tmp_24;
+}
+template <BlitterMode, Blitter_32bppSSE_Base::ReadMode,
+ Blitter_32bppSSE_Base::BlockType, bool, bool>
+void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom) {
+ __m128i __trans_tmp_30;
+ Colour *dst_line = (Colour *)bp->dst + bp->left;
+ unsigned short *anim_line = &anim_buf + bp->top;
+ int effective_width;
+ SpriteData *sd = (SpriteData *)bp;
+ Colour *src_rgba_line = (Colour *)sd->data;
+ Draw___trans_tmp_29 = Draw___trans_tmp_7;
+ for (int y = bp->height; y; y--) {
+ Colour *dst = dst_line;
+ unsigned short *anim = anim_line;
+ anim += src_rgba_line[0].data;
+ dst += src_rgba_line[0].data;
+ int width_diff = Draw_si_0 - bp->width;
+ effective_width = width_diff ?: effective_width;
+ for (int x = effective_width; x; x--) {
+ int mvX2 = *(unsigned *)sd->infos[zoom], m = byte(mvX2);
+ __trans_tmp_30 = _mm_set_epi64(*(__m64_u *)dst);
+ Colour c0 = Draw_dsts, srcm(0), cmap = LookupColourInPalette().data & 40;
+ c0 = Draw_remap[m] ?: cmap;
+ c0 = m ? c0 : srcm;
+ Draw___trans_tmp_10 = __v2di{c0.data};
+ if (mvX2)
+ Draw_srcABCD = AdjustBrightnessOfTwoPixels();
+ if (src_rgba_line)
+ anim[1] = 0;
+ __m128i tmp;
+ __m128i dstAB = _mm_unpacklo_epi8(__trans_tmp_30, tmp);
+ AlphaBlendTwoPixels___trans_tmp_12 =
+ __m128i((__v8hu)Draw_srcABCD + (__v8hu)dstAB);
+ AlphaBlendTwoPixels___trans_tmp_11 = _mm_shuffle_epi8 (AlphaBlendTwoPixels___trans_tmp_12,
+ Draw___trans_tmp_7);
+ *(__m64_u *)_mm_storel_epi64___P =
+ (__m64)AlphaBlendTwoPixels___trans_tmp_11[0];
+ }
+ }
+}
+Blitter::BlitterParams Draw_bp;
+ZoomLevel Draw_zoom;
+void Blitter_32bppSSE4_Anim::Draw() {
+ Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, false>(&Draw_bp,
+ Draw_zoom);
+}
diff --git a/gcc/testsuite/g++.target/i386/pr101023a.C b/gcc/testsuite/g++.target/i386/pr101023a.C
new file mode 100644
index 0000000..04fb8b0
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr101023a.C
@@ -0,0 +1,63 @@
+// PR target/101023
+// { dg-do run { target { ! ia32 } } }
+// { dg-options "-O2 -mtune=opteron -mstackrealign --param=hot-bb-frequency-fraction=1" }
+
+struct S {
+ __attribute__((noipa)) int m1 ();
+ __attribute__((noipa)) void m2 ();
+};
+struct T {
+ __attribute__((noipa)) virtual S m3 ();
+};
+struct U : T {
+ int u;
+ __attribute__((noipa)) U (int);
+};
+int *a;
+S *b;
+int c;
+
+int
+S::m1 ()
+{
+ return 0;
+}
+
+void
+S::m2 ()
+{
+}
+
+S
+T::m3 ()
+{
+ return S ();
+}
+
+U::U (int) : u (4)
+{
+}
+
+__attribute__((noipa)) int
+foo ()
+{
+ if (a)
+ return 0;
+ U d(c);
+ S *e = b;
+ e->m2 ();
+ return e->m1();
+}
+
+int
+main ()
+{
+ register int r12 __asm ("r12") = 1;
+ register int rax __asm ("rax") = 2;
+ asm volatile ("" : "+r" (r12), "+r" (rax));
+ foo ();
+ asm volatile ("" : "+r" (r12));
+ if (r12 != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.target/i386/pr101023b.C b/gcc/testsuite/g++.target/i386/pr101023b.C
new file mode 100644
index 0000000..b19791c
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr101023b.C
@@ -0,0 +1,5 @@
+// PR target/101023
+// { dg-do run { target { ! ia32 } } }
+// { dg-options "-O2 -mno-red-zone -mtune=opteron -mstackrealign --param=hot-bb-frequency-fraction=1" }
+
+#include "pr101023a.C"
diff --git a/gcc/testsuite/g++.target/i386/pr102166.C b/gcc/testsuite/g++.target/i386/pr102166.C
new file mode 100644
index 0000000..751cd2c
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102166.C
@@ -0,0 +1,20 @@
+/* PR target/102166 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -std=c++14" } */
+
+#include<immintrin.h>
+__attribute__((target("amx-tile"))) void amx()
+{
+ _tile_loadd(0, 0, 0);
+ _tile_release();
+}
+
+__attribute__((target("amx-int8"))) void amxint8()
+{
+ _tile_dpbssd(0, 1, 2);
+}
+
+__attribute__((target("amx-bf16"))) void amxbf16()
+{
+ _tile_dpbf16ps (0, 1, 2);
+}
diff --git a/gcc/testsuite/g++.target/i386/pr80566-1.C b/gcc/testsuite/g++.target/i386/pr80566-1.C
new file mode 100644
index 0000000..29da31d
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr80566-1.C
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2 -march=haswell -mtune-ctrl=avx256_store_by_pieces" }
+
+#include <cstring>
+
+int *
+foo()
+{
+ int * p = new int[16];
+ memset(p,0,16*sizeof(int));
+ return p;
+}
+
+/* { dg-final { scan-assembler-times "vpxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
diff --git a/gcc/testsuite/g++.target/i386/pr80566-2.C b/gcc/testsuite/g++.target/i386/pr80566-2.C
new file mode 100644
index 0000000..9ffd2c8
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr80566-2.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-O2 -march=haswell -mtune-ctrl=avx256_move_by_pieces" }
+
+#include <cstring>
+
+int *
+foo(int * q)
+{
+ int * p = new int[16];
+ memcpy(q,p,16*sizeof(int));
+ return p;
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 4 } } */
diff --git a/gcc/testsuite/g++.target/i386/pr94185.C b/gcc/testsuite/g++.target/i386/pr94185.C
index 2b3f7a1..ed39980 100644
--- a/gcc/testsuite/g++.target/i386/pr94185.C
+++ b/gcc/testsuite/g++.target/i386/pr94185.C
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fPIE -fstack-protector-strong" } */
+/* { dg-require-effective-target pie } */
struct a {
int b;
diff --git a/gcc/testsuite/g++.target/i386/pr98218-1.C b/gcc/testsuite/g++.target/i386/pr98218-1.C
new file mode 100644
index 0000000..61ea4bf
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr98218-1.C
@@ -0,0 +1,20 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef unsigned int __attribute__((__vector_size__ (8))) v64u32;
+typedef int __attribute__((__vector_size__ (8))) v64s32;
+typedef float __attribute__((__vector_size__ (8))) v64f32;
+
+v64u32 au, bu;
+v64s32 as, bs;
+v64f32 af, bf;
+
+v64u32 tu (v64f32 a, v64f32 b) { return (a > b) ? au : bu; }
+v64s32 ts (v64f32 a, v64f32 b) { return (a > b) ? as : bs; }
+v64f32 fu (v64u32 a, v64u32 b) { return (a > b) ? af : bf; }
+v64f32 fs (v64s32 a, v64s32 b) { return (a > b) ? af : bf; }
+v64f32 ff (v64f32 a, v64f32 b) { return (a > b) ? af : bf; }
+
+/* { dg-final { scan-assembler-times "cmpltps" 3 } } */
+/* { dg-final { scan-assembler-times "pcmpgtd" 2 } } */
diff --git a/gcc/testsuite/g++.target/i386/pr99679-1.C b/gcc/testsuite/g++.target/i386/pr99679-1.C
new file mode 100644
index 0000000..36640a4
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr99679-1.C
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-Ofast -fipa-pta -mno-80387" }
+
+#include <stdarg.h>
+
+extern "C" void abort (void);
+
+void
+foo (int x, ...)
+{
+ long double ld;
+ va_list ap;
+ va_start (ap, x);
+ ld = va_arg (ap, long double);
+ if (ld)
+ abort ();
+} // { dg-error "x87 register return with x87 disabled" "" { target { ! ia32 } } }
diff --git a/gcc/testsuite/g++.target/i386/pr99679-2.C b/gcc/testsuite/g++.target/i386/pr99679-2.C
new file mode 100644
index 0000000..cbd3c49
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr99679-2.C
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-Ofast -fipa-pta -mgeneral-regs-only" }
+
+#include <stdarg.h>
+
+extern "C" void abort (void);
+
+void
+foo (int x, ...)
+{
+ double ld;
+ va_list ap;
+ va_start (ap, x);
+ ld = va_arg (ap, double); // { dg-error "SSE register argument with SSE disabled" "" { target { ! ia32 } } }
+ if (ld)
+ abort ();
+} // { dg-error "SSE register return with SSE disabled" "" { target { ! ia32 } } }
diff --git a/gcc/testsuite/g++.target/powerpc/pr99842.C b/gcc/testsuite/g++.target/powerpc/pr99842.C
new file mode 100644
index 0000000..922450e
--- /dev/null
+++ b/gcc/testsuite/g++.target/powerpc/pr99842.C
@@ -0,0 +1,188 @@
+/* PR target/99842 */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O3 -mdejagnu-cpu=power10 -Wno-return-type" } */
+
+/* Verify we do not ICE on the following noisy creduced test case. */
+
+enum { a, b, c, d };
+template <typename> struct e;
+template <typename g, typename h, typename k> struct e<g(h, k)> {
+ typedef h f;
+};
+template <typename> struct ac;
+template <typename ab> struct ac<const ab> : ac<ab> {};
+template <typename> struct l;
+template <typename, int, int m, int = 0, int = a, int = m> class n;
+template <typename> class o;
+template <typename, typename, typename> class ag;
+template <typename, typename, int = c> class af;
+template <typename> struct ad;
+template <typename ab> struct an {
+ typedef n<typename ab ::ah, ac<ab>::ai, ac<ab>::aj> f;
+};
+template <typename al> struct am { typedef o<al> f; };
+template <typename al, typename = typename ac<al>::ao,
+ typename = typename ac<al>::av>
+struct ak;
+template <typename al, typename ao> struct ak<al, ao, int> {
+ typedef typename am<al>::f f;
+};
+template <typename, typename, typename> struct aq;
+template <typename ar, typename as> struct aq<ar, ar, as> { typedef ar at; };
+template <typename ap> ap bf(const typename ad<ap>::f *);
+template <typename ap, int> ap aw(typename ad<ap>::f *ax) { return bf<ap>(ax); }
+typedef __attribute__((altivec(vector__))) double au;
+template <> struct ad<au> { typedef double f; };
+template <> au bf(const double *ax) { return __builtin_vec_vsx_ld(0, ax); }
+template <typename> struct az {};
+template <typename al> class o : public l<al> {
+public:
+ typedef typename ac<al>::ah ah;
+ template <typename ay> al &operator+=(const o<ay> &);
+};
+template <typename> struct l {};
+template <typename ba, typename bb, int bd> struct ac<af<ba, bb, bd>> {
+ typedef typename ba::ah ah;
+ enum { ai, aj };
+};
+template <typename, typename, int bd>
+class af
+ : public ak<
+ af<ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>,
+ n<double, -1, 1, 3>, bd>,
+ int, int>::f {};
+template <typename, typename, typename> struct be;
+template <typename bj, typename bg, typename g> void bi(bj, bg bm, g) {
+ typename an<bg>::f bk(bm);
+}
+template <typename bj, typename bg, typename g> void bl(bj, bg bm, g bp) {
+ be<bj, bg, g>::bn(a, bm, bp);
+}
+template <typename, typename, typename, typename> struct bo;
+class bs {
+public:
+ bs(double *, int);
+ double &operator()(int, int) { return bq[br]; }
+ template <typename bw, int> bw bt(int i, int j) {
+ double &bu = operator()(i, j);
+ return aw<bw, b>(&bu);
+ }
+ double *bq;
+ int br;
+};
+class ca : public bs {
+public:
+ ca(double *by, int bz) : bs(by, bz) {}
+};
+template <typename al> class ce : public am<al>::f {
+protected:
+ template <typename ay> void cb(l<ay>) {
+ af<ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>,
+ n<double, -1, 1, 3>>
+ cc;
+ bl(0, cc, az<typename ay::ah>());
+ }
+ template <typename> void ch(long);
+ template <typename ay> void ch(l<ay> cf) { cb(cf); }
+};
+template <typename cg, int aa, int m, int cl, int ci, int cj>
+struct ac<n<cg, aa, m, cl, ci, cj>> {
+ typedef cg ah;
+ typedef int av;
+};
+template <typename cg, int, int m, int, int, int>
+class n : public ce<n<cg, m, c>> {
+public:
+ template <typename ab> n(ab p) { n::template ch<ab>(p); }
+};
+template <typename bc, typename ba, typename bb> struct ac<ag<bc, ba, bb>> {
+ typedef ba ao;
+ typedef typename e<bc(typename ba::ah, typename bb::ah)>::f ah;
+ typedef typename aq<typename ac<ba>::av, typename ac<bb>::av, bc>::at av;
+};
+template <typename> class cm;
+template <typename, typename r, typename cs>
+class ag
+ : public cm<typename aq<typename ac<r>::av, typename ac<cs>::av, int>::at> {
+};
+template <typename>
+class cm : public ak<ag<int, n<double, 1, 1>, n<double, 1, 1>>>::f {};
+template <typename al>
+template <typename ay>
+al &o<al>::operator+=(const o<ay> &) {
+ af<ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>,
+ n<double, -1, 1, 3>>
+ co;
+ bi(0, co, int());
+}
+enum { cp };
+template <int> struct cq;
+template <typename> struct cr {
+ enum { q };
+ enum { ae = cq<q>::at };
+};
+template <> struct cq<cp> {
+ enum { at = d };
+};
+struct t {
+ template <typename ba, typename bb, typename s> static void bn(ba, bb, s) {
+ typedef typename bb::ah x;
+ x u;
+ bo<long, ca, x, ca>::bn(0, 0, ca(0, 0), ca(&u, 1), 0, 0, 0);
+ }
+};
+template <typename, typename bb, int = cr<bb>::ae> struct cu;
+template <typename cd, typename ba, typename bb, int ct, typename ah>
+struct be<cd, af<ba, bb, ct>, az<ah>> {
+ static void bn(cd, af<ba, bb> bm, az<ah>) {
+ ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>> da;
+ cu<ba, bb>::cv(c, da, bm);
+ }
+};
+template <typename al> struct cw {
+ template <typename bj>
+ static void
+ cv(bj, ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>,
+ n<double, -1, 1, 3> bx) {
+ double alpha;
+ ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>> bh;
+ al::cx(c, bh, bx, alpha);
+ }
+};
+template <typename ba, typename bb> struct cu<ba, bb, d> : cw<cu<ba, bb>> {
+ template <typename s> static void cx(s, ba, bb bx, typename af<ba, bb>::ah) {
+ ba cz;
+ t::bn(cz, bx, c);
+ }
+};
+template <typename dj, typename, bool>
+void db(__vector_quad *, __vector_pair &, dj);
+template <typename, typename, typename, typename, typename, typename, int>
+void dc(ca alhs) {
+ typedef au dj;
+ typedef au dd;
+ ca bh(alhs);
+ enum { de };
+ __vector_quad df, dg;
+ int j;
+ dd v;
+ __vector_pair dh;
+ __builtin_mma_assemble_pair(
+ &dh, (__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j),
+ (__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j));
+ db<dj, dd, true>(&df, dh, v);
+ __vector_pair di;
+ __builtin_mma_assemble_pair(
+ &di, (__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j),
+ (__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j));
+ db<dj, dd, true>(&dg, di, v);
+}
+template <typename bv, typename w, typename cy> struct bo<bv, w, double, cy> {
+ static void bn(bv, bv, w bh, cy, double, bv, double) {
+ dc<bv, double, w, double, cy, double, d>(bh);
+ }
+};
+void dm() {
+ n<double, 1, 1> dk(1), y(0);
+ y += dk;
+}
diff --git a/gcc/testsuite/g++.target/s390/mi-thunk.C b/gcc/testsuite/g++.target/s390/mi-thunk.C
new file mode 100644
index 0000000..7c25dc0
--- /dev/null
+++ b/gcc/testsuite/g++.target/s390/mi-thunk.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -fPIC" } */
+
+class A {
+public:
+ virtual int a (void);
+};
+
+class B {
+public:
+ virtual int b (void);
+};
+
+class C : public B, public A {
+public:
+ virtual int a (void);
+};
+
+int C::a (void) { return b(); }
+
+/* { dg-final { scan-assembler {\n_ZThn8_N1C1aEv:\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {\n_ZThn4_N1C1aEv:\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {\n\tjg\t.LTHUNK0@PLT\n} { target lp64 } } } */
diff --git a/gcc/testsuite/g++.target/s390/pr100281-1.C b/gcc/testsuite/g++.target/s390/pr100281-1.C
new file mode 100644
index 0000000..b82e27b
--- /dev/null
+++ b/gcc/testsuite/g++.target/s390/pr100281-1.C
@@ -0,0 +1,10 @@
+// PR C++/100281
+// { dg-do compile }
+
+typedef void * __attribute__((mode (SI))) __ptr32_t;
+
+void foo () {
+ unsigned int b = 100;
+ __ptr32_t a;
+ a = b; /* { dg-error "invalid conversion from 'unsigned int' to '__ptr32_t'.*" } */
+}
diff --git a/gcc/testsuite/g++.target/s390/pr100281-2.C b/gcc/testsuite/g++.target/s390/pr100281-2.C
new file mode 100644
index 0000000..58552be
--- /dev/null
+++ b/gcc/testsuite/g++.target/s390/pr100281-2.C
@@ -0,0 +1,9 @@
+// PR C++/100281
+// { dg-do compile }
+
+typedef int & __attribute__((mode (SI))) __ref32_t;
+
+void foo () {
+ unsigned int b = 100;
+ __ref32_t a = b; /* { dg-error "cannot bind non-const lvalue reference of type '__ref32_t'.*" } */
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-2.c b/gcc/testsuite/gcc.c-torture/compile/20030405-2.c
new file mode 100644
index 0000000..2e61f1f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030405-2.c
@@ -0,0 +1,58 @@
+/* PR optimization/10024 */
+extern int *allegro_errno;
+typedef long fixed;
+extern inline int
+fixfloor (fixed x)
+{
+ if (x >= 0)
+ return (x >> 16);
+ else
+ return ~((~x) >> 16);
+}
+extern inline int
+fixtoi (fixed x)
+{
+ return fixfloor (x) + ((x & 0x8000) >> 15);
+}
+extern inline fixed
+ftofix (double x)
+{
+ if (x > 32767.0)
+ {
+ *allegro_errno = 34;
+ return 0x7FFFFFFF;
+ }
+ if (x < -32767.0)
+ {
+ *allegro_errno = 34;
+ return -0x7FFFFFFF;
+ }
+ return (long) (x * 65536.0 + (x < 0 ? -0.5 : 0.5));
+}
+extern inline double
+fixtof (fixed x)
+{
+ return (double) x / 65536.0;
+}
+extern inline fixed
+fixdiv (fixed x, fixed y)
+{
+ if (y == 0)
+ {
+ *allegro_errno = 34;
+ return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF;
+ }
+ else
+ return ftofix (fixtof (x) / fixtof (y));
+}
+extern inline fixed
+itofix (int x)
+{
+ return x << 16;
+}
+
+int
+foo (int n)
+{
+ return fixtoi (fixdiv (itofix (512), itofix (n)));
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040304-2.c b/gcc/testsuite/gcc.c-torture/compile/20040304-2.c
new file mode 100644
index 0000000..146d42f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040304-2.c
@@ -0,0 +1,45 @@
+/* PR optimization/14235 */
+/* Origin: <senor_fjord@yahoo.com> */
+
+typedef signed char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef unsigned long long uint64_t;
+
+static const uint64_t LOW_BYTE_MASK = 0x00000000000000ffULL;
+static const uint64_t HIGH_BYTE_MASK = 0x000000000000ff00ULL;
+static const uint64_t WORD_MASK = 0x000000000000ffffULL;
+static const uint64_t DWORD_MASK = 0x00000000ffffffffULL;
+
+extern uint64_t *srca_mask;
+extern int *assert_thrown;
+
+void foo()
+{
+ uint64_t tempA = 0; /* actually a bunch of code to set A */
+ uint64_t tempB = 0; /* actually a bunch of code to set B */
+
+ /* cast A to right size */
+ tempA = (((*srca_mask == LOW_BYTE_MASK) ||
+ (*srca_mask == HIGH_BYTE_MASK)) ?
+ ((int8_t)tempA) :
+ ((*srca_mask == WORD_MASK) ?
+ ((int16_t)tempA) :
+ ((*srca_mask == DWORD_MASK) ?
+ ((int32_t)tempA) :
+ tempA)));
+
+ /* cast B to right size */
+ tempB = (((*srca_mask == LOW_BYTE_MASK) ||
+ (*srca_mask == HIGH_BYTE_MASK)) ?
+ ((int8_t)tempB) :
+ ((*srca_mask == WORD_MASK) ?
+ ((int16_t)tempB) :
+ ((*srca_mask == DWORD_MASK) ?
+ ((int32_t)tempB) :
+ tempB)));
+
+ if ((int) tempA > (int) tempB) {
+ *assert_thrown = 1;
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100106.c b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
new file mode 100644
index 0000000..7f98b4f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
@@ -0,0 +1,11 @@
+union a {
+ float _Complex b;
+ long long c;
+};
+
+void g(union a);
+
+void e() {
+ union a f = {1.0f};
+ g(f);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100305.c b/gcc/testsuite/gcc.c-torture/compile/pr100305.c
new file mode 100644
index 0000000..43d78bf
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr100305.c
@@ -0,0 +1,13 @@
+/* PR target/100305 */
+
+typedef double v2df __attribute__((vector_size(16)));
+
+#define N 4096
+void consume (void *);
+v2df
+foo (void)
+{
+ double x[N+2];
+ consume (x);
+ return (v2df) { x[N], x[N + 1] };
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100576.c b/gcc/testsuite/gcc.c-torture/compile/pr100576.c
new file mode 100644
index 0000000..f2f40ec
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr100576.c
@@ -0,0 +1,12 @@
+/* PR middle-end/100576 */
+
+const char v[] = {0x12};
+
+void
+foo (const char *p)
+{
+ int b = sizeof v;
+ int n = memcmp (p, v, b);
+ if (n)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr101159.c b/gcc/testsuite/gcc.c-torture/compile/pr101159.c
new file mode 100644
index 0000000..81b2d2c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr101159.c
@@ -0,0 +1,10 @@
+/* PR tree-optimization/101159 */
+
+unsigned long a;
+long b;
+
+void
+foo (void)
+{
+ a += __builtin_popcountl (b);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr101437.c b/gcc/testsuite/gcc.c-torture/compile/pr101437.c
new file mode 100644
index 0000000..96e7df8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr101437.c
@@ -0,0 +1,29 @@
+/* PR middle-end/101437 */
+
+struct S { int : 1; };
+
+void
+foo (volatile struct S *p)
+{
+ struct S s = {};
+ *p = s;
+}
+
+void
+bar (volatile struct S *p)
+{
+ *p;
+}
+
+void
+baz (volatile struct S *p)
+{
+ struct S s;
+ s = *p;
+}
+
+void
+qux (volatile struct S *p, volatile struct S *q)
+{
+ *p = *q;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr10153-1.c b/gcc/testsuite/gcc.c-torture/compile/pr10153-1.c
new file mode 100644
index 0000000..3f2040f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr10153-1.c
@@ -0,0 +1,7 @@
+typedef int V __attribute__ ((vector_size (2 * sizeof (int))));
+V
+foo (void)
+{
+ V v = { };
+ return v - foo();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr10153-2.c b/gcc/testsuite/gcc.c-torture/compile/pr10153-2.c
new file mode 100644
index 0000000..1af4c8e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr10153-2.c
@@ -0,0 +1,9 @@
+typedef int V __attribute__ ((vector_size (2 * sizeof (int))));
+V
+foo (int t)
+{
+ if (t < 10)
+ return (V){1, 1};
+ V v = { };
+ return v - foo(t - 1);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr101562.c b/gcc/testsuite/gcc.c-torture/compile/pr101562.c
new file mode 100644
index 0000000..ea4a5f7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr101562.c
@@ -0,0 +1,21 @@
+/* PR rtl-optimization/101562 */
+
+struct S { char c; };
+void baz (struct S a, struct S b);
+
+void
+foo (void)
+{
+ struct S x[1];
+ *(short *)&x[0] = 256;
+ baz (x[0], x[1]);
+}
+
+void
+bar (void)
+{
+ struct S x[1];
+ x[0].c = 0;
+ x[1].c = 1;
+ baz (x[0], x[1]);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr101642.c b/gcc/testsuite/gcc.c-torture/compile/pr101642.c
new file mode 100644
index 0000000..f8b96f0
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr101642.c
@@ -0,0 +1,17 @@
+/* PR middle-end/101642 */
+
+int x;
+
+unsigned short
+foo (void)
+{
+ return __builtin_bswap16 (x) ? : 0;
+}
+
+int
+bar (int x, int y)
+{
+ unsigned short a = __builtin_bswap16 ((unsigned short) x);
+ unsigned short b = __builtin_bswap16 ((unsigned short) y);
+ return a == b;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr61159.c b/gcc/testsuite/gcc.c-torture/compile/pr61159.c
index 5afa6ea..dadd9c0 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr61159.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr61159.c
@@ -1,5 +1,6 @@
/* { dg-require-alias "" } */
/* { dg-require-weak "" } */
+/* { dg-xfail-if "weak alias" { powerpc-ibm-aix* } } */
static int dummy = 0;
extern int foo __attribute__((__weak__, __alias__("dummy")));
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr83510.c b/gcc/testsuite/gcc.c-torture/compile/pr83510.c
index 907dd80..7f222fa 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr83510.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr83510.c
@@ -4,6 +4,37 @@
/* { dg-options "-Warray-bounds" } */
+/* This test is XFAILed because thread1 threads a switch statement
+ such that the various cases have been split into different
+ independent blocks. One of these blocks exposes an arr[i_27]
+ which is later propagated by VRP to be arr[10]. This is an
+ invalid access, but the array bounds code doesn't know it is an
+ unreachable path.
+
+ However, it is not until dom2 that we "know" that the value of the
+ switch index is such that the path to arr[10] is unreachable. For
+ that matter, it is not until dom3 that we remove the unreachable
+ path.
+
+
+ See:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83510
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83312
+
+ It's not until here that ranger "knows" that the path is
+ unreachable:
+
+ thread1
+ vrp1 <-- array bounds checking
+ dce2
+ stdarg
+ cdce
+ cselim
+ copyprop
+ ifcombine
+ mergephi3 <-- too late
+*/
+
extern int get_flag (void);
unsigned int arr[10];
@@ -37,19 +68,6 @@ int g(struct xyz * ctx) {
return 0;
}
-static unsigned int f_signed(struct xyz * ctx, int number)
-{
- switch (number) {
- case 0x9:
- return ctx->a0;
- case 0xA: case 0xB:
- case 0xC: case 0xD: case 0xE: case 0xF:
- case 0x10: case 0x11: case 0x12: case 0x13:
- return arr[number];
- }
- return 0;
-}
-
int g_signed(struct xyz * ctx) {
int i;
@@ -70,16 +88,6 @@ void test_2 (struct xyz * ctx)
}
}
-void test_2_signed (struct xyz * ctx)
-{
- int i;
-
- for (i = 0; i < 10; i++) {
- if (get_flag ())
- wfm(ctx, i, f_signed(ctx, i));
- }
-}
-
void test_3 (struct xyz * ctx)
{
unsigned int i;
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr97141.c b/gcc/testsuite/gcc.c-torture/compile/pr97141.c
new file mode 100644
index 0000000..1a9ff83
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr97141.c
@@ -0,0 +1,8 @@
+int a;
+short b, c;
+short d(short e, short f) { return e + f; }
+void g(void) {
+ a = -9;
+ for (; a != 51; a = d(a, 5))
+ b |= c;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr98726.c b/gcc/testsuite/gcc.c-torture/compile/pr98726.c
new file mode 100644
index 0000000..ce24b18
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr98726.c
@@ -0,0 +1,7 @@
+int a, c;
+char b;
+int d() {
+ a = 0;
+ for (; a <= 21; a = (short)a + 1)
+ b &= c;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99647.c b/gcc/testsuite/gcc.c-torture/compile/pr99647.c
new file mode 100644
index 0000000..701155d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr99647.c
@@ -0,0 +1,5 @@
+/* { dg-do assemble } */
+typedef int __attribute((vector_size(16))) V;
+V f(void) {
+ return (V){ (int)f, (int)f, (int)f, (int)f };
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99822.c b/gcc/testsuite/gcc.c-torture/compile/pr99822.c
new file mode 100644
index 0000000..0660784
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr99822.c
@@ -0,0 +1,41 @@
+/* PR target/99822 */
+/* { dg-do assemble } */
+/* { dg-require-effective-target int128 } */
+
+int zt, bm, p5 = 1;
+
+void __attribute__ ((cold))
+l2 (unsigned long int hz)
+{
+ __int128 d9 = 0;
+ unsigned long int *mg = hz ? &hz : (unsigned long int *) &d9;
+
+ while (d9 < 1)
+ {
+ bm = bm > d9;
+ bm = bm == (d9 = bm || hz);
+
+ hz = 0x197000000;
+ d9 = hz * hz;
+
+ while (p5 < 1)
+ {
+ bm = ((hz = 3) ? zt : 0) > 0x1001;
+ if (bm != 0)
+ {
+ __int128 *nd = (__int128 *) bm;
+
+ *nd /= 3;
+ }
+
+ *mg = 0x1001;
+ p5 -= *mg;
+ }
+
+ for (zt = 0; zt >= 0; zt += 2)
+ d9 = 0;
+
+ d9 += 2;
+ }
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/ssa-unused-1.c b/gcc/testsuite/gcc.c-torture/compile/ssa-unused-1.c
new file mode 100644
index 0000000..e8fb93c7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/ssa-unused-1.c
@@ -0,0 +1,15 @@
+/* This is just to exercise the '__OPTIMIZE__' DejaGnu selector. */
+
+/* { dg-do "assemble" } */
+/* { dg-additional-options "-fdump-tree-ssa" } */
+
+void f()
+{
+ int unused = 3;
+ (void) &unused;
+}
+
+/* { dg-final { scan-tree-dump-not {No longer having address taken: unused} ssa { target { ! __OPTIMIZE__ } } } }
+ { dg-final { scan-tree-dump-times {No longer having address taken: unused} 1 ssa { target __OPTIMIZE__ } } } */
+/* { dg-final { scan-tree-dump-not {Now a gimple register: unused} ssa { target { ! __OPTIMIZE__ } } } }
+ { dg-final { scan-tree-dump-times {Now a gimple register: unused} 1 ssa { target __OPTIMIZE__ } } } */
diff --git a/gcc/testsuite/gcc.c-torture/execute/20210505-1.c b/gcc/testsuite/gcc.c-torture/execute/20210505-1.c
new file mode 100644
index 0000000..10a2de0
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20210505-1.c
@@ -0,0 +1,31 @@
+/* PR target/100402 */
+/* Testcase by Hannes Domani <ssbssa@yahoo.de> */
+
+/* { dg-require-effective-target indirect_jumps } */
+
+#include <setjmp.h>
+#include <stdbool.h>
+
+static jmp_buf buf;
+static _Bool stop = false;
+
+void call_func (void(*func)(void))
+{
+ func ();
+}
+
+void func (void)
+{
+ stop = true;
+ longjmp (buf, 1);
+}
+
+int main (void)
+{
+ setjmp (buf);
+
+ while (!stop)
+ call_func (func);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/950704-1.c b/gcc/testsuite/gcc.c-torture/execute/950704-1.c
index f11aff8..67fe088 100644
--- a/gcc/testsuite/gcc.c-torture/execute/950704-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/950704-1.c
@@ -1,3 +1,4 @@
+/* { dg-additional-options "-fwrapv" } */
int errflag;
long long
diff --git a/gcc/testsuite/gcc.c-torture/execute/alias-2.c b/gcc/testsuite/gcc.c-torture/execute/alias-2.c
index c62d506..6aeb0c2 100644
--- a/gcc/testsuite/gcc.c-torture/execute/alias-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/alias-2.c
@@ -1,4 +1,5 @@
/* { dg-require-alias "" } */
+/* { dg-skip-if "BSS alias" { powerpc-ibm-aix* } } */
int a[10]={};
extern int b[10] __attribute__ ((alias("a")));
int off;
diff --git a/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c b/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c
index d8e19e7..00517d1 100644
--- a/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c
@@ -9,10 +9,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "gcc_tmpnam.h"
int main (void)
{
- char *tmpfname = tmpnam (0);
+ char *tmpfname = gcc_tmpnam (0);
FILE *f = fopen (tmpfname, "w");
if (!f)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h b/gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h
new file mode 100644
index 0000000..2136e6e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#ifndef GCC_TMPNAM
+#define GCC_TMPNAM
+static inline char *gcc_tmpnam(char *s)
+{
+ char *ret = tmpnam (s);
+ // Windows sometimes prepends a backslash to denote the current directory,
+ // so swallow that if it occurs
+ if (ret[0] == '\\')
+ ++ret;
+ return ret;
+}
+#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c
new file mode 100644
index 0000000..3ef5fad
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c
@@ -0,0 +1,126 @@
+/*
+ Program to test complex divide for correct results on selected values.
+ Checking known failure points.
+*/
+
+#include <float.h>
+
+extern void abort (void);
+extern void exit (int);
+
+extern int ilogb (double);
+int match (double _Complex, double _Complex);
+
+#define SMALL DBL_MIN
+#define MAXBIT DBL_MANT_DIG
+#define ERRLIM 6
+
+/*
+ Compare c (computed value) with z (expected value).
+ Return 0 if within allowed range. Return 1 if not.
+*/
+int match (double _Complex c, double _Complex z)
+{
+ double rz, iz, rc, ic;
+ double rerr, ierr, rmax;
+ int biterr;
+ rz = __real__ z;
+ iz = __imag__ z;
+ rc = __real__ c;
+ ic = __imag__ c;
+
+ if (__builtin_fabs (rz) > SMALL)
+ {
+ rerr = __builtin_fabs (rz - rc) / __builtin_fabs (rz);
+ }
+ else if (__builtin_fabs (rz) == 0.0)
+ {
+ rerr = __builtin_fabs (rc);
+ }
+ else
+ {
+ rerr = __builtin_fabs (rz - rc) / SMALL;
+ }
+
+ if (__builtin_fabs (iz) > SMALL)
+ {
+ ierr = __builtin_fabs (iz - ic) / __builtin_fabs (iz);
+ }
+ else if (__builtin_fabs (iz) == 0.0)
+ {
+ ierr = __builtin_fabs (ic);
+ }
+ else
+ {
+ ierr = __builtin_fabs (iz - ic) / SMALL;
+ }
+ rmax = __builtin_fmax(rerr, ierr);
+ biterr = 0;
+ if ( rmax != 0.0)
+ {
+ biterr = ilogb (rmax) + MAXBIT + 1;
+ }
+
+ if (biterr >= ERRLIM)
+ return 0;
+ else
+ return 1;
+}
+
+
+int main (int argc, char** argv)
+{
+ double _Complex a,b,c,z;
+ double xr[4], xi[4], yr[4], yi[4], zr[4], zi[4];
+ double cr, ci;
+ int i;
+ int ok = 1;
+ xr[0] = -0x1.16e7fad79e45ep+651;
+ xi[0] = -0x1.f7f75b94c6c6ap-860;
+ yr[0] = -0x1.2f40d8ff7e55ep+245;
+ yi[0] = -0x0.0000000004ebcp-1022;
+ zr[0] = 0x1.d6e4b0e282869p+405;
+ zi[0] = -0x1.e9095e311e706p-900;
+
+ xr[1] = -0x1.21ff587f953d3p-310;
+ xi[1] = -0x1.5a526dcc59960p+837;
+ yr[1] = 0x1.b88b8b552eaadp+735;
+ yi[1] = -0x1.873e2d6544d92p-327;
+ zr[1] = 0x1.65734a88b2de0p-961;
+ zi[1] = -0x1.927e85b8b5770p+101;
+
+ xr[2] = 0x1.4612e41aa8080p-846;
+ xi[2] = -0x0.0000000613e07p-1022;
+ yr[2] = 0x1.df9cd0d58caafp-820;
+ yi[2] = -0x1.e47051a9036dbp-584;
+ zr[2] = 0x1.9b194f3fffa32p-469;
+ zi[2] = 0x1.58a00ab740a6bp-263;
+
+ xr[3] = 0x1.cb27eece7c585p-355;
+ xi[3] = 0x0.000000223b8a8p-1022;
+ yr[3] = -0x1.74e7ed2b9189fp-22;
+ yi[3] = 0x1.3d80439e9a119p-731;
+ zr[3] = -0x1.3b35ed806ae5ap-333;
+ zi[3] = -0x0.05e01bcbfd9f6p-1022;
+
+
+ for (i = 0; i < 4; i++)
+ {
+ __real__ a = xr[i];
+ __imag__ a = xi[i];
+ __real__ b = yr[i];
+ __imag__ b = yi[i];
+ __real__ z = zr[i];
+ __imag__ z = zi[i];
+ c = a / b;
+ cr = __real__ c;
+ ci = __imag__ c;
+
+ if (!match (c,z)){
+ ok = 0;
+ }
+ }
+ if (!ok)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c
new file mode 100644
index 0000000..adf1ed9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c
@@ -0,0 +1,125 @@
+/*
+ Program to test complex divide for correct results on selected values.
+ Checking known failure points.
+*/
+
+#include <float.h>
+
+extern void abort (void);
+extern void exit (int);
+
+extern int ilogbf (float);
+int match (float _Complex, float _Complex);
+
+#define SMALL FLT_MIN
+#define MAXBIT FLT_MANT_DIG
+#define ERRLIM 6
+
+/*
+ Compare c (computed value) with z (expected value).
+ Return 0 if within allowed range. Return 1 if not.
+*/
+int match (float _Complex c, float _Complex z)
+{
+ float rz, iz, rc, ic;
+ float rerr, ierr, rmax;
+ int biterr;
+ rz = __real__ z;
+ iz = __imag__ z;
+ rc = __real__ c;
+ ic = __imag__ c;
+
+ if (__builtin_fabsf (rz) > SMALL)
+ {
+ rerr = __builtin_fabsf (rz - rc) / __builtin_fabsf (rz);
+ }
+ else if (__builtin_fabsf (rz) == 0.0)
+ {
+ rerr = __builtin_fabsf (rc);
+ }
+ else
+ {
+ rerr = __builtin_fabsf (rz - rc) / SMALL;
+ }
+
+ if (__builtin_fabsf (iz) > SMALL)
+ {
+ ierr = __builtin_fabsf (iz - ic) / __builtin_fabsf (iz);
+ }
+ else if (__builtin_fabsf (iz) == 0.0)
+ {
+ ierr = __builtin_fabsf (ic);
+ }
+ else
+ {
+ ierr = __builtin_fabsf (iz - ic) / SMALL;
+ }
+ rmax = __builtin_fmaxf(rerr, ierr);
+ biterr = 0;
+ if ( rmax != 0.0)
+ {
+ biterr = ilogbf (rmax) + MAXBIT + 1;
+ }
+
+ if (biterr >= ERRLIM)
+ return 0;
+ else
+ return 1;
+}
+
+
+int main(int argc, char** argv)
+{
+ float _Complex a,b,c,z;
+ float xr[4], xi[4], yr[4], yi[4], zr[4], zi[4];
+ float cr, ci;
+ int i;
+ int ok = 1;
+ xr[0] = 0x1.0b1600p-133;
+ xi[0] = 0x1.5e1c28p+54;
+ yr[0] = -0x1.cdec8cp-119;
+ yi[0] = 0x1.1e72ccp+32;
+ zr[0] = 0x1.38e502p+22;
+ zi[0] = -0x1.f89220p-129;
+
+ xr[1] = -0x1.b1bee2p+121;
+ xi[1] = -0x1.cb403ep-59;
+ yr[1] = 0x1.480000p-144;
+ yi[1] = -0x1.c66fc4p+5;
+ zr[1] = -0x1.60b8cap-34;
+ zi[1] = -0x1.e8b02ap+115;
+
+ xr[2] = -0x1.3f6e00p-97;
+ xi[2] = -0x1.c00000p-146;
+ yr[2] = 0x1.000000p-148;
+ yi[2] = -0x1.0c4e70p-91;
+ zr[2] = 0x1.aa50d0p-55;
+ zi[2] = -0x1.30c746p-6;
+
+ xr[3] = 0x1.000000p-148;
+ xi[3] = 0x1.f4bc04p-84;
+ yr[3] = 0x1.00ad74p-20;
+ yi[3] = 0x1.2ad02ep-85;
+ zr[3] = 0x1.1102ccp-127;
+ zi[3] = 0x1.f369a4p-64;
+
+ for (i = 0; i < 4; i++)
+ {
+ __real__ a = xr[i];
+ __imag__ a = xi[i];
+ __real__ b = yr[i];
+ __imag__ b = yi[i];
+ __real__ z = zr[i];
+ __imag__ z = zi[i];
+ c = a / b;
+ cr = __real__ c;
+ ci = __imag__ c;
+
+ if (!match (c,z)){
+ ok = 0;
+ }
+ }
+ if (!ok)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c
new file mode 100644
index 0000000..ffe9c34
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c
@@ -0,0 +1,168 @@
+/*
+ Program to test complex divide for correct results on selected values.
+ Checking known failure points.
+*/
+
+#include <float.h>
+
+extern void abort (void);
+extern void exit (int);
+
+extern int ilogbl (long double);
+int match (long double _Complex,long double _Complex);
+
+#define SMALL LDBL_MIN
+#define MAXBIT LDBL_MANT_DIG
+#define ERRLIM 6
+
+/*
+ Compare c (computed value) with z (expected value).
+ Return 0 if within allowed range. Return 1 if not.
+*/
+int match (long double _Complex c,long double _Complex z)
+{
+ long double rz, iz, rc, ic;
+ long double rerr, ierr, rmax;
+ int biterr;
+ rz = __real__ z;
+ iz = __imag__ z;
+ rc = __real__ c;
+ ic = __imag__ c;
+
+ if (__builtin_fabsl (rz) > SMALL)
+ {
+ rerr = __builtin_fabsl (rz - rc) / __builtin_fabsl(rz);
+ }
+ else if (__builtin_fabsl (rz) == 0.0)
+ {
+ rerr = __builtin_fabsl (rc);
+ }
+ else
+ {
+ rerr = __builtin_fabsl (rz - rc) / SMALL;
+ }
+
+ if (__builtin_fabsl (iz) > SMALL)
+ {
+ ierr = __builtin_fabsl (iz - ic) / __builtin_fabsl(iz);
+ }
+ else if (__builtin_fabsl (iz) == 0.0)
+ {
+ ierr = __builtin_fabsl (ic);
+ }
+ else
+ {
+ ierr = __builtin_fabsl (iz - ic) / SMALL;
+ }
+ rmax = __builtin_fmaxl (rerr, ierr);
+ biterr = 0;
+ if ( rmax != 0.0)
+ {
+ biterr = ilogbl (rmax) + MAXBIT + 1;
+ }
+
+ if (biterr >= ERRLIM)
+ return 0;
+ else
+ return 1;
+}
+
+
+int main (int argc, char** argv)
+{
+ long double _Complex a,b,c,z;
+ long double xr[4], xi[4], yr[4], yi[4], zr[4], zi[4];
+ long double cr, ci;
+ int i;
+ int ok = 1;
+
+#if (LDBL_MAX_EXP < 2048)
+ /*
+ Test values when mantissa is 11 or fewer bits. Either LDBL is
+ using DBL on this platform or we are using IBM extended double
+ precision. Test values will be automatically truncated when
+ the available precision is smaller than the explicit precision.
+ */
+ xr[0] = -0x1.16e7fad79e45ep+651;
+ xi[0] = -0x1.f7f75b94c6c6ap-860;
+ yr[0] = -0x1.2f40d8ff7e55ep+245;
+ yi[0] = -0x0.0000000004ebcp-968;
+ zr[0] = 0x1.d6e4b0e2828694570ba839070beep+405L;
+ zi[0] = -0x1.e9095e311e70498db810196259b7p-846L;
+
+ xr[1] = -0x1.21ff587f953d3p-310;
+ xi[1] = -0x1.5a526dcc59960p+837;
+ yr[1] = 0x1.b88b8b552eaadp+735;
+ yi[1] = -0x1.873e2d6544d92p-327;
+ zr[1] = 0x1.65734a88b2ddff699c482ee8eef6p-961L;
+ zi[1] = -0x1.927e85b8b576f94a797a1bcb733dp+101L;
+
+ xr[2] = 0x1.4612e41aa8080p-846;
+ xi[2] = -0x0.0000000613e07p-968;
+ yr[2] = 0x1.df9cd0d58caafp-820;
+ yi[2] = -0x1.e47051a9036dbp-584;
+ zr[2] = 0x1.9b194f3aaadea545174c5372d8p-415L;
+ zi[2] = 0x1.58a00ab740a6ad3249002f2b79p-263L;
+
+ xr[3] = 0x1.cb27eece7c585p-355;
+ xi[3] = 0x0.000000223b8a8p-968;
+ yr[3] = -0x1.74e7ed2b9189fp-22;
+ yi[3] = 0x1.3d80439e9a119p-731;
+ zr[3] = -0x1.3b35ed806ae5a2a8cc1c9a96931dp-333L;
+ zi[3] = -0x1.7802c17c774895bd541adeb200p-974L;
+#else
+ /*
+ Test values intended for either IEEE128 or Intel80 formats. In
+ either case, 15 bits of exponent are available. Test values will
+ be automatically truncated when the available precision is smaller
+ than the explicit precision.
+ */
+ xr[0] = -0x9.c793985b7d029d90p-8480L;
+ xi[0] = 0x8.018745ffa61a8fe0p+16329L;
+ yr[0] = -0xe.d5bee9c523a35ad0p-15599L;
+ yi[0] = -0xa.8c93c5a4f94128f0p+869L;
+ zr[0] = -0x1.849178451c035b95d16311d0efdap+15459L;
+ zi[0] = -0x1.11375ed2c1f58b9d047ab64aed97p-1008L;
+
+ xr[1] = 0xb.68e44bc6d0b91a30p+16026L;
+ xi[1] = 0xb.ab10f5453e972f30p-14239L;
+ yr[1] = 0x8.8cbd470705428ff0p-16350L;
+ yi[1] = -0xa.0c1cbeae4e4b69f0p+347L;
+ zr[1] = 0x1.eec40848785e500d9f0945ab58d3p-1019L;
+ zi[1] = 0x1.22b6b579927a3f238b772bb6dc95p+15679L;
+
+ xr[2] = -0x9.e8c093a43b546a90p+15983L;
+ xi[2] = 0xc.95b18274208311e0p-2840L;
+ yr[2] = -0x8.dedb729b5c1b2ec0p+8L;
+ yi[2] = 0xa.a49fb81b24738370p-16385L;
+ zr[2] = 0x1.1df99ee89bb118f3201369e06576p+15975L;
+ zi[2] = 0x1.571e7ef904d6b6eee7acb0dcf098p-418L;
+
+ xr[3] = 0xc.4687f251c0f48bd0p-3940L;
+ xi[3] = -0xe.a3f2138992d85fa0p+15598L;
+ yr[3] = 0xe.4b0c25c3d5ebb830p-16344L;
+ yi[3] = -0xa.6cbf1ba80f7b97a0p+78L;
+ zr[3] = 0x1.6785ba23bfb744cee97b4142348bp+15520L;
+ zi[3] = -0x1.ecee7b8c7bdd36237eb538324289p-902L;
+#endif
+
+ for (i = 0; i < 4; i++)
+ {
+ __real__ a = xr[i];
+ __imag__ a = xi[i];
+ __real__ b = yr[i];
+ __imag__ b = yi[i];
+ __real__ z = zr[i];
+ __imag__ z = zi[i];
+ c = a / b;
+ cr = __real__ c;
+ ci = __imag__ c;
+
+ if (!match (c,z)){
+ ok = 0;
+ }
+ }
+ if (!ok)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x
new file mode 100644
index 0000000..f798152
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x
@@ -0,0 +1,4 @@
+if { [check_effective_target_c99_runtime] } {
+ return 0
+}
+return 1
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.x
index 1922b14..3ae2096 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.x
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.x
@@ -4,9 +4,3 @@ if { [istarget "tic6x-*-*"] && [check_effective_target_ti_c67x] } {
return 1
}
return 0
-if { [istarget "tic6x-*-*"] && [check_effective_target_ti_c67x] } {
- # C6X uses -freciprocal-math by default.
- set torture_execute_xfail "tic6x-*-*"
- return 1
-}
-return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr102134.c b/gcc/testsuite/gcc.c-torture/execute/pr102134.c
new file mode 100644
index 0000000..55cf4eb
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr102134.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/102134 */
+
+typedef unsigned long long u64;
+
+u64 g;
+
+void
+foo (u64 a, u64 b, u64 c, u64 *r)
+{
+ b *= b;
+ u64 x = a && ((b >> (c & 63)) | ((b << (c & 63)) & g));
+ *r = x + a;
+}
+
+int
+main ()
+{
+ u64 x;
+ foo (1, 3000, 0, &x);
+ if (x != 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr92618.c b/gcc/testsuite/gcc.c-torture/execute/pr92618.c
index 2a5e565..88f2f68 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr92618.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr92618.c
@@ -1,6 +1,6 @@
/* PR tree-optimization/92618 */
-typedef long long __m128i __attribute__((__may_alias__, __vector_size__(2 * sizeof (long long))));
+typedef long long __m128i __attribute__((__vector_size__(2 * sizeof (long long)),__may_alias__));
double a[4];
unsigned long long b[4];
@@ -14,7 +14,7 @@ bar (void)
}
#if __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__
-typedef double __m128d __attribute__((__may_alias__, __vector_size__(2 * sizeof (double))));
+typedef double __m128d __attribute__((__vector_size__(2 * sizeof (double)),__may_alias__));
__attribute__((noipa)) __m128i
qux (void)
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr98736.c b/gcc/testsuite/gcc.c-torture/execute/pr98736.c
new file mode 100644
index 0000000..c066abc
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr98736.c
@@ -0,0 +1,14 @@
+/* PR tree-optimization/98736 */
+
+int a[6];
+char b, c;
+int main() {
+ int d[4] = {0, 0, 0, 0};
+ for (c = 0; c <= 5; c++) {
+ for (b = 2; b != 0; b++)
+ a[c] = 8;
+ a[c] = d[3];
+ }
+ if (a[0] != 0)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr99751.c b/gcc/testsuite/gcc.c-torture/execute/pr99751.c
new file mode 100644
index 0000000..f1d5101
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr99751.c
@@ -0,0 +1,20 @@
+int *ptr1 = 0, **ptr2 = &ptr1;
+
+int *identity(int *p)
+{
+ return p;
+}
+
+void store_to_c(int *p)
+{
+ *ptr2 = identity(p);
+}
+
+int main()
+{
+ int f;
+ store_to_c(&f);
+ if (ptr1 != &f)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/printf-2.c b/gcc/testsuite/gcc.c-torture/execute/printf-2.c
index 4e7d8f7..2087bba 100644
--- a/gcc/testsuite/gcc.c-torture/execute/printf-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/printf-2.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "gcc_tmpnam.h"
__attribute__ ((noipa)) void
write_file (void)
@@ -26,7 +27,7 @@ write_file (void)
int main (void)
{
- char *tmpfname = tmpnam (0);
+ char *tmpfname = gcc_tmpnam (0);
FILE *f = freopen (tmpfname, "w", stdout);
if (!f)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/user-printf.c b/gcc/testsuite/gcc.c-torture/execute/user-printf.c
index 42a3b17..bfee076 100644
--- a/gcc/testsuite/gcc.c-torture/execute/user-printf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/user-printf.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "gcc_tmpnam.h"
void __attribute__ ((format (printf, 1, 2), noipa))
user_print (const char *fmt, ...)
@@ -23,7 +24,7 @@ user_print (const char *fmt, ...)
int main (void)
{
- char *tmpfname = tmpnam (0);
+ char *tmpfname = gcc_tmpnam (0);
FILE *f = freopen (tmpfname, "w", stdout);
if (!f)
{
diff --git a/gcc/testsuite/gcc.dg/20030612-2.c b/gcc/testsuite/gcc.dg/20030612-2.c
new file mode 100644
index 0000000..f9f212c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20030612-2.c
@@ -0,0 +1,20 @@
+/* Derived from PR middle-end/168. */
+
+/* { dg-do compile } */
+/* { dg-options "-W" } */
+
+extern void foo ();
+
+unsigned char uc;
+unsigned short int usi;
+unsigned int ui;
+
+
+void bar()
+{
+ if (uc + usi >= ui) /* { dg-bogus "between signed and unsigned" } */
+ foo ();
+ if (uc * usi >= ui) /* { dg-bogus "between signed and unsigned" } */
+ foo ();
+}
+
diff --git a/gcc/testsuite/gcc.dg/Walloca-larger-than-4.c b/gcc/testsuite/gcc.dg/Walloca-larger-than-4.c
new file mode 100644
index 0000000..9d4c4e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloca-larger-than-4.c
@@ -0,0 +1,18 @@
+/* PR middle-end/100425 - missing -Walloca-larger-than with -O0
+ { dg-do compile }
+ { dg-options "-O0 -Wall -Walloca-larger-than=128" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void* alloca (size_t);
+
+void sink (void*);
+
+void warn_alloca_too_large (void)
+{
+ sink (alloca (1));
+ sink (alloca (128));
+ sink (alloca (129)); // { dg-warning "\\\[-Walloca-larger-than" }
+ sink (alloca (128 + 2)); // { dg-warning "\\\[-Walloca-larger-than" }
+ sink (alloca (1024)); // { dg-warning "\\\[-Walloca-larger-than" }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-29.c b/gcc/testsuite/gcc.dg/Warray-bounds-29.c
index 72c5d1c..44e5bd3 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-29.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-29.c
@@ -44,7 +44,7 @@ void test_narrow (void)
T (p1[-1]);
T (p1[ 0]);
T (p1[ 1]);
- T (p1[ 2]); /* { dg-warning "array subscript \\\[3, 4] is outside array bounds of .char\\\[3]." } */
+ T (p1[ 2]); /* { dg-warning "array subscript 3 is outside array bounds of .char\\\[3]." } */
T (p1[ 3]); /* { dg-warning "array subscript \\\[4, 5] is outside array bounds of .char\\\[3]." } */
T (&p1[-3]); /* { dg-warning "array subscript \\\[-2, -1] is outside array bounds of .char\\\[3]." "bug" { xfail *-*-* } } */
@@ -55,7 +55,7 @@ void test_narrow (void)
T (&p1[ 2]);
T (&p1[ 3]); /* { dg-warning "array subscript \\\[4, 6] is outside array bounds of .char\\\[3]." "bug" { xfail *-*-* } } */
- T (p2[-4]); /* { dg-warning "intermediate array offset 4 is outside array bounds of .char\\\[3]." } */
+ T (p2[-4]); /* { dg-warning "subscript \\\[-2, -1\\\] is outside array bounds of .char\\\[3]." } */
T (p2[-3]);
T (p2[-2]);
T (p2[-1]);
@@ -64,19 +64,19 @@ void test_narrow (void)
/* Even though the lower bound of p3's offsets is in bounds, in order
to subtract 4 from p3 and get a dereferenceable pointer its value
would have to be out-of-bounds. */
- T (p3[-4]); /* { dg-warning "intermediate array offset 4 is outside array bounds of .char\\\[3]." } */
+ T (p3[-4]); /* { dg-warning "array subscript -1 is outside array bounds of .char\\\[3]." } */
T (p3[-3]);
T (p3[-2]);
T (p3[-1]);
- T (p3[ 0]); /* { dg-warning "array subscript \\\[3, 6] is outside array bounds of .char\\\[3]." } */
+ T (p3[ 0]); /* { dg-warning "array subscript 3 is outside array bounds of .char\\\[3]." } */
T (p4[-4]); /* { dg-warning "intermediate array offset 4 is outside array bounds of .char\\\[3]." } */
T (p4[-3]); /* { dg-warning "intermediate array offset 4 is outside array bounds of .char\\\[3]." } */
T (p4[-2]); /* { dg-warning "intermediate array offset 4 is outside array bounds of .char\\\[3]." } */
/* The final subscripts below are invalid. */
- T (p4[-1]); /* { dg-warning "array subscript \\\[3, 7] is outside array bounds of .char\\\[3]." } */
- T (p4[ 0]); /* { dg-warning "array subscript \\\[4, 8] is outside array bounds of .char\\\[3]." } */
+ T (p4[-1]); /* { dg-warning "array subscript 3 is outside array bounds of .char\\\[3]." } */
+ T (p4[ 0]); /* { dg-warning "array subscript \\\[4, 5] is outside array bounds of .char\\\[3]." } */
}
@@ -114,7 +114,7 @@ void test_wide (void)
T (p1[ 0]);
T (p1[ 1]);
T (p1[ 2]);
- T (p1[ 3]); /* { dg-warning "array subscript \\\[4, 5] is outside array bounds of .\[a-z \]+\\\[4]." } */
+ T (p1[ 3]); /* { dg-warning "array subscript 4 is outside array bounds of .\[a-z \]+\\\[4]." } */
T (&p1[-1]);
T (&p1[ 0]);
@@ -133,18 +133,18 @@ void test_wide (void)
/* Even though the lower bound of p3's offsets is in bounds, in order
to subtract 5 from p3 and get a dereferenceable pointer its value
would have to be out-of-bounds. */
- T (p3[-5]); /* { dg-warning "intermediate array offset 5 is outside array bounds of .\[a-z \]+\\\[4]." } */
+ T (p3[-5]); /* { dg-warning "array subscript \\\[-2, -1\\\] is outside array bounds of .\[a-z \]+\\\[4]." } */
T (p3[-4]);
T (p3[-3]);
T (p3[-2]);
T (p3[-1]);
T (p3[ 0]);
- T (p3[ 1]); /* { dg-warning "array subscript \\\[4, 7] is outside array bounds of .\[a-z \]+\\\[4]." } */
+ T (p3[ 1]); /* { dg-warning "array subscript 4 is outside array bounds of .\[a-z \]+\\\[4]." } */
- T (p4[-5]); /* { dg-warning "intermediate array offset 5 is outside array bounds of .\[a-z \]+\\\[4]." } */
+ T (p4[-5]); /* { dg-warning "array subscript -1 is outside array bounds of .\[a-z \]+\\\[4]." } */
T (p4[-4]);
T (p4[-3]);
T (p4[-2]);
T (p4[-1]);
- T (p4[ 0]); /* { dg-warning "array subscript \\\[4, 8] is outside array bounds of .\[a-z \]+\\\[4]." } */
+ T (p4[ 0]); /* { dg-warning "array subscript 4 is outside array bounds of .\[a-z \]+\\\[4]." } */
}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-30.c b/gcc/testsuite/gcc.dg/Warray-bounds-30.c
index 048a95d..b837ad0 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-30.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-30.c
@@ -120,7 +120,7 @@ void test_global_short_2dim_array (void)
T (&p[1]);
T (&p[2]);
T (&p[3]);
- T (&p[16]); /* { dg-warning "subscript 16 is \(above|outside\) array bounds of .short int\\\[3]" } */
+ T (&p[16]); /* { dg-warning "subscript 16 is \(above|outside\) array bounds of .short int\\\[3]" "pr??????" { xfail *-*-* } } */
T (&p[MAX]); /* { dg-warning "subscript -?\[0-9\]+ is \(above|outside\) array bounds of .short int\\\[3]" } */
}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-31.c b/gcc/testsuite/gcc.dg/Warray-bounds-31.c
index 389afaf..921461a 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-31.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-31.c
@@ -174,7 +174,7 @@ void narrow_ptr_deref_range (ptrdiff_t i, size_t j)
T (*p);
p = S1 + SR (2, 3);
- T (*p); /* { dg-warning "array subscript \\\[2, 3] is outside array bounds of .char\\\[2]." } */
+ T (*p); /* { dg-warning "array subscript 2 is outside array bounds of .char\\\[2]." } */
p = S1 + SR (9, 99);
T (*p); /* { dg-warning "array subscript \\\[9, 99] is outside array bounds of .char\\\[2]." } */
@@ -198,7 +198,7 @@ void narrow_ptr_deref_range (ptrdiff_t i, size_t j)
T (*p);
p = S8 + SR (9, 123);
- T (*p); /* { dg-warning "array subscript \\\[9, 123] is outside array bounds of .char\\\[9]." } */
+ T (*p); /* { dg-warning "array subscript 9 is outside array bounds of .char\\\[9]." } */
{
const char *p1 = S3 + i;
@@ -226,7 +226,7 @@ void narrow_ptr_deref_range (ptrdiff_t i, size_t j)
T (*p1);
T (*p2);
T (*p3);
- T (*p4); /* { dg-warning "array subscript \\\[4, \[0-9\]+] is outside array bounds of .char\\\[4]." } */
+ T (*p4); /* { dg-warning "array subscript 4 is outside array bounds of .char\\\[4]." } */
T (*p5); /* { dg-warning "array subscript \\\[5, \[0-9\]+] is outside array bounds of .char\\\[4]." } */
}
}
@@ -241,7 +241,7 @@ void narrow_ptr_index_range (void)
T (p[SR (-8, 0)]);
T (p[SR (0, MAX)]);
T (p[SR (1, 9)]);
- T (p[SR (8, 9)]); /* { dg-warning "array subscript \\\[8, 9] is outside array bounds of .char\\\[8]." } */
+ T (p[SR (8, 9)]); /* { dg-warning "array subscript 8 is outside array bounds of .char\\\[8]." } */
p = S7 + SR (4, 6);
T (p[5]); /* { dg-warning "array subscript \\\[9, 11] is outside array bounds of .char\\\[8]." } */
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-32.c b/gcc/testsuite/gcc.dg/Warray-bounds-32.c
index 9b5f333..02dac65 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-32.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-32.c
@@ -87,7 +87,7 @@ void wide_ptr_deref_range (ptrdiff_t i, size_t j)
T (*p);
p = W8 + SR (9, 123);
- T (*p); /* { dg-warning "array subscript \\\[9, 123] is outside array bounds of .\[a-z \]+\\\[9]." } */
+ T (*p); /* { dg-warning "array subscript 9 is outside array bounds of .\[a-z \]+\\\[9]." } */
}
void wide_ptr_index_range (void)
@@ -99,7 +99,7 @@ void wide_ptr_index_range (void)
T (p[SR (-8, 0)]);
T (p[SR (0, MAX)]);
T (p[SR (1, 9)]);
- T (p[SR (8, 9)]); /* { dg-warning "array subscript \\\[8, 9] is outside array bounds of .\[a-z \]+\\\[8]." } */
+ T (p[SR (8, 9)]); /* { dg-warning "array subscript 8 is outside array bounds of .\[a-z \]+\\\[8]." } */
p = W7 + SR (4, 6);
T (p[5]); /* { dg-warning "array subscript \\\[9, 11] is outside array bounds of .\[a-z \]+\\\[8]." } */
@@ -123,7 +123,7 @@ void wide_ptr_index_range_1 (void)
int i = SR (1, 2);
const wchar_t *p1 = W2 + i;
- T (p1[2]); /* { dg-warning "array subscript \\\[3, 4] is outside array bounds of .\[a-z \]+\\\[3]." } */
+ T (p1[2]); /* { dg-warning "array subscript 3 is outside array bounds of .\[a-z \]+\\\[3]." } */
}
}
@@ -140,17 +140,17 @@ void wide_ptr_index_range_chain (void)
T (p1[-1]);
T (p1[0]);
T (p1[1]);
- T (p1[2]); /* { dg-warning "array subscript \\\[3, 4] is outside array bounds of .\[a-z \]+\\\[3]." } */
+ T (p1[2]); /* { dg-warning "array subscript 3 is outside array bounds of .\[a-z \]+\\\[3]." } */
- T (p2[-5]); /* { dg-warning "array subscript \\\[-3, -1] is outside array bounds of .\[a-z \]+\\\[3]." } */
- T (p2[-4]);
+ T (p2[-5]); /* { dg-warning "array subscript \\\[-3, -2] is outside array bounds of .\[a-z \]+\\\[3]." } */
+ T (p2[-4]); /* { dg-warning "array subscript \\\[-2, -1] is outside array bounds of .\[a-z \]+\\\[3]." } */
T (p2[-1]);
T (p2[0]);
- T (p2[1]); /* { dg-warning "array subscript \\\[3, 5] is outside array bounds of .\[a-z \]+\\\[3]." } */
+ T (p2[1]); /* { dg-warning "array subscript 3 is outside array bounds of .\[a-z \]+\\\[3]." } */
- T (p3[0]); /* { dg-warning "array subscript \\\[3, 6] is outside array bounds of .\[a-z \]+\\\[3]." } */
- T (p3[1]); /* { dg-warning "array subscript \\\[4, 7] is outside array bounds of .\[a-z \]+\\\[3]." } */
- T (p3[9999]); /* { dg-warning "array subscript \\\[10002, 10005] is outside array bounds of .\[a-z \]+\\\[3]." "" { target size20plus} } */
+ T (p3[0]); /* { dg-warning "array subscript 3 is outside array bounds of .\[a-z \]+\\\[3]." } */
+ T (p3[1]); /* { dg-warning "array subscript 4 is outside array bounds of .\[a-z \]+\\\[3]." } */
+ T (p3[9999]); /* { dg-warning "array subscript 10002 is outside array bounds of .\[a-z \]+\\\[3]." "" { target size20plus} } */
/* { dg-warning "array subscript \\\[-6382, -6379] is outside array bounds of .\[a-z \]+\\\[3]." "" { target { ! size20plus } } .-1 } */
/* Large offsets are indistinguishable from negative values. */
T (p3[DIFF_MAX]); /* { dg-warning "array subscript" "bug" { xfail *-*-* } } */
@@ -166,9 +166,9 @@ void wide_ptr_index_range_chain (void)
T (p1[-2]);
T (p1[1]);
T (p1[2]);
- T (p1[3]); /* { dg-warning "array subscript \\\[4, 5] is outside array bounds of .\[a-z \]+\\\[4]." } */
+ T (p1[3]); /* { dg-warning "array subscript 4 is outside array bounds of .\[a-z \]+\\\[4]." } */
- T (p3[1]); /* { dg-warning "array subscript \\\[4, 7] is outside array bounds of .\[a-z \]+\\\[4]." } */
+ T (p3[1]); /* { dg-warning "array subscript 4 is outside array bounds of .\[a-z \]+\\\[4]." } */
}
}
@@ -180,5 +180,5 @@ void wide_ptr_index_range_4 (void)
const wchar_t *p3 = p2 + i;
const wchar_t *p4 = p3 + i;
- T (p4[1]); /* { dg-warning "array subscript \\\[5, 9] is outside array bounds of .\[a-z \]+\\\[5]." } */
+ T (p4[1]); /* { dg-warning "array subscript 5 is outside array bounds of .\[a-z \]+\\\[5]." } */
}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-39.c b/gcc/testsuite/gcc.dg/Warray-bounds-39.c
index 8317656..cb00fa9 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-39.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-39.c
@@ -5,6 +5,8 @@
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
+#define NOIPA __attribute__ ((noipa))
+
typedef __SIZE_TYPE__ size_t;
extern void* memcpy (void*, const void*, size_t);
@@ -19,65 +21,65 @@ const char s1_0[1][0] = { };
char d[4];
-void* test_memcpy_s0_1 (void *d)
+NOIPA void* test_memcpy_s0_1 (void *d)
{
return memcpy (d, s0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_s0_2 (void *d)
+NOIPA void* test_memcpy_s0_2 (void *d)
{
return memcpy (d, s0, 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_s0_0_1 (void *d)
+NOIPA void* test_memcpy_s0_0_1 (void *d)
{
return memcpy (d, s0_0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_s0_0_2 (void *d)
+NOIPA void* test_memcpy_s0_0_2 (void *d)
{
return memcpy (d, s0_0, 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_s0_1_1 (void *d)
+NOIPA void* test_memcpy_s0_1_1 (void *d)
{
return memcpy (d, s0_1, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_s0_1_2 (void *d)
+NOIPA void* test_memcpy_s0_1_2 (void *d)
{
return memcpy (d, s0_1, 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_s1_0_1 (void *d)
+NOIPA void* test_memcpy_s1_0_1 (void *d)
{
return memcpy (d, s1_0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_s1_0_2 (void *d)
+NOIPA void* test_memcpy_s1_0_2 (void *d)
{
return memcpy (d, s1_0, 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memmove_s0_1 (void *d)
+NOIPA void* test_memmove_s0_1 (void *d)
{
return memmove (d, s0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memmove_s0_2 (void *d)
+NOIPA void* test_memmove_s0_2 (void *d)
{
return memmove (d, s0, 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memmove_s0_0_1 (void *d)
+NOIPA void* test_memmove_s0_0_1 (void *d)
{
return memmove (d, s0_0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memmove_s0_0_2 (void *d)
+NOIPA void* test_memmove_s0_0_2 (void *d)
{
return memmove (d, s0_0, 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
@@ -90,59 +92,60 @@ const struct Empty e0_0[0][0] = { };
const struct Empty e0_1[0][1] = { };
const struct Empty e1_0[1][0] = { };
-void* test_memcpy_e_1 (void *d)
+NOIPA void* test_memcpy_e_1 (void *d)
{
return memcpy (d, &e, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_e0_1 (void *d)
+NOIPA void* test_memcpy_e0_1 (void *d)
{
return memcpy (d, e0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_e0_0_1 (void *d)
+NOIPA void* test_memcpy_e0_0_1 (void *d)
{
return memcpy (d, e0_0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_e0_1_1 (void *d)
+NOIPA void* test_memcpy_e0_1_1 (void *d)
{
return memcpy (d, e0_1, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-void* test_memcpy_e1_0_1 (void *d)
+NOIPA void* test_memcpy_e1_0_1 (void *d)
{
return memcpy (d, e1_0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-char* test_strcpy_s0 (char *d)
+NOIPA char*
+test_strcpy_s0 (char *d) /* { dg-bogus "-Warray-bounds" "pr101679" { xfail *-*-* } } */
{
return strcpy (d, s0); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-char* test_strcpy_s0_0 (char *d)
+NOIPA char* test_strcpy_s0_0 (char *d)
{
return strcpy (d, s0_0[0]); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-char* test_strncpy_s0_1 (char *d)
+NOIPA char* test_strncpy_s0_1 (char *d)
{
return strncpy (d, s0, 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-char* test_strncpy_s0_2 (char *d)
+NOIPA char* test_strncpy_s0_2 (char *d)
{
return strncpy (d, s0, 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-char* test_strncpy_s0_0_1 (char *d)
+NOIPA char* test_strncpy_s0_0_1 (char *d)
{
return strncpy (d, s0_0[0], 1); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
-char* test_strncpy_s0_0_2 (char *d)
+NOIPA char* test_strncpy_s0_0_2 (char *d)
{
return strncpy (d, s0_0[0], 2); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" } */
}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-52.c b/gcc/testsuite/gcc.dg/Warray-bounds-52.c
index 729ad45..c7217ad 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-52.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-52.c
@@ -83,17 +83,17 @@ void ptr_idx_range (void)
i = SR (0, 1);
- T (i, (int[]){ }); // { dg-warning "array subscript \\\[0, 1] is outside array bounds of 'int\\\[0]'" }
+ T (i, (int[]){ }); // { dg-warning "array subscript 0 is outside array bounds of 'int\\\[0]'" }
T (i, (int[]){ 1 });
i = SR (1, 2);
- T (i, (int[]){ 1 }); // { dg-warning "array subscript \\\[1, 2] is outside array bounds of 'int\\\[1]'" }
+ T (i, (int[]){ 1 }); // { dg-warning "array subscript 1 is outside array bounds of 'int\\\[1]'" }
i = SR (2, 3);
T (i, (int[]){ 1, 2, 3 });
i = SR (3, 4);
- T (i, (int[]){ 2, 3, 4 }); // { dg-warning "array subscript \\\[3, 4] is outside array bounds of 'int\\\[3]'" }
+ T (i, (int[]){ 2, 3, 4 }); // { dg-warning "array subscript 3 is outside array bounds of 'int\\\[3]'" }
}
/* Some of the invalid accesses above also trigger -Wuninitialized.
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-53.c b/gcc/testsuite/gcc.dg/Warray-bounds-53.c
index 80db314..591cca2 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-53.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-53.c
@@ -83,17 +83,17 @@ void ptr_idx_range (void)
i = SR (0, 1);
- T (i, (int[]){ }); // { dg-warning "array subscript \\\[0, 1] is outside array bounds of 'int\\\[0]'" }
+ T (i, (int[]){ }); // { dg-warning "array subscript 0 is outside array bounds of 'int\\\[0]'" }
T (i, (int[]){ 1 });
i = SR (1, 2);
- T (i, (int[]){ 1 }); // { dg-warning "array subscript \\\[1, 2] is outside array bounds of 'int\\\[1]'" }
+ T (i, (int[]){ 1 }); // { dg-warning "array subscript 1 is outside array bounds of 'int\\\[1]'" }
i = SR (2, 3);
T (i, (int[]){ 1, 2, 3 });
i = SR (3, 4);
- T (i, (int[]){ 2, 3, 4 }); // { dg-warning "array subscript \\\[3, 4] is outside array bounds of 'int\\\[3]'" }
+ T (i, (int[]){ 2, 3, 4 }); // { dg-warning "array subscript 3 is outside array bounds of 'int\\\[3]'" }
}
/* Some of the invalid accesses above also trigger -Wuninitialized.
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-58.c b/gcc/testsuite/gcc.dg/Warray-bounds-58.c
index 849457e5..616145b 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-58.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-58.c
@@ -36,7 +36,7 @@ extern struct Ax ax;
void fax_extern (void)
{
- sink (strlen (ax.a - 2)); // { dg-warning "\\\[-Warray-bounds" "pr93514" { xfail *-*-* } }
+ sink (strlen (ax.a - 2)); // { dg-warning "\\\[-Warray-bounds" "pr93514" }
sink (strlen (ax.a - 1)); // { dg-warning "\\\[-Warray-bounds" "pr93514" { xfail *-*-* } }
sink (strlen (ax.a));
sink (strlen (ax.a + 123));
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-63.c b/gcc/testsuite/gcc.dg/Warray-bounds-63.c
index a3fc918..530e2c5 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-63.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-63.c
@@ -14,7 +14,7 @@ void sink (void*);
void byte_store_to_decl (void)
{
- struct S6 { char a[6]; } s; // { dg-message "referencing 's'" }
+ struct S6 { char a[6]; } s; // { dg-message "at offset 6 into object 's' of size 6" "note" }
char *p = (char*)&s;
@@ -27,7 +27,7 @@ void byte_store_to_decl (void)
void word_store_to_decl (void)
{
- struct S6 { char a[6]; } s; // { dg-message "referencing 's'" }
+ struct S6 { char a[6]; } s; // { dg-message "at offset 5 into object 's' of size 6" "note" }
char *p = (char*)&s;
@@ -43,7 +43,7 @@ void word_store_to_decl (void)
void word_store_to_alloc (void)
{
struct S6 { char a[6]; } *p;
- p = alloca (sizeof *p); // { dg-message "referencing an object of size 6 allocated by 'alloca'" }
+ p = alloca (sizeof *p); // { dg-message "at offset 5 into object of size 6 allocated by 'alloca'" "note" }
int16_t *q = (int16_t*)((char*)p + 1);
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-64.c b/gcc/testsuite/gcc.dg/Warray-bounds-64.c
index 88b88de..f5ebc3d 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-64.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-64.c
@@ -7,7 +7,7 @@
asks for.
{ dg-do compile }
- { dg-options "-O2 -Wall -Warray-parameter -Wno-vla-paramater" } */
+ { dg-options "-O2 -Wall -Warray-parameter -Wno-vla-parameter" } */
#define NOIPA __attribute__ ((noipa))
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-66.c b/gcc/testsuite/gcc.dg/Warray-bounds-66.c
index c61891f..6ab3398 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-66.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-66.c
@@ -117,14 +117,14 @@ void test_alloca_int16_range (unsigned n)
}
{
- p = alloca (UR (0, 1)); // { dg-message "object of size between 0 and 1 allocated by '__builtin_alloca'" }
+ p = alloca (UR (0, 1)); // { dg-message "at offset \\d+ into object of size \\\[0, 1] allocated by '__builtin_alloca'" "note" }
sink (p);
T (p[0]); // { dg-warning "subscript 'int16_t {aka short int}\\\[0\\\]' is partly outside array bounds of 'unsigned char\\\[1]'" }
T (p[1]); // { dg-warning "subscript 1 is outside array bounds of 'int16_t\\\[0]'" }
}
{
- p = alloca (UR (0, 2)); // { dg-message "object of size between 0 and 2 allocated by '__builtin_alloca'" }
+ p = alloca (UR (0, 2)); // { dg-message "at offset \\d+ into object of size \\\[0, 2] allocated by '__builtin_alloca'" "note" }
sink (p);
sink (p[0]);
sink (p[1]); // { dg-warning "subscript 1 is outside array bounds of 'int16_t\\\[1]'" }
@@ -132,7 +132,7 @@ void test_alloca_int16_range (unsigned n)
}
{
- p = alloca (UR (0, 3)); // { dg-message "object of size between 0 and 3 allocated by '__builtin_alloca'" }
+ p = alloca (UR (0, 3)); // { dg-message "at offset \\d+ into object of size \\\[0, 3] allocated by '__builtin_alloca'" "note" }
sink (p);
T (p[0]);
T (p[1]); // { dg-warning "subscript 'int16_t {aka short int}\\\[1\\\]' is partly outside array bounds of 'unsigned char\\\[3]'" }
@@ -141,7 +141,7 @@ void test_alloca_int16_range (unsigned n)
}
{
- p = alloca (UR (1, 3)); // { dg-message "object of size between 1 and 3 allocated by '__builtin_alloca'" }
+ p = alloca (UR (1, 3)); // { dg-message "at offset 1|2|3 into object of size \\\[1, 3] allocated by '__builtin_alloca'" "note" }
sink (p);
T (p[0]);
T (p[1]); // { dg-warning "subscript 'int16_t {aka short int}\\\[1\\\]' is partly outside array bounds of 'unsigned char\\\[3]'" }
@@ -150,7 +150,7 @@ void test_alloca_int16_range (unsigned n)
}
{
- p = alloca (UR (2, 3)); // { dg-message "object of size between 2 and 3 allocated by '__builtin_alloca'" }
+ p = alloca (UR (2, 3)); // { dg-message "at offset 2|4 into object of size \\\[2, 3] allocated by '__builtin_alloca'" "note" }
sink (p);
T (p[0]);
T (p[1]); // { dg-warning "subscript 'int16_t {aka short int}\\\[1\\\]' is partly outside array bounds of 'unsigned char\\\[3]'" }
@@ -159,7 +159,7 @@ void test_alloca_int16_range (unsigned n)
}
{
- p = alloca (UR (3, 4)); // { dg-message "object of size between 3 and 4 allocated by '__builtin_alloca'" }
+ p = alloca (UR (3, 4)); // { dg-message "at offset 4|6 into object of size \\\[3, 4] allocated by '__builtin_alloca'" "note" }
sink (p);
T (p[0]);
T (p[1]);
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-69.c b/gcc/testsuite/gcc.dg/Warray-bounds-69.c
index 5a95577..80503f8 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-69.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-69.c
@@ -1,6 +1,6 @@
/* Verify that storing a bigger vector into smaller space is diagnosed.
{ dg-do compile }
- { dg-options "-O2 -Warray-bounds" } */
+ { dg-options "-O2 -Warray-bounds -Wno-stringop-overflow" } */
typedef __INT16_TYPE__ int16_t;
typedef __attribute__ ((__vector_size__ (32))) char C32;
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-71.c b/gcc/testsuite/gcc.dg/Warray-bounds-71.c
new file mode 100644
index 0000000..425bb12
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-71.c
@@ -0,0 +1,7 @@
+/* Verify that -Warray-bounds suppression via #pragma GCC diagnostic
+ works at any call site in an inlining stack
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define IGNORE '1'
+#include "Warray-bounds-71.h"
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-71.h b/gcc/testsuite/gcc.dg/Warray-bounds-71.h
new file mode 100644
index 0000000..89d1068
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-71.h
@@ -0,0 +1,46 @@
+/* Verify that -Warray-bounds suppression via #pragma GCC diagnostic
+ works at any call site in an inlining stack
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+int a[4];
+
+void f1 (int *p, int i)
+{
+#pragma GCC diagnostic push
+#if IGNORE == '1'
+# pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+ p[i + 1] = 0;
+#pragma GCC diagnostic pop
+}
+
+void f2 (int *p, int i)
+{
+#pragma GCC diagnostic push
+#if IGNORE == '2'
+# pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+ f1 (p + 1, i + 1);
+#pragma GCC diagnostic pop
+}
+
+void f3 (int *p, int i)
+{
+#pragma GCC diagnostic push
+#if IGNORE == '3'
+# pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+ f2 (p + 1, i + 1);
+#pragma GCC diagnostic pop
+}
+
+void f4 (void)
+{
+#pragma GCC diagnostic push
+#if IGNORE == '4'
+# pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+ f3 (a, 1);
+#pragma GCC diagnostic pop
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-72.c b/gcc/testsuite/gcc.dg/Warray-bounds-72.c
new file mode 100644
index 0000000..eb3f664
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-72.c
@@ -0,0 +1,7 @@
+/* Verify that -Warray-bounds suppression via #pragma GCC diagnostic
+ works at any call site in an inlining stack
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define IGNORE '2'
+#include "Warray-bounds-71.h"
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-73.c b/gcc/testsuite/gcc.dg/Warray-bounds-73.c
new file mode 100644
index 0000000..50e2083
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-73.c
@@ -0,0 +1,7 @@
+/* Verify that -Warray-bounds suppression via #pragma GCC diagnostic
+ works at any call site in an inlining stack
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define IGNORE '3'
+#include "Warray-bounds-71.h"
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-74.c b/gcc/testsuite/gcc.dg/Warray-bounds-74.c
new file mode 100644
index 0000000..c59a876
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-74.c
@@ -0,0 +1,7 @@
+/* Verify that -Warray-bounds suppression via #pragma GCC diagnostic
+ works at any call site in an inlining stack
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define IGNORE '4'
+#include "Warray-bounds-71.h"
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-75.c b/gcc/testsuite/gcc.dg/Warray-bounds-75.c
new file mode 100644
index 0000000..306b176
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-75.c
@@ -0,0 +1,12 @@
+/* Sanity test for Warray-bounds-7[1-4].c. Also verify the expected
+ inlining stack.
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#include "Warray-bounds-71.h"
+
+// { dg-regexp "In function 'f1'," "In function f1" { target *-*-* } 0 }
+// { dg-regexp "inlined from 'f2' at \[^\\n\\r\]+\[\\n\\r\]" "inlined from f2" { target *-*-* } 0 }
+// { dg-regexp "inlined from 'f3' at \[^\\n\\r\]+\[\\n\\r\]" "inlined from f3" { target *-*-* } 0 }
+// { dg-regexp "inlined from 'f4' at \[^\\n\\r\]+\[\\n\\r\]" "inlined from f4" { target *-*-* } 0 }
+// { dg-message "Warray-bounds-71.h:\\d+:\\d+: warning: array subscript 6 is outside array bounds of 'int\\\[4]'" "warning" { target *-*-* } 0 }
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-76.c b/gcc/testsuite/gcc.dg/Warray-bounds-76.c
new file mode 100644
index 0000000..6711dc4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-76.c
@@ -0,0 +1,35 @@
+/* PR tree-optimization/86650 - -Warray-bounds missing inlining context
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+static void f0 (int *p, int i)
+{
+ p[i] = 0; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+// Expect two instances of the text below:
+// { dg-regexp "In function 'f0'," "first f0 prefix" { target *-*-* } 0 }
+// { dg-regexp "In function 'f0'," "second f0 prefix" { target *-*-* } 0 }
+
+static void f1 (int *p, int i) { f0 (p + 1, i + 1); }
+static void f2 (int *p, int i) { f1 (p + 1, i + 1); }
+
+extern int a2[2]; // { dg-note "'a2'" }
+
+void foo (void)
+{
+ f1 (a2 + 1, 1);
+}
+
+// { dg-regexp " +inlined from 'foo' at \[^:\]+Warray-bounds-76.c:21:\\d+:" "inlined from foo" }
+
+extern int a3[3]; // { dg-note "'a3'" }
+
+void bar (void)
+{
+ f2 (a3 + 1, 1);
+}
+
+// { dg-regexp " +inlined from 'f1' at \[^:\]+Warray-bounds-76.c:14:\\d+," "inlined from f1" }
+// { dg-regexp " +inlined from 'f2' at \[^:\]+Warray-bounds-76.c:15:\\d+," "inlined from f2" }
+// { dg-regexp " +inlined from 'bar' at \[^:\]+Warray-bounds-76.c:30:\\d+:" "inlined from bar" }
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-77.c b/gcc/testsuite/gcc.dg/Warray-bounds-77.c
new file mode 100644
index 0000000..6487613
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-77.c
@@ -0,0 +1,135 @@
+/* PR middle-end/100137 - -Warray-bounds false positive on varying offset
+ plus negative
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+extern char ax[], a1[1], a2[2], a3[3], a4[4], a5[5];
+
+int* ptr;
+#define X (*ptr++)
+
+
+__attribute__ ((noipa)) void
+array_plus_var_minus_cstint (int i, int j)
+{
+ {
+ const char *p = ax;
+ p += i;
+ X = p[-1];
+ X = p[-123];
+ }
+
+ {
+ const char *p = a1;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a2;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a3;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a4;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a5;
+ p += i;
+ p += j;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-5]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
+
+
+__attribute__ ((noipa)) void
+array_plus_var_minus_cstlong (long i, long j)
+{
+ {
+ const char *p = ax;
+ p += i;
+ X = p[-1];
+ X = p[-123];
+ }
+
+ {
+ const char *p = a1;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a2;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a3;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a4;
+ p += i;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ X = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = a5;
+ p += i;
+ p += j;
+ X = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-3]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-4]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-5]; // { dg-bogus "\\\[-Warray-bounds" }
+ X = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-78.c b/gcc/testsuite/gcc.dg/Warray-bounds-78.c
new file mode 100644
index 0000000..73c335f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-78.c
@@ -0,0 +1,109 @@
+/* PR tree-optimization/99475 - bogus -Warray-bounds accessing an array
+ element of empty structs
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Wno-strict-aliasing" } */
+
+typedef _Bool bool;
+
+#define NOIPA __attribute__ ((noipa))
+
+struct S { };
+
+extern struct S sa3[3];
+extern struct S sa2_3[2][3];
+extern struct S sa3_4_5[3][4][5];
+
+void sink (void*);
+
+
+NOIPA void access_sa3 (void)
+{
+ ((bool*)sa3)[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ ((bool*)sa3)[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ ((bool*)sa3)[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ ((bool*)sa3)[3] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void access_sa3_ptr (void)
+{
+ bool *p = (bool*)&sa3[0];
+
+ p[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[3] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void access_sa2_3_ptr (void)
+{
+ bool *p = (bool*)&sa2_3[0][0];
+
+ p[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[6] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+NOIPA void access_sa3_4_5_ptr (struct S s, int i)
+{
+ bool *p = (bool*)&sa3_4_5[0][0][0];
+
+ p[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[60] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+
+NOIPA void access_vla3 (struct S s, unsigned n)
+{
+ struct S vla3[3 < n ? 3 : n];
+
+ ((bool*)vla3)[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ ((bool*)vla3)[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ ((bool*)vla3)[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ ((bool*)vla3)[3] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+
+ sink (vla3);
+}
+
+NOIPA void access_vla3_ptr (struct S s, unsigned n)
+{
+ struct S vla3[3 < n ? 3 : n];
+ bool *p = (bool*)&vla3[0];
+
+ p[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[3] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+
+ sink (vla3);
+}
+
+NOIPA void access_vla2_3_ptr (struct S s, unsigned n)
+{
+ struct S vla2_3[2 < n ? 2 : n][3 < n ? 3 : n];
+ bool *p = (bool*)&vla2_3[0][0];
+
+ p[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[6] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+
+ sink (vla2_3);
+}
+
+NOIPA void access_vla3_4_5_ptr (struct S s, unsigned n)
+{
+ struct S vla3_4_5[3 < n ? 3 : n][4 < n ? 4 : n][5 < n ? 5 : n];
+ bool *p = (bool*)&vla3_4_5[0][0][0];
+
+ p[0] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+ p[60] = __LINE__; // { dg-warning "\\\[-Warray-bounds" }
+
+ sink (vla3_4_5);
+}
+
+// { dg-prune-output "empty struct has size 0 in C" }
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-79.c b/gcc/testsuite/gcc.dg/Warray-bounds-79.c
new file mode 100644
index 0000000..b44ac9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-79.c
@@ -0,0 +1,112 @@
+/* PR tree-optimization/99475 - bogus -Warray-bounds accessing an array
+ element of empty structs
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct S
+{
+#if SOME_CONFIG_MACRO
+ /* Suppose the contents are empty in the development configuration
+ but non-empty in others. Out of bounds accesses to elements of
+ the arrays below should be diagnosed in all configurations,
+ including when S is empty, even if they are folded away. */
+ int member;
+#endif
+};
+
+extern struct S sa3[3];
+extern struct S sa2_3[2][3];
+extern struct S sa3_4_5[3][4][5];
+
+void sink (void*);
+
+
+void access_sa3 (void)
+{
+ sa3[0] = (struct S){ };
+ sa3[1] = (struct S){ };
+ sa3[2] = (struct S){ };
+ sa3[3] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+void access_sa3_ptr (void)
+{
+ struct S *p = &sa3[0];
+
+ p[0] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[3] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+void access_sa2_3_ptr (void)
+{
+ struct S *p = &sa2_3[0][0];
+
+ p[0] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[6] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+void access_sa3_4_5_ptr (struct S s, int i)
+{
+ struct S *p = &sa3_4_5[0][0][0];
+
+ p[0] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[60] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+}
+
+
+void access_vla3 (struct S s, unsigned n)
+{
+ struct S vla3[3 < n ? 3 : n];
+
+ vla3[0] = (struct S){ };
+ vla3[1] = (struct S){ };
+ vla3[2] = (struct S){ };
+ vla3[3] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla3);
+}
+
+void access_vla3_ptr (struct S s, unsigned n)
+{
+ struct S vla3[3 < n ? 3 : n];
+ struct S *p = &vla3[0];
+
+ p[0] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[3] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla3);
+}
+
+void access_vla2_3_ptr (struct S s, unsigned n)
+{
+ struct S vla2_3[2 < n ? 2 : n][3 < n ? 3 : n];
+ struct S *p = &vla2_3[0][0];
+
+ p[0] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[6] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla2_3);
+}
+
+void access_vla3_4_5_ptr (struct S s, unsigned n)
+{
+ struct S vla3_4_5[3 < n ? 3 : n][4 < n ? 4 : n][5 < n ? 5 : n];
+ struct S *p = &vla3_4_5[0][0][0];
+
+ p[0] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[1] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[2] = (struct S){ }; // { dg-bogus "\\\[-Warray-bounds" }
+ p[60] = (struct S){ }; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ sink (vla3_4_5);
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-80.c b/gcc/testsuite/gcc.dg/Warray-bounds-80.c
new file mode 100644
index 0000000..4ef32fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-80.c
@@ -0,0 +1,96 @@
+/* PR tree-optimization/101397 - spurious warning writing to the result
+ of stpcpy minus 1
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+char* stpcpy (char*, const char*);
+
+void sink (int, ...);
+
+extern char ax[], a3[3], a5[5], *s;
+
+volatile int x;
+
+void test_stpcpy (int i)
+{
+ {
+ char *p = stpcpy (ax, s);
+ x = p[-9]; // { dg-bogus "\\\[-Warray-bounds" }
+ x = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ x = p[ 0];
+ x = p[+9];
+ }
+
+ {
+ char *p = stpcpy (a3, s);
+ x = p[-2]; // { dg-bogus "\\\[-Warray-bounds" }
+ x = p[-1]; // { dg-bogus "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = stpcpy (a3, s);
+ x = p[-3]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-2], p[-1], p[0], p[1], p[2]);
+ x = p[ 3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ /* Stpcpy always returns a pointer to the copied nul (which must
+ exist) and never a past-the-end pointer. As a result, P below
+ is in [a5, a5 + 4]. */
+ char *p = stpcpy (a5, s);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = stpcpy (a5 + 1, s);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3]);
+ x = p[ 4]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = stpcpy (a5 + 2, s);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2]);
+ x = p[ 3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = stpcpy (a5 + 3, s);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1]);
+ x = p[ 2]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ /* Because strlen (a3) is at most 2, the stpcpy call must return
+ a pointer in the range [ax, ax + 2], and so -3 is necessarily
+ out of bounds. */
+ char *p = stpcpy (ax, a3);
+ p[-3] = 1; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (i >= 0)
+ i = -1;
+
+ char *p = stpcpy (a3, s);
+ x = p[i]; // { dg-bogus "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (i >= -3)
+ i = -3;
+
+ char *p = stpcpy (a3, s);
+ p[i] = 1; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-81.c b/gcc/testsuite/gcc.dg/Warray-bounds-81.c
new file mode 100644
index 0000000..27e725d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-81.c
@@ -0,0 +1,302 @@
+/* PR tree-optimization/101397 - spurious warning writing to the result
+ of stpcpy minus 1
+ Verify warnings for indexing into a pointer returned from stpncpy.
+ The call stpncpy(S1, S2, N) returns the address of the copy of
+ the first NUL is it exists or &S1[N] otherwise.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Wno-stringop-truncation" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void* calloc (size_t, size_t);
+char* stpncpy (char*, const char*, size_t);
+
+void sink (int, ...);
+
+extern char ax[], a3[3], a5[5], a7[7], a9[9], *s;
+
+volatile int x;
+
+/* Verify warnings for indexing into the result of stpncpy with a source
+ pointing to an array of unknown bound. */
+
+void test_stpncpy_from_ptr (int i, int n)
+{
+ {
+ // P is in [ax, ax + 5].
+ char *p = stpncpy (ax, s, 5);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-5], p[-1], p[0], p[9]);
+ }
+
+ {
+ // P is in [a5, a5 + 3].
+ char *p = stpncpy (a5, s, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[ 1], p[ 2], p[ 3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // P is in [ax, ax + 4].
+ char *p = stpncpy (a5, s, 4);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[ 1], p[ 2], p[ 3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // P is in [ax, ax + 5].
+ char *p = stpncpy (a5, s, n);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[ 1], p[ 2], p[ 3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // P is in [ax, ax + 4].
+ char *p = stpncpy (a5, s, 4);
+
+ if (i > -1) i = -1;
+ x = p[i];
+
+ if (i > -2) i = -2;
+ x = p[i];
+
+ if (i > -3) i = -3;
+ x = p[i];
+
+ if (i > -4) i = -4;
+ x = p[i];
+
+ if (i > -5) i = -5;
+ x = p[i]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
+
+/* Verify warnings for indexing into the result of stpncpy with a source
+ an array of size 5. */
+
+void test_stpncpy_from_a5 (int i, int n, int n3_9)
+{
+ {
+ // The returned pointer is in [ax, ax + 3].
+ char *p = stpncpy (ax, a5, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0], p[1], p[99]);
+ }
+
+ {
+ // The returned pointer is in [ax, ax + 5].
+ char *p = stpncpy (ax, a5, 5);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+ {
+ //The returned pointer is in [ax, ax + 5] even though n is not known.
+ char *p = stpncpy (ax, a5, n);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-5], p[-4], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[9], p[99]);
+ }
+
+
+ {
+ // The returned pointer is in [a3, a3 + 3].
+ char *p = stpncpy (a3, a5, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[ 1], p[ 2]);
+ x = p[ 3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is in [a3, a3 + 3].
+ char *p = stpncpy (a3, a5, n);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[ 1], p[ 2]);
+ x = p[ 3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (n3_9 < 3 || 9 < n3_9)
+ n3_9 = 3;
+
+ // The returned pointer is in [a3, a3 + 3].
+ char *p = stpncpy (a3, a5, n3_9);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[ 1], p[ 2]);
+ x = p[ 3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = stpncpy (a3, a5, 3);
+
+ if (i > -1) i = -1;
+ x = p[i];
+
+ if (i > -2) i = -2;
+ x = p[i];
+
+ if (i > -3) i = -3;
+ x = p[i];
+
+ if (i > -4) i = -4;
+ x = p[i]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
+
+
+/* Verify warnings for indexing into the result of stpncpy with a source
+ an array of size 7. */
+
+void test_stpncpy_from_a7 (int i, int n, int n3_9)
+{
+ {
+ // The returned pointer is ax + 5.
+ char *p = stpncpy (ax, a7, 5);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+ {
+ //The returned pointer is in [ax, ax + 7] even though n is not known.
+ char *p = stpncpy (ax, a7, n);
+ x = p[-8]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-7], p[-6], p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]);
+ }
+
+
+ {
+ // The returned pointer is in [a5, a5 + 3].
+ char *p = stpncpy (a5, a7, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is a5 + 4.
+ char *p = stpncpy (a5, a7, 4);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is in [a5, a5 + 5].
+ char *p = stpncpy (a5, a7, n);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (n3_9 < 3 || 9 < n3_9)
+ n3_9 = 3;
+
+ // The returned pointer is in [a5, a5 + 5].
+ char *p = stpncpy (a5, a7, n3_9);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = stpncpy (a5, a7, 4);
+
+ if (i > -1) i = -1;
+ x = p[i];
+
+ if (i > -2) i = -2;
+ x = p[i];
+
+ if (i > -3) i = -3;
+ x = p[i];
+
+ if (i > -4) i = -4;
+ x = p[i];
+
+ if (i > -5) i = -5;
+ x = p[i]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
+
+
+void test_stpncpy_from_a5_to_allocated (int i, int n, int n5_7, int n3_9)
+{
+ if (n5_7 < 5 || 7 < n5_7)
+ n5_7 = 5;
+
+ {
+ char *d = calloc (n5_7, 1);
+ char *p = stpncpy (d, s, n);
+ x = p[-8]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-7], p[-6], p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *d = calloc (n5_7, 1);
+ char *p = stpncpy (d, a3, n);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *d = calloc (n5_7, 1);
+ char *p = stpncpy (d, a5, n);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *d = calloc (n5_7, 1);
+ char *p = stpncpy (d, a9, n);
+ x = p[-8]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-7], p[-6], p[-5], p[-3], p[-4], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *d = calloc (n5_7, 1);
+ char *p = stpncpy (d, a3, n3_9);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *d = calloc (n5_7, 1);
+ char *p = stpncpy (d, a9, n3_9);
+ x = p[-8]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-7], p[-6], p[-5], p[-4], p[-4], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-82.c b/gcc/testsuite/gcc.dg/Warray-bounds-82.c
new file mode 100644
index 0000000..b5dd919
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-82.c
@@ -0,0 +1,258 @@
+/* PR tree-optimization/101397 - spurious warning writing to the result
+ of stpcpy minus 1
+ Verify warnings for indexing into a pointer returned from mempcpy.
+ The call mempcpy(S1, S2, N) returns &S1[N].
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void* mempcpy (void*, const void*, size_t);
+
+extern char ax[], a3[3], a5[5], a7[7], *s;
+
+volatile int x;
+
+/* Verify warnings for indexing into the result of mempcpy with a source
+ pointing to an array of unknown bound. */
+
+void test_mempcpy_from_ptr (int i)
+{
+ {
+ char *p = mempcpy (ax, s, 5);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+ {
+ char *p = mempcpy (a5, s, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-3];
+ x = p[-2];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 1];
+ x = p[ 2]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = mempcpy (a5, s, 4);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-4];
+ x = p[-3];
+ x = p[-2];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 1]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = mempcpy (a5, s, 4);
+
+ if (i > -1) i = -1;
+ x = p[i];
+
+ if (i > -2) i = -2;
+ x = p[i];
+
+ if (i > -3) i = -3;
+ x = p[i];
+
+ if (i > -4) i = -4;
+ x = p[i];
+
+ if (i > -5) i = -5;
+ x = p[i]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
+
+/* Verify warnings for indexing into the result of mempcpy with a source
+ an array of size 5. */
+
+void test_mempcpy_from_a5 (int i, int n, int n3_9)
+{
+ {
+ // The returned pointer is ax + 3 as specified by the bound.
+ char *p = mempcpy (ax, a5, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-3];
+ x = p[-2];
+ x = p[ 0];
+ x = p[ 1];
+ x = p[ 2];
+ }
+
+ {
+ // The returned pointer is ax + 5.
+ char *p = mempcpy (ax, a5, 5);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+ {
+ //The returned pointer is in [ax, ax + 5] even though n is not known.
+ char *p = mempcpy (ax, a5, n);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+
+ {
+ // The returned pointer is a3 + 3.
+ char *p = mempcpy (a3, a5, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-3];
+ x = p[-1];
+ x = p[ 0]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[ 1]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is in [a3, a3 + 3].
+ char *p = mempcpy (a3, a5, n);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-3];
+ x = p[-2];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 2];
+ x = p[ 3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (n3_9 < 3 || 9 < n3_9)
+ n3_9 = 3;
+
+ // The returned pointer is a3.
+ char *p = mempcpy (a3, a5, n3_9);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-3];
+ x = p[-2];
+ x = p[-1];
+ x = p[ 0]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = mempcpy (a3, a5, 3);
+
+ if (i > -1) i = -1;
+ x = p[i];
+
+ if (i > -2) i = -2;
+ x = p[i];
+
+ if (i > -3) i = -3;
+ x = p[i];
+
+ if (i > -4) i = -4;
+ x = p[i]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
+
+
+/* Verify warnings for indexing into the result of mempcpy with a source
+ an array of size 7. */
+
+void test_mempcpy_from_a7 (int i, int n, int n3_9)
+{
+ {
+ // The returned pointer is ax + 5.
+ char *p = mempcpy (ax, a7, 5);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+ {
+ //The returned pointer is in [ax, ax + 7] even though n is not known.
+ char *p = mempcpy (ax, a7, n);
+ x = p[-8]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-7];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+
+ {
+ // The returned pointer is a5 + 3 as specified by the bound.
+ char *p = mempcpy (a5, a7, 3);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-3];
+ x = p[-2];
+ x = p[ 0];
+ x = p[ 1];
+ x = p[ 2]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is a5 + 4.
+ char *p = mempcpy (a5, a7, 4);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-4];
+ x = p[-3];
+ x = p[-2];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 1]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is in [a5, a5 + 5].
+ char *p = mempcpy (a5, a7, n);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-3];
+ x = p[-2];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 4];
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (n3_9 < 3 || 9 < n3_9)
+ n3_9 = 3;
+
+ // The returned pointer is in [a5 + 3, a5 + 5].
+ char *p = mempcpy (a5, a7, n3_9);
+ x = p[-6]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-5];
+ x = p[-3];
+ x = p[-2];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 1];
+ x = p[ 2]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = mempcpy (a5, a7, 4);
+
+ if (i > -1) i = -1;
+ x = p[i];
+
+ if (i > -2) i = -2;
+ x = p[i];
+
+ if (i > -3) i = -3;
+ x = p[i];
+
+ if (i > -4) i = -4;
+ x = p[i];
+
+ if (i > -5) i = -5;
+ x = p[i]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-83.c b/gcc/testsuite/gcc.dg/Warray-bounds-83.c
new file mode 100644
index 0000000..b1d02ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-83.c
@@ -0,0 +1,172 @@
+/* PR tree-optimization/101397 - spurious warning writing to the result
+ of stpcpy minus 1
+ Verify warnings for indexing into a pointer returned from stpncpy.
+ The call stpncpy(S1, S2, N) returns the address of the copy of
+ the first NUL is it exists or &S1[N] otherwise.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Wno-stringop-truncation" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+__attribute__ ((alloc_size (1))) const void* alloc (size_t);
+
+void* memchr (const void*, int, size_t);
+
+void sink (int, ...);
+
+extern char ax[], a3[3], a5[5], a7[7], a9[9];
+
+volatile int x;
+
+/* Verify warnings for indexing into the result of memchr. */
+
+void test_memchr (int i, int n, int n3_5, int n3_9)
+{
+ {
+ /* Because memchr never returns a past-the-end pointer the result
+ below is in [ax, ax + 4]. */
+ const char *p = memchr (ax, x, 5);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[-4];
+ x = p[-1];
+ x = p[ 0];
+ x = p[ 9];
+ }
+
+ {
+ // The returned pointer is in [ax, ax + n].
+ const char *p = memchr (ax, x, n);
+ sink (p[-99], p[-6], p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[99]);
+ }
+
+
+ {
+ // The returned pointer is in [a5, a5 + 2].
+ const char *p = memchr (a5, x, 3);
+ x = p[-3]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is a5 + 4.
+ const char *p = memchr (a5, x, 4);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ // The returned pointer is in [a5, a5 + 4].
+ const char *p = memchr (a5, x, n);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (n3_5 < 3 || 5 < n3_5)
+ n3_5 = 3;
+
+ // The returned pointer is in [a7, a7 + 4].
+ const char *p = memchr (a7, x, n3_5);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ if (n3_9 < 3 || 9 < n3_9)
+ n3_9 = 3;
+
+ // The returned pointer is in [a5, a5 + 4].
+ const char *p = memchr (a5, x, n3_9);
+ x = p[-5]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *p = memchr (a5, x, 4);
+
+ if (i > -1) i = -1;
+ x = p[i];
+
+ if (i > -2) i = -2;
+ x = p[i];
+
+ if (i > -3) i = -3;
+ x = p[i];
+
+ if (i > -4) i = -4;
+ x = p[i]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+}
+
+
+void test_memchr_in_allocated (int i, int n, int n5_7, int n3_9)
+{
+ if (n5_7 < 5 || 7 < n5_7)
+ n5_7 = 5;
+
+ {
+ const char *s = alloc (n5_7);
+ const char *p = memchr (s, x, n);
+ x = p[-7]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-6], p[-6], p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *s = alloc (n5_7);
+ const char *p = memchr (s, x, n);
+ x = p[-7]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-6], p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *s = alloc (n5_7);
+ const char *p = memchr (s, x, n);
+ x = p[-7]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-6], p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *s = alloc (n5_7);
+ const char *p = memchr (s, x, n);
+ x = p[-7]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-6], p[-5], p[-3], p[-4], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *s = alloc (n5_7);
+ const char *p = memchr (s, x, n3_9);
+ x = p[-7]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-6], p[-5], p[-4], p[-3], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ const char *s = alloc (n5_7);
+ const char *p = memchr (s, x, n3_9);
+ x = p[-7]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-6], p[-5], p[-4], p[-4], p[-2], p[-1], p[0]);
+ sink (p[1], p[2], p[3], p[4], p[5], p[6]);
+ x = p[7]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-84.c b/gcc/testsuite/gcc.dg/Warray-bounds-84.c
new file mode 100644
index 0000000..b9350d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-84.c
@@ -0,0 +1,65 @@
+/* PR tree-optimization/101397 - spurious warning writing to the result
+ of stpcpy minus 1
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+char* strcpy (char*, const char*);
+
+void sink (int, ...);
+
+extern char ax[], a3[3], a5[5], *s;
+
+volatile int x;
+
+void test_strcpy (int i)
+{
+ {
+ char *p = strcpy (ax, s);
+ x = p[-1]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[ 0];
+ x = p[+9];
+ }
+
+ {
+ char *p = strcpy (a3, s);
+ x = p[-1]; // { dg-warning "\\\[-Warray-bounds" }
+ x = p[0];
+ x = p[1];
+ x = p[2];
+ x = p[3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = strcpy (a5, s);
+ x = p[-1]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[0], p[1], p[2], p[3], p[4]);
+ x = p[ 5]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = strcpy (a5 + 1, s);
+ x = p[-2]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-1], p[0], p[1], p[2], p[3]);
+ x = p[4]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = strcpy (a5 + 2, s);
+ x = p[-3]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-2], p[-1], p[0], p[1], p[2]);
+ x = p[3]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = strcpy (a5 + 3, s);
+ x = p[-4]; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[-3], p[-2], p[-1], p[0], p[1]);
+ x = p[2]; // { dg-warning "\\\[-Warray-bounds" }
+ }
+
+ {
+ char *p = strcpy (ax, a3);
+ p[-1] = 1; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p[0], p[1], p[2], p[9], p[99]);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-85.c b/gcc/testsuite/gcc.dg/Warray-bounds-85.c
new file mode 100644
index 0000000..0ee7120
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-85.c
@@ -0,0 +1,30 @@
+/* PR middle-end/101601 - [12 Regression] -Warray-bounds triggers error:
+ arrays of functions are not meaningful
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef void Fvv (void);
+
+extern Fvv* pf; // { dg-message "'pf'" }
+
+void f (void*);
+
+void test_funptr (void)
+{
+ f (&pf);
+ f (&pf + 1);
+ f (&pf + 2); // { dg-warning "subscript 2 is outside array bounds of 'void \\\(\\\*\\\[1]\\\)\\\(void\\\)'" }
+}
+
+typedef int Fii_ (int, ...);
+
+extern Fii_* pfa[3]; // { dg-message "'pfa'" }
+
+void test_funptr_array (void)
+{
+ f (pfa);
+ f (pfa + 1);
+ f (pfa + 2);
+ f (pfa + 3);
+ f (pfa + 4); // { dg-warning "subscript 4 is outside array bounds of 'int \\\(\\\*\\\[3]\\\)\\\(int, ...\\\)'" }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-87.c b/gcc/testsuite/gcc.dg/Warray-bounds-87.c
new file mode 100644
index 0000000..a49874d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-87.c
@@ -0,0 +1,48 @@
+/* PR middle-end/101671 - pr83510 fails with -Os because threader confuses
+ -Warray-bounds
+ { dg-do compile }
+ { dg-options "-Os -Wall" } */
+
+extern int f (void);
+extern void sink (unsigned int);
+
+unsigned int a[10];
+
+static unsigned int g (int i, int j)
+{
+ if (i == 9)
+ return j;
+ else if (i == 10)
+ return a[i]; // no warning here
+ return 0;
+}
+
+void test_g (int j)
+{
+ for (int i = 0; i < 10; i++)
+ {
+ if (f ())
+ sink (g (i, j));
+ }
+}
+
+static unsigned int h (int i, int j)
+{
+ switch (i)
+ {
+ case 9:
+ return j;
+ case 10:
+ return a[i]; // { dg-bogus "-Warray-bounds" "pr101671" { xfail *-*-* } }
+ }
+ return 0;
+}
+
+void test_h (int j)
+{
+ for (int i = 0; i < 10; i++)
+ {
+ if (f ())
+ sink (h (i, j));
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-88.c b/gcc/testsuite/gcc.dg/Warray-bounds-88.c
new file mode 100644
index 0000000..8cee8d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-88.c
@@ -0,0 +1,134 @@
+/* PR middle-end/101977 - bogus -Warray-bounds on a negative index into
+ a parameter in conditional with null
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct A { int i; };
+struct B { struct A a1; struct A a2; };
+
+
+void nowarn_p_0_0 (struct A *p, int i)
+{
+ struct A *q = i < 0 ? p : 0 < i ? (struct A*)0 : 0;
+ struct B *r = (struct B*)((char *)q - __builtin_offsetof (struct B, a2));
+ r->a1.i = 0;
+}
+
+void nowarn_0_p_0 (struct A *p, int i)
+{
+ struct A *q = i < 0 ? 0 : 0 < i ? p : 0;
+ struct B *r = (struct B*)((char *)q - __builtin_offsetof (struct B, a2));
+ r->a1.i = 0; // { dg-bogus "-Warray-bounds" }
+}
+
+void nowarn_0_0_p (struct A *p, int i)
+{
+ struct A *q = i < 0 ? 0 : 0 < i ? 0 : p;
+ struct B *r = (struct B*)((char *)q - __builtin_offsetof (struct B, a2));
+ r->a1.i = 0; // { dg-bogus "-Warray-bounds" }
+}
+
+
+void nowarn_p_q_0 (struct A *p, struct A *q, int i)
+{
+ struct A *r = i < 0 ? p : 0 < i ? q : 0;
+ struct B *s = (struct B*)((char *)r - __builtin_offsetof (struct B, a2));
+ s->a1.i = 0; // { dg-bogus "-Warray-bounds" }
+}
+
+void nowarn_p_0_q (struct A *p, struct A *q, int i)
+{
+ struct A *r = i < 0 ? p : 0 < i ? 0 : q;
+ struct B *s = (struct B*)((char *)r - __builtin_offsetof (struct B, a2));
+ s->a1.i = 0; // { dg-bogus "-Warray-bounds" }
+}
+
+void nowarn_0_p_q (struct A *p, struct A *q, int i)
+{
+ struct A *r = i < 0 ? 0 : 0 < i ? p : q;
+ struct B *s = (struct B*)((char *)r - __builtin_offsetof (struct B, a2));
+ s->a1.i = 0;
+}
+
+
+void nowarn_p_q_r (struct A *p, struct A *q, struct A *r, int i)
+{
+ struct A *s = i < 0 ? p : 0 < i ? q : r;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
+
+
+extern struct B b1, b2, b3;
+
+void nowarn_p_b1_0 (struct A *p, int i)
+{
+ struct A *r = i < 0 ? p : 0 < i ? &b1.a2 : 0;
+ struct B *s = (struct B*)((char *)r - __builtin_offsetof (struct B, a2));
+ s->a1.i = 0; // { dg-bogus "-Warray-bounds" }
+}
+
+void nowarn_p_0_b1 (struct A *p, int i)
+{
+ struct A *r = i < 0 ? p : 0 < i ? 0 : &b1.a2;
+ struct B *s = (struct B*)((char *)r - __builtin_offsetof (struct B, a2));
+ s->a1.i = 0; // { dg-bogus "-Warray-bounds" }
+}
+
+void nowarn_0_p_b1 (struct A *p, int i)
+{
+ struct A *r = i < 0 ? 0 : 0 < i ? p : &b1.a2;
+ struct B *s = (struct B*)((char *)r - __builtin_offsetof (struct B, a2));
+ s->a1.i = 0;
+}
+
+
+void nowarn_p_b1_b2 (struct A *p, int i)
+{
+ struct A *s = i < 0 ? p : 0 < i ? &b1.a2 : &b2.a2;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
+
+void nowarn_b1_p_b2 (struct A *p, int i)
+{
+ struct A *s = i < 0 ? &b1.a2 : 0 < i ? p : &b2.a2;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
+
+void nowarn_b1_b2_p (struct A *p, int i)
+{
+ struct A *s = i < 0 ? &b1.a2 : 0 < i ? &b2.a2 : p;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
+
+void nowarn_b1_b2_b3 (struct A *p, int i)
+{
+ struct A *s = i < 0 ? &b1.a2 : 0 < i ? &b2.a2 : &b3.a2;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
+
+
+void nowarn_0_b1_b2 (int i)
+{
+ struct A *s = i < 0 ? 0 : 0 < i ? &b1.a2 : &b2.a2;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
+
+void warn_b1_0_b2 (int i)
+{
+ struct A *s = i < 0 ? &b1.a2 : 0 < i ? 0 : &b2.a2;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
+
+void warn_b1_b2_0 (int i)
+{
+ struct A *s = i < 0 ? &b1.a2 : 0 < i ? &b2.a2 : 0;
+ struct B *t = (struct B*)((char *)s - __builtin_offsetof (struct B, a2));
+ t->a1.i = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-9.c b/gcc/testsuite/gcc.dg/Warray-parameter-9.c
new file mode 100644
index 0000000..b5d3d96
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-parameter-9.c
@@ -0,0 +1,54 @@
+/* PR c/99420 - bogus -Warray-parameter on a function redeclaration
+ in function scope
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+extern int a1[1], a2[2], a3[3], a4[4];
+
+void fa1 (int [1]); // { dg-message "previously declared as 'int\\\[1]'" }
+void fa1 (int [1]);
+
+
+void nested_decl (void)
+{
+ void fa2 (int [2]);
+
+ fa2 (a1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
+ fa2 (a2);
+ fa2 (a3);
+
+ void fa3 (int [3]);
+
+ fa3 (a2); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
+ fa3 (a3);
+}
+
+
+void nested_redecl (void)
+{
+ void fa1 (int [2]); // { dg-warning "argument 1 of type 'int\\\[2]' with mismatched bound" }
+
+ fa1 (a1 + 1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
+ fa1 (a1);
+
+ void fa2 (int [2]); // { dg-bogus "\\\[-Warray-parameter" }
+
+ fa2 (a1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
+ fa2 (a2);
+ fa2 (a3);
+
+ void fa3 (int [3]); // { dg-bogus "\\\[-Warray-parameter" }
+
+ fa3 (a2); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
+ fa3 (a3);
+
+ void fa4 (int [4]);
+}
+
+void fa4 (int [5]); // { dg-warning "\\\[-Warray-parameter" }
+
+void call_fa4 (void)
+{
+ fa4 (a4);
+ fa4 (a3); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter.c b/gcc/testsuite/gcc.dg/Warray-parameter.c
index 42be310..6c5195a 100644
--- a/gcc/testsuite/gcc.dg/Warray-parameter.c
+++ b/gcc/testsuite/gcc.dg/Warray-parameter.c
@@ -5,7 +5,7 @@
Also verify that the array/pointer argument form in a mismatched
redeclaration doesn't override the form in the initial declaration.
{ dg-do compile }
- { dg-options "-Wall -Warray-parameter -Wno-vla-paramater" } */
+ { dg-options "-Wall -Warray-parameter -Wno-vla-parameter" } */
/* Redclarations with the same or equivalent array form should not
be dianosed. T[0] is diagnosed by -Wpedantic for being invalid
diff --git a/gcc/testsuite/gcc.dg/Wattributes-6.c b/gcc/testsuite/gcc.dg/Wattributes-6.c
index 4ba59bf..978f3f9 100644
--- a/gcc/testsuite/gcc.dg/Wattributes-6.c
+++ b/gcc/testsuite/gcc.dg/Wattributes-6.c
@@ -97,6 +97,8 @@ fnoinline1 (void); /* { dg-message "previous declaration here" } */
/* Verify a warning for always_inline conflict. */
void ATTR ((always_inline))
fnoinline1 (void) { } /* { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
+ /* { dg-note "previous definition" "" { target *-*-* } .-2 } */
/* Verify a warning for gnu_inline conflict. */
inline void ATTR ((gnu_inline))
@@ -364,13 +366,15 @@ inline int ATTR ((cold))
finline_cold_noreturn (int);
inline int ATTR ((noreturn))
-finline_cold_noreturn (int);
+finline_cold_noreturn (int); /* { dg-note "previous declaration here" } */
inline int ATTR ((noinline))
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((hot))
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .hot. because it conflicts with attribute .cold." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((warn_unused_result))
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */
@@ -389,23 +393,25 @@ finline_cold_noreturn (int i) { (void)&i; __builtin_abort (); }
and some on distinct declarations. */
inline int ATTR ((always_inline, hot))
-finline_hot_noret_align (int);
+finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */
inline int ATTR ((noreturn, noinline))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((cold, aligned (8)))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .cold. because it conflicts with attribute .hot." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((warn_unused_result))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */
+ /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */
inline int ATTR ((aligned (4)))
- finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* s390*-*-* } } } } */
-/* { dg-error "alignment for 'finline_hot_noret_align' must be at least 8" "" { target s390*-*-* } .-1 } */
+ finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* } } } } */
inline int ATTR ((aligned (8)))
-finline_hot_noret_align (int);
+finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */
inline int ATTR ((const))
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */
@@ -416,6 +422,26 @@ inline int ATTR ((noreturn))
finline_hot_noret_align (int i) { (void)&i; __builtin_abort (); }
+/* Expect a warning about conflicting alignment but without
+ other declarations inbetween. */
+inline int ATTR ((aligned (32)))
+finline_align (int); /* { dg-note "previous declaration here" } */
+
+inline int ATTR ((aligned (4)))
+finline_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." "" } */
+
+inline int ATTR ((noreturn))
+finline_align (int i) { (void)&i; __builtin_abort (); }
+
+
+/* Expect no note that would refer to the same declaration. */
+inline int ATTR ((aligned (32), aligned (4)))
+finline_double_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." } */
+
+inline int ATTR ((noreturn))
+finline_double_align (int i) { (void)&i; __builtin_abort (); }
+
+
/* Exercise variable attributes. */
extern int ATTR ((common))
diff --git a/gcc/testsuite/gcc.dg/Wfree-nonheap-object-4.c b/gcc/testsuite/gcc.dg/Wfree-nonheap-object-4.c
index a7d9212..e459b24 100644
--- a/gcc/testsuite/gcc.dg/Wfree-nonheap-object-4.c
+++ b/gcc/testsuite/gcc.dg/Wfree-nonheap-object-4.c
@@ -10,23 +10,23 @@ struct A
void *p;
};
-void f0 (struct A *p, void *q) { p->p = q; }
-void f1 (struct A *p, void *q) { f0 (p, q); }
-void f2 (struct A *p, void *q) { f1 (p, q); }
+static void f0 (struct A *p, void *q) { p->p = q; }
+static void f1 (struct A *p, void *q) { f0 (p, q); }
+static void f2 (struct A *p, void *q) { f1 (p, q); }
-void g0 (struct A *p)
+static void g0 (struct A *p)
{
__builtin_free (p->p); // { dg-warning "\\\[-Wfree-nonheap-object" }
}
-void g1 (struct A *p) { g0 (p); }
-void g2 (struct A *p) { g1 (p); }
+static void g1 (struct A *p) { g0 (p); }
+static void g2 (struct A *p) { g1 (p); }
# 26 "Wfree-nonheap-object-4.c"
#define NOIPA __attribute__ ((noipa))
-extern int array[];
+extern int array[]; // { dg-message "declared here" "note on line 29" }
/* Verify the warning is issued even for calls in a system header inlined
into a function outside the header. */
@@ -39,7 +39,7 @@ NOIPA void warn_g0 (struct A *p)
g0 (p);
}
-// { dg-message "inlined from 'warn_g0'" "" { target *-*-* } 0 }
+// { dg-message "inlined from 'warn_g0'" "note on line 42" { target *-*-* } 0 }
/* Also verify the warning can be suppressed. */
@@ -65,8 +65,8 @@ NOIPA void warn_g1 (struct A *p)
g1 (p);
}
-// { dg-message "inlined from 'g1'" "" { target *-*-* } 0 }
-// { dg-message "inlined from 'warn_g1'" "" { target *-*-* } 0 }
+// { dg-message "inlined from 'g1'" "note on line 68" { target *-*-* } 0 }
+// { dg-message "inlined from 'warn_g1'" "note on line 69" { target *-*-* } 0 }
NOIPA void nowarn_g1 (struct A *p)
@@ -90,8 +90,8 @@ NOIPA void warn_g2 (struct A *p)
g2 (p);
}
-// { dg-message "inlined from 'g2'" "" { target *-*-* } 0 }
-// { dg-message "inlined from 'warn_g2'" "" { target *-*-* } 0 }
+// { dg-message "inlined from 'g2'" "note on line 93" { target *-*-* } 0 }
+// { dg-message "inlined from 'warn_g2'" "note on line 94" { target *-*-* } 0 }
NOIPA void nowarn_g2 (struct A *p)
diff --git a/gcc/testsuite/gcc.dg/Wfree-nonheap-object-5.c b/gcc/testsuite/gcc.dg/Wfree-nonheap-object-5.c
new file mode 100644
index 0000000..026cd45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wfree-nonheap-object-5.c
@@ -0,0 +1,46 @@
+/* Similar to Wfree-nonheap-object-4.c but without system headers:
+ verify that warnings for the same call site from distinct callers
+ include the correct function names in the inlining stack.
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct A
+{
+ void *p;
+};
+
+static void f0 (struct A *p)
+{
+ __builtin_free (p->p); // { dg-warning "\\\[-Wfree-nonheap-object" }
+}
+
+// Expect two instances of the text below:
+// { dg-regexp "In function 'f0'," "first f0 prefix" { target *-*-* } 0 }
+// { dg-regexp "In function 'f0'," "second f0 prefix" { target *-*-* } 0 }
+
+static void f1 (struct A *p) { f0 (p); }
+static void f2 (struct A *p) { f1 (p); }
+
+extern int array[];
+// Also expect two instances of the note:
+// { dg-regexp "declared here" "first note on line 24" { target *-*-* } .-2 }
+// { dg-regexp "declared here" "second note on line 24" { target *-*-* } .-3 }
+
+void foo (struct A *p)
+{
+ p->p = array + 1;
+ f0 (p);
+}
+
+// { dg-regexp " +inlined from 'foo' at \[^:\]+Wfree-nonheap-object-5.c:32:\\d+:" "note on line 32" }
+
+
+void bar (struct A *p)
+{
+ p->p = array + 2;
+ f2 (p);
+}
+
+// { dg-regexp " +inlined from 'f1' at \[^:\]+Wfree-nonheap-object-5.c:21:\\d+," "inlined from f1" }
+// { dg-regexp " +inlined from 'f2' at \[^:\]+Wfree-nonheap-object-5.c:22:\\d+," "inlined from f2" }
+// { dg-regexp " +inlined from 'bar' at \[^:\]+Wfree-nonheap-object-5.c:41:\\d+:" "inlined from bar" }
diff --git a/gcc/testsuite/gcc.dg/Wfree-nonheap-object-6.c b/gcc/testsuite/gcc.dg/Wfree-nonheap-object-6.c
new file mode 100644
index 0000000..c109558
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wfree-nonheap-object-6.c
@@ -0,0 +1,49 @@
+/* Similar to Wfree-nonheap-object-5.c but with attribute artificial:
+ verify that warnings for the same call site from distinct callers
+ include the correct function names in the inlining stack.
+ { dg-do compile }
+ { dg-options "-O1 -Wall" } */
+
+struct A
+{
+ void *p;
+};
+
+__attribute__ ((always_inline, artificial))
+inline void f0 (struct A *p)
+{
+ __builtin_free (p->p); // { dg-warning "\\\[-Wfree-nonheap-object" }
+}
+
+// Expect two instances of the text below:
+// { dg-regexp "In function 'f0'," "first f0 prefix" { target *-*-* } 0 }
+// { dg-regexp "In function 'f0'," "second f0 prefix" { target *-*-* } 0 }
+
+__attribute__ ((always_inline, artificial))
+inline void f1 (struct A *p) { f0 (p); }
+__attribute__ ((always_inline, artificial))
+inline void f2 (struct A *p) { f1 (p); }
+
+extern int array[];
+// Also expect two instances of the note:
+// { dg-regexp "declared here" "first note for array" { target *-*-* } .-2 }
+// { dg-regexp "declared here" "second note for array" { target *-*-* } .-3 }
+
+void foo (struct A *p)
+{
+ p->p = array + 1;
+ f0 (p);
+}
+
+// { dg-regexp " +inlined from 'foo' at \[^:\]+Wfree-nonheap-object-6.c:35:\\d+:" "inlined from foo" }
+
+
+void bar (struct A *p)
+{
+ p->p = array + 2;
+ f2 (p);
+}
+
+// { dg-regexp " +inlined from 'f1' at \[^:\]+Wfree-nonheap-object-6.c:23:\\d+," "inlined from f1" }
+// { dg-regexp " +inlined from 'f2' at \[^:\]+Wfree-nonheap-object-6.c:25:\\d+," "inlined from f2" }
+// { dg-regexp " +inlined from 'bar' at \[^:\]+Wfree-nonheap-object-6.c:44:\\d+:" "inlined from bar" }
diff --git a/gcc/testsuite/gcc.dg/Wnonnull-4.c b/gcc/testsuite/gcc.dg/Wnonnull-4.c
index 180a40d..2c1c45a 100644
--- a/gcc/testsuite/gcc.dg/Wnonnull-4.c
+++ b/gcc/testsuite/gcc.dg/Wnonnull-4.c
@@ -27,9 +27,9 @@ void test_fca_n (int r_m1)
T ( 0);
// Verify positive bounds.
- T ( 1); // { dg-warning "argument 1 of variable length array 'char\\\[n]' is null but the corresponding bound argument 2 value is 1" }
- T ( 9); // { dg-warning "argument 1 of variable length array 'char\\\[n]' is null but the corresponding bound argument 2 value is 9" }
- T (max); // { dg-warning "argument 1 of variable length array 'char\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+ T ( 1); // { dg-warning "argument 2 of variable length array 'char\\\[n]' is null but the corresponding bound argument 1 value is 1" }
+ T ( 9); // { dg-warning "argument 2 of variable length array 'char\\\[n]' is null but the corresponding bound argument 1 value is 9" }
+ T (max); // { dg-warning "argument 2 of variable length array 'char\\\[n]' is null but the corresponding bound argument 1 value is \\d+" }
}
@@ -55,9 +55,9 @@ void test_fsa_x_n (int r_m1)
T ( 0);
// Verify positive bounds.
- T ( 1); // { dg-warning "argument 1 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
- T ( 9); // { dg-warning "argument 1 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
- T (max); // { dg-warning "argument 1 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+ T ( 1); // { dg-warning "argument 2 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 1 value is 1" }
+ T ( 9); // { dg-warning "argument 2 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 1 value is 9" }
+ T (max); // { dg-warning "argument 2 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 1 value is \\d+" }
}
@@ -83,9 +83,9 @@ void test_fia_1_n (int r_m1)
T ( 0);
// Verify positive bounds.
- T ( 1); // { dg-warning "argument 1 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
- T ( 9); // { dg-warning "argument 1 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
- T (max); // { dg-warning "argument 1 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+ T ( 1); // { dg-warning "argument 2 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 1 value is 1" }
+ T ( 9); // { dg-warning "argument 2 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 1 value is 9" }
+ T (max); // { dg-warning "argument 2 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 1 value is \\d+" }
}
@@ -111,9 +111,9 @@ void test_fla_3_n (int r_m1)
T ( 0);
// Verify positive bounds.
- T ( 1); // { dg-warning "argument 1 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
- T ( 9); // { dg-warning "argument 1 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
- T (max); // { dg-warning "argument 1 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+ T ( 1); // { dg-warning "argument 2 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 1 value is 1" }
+ T ( 9); // { dg-warning "argument 2 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 1 value is 9" }
+ T (max); // { dg-warning "argument 2 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 1 value is \\d+" }
}
@@ -139,9 +139,9 @@ void test_fda_n_5 (int r_m1)
T ( 0);
// Verify positive bounds.
- T ( 1); // { dg-warning "argument 1 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 2 value is 1" }
- T ( 9); // { dg-warning "argument 1 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 2 value is 9" }
- T (max); // { dg-warning "argument 1 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 2 value is \\d+" }
+ T ( 1); // { dg-warning "argument 2 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 1 value is 1" }
+ T ( 9); // { dg-warning "argument 2 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 1 value is 9" }
+ T (max); // { dg-warning "argument 2 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 1 value is \\d+" }
}
@@ -167,7 +167,7 @@ void test_fca_n_n (int r_m1)
T ( 0);
// Verify positive bounds.
- T ( 1); // { dg-warning "argument 1 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
- T ( 9); // { dg-warning "argument 1 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
- T (max); // { dg-warning "argument 1 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+ T ( 1); // { dg-warning "argument 2 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 1 value is 1" }
+ T ( 9); // { dg-warning "argument 2 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 1 value is 9" }
+ T (max); // { dg-warning "argument 2 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 1 value is \\d+" }
}
diff --git a/gcc/testsuite/gcc.dg/Wnonnull-6.c b/gcc/testsuite/gcc.dg/Wnonnull-6.c
new file mode 100644
index 0000000..48f09da
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wnonnull-6.c
@@ -0,0 +1,93 @@
+/* Verify that attribute nonnull on global and local function declarations
+ or those to pointers to functions is merged.
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+void fnonnull_local_local (void)
+{
+ extern __attribute__ ((nonnull)) void fnonnull1 (void*);
+
+ fnonnull1 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+void gnonnull_local_local (void)
+{
+ extern void fnonnull1 (void*);
+
+ fnonnull1 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+
+void fnonnull_local_global (void)
+{
+ extern __attribute__ ((nonnull)) void fnonnull2 (void*);
+
+ fnonnull2 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+extern void fnonnull2 (void*);
+
+void gnonnull_local_global (void)
+{
+ fnonnull2 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+
+extern __attribute__ ((nonnull)) void fnonnull3 (void*);
+
+void fnonnull_global_local (void)
+{
+ fnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+void gnonnull_global_local (void)
+{
+ extern void fnonnull3 (void*);
+
+ fnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+
+void pfnonnull_local_local (void)
+{
+ extern __attribute__ ((nonnull)) void (*pfnonnull1) (void*);
+
+ pfnonnull1 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+void gpnonnull_local_local (void)
+{
+ extern void (*pfnonnull1) (void*);
+
+ pfnonnull1 (0); // { dg-warning "\\\[-Wnonnull" "pr?????" { xfail *-*-* } }
+}
+
+
+void pfnonnull_local_global (void)
+{
+ extern __attribute__ ((nonnull)) void (*pfnonnull2) (void*);
+
+ pfnonnull2 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+extern void (*pfnonnull2) (void*);
+
+void gpnonnull_local_global (void)
+{
+ pfnonnull2 (0); // { dg-warning "\\\[-Wnonnull" "pr?????" { xfail *-*-* } }
+}
+
+
+extern __attribute__ ((nonnull)) void (*pfnonnull3) (void*);
+
+void pfnonnull_global_local (void)
+{
+ pfnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+void gpnonnull_global_local (void)
+{
+ extern void (*pfnonnull3) (void*);
+
+ pfnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wnonnull-7.c b/gcc/testsuite/gcc.dg/Wnonnull-7.c
new file mode 100644
index 0000000..e7b331a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wnonnull-7.c
@@ -0,0 +1,15 @@
+/* PR middle-end/101216 - spurious notes for function calls
+ { dg-do compile }
+ { dg-options "-O2 -w" } */
+
+__attribute__ ((access (write_only, 1, 2))) char*
+getcwd (char *, __SIZE_TYPE__);
+
+char* f (void)
+{
+ char a[8];
+ return getcwd (0, 8);
+}
+
+/* Expect no messages of any kind on output.
+ { dg-bogus "" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/Wobjsize-1.c b/gcc/testsuite/gcc.dg/Wobjsize-1.c
index e80c8ad..2bd2f93 100644
--- a/gcc/testsuite/gcc.dg/Wobjsize-1.c
+++ b/gcc/testsuite/gcc.dg/Wobjsize-1.c
@@ -4,13 +4,17 @@
#include "Wobjsize-1.h"
char buf[6];
-/* { dg-warning "writing" "" { target *-*-* } .-1 } */
int main(int argc, char **argv)
{
- strcpy (buf,"hello ");
+ strcpy (buf,"hello "); /* { dg-warning "\\\[-Wstringop-overflow" } */
return 0;
}
-/* { dg-message "file included" "included" { target *-*-* } 0 } */
-/* { dg-message "inlined from" "inlined" { target *-*-* } 0 } */
+/* { dg-message "file included" "included" { target *-*-* } 0 }
+ { dg-message "inlined from" "inlined" { target *-*-* } 0 }
+
+ The test might emit two warnings, one for the strcpy call and
+ another for the inlined call to __builtin___strcpy_chk() called
+ from strcpy().
+ { dg-prune-output "writing 7 bytes into a region of size 6" } */
diff --git a/gcc/testsuite/gcc.dg/Wrestrict-8.c b/gcc/testsuite/gcc.dg/Wrestrict-8.c
index 24946b0..62e8bbc 100644
--- a/gcc/testsuite/gcc.dg/Wrestrict-8.c
+++ b/gcc/testsuite/gcc.dg/Wrestrict-8.c
@@ -7,7 +7,9 @@ typedef __SIZE_TYPE__ size_t;
extern void* memcpy (void* restrict, const void* restrict, size_t);
-#define T(d, s, n) memcpy (d, s, n)
+void foo (void *);
+
+#define T(d, s, n) do { memcpy (d, s, n); foo (d); } while (0)
struct S1 { char c; } a8_1[8];
diff --git a/gcc/testsuite/gcc.dg/Wreturn-type3.c b/gcc/testsuite/gcc.dg/Wreturn-type3.c
new file mode 100644
index 0000000..93596b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wreturn-type3.c
@@ -0,0 +1,54 @@
+/* Verify that attribute noreturn on global and local function declarations
+ is merged.
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+int fnr_local_local (void)
+{
+ __attribute__ ((noreturn)) void fnr1 (void);
+
+ fnr1 ();
+ // no return, no warning (good)
+}
+
+int gnr_local_local (void)
+{
+ void fnr1 (void);
+
+ fnr1 ();
+ // no return, no warning (good)
+}
+
+
+int fnr_local_global (void)
+{
+ __attribute__ ((noreturn)) void fnr2 (void);
+
+ fnr2 ();
+ // no return, no warning (good)
+}
+
+void fnr2 (void);
+
+int gnr_local_global (void)
+{
+ fnr2 ();
+ // no return, no warning (good)
+}
+
+
+__attribute__ ((noreturn)) void fnr3 (void);
+
+int fnr_global_local (void)
+{
+ fnr3 ();
+ // no return, no warning (good)
+}
+
+int gnr_global_local (void)
+{
+ void fnr3 (void);
+
+ fnr3 ();
+ // no return, no warning (good)
+}
diff --git a/gcc/testsuite/gcc.dg/Wstring-compare-3.c b/gcc/testsuite/gcc.dg/Wstring-compare-3.c
index d4d7121..6d0d5be 100644
--- a/gcc/testsuite/gcc.dg/Wstring-compare-3.c
+++ b/gcc/testsuite/gcc.dg/Wstring-compare-3.c
@@ -1,6 +1,6 @@
/* PR middle-end/95673 - missing -Wstring-compare for an impossible strncmp test
{ dg-do compile }
- { dg-options "-O2 -Wall -Wstring-compare -ftrack-macro-expansion=0" } */
+ { dg-options "-O2 -Wall -Wstring-compare -Wno-stringop-overread -ftrack-macro-expansion=0" } */
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/gcc.dg/Wstring-compare.c b/gcc/testsuite/gcc.dg/Wstring-compare.c
index d1534bf..239bbfe 100644
--- a/gcc/testsuite/gcc.dg/Wstring-compare.c
+++ b/gcc/testsuite/gcc.dg/Wstring-compare.c
@@ -21,7 +21,7 @@ extern char b4[4];
void strcmp_array_lit (void)
{
if (strcmp (a4, "1234")) // { dg-warning "'strcmp' of a string of length 4 and an array of size 4 evaluates to nonzero" }
- // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 }
+ // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 }
sink (0, a4);
int cmp;
@@ -44,7 +44,7 @@ void strcmp_array_pstr (void)
{
if (strcmp (a4, s4)) // { dg-warning "'strcmp' of a string of length 4 and an array of size 4 evaluates to nonzero" }
- // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 }
+ // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 }
sink (1, a4);
else
sink (0, a4);
@@ -86,7 +86,7 @@ void strcmp_array_copy (void)
{
strcpy (s, "1234");
if (strcmp (a4, s)) // { dg-warning "'strcmp' of a string of length 4 and an array of size 4 evaluates to nonzero" }
- // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 }
+ // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 }
sink (1, a4);
else
sink (0, a4);
@@ -131,7 +131,7 @@ void strcmp_member_array_lit (const struct S *p)
void strncmp_array_lit (void)
{
if (strncmp (a4, "12345", 5)) // { dg-warning "'strncmp' of a string of length 5, an array of size 4 and bound of 5 evaluates to nonzero" }
- // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 }
+ // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 }
sink (0, a4);
int cmp;
@@ -161,7 +161,7 @@ void strncmp_strarray_copy (void)
char b[6];
strcpy (b, "12345");
if (strncmp (a, b, 5)) // { dg-warning "'strncmp' of strings of length 4 and 5 and bound of 5 evaluates to nonzero" }
- // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 }
+ // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 }
sink (0, a, b);
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-11.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-11.c
index ec3c97e..cf53652 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-11.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-11.c
@@ -56,7 +56,7 @@ void test_memset_array_cst_range_off (void)
T (2, SR ( 1, 2), 4);
T (2, SR ( 1, 2), 5); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
- T (2, SR ( 0, 1), 6); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" { xfail *-*-* } } */
+ T (2, SR ( 0, 1), 6); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" } */
T (2, UR ( 1, 2), 7); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
T (7, UR (-7, 0), 7);
T (7, UR (-7, 0), 9); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
@@ -134,7 +134,7 @@ void test_memcpy_array_cst_range_off (const void *s)
T (2, SR ( 1, 2), 4);
T (2, SR ( 1, 2), 5); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
- T (2, SR ( 0, 1), 6); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" { xfail *-*-* } } */
+ T (2, SR ( 0, 1), 6); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" } */
T (2, UR ( 1, 2), 7); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
T (7, UR (-7, 0), 7);
T (7, UR (-7, 0), 9); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
@@ -211,7 +211,7 @@ void test_strcpy_array_cst_range_off (void)
T (2, SR ( 1, 2), 3);
T (2, SR ( 1, 2), 4); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
- T (2, SR ( 0, 1), 5); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" { xfail *-*-* } } */
+ T (2, SR ( 0, 1), 5); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" } */
T (2, UR ( 1, 2), 6); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
T (7, UR (-7, 0), 6);
T (7, UR (-7, 0), 8); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
@@ -277,7 +277,7 @@ void test_strncpy_array_cst_range_off (const char *s)
T (2, SR ( 1, 2), 4);
T (2, SR ( 1, 2), 5); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
- T (2, SR ( 0, 1), 6); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" { xfail *-*-* } } */
+ T (2, SR ( 0, 1), 6); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" "pr89428" } */
T (2, UR ( 1, 2), 7); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
T (7, UR (-7, 0), 7);
T (7, UR (-7, 0), 9); /* { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } */
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-12.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-12.c
index 7c3dc8c..1ba7720 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-12.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-12.c
@@ -25,9 +25,7 @@ void test_memcpy_array_cst_range_off (const void *s)
T (d + UR (1, 2), 5);
T (d + UR (0, 1), 6);
- /* The warning below should be "writing" but the [0, 1] range
- is somehow lost and get_range_info() returns VR_VARYING. */
- T (d + UR (0, 1), 7); /* { dg-warning ".memcpy. writing 7 bytes into a region of size 6 overflows the destination" "pr89428" { xfail *-*-* } } */
+ T (d + UR (0, 1), 7); /* { dg-warning ".memcpy. writing 7 bytes into a region of size 6 overflows the destination" "pr89428" } */
T (d + UR (1, 2), 6); /* { dg-warning ".memcpy. writing 6 bytes into a region of size 5 overflows the destination" } */
T (d + UR (1, 2), 7); /* { dg-warning "writing 7 bytes into a region of size 5 " } */
@@ -66,7 +64,7 @@ void test_memset_array_unsigned_off (void)
T (d + UR (1, 2), 5);
T (d + UR (0, 1), 6);
- T (d + UR (0, 1), 7); /* { dg-warning ".memset. writing 6 bytes into a region of size 5 overflows the destination" "pr89428" { xfail *-*-* } } */
+ T (d + UR (0, 1), 7); /* { dg-warning ".memset. writing 7 bytes into a region of size 6 overflows the destination" "pr89428" } */
T (d + UR (1, 2), 6); /* { dg-warning ".memset. writing 6 bytes into a region of size 5 overflows the destination" } */
T (d + UR (1, 2), 7); /* { dg-warning "writing 7 bytes into a region of size 5 " } */
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-15.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-15.c
index 1907bac..87f8462 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-15.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-15.c
@@ -30,7 +30,7 @@ void vla_bounded (int n)
a[0] = 0;
a[1] = 1;
a[n] = n; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" { xfail *-*-* } }
- a[69] = n; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" { xfail *-*-* } }
+ a[69] = n; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" }
sink (&a);
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c
index a1b1039..d9ca344 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c
@@ -112,7 +112,7 @@ void s2_warn_cstoff_cstidx (struct S2 *p)
void s2_warn_varoff_cstdix (struct S2 *p, int i)
{
char *q = p->a + i;
- q[2] = __LINE__; // { dg-warning "\\\[-Wstringop-overflow" }
+ q[2] = __LINE__; // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
}
void s2_warn_cstoff_varidx (struct S2 *p, int i)
@@ -235,8 +235,8 @@ void si0_warn_cstoff_cstidx (struct Si0 *p)
void si0_warn_varoff_cstdix (struct Si0 *p, int i)
{
char *q = p->a + i;
- q[1] = __LINE__; // { dg-warning "\\\[-Wstringop-overflow" }
- q[9] = __LINE__; // { dg-warning "\\\[-Wstringop-overflow" }
+ q[1] = __LINE__; // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
+ q[9] = __LINE__; // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
}
void si0_warn_cstoff_varidx (struct Si0 *p, int i)
@@ -248,5 +248,5 @@ void si0_warn_cstoff_varidx (struct Si0 *p, int i)
void si0_warn_varoff_varidx (struct Si0 *p, int i, int j)
{
char *q = p->a + i;
- q[j] = __LINE__; // { dg-warning "\\\[-Wstringop-overflow" }
+ q[j] = __LINE__; // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-41.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-41.c
index 9b2d2cb..e255e67 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-41.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-41.c
@@ -29,7 +29,8 @@ void char_array_cst_off_cst_size (void)
sink (p);
++idx;
- memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 1" "pr?????" { xfail ilp32 } }
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 1" }
+ sink (p);
++idx;
memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 0" }
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-42.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-42.c
index 4bb22f2..8527eea 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-42.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-42.c
@@ -23,21 +23,21 @@ void cpy_ui_1_max (unsigned i, const char *s)
{
if (i < 1) i = 1;
d = strcpy (a + i, s); // { dg-warning "writing 1 or more bytes into a region of size 0" }
- d = strcpy (a + i + 1, s); // { dg-warning "writing 1 or more bytes into a region of size 0" "" { xfail ilp32 } }
+ d = strcpy (a + i + 1, s); // { dg-warning "writing 1 or more bytes into a region of size 0" "" { xfail { ! lp64 } } }
}
void cpy_sl_1_max (long i, const char *s)
{
if (i < 1) i = 1;
- d = strcpy (a + i, s); // { dg-warning "writing 1 or more bytes into a region of size 0" }
- d = strcpy (a + i + 1, s); // { dg-warning "writing 1 or more bytes into a region of size 0" }
+ d = strcpy (a + i, s); // { dg-warning "writing 1 or more bytes into a region of size 0" "" { target { ! ptr_eq_short } } }
+ d = strcpy (a + i + 1, s); // { dg-warning "writing 1 or more bytes into a region of size 0" "" { target { ! ptr_eq_short } } }
}
void cpy_ul_1_max (unsigned long i, const char *s)
{
if (i < 1) i = 1;
- d = strcpy (a + i, s); // { dg-warning "writing 1 or more bytes into a region of size 0" }
+ d = strcpy (a + i, s); // { dg-warning "writing 1 or more bytes into a region of size 0" "" { target { ! ptr_eq_short } } }
/* Because of integer wraparound the offset's range is [1, 0] so
the overflow isn't diagnosed (yet). */
@@ -56,7 +56,7 @@ void cpy_si_min_m1 (int i, const char *s)
void cpy_sl_min_m1 (long i, const char *s)
{
if (i > -1) i = -1;
- d = strcpy (a + i - 1, s); // { dg-warning "writing 1 or more bytes into a region of size 0" }
- d = strcpy (a + i, s); // { dg-warning "writing 1 or more bytes into a region of size 0" }
+ d = strcpy (a + i - 1, s); // { dg-warning "writing 1 or more bytes into a region of size 0" "" { target { ! ptr_eq_short } } }
+ d = strcpy (a + i, s); // { dg-warning "writing 1 or more bytes into a region of size 0" "" { target { ! ptr_eq_short } } }
d = strcpy (a + i + 2, s);
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c
index 14ab925..9100661 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c
@@ -161,18 +161,19 @@ void warn_memset_reversed_range (void)
/* Since the offset is excessive, either starting before &a11[0]
ot just past &a[11], the region size in the warning should
- probably be zero, but accept other sizes too. */
- T1 (p, SAR (INT_MIN, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size \\d+" }
+ probably be zero, but accept other sizes too.
+
+ The problem isn't detected anymore because the offset is in
+ the anti-range ~[INT_MIN, -11] which isn't handled. */
+ T1 (p, SAR (INT_MIN, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size \\d+" "" { xfail *-*-* } }
/* The following are represented as ordinary ranges with reversed bounds
and those are handled. */
T1 (p, SAR (INT_MIN, 11), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
- /* In ILP32 the offset in the following has no range info associated
- with it. */
- T1 (p, SAR (INT_MIN, 1), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" "pr?????" { xfail ilp32 } }
+ T1 (p, SAR (INT_MIN, 1), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
T1 (p, SAR (INT_MIN, 0), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
/* Also represented as a true anti-range. */
- T1 (p, SAR ( -12, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size \\d+" }
+ T1 (p, SAR ( -12, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size \\d+" "" { xfail *-*-* } }
T1 (p, SAR ( -12, -1), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
T1 (p, SAR ( -11, 0), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
T1 (p, SAR ( -11, 11), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c
index b126fcb..042c967 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c
@@ -79,9 +79,8 @@ void warn_memchr_var_memset_range (const void *s, unsigned n)
as in the first two notes. The exact value probably isn't too
important. */
char *p0 = malloc (UR (5, 7));
- // { dg-message ": destination object of size \\\[5, 7]" "note 1" { target *-*-* } .-1 }
- // { dg-message "at offset \\\[1, 7] into destination object of size \\\[5, 7]" "note 2" { target *-*-* } .-2 }
- // { dg-message "at offset \\\[2, 7] into destination object of size \\\[5, 7]" "note 3" { target *-*-* } .-3 }
+ // { dg-message "at offset \\\[\[01\], 6] into destination object of size \\\[5, 7]" "note 2" { target *-*-* } .-1 }
+ // { dg-message "at offset \\\[2, 7] into destination object of size \\\[5, 7]" "note 3" { target *-*-* } .-2 }
sink (p0);
char *p1 = memchr (p0, '1', n);
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-47.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-47.c
index 9bfc84a..968f6ee 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-47.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-47.c
@@ -24,22 +24,22 @@ void nowarn_c32 (char c)
sink (p);
}
-/* The tests below fail as a result of the hack for PR 96963. However,
- with -Wall, the invalid stores are diagnosed by -Warray-bounds which
- runs before vectorization and so doesn't need the hack. If/when
- -Warray changes to use compute_objsize() this will need adjusting. */
+/* The tests below failed as a result of the hack for PR 96963. However,
+ with -Wall, the invalid stores were diagnosed by -Warray-bounds which
+ runs before vectorization and so doesn't need the hack. Now that
+ -Warray-bounds has changed to use compute_objsize() the tests pass. */
void warn_c32 (char c)
{
- extern char warn_a32[32]; // { dg-message "at offset 32 into destination object 'warn_a32' of size 32" "pr97027" { xfail *-*-* } }
+ extern char warn_a32[32]; // { dg-message "at offset (32|1) into destination object 'warn_a32' of size 32" "pr97027" }
void *p = warn_a32 + 1;
- *(C32*)p = (C32){ c }; // { dg-warning "writing 1 byte into a region of size 0" "pr97027" { xfail *-*-* } }
+ *(C32*)p = (C32){ c }; // { dg-warning "writing (1 byte|32 bytes) into a region of size (0|31)" "pr97027" }
/* Verify a local variable too. */
char a32[32];
p = a32 + 1;
- *(C32*)p = (C32){ c }; // { dg-warning "writing 1 byte into a region of size 0" "pr97027" { xfail *-*-* } }
+ *(C32*)p = (C32){ c }; // { dg-warning "writing (1 byte|32 bytes) into a region of size (0|31)" "pr97027" }
sink (p);
}
@@ -60,15 +60,20 @@ void nowarn_i16_64 (int16_t i)
void warn_i16_64 (int16_t i)
{
- extern char warn_a64[64]; // { dg-message "at offset 128 to object 'warn_a64' with size 64" "pr97027" { xfail *-*-* } }
+/* The IL below that's visible to the warning changes from one target to
+ another. On some like aarch64 it's a single vector store, on others
+ like x86_64 it's a series of BIT_FIELD_REFs. The overflow by
+ the former is detected but the latter is not yet. */
+
+ extern char warn_a64[64]; // { dg-message "at offset (1|128) into destination object 'warn_a64' of size (63|64)" "pr97027 note" { xfail { ! aarch64-*-* } } }
void *p = warn_a64 + 1;
I16_64 *q = (I16_64*)p;
- *q = (I16_64){ i }; // { dg-warning "writing 1 byte into a region of size 0" "pr97027" { xfail *-*-* } }
+ *q = (I16_64){ i }; // { dg-warning "writing (1 byte|64 bytes) into a region of size (0|63)" "pr97027" { xfail { ! aarch64-*-* } } }
char a64[64];
p = a64 + 1;
q = (I16_64*)p;
- *q = (I16_64){ i }; // { dg-warning "writing 1 byte into a region of size 0" "pr97027" { xfail *-*-* } }
+ *q = (I16_64){ i }; // { dg-warning "writing (1 byte|64 bytes) into a region of size (0|63)" "pr97027" { xfail { ! aarch64-*-* } } }
sink (p);
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
index 25f5b82..c3c2dbe 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
@@ -1,6 +1,6 @@
/* Verify that offsets in "anti-ranges" are handled correctly.
{ dg-do compile }
- { dg-options "-O2 -Wall -ftrack-macro-expansion=0" } */
+ { dg-options "-O2 -Wall -ftrack-macro-expansion=0 -fno-ipa-icf" } */
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef __SIZE_TYPE__ size_t;
@@ -66,7 +66,7 @@ void warn_ptrdiff_anti_range_add (ptrdiff_t i)
{
i |= 1;
- char ca5[5]; // { dg-message "at offset \\\[1, 5]" "pr?????" { xfail *-*-* } }
+ char ca5[5]; // { dg-message "at offset \\\[1, 5]" "pr?????" }
char *p0 = ca5; // offset
char *p1 = p0 + i; // 1-5
char *p2 = p1 + i; // 2-5
@@ -74,7 +74,7 @@ void warn_ptrdiff_anti_range_add (ptrdiff_t i)
char *p4 = p3 + i; // 4-5
char *p5 = p4 + i; // 5
- memset (p5, 0, 5); // { dg-warning "writing 5 bytes into a region of size 0" "pr?????" { xfail *-*-* } }
+ memset (p5, 0, 5); // { dg-warning "writing 5 bytes into a region of size" "pr?????" }
sink (p0, p1, p2, p3, p4, p5);
}
@@ -83,7 +83,7 @@ void warn_int_anti_range (int i)
{
i |= 1;
- char ca5[5]; // { dg-message "at offset \\\[1, 5]" "pr?????" { xfail *-*-* } }
+ char ca5[5]; // { dg-message "at offset \\\[1, 5]" "pr?????" }
char *p0 = ca5; // offset
char *p1 = p0 + i; // 1-5
char *p2 = p1 + i; // 2-5
@@ -91,7 +91,7 @@ void warn_int_anti_range (int i)
char *p4 = p3 + i; // 4-5
char *p5 = p4 + i; // 5
- memset (p5, 0, 5); // { dg-warning "writing 5 bytes into a region of size 0" "pr?????" { xfail *-*-* } }
+ memset (p5, 0, 5); // { dg-warning "writing 5 bytes into a region of size" "pr?????" }
sink (p0, p1, p2, p3, p4, p5);
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-61.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-61.c
index 7601679..93c54c6 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-61.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-61.c
@@ -65,7 +65,7 @@ void nowarn_cond_escape (int c, int *x)
void warn_cond_escape (int c, int *x)
{
extern char a3_2[3];
- extern char a5_2[5]; // { dg-message "at offset 5 into destination object 'a5_2'" }
+ extern char a5_2[5]; // { dg-message "at offset 5 into object 'a5_2'" }
char *p;
if (c)
@@ -84,5 +84,5 @@ void warn_cond_escape (int c, int *x)
if (*x == 2)
p[2] = 0;
else if (*x == 5)
- p[5] = 0; // { dg-warning "\\\[-Wstringop-overflow" }
+ p[5] = 0; // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c
new file mode 100644
index 0000000..7b8f3f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c
@@ -0,0 +1,92 @@
+/* PR middle-end/100571 - bogus -Wstringop-overflow with VLA of elements
+ larger than byte
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+__attribute__ ((access (read_only, 1, 2))) void fro (int *, int);
+__attribute__ ((access (write_only, 1, 2))) void fwo (int *, int);
+__attribute__ ((access (read_write, 1, 2))) void frw (int *, int);
+
+extern __SIZE_TYPE__ n;
+
+void alloca_ro (void)
+{
+ int *a = __builtin_alloca (n * sizeof *a);
+ a[0] = 0;
+ fro (a, n);
+}
+
+void alloca_wo (void)
+{
+ int *a = __builtin_alloca (n * sizeof *a);
+ fwo (a, n);
+}
+
+void alloca_rw (void)
+{
+ int *a = __builtin_alloca (n * sizeof *a);
+ a[0] = 0;
+ frw (a, n);
+}
+
+
+void calloc_ro (void)
+{
+ int *a = __builtin_calloc (n, sizeof *a);
+ fro (a, n);
+}
+
+void calloc_wo (void)
+{
+ int *a = __builtin_calloc (n, sizeof *a);
+ fwo (a, n);
+}
+
+void calloc_rw (void)
+{
+ int *a = __builtin_calloc (n, sizeof *a);
+ a[0] = 0;
+ frw (a, n);
+}
+
+
+void malloc_ro (void)
+{
+ int *a = __builtin_malloc (n * sizeof *a);
+ a[0] = 0;
+ fro (a, n);
+}
+
+void malloc_wo (void)
+{
+ int *a = __builtin_malloc (n * sizeof *a);
+ fwo (a, n);
+}
+
+void malloc_rw (void)
+{
+ int *a = __builtin_malloc (n * sizeof *a);
+ a[0] = 0;
+ frw (a, n);
+}
+
+
+void vla_ro (void)
+{
+ int a[n];
+ a[0] = 0;
+ fro (a, n);
+}
+
+void vla_wo (void)
+{
+ int a[n];
+ fwo (a, n);
+}
+
+void vla_rw (void)
+{
+ int a[n];
+ a[0] = 0;
+ frw (a, n);
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
new file mode 100644
index 0000000..6bcba27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
@@ -0,0 +1,104 @@
+/* PR tree-optimization/97027 - missing warning on buffer overflow storing
+ a larger scalar into a smaller array
+ Verify overflow by aggregate stores.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#define A(N) (A ## N)
+#define Ac1 (AC1){ 0 }
+#define Ac2 (AC2){ 0, 1 }
+#define Ac4 (AC4){ 0, 1, 2, 3 }
+#define Ac8 (AC8){ 0, 1, 2, 3, 4, 5, 6, 7 }
+#define Ac16 (AC16){ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
+
+typedef struct AC1 { char a[1]; } AC1;
+typedef struct AC2 { char a[2]; } AC2;
+typedef struct AC3 { char a[3]; } AC3;
+typedef struct AC4 { char a[4]; } AC4;
+typedef struct AC5 { char a[5]; } AC5;
+typedef struct AC8 { char a[8]; } AC8;
+typedef struct AC16 { char a[16]; } AC16;
+
+extern char a1[1], a2[2], a3[3], a4[4], a5[5], a6[6], a7[7], a8[8], a15[15];
+
+extern AC1 ac1;
+extern AC2 ac2;
+extern AC4 ac4;
+extern AC8 ac8;
+extern AC16 ac16;
+
+extern AC1 fac1 (void);
+extern AC2 fac2 (void);
+extern AC4 fac4 (void);
+extern AC8 fac8 (void);
+extern AC16 fac16 (void);
+
+void nowarn (void)
+{
+ *(AC1*)a1 = Ac1;
+ *(AC2*)a2 = Ac2;
+ *(AC4*)a4 = Ac4;
+ *(AC4*)a5 = Ac4;
+ *(AC4*)a6 = Ac4;
+ *(AC4*)a7 = Ac4;
+ *(AC8*)a8 = Ac8;
+ *(AC8*)a15 = Ac8;
+}
+
+void warn_comp_lit_zero (void)
+{
+ *(AC2*)a1 = (AC2){ }; // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(AC4*)a2 = (AC4){ }; // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(AC4*)a3 = (AC4){ }; // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(AC8*)a4 = (AC8){ }; // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(AC8*)a7 = (AC8){ }; // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(AC16*)a15 = (AC16){ };// { dg-warning "writing 16 bytes into a region of size 15" }
+}
+
+void warn_comp_lit (void)
+{
+ *(AC2*)a1 = Ac2; // { dg-warning "writing 2 bytes into a region of size 1" "pr101475" { xfail *-*-* } }
+ *(AC4*)a2 = Ac4; // { dg-warning "writing 4 bytes into a region of size 2" "pr101475" { xfail *-*-* } }
+ *(AC4*)a3 = Ac4; // { dg-warning "writing 4 bytes into a region of size 3" "pr101475" { xfail *-*-* } }
+ *(AC8*)a4 = Ac8; // { dg-warning "writing 8 bytes into a region of size 4" "pr101475" { xfail *-*-* } }
+ *(AC8*)a7 = Ac8; // { dg-warning "writing 8 bytes into a region of size 7" "pr101475" { xfail *-*-* } }
+ *(AC16*)a15 = Ac16; // { dg-warning "writing 16 bytes into a region of size 15" "pr101475" { xfail *-*-* } }
+}
+
+void warn_aggr_decl (void)
+{
+ *(AC2*)a1 = ac2; // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(AC4*)a2 = ac4; // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(AC4*)a3 = ac4; // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(AC8*)a4 = ac8; // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(AC8*)a7 = ac8; // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(AC16*)a15 = ac16; // { dg-warning "writing 16 bytes into a region of size 15" }
+}
+
+void warn_aggr_parm (AC2 pc2, AC4 pc4, AC8 pc8, AC16 pc16)
+{
+ *(AC2*)a1 = pc2; // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(AC4*)a2 = pc4; // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(AC4*)a3 = pc4; // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(AC8*)a4 = pc8; // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(AC8*)a7 = pc8; // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(AC16*)a15 = pc16; // { dg-warning "writing 16 bytes into a region of size 15" }
+}
+
+void warn_aggr_func (void)
+{
+ *(AC2*)a1 = fac2 (); // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(AC4*)a2 = fac4 (); // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(AC4*)a3 = fac4 (); // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(AC8*)a4 = fac8 (); // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(AC8*)a7 = fac8 (); // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(AC16*)a15 = fac16 ();// { dg-warning "writing 16 bytes into a region of size 15" }
+
+ extern AC2 fac2_x ();
+
+ *(AC2*)a1 = fac2_x (); // { dg-warning "writing 2 bytes into a region of size 1" }
+
+ extern AC2 fac2_p (char*);
+
+ *(AC2*)a1 = fac2_p (0); // { dg-warning "writing 2 bytes into a region of size 1" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-69.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-69.c
new file mode 100644
index 0000000..754b481
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-69.c
@@ -0,0 +1,84 @@
+/* PR tree-optimization/97027 - missing warning on buffer overflow storing
+ a larger scalar into a smaller array
+ Verify overflow by vector stores.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#define V(N) __attribute__ ((vector_size (N)))
+#define C1 (VC1){ 0 }
+#define C2 (VC2){ 0, 1 }
+#define C4 (VC4){ 0, 1, 2, 3 }
+#define C8 (VC8){ 0, 1, 2, 3, 4, 5, 6, 7 }
+#define C16 (VC16){ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
+
+typedef V (1) char VC1;
+typedef V (2) char VC2;
+typedef V (4) char VC4;
+typedef V (8) char VC8;
+typedef V (16) char VC16;
+
+extern char a1[1], a2[2], a3[3], a4[4], a5[5], a6[6], a7[7], a8[8], a15[15];
+
+extern VC1 c1;
+extern VC2 c2;
+extern VC4 c4;
+extern VC8 c8;
+extern VC16 c16;
+
+extern VC1 fc1 (void);
+extern VC2 fc2 (void);
+extern VC4 fc4 (void);
+extern VC8 fc8 (void);
+extern VC16 fc16 (void);
+
+void nowarn (void)
+{
+ *(VC1*)a1 = C1;
+ *(VC2*)a2 = C2;
+ *(VC4*)a4 = C4;
+ *(VC4*)a5 = C4;
+ *(VC4*)a6 = C4;
+ *(VC4*)a7 = C4;
+ *(VC8*)a8 = C8;
+ *(VC8*)a15 = C8;
+}
+
+void warn_vec_lit (void)
+{
+ *(VC2*)a1 = C2; // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(VC4*)a2 = C4; // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(VC4*)a3 = C4; // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(VC8*)a4 = C8; // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(VC8*)a7 = C8; // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(VC16*)a15 = C16; // { dg-warning "writing 16 bytes into a region of size 15" }
+}
+
+void warn_vec_decl (void)
+{
+ *(VC2*)a1 = c2; // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(VC4*)a2 = c4; // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(VC4*)a3 = c4; // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(VC8*)a4 = c8; // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(VC8*)a7 = c8; // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(VC16*)a15 = c16; // { dg-warning "writing 16 bytes into a region of size 15" }
+}
+
+void warn_vec_parm (VC2 pc2, VC4 pc4, VC8 pc8, VC16 pc16)
+{
+ *(VC2*)a1 = pc2; // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(VC4*)a2 = pc4; // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(VC4*)a3 = pc4; // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(VC8*)a4 = pc8; // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(VC8*)a7 = pc8; // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(VC16*)a15 = pc16; // { dg-warning "writing 16 bytes into a region of size 15" }
+}
+
+void warn_vec_func (void)
+{
+ *(VC2*)a1 = fc2 (); // { dg-warning "writing 2 bytes into a region of size 1" }
+ *(VC4*)a2 = fc4 (); // { dg-warning "writing 4 bytes into a region of size 2" }
+ *(VC4*)a3 = fc4 (); // { dg-warning "writing 4 bytes into a region of size 3" }
+ *(VC8*)a4 = fc8 (); // { dg-warning "writing 8 bytes into a region of size 4" }
+ *(VC8*)a7 = fc8 (); // { dg-warning "writing 8 bytes into a region of size 7" }
+ *(VC16*)a15 = fc16 ();// { dg-warning "writing 16 bytes into a region of size 15" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-70.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-70.c
new file mode 100644
index 0000000..82c4d9f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-70.c
@@ -0,0 +1,24 @@
+/* PR tree-optimization/97027 - missing warning on buffer overflow storing
+ a larger scalar into a smaller array
+ Verify overflow by vector stores.
+ { dg-do compile }
+ { dg-options "-O3" } */
+
+void* nowarn_loop (void)
+{
+ char *p = __builtin_malloc (16);
+ for (int i = 0; i != 16; ++i)
+ p[i] = i;
+ return p;
+}
+
+void* warn_loop (void)
+{
+ char *p = __builtin_malloc (15);
+ for (int i = 0; i != 16; ++i)
+ /* The size of the write below depends on the target. When vectorized
+ the vector size may be 4 or 16, otherwise it may be a series of byte
+ assignments. */
+ p[i] = i; // { dg-warning "writing (1|2|4|16) bytes? into a region of size (0|1|3|15)" }
+ return p;
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-71.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-71.c
new file mode 100644
index 0000000..f56a005
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-71.c
@@ -0,0 +1,113 @@
+/* PR tree-optimization/97027 - missing warning on buffer overflow storing
+ a larger scalar into a smaller array
+ Verify warnings for overflow by stores of results of built-in functions.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+typedef __INT16_TYPE__ int16_t;
+typedef __SIZE_TYPE__ size_t;
+
+extern int abs (int);
+
+extern void* alloca (size_t);
+
+extern double nan (const char *);
+
+#ifdef __DEC32_MAX__
+ _Decimal32 nand32 (const char *);
+#else
+/* _Decimal32 is supported only conditionally and not available on all
+ targets. */
+# define _Decimal32 double
+# define nand32(s) nan (s)
+#endif
+
+extern size_t strlen (const char *);
+extern char* strcpy (char *, const char *);
+
+
+extern unsigned char ax[], a1[1], a2[2], a8[8];
+
+
+void nowarn_abs (int i)
+{
+ *(int *)ax = abs (i);
+ *(char *)a1 = abs (i);
+}
+
+void warn_abs (int i)
+{
+ *(int *)a1 = abs (i); // { dg-warning "\\\[-Wstringop-overflow" }
+}
+
+
+void nowarn_alloca (size_t n)
+{
+ *(void **)ax = alloca (n);
+}
+
+void warn_alloca (size_t n)
+{
+ *(void **)a1 = alloca (n); // { dg-warning "\\\[-Wstringop-overflow" }
+}
+
+
+void nowarn_complex (double x, double i)
+{
+ *(_Complex double *)ax = __builtin_complex (x, i);
+}
+
+void warn_complex (double x, double i)
+{
+ _Complex double *p = (_Complex double *)a1;
+ *p = __builtin_complex (x, i); // { dg-warning "\\\[-Wstringop-overflow" "pr101455" { xfail *-*-* } }
+}
+
+
+__attribute__ ((noipa)) void nowarn_nan (const char *s)
+{
+ *(double *)ax = nan (s);
+}
+
+__attribute__ ((noipa)) void warn_nan (const char *s)
+{
+ *(double *)a1 = nan (s); // { dg-warning "\\\[-Wstringop-overflow" }
+}
+
+
+__attribute__ ((noipa)) void nowarn_nand32 (const char *s)
+{
+ *(_Decimal32 *)ax = nand32 (s);
+}
+
+__attribute__ ((noipa)) void warn_nand32 (const char *s)
+{
+ *(_Decimal32 *)a1 = nand32 (s); // { dg-warning "\\\[-Wstringop-overflow" }
+}
+
+
+void nowarn_strlen (const char *s1, const char *s2, const char *s3)
+{
+ *(char *)ax = strlen (s1);
+ *(char *)a1 = strlen (s2);
+ *(size_t *)a8 = strlen (s3);
+}
+
+void warn_strlen (const char *s1, const char *s2)
+{
+ *(int16_t *)a1 = strlen (s1); // { dg-warning "\\\[-Wstringop-overflow" }
+ *(size_t *)a2 = strlen (s2); // { dg-warning "\\\[-Wstringop-overflow" "!ptr_eq_short" { target { ! ptr_eq_short } } }
+}
+
+
+void nowarn_strcpy (char *s1, char *s2, const char *s3)
+{
+ *(char **)ax = strcpy (s1, s2);
+ *(char **)a8 = strcpy (s2, s3);
+}
+
+void warn_strcpy (char *s1, char *s2, const char *s3)
+{
+ *(char **)a1 = strcpy (s1, s2); // { dg-warning "\\\[-Wstringop-overflow" }
+ *(char **)a2 = strcpy (s2, s3); // { dg-warning "\\\[-Wstringop-overflow" "!ptr_eq_short" { target { ! ptr_eq_short } } }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-72.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-72.c
new file mode 100644
index 0000000..c10773e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-72.c
@@ -0,0 +1,13 @@
+/* PR middle-end/101854 - Invalid warning -Wstringop-overflow wrong argument
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct A { int a[5]; };
+
+struct A g (int*, int[6][8]);
+
+struct A f (void)
+{
+ int a[2];
+ return g (a, 0); // { dg-bogus "-Wstringop-overflow" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-73.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-73.c
new file mode 100644
index 0000000..0bb4afe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-73.c
@@ -0,0 +1,35 @@
+/*
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+int memcmp (const void*, const void*, size_t);
+int strncmp (const char*, const char*, size_t);
+char* stpncpy (char*, const char*, size_t);
+char* strncpy (char*, const char*, size_t);
+
+extern char a4[4], b5[5];
+
+struct A { char a4[4]; };
+
+extern volatile int i;
+extern void* volatile ptr;
+
+void test_stpncpy (struct A *p)
+{
+ ptr = stpncpy (a4, b5, 4);
+ ptr = stpncpy (a4, b5, 5); // { dg-warning "writing 5 bytes" }
+
+ ptr = stpncpy (p->a4, b5, 4);
+ ptr = stpncpy (p->a4, b5, 5); // { dg-warning "writing 5 bytes" }
+}
+
+void test_strncpy (struct A *p)
+{
+ ptr = strncpy (a4, b5, 4);
+ ptr = strncpy (a4, b5, 5); // { dg-warning "writing 5 bytes" }
+
+ ptr = strncpy (p->a4, b5, 4);
+ ptr = strncpy (p->a4, b5, 5); // { dg-warning "writing 5 bytes" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overread-6.c b/gcc/testsuite/gcc.dg/Wstringop-overread-6.c
new file mode 100644
index 0000000..a8177a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overread-6.c
@@ -0,0 +1,574 @@
+/* Verify -Wstringop-overread is issued appropriately for calls to string
+ functions at -O0 and without -Wall.
+ { dg-do compile }
+ { dg-options "-O0 -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+#define S2 "12"
+#define S9 "123456789"
+
+// <libint.h> functions.
+
+char* gettext (const char *);
+
+// <stdio.h> functions.
+
+typedef struct FILE FILE;
+
+int fputs (const char*, FILE*);
+int fputs_unlocked (const char*, FILE*);
+
+int puts (const char*);
+int puts_unlocked (const char*);
+
+// <string.h> functions.
+
+void* memchr (const void*, int, size_t);
+int memcmp (const void*, const void*, size_t);
+void* memcpy (void*, const void*, size_t);
+void* mempcpy (void*, const void*, size_t);
+void* memmove (void*, const void*, size_t);
+
+char* strchr (const char*, int);
+char* strrchr (const char*, int);
+
+int strcmp (const char*, const char*);
+int strncmp (const char*, const char*, size_t);
+
+char* strcat (char*, const char*);
+char* stpcpy (char*, const char*);
+char* strcpy (char*, const char*);
+char* stpncpy (char*, const char*, size_t);
+char* strncpy (char*, const char*, size_t);
+char* strdup (const char*);
+char* strndup (const char*, size_t);
+
+char* strpbrk (const char*, const char*);
+size_t strcspn (const char*, const char*);
+size_t strspn (const char*, const char*);
+char* strstr (const char*, const char*);
+
+size_t strlen (const char*);
+size_t strnlen (const char*, size_t);
+
+
+extern void* malloc (size_t);
+
+void sink (void*);
+
+
+extern char *d;
+extern char a0[0];
+
+const char arr[7] = "abc\0def";
+
+/* Unterminated array at the end of ARR above. */
+#define unterm (arr + __builtin_strlen (arr) + 1)
+
+/* Size of the unterminated array - 1. */
+#define unterm_size (sizeof arr - __builtin_strlen (arr) - 1)
+
+const void* nowarn_memchr (int x)
+{
+ const char *p1 = unterm;
+ return memchr (p1, x, unterm_size);
+}
+
+const void* warn_memchr (int x)
+{
+ const char *p1 = unterm;
+ return memchr (p1, x, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void* nowarn_memcpy (void)
+{
+ const char *s = unterm;
+ return memcpy (d, s, unterm_size);
+}
+
+void* warn_memcpy (void)
+{
+ const char *s = unterm;
+ /* Use + 2 for an odd size to prevent the memmove --> MEM_REF transform
+ from defeating the warning (for now). */
+ return memcpy (d, s, unterm_size + 2 | 1); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void* nowarn_mempcpy (void)
+{
+ const char *s = unterm;
+ return mempcpy (d, s, unterm_size);
+}
+
+void* warn_mempcpy (void)
+{
+ const char *s = unterm;
+ /* Use + 2 for an odd size to prevent the memmove --> MEM_REF transform
+ from defeating the warning (for now). */
+ return mempcpy (d, s, unterm_size + 2 | 1); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void* nowarn_memmove (void)
+{
+ const char *s = unterm;
+ return memmove (d, s, unterm_size);
+}
+
+void* warn_memmove (void)
+{
+ const char *s = unterm;
+ /* Use + 2 for an odd size to prevent the memmove --> MEM_REF transform
+ from defeating the warning (for now). */
+ return memmove (d, s, unterm_size + 2); // { dg-warning "-Wstringop-overread" }
+}
+
+
+int nowarn_memcmp_1 (const char *p2)
+{
+ const char *p1 = unterm;
+ return memcmp (p1, p2, unterm_size);
+}
+
+int warn_memcmp_1 (const char *p2)
+{
+ const char *p1 = unterm;
+ return memcmp (p1, p2, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+int nowarn_memcmp_2 (const char *p1)
+{
+ const char *p2 = unterm;
+ return memcmp (p1, p2, unterm_size);
+}
+
+int warn_memcmp_2 (const char *p1)
+{
+ const char *p2 = unterm;
+ return memcmp (p1, p2, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void warn_strcat (void)
+{
+ strcat (d, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_strcat_a0 (void)
+{
+ strcat (d, a0); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_strcat_end (void)
+{
+ const char *s = arr + sizeof arr;
+ strcat (d, s); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_stpcpy (void)
+{
+ return stpcpy (d, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_stpcpy_a0 (void)
+{
+ return stpcpy (d, a0); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_stpcpy_end (void)
+{
+ const char *s = arr + sizeof arr;
+ return stpcpy (d, s); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_stpcpy_malloc0 (void)
+{
+ char *s = malloc (0);
+ sink (s);
+ return stpcpy (d, s); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void warn_strcpy (void)
+{
+ strcpy (d, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_strcpy_a0 (void)
+{
+ strcpy (d, a0); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_strcpy_end (void)
+{
+ const char *s = arr + sizeof arr;
+ strcpy (d, s); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_strcpy_malloc0 (void)
+{
+ char *s = malloc (0);
+ sink (s);
+ strcpy (d, s); // { dg-warning "-Wstringop-overread" }
+}
+
+
+char* nowarn_stpncpy (void)
+{
+ const char *s = unterm;
+ return stpncpy (d, s, unterm_size);
+}
+
+char* warn_stpncpy (void)
+{
+ const char *s = unterm;
+ return stpncpy (d, s, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_stpncpy_a0 (void)
+{
+ return stpncpy (d, a0, 3); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_stpncpy_end (void)
+{
+ const char *s = arr + sizeof arr;
+ return stpncpy (d, s, sizeof arr); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void nowarn_strncpy (void)
+{
+ const char *s = unterm;
+ strncpy (d, s, unterm_size);
+}
+
+void warn_strncpy (void)
+{
+ const char *s = unterm;
+ strncpy (d, s, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_strncpy_a0 (void)
+{
+ const char *s = a0;
+ strncpy (d, s, sizeof arr); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_strncpy_end (void)
+{
+ const char *s = arr + sizeof arr;
+ strncpy (d, s, sizeof arr); // { dg-warning "-Wstringop-overread" }
+}
+
+
+int warn_strlen (void)
+{
+ return strlen (unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strlen_a0 (void)
+{
+ return strlen (a0); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strlen_end (void)
+{
+ const char *s = arr + sizeof arr;
+ return strlen (s); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strlen_malloc0 (void)
+{
+ char *s = malloc (0);
+ sink (s);
+ return strlen (s); // { dg-warning "-Wstringop-overread" }
+}
+
+
+int nowarn_strnlen (void)
+{
+ return strnlen (unterm, unterm_size);
+}
+
+int warn_strnlen (void)
+{
+ return strnlen (unterm, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strnlen_end (void)
+{
+ const char *s = arr + sizeof arr;
+ return strnlen (s, 2); // { dg-warning "-Wstringop-overread" }
+}
+
+
+int warn_strcmp_1 (const char *s)
+{
+ return strcmp (unterm, s); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strcmp_2 (const char *s)
+{
+ return strcmp (s, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strcmp_2_end (const char *s)
+{
+ const char *t = arr + sizeof arr;
+ return strcmp (s, t); // { dg-warning "-Wstringop-overread" }
+}
+
+
+int nowarn_strncmp_1 (const char *s2)
+{
+ const char *s1 = unterm;
+ return strncmp (s1, s2, unterm_size);
+}
+
+int warn_strncmp_1 (const char *s2)
+{
+ const char *s1 = unterm;
+ return strncmp (s1, s2, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+int nowarn_strncmp_2 (const char *s1)
+{
+ const char *s2 = unterm;
+ return strncmp (s1, s2, unterm_size);
+}
+
+int warn_strncmp_2 (const char *s1)
+{
+ const char *s2 = unterm;
+ return strncmp (s1, s2, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strncmp_2_end (const char *s1)
+{
+ const char *s2 = arr + sizeof arr;;
+ return strncmp (s1, s2, sizeof arr); // { dg-warning "-Wstringop-overread" }
+}
+
+
+int nowarn_strncmp_1_s2 (void)
+{
+ /* Since the read is also bounded by the length of the S2 literal
+ and so safe, expect no warning. */
+ const char *s = unterm;
+ return strncmp (s, S2, unterm_size + 1); // { dg-bogus "-Wstringop-overread" "pr101778" { xfail *-*-* } }
+}
+
+int warn_strncmp_2_s2 (void)
+{
+ /* Same as above. */
+ const char *t = unterm;
+ return strncmp (S2, t, unterm_size + 1); // { dg-bogus "-Wstringop-overread" "pr101778" { xfail *-*-* } }
+}
+
+
+int warn_strncmp_1_s9 (void)
+{
+ /* Since both the bound and the length of the S9 literal are greater
+ than the size of UNNTERM the call reads past the end of the array.
+ Expect a warning. */
+ const char *s1 = unterm;
+ return strncmp (s1, S9, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+int warn_strncmp_2_s9 (void)
+{
+ /* Same as above. */
+ const char *s2 = unterm;
+ return strncmp (S9, s2, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+
+const char* warn_strchr (int x)
+{
+ return strchr (unterm, x); // { dg-warning "-Wstringop-overread" }
+}
+
+const char* warn_strchr_end (int x)
+{
+ const char *s = arr + sizeof arr;
+ return strchr (s, x); // { dg-warning "-Wstringop-overread" }
+}
+
+
+const char* warn_strrchr (int x)
+{
+ return strrchr (unterm, x); // { dg-warning "-Wstringop-overread" }
+}
+
+const char* warn_strrchr_end (int x)
+{
+ const char *s = arr + sizeof arr;
+ return strrchr (s, x); // { dg-warning "-Wstringop-overread" }
+}
+
+
+char* warn_strdup (void)
+{
+ return strdup (unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_strdup_end (void)
+{
+ const char *s = arr + sizeof arr;
+ return strdup (s); // { dg-warning "-Wstringop-overread" }
+}
+
+
+char* nowarn_strndup (void)
+{
+ return strndup (unterm, unterm_size);
+}
+
+char* warn_strndup (void)
+{
+ return strndup (unterm, unterm_size + 1); // { dg-warning "-Wstringop-overread" }
+}
+
+char* warn_strndup_end (void)
+{
+ const char *s = arr + sizeof arr;
+ return strndup (s, sizeof arr); // { dg-warning "-Wstringop-overread" }
+}
+
+
+const char* warn_strpbrk_1 (const char *s2)
+{
+ return strpbrk (unterm, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+const char* warn_strpbrk_2 (const char *s1)
+{
+ return strpbrk (s1, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+
+size_t warn_strspn_1 (const char *s2)
+{
+ return strspn (unterm, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+size_t warn_strspn_1_end (const char *s2)
+{
+ const char *s1 = arr + sizeof arr;
+ return strspn (s1, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+size_t warn_strspn_2 (const char *s1)
+{
+ return strspn (s1, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+size_t warn_strspn_2_end (const char *s1)
+{
+ const char *s2 = arr + sizeof arr;
+ return strspn (s1, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+
+size_t warn_strcspn_1 (const char *s2)
+{
+ return strcspn (unterm, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+size_t warn_strcspn_1_end (const char *s2)
+{
+ const char *s1 = arr + sizeof arr;
+ return strcspn (s1, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+size_t warn_strcspn_2 (const char *s1)
+{
+ return strcspn (s1, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+size_t warn_strcspn_2_end (const char *s1)
+{
+ const char *s2 = arr + sizeof arr;
+ return strcspn (s1, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+
+const char* warn_strstr_1 (const char *s2)
+{
+ return strstr (unterm, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+const char* warn_strstr_1_end (const char *s2)
+{
+ const char *s1 = arr + sizeof arr;
+ return strstr (s1, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+
+const char* warn_strstr_2 (const char *s1)
+{
+ return strstr (s1, unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+const char* warn_strstr_2_end (const char *s1)
+{
+ const char *s2 = arr + sizeof arr;
+ return strstr (s1, s2); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void warn_puts (void)
+{
+ puts (unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_puts_end (void)
+{
+ const char *s = arr + sizeof arr;
+ puts (s); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void warn_fputs (FILE *f)
+{
+ fputs (unterm, f); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_fputs_end (FILE *f)
+{
+ const char *s = arr + sizeof arr;
+ fputs (s, f); // { dg-warning "-Wstringop-overread" }
+}
+
+
+void warn_puts_unlocked (void)
+{
+ puts_unlocked (unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_puts_unlocked_end (void)
+{
+ const char *s = arr + sizeof arr;
+ puts_unlocked (s); // { dg-warning "-Wstringop-overread" }
+}
+
+void warn_fputs_unlocked (FILE *f)
+{
+ fputs_unlocked (unterm, f); // { dg-warning "-Wstringop-overread" }
+}
+
+
+const char* warn_gettext (void)
+{
+ return gettext (unterm); // { dg-warning "-Wstringop-overread" }
+}
+
+const char* warn_gettext_end (void)
+{
+ const char *s = arr + sizeof arr;
+ return gettext (s); // { dg-warning "-Wstringop-overread" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overread.c b/gcc/testsuite/gcc.dg/Wstringop-overread.c
index 0343e43..7db7402 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overread.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overread.c
@@ -317,9 +317,9 @@ void test_strnlen_array (int i, int i0, unsigned n)
T (strnlen (a1, n));
T (strnlen (a1 + 1, 0));
- T (strnlen (a1 + 1, 1)); // { dg-warning "'strnlen' reading 1 byte from a region of size 0" }
+ T (strnlen (a1 + 1, 1)); // { dg-warning "'strnlen' specified bound 1 exceeds source size 0" }
T (strnlen (a1 + 1, i0));
- T (strnlen (a1 + 1, i0 + 1)); // { dg-warning "'strnlen' reading between 1 and \[0-9\]+ bytes from a region of size 0" }
+ T (strnlen (a1 + 1, i0 + 1)); // { dg-warning "'strnlen' specified bound \\\[1, \\d+] exceeds source size 0" }
T (strnlen (a1 + 1, n));
T (strnlen (a1 + i, 0));
T (strnlen (a1 + i, 1));
@@ -335,7 +335,7 @@ void test_strnlen_array (int i, int i0, unsigned n)
T (strnlen (a1 + i0, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" }
T (strnlen (a1 + i0, n));
T (strnlen (a1 + i0 + 1, 0));
- T (strnlen (a1 + i0 + 1, 1)); // { dg-warning "'strnlen' reading 1 byte from a region of size 0" }
+ T (strnlen (a1 + i0 + 1, 1)); // { dg-warning "'strnlen' specified bound 1 exceeds source size 0" }
T (strnlen (a1 + i0 + 1, n));
T (strnlen (a2, 0));
@@ -344,10 +344,10 @@ void test_strnlen_array (int i, int i0, unsigned n)
T (strnlen (a2, n));
T (strnlen (a2 + 1, 0));
T (strnlen (a2 + 1, 1));
- T (strnlen (a2 + 1, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" "pr87492" { xfail *-*-* } }
+ T (strnlen (a2 + 1, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" "pr87492" }
T (strnlen (a2 + 1, n));
T (strnlen (a2 + 2, 0));
- T (strnlen (a2 + 2, 1)); // { dg-warning "'strnlen' reading 1 byte from a region of size 0" }
+ T (strnlen (a2 + 2, 1)); // { dg-warning "'strnlen' specified bound 1 exceeds source size 0" }
T (strnlen (a2 + 2, n));
T (strnlen (a2 + i, 0));
T (strnlen (a2 + i, 1));
@@ -365,13 +365,13 @@ void test_strnlen_array (int i, int i0, unsigned n)
T (strnlen (a2 + i0 + 1, 0));
T (strnlen (a2 + i0 + 1, 1));
- T (strnlen (a2 + i0 + 1, 2));
+ T (strnlen (a2 + i0 + 1, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" }
T (strnlen (a2 + i0 + 1, n));
T (strnlen (a2 + i0 + 2, 0));
- T (strnlen (a2 + i0 + 2, 1)); // { dg-warning "'strnlen' reading 1 byte from a region of size 0" }
+ T (strnlen (a2 + i0 + 2, 1)); // { dg-warning "'strnlen' specified bound 1 exceeds source size 0" }
T (strnlen (a2 + i0 + 2, i0));
- T (strnlen (a2 + i0 + 2, i0 + 1)); // { dg-warning "'strnlen' reading between 1 and \[0-9\]+ bytes from a region of size 0" }
+ T (strnlen (a2 + i0 + 2, i0 + 1)); // { dg-warning "'strnlen' specified bound \\\[1, \\d+] exceeds source size 0" }
T (strnlen (a2 + i0 + 2, n));
}
@@ -512,9 +512,9 @@ void test_strndup_array (int i, int i0, unsigned n)
T (strndup (a1, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" }
T (strndup (a1, n));
T (strndup (a1 + 1, 0));
- T (strndup (a1 + 1, 1)); // { dg-warning "'strndup' reading 1 byte from a region of size 0" }
+ T (strndup (a1 + 1, 1)); // { dg-warning "'strndup' specified bound 1 exceeds source size 0" }
T (strndup (a1 + 1, i0));
- T (strndup (a1 + 1, i0 + 1)); // { dg-warning "'strndup' reading between 1 and \[0-9\]+ bytes from a region of size 0" }
+ T (strndup (a1 + 1, i0 + 1)); // { dg-warning "'strndup' specified bound \\\[1, \\d+] exceeds source size 0" }
T (strndup (a1 + 1, n));
T (strndup (a1 + i, 0));
T (strndup (a1 + i, 1));
@@ -529,7 +529,7 @@ void test_strndup_array (int i, int i0, unsigned n)
T (strndup (a1 + i0, 1));
T (strndup (a1 + i0, n));
T (strndup (a1 + i0 + 1, 0));
- T (strndup (a1 + i0 + 1, 1)); // { dg-warning "'strndup' reading 1 byte from a region of size 0" }
+ T (strndup (a1 + i0 + 1, 1)); // { dg-warning "'strndup' specified bound 1 exceeds source size 0" }
T (strndup (a1 + i0 + 1, n));
T (strndup (a2, 0));
@@ -538,10 +538,10 @@ void test_strndup_array (int i, int i0, unsigned n)
T (strndup (a2, n));
T (strndup (a2 + 1, 0));
T (strndup (a2 + 1, 1));
- T (strndup (a2 + 1, 2));
+ T (strndup (a2 + 1, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" }
T (strndup (a2 + 1, n));
T (strndup (a2 + 2, 0));
- T (strndup (a2 + 2, 1)); // { dg-warning "'strndup' reading 1 byte from a region of size 0" }
+ T (strndup (a2 + 2, 1)); // { dg-warning "'strndup' specified bound 1 exceeds source size 0" }
T (strndup (a2 + 2, n));
T (strndup (a2 + i, 0));
T (strndup (a2 + i, 1));
@@ -559,13 +559,13 @@ void test_strndup_array (int i, int i0, unsigned n)
T (strndup (a2 + i0 + 1, 0));
T (strndup (a2 + i0 + 1, 1));
- T (strndup (a2 + i0 + 1, 2));
+ T (strndup (a2 + i0 + 1, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" }
T (strndup (a2 + i0 + 1, n));
T (strndup (a2 + i0 + 2, 0));
- T (strndup (a2 + i0 + 2, 1)); // { dg-warning "'strndup' reading 1 byte from a region of size 0" }
+ T (strndup (a2 + i0 + 2, 1)); // { dg-warning "'strndup' specified bound 1 exceeds source size 0" }
T (strndup (a2 + i0 + 2, i0));
- T (strndup (a2 + i0 + 2, i0 + 1)); // { dg-warning "'strndup' reading between 1 and \[0-9\]+ bytes from a region of size 0" }
+ T (strndup (a2 + i0 + 2, i0 + 1)); // { dg-warning "'strndup' specified bound \\\[1, \\d+] exceeds source size 0" }
T (strndup (a2 + i0 + 2, n));
}
diff --git a/gcc/testsuite/gcc.dg/Wunused-result.c b/gcc/testsuite/gcc.dg/Wunused-result.c
new file mode 100644
index 0000000..c0bb9ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wunused-result.c
@@ -0,0 +1,50 @@
+/* PR c/99972 - missing -Wunused-result on a call to a locally redeclared
+ warn_unused_result function
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+void gwur_local_local (void)
+{
+ __attribute__ ((warn_unused_result)) int fwur1 (void);
+
+ fwur1 (); // { dg-warning "\\\[-Wunused-result" }
+}
+
+void hwur_local_local (void)
+{
+ /* Verify the attribute from the declaration above is copied/merged
+ into the declaration below. */
+ int fwur1 (void);
+
+ fwur1 (); // { dg-warning "\\\[-Wunused-result" }
+}
+
+
+void gwur_local_global (void)
+{
+ __attribute__ ((warn_unused_result)) int fwur2 (void);
+
+ fwur2 (); // { dg-warning "\\\[-Wunused-result" }
+}
+
+int fwur2 (void);
+
+void hwur_local_global (void)
+{
+ fwur2 (); // { dg-warning "\\\[-Wunused-result" }
+}
+
+
+__attribute__ ((warn_unused_result)) int fwur3 (void);
+
+void gwur_global_local (void)
+{
+ fwur3 (); // { dg-warning "\\\[-Wunused-result" }
+}
+
+void hwur_global_local (void)
+{
+ int fwur3 (void);
+
+ fwur3 (); // { dg-warning "\\\[-Wunused-result" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wunused-var-5.c b/gcc/testsuite/gcc.dg/Wunused-var-5.c
new file mode 100644
index 0000000..cc5bbf5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wunused-var-5.c
@@ -0,0 +1,23 @@
+/* PR c/99588 */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -Wunused-but-set-variable" } */
+
+void bar (int, ...);
+void f1 (void) { static _Atomic int x = 0; bar (0, x); }
+void f2 (void) { static _Atomic int x = 0; bar (0, x += 1); }
+void f3 (void) { static _Atomic int x = 0; bar (x); }
+void f4 (void) { static _Atomic int x = 0; bar (x += 1); }
+void f5 (void) { static _Atomic int x = 0; bar (x = 1); }
+void f6 (void) { static _Atomic int x = 0; x = 1; } /* { dg-warning "variable 'x' set but not used" } */
+void f7 (void) { static _Atomic int x = 0; x += 3; }
+void f8 (void) { _Atomic int x = 0; bar (0, x); }
+void f9 (void) { _Atomic int x = 0; bar (0, x += 1); }
+void f10 (void) { _Atomic int x = 0; bar (x); }
+void f11 (void) { _Atomic int x = 0; bar (x += 1); }
+void f12 (void) { _Atomic int x = 0; bar (x = 1); }
+void f13 (void) { _Atomic int x = 0; x = 1; } /* { dg-warning "variable 'x' set but not used" } */
+void f14 (void) { _Atomic int x = 0; x += 3; }
+void f15 (void) { _Atomic int x = 0; int y = 3; x += y; }
+void f16 (void) { _Atomic int x = 0; int y = 3; bar (x += y); }
+void f17 (void) { _Atomic int x = 0; int y = 3; x = y; } /* { dg-warning "variable 'x' set but not used" } */
+void f18 (void) { _Atomic int x = 0; int y = 3; bar (x = y); }
diff --git a/gcc/testsuite/gcc.dg/Wunused-var-6.c b/gcc/testsuite/gcc.dg/Wunused-var-6.c
new file mode 100644
index 0000000..f48a455
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wunused-var-6.c
@@ -0,0 +1,14 @@
+/* PR c/99588 */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -Wunused-but-set-variable" } */
+
+void bar (int, ...);
+struct S { int a, b, c; };
+typedef _Atomic struct S T;
+
+void
+foo (void)
+{
+ static T x = (struct S) { 0, 0, 0 }; /* { dg-bogus "set but not used" } */
+ bar (0, x = (struct S) { 1, 1, 1 });
+}
diff --git a/gcc/testsuite/gcc.dg/Wvla-larger-than-5.c b/gcc/testsuite/gcc.dg/Wvla-larger-than-5.c
new file mode 100644
index 0000000..c131f83
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-larger-than-5.c
@@ -0,0 +1,38 @@
+/* PR middle-end/100510 - bogus -Wvla-large-than with -Walloca
+ { dg-do compile }
+ { dg-options "-O0 -Walloca -Wvla-larger-than=1000" } */
+
+void f (void*);
+
+#pragma GCC optimize ("0")
+
+void nowarn_O0 (__SIZE_TYPE__ n)
+{
+ if (n > 32)
+ return;
+
+ char a[n]; // { dg-bogus "\\\[-Wvla-larger-than=" }
+ f (a);
+}
+
+#pragma GCC optimize ("1")
+
+void nowarn_O1 (__SIZE_TYPE__ n)
+{
+ if (n > 33)
+ return;
+
+ char a[n]; // { dg-bogus "\\\[-Wvla-larger-than=" }
+ f (a);
+}
+
+#pragma GCC optimize ("2")
+
+void nowarn_O2 (__SIZE_TYPE__ n)
+{
+ if (n > 34)
+ return;
+
+ char a[n]; // { dg-bogus "\\\[-Wvla-larger-than=" }
+ f (a);
+}
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-10.c b/gcc/testsuite/gcc.dg/Wvla-parameter-10.c
new file mode 100644
index 0000000..68db3ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-10.c
@@ -0,0 +1,68 @@
+/* PR c/100719 - missing -Wvla-parameter on a mismatch in second parameter
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+typedef struct A1 { int i; } A1;
+typedef struct A2 { int i; } A2;
+typedef struct A3 { int i; } A3;
+
+void f2 (int n, A1[n], A2[n]);
+void f2 (int n, A1[n], A2[n]);
+
+void f2_x1 (int n, A1[n], A2[n]); // { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" }
+void f2_x1 (int n, A1[n + 1], A2[n]); // { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" }
+
+void f2_x2 (int n, A1[n], A2[n]); // { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" }
+void f2_x2 (int n, A1[n], A2[n + 2]); // { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" }
+
+
+void f3 (int n, A1[n], A2[n], A3[n]);
+void f3 (int n, A1[n], A2[n], A3[n]);
+
+void f3_x1 (int n, A1[n], A2[n], A3[n]);
+// { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void f3_x1 (int n, A1[n + 1], A2[n], A3[n]);
+// { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" "" { target *-*-* } .-1 }
+
+void f3_x2 (int n, A1[n], A2[n], A3[n]);
+// { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void f3_x2 (int n, A1[n], A2[n + 2], A3[n]);
+// { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" "" { target *-*-* } .-1 }
+
+void f3_x3 (int n, A1[n], A2[n], A3[n]);
+// { dg-note "previously declared as 'A3\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void f3_x3 (int n, A1[n], A2[n], A3[n + 3]);
+// { dg-warning "argument 4 of type 'A3\\\[n \\+ 3]' declared with mismatched bound 'n \\+ 3'" "" { target *-*-* } .-1 }
+
+
+void g3_x1 (int n, A1[n], A2[*], A3[n]);
+// { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void g3_x1 (int n, A1[n + 1], A2[*], A3[n]);
+// { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" "" { target *-*-* } .-1 }
+
+void g3_x2 (int n, A1[*], A2[n], A3[n]);
+// { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void g3_x2 (int n, A1[*], A2[n + 2], A3[n]);
+// { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" "" { target *-*-* } .-1 }
+
+void g3_x3 (int n, A1[*], A2[*], A3[n]);
+// { dg-note "previously declared as 'A3\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void g3_x3 (int n, A1[*], A2[*], A3[n + 3]);
+// { dg-warning "argument 4 of type 'A3\\\[n \\+ 3]' declared with mismatched bound 'n \\+ 3'" "" { target *-*-* } .-1 }
+
+
+void h3_x1 (int n, A1[n], A2[ ], A3[n]);
+// { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void h3_x1 (int n, A1[n + 1], A2[ ], A3[n]);
+// { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" "" { target *-*-* } .-1 }
+
+void h3_x2 (int n, A1[ ], A2[n], A3[n]);
+// { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void h3_x2 (int n, A1[ ], A2[n + 2], A3[n]);
+// { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" "" { target *-*-* } .-1 }
+
+void h3_x3 (int n, A1[ ], A2[ ], A3[n]);
+// { dg-note "previously declared as 'A3\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
+void h3_x3 (int n, A1[ ], A2[ ], A3[n + 3]);
+// { dg-warning "argument 4 of type 'A3\\\[n \\+ 3]' declared with mismatched bound 'n \\+ 3'" "" { target *-*-* } .-1 }
+
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-11.c b/gcc/testsuite/gcc.dg/Wvla-parameter-11.c
new file mode 100644
index 0000000..39886a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-11.c
@@ -0,0 +1,70 @@
+/* PR c/100719 - missing -Wvla-parameter on a mismatch in second parameter
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+typedef struct A1 { int i; } A1;
+typedef struct A2 { int i; } A2;
+typedef struct A3 { int i; } A3;
+
+extern int n, n1, n2, n3;
+
+void f2 (int, A1[n], A2[n]);
+void f2 (int, A1[n], A2[n]);
+
+void f2_x1 (int, A1[n], A2[n]); // { dg-note "previously declared as 'A1\\\[n]'" }
+void f2_x1 (int, A1[n1], A2[n]); // { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" }
+
+void f2_x2 (int, A1[n], A2[n]); // { dg-note "previously declared as 'A2\\\[n]'" }
+void f2_x2 (int, A1[n], A2[n2]); // { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" }
+
+
+void f3 (int, A1[n], A2[n], A3[n]);
+void f3 (int, A1[n], A2[n], A3[n]);
+
+void f3_x1 (int, A1[n], A2[n], A3[n]);
+// { dg-note "previously declared as 'A1\\\[n]'" "note" { target *-*-* } .-1 }
+void f3_x1 (int, A1[n1], A2[n], A3[n]);
+// { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" "" { target *-*-* } .-1 }
+
+void f3_x2 (int, A1[n], A2[n], A3[n]);
+// { dg-note "previously declared as 'A2\\\[n]'" "note" { target *-*-* } .-1 }
+void f3_x2 (int, A1[n], A2[n2], A3[n]);
+// { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" "" { target *-*-* } .-1 }
+
+void f3_x3 (int, A1[n], A2[n], A3[n]);
+// { dg-note "previously declared as 'A3\\\[n]'" "note" { target *-*-* } .-1 }
+void f3_x3 (int, A1[n], A2[n], A3[n3]);
+// { dg-warning "argument 4 of type 'A3\\\[n3]' declared with mismatched bound 'n3'" "" { target *-*-* } .-1 }
+
+
+void g3_x1 (int, A1[n], A2[*], A3[n]);
+// { dg-note "previously declared as 'A1\\\[n]'" "note" { target *-*-* } .-1 }
+void g3_x1 (int, A1[n1], A2[*], A3[n]);
+// { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" "" { target *-*-* } .-1 }
+
+void g3_x2 (int, A1[*], A2[n], A3[n]);
+// { dg-note "previously declared as 'A2\\\[n]'" "note" { target *-*-* } .-1 }
+void g3_x2 (int, A1[*], A2[n2], A3[n]);
+// { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" "" { target *-*-* } .-1 }
+
+void g3_x3 (int, A1[*], A2[*], A3[n]);
+// { dg-note "previously declared as 'A3\\\[n]'" "note" { target *-*-* } .-1 }
+void g3_x3 (int, A1[*], A2[*], A3[n3]);
+// { dg-warning "argument 4 of type 'A3\\\[n3]' declared with mismatched bound 'n3'" "" { target *-*-* } .-1 }
+
+
+void h3_x1 (int, A1[n], A2[ ], A3[n]);
+// { dg-note "previously declared as 'A1\\\[n]'" "note" { target *-*-* } .-1 }
+void h3_x1 (int, A1[n1], A2[ ], A3[n]);
+// { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" "" { target *-*-* } .-1 }
+
+void h3_x2 (int, A1[ ], A2[n], A3[n]);
+// { dg-note "previously declared as 'A2\\\[n]'" "note" { target *-*-* } .-1 }
+void h3_x2 (int, A1[ ], A2[n2], A3[n]);
+// { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" "" { target *-*-* } .-1 }
+
+void h3_x3 (int, A1[ ], A2[ ], A3[n]);
+// { dg-note "previously declared as 'A3\\\[n]'" "note" { target *-*-* } .-1 }
+void h3_x3 (int, A1[ ], A2[ ], A3[n3]);
+// { dg-warning "argument 4 of type 'A3\\\[n3]' declared with mismatched bound 'n3'" "" { target *-*-* } .-1 }
+
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-12.c b/gcc/testsuite/gcc.dg/Wvla-parameter-12.c
new file mode 100644
index 0000000..1be5e48
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-12.c
@@ -0,0 +1,36 @@
+/* PR c/101289 - bogus -Wvla-parameter warning when using const bound
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+void f1ci_can (const int n, char a[n]);
+void f1ci_can (const int n, char a[n]); // { dg-bogus "-Wvla-parameter" }
+
+void f2ci_can (const int m, char a[m]);
+void f2ci_can (int n, char a[n]); // { dg-bogus "-Wvla-parameter" }
+
+void f3i_can (int n, char a[n]);
+void f3i_can (const int n, char a[n]); // { dg-bogus "-Wvla-parameter" }
+
+void f4i_can (int n, char a[n]);
+void f4i_can (const int n, char a[(int)n]); // { dg-bogus "-Wvla-parameter" }
+
+void f5i_can (int n, char a[(char)n]);
+void f5i_can (const int n, char a[(char)n]); // { dg-bogus "-Wvla-parameter" }
+
+void f6i_can (int m, char a[(char)m]);
+void f6i_can (const int n, char a[(char)n]); // { dg-bogus "-Wvla-parameter" "" { xfail *-*-* } }
+
+
+/* PR c/97548 - bogus -Wvla-parameter on a bound expression involving
+ a parameter */
+
+int n;
+
+void f7ianp1 (int, int[n + 1]);
+void f7ianp1 (int, int[n + 1]);
+void f7ianp1 (int, int[n + 2]); // { dg-warning "-Wvla-parameter" }
+
+void f8iakp1 (int k, int [k + 1]);
+void f8iakp1 (int k, int [k + 1]); // { dg-bogus "-Wvla-parameter" }
+void f8iakp1 (int k, int [1 + k]); // { dg-bogus "-Wvla-parameter" }
+void f8iakp1 (int k, int [k + 2]); // { dg-warning "-Wvla-parameter" }
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-13.c b/gcc/testsuite/gcc.dg/Wvla-parameter-13.c
new file mode 100644
index 0000000..f64d29c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-13.c
@@ -0,0 +1,18 @@
+/* PR c/101585 - Bad interaction of -fsanitize=undefined and -Wvla-parameters
+ { dg-do compile }
+ { dg-options "-Wall -fsanitize=undefined" } */
+
+void f1 (int n, int (*)[n]);
+void f1 (int n, int (*)[n]); // { dg-bogus "\\\[-Wvla-parameter" }
+
+void g1 (int m, int (*)[m]);
+void g1 (int n, int (*)[n]); // { dg-bogus "\\\[-Wvla-parameter" "pr101605" { xfail *-*-* } }
+
+void h1 (int n, int (*)[n]);
+void h1 (int n, int (*)[n + 1]); // { dg-warning "\\\[-Wvla-parameter" }
+
+void f2 (int m, int n, int (*)[m][n]);
+void f2 (int n, int m, int (*)[n][m]); // { dg-bogus "\\\[-Wvla-parameter" "pr101605" { xfail *-*-* } }
+
+void g2 (int m, int n, int (*)[m][n]);
+void g2 (int n, int m, int (*)[m][n]); // { dg-warning "\\\[-Wvla-parameter" "pr101605" { xfail *-*-* } }
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
index 01728e7..daa71d8 100644
--- a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
@@ -37,14 +37,14 @@ void f (int[n1][2][n3][4][n5][6][n7][8][n9]);
/* Due to a limitation and because [*] is represented the same as [0]
only the most significant array bound is rendered as [*]; the others
are rendered as [0]. */
-void f (int[n1][2][n3][4][n5][6][n7][8][*]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[\\\*]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-* } }
-// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[0]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 }
-void f (int[n1][2][n3][4][n5][6][*][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[\\\*]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-* } }
-// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[0]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 }
-void f (int[n1][2][n3][4][*][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[\\\*]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-*} }
-// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[0]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 }
-void f (int[n1][2][*][4][n5][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[\\\*]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-* } }
-// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[0]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 }
+void f (int[n1][2][n3][4][n5][6][n7][8][*]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[\\\*]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-* } }
+// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[0]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 }
+void f (int[n1][2][n3][4][n5][6][*][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[\\\*]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-* } }
+// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[0]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 }
+void f (int[n1][2][n3][4][*][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[\\\*]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-*} }
+// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[0]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 }
+void f (int[n1][2][*][4][n5][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[\\\*]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-* } }
+// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[0]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 }
void f (int[*][2][n3][4][n5][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[\\\*]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" }
void f (int[n1][n2][n3][n4][n5][n6][n7][n8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[n2]\\\[n3]\\\[n4]\\\[n5]\\\[n6]\\\[n7]\\\[n8]\\\[n9]' declared with 9 variable bounds" }
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-3.c b/gcc/testsuite/gcc.dg/Wvla-parameter-3.c
index 51f0172..f1cf139 100644
--- a/gcc/testsuite/gcc.dg/Wvla-parameter-3.c
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-3.c
@@ -25,19 +25,19 @@ void ppax (int (**)[*]); // { dg-message "previously declared as
void ppax (int (**)[n]); // { dg-warning "\\\[-Wvla-parameter" }
/* A VLA with an unspecified bound is represented the same as [0] so
so the pretty printer can't differentiate between the two forms. */
-void ppax (int (**)[1]); // { dg-bogus "\\\[-Warray-parameter" "pr?????" { xfail *-*-* } }
- // { dg-warning "\\\[-Wvla-parameter" "pr?????" { xfail *-*-* } .-1 }
+void ppax (int (**)[1]); // { dg-bogus "\\\[-Warray-parameter" "pr100420 (expected)" { xfail *-*-* } }
+ // { dg-warning "\\\[-Wvla-parameter" "pr100420 (expected)" { xfail *-*-* } .-1 }
void ppax (int (**)[n + 1]); // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int *\\\(\\\*\\\*\\\)\\\[n \\\+ 1\\\]'" }
void pa1_n (int (*)[1][n]);
void pa1_n (int (*)[1][n]);
-void pa1_n (int (*)[*][n]); // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[\\\*]\\\[n]'" "pr?????" { xfail *-*-*} }
- // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[0]\\\[n]'" "pr?????" { target *-*-* } .-1 }
+void pa1_n (int (*)[*][n]); // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[\\\*]\\\[n]'" "pr100420 (expected)" { xfail *-*-*} }
+ // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[0]\\\[n]'" "pr100420" { target *-*-* } .-1 }
void pa1_n_2 (int (*)[1][n][2]);
-void pa1_n_2 (int (*)[1][n][*]); // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[\\\*]'" "pr?????" { xfail *-*-* } }
- // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[0]'" "pr?????" { target *-*-* } .-1 }
+void pa1_n_2 (int (*)[1][n][*]); // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[\\\*]'" "pr100420 (expected)" { xfail *-*-* } }
+ // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[0]'" "pr100420" { target *-*-* } .-1 }
void pa1_n_2_a1_n_2 (int (*)[1][n][2], int (*)[1][n][2]);
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-9.c b/gcc/testsuite/gcc.dg/Wvla-parameter-9.c
new file mode 100644
index 0000000..6c8987a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-9.c
@@ -0,0 +1,30 @@
+/* PR c/100550 - ICE: in fold_convert_loc with function call VLA argument
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+struct S { int i; };
+
+extern void v;
+extern void *pv;
+extern struct S s;
+void vf (void);
+
+/* Verify that a function redeclaration with an invalid VLA doesn't ICE. */
+
+void f0 (int[]);
+void f0 (int[undeclared]); // { dg-error "undeclared" }
+
+void f1 (int[]);
+void f1 (int[-1]); // { dg-error "size" }
+
+void f2 (int[]);
+void f2 (int[v]); // { dg-error "size" }
+
+void f3 (int[]);
+void f3 (int b[s]); // { dg-error "size" }
+
+void f4 (int[]);
+void f4 (int c[pv]); // { dg-error "size" }
+
+void f5 (int[]);
+void f5 (int d[vf ()]); // { dg-error "size" }
diff --git a/gcc/testsuite/gcc.dg/alias-7.c b/gcc/testsuite/gcc.dg/alias-7.c
index 591c302..e0c24bd 100644
--- a/gcc/testsuite/gcc.dg/alias-7.c
+++ b/gcc/testsuite/gcc.dg/alias-7.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-alias "" } */
/* { dg-options "-O2" } */
+/* { dg-skip-if "weak alias" { powerpc-ibm-aix* } } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
index d96b3f2..e8745c0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
+++ b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
@@ -15,6 +15,9 @@ extern void __analyzer_describe (int verbosity, ...);
/* Dump copious information about the analyzer’s state when reached. */
extern void __analyzer_dump (void);
+/* Emit a warning describing the size of the base region of (*ptr). */
+extern void __analyzer_dump_capacity (const void *ptr);
+
/* Dump information after analysis on all of the exploded nodes at this
program point.
@@ -32,6 +35,11 @@ extern void __analyzer_dump_path (void);
/* Dump the region_model's state to stderr. */
extern void __analyzer_dump_region_model (void);
+/* Emit a warning describing the state of the 2nd argument
+ (which can be of any type) with respect to NAME.
+ This is for use when debugging, and may be of use in DejaGnu tests. */
+extern void __analyzer_dump_state (const char *name, ...);
+
/* Emit a warning with text "TRUE", FALSE" or "UNKNOWN" based on the
truthfulness of the argument. */
extern void __analyzer_eval (int);
diff --git a/gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c b/gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c
new file mode 100644
index 0000000..f6026b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c
@@ -0,0 +1,69 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+
+#include "analyzer-decls.h"
+
+int test_out (void)
+{
+ int dst_a, dst_b;
+ asm ("mov 42, %0"
+ : "=r" (dst_a));
+ asm ("mov 42, %0"
+ : "=r" (dst_b));
+ __analyzer_eval (dst_a == dst_b); /* { dg-warning "TRUE" } */
+ return dst_a;
+}
+
+int test_out_in (int src_a)
+{
+ int dst_a, dst_b;
+ asm ("mov %1, %0"
+ : "=r" (dst_a)
+ : "r" (src_a));
+ asm ("mov %1, %0"
+ : "=r" (dst_b)
+ : "r" (src_a));
+ __analyzer_eval (dst_a == dst_b); /* { dg-warning "TRUE" } */
+ return dst_a;
+}
+
+int test_out_in_in (int src_a, int src_b)
+{
+ int dst_a, dst_b;
+ asm ("mov %1, %0;\n"
+ "add %2, %0"
+ : "=r" (dst_a)
+ : "r" (src_a),
+ "r" (src_b));
+ asm ("mov %1, %0;\n"
+ "add %2, %0"
+ : "=r" (dst_b)
+ : "r" (src_a),
+ "r" (src_b));
+ __analyzer_eval (dst_a == dst_b); /* { dg-warning "TRUE" } */
+ return dst_a;
+}
+
+void test_inout_1 (int v)
+{
+ int saved = v;
+ int result_a, result_b;
+ asm ("dec %0"
+ : "+r" (v));
+ result_a = v;
+
+ asm ("dec %0"
+ : "+r" (v));
+ result_b = v;
+
+ __analyzer_eval (v == saved); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (v == result_a); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (v == result_b); /* { dg-warning "TRUE" } */
+}
+
+void test_inout_2 (void)
+{
+ int v;
+ int result_a, result_b;
+ asm ("dec %0" /* { dg-warning "use of uninitialized value 'v'" } */
+ : "+r" (v));
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-1.c b/gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-1.c
new file mode 100644
index 0000000..c235e22
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-1.c
@@ -0,0 +1,131 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+
+#include "analyzer-decls.h"
+
+#include <stdint.h>
+
+int test_1 (int src)
+{
+ int dst;
+ asm ("mov %1, %0\n\t"
+ "add $1, %0"
+ : "=r" (dst)
+ : "r" (src));
+ return dst;
+}
+
+uint32_t test_2 (uint32_t Mask)
+{
+ uint32_t Index;
+ asm ("bsfl %[aMask], %[aIndex]"
+ : [aIndex] "=r" (Index)
+ : [aMask] "r" (Mask)
+ : "cc");
+ return Index;
+}
+
+int test_3a (int p1, int p2)
+{
+ asm goto ("btl %1, %0\n\t"
+ "jc %l2"
+ : // No outputs
+ : "r" (p1), "r" (p2)
+ : "cc"
+ : carry);
+
+ return 0;
+
+ carry:
+ return 1;
+}
+
+int test_3b (int p1, int p2)
+{
+ asm goto ("btl %1, %0\n\t"
+ "jc %l[carry]"
+ : // No outputs
+ : "r" (p1), "r" (p2)
+ : "cc"
+ : carry);
+
+ return 0;
+
+ carry:
+ return 1;
+}
+
+uint64_t test_4 (void)
+{
+ uint64_t start_time, end_time;
+
+ // Get start time
+ asm volatile ("rdtsc\n\t" // Returns the time in EDX:EAX.
+ "shl $32, %%rdx\n\t" // Shift the upper bits left.
+ "or %%rdx, %0" // 'Or' in the lower bits.
+ : "=a" (start_time)
+ :
+ : "rdx");
+
+ // could do other work here
+
+ // Get end time
+ asm volatile ("rdtsc\n\t" // Returns the time in EDX:EAX.
+ "shl $32, %%rdx\n\t" // Shift the upper bits left.
+ "or %%rdx, %0" // 'Or' in the lower bits.
+ : "=a" (end_time)
+ :
+ : "rdx");
+
+ __analyzer_eval (start_time == end_time); /* { dg-warning "UNKNOWN" } */
+
+ // Get elapsed time
+ return end_time - start_time;
+}
+
+static uint64_t get_time (void)
+{
+ uint64_t result;
+ asm volatile ("rdtsc\n\t" // Returns the time in EDX:EAX.
+ "shl $32, %%rdx\n\t" // Shift the upper bits left.
+ "or %%rdx, %0" // 'Or' in the lower bits.
+ : "=a" (result)
+ :
+ : "rdx");
+ return result;
+}
+
+uint64_t test_4a (void)
+{
+ uint64_t start_time, end_time;
+
+ start_time = get_time ();
+ // could do other work here
+ end_time = get_time ();
+
+ __analyzer_eval (start_time == end_time); /* { dg-warning "UNKNOWN" } */
+
+ // Get elapsed time
+ return end_time - start_time;
+}
+
+asm ("\t.pushsection .text\n"
+ "\t.globl add_asm\n"
+ "\t.type add_asm, @function\n"
+ "add_asm:\n"
+ "\tmovq %rdi, %rax\n"
+ "\tadd %rsi, %rax\n"
+ "\tret\n"
+ "\t.popsection\n");
+
+int test_5 (int count)
+{
+ asm goto ("dec %0; jb %l[stop]"
+ : "+r" (count)
+ :
+ :
+ : stop);
+ return count;
+stop:
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-2.c b/gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-2.c
new file mode 100644
index 0000000..fa50739
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-2.c
@@ -0,0 +1,34 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+
+/* Adapted from Linux x86: page_ref_dec_and_test.c (GPL-2.0). */
+
+typedef _Bool bool;
+
+typedef struct {
+ int counter;
+} atomic_t;
+
+bool
+arch_atomic_dec_and_test(atomic_t *v) {
+ return ({
+ bool c;
+ asm volatile(".pushsection .smp_locks,\"a\"\n"
+ ".balign 4\n"
+ ".long 671f - .\n"
+ ".popsection\n"
+ "671:"
+ "\n\tlock; "
+ "decl"
+ " "
+ "%[var]"
+ "\n\t/* output condition code "
+ "e"
+ "*/\n"
+ : [ var ] "+m"(v->counter), "=@cc"
+ "e"(c)
+ :
+ : "memory");
+ c;
+ });
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c b/gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c
index 3de32b1..a9a2a3d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c
@@ -11,6 +11,12 @@ extern struct foo *foo_acquire (void)
extern void use_foo (const struct foo *)
__attribute__((nonnull));
+extern struct foo *compatible_alloc (void)
+ __attribute__ ((malloc (__builtin_free)));
+
+extern struct foo *compatible_alloc2 (void)
+ __attribute__ ((malloc (free)));
+
void test_1 (void)
{
struct foo *p = foo_acquire ();
@@ -73,3 +79,16 @@ int test_8 (struct foo *p)
foo_release (p);
return p->m_int; /* { dg-warning "use after 'foo_release' of 'p'" } */
}
+
+/* Recognize that __builtin_free and free are the same thing. */
+void test_9 (void)
+{
+ struct foo *p = compatible_alloc ();
+ free (p);
+}
+
+void test_10 (void)
+{
+ struct foo *p = compatible_alloc2 ();
+ __builtin_free (p);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c b/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c
index 905d50e..e086843 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c
+++ b/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c
@@ -192,9 +192,7 @@ static int ath10k_usb_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
goto err_free_urb_to_pipe;
}
- /* TODO: the loop confuses the double-free checker (another
- instance of PR analyzer/93695). */
- usb_free_urb(urb); /* { dg-bogus "double-'usb_free_urb' of 'urb'" "" { xfail *-*-* } } */
+ usb_free_urb(urb); /* { dg-bogus "double-'usb_free_urb' of 'urb'" } */
}
return 0;
diff --git a/gcc/testsuite/gcc.dg/analyzer/bitfields-1.c b/gcc/testsuite/gcc.dg/analyzer/bitfields-1.c
new file mode 100644
index 0000000..8bbe76b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/bitfields-1.c
@@ -0,0 +1,144 @@
+#include "analyzer-decls.h"
+
+typedef unsigned char u8;
+typedef unsigned __INT16_TYPE__ u16;
+typedef unsigned __INT32_TYPE__ u32;
+
+struct st1
+{
+ u16 nonzero_offset;
+ unsigned int f0 : 1;
+ unsigned int f1 : 1;
+ unsigned int f2 : 1;
+ unsigned int f3 : 1;
+ unsigned int f4 : 1;
+ unsigned int f5 : 1;
+ unsigned int f6 : 1;
+ unsigned int f7 : 1;
+};
+
+void test_1 (void)
+{
+ struct st1 s;
+ s.f0 = 0;
+ __analyzer_eval (s.f0 == 0); /* { dg-warning "TRUE" } */
+ s.f0 = 1;
+ __analyzer_eval (s.f0 == 1); /* { dg-warning "TRUE" } */
+
+ s.f1 = 0;
+ __analyzer_eval (s.f1 == 0); /* { dg-warning "TRUE" } */
+ s.f1 = 1;
+ __analyzer_eval (s.f1 == 1); /* { dg-warning "TRUE" } */
+
+ /* etc */
+
+ s.f6 = 0;
+ __analyzer_eval (s.f6 == 0); /* { dg-warning "TRUE" } */
+ s.f6 = 1;
+ __analyzer_eval (s.f6 == 1); /* { dg-warning "TRUE" } */
+
+ s.f7 = 0;
+ __analyzer_eval (s.f7 == 0); /* { dg-warning "TRUE" } */
+ s.f7 = 1;
+ __analyzer_eval (s.f7 == 1); /* { dg-warning "TRUE" } */
+};
+
+void test_2 (_Bool v0, _Bool v1, _Bool v2, _Bool v3,
+ _Bool v4, _Bool v5, _Bool v6, _Bool v7)
+{
+ struct st1 s;
+ s.f0 = v0;
+ s.f1 = v1;
+ s.f2 = v2;
+ s.f3 = v3;
+ s.f4 = v4;
+ s.f5 = v5;
+ s.f6 = v6;
+ s.f7 = v7;
+
+ __analyzer_eval (s.f0 == v0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (s.f1 == v1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (s.f2 == v2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (s.f3 == v3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (s.f4 == v4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (s.f5 == v5); /* { dg-warning "TRUE" } */
+ __analyzer_eval (s.f6 == v6); /* { dg-warning "TRUE" } */
+ __analyzer_eval (s.f7 == v7); /* { dg-warning "TRUE" } */
+};
+
+struct st3
+{
+ unsigned int f01 : 2;
+ unsigned int f23 : 2;
+ unsigned int f34 : 2;
+ unsigned int f56 : 2;
+};
+
+void test_3 (void)
+{
+ struct st3 s;
+ s.f01 = 0;
+ __analyzer_eval (s.f01 == 0); /* { dg-warning "TRUE" } */
+ s.f01 = 1;
+ __analyzer_eval (s.f01 == 1); /* { dg-warning "TRUE" } */
+ s.f01 = 2;
+ __analyzer_eval (s.f01 == 2); /* { dg-warning "TRUE" } */
+ s.f01 = 3;
+ __analyzer_eval (s.f01 == 3); /* { dg-warning "TRUE" } */
+
+ /* etc */
+
+ s.f56 = 0;
+ __analyzer_eval (s.f56 == 0); /* { dg-warning "TRUE" } */
+ s.f56 = 1;
+ __analyzer_eval (s.f56 == 1); /* { dg-warning "TRUE" } */
+ s.f56 = 2;
+ __analyzer_eval (s.f56 == 2); /* { dg-warning "TRUE" } */
+ s.f56 = 3;
+ __analyzer_eval (s.f56 == 3); /* { dg-warning "TRUE" } */
+};
+
+/* A signed bitfield. */
+
+struct st4
+{
+ signed int f012 : 3;
+ signed int f345 : 3;
+};
+
+void test_4 (void)
+{
+ struct st4 s;
+ s.f345 = -4;
+ __analyzer_eval (s.f345 == -4); /* { dg-warning "TRUE" } */
+ s.f345 = -3;
+ __analyzer_eval (s.f345 == -3); /* { dg-warning "TRUE" } */
+ s.f345 = -2;
+ __analyzer_eval (s.f345 == -2); /* { dg-warning "TRUE" } */
+ s.f345 = -1;
+ __analyzer_eval (s.f345 == -1); /* { dg-warning "TRUE" } */
+ s.f345 = 0;
+ __analyzer_eval (s.f345 == 0); /* { dg-warning "TRUE" } */
+ s.f345 = 1;
+ __analyzer_eval (s.f345 == 1); /* { dg-warning "TRUE" } */
+ s.f345 = 2;
+ __analyzer_eval (s.f345 == 2); /* { dg-warning "TRUE" } */
+ s.f345 = 3;
+ __analyzer_eval (s.f345 == 3); /* { dg-warning "TRUE" } */
+};
+
+/* A zero bitfield to break up padding. */
+
+struct st5
+{
+ unsigned f0 : 5;
+ unsigned :0;
+ unsigned f1 : 16;
+};
+
+void test_5 (void)
+{
+ struct st5 s;
+ s.f1 = 0xcafe;
+ __analyzer_eval (s.f1 == 0xcafe); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/capacity-1.c b/gcc/testsuite/gcc.dg/analyzer/capacity-1.c
new file mode 100644
index 0000000..9ea41f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/capacity-1.c
@@ -0,0 +1,106 @@
+#include <stdlib.h>
+#include "analyzer-decls.h"
+
+typedef unsigned __INT32_TYPE__ u32;
+
+void
+test_1 (void)
+{
+ char buf[16];
+ __analyzer_dump_capacity (buf); /* { dg-warning "capacity: '\\(sizetype\\)16'" } */
+}
+
+void
+test_2 (void)
+{
+ char ch;
+ __analyzer_dump_capacity (&ch); /* { dg-warning "capacity: '\\(sizetype\\)1'" } */
+}
+
+struct s3 { char buf[100]; };
+
+void
+test_3 (void)
+{
+ struct s3 s;
+ __analyzer_dump_capacity (&s); /* { dg-warning "capacity: '\\(sizetype\\)100'" } */
+}
+
+/* Capacity refers to the base region, not any offset within it. */
+
+void
+test_4 (void)
+{
+ char buf[1024];
+ __analyzer_dump_capacity (buf + 100); /* { dg-warning "capacity: '\\(sizetype\\)1024'" } */
+}
+
+void
+test_5 (void *p)
+{
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" } */
+}
+
+void
+test_malloc (void)
+{
+ void *p = malloc (1024);
+
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(size_t\\)1024'" } */
+ free (p);
+}
+
+void
+test_alloca (size_t sz)
+{
+ void *p = alloca (sz);
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(sz_\[^\n\r\]*\\)'" } */
+}
+
+void
+test_vla (size_t sz)
+{
+ char buf[sz];
+ __analyzer_dump_capacity (buf); /* { dg-warning "capacity: 'INIT_VAL\\(sz_\[^\n\r\]*\\)'" } */
+}
+
+static void * __attribute__((noinline))
+called_by_test_interproc_malloc (size_t a)
+{
+ return malloc (a);
+}
+
+void *
+test_interproc_malloc (size_t sz)
+{
+ void *p = called_by_test_interproc_malloc (sz);
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(sz_\[^\n\r\]*\\)'" } */
+ return p;
+}
+
+struct s
+{
+ u32 f1;
+ char arr[];
+};
+
+static struct s * __attribute__((noinline))
+alloc_s (size_t num)
+{
+ struct s *p = malloc (sizeof(struct s) + num);
+ return p;
+}
+
+struct s *
+test_trailing_array (void)
+{
+ struct s *p = alloc_s (5);
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(\[^\n\r\]*\\)9'" } */
+ return p;
+}
+
+void
+test_unknown_arr (int p[])
+{
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/capacity-2.c b/gcc/testsuite/gcc.dg/analyzer/capacity-2.c
new file mode 100644
index 0000000..2db1b3f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/capacity-2.c
@@ -0,0 +1,55 @@
+#include <stdlib.h>
+#include "analyzer-decls.h"
+
+extern void might_realloc (void *);
+extern void cant_realloc (const void *);
+
+void *
+test_realloc_1 (void *p, size_t new_sz)
+{
+ void *q = realloc (p, new_sz);
+ __analyzer_dump_capacity (q); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" "failure" } */
+ /* { dg-warning "capacity: 'INIT_VAL\\(new_sz\[^\n\r\]*\\)'" "success" { target *-*-* } .-1 } */
+ return q;
+}
+
+void *
+test_realloc_2 (size_t sz_a, size_t sz_b)
+{
+ void *p = malloc (sz_a);
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(sz_a_\[^\n\r\]*\\)'" } */
+ void *q = realloc (p, sz_b);
+ __analyzer_dump_capacity (q); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" "failure" } */
+ /* { dg-warning "capacity: 'INIT_VAL\\(sz_b\[^\n\r\]*\\)'" "success" { target *-*-* } .-1 } */
+ return q; /* { dg-warning "leak of 'p'" } */
+}
+
+void *
+test_might_realloc (void)
+{
+ void *p = malloc (1024);
+
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(size_t\\)1024'" } */
+
+ might_realloc (p);
+
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" } */
+
+ return p;
+}
+
+void *
+test_cant_realloc (void)
+{
+ void *p = malloc (1024);
+
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(size_t\\)1024'" } */
+
+ cant_realloc (p);
+
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(size_t\\)1024'" } */
+
+ return p;
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/analyzer/capacity-3.c b/gcc/testsuite/gcc.dg/analyzer/capacity-3.c
new file mode 100644
index 0000000..41e282c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/capacity-3.c
@@ -0,0 +1,82 @@
+#include <stdlib.h>
+#include "analyzer-decls.h"
+
+static void __attribute__((noinline))
+__analyzer_callee_1 (size_t inner_sz)
+{
+ void *p = alloca (inner_sz);
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(outer_sz_\[^\n\r\]*\\)'" } */
+}
+
+void
+test_1 (int flag, size_t outer_sz)
+{
+ if (flag)
+ __analyzer_callee_1 (outer_sz);
+
+ /* Verify that we merge state; in particular, the dynamic size of "p"
+ in the called frame should have been purged. */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
+
+void
+test_2 (int flag, size_t sz)
+{
+ if (flag)
+ {
+ void *p = malloc (sz);
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(sz_\[^\n\r\]*\\)'" } */
+ free (p);
+ /* The dynamic size of "p" should have been purged. */
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" } */
+ }
+
+ /* Verify that we merge state. */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
+/* Verify that we purge state on the NULL branch when a malloc result is
+ tested against NULL. */
+
+void
+test_3 (size_t sz)
+{
+ void *p = malloc (sz);
+
+ if (p)
+ {
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(sz_\[^\n\r\]*\\)'" } */
+ }
+ else
+ {
+ /* The dynamic size of "p" should have been purged
+ due to "p" being equal to NULL. */
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" } */
+ }
+
+ free (p);
+
+ /* The dynamic size of "p" should have been purged. */
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'UNKNOWN\\(sizetype\\)'" } */
+
+ /* Verify that we merge state. */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
+
+/* Verify that we purge dynamic extent of a pointer when it leaks. */
+
+static void __attribute__((noinline))
+__analyzer_callee_4 (size_t inner_sz)
+{
+ void *p = malloc (inner_sz);
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(outer_sz_\[^\n\r\]*\\)'" } */
+} /* { dg-warning "leak of 'p'" } */
+
+void
+test_4 (int flag, size_t outer_sz)
+{
+ if (flag)
+ __analyzer_callee_4 (outer_sz);
+
+ /* Verify that we merge state. */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/clobbers-1.c b/gcc/testsuite/gcc.dg/analyzer/clobbers-1.c
new file mode 100644
index 0000000..6400f84
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/clobbers-1.c
@@ -0,0 +1,97 @@
+#include "analyzer-decls.h"
+
+struct foo
+{
+ int i;
+ int j;
+};
+
+struct coord
+{
+ int x;
+ int y;
+ int z;
+};
+
+struct foo g;
+
+void test_1 (void)
+{
+ g.i = 42;
+ if (g.j)
+ __analyzer_eval (g.j); /* { dg-warning "TRUE" } */
+ else
+ __analyzer_eval (g.j); /* { dg-warning "FALSE" } */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
+
+void test_2 (struct foo f)
+{
+ f.i = 42;
+ if (f.j)
+ __analyzer_eval (f.j); /* { dg-warning "TRUE" } */
+ else
+ __analyzer_eval (f.j); /* { dg-warning "FALSE" } */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
+
+void test_3 (struct foo *p)
+{
+ struct foo f = *p;
+ f.i = 42;
+ if (f.j)
+ __analyzer_eval (f.j); /* { dg-warning "TRUE" } */
+ else
+ __analyzer_eval (f.j); /* { dg-warning "FALSE" } */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
+
+void test_4 (struct coord *p)
+{
+ struct coord f = *p;
+ f.x = 42;
+ __analyzer_eval (f.y == p->y); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.z == p->z); /* { dg-warning "TRUE" } */
+}
+
+struct s5
+{
+ char arr[8];
+};
+
+void test_5 (struct s5 *p)
+{
+ struct s5 f = *p;
+ f.arr[3] = 42;
+ __analyzer_eval (f.arr[0] == p->arr[0]); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[1] == p->arr[1]); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[2] == p->arr[2]); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[3] == 42); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[4] == p->arr[4]); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[5] == p->arr[5]); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[6] == p->arr[6]); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[7] == p->arr[7]); /* { dg-warning "TRUE" } */
+}
+
+struct s6
+{
+ int before; /* Give "arr" a nonzero offset. */
+ struct foo arr[4];
+ int after;
+};
+
+void test_6 (struct s6 *p, struct foo *q)
+{
+ struct s6 f = *p;
+ f.arr[1] = *q;
+ __analyzer_eval (f.before == p->before); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[0].i == p->arr[0].i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[0].j == p->arr[0].j); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[1].i == q->i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[1].j == q->j); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[2].i == p->arr[2].i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[2].j == p->arr[2].j); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[3].i == p->arr[3].i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.arr[3].j == p->arr[3].j); /* { dg-warning "TRUE" } */
+ __analyzer_eval (f.after == p->after); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/clobbers-2.c b/gcc/testsuite/gcc.dg/analyzer/clobbers-2.c
new file mode 100644
index 0000000..9a88349
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/clobbers-2.c
@@ -0,0 +1,72 @@
+#include "analyzer-decls.h"
+
+typedef __SIZE_TYPE__ size_t;
+extern void bzero (void *s, size_t n);
+extern void *memset(void *s, int c, size_t n);
+
+void test_1 (void)
+{
+ char arr[16];
+ bzero (arr, sizeof (arr));
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[7] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[8] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[9] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "TRUE" } */
+
+ /* Clobber in the middle (with prefix and suffix). */
+ arr[8] = 42;
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[7] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[8] == 0); /* { dg-warning "FALSE" } */
+ __analyzer_eval (arr[8] == 42); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[9] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "TRUE" } */
+}
+
+void test_2 (void)
+{
+ char arr[16];
+ bzero (arr, sizeof (arr));
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[1] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "TRUE" } */
+
+ /* Clobber at the front (suffix, but no prefix). */
+ arr[0] = 42;
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "FALSE" } */
+ __analyzer_eval (arr[0] == 42); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[1] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "TRUE" } */
+}
+
+void test_3 (void)
+{
+ char arr[16];
+ bzero (arr, sizeof (arr));
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[14] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "TRUE" } */
+
+ /* Clobber at the end (prefix, but no suffix). */
+ arr[15] = 42;
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[14] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "FALSE" } */
+ __analyzer_eval (arr[15] == 42); /* { dg-warning "TRUE" } */
+}
+
+void test_4 (void)
+{
+ char arr[16];
+ bzero (arr, sizeof (arr));
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "TRUE" } */
+
+ /* Exact overlap, no prefix or suffix. */
+ memset (arr, 1, 16);
+ __analyzer_eval (arr[0] == 0); /* { dg-warning "FALSE" } */
+ __analyzer_eval (arr[15] == 0); /* { dg-warning "FALSE" } */
+ __analyzer_eval (arr[0] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[15] == 1); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index afd1556..908d999 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -137,7 +137,7 @@ void test_11 (void)
/* alloca. */
-void test_12 (void)
+int test_12 (void)
{
void *p = __builtin_alloca (256);
void *q = __builtin_alloca (256);
@@ -145,14 +145,14 @@ void test_12 (void)
/* alloca results should be unique. */
__analyzer_eval (p == q); /* { dg-warning "FALSE" } */
- // FIXME: complain about uses of poisoned values
+ return *(int *)p; /* { dg-warning "use of uninitialized value '\\*\\(int \\*\\)p" } */
}
/* Use of uninit value. */
int test_12a (void)
{
int i;
- return i; // FIXME: do we see the return stmt?
+ return i; /* { dg-warning "use of uninitialized value 'i'" } */
}
void test_12b (void *p, void *q)
@@ -165,9 +165,11 @@ int test_12c (void)
int i;
int j;
- j = i; // FIXME: should complain about this
+ j = i; /* { dg-warning "use of uninitialized value 'i'" } */
- return j;
+ /* We should not emit followup warnings after the first warning about
+ an uninitialized value. */
+ return j; /* { dg-bogus "use of uninitialized value" } */
}
struct coord
@@ -348,7 +350,9 @@ void test_19 (void)
{
int i, j;
/* Compare two uninitialized locals. */
- __analyzer_eval (i == j); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i == j); /* { dg-warning "UNKNOWN" "unknown " } */
+ /* { dg-warning "use of uninitialized value 'i'" "uninit i" { target *-*-* } .-1 } */
+ /* { dg-warning "use of uninitialized value 'j'" "uninit j" { target *-*-* } .-2 } */
}
void test_20 (int i, int j)
@@ -503,9 +507,7 @@ void test_26 (struct coord *p, struct coord *q)
the dest value. */
*p = *q;
__analyzer_eval (p->x); /* { dg-warning "UNKNOWN" } */
- __analyzer_eval (p->y == 17); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail): should have been overwritten with q->y
+ __analyzer_eval (p->y == 17); /* { dg-warning "TRUE" } */
__analyzer_eval (q->x); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (q->y == 17); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
@@ -522,19 +524,11 @@ void test_27 (struct coord *p)
void test_28 (struct coord *p)
{
memset (p, 0, sizeof (struct coord) * 10);
- __analyzer_eval (p[0].x == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail):
- __analyzer_eval (p[0].y == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail):
+ __analyzer_eval (p[0].x == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[0].y == 0); /* { dg-warning "TRUE" } */
- __analyzer_eval (p[9].x == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail):
- __analyzer_eval (p[9].y == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail):
+ __analyzer_eval (p[9].x == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[9].y == 0); /* { dg-warning "TRUE" } */
__analyzer_eval (p[10].x == 0); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (p[10].y == 0); /* { dg-warning "UNKNOWN" } */
@@ -659,8 +653,10 @@ void test_29b (void)
__analyzer_eval (p[9].x == 109024); /* { dg-warning "TRUE" } */
__analyzer_eval (p[9].y == 109025); /* { dg-warning "TRUE" } */
- __analyzer_eval (p[10].x == 0); /* { dg-warning "UNKNOWN" } */
- __analyzer_eval (p[10].y == 0); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (p[10].x == 0); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value 'p\\\[10\\\].x'" "uninit" { target *-*-* } .-1 } */
+ __analyzer_eval (p[10].y == 0); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value 'p\\\[10\\\].y'" "uninit" { target *-*-* } .-1 } */
q = &p[7];
@@ -708,8 +704,10 @@ void test_29c (int len)
__analyzer_eval (p[9].x == 109024); /* { dg-warning "TRUE" } */
__analyzer_eval (p[9].y == 109025); /* { dg-warning "TRUE" } */
- __analyzer_eval (p[10].x == 0); /* { dg-warning "UNKNOWN" } */
- __analyzer_eval (p[10].y == 0); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (p[10].x == 0); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value '\\*p\\\[10\\\].x'" "uninit" { target *-*-* } .-1 } */
+ __analyzer_eval (p[10].y == 0); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value '\\*p\\\[10\\\].y'" "uninit" { target *-*-* } .-1 } */
q = &p[7];
@@ -821,7 +819,7 @@ void test_36 (int i)
int test_37 (void)
{
int *ptr;
- return *ptr; /* { dg-warning "use of uninitialized value 'ptr'" "uninit-warning-removed" { xfail *-*-* } } */
+ return *ptr; /* { dg-warning "use of uninitialized value 'ptr'" } */
}
/* Write through uninitialized pointer. */
@@ -829,7 +827,7 @@ int test_37 (void)
void test_37a (int i)
{
int *ptr;
- *ptr = i; /* { dg-warning "use of uninitialized value 'ptr'" "uninit-warning-removed" { xfail *-*-* } } */
+ *ptr = i; /* { dg-warning "use of uninitialized value 'ptr'" } */
}
// TODO: the various other ptr deref poisonings
@@ -934,24 +932,20 @@ void test_43 (void)
struct sbits
{
- int b0 : 1;
- int b123 : 3;
- int b456 : 3;
- int b7 : 1;
+ signed int b0 : 1;
+ signed int b123 : 3;
+ signed int b456 : 3;
+ signed int b7 : 1;
};
void test_44 (void)
{
struct sbits bits;
- bits.b0 = 1;
- __analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "FALSE" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail): ^^^^
+ bits.b0 = -1;
+ __analyzer_eval (bits.b0 == -1); /* { dg-warning "TRUE" } */
- bits.b456 = 5;
- __analyzer_eval (bits.b456 == 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "FALSE" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail): ^^^^
+ bits.b456 = -4;
+ __analyzer_eval (bits.b456 == -4); /* { dg-warning "TRUE" } */
};
struct ubits
@@ -962,20 +956,14 @@ struct ubits
unsigned int b7 : 1;
};
-/* FIXME: this requires BIT_FIELD_REF to work. */
-
void test_45 (void)
{
struct ubits bits;
bits.b0 = 1;
- __analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail): ^^^^
+ __analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" } */
bits.b456 = 5;
- __analyzer_eval (bits.b456 == 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- // TODO(xfail): ^^^^
+ __analyzer_eval (bits.b456 == 5); /* { dg-warning "TRUE" } */
};
extern const char *char_ptr;
@@ -1045,8 +1033,8 @@ void test_52 (struct big b)
{
struct big d;
memcpy (&d, &b, sizeof (struct big));
- __analyzer_eval (b.ia[0] == d.ia[0]); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
+ __analyzer_eval (b.ia[0] == d.ia[0]); /* { dg-warning "TRUE" } */
+ __analyzer_eval (b.ia[1023] == d.ia[1023]); /* { dg-warning "TRUE" } */
}
void test_53 (const char *msg)
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-10.c b/gcc/testsuite/gcc.dg/analyzer/data-model-10.c
index c261edc..04c9891 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-10.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-10.c
@@ -12,6 +12,7 @@ test (void)
if (!new_table)
return NULL;
new_table->m_f = (char **)malloc(sizeof(char **));
- *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL '<unknown>'" } */ // FIXME: something better than "unknown" here
+ *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL '\\*new_table.m_f'" } */
+ /* { dg-message "'\\*new_table.m_f' could be NULL" "final event wording" { target *-*-* } .-1 } */
return new_table;
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-20.c b/gcc/testsuite/gcc.dg/analyzer/data-model-20.c
index 8fdbb6b..ff65883 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-20.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-20.c
@@ -17,7 +17,7 @@ test (int n) {
for (; i >= 0; i++) {
free(arr[i]); /* { dg-bogus "double-'free'" } */
}
- free(arr);
+ free(arr); /* { dg-warning "leak" } */
return NULL;
}
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-22.c b/gcc/testsuite/gcc.dg/analyzer/data-model-22.c
new file mode 100644
index 0000000..8429b2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-22.c
@@ -0,0 +1,101 @@
+#include <string.h>
+#include "analyzer-decls.h"
+
+extern void check_init_char (char v);
+extern void check_init_int (int v);
+
+void test_1 (void)
+{
+ union
+ {
+ char c[16];
+ int i[4];
+ } v;
+ memset (&v, 0, sizeof (v));
+ v.c[5] = 42;
+ check_init_int (v.c[0]);
+ check_init_int (v.c[4]);
+ check_init_int (v.c[6]);
+ check_init_int (v.i[1]);
+}
+
+void test_2 (void)
+{
+ /* Intersection of byte ranges within "v". */
+ union
+ {
+ struct {
+ int a;
+ char b;
+ char c;
+ } __attribute__((packed)) icc;
+ struct {
+ char a;
+ int b;
+ char c;
+ } __attribute__((packed)) cic;
+ struct {
+ char a;
+ char b;
+ int c;
+ } __attribute__((packed)) cci;
+ } v;
+
+ v.icc.a = 1066;
+ v.icc.b = 42;
+ v.icc.c = 17;
+
+ __analyzer_eval (v.icc.a == 1066); /* { dg-warning "TRUE" } */
+ __analyzer_eval (v.icc.b == 42); /* { dg-warning "TRUE" } */
+ __analyzer_eval (v.icc.c == 17); /* { dg-warning "TRUE" } */
+ check_init_int (v.icc.a);
+ check_init_char (v.icc.b);
+ check_init_char (v.icc.c);
+
+ check_init_char (v.cic.a);
+ check_init_int (v.cic.b);
+ check_init_char (v.cic.c);
+
+ check_init_char (v.cci.a);
+ check_init_char (v.cci.b);
+ check_init_int (v.cci.c);
+
+ v.cic.a = 42;
+ v.cic.b = 1066;
+ v.cic.c = 17;
+
+ __analyzer_eval (v.cic.a == 42); /* { dg-warning "TRUE" } */
+ __analyzer_eval (v.cic.b == 1066); /* { dg-warning "TRUE" } */
+ __analyzer_eval (v.cic.c == 17); /* { dg-warning "TRUE" } */
+ check_init_int (v.icc.a);
+ check_init_char (v.icc.b);
+ check_init_char (v.icc.c);
+
+ check_init_char (v.cic.a);
+ check_init_int (v.cic.b);
+ check_init_char (v.cic.c);
+
+ check_init_char (v.cci.a);
+ check_init_char (v.cci.b);
+ check_init_int (v.cci.c);
+
+ v.cci.a = 42;
+ v.cci.b = 17;
+ v.cci.c = 1066;
+
+ __analyzer_eval (v.cci.a == 42); /* { dg-warning "TRUE" } */
+ __analyzer_eval (v.cci.b == 17); /* { dg-warning "TRUE" } */
+ __analyzer_eval (v.cci.c == 1066); /* { dg-warning "TRUE" } */
+ check_init_int (v.icc.a);
+ check_init_char (v.icc.b);
+ check_init_char (v.icc.c);
+
+ check_init_char (v.cic.a);
+ check_init_int (v.cic.b);
+ check_init_char (v.cic.c);
+
+ check_init_char (v.cci.a);
+ check_init_char (v.cci.b);
+ check_init_int (v.cci.c);
+
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-23.c b/gcc/testsuite/gcc.dg/analyzer/data-model-23.c
new file mode 100644
index 0000000..c76dd4e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-23.c
@@ -0,0 +1,26 @@
+#include "analyzer-decls.h"
+
+#define NULL ((void *)0)
+
+void * __attribute__((noinline))
+hide (void *ptr)
+{
+ return ptr;
+}
+
+void test_1 (void)
+{
+ int a;
+ __analyzer_eval (hide (&a) == NULL); /* { dg-warning "FALSE" } */
+ __analyzer_eval (hide (&a) + 1 != NULL); /* { dg-warning "TRUE" } */
+ __analyzer_eval (hide (&a) + 1 == NULL); /* { dg-warning "FALSE" } */
+ __analyzer_eval (hide (&a) - 1 != NULL); /* { dg-warning "TRUE" } */
+ __analyzer_eval (hide (&a) - 1 == NULL); /* { dg-warning "FALSE" } */
+}
+
+void test_2 (void)
+{
+ __analyzer_eval (hide (NULL) == NULL); /* { dg-warning "TRUE" } */
+ __analyzer_eval (hide (NULL) - 1 == NULL); /* { dg-warning "FALSE" } */
+ __analyzer_eval (hide (NULL) + 1 == NULL); /* { dg-warning "FALSE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/dump-state.c b/gcc/testsuite/gcc.dg/analyzer/dump-state.c
new file mode 100644
index 0000000..618a5a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/dump-state.c
@@ -0,0 +1,14 @@
+/* Verify that __analyzer_dump_state works as expected. */
+
+#include <stdlib.h>
+#include "analyzer-decls.h"
+
+void test_1 (void)
+{
+ void *p = malloc (1024);
+ __analyzer_dump_state ("malloc", p); /* { dg-warning "state: 'unchecked'" } */
+ free (p);
+ __analyzer_dump_state ("malloc", p); /* { dg-warning "state: 'freed'" } */
+ __analyzer_dump_state (NULL, p); /* { dg-error "cannot determine state machine" } */
+ __analyzer_dump_state ("not a state machine", p); /* { dg-error "unrecognized state machine 'not a state machine'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-1.c b/gcc/testsuite/gcc.dg/analyzer/explode-1.c
index 6b62e8e..f48408e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/explode-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/explode-1.c
@@ -12,7 +12,7 @@ void test (void)
{
void *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8;
void **pp;
- while (get ())
+ while (get ()) /* { dg-warning "leak" } */
{
switch (get ())
{
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-2.c b/gcc/testsuite/gcc.dg/analyzer/explode-2.c
index 70d8fec..c16982f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/explode-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/explode-2.c
@@ -2,9 +2,11 @@
independently, so the total combined number of states
at any program point within the loop is NUM_VARS * NUM_STATES.
- Set the limits high enough that we can fully explore this. */
+ However, due to the way the analyzer represents heap-allocated regions
+ this never terminates, eventually hitting the complexity limit
+ (PR analyzer/93695). */
-/* { dg-additional-options "--param analyzer-max-enodes-per-program-point=200 --param analyzer-bb-explosion-factor=50" } */
+/* { dg-additional-options "-Wno-analyzer-too-complex -Wno-analyzer-malloc-leak" } */
#include <stdlib.h>
@@ -12,35 +14,35 @@ extern int get (void);
void test (void)
{
- void *p0, *p1, *p2, *p3;
+ void *p0 = NULL, *p1 = NULL, *p2 = NULL, *p3 = NULL;
while (get ())
{
switch (get ())
{
default:
case 0:
- p0 = malloc (16); /* { dg-warning "leak" } */
+ p0 = malloc (16); /* { dg-warning "leak" "" { xfail *-*-* } } */
break;
case 1:
- free (p0); /* { dg-warning "double-'free' of 'p0'" "" { xfail *-*-* } } */
+ free (p0); /* { dg-warning "double-'free' of 'p0'" } */
break;
case 2:
- p1 = malloc (16); /* { dg-warning "leak" } */
+ p1 = malloc (16); /* { dg-warning "leak" "" { xfail *-*-* } } */
break;
case 3:
free (p1); /* { dg-warning "double-'free' of 'p1'" "" { xfail *-*-* } } */
break;
case 4:
- p2 = malloc (16); /* { dg-warning "leak" } */
+ p2 = malloc (16); /* { dg-warning "leak" "" { xfail *-*-* } } */
break;
case 5:
free (p2); /* { dg-warning "double-'free' of 'p2'" "" { xfail *-*-* } } */
break;
case 6:
- p3 = malloc (16); /* { dg-warning "leak" } */
+ p3 = malloc (16); /* { dg-warning "leak" "" { xfail *-*-* } } */
break;
case 7:
free (p3); /* { dg-warning "double-'free' of 'p3'" "" { xfail *-*-* } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-2a.c b/gcc/testsuite/gcc.dg/analyzer/explode-2a.c
new file mode 100644
index 0000000..32c71ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/explode-2a.c
@@ -0,0 +1,51 @@
+/* PR analyzer/101068. */
+
+/* { dg-additional-options "--param analyzer-max-enodes-per-program-point=200 --param analyzer-bb-explosion-factor=50" } */
+
+#include <stdlib.h>
+
+extern int get (void);
+
+void test (void)
+{
+ void *p0 = NULL, *p1 = NULL, *p2 = NULL, *p3 = NULL;
+ /* Due to not purging constraints on SSA names within loops
+ (PR analyzer/101068), the analyzer effectively treats the original
+ explode-2.c as this code. */
+ int a = get ();
+ int b = get ();
+ while (a)
+ {
+ switch (b)
+ {
+ default:
+ case 0:
+ p0 = malloc (16); /* { dg-warning "leak" } */
+ break;
+ case 1:
+ free (p0); /* { dg-warning "double-'free' of 'p0'" "" { xfail *-*-* } } */
+ break;
+
+ case 2:
+ p1 = malloc (16); /* { dg-warning "leak" } */
+ break;
+ case 3:
+ free (p1); /* { dg-warning "double-'free' of 'p1'" "" { xfail *-*-* } } */
+ break;
+
+ case 4:
+ p2 = malloc (16); /* { dg-warning "leak" } */
+ break;
+ case 5:
+ free (p2); /* { dg-warning "double-'free' of 'p2'" "" { xfail *-*-* } } */
+ break;
+
+ case 6:
+ p3 = malloc (16); /* { dg-warning "leak" } */
+ break;
+ case 7:
+ free (p3); /* { dg-warning "double-'free' of 'p3'" "" { xfail *-*-* } } */
+ break;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-3.c b/gcc/testsuite/gcc.dg/analyzer/feasibility-3.c
new file mode 100644
index 0000000..0c0bd14
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/feasibility-3.c
@@ -0,0 +1,133 @@
+/* Reduced and adapted from Linux: fs/proc/inode.c: proc_reg_open
+ (GPL v2.0). */
+
+/* Types. */
+
+typedef unsigned char u8;
+typedef _Bool bool;
+typedef unsigned int gfp_t;
+
+struct file;
+struct kmem_cache;
+struct proc_dir_entry;
+
+struct inode { /* [...snip...] */ };
+
+enum {
+ PROC_ENTRY_PERMANENT = 1U << 0,
+};
+
+struct proc_ops {
+ /* [...snip...] */
+ int (*proc_open)(struct inode *, struct file *);
+ /* [...snip...] */
+ int (*proc_release)(struct inode *, struct file *);
+ /* [...snip...] */
+};
+
+struct proc_dir_entry {
+ /* [...snip...] */
+ struct completion *pde_unload_completion;
+ /* [...snip...] */
+ union {
+ const struct proc_ops *proc_ops;
+ const struct file_operations *proc_dir_ops;
+ };
+ /* [...snip...] */
+ u8 flags;
+ /* [...snip...] */
+};
+
+struct pde_opener {
+ /* [...snip...] */
+ struct file *file;
+ /* [...snip...] */
+};
+
+struct proc_inode {
+ /* [...snip...] */
+ struct proc_dir_entry *pde;
+ /* [...snip...] */
+ struct inode vfs_inode;
+};
+
+/* Data. */
+
+static struct kmem_cache *pde_opener_cache __attribute__((__section__(".data..ro_after_init")));
+
+/* Functions. */
+
+void *kmem_cache_alloc(struct kmem_cache *, gfp_t flags) __attribute__((__malloc__));
+void kmem_cache_free(struct kmem_cache *, void *);
+
+static inline bool pde_is_permanent(const struct proc_dir_entry *pde)
+{
+ return pde->flags & PROC_ENTRY_PERMANENT;
+}
+
+static inline struct proc_inode *PROC_I(const struct inode *inode)
+{
+ void *__mptr = (void *)(inode);
+ return ((struct proc_inode *)(__mptr - __builtin_offsetof(struct proc_inode, vfs_inode)));
+}
+
+static inline struct proc_dir_entry *PDE(const struct inode *inode)
+{
+ return PROC_I(inode)->pde;
+}
+
+/* We don't want to emit bogus use of uninitialized value 'pdeo'
+ warnings from -Wanalyzer-use-of-uninitialized-value in this function;
+ these would require following infeasible paths in which "release" is
+ first NULL (to avoid the initialization of "pdeo") and then is non-NULL
+ (to access "pdeo").
+
+ "release" is sufficiently complicated in this function to hit the
+ complexity limit for symbolic values during enode exploration. */
+
+static int proc_reg_open(struct inode *inode, struct file *file)
+{
+ struct proc_dir_entry *pde = PDE(inode);
+ int rv = 0;
+ typeof(((struct proc_ops*)0)->proc_open) open;
+ typeof(((struct proc_ops*)0)->proc_release) release;
+ struct pde_opener *pdeo;
+
+ if (pde_is_permanent(pde)) {
+ open = pde->proc_ops->proc_open;
+ if (open)
+ rv = open(inode, file);
+ return rv;
+ }
+
+ /* [...snip...] */
+
+ release = pde->proc_ops->proc_release;
+ if (release) {
+ pdeo = kmem_cache_alloc(pde_opener_cache,
+ ((( gfp_t)(0x400u|0x800u))
+ | (( gfp_t)0x40u)
+ | (( gfp_t)0x80u)));
+ if (!pdeo) {
+ rv = -12;
+ goto out_unuse;
+ }
+ }
+
+ open = pde->proc_ops->proc_open;
+ if (open)
+ rv = open(inode, file);
+
+ if (release) {
+ if (rv == 0) {
+
+ pdeo->file = file; /* { dg-bogus "uninit" } */
+ /* [...snip...] */
+ } else
+ kmem_cache_free(pde_opener_cache, pdeo); /* { dg-bogus "uninit" } */
+ }
+
+out_unuse:
+ /* [...snip...] */
+ return rv;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/fgets-1.c b/gcc/testsuite/gcc.dg/analyzer/fgets-1.c
new file mode 100644
index 0000000..e93d24c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/fgets-1.c
@@ -0,0 +1,31 @@
+/* { dg-do "compile" } */
+
+#define NULL ((void *) 0)
+typedef struct _IO_FILE FILE;
+
+extern char *fgets(char *__restrict __s, int __n,
+ FILE *__restrict __stream);
+extern char *fgets_unlocked(char *__restrict __s, int __n,
+ FILE *__restrict __stream);
+
+char
+test_1 (FILE *fp)
+{
+ char buf[400];
+
+ if (fgets (buf, sizeof buf, fp) == NULL)
+ return 0;
+
+ return buf[0];
+}
+
+char
+test_2 (FILE *fp)
+{
+ char buf[400];
+
+ if (fgets_unlocked (buf, sizeof buf, fp) == NULL)
+ return 0;
+
+ return buf[0];
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/fread-1.c b/gcc/testsuite/gcc.dg/analyzer/fread-1.c
new file mode 100644
index 0000000..593cb7f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/fread-1.c
@@ -0,0 +1,13 @@
+/* { dg-additional-options "-fanalyzer-checker=taint" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+extern size_t fread (void *, size_t, size_t, void *);
+
+int
+test_1 (void *fp)
+{
+ int i;
+ fread (&i, sizeof (i), 1, fp);
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c b/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c
index 411b1b3..fd25e3b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c
@@ -6,9 +6,10 @@ typedef void (*fn_ptr_t) (void *);
void
calls_free (void *victim)
{
- free (victim);
+ free (victim); /* { dg-warning "double-'free' of 'victim'" } */
}
+
void
no_op (void *ptr)
{
@@ -25,7 +26,6 @@ void test_1 (void *ptr)
fn_ptr (ptr);
fn_ptr (ptr);
}
-// TODO: issue a double-'free' warning at 2nd call to fn_ptr.
/* As above, but with an extra indirection to try to thwart
the optimizer. */
@@ -41,4 +41,3 @@ void test_2 (void *ptr, fn_ptr_t *fn_ptr)
(*fn_ptr) (ptr);
(*fn_ptr) (ptr);
}
-// TODO: issue a double-'free' warning at 2nd call to fn_ptr.
diff --git a/gcc/testsuite/gcc.dg/analyzer/function-ptr-4.c b/gcc/testsuite/gcc.dg/analyzer/function-ptr-4.c
new file mode 100644
index 0000000..016351a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/function-ptr-4.c
@@ -0,0 +1,24 @@
+/* Test to see if the analyzer detect and analyze calls via
+ function pointers or not. */
+
+#include <stdlib.h>
+
+void fun(int *int_ptr)
+{
+ free(int_ptr); /* { dg-warning "double-'free' of 'int_ptr'" } */
+}
+
+void single_call()
+{
+ int *int_ptr = (int*)malloc(sizeof(int));
+ void (*fun_ptr)(int *) = &fun;
+ (*fun_ptr)(int_ptr);
+}
+
+void double_call()
+{
+ int *int_ptr = (int*)malloc(sizeof(int));
+ void (*fun_ptr)(int *) = &fun;
+ (*fun_ptr)(int_ptr); /* { dg-message "calling 'fun' from 'double_call'" } */
+ (*fun_ptr)(int_ptr);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c b/gcc/testsuite/gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c
index 2b03527..0172c9b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c
+++ b/gcc/testsuite/gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c
@@ -69,6 +69,5 @@ void test(int n)
free (it);
- __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */
- // TODO: why 2 enodes here, rather than 1
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
index 448b8558..df2fc9c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
@@ -204,8 +204,7 @@ void test_16 (void)
bar ();
fail:
- free (q); /* { dg-warning "free of uninitialized 'q'" "" { xfail *-*-* } } */
- /* TODO(xfail): implement uninitialized detection. */
+ free (q); /* { dg-warning "use of uninitialized value 'q'" } */
free (p);
}
@@ -459,8 +458,8 @@ int *
test_40 (int i)
{
int *p = (int*)malloc(sizeof(int*));
- i = *p; /* { dg-warning "dereference of possibly-NULL 'p' \\\[CWE-690\\\]" } */
- /* TODO: (it's also uninitialized) */
+ i = *p; /* { dg-warning "dereference of possibly-NULL 'p' \\\[CWE-690\\\]" "possibly-null" } */
+ /* { dg-warning "use of uninitialized value '\\*p'" "uninit" { target *-*-*} .-1 } */
return p;
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c b/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c
index 901ca5c..8820ddd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c
@@ -69,7 +69,7 @@ int *test_5 (void)
static void __attribute__((noinline))
called_by_test_6a (void *ptr)
{
- free (ptr); /* { dg-warning "double-'free'" "" { xfail *-*-* } } */
+ free (ptr); /* { dg-warning "double-'free'" } */
}
static deallocator_t __attribute__((noinline))
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c
index 2e3d80e..a08386a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c
@@ -23,8 +23,7 @@ void test (struct foo f)
do_stuff ();
- calls_free (f.m_p); /* { dg-message "passing freed pointer '<unknown>' in call to 'calls_free' from 'test'" } */
- // TODO: something better than '<unknown>'
+ calls_free (f.m_p); /* { dg-message "passing freed pointer 'f\\.m_p' in call to 'calls_free' from 'test'" } */
do_stuff ();
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c
new file mode 100644
index 0000000..d74ef59
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c
@@ -0,0 +1,38 @@
+/* { dg-additional-options "-fanalyzer-verbosity=1" } */
+
+#include <stdlib.h>
+
+void
+calls_free (void *victim)
+{
+ free (victim); /* { dg-warning "double-'free' of 'victim'" } */
+}
+
+extern void do_stuff (void);
+
+struct foo
+{
+ void *m_p;
+};
+
+static void * __attribute__((noinline))
+test_a (struct foo f)
+{
+ do_stuff ();
+
+ calls_free (f.m_p);
+
+ do_stuff ();
+
+ return f.m_p;
+}
+
+void test_b (void *p)
+{
+ void *q;
+ struct foo f;
+ f.m_p = p;
+ q = test_a (f);
+ calls_free (q); /* { dg-message "passing freed pointer 'q' in call to 'calls_free' from 'test_b'" } */
+ do_stuff ();
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/memset-1.c b/gcc/testsuite/gcc.dg/analyzer/memset-1.c
index 5748aa1..94c5a1b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/memset-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/memset-1.c
@@ -36,22 +36,16 @@ void test_3 (int val)
{
char buf[256];
memset (buf, 'A', 256);
- /* We currently merely mark such regions as "unknown", so querying
- values within them yields UNKNOWN when ideally it would be TRUE. */
- __analyzer_eval (buf[42] == 'A'); /* { dg-warning "TRUE" "known nonzero" { xfail *-*-* } } */
- /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
+ __analyzer_eval (buf[42] == 'A'); /* { dg-warning "TRUE" } */
}
/* A "memset" with unknown value. */
-void test_4 (int val)
+void test_4 (char val)
{
char buf[256];
memset (buf, val, 256);
- /* We currently merely mark such regions as "unknown", so querying
- values within them yields UNKNOWN when ideally it would be TRUE. */
- __analyzer_eval (buf[42] == (char)val); /* { dg-warning "TRUE" "known nonzero" { xfail *-*-* } } */
- /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
+ __analyzer_eval (buf[42] == (char)val); /* { dg-warning "TRUE" } */
}
/* A "memset" with unknown num bytes. */
@@ -98,6 +92,14 @@ void test_6 (int val)
__analyzer_eval (buf[42] == 'A'); /* { dg-warning "TRUE" } */
}
+void test_6b (int val)
+{
+ char buf[256];
+ memset (buf, 'A', sizeof (buf));
+ memset (buf, 'B', get_zero ());
+ __analyzer_eval (buf[42] == 'A'); /* { dg-warning "TRUE" } */
+}
+
/* A "memset" of known size that's not the full buffer. */
void test_7 (void)
@@ -105,10 +107,96 @@ void test_7 (void)
char buf[256];
buf[128] = 'A';
memset (buf, 0, 128);
- /* We currently merely mark the whole region as "unknown", so querying
- values within them yields UNKNOWN. */
- __analyzer_eval (buf[127] == '\0'); /* { dg-warning "TRUE" "known nonzero" { xfail *-*-* } } */
- /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
- __analyzer_eval (buf[128] == 'A'); /* { dg-warning "TRUE" "known nonzero" { xfail *-*-* } } */
- /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
+ __analyzer_eval (buf[0] == '\0'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[127] == '\0'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[128] == 'A'); /* { dg-warning "TRUE" } */
+}
+
+void test_8 (void)
+{
+ char buf[20];
+ memset (buf + 0, 0, 1);
+ memset (buf + 1, 1, 1);
+ memset (buf + 2, 2, 1);
+ memset (buf + 3, 3, 1);
+ memset (buf + 4, 4, 2);
+ memset (buf + 6, 6, 2);
+ memset (buf + 8, 8, 4);
+ memset (buf + 12, 12, 8);
+ __analyzer_eval (buf[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[1] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[2] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[3] == 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[4] == 4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[5] == 4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[6] == 6); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[7] == 6); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[8] == 8); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[9] == 8); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[10] == 8); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[11] == 8); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[12] == 12); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[13] == 12); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[14] == 12); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[15] == 12); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[16] == 12); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[17] == 12); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[18] == 12); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[19] == 12); /* { dg-warning "TRUE" } */
+}
+
+/* Various overlapping memset calls with different sizes and values. */
+
+void test_9 (void)
+{
+ char buf[8];
+ memset (buf, 0, 8);
+ __analyzer_eval (buf[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[1] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[2] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[3] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[4] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[5] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[6] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[7] == 0); /* { dg-warning "TRUE" } */
+
+ memset (buf + 1, 1, 4);
+ __analyzer_eval (buf[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[1] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[2] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[3] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[4] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[5] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[6] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[7] == 0); /* { dg-warning "TRUE" } */
+
+ memset (buf + 2, 2, 4);
+ __analyzer_eval (buf[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[1] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[2] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[3] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[4] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[5] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[6] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[7] == 0); /* { dg-warning "TRUE" } */
+
+ memset (buf + 4, 3, 3);
+ __analyzer_eval (buf[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[1] == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[2] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[3] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[4] == 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[5] == 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[6] == 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[7] == 0); /* { dg-warning "TRUE" } */
+
+ memset (buf + 0, 4, 3);
+ __analyzer_eval (buf[0] == 4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[1] == 4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[2] == 4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[3] == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[4] == 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[5] == 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[6] == 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[7] == 0); /* { dg-warning "TRUE" } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/memset-CVE-2017-18549-1.c b/gcc/testsuite/gcc.dg/analyzer/memset-CVE-2017-18549-1.c
new file mode 100644
index 0000000..de9b5e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/memset-CVE-2017-18549-1.c
@@ -0,0 +1,107 @@
+/* This is a very simplified version of CVE-2017-18549,
+ a use of uninitialized padding values affecting the Linux kernel
+ (and thus GPLv2).
+
+ It was fixed by e.g. 342ffc26693b528648bdc9377e51e4f2450b4860 on linux-4.13.y
+ in linux-stable. */
+
+#include "analyzer-decls.h"
+#include <string.h>
+
+typedef unsigned int __u32;
+typedef unsigned int u32;
+typedef unsigned char u8;
+
+/* Adapted from include/uapi/linux/types.h */
+
+#define __bitwise
+typedef __u32 __bitwise __le32;
+
+/* Adapted from drivers/scsi/aacraid/aacraid.h */
+
+#define AAC_SENSE_BUFFERSIZE 30
+
+struct aac_srb_reply
+{
+ __le32 status;
+ __le32 srb_status;
+ __le32 scsi_status;
+ __le32 data_xfer_length;
+ __le32 sense_data_size;
+ u8 sense_data[AAC_SENSE_BUFFERSIZE];
+
+ /* Manually added to help verify the fix. */
+ u8 padding[2];
+};
+
+#define ST_OK 0
+#define SRB_STATUS_SUCCESS 0x01
+
+extern void check_uninit (u8 v);
+
+/* Adapted from drivers/scsi/aacraid/commctrl.c */
+
+static int aac_send_raw_srb(/* [...snip...] */)
+{
+ u32 byte_count = 0;
+
+ /* [...snip...] */
+
+ struct aac_srb_reply reply;
+
+ reply.status = ST_OK;
+
+ /* [...snip...] */
+
+ reply.srb_status = SRB_STATUS_SUCCESS;
+ reply.scsi_status = 0;
+ reply.data_xfer_length = byte_count;
+ reply.sense_data_size = 0;
+ memset(reply.sense_data, 0, AAC_SENSE_BUFFERSIZE);
+
+ /* [...snip...] */
+
+ __analyzer_eval (reply.status == ST_OK); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.srb_status == SRB_STATUS_SUCCESS); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.scsi_status == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.data_xfer_length == byte_count); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.sense_data_size == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.sense_data[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.sense_data[AAC_SENSE_BUFFERSIZE - 1] == 0); /* { dg-warning "TRUE" } */
+ check_uninit (reply.padding[0]); /* { dg-warning "uninitialized value" } */
+ check_uninit (reply.padding[1]); /* { dg-warning "uninitialized value" } */
+}
+
+static int aac_send_raw_srb_fixed(/* [...snip...] */)
+{
+ u32 byte_count = 0;
+
+ /* [...snip...] */
+
+ struct aac_srb_reply reply;
+
+ /* This is the fix. */
+ memset(&reply, 0, sizeof(reply));
+
+ reply.status = ST_OK;
+
+ /* [...snip...] */
+
+ reply.srb_status = SRB_STATUS_SUCCESS;
+ reply.scsi_status = 0;
+ reply.data_xfer_length = byte_count;
+ reply.sense_data_size = 0;
+ memset(reply.sense_data, 0, AAC_SENSE_BUFFERSIZE);
+
+ /* [...snip...] */
+
+ __analyzer_eval (reply.status == ST_OK); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.srb_status == SRB_STATUS_SUCCESS); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.scsi_status == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.data_xfer_length == byte_count); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.sense_data_size == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.sense_data[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.sense_data[AAC_SENSE_BUFFERSIZE - 1] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.padding[0] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (reply.padding[1] == 0); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-8.c b/gcc/testsuite/gcc.dg/analyzer/paths-8.c
new file mode 100644
index 0000000..b350d4d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-8.c
@@ -0,0 +1,17 @@
+#include "analyzer-decls.h"
+
+static void __attribute__((noinline))
+__analyzer_callee_1 (void)
+{
+ /* empty. */
+}
+
+void
+test_1 (int flag)
+{
+ if (flag)
+ __analyzer_callee_1 ();
+
+ /* Verify that we merge state, whether or not the call happens. */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c b/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
index f5424f5..7c8d1b3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
@@ -25,11 +25,8 @@ void test_2 (void *p, void *q)
return;
foo(p);
- /* { dg-warning "pattern match on 'tmp1 == 0'" "tmp1 == 0" { target *-*-* } cond_2 } */
- /* { dg-warning "pattern match on 'tmp2 == 0'" "tmp2 == 0" { target *-*-* } cond_2 } */
- /* { dg-warning "pattern match on '<unknown> == 0'" "<unknown> == 0" { target *-*-* } cond_2 } */
- /* { dg-warning "pattern match on '<unknown> != 0'" "<unknown> != 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'p != 0'" "p != 0" { target *-*-* } cond_2 } */
+ /* { dg-warning "pattern match on 'tmp1 | tmp2 != 0'" "tmp1 | tmp2 != 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'q != 0'" "q != 0" { target *-*-* } cond_2 } */
}
@@ -44,10 +41,7 @@ void test_3 (void *p, void *q)
return;
foo(p);
- /* { dg-warning "pattern match on 'tmp1 != 0'" "tmp1 != 0" { target *-*-* } cond_3 } */
- /* { dg-warning "pattern match on 'tmp2 != 0'" "tmp2 != 0" { target *-*-* } cond_3 } */
- /* { dg-warning "pattern match on '<unknown> == 0'" "<unknown> == 0" { target *-*-* } cond_3 } */
- /* { dg-warning "pattern match on '<unknown> != 0'" "<unknown> != 0" { target *-*-* } cond_3 } */
/* { dg-warning "pattern match on 'p == 0'" "p == 0" { target *-*-* } cond_3 } */
+ /* { dg-warning "pattern match on 'tmp1 & tmp2 == 0'" "tmp1 & tmp2 == 0" { target *-*-* } cond_3 } */
/* { dg-warning "pattern match on 'q == 0'" "q == 0" { target *-*-* } cond_3 } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/phi-1.c b/gcc/testsuite/gcc.dg/analyzer/phi-1.c
new file mode 100644
index 0000000..0926003
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/phi-1.c
@@ -0,0 +1,24 @@
+/* { dg-do "compile" } */
+
+typedef __SIZE_TYPE__ size_t;
+#define NULL ((void *) 0)
+
+extern const char *foo (void);
+extern size_t bar (void);
+
+void
+_nl_expand_alias (const char *locale_alias_path)
+{
+ size_t added;
+ do
+ {
+ added = 0;
+ while (added == 0 && locale_alias_path[0] != '\0')
+ {
+ const char *start = foo ();
+ if (start < locale_alias_path)
+ added = bar ();
+ }
+ }
+ while (added != 0);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/phi-2.c b/gcc/testsuite/gcc.dg/analyzer/phi-2.c
new file mode 100644
index 0000000..2ab8344
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/phi-2.c
@@ -0,0 +1,27 @@
+/* { dg-additional-options "-O1" } */
+
+struct list_head {
+ struct list_head *next, *prev;
+};
+
+struct mbochs_dmabuf {
+ /* [...snip...] */
+ struct dma_buf *buf;
+ /* [...snip...] */
+ struct list_head next;
+ /* [...snip...] */
+};
+
+void mbochs_close(struct list_head *dmabufs,
+ struct mbochs_dmabuf *dmabuf,
+ struct mbochs_dmabuf *tmp)
+{
+ /* [...snip...] */
+ while (&dmabuf->next != dmabufs)
+ {
+ dmabuf = tmp;
+ tmp = ((struct mbochs_dmabuf *)((void *)(tmp->next.next) - __builtin_offsetof(struct mbochs_dmabuf, next)));
+ }
+
+ /* [...snip...] */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr100011.c b/gcc/testsuite/gcc.dg/analyzer/pr100011.c
new file mode 100644
index 0000000..228cfdf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr100011.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target signal } */
+
+#include <stdlib.h>
+#include <signal.h>
+
+void terminate(int sig)
+{
+ char buf[64] = { 0 };
+ exit(1); /* { dg-warning "call to 'exit' from within signal handler" } */
+}
+
+int main(int argc, char **argv)
+{
+ signal(0, terminate); /* { dg-message "registering 'terminate' as signal handler" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr100546.c b/gcc/testsuite/gcc.dg/analyzer/pr100546.c
new file mode 100644
index 0000000..3349d40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr100546.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+static void noReturn(const char *str) __attribute__((noreturn));
+static void noReturn(const char *str) {
+ printf("%s\n", str);
+ exit(1);
+}
+
+void (*noReturnPtr)(const char *str) = &noReturn;
+
+int main(int argc, char **argv) {
+ char *str = 0;
+ if (!str)
+ noReturnPtr(__FILE__);
+ return printf("%c\n", *str);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr100615.c b/gcc/testsuite/gcc.dg/analyzer/pr100615.c
new file mode 100644
index 0000000..7a06f98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr100615.c
@@ -0,0 +1,53 @@
+/* Adapted from
+ https://github.com/stackpath/rxtxcpu/blob/816d86c5d49c4db2ea5649f6b87e96da5af660f1/cpu.c
+ which is MIT-licensed. */
+
+typedef __SIZE_TYPE__ size_t;
+#define NULL ((void *)0)
+
+extern size_t strlen (const char *__s)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__pure__))
+ __attribute__ ((__nonnull__ (1)));
+extern char *strdup (const char *__s)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__malloc__))
+ __attribute__ ((__nonnull__ (1)));
+extern char *strsep (char **__restrict __stringp,
+ const char *__restrict __delim)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1, 2)));
+extern long int strtol (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1)));
+extern void free (void *__ptr)
+ __attribute__ ((__nothrow__ , __leaf__));
+
+#define CPU_LIST_BASE 10
+
+int parse_cpu_list(char *cpu_list) {
+ if (strlen(cpu_list) == 0) {
+ return 0;
+ }
+
+ char *endptr;
+ char *tofree, *string, *range;
+
+ tofree = string = strdup(cpu_list); /* { dg-message "allocated here" } */
+
+ while ((range = strsep(&string, ",")) != NULL) {
+ int first = strtol(range, &endptr, CPU_LIST_BASE);
+ if (!*endptr) {
+ continue;
+ }
+ char *save = endptr;
+ endptr++;
+ int last = strtol(endptr, &endptr, CPU_LIST_BASE);
+ if (save[0] != '-' || *endptr || last < first) {
+ return -1; /* { dg-warning "leak of 'tofree'" } */
+ }
+ }
+ free(tofree);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101143.c b/gcc/testsuite/gcc.dg/analyzer/pr101143.c
new file mode 100644
index 0000000..bcc0974
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101143.c
@@ -0,0 +1,18 @@
+/* { dg-additional-options "-Wno-builtin-declaration-mismatch" } */
+
+extern void *malloc (unsigned int);
+extern void *alloca (unsigned int);
+extern void unknown_fn (void *);
+
+void *
+test_malloc (void)
+{
+ return malloc (sizeof (int));
+}
+
+void *
+test_alloca (void)
+{
+ void *p = alloca (sizeof (int));
+ unknown_fn (p);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101503.c b/gcc/testsuite/gcc.dg/analyzer/pr101503.c
new file mode 100644
index 0000000..16faf6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101503.c
@@ -0,0 +1,11 @@
+/* { dg-additional-options "--param analyzer-max-svalue-depth=0" } */
+
+int val;
+
+int
+fn (void)
+{
+ val = fn ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101547.c b/gcc/testsuite/gcc.dg/analyzer/pr101547.c
new file mode 100644
index 0000000..8791cff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101547.c
@@ -0,0 +1,11 @@
+char *
+fopen (const char *restrict, const char *restrict);
+
+void
+k2 (void)
+{
+ char *setfiles[1];
+ int i;
+
+ setfiles[i] = fopen ("", ""); /* { dg-warning "use of uninitialized value 'i'" } */
+} /* { dg-warning "leak of FILE" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101570.c b/gcc/testsuite/gcc.dg/analyzer/pr101570.c
new file mode 100644
index 0000000..809bad6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101570.c
@@ -0,0 +1,5 @@
+void
+test2 (_Complex double f)
+{
+ __asm__ ("" : "=r" (__real f));
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101721.c b/gcc/testsuite/gcc.dg/analyzer/pr101721.c
new file mode 100644
index 0000000..07ef2d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101721.c
@@ -0,0 +1,8 @@
+/* PR analyzer/101721 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+
+void
+foo ()
+{
+ __builtin_ia32_pause ();
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101837.c b/gcc/testsuite/gcc.dg/analyzer/pr101837.c
new file mode 100644
index 0000000..f99374d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101837.c
@@ -0,0 +1,10 @@
+/* { dg-additional-options "-O3 -fsanitize=undefined" } */
+
+void memory_exhausted();
+void memcheck(void *ptr) {
+ if (ptr) /* { dg-warning "leak" } */
+ memory_exhausted();
+}
+
+int emalloc(int size) { memcheck(__builtin_malloc(size)); } /* { dg-message "allocated here" } */
+int main() { int max_envvar_len = emalloc(max_envvar_len + 1); } /* { dg-message "use of uninitialized value 'max_envvar_len'" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101875.c b/gcc/testsuite/gcc.dg/analyzer/pr101875.c
new file mode 100644
index 0000000..5988b8e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101875.c
@@ -0,0 +1,16 @@
+char *
+fopen (const char *restrict, const char *restrict);
+
+void
+err (void);
+
+void
+k2 (void)
+{
+ char *setfiles[1];
+ int i;
+
+ setfiles[i] = fopen("", ""); /* { dg-warning "use of uninitialized value 'i'" } */
+ if (!setfiles[i]) /* { dg-warning "use of uninitialized value 'i'" } */
+ err ();
+} /* { dg-warning "leak of FILE" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101962.c b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
new file mode 100644
index 0000000..7b83d03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
@@ -0,0 +1,51 @@
+#include "analyzer-decls.h"
+
+#define NULL ((void *)0)
+
+/* Verify that the analyzer makes the simplifying assumption that we don't
+ hit NULL when incrementing pointers to non-NULL memory regions. */
+
+static int * __attribute__((noinline))
+maybe_inc_int_ptr (int *ptr)
+{
+ if (!ptr)
+ return NULL;
+ return ++ptr;
+}
+
+int
+test_1 (void)
+{
+ int stack;
+ int *a = &stack;
+ a = maybe_inc_int_ptr (a);
+ a = maybe_inc_int_ptr (a);
+ __analyzer_eval (a == NULL); /* { dg-warning "FALSE" } */
+ __analyzer_eval (a != NULL); /* { dg-warning "TRUE" } */
+ return *a; /* { dg-warning "use of uninitialized value '\\*a'" } */
+ /* TODO: a complaint about out-of-bounds would be a better warning. */
+}
+
+static const char * __attribute__((noinline))
+maybe_inc_char_ptr (const char *ptr)
+{
+ if (!ptr)
+ return NULL;
+ return ++ptr;
+}
+
+char
+test_s (void)
+{
+ const char *msg = "hello world";
+ const char *a = msg;
+ __analyzer_eval (*a == 'h'); /* { dg-warning "TRUE" } */
+ a = maybe_inc_char_ptr (a);
+ __analyzer_eval (*a == 'e'); /* { dg-warning "TRUE" } */
+ a = maybe_inc_char_ptr (a);
+ __analyzer_eval (*a == 'l'); /* { dg-warning "TRUE" } */
+ a = maybe_inc_char_ptr (a);
+ __analyzer_eval (*a == 'l'); /* { dg-warning "TRUE" } */
+ a = maybe_inc_char_ptr (a);
+ __analyzer_eval (*a == 'o'); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c
index 1a34d05..c7b49d2 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c
@@ -30,6 +30,7 @@ typedef __SIZE_TYPE__ size_t;
typedef struct _IO_FILE FILE;
extern FILE *fopen (const char *__restrict __filename,
const char *__restrict __modes);
+extern size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
extern int fclose (FILE *__stream);
extern int isspace (int) __attribute__((__nothrow__, __leaf__));
@@ -50,6 +51,12 @@ read_alias_file (const char *fname, int fname_len)
if (fp == NULL)
return 0;
+ if (fread (buf, sizeof buf, 1, fp) != 1)
+ {
+ fclose (fp);
+ return 0;
+ }
+
cp = buf;
/* Ignore leading white space. */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93695-1.c b/gcc/testsuite/gcc.dg/analyzer/pr93695-1.c
new file mode 100644
index 0000000..e0500c4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93695-1.c
@@ -0,0 +1,53 @@
+/* { dg-additional-options "-Wno-analyzer-too-complex" } */
+/* TODO: remove the need for this option (PR analyzer/93695). */
+
+#define NELEMS 10
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0]))
+
+void
+test_1 (void)
+{
+ int *p[NELEMS];
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE (p); ++i)
+ p[i] = __builtin_malloc (sizeof (i));
+
+ for (i = 0; i < ARRAY_SIZE (p); ++i)
+ __builtin_free (p [i]);
+}
+
+void
+test_2 (int n)
+{
+ int **p;
+ int i;
+
+ p = (int **)__builtin_malloc (sizeof (int *) * n);
+ if (!p)
+ return;
+
+ for (i = 0; i < n; ++i)
+ p[i] = __builtin_malloc (sizeof (i));
+
+ for (i = 0; i < n; ++i)
+ __builtin_free (p [i]);
+
+ __builtin_free (p);
+}
+
+void
+test_3 (int **p, int n)
+{
+ int i;
+ for (i = 0; i < n; ++i)
+ p[i] = __builtin_malloc (sizeof (i));
+}
+
+void
+test_4 (void **p, int n)
+{
+ int i;
+ for (i = 0; i < n; ++i)
+ __builtin_free (p[i]);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr94047.c b/gcc/testsuite/gcc.dg/analyzer/pr94047.c
index 5107ec0..d13da3e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr94047.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr94047.c
@@ -13,7 +13,7 @@ void
foo (void)
{
struct list l;
- tlist t = l;
+ tlist t = l; /* { dg-warning "use of uninitialized value 'l'" } */
for (;;)
bar (&t);
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
index 6094721..0acf488 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
@@ -45,7 +45,7 @@ int pamark(void) {
if (curbp->b_amark == (AMARK *)NULL)
curbp->b_amark = p;
else
- last->m_next = p;
+ last->m_next = p; /* { dg-warning "dereference of NULL 'last'" "deref" { xfail *-*-* } } */
}
p->m_name = (char)c; /* { dg-bogus "leak of 'p'" "bogus leak" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr96841.c b/gcc/testsuite/gcc.dg/analyzer/pr96841.c
index 8546661..c766582 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr96841.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr96841.c
@@ -10,10 +10,8 @@ void
th (int *);
void
-bv (__SIZE_TYPE__ ny)
+bv (__SIZE_TYPE__ ny, int ***mf)
{
- int ***mf;
-
while (l8 ())
{
*mf = 0;
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98599-a.c b/gcc/testsuite/gcc.dg/analyzer/pr98599-a.c
new file mode 100644
index 0000000..2bbf37b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr98599-a.c
@@ -0,0 +1,8 @@
+/* { dg-do link } */
+/* { dg-require-effective-target lto } */
+/* { dg-additional-options "-Os -flto" } */
+/* { dg-additional-sources pr98599-b.c } */
+
+int b(int x);
+int a() { b(5); }
+int main() { a(); }
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98599-b.c b/gcc/testsuite/gcc.dg/analyzer/pr98599-b.c
new file mode 100644
index 0000000..cfdeb3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr98599-b.c
@@ -0,0 +1 @@
+int b(int x) { return x; }
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98628.c b/gcc/testsuite/gcc.dg/analyzer/pr98628.c
index e2fa778..fa0ca96 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr98628.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr98628.c
@@ -7,8 +7,7 @@ struct chanset_t {
struct chanset_t *next;
char dname[];
};
-void help_subst() {
- char *writeidx;
+void help_subst(char *writeidx) {
for (;; help_subst_chan = *help_subst_chan_0_0) {
foo(help_subst_chan.next->dname);
if (help_subst_chan_0_0) {
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99042.c b/gcc/testsuite/gcc.dg/analyzer/pr99042.c
new file mode 100644
index 0000000..f28a9de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99042.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+
+struct foo {
+ FILE *file;
+};
+
+extern void unknown_fn ();
+extern void unknown_fn2 (const struct foo *f);
+
+int test_1 (struct foo *p)
+{
+ if ((p->file = fopen("test.txt", "w")) == NULL)
+ return 1;
+ unknown_fn ();
+ return 0; /* { dg-bogus "leak" } */
+}
+
+int test_2 (struct foo *p)
+{
+ if ((p->file = fopen("test.txt", "w")) == NULL)
+ return 1;
+ return 0; /* { dg-bogus "leak" } */
+}
+
+int test_3 (void)
+{
+ struct foo f;
+ struct foo *p = &f;
+ if ((p->file = fopen("test.txt", "w")) == NULL)
+ return 1;
+ unknown_fn ();
+ return 0;
+} /* { dg-warning "leak" } */
+
+int test_4 (void)
+{
+ struct foo f;
+ struct foo *p = &f;
+ if ((p->file = fopen("test.txt", "w")) == NULL)
+ return 1;
+ return 0;
+} /* { dg-warning "leak" } */
+
+int test_5 (void)
+{
+ struct foo f;
+ struct foo *p = &f;
+ if ((p->file = fopen("test.txt", "w")) == NULL)
+ return 1;
+ /* Although p is const, the underlying FILE * is not and could be closed. */
+ unknown_fn2 (p);
+ return 0; /* { dg-bogus "leak" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99044-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99044-1.c
new file mode 100644
index 0000000..6b5d901
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99044-1.c
@@ -0,0 +1,60 @@
+#include <stdlib.h>
+
+struct hashmap_entry {
+ struct hashmap_entry *next;
+ unsigned int hash;
+};
+
+struct strbuf {
+ size_t alloc;
+ size_t len;
+ char *buf;
+};
+
+struct oid2strbuf {
+ struct hashmap_entry ent; /* must be the first member! */
+ unsigned char key[21];
+ struct strbuf *value;
+};
+
+
+struct hashmap_iter {
+ struct hashmap *map;
+ struct hashmap_entry *next;
+ unsigned int tablepos;
+};
+
+struct hashmap {
+ struct hashmap_entry **table;
+ // hashmap_cmp_fn cmpfn;
+ unsigned int size, tablesize, grow_at, shrink_at;
+ unsigned disallow_rehash : 1;
+};
+void strbuf_init(struct strbuf *, size_t);
+void *hashmap_iter_next(struct hashmap_iter *iter);
+void hashmap_free(struct hashmap *map, int free_entries);
+void hashmap_iter_init(struct hashmap *map, struct hashmap_iter *iter);
+
+void strbuf_release(struct strbuf *sb)
+{
+ if (sb->alloc) { /* { dg-bogus "use after 'free'" } */
+ free(sb->buf);
+ strbuf_init(sb, 0);
+ }
+}
+
+void oid2strbuf_free(struct hashmap *map) {
+ struct hashmap_iter iter;
+ struct hashmap_entry *e;
+
+ hashmap_iter_init(map, &iter);
+ while ((e = hashmap_iter_next(&iter))) {
+ struct oid2strbuf *e_strbuf = (struct oid2strbuf *)e;
+ strbuf_release(e_strbuf->value); /* { dg-bogus "use after 'free'" } */
+ free(e_strbuf->value);
+ free(e);
+ }
+
+ hashmap_free(map, 0);
+}
+
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99044-2.c b/gcc/testsuite/gcc.dg/analyzer/pr99044-2.c
new file mode 100644
index 0000000..fd71d35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99044-2.c
@@ -0,0 +1,42 @@
+struct node
+{
+ struct node *next;
+};
+
+void test_1 (struct node *n)
+{
+ while (n)
+ {
+ struct node *next = n->next;
+ __builtin_free (n);
+ n = next;
+ }
+}
+
+extern void *get_ptr (void);
+
+void test_2 (void)
+{
+ void *p;
+ while (p = get_ptr ())
+ __builtin_free (p); /* { dg-bogus "double-'free' of 'p'" } */
+}
+
+extern void **get_ptr_ptr (void);
+
+void test_3 (void)
+{
+ void **p;
+ while (p = get_ptr_ptr ())
+ __builtin_free (*p); /* { dg-bogus "double-'free'" } */
+}
+
+void test_4 (void)
+{
+ void *p = (void *)0;
+ while (1)
+ {
+ __builtin_free (p); /* { dg-bogus "double-'free' of 'p'" } */
+ p = get_ptr ();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99193-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99193-1.c
index c6179e9..459357c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr99193-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99193-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-analyzer-too-complex" } */
+
/* Verify absence of false positive from -Wanalyzer-mismatching-deallocation
on realloc(3).
Based on https://github.com/libguestfs/libguestfs/blob/f19fd566f6387ce7e4d82409528c9dde374d25e0/daemon/command.c#L115
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99193-3.c b/gcc/testsuite/gcc.dg/analyzer/pr99193-3.c
index 3e7ffd6..d64b045 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr99193-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99193-3.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-analyzer-too-complex" } */
+
/* Verify absence of false positive from -Wanalyzer-mismatching-deallocation
on realloc(3).
Based on https://github.com/libguestfs/libguestfs/blob/f19fd566f6387ce7e4d82409528c9dde374d25e0/daemon/debug.c#L115
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99716-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99716-1.c
new file mode 100644
index 0000000..6720c3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99716-1.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+void
+test_1 (void)
+{
+ int i;
+
+ for (i = 0; i < 2; ++i) {
+ FILE *fp = fopen ("/tmp/test", "w");
+ fprintf (fp, "hello:%s ", "world");
+ fclose (fp); /* { dg-bogus "double 'fclose'" } */
+ }
+}
+
+void
+test_2 (void)
+{
+ int i;
+
+ for (i = 0; i < 2; ++i) {
+ FILE *fp = fopen ("/tmp/test", "w");
+ fprintf (fp, "hello");
+ }
+} /* { dg-warning "leak of FILE 'fp'" } */
+
+FILE *fp3;
+
+void
+test_3 (FILE **fpp)
+{
+ int i;
+
+ for (i = 0; i < 2; ++i) {
+ *fpp = fopen ("/tmp/test", "w");
+ fprintf (*fpp, "hello");
+ fclose (*fpp); /* { dg-bogus "double 'fclose'" } */
+ *fpp = NULL;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99716-2.c b/gcc/testsuite/gcc.dg/analyzer/pr99716-2.c
new file mode 100644
index 0000000..7c9881c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99716-2.c
@@ -0,0 +1,34 @@
+/* Reduced from
+ https://github.com/libguestfs/libguestfs/blob/e0a11061035d47b118c95706240bcc17fd576edc/tests/mount-local/test-parallel-mount-local.c#L299-L335
+ which is GPLv2 or later. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern int foo (void);
+
+void
+test_mountpoint (const char *mp)
+{
+ const int nr_passes = 5 + (random () & 31);
+ int pass;
+ int ret = 1;
+ FILE *fp;
+
+ for (pass = 0; pass < nr_passes; ++pass) {
+ if (foo ()) {
+ goto error;
+ }
+ fp = fopen ("file", "w");
+ if (fp == NULL) {
+ goto error;
+ }
+ fprintf (fp, "hello world\n");
+ fclose (fp); /* { dg-bogus "double 'fclose'" } */
+ }
+
+ ret = 0;
+
+ error:
+ exit (ret);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99716-3.c b/gcc/testsuite/gcc.dg/analyzer/pr99716-3.c
new file mode 100644
index 0000000..77d450e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99716-3.c
@@ -0,0 +1,16 @@
+#include <stdlib.h>
+
+extern void foo (void *);
+
+void
+test_1 (int nr_passes)
+{
+ int pass;
+ void *p;
+
+ for (pass = 0; pass < nr_passes; ++pass) {
+ p = malloc (1024);
+ foo (p);
+ free (p);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99771-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99771-1.c
new file mode 100644
index 0000000..08449f9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99771-1.c
@@ -0,0 +1,63 @@
+/* Verify that we don't print "<unknown>" in various diagnostics
+ (PR analyzer/99771). */
+
+#include <stdlib.h>
+
+void test_1 (void)
+{
+ *(char*)malloc (1024) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(1024\\)'" } */
+} /* { dg-warning "leak of 'malloc\\(1024\\)'" "warning" } */
+ /* { dg-message "'malloc\\(1024\\)' leaks here" "final event" { target *-*-* } .-1 } */
+
+void test_2 (size_t n)
+{
+ *(char*)malloc (4 * n) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(n \\* 4\\)'" "warning" } */
+ /* { dg-message "'malloc\\(n \\* 4\\)' could be NULL" "final event" { target *-*-* } .-1 } */
+} /* { dg-warning "leak of 'malloc\\(n \\* 4\\)'" "warning" } */
+ /* { dg-message "'malloc\\(n \\* 4\\)' leaks here" "final event" { target *-*-* } .-1 } */
+
+/* A compound example. */
+
+void test_3 (size_t a, size_t b, size_t c)
+{
+ *(char*)malloc (a + (b * c)) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(a \\+ b \\* c\\)'" "warning" } */
+ /* { dg-message "'malloc\\(a \\+ b \\* c\\)' could be NULL" "final event" { target *-*-* } .-1 } */
+} /* { dg-warning "leak of 'malloc\\(a \\+ b \\* c\\)'" "warning" } */
+ /* { dg-message "'malloc\\(a \\+ b \\* c\\)' leaks here" "final event" { target *-*-* } .-1 } */
+
+void test_4 (size_t a, size_t b, size_t c)
+{
+ *(char *)malloc (a ? b : c) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(<unknown>\\)'" "warning" } */
+ /* { dg-message "'malloc\\(<unknown>\\)' could be NULL" "final event" { target *-*-* } .-1 } */
+} /* { dg-warning "leak of 'malloc\\(<unknown>\\)'" "warning" } */
+ /* { dg-message "'malloc\\(<unknown>\\)' leaks here" "final event" { target *-*-* } .-1 } */
+
+/* Unary operators. */
+
+void test_5 (size_t a)
+{
+ *(char*)malloc (-a) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(-a\\)'" } */
+} /* { dg-warning "leak of 'malloc\\(-a\\)'" "warning" } */
+ /* { dg-message "'malloc\\(-a\\)' leaks here" "final event" { target *-*-* } .-1 } */
+
+void test_6 (size_t a)
+{
+ *(char*)malloc (~a) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(~a\\)'" } */
+} /* { dg-warning "leak of 'malloc\\(~a\\)'" "warning" } */
+ /* { dg-message "'malloc\\(~a\\)' leaks here" "final event" { target *-*-* } .-1 } */
+
+/* Field access. */
+
+struct s7 { size_t sz; };
+
+void test_7a(struct s7 s)
+{
+ *(char*)malloc (s.sz) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(s\\.sz\\)'" } */
+} /* { dg-warning "leak of 'malloc\\(s\\.sz\\)'" "warning" } */
+ /* { dg-message "'malloc\\(s\\.sz\\)' leaks here" "final event" { target *-*-* } .-1 } */
+
+void test_7b (struct s7 *s)
+{
+ *(char*)malloc (s->sz) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(\\*s\\.sz\\)'" } */
+} /* { dg-warning "leak of 'malloc\\(\\*s\\.sz\\)'" "warning" } */
+ /* { dg-message "'malloc\\(\\*s\\.sz\\)' leaks here" "final event" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99774-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99774-1.c
new file mode 100644
index 0000000..620cf65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99774-1.c
@@ -0,0 +1,61 @@
+/* Reproducer for report from -Wanalyzer-malloc-leak
+ Reduced from
+ https://git.qemu.org/?p=qemu.git;a=blob;f=subprojects/libvhost-user/libvhost-user.c;h=fab7ca17ee1fb27bcfc338527d1aeb9f923aade5;hb=HEAD#l1184
+ which is licensed under GNU GPLv2 or later. */
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned long uint64_t;
+typedef unsigned long uint64_t;
+typedef long unsigned int size_t;
+
+extern void *calloc(size_t __nmemb, size_t __size)
+ __attribute__((__nothrow__, __leaf__))
+ __attribute__((__malloc__))
+ __attribute__((__alloc_size__(1, 2)))
+ __attribute__((__warn_unused_result__));
+
+typedef struct VuDescStateSplit {
+ uint8_t inflight;
+ uint64_t counter;
+} VuDescStateSplit;
+
+typedef struct VuVirtqInflight {
+ uint16_t desc_num;
+ VuDescStateSplit desc[];
+} VuVirtqInflight;
+
+typedef struct VuVirtqInflightDesc {
+ uint16_t index;
+ uint64_t counter;
+} VuVirtqInflightDesc;
+
+typedef struct VuVirtq {
+ VuVirtqInflight *inflight;
+ VuVirtqInflightDesc *resubmit_list;
+ uint16_t resubmit_num;
+ uint64_t counter;
+ int inuse;
+} VuVirtq;
+
+int vu_check_queue_inflights(VuVirtq *vq) {
+ int i = 0;
+
+ if (vq->inuse) {
+ vq->resubmit_list = calloc(vq->inuse, sizeof(VuVirtqInflightDesc));
+ if (!vq->resubmit_list) {
+ return -1;
+ }
+
+ for (i = 0; i < vq->inflight->desc_num; i++) {
+ if (vq->inflight->desc[i].inflight) {
+ vq->resubmit_list[vq->resubmit_num].index = i; /* { dg-bogus "leak" } */
+ vq->resubmit_list[vq->resubmit_num].counter =
+ vq->inflight->desc[i].counter;
+ vq->resubmit_num++;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99774-2.c b/gcc/testsuite/gcc.dg/analyzer/pr99774-2.c
new file mode 100644
index 0000000..d9704de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99774-2.c
@@ -0,0 +1,144 @@
+#include <stdlib.h>
+
+struct st
+{
+ void *m_f;
+};
+
+struct node
+{
+ struct node *m_next;
+};
+
+extern void unknown_fn (void *);
+extern void const_unknown_fn (const void *);
+
+void
+test_1 (struct st *p, struct st *q)
+{
+ p->m_f = malloc (1024);
+ q->m_f = NULL; /* { dg-bogus "leak" } */
+ free (p->m_f);
+}
+
+void
+test_2 (void)
+{
+ struct st s;
+ s.m_f = malloc (1024);
+ unknown_fn (&s);
+ free (s.m_f);
+}
+
+void
+test_3 (void)
+{
+ struct st s;
+ s.m_f = malloc (1024);
+ const_unknown_fn (&s);
+ free (s.m_f);
+}
+
+void
+test_4 (void)
+{
+ struct st s;
+ s.m_f = malloc (1024);
+ unknown_fn (&s);
+} /* { dg-bogus "leak" } */
+
+void
+test_5 (void)
+{
+ struct st s;
+ s.m_f = malloc (1024);
+ /* s is const, but the pointer could still be freed; hence not a leak. */
+ const_unknown_fn (&s);
+} /* { dg-bogus "leak" } */
+
+void
+test_6 (void)
+{
+ struct st s;
+ s.m_f = malloc (1024);
+} /* { dg-warning "leak" } */
+
+struct st
+test_7 (void)
+{
+ struct st s;
+ s.m_f = malloc (1024);
+ return s;
+} /* { dg-bogus "leak" } */
+
+struct node *
+test_8 (void)
+{
+ struct node *n1 = malloc (sizeof (struct node));
+ if (!n1)
+ return NULL;
+ n1->m_next = malloc (sizeof (struct node));
+ return n1;
+}
+
+void
+test_9 (void)
+{
+ struct node *n1 = malloc (sizeof (struct node));
+ if (!n1)
+ return;
+ n1->m_next = malloc (sizeof (struct node));
+ /* Could free n1 and n1->m_next. */
+ unknown_fn (n1);
+}
+
+void
+test_10 (void)
+{
+ struct node *n1 = malloc (sizeof (struct node));
+ if (!n1)
+ return;
+ n1->m_next = malloc (sizeof (struct node));
+ /* Could free n1->m_next, but not n1. */
+ const_unknown_fn (n1); /* { dg-warning "leak of 'n1'" } */
+}
+
+void
+test_11 (void)
+{
+ struct node *n1 = malloc (sizeof (struct node));
+ if (!n1)
+ return;
+ n1->m_next = malloc (sizeof (struct node));
+ /* Could free n1->m_next, but not n1. */
+ unknown_fn (n1->m_next); /* { dg-warning "leak of 'n1'" } */
+}
+
+void
+test_12a (void)
+{
+ int *ip = malloc (sizeof (int));
+ *ip = 42; /* { dg-warning "dereference of possibly-NULL 'ip'" } */
+ free (ip);
+}
+
+void
+test_12b (void)
+{
+ int *ip = malloc (sizeof (int));
+ unknown_fn (ip);
+ /* Might not be a null-deref, as unknown_fn could abort on NULL. */
+ *ip = 42;
+ free (ip);
+}
+
+void
+test_12c (void)
+{
+ int *ip = malloc (sizeof (int));
+ /* Might not be a null-deref, as const_unknown_fn could abort on NULL.
+ Right now we don't have a great way of handling this. */
+ const_unknown_fn (ip);
+ *ip = 42; /* { dg-bogus "dereference of possibly-NULL 'ip'" "" { xfail *-*-* } } */
+ free (ip);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99886.c b/gcc/testsuite/gcc.dg/analyzer/pr99886.c
new file mode 100644
index 0000000..da768ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99886.c
@@ -0,0 +1,21 @@
+/* Regression test for hang with -fanalyzer-verbosity=0. */
+/* { dg-additional-options "-fanalyzer-verbosity=0" } */
+
+#include <stdlib.h>
+
+struct coord {
+ float x;
+ float y;
+};
+
+void test_34 (void)
+{
+ float *q;
+ struct coord *p = malloc (sizeof (struct coord));
+ if (!p)
+ return;
+ p->x = 0.0f;
+ q = &p->x;
+ free (p);
+ *q = 1.0f; /* { dg-warning "use after 'free' of 'q'" } */
+};
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99906.c b/gcc/testsuite/gcc.dg/analyzer/pr99906.c
new file mode 100644
index 0000000..bb399a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99906.c
@@ -0,0 +1,3 @@
+void bar(void *) __attribute__((__nonnull__));
+void *baz(void);
+void foo(void) { bar(baz()); }
diff --git a/gcc/testsuite/gcc.dg/analyzer/realloc-1.c b/gcc/testsuite/gcc.dg/analyzer/realloc-1.c
index a6c6bfc..ef117ad 100644
--- a/gcc/testsuite/gcc.dg/analyzer/realloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/realloc-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-free-nonheap-object" } */
+
typedef __SIZE_TYPE__ size_t;
#define NULL ((void *)0)
@@ -20,11 +22,10 @@ void *test_1 (void *ptr)
void *test_2 (void *ptr)
{
- void *p = malloc (1024);
- p = realloc (p, 4096);
- /* TODO: should warn about the leak when the above call fails (PR analyzer/99260). */
+ void *p = malloc (1024); /* { dg-message "allocated here" } */
+ p = realloc (p, 4096); /* { dg-message "when 'realloc' fails" } */
free (p);
-}
+} /* { dg-warning "leak of 'p'" } */ // ideally this would be on the realloc stmt
void *test_3 (void *ptr)
{
@@ -44,8 +45,8 @@ void *test_4 (void)
int *test_5 (int *p)
{
*p = 42;
- int *q = realloc (p, sizeof(int) * 4);
- *q = 43; /* { dg-warning "possibly-NULL 'q'" "PR analyzer/99260" { xfail *-*-* } } */
+ int *q = realloc (p, sizeof(int) * 4); /* { dg-message "when 'realloc' fails" } */
+ *q = 43; /* { dg-warning "dereference of NULL 'q'" } */
return q;
}
@@ -53,3 +54,42 @@ void test_6 (size_t sz)
{
void *p = realloc (NULL, sz);
} /* { dg-warning "leak of 'p'" } */
+
+/* The analyzer should complain about realloc of non-heap. */
+
+void *test_7 (size_t sz)
+{
+ char buf[100];
+ void *p = realloc (&buf, sz); /* { dg-warning "'realloc' of '&buf' which points to memory not on the heap" } */
+ return p;
+}
+
+/* Mismatched allocator. */
+
+struct foo
+{
+ int m_int;
+};
+
+extern void foo_release (struct foo *);
+extern struct foo *foo_acquire (void)
+ __attribute__ ((malloc (foo_release)));
+
+void test_8 (void)
+{
+ struct foo *p = foo_acquire ();
+ void *q = realloc (p, 1024); /* { dg-warning "'p' should have been deallocated with 'foo_release' but was deallocated with 'realloc'" } */
+}
+
+/* We should complain about realloc on a freed pointer. */
+
+void test_9 (void *p)
+{
+ free (p);
+ void *q = realloc (p, 1024); /* { dg-warning "double-'free' of 'p'" } */
+}
+
+void test_10 (char *s, int n)
+{
+ __builtin_realloc(s, n); /* { dg-warning "ignoring return value of '__builtin_realloc' declared with attribute 'warn_unused_result'" } */
+} /* { dg-warning "leak" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/realloc-2.c b/gcc/testsuite/gcc.dg/analyzer/realloc-2.c
new file mode 100644
index 0000000..a397753
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/realloc-2.c
@@ -0,0 +1,80 @@
+#include "analyzer-decls.h"
+
+typedef __SIZE_TYPE__ size_t;
+
+#define NULL ((void *)0)
+
+extern void *malloc (size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__malloc__))
+ __attribute__ ((__alloc_size__ (1)));
+extern void *realloc (void *__ptr, size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__))
+ __attribute__ ((__alloc_size__ (2)));
+extern void free (void *__ptr)
+ __attribute__ ((__nothrow__ , __leaf__));
+
+char *test_8 (size_t sz)
+{
+ char *p, *q;
+
+ p = malloc (3);
+ if (!p)
+ return NULL;
+
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(size_t\\)3'" } */
+
+ p[0] = 'a';
+ p[1] = 'b';
+ p[2] = 'c';
+
+ __analyzer_eval (p[0] == 'a'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[1] == 'b'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[2] == 'c'); /* { dg-warning "TRUE" } */
+
+ q = realloc (p, 6);
+
+ /* We should have 3 nodes, corresponding to "failure",
+ "success without moving", and "success with moving". */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */
+
+ if (q)
+ {
+ __analyzer_dump_capacity (q); /* { dg-warning "capacity: '\\(size_t\\)6'" } */
+ q[3] = 'd';
+ q[4] = 'e';
+ q[5] = 'f';
+ if (q == p)
+ {
+ /* "realloc" success, growing the buffer in-place. */
+ __analyzer_eval (p[0] == 'a'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[1] == 'b'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[2] == 'c'); /* { dg-warning "TRUE" } */
+ // TODO
+ }
+ else
+ {
+ /* "realloc" success, moving the buffer (and thus freeing "p"). */
+ __analyzer_eval (q[0] == 'a'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (q[1] == 'b'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (q[2] == 'c'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[0] == 'a'); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use after 'free' of 'p'" "use after free" { target *-*-* } .-1 } */
+ }
+ __analyzer_eval (q[3] == 'd'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (q[4] == 'e'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (q[5] == 'f'); /* { dg-warning "TRUE" } */
+ }
+ else
+ {
+ /* "realloc" failure. p should be unchanged. */
+ __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(size_t\\)3'" } */
+ __analyzer_eval (p[0] == 'a'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[1] == 'b'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (p[2] == 'c'); /* { dg-warning "TRUE" } */
+ return p;
+ }
+
+ return q;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/sock-1.c b/gcc/testsuite/gcc.dg/analyzer/sock-1.c
new file mode 100644
index 0000000..0f3e822
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/sock-1.c
@@ -0,0 +1,112 @@
+typedef unsigned int __u32;
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
+typedef __u32 u32;
+typedef __s64 s64;
+typedef __u64 u64;
+typedef long long __kernel_time64_t;
+typedef _Bool bool;
+typedef __s64 time64_t;
+struct __kernel_timespec {
+ __kernel_time64_t tv_sec;
+ long long tv_nsec;
+};
+struct timespec64 {
+ time64_t tv_sec;
+ long tv_nsec;
+};
+
+extern struct timespec64 ns_to_timespec64(const s64 nsec);
+int put_timespec64(const struct timespec64 *ts,
+ struct __kernel_timespec *uts);
+
+/* [...snip...] */
+
+extern int put_old_timespec32(const struct timespec64 *, void *);
+
+/* [...snip...] */
+
+/* [...snip...] */
+
+typedef s64 ktime_t;
+
+/* [...snip...] */
+
+extern void ktime_get_real_ts64(struct timespec64 *tv);
+
+/* [...snip...] */
+
+enum tk_offsets {
+ TK_OFFS_REAL,
+ TK_OFFS_BOOT,
+ TK_OFFS_TAI,
+ TK_OFFS_MAX,
+};
+
+extern ktime_t ktime_get(void);
+extern ktime_t ktime_get_with_offset(enum tk_offsets offs);
+extern ktime_t ktime_get_coarse_with_offset(enum tk_offsets offs);
+extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs);
+extern ktime_t ktime_get_raw(void);
+extern u32 ktime_get_resolution_ns(void);
+
+
+static ktime_t ktime_get_real(void)
+{
+ return ktime_get_with_offset(TK_OFFS_REAL);
+}
+
+/* [...snip...] */
+
+struct socket {
+ /* [...snip...] */
+ struct sock *sk;
+ /* [...snip...] */
+};
+
+/* [...snip...] */
+
+struct sock {
+ /* [...snip...] */
+ ktime_t sk_stamp;
+ /* [...snip...] */
+};
+
+/* [...snip...] */
+
+static ktime_t sock_read_timestamp(struct sock *sk)
+{
+ return *(const volatile typeof(sk->sk_stamp) *)&(sk->sk_stamp);
+}
+
+static void sock_write_timestamp(struct sock *sk, ktime_t kt)
+{
+ *(volatile typeof(sk->sk_stamp) *)&(sk->sk_stamp) = kt;
+}
+
+/* [...snip...] */
+
+int sock_gettstamp(struct socket *sock, void *userstamp,
+ bool timeval, bool time32)
+{
+ struct sock *sk = sock->sk;
+ struct timespec64 ts;
+
+ /* [...snip...] */
+ ts = ns_to_timespec64((sock_read_timestamp(sk)));
+ if (ts.tv_sec == -1)
+ return -2;
+ if (ts.tv_sec == 0) {
+ ktime_t kt = ktime_get_real();
+ sock_write_timestamp(sk, kt);
+ ts = ns_to_timespec64((kt));
+ }
+
+ if (timeval)
+ ts.tv_nsec /= 1000;
+
+
+ if (time32)
+ return put_old_timespec32(&ts, userstamp);
+ return put_timespec64(&ts, userstamp);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/sock-2.c b/gcc/testsuite/gcc.dg/analyzer/sock-2.c
new file mode 100644
index 0000000..237e0cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/sock-2.c
@@ -0,0 +1,20 @@
+__extension__ typedef __signed__ long long __s64;
+typedef __s64 time64_t;
+struct timespec64 {
+ time64_t tv_sec;
+ long tv_nsec;
+};
+
+extern struct timespec64 ns_to_timespec64(void);
+
+int sock_gettstamp()
+{
+ struct timespec64 ts;
+
+ /* [...snip...] */
+ ts = ns_to_timespec64();
+ if (ts.tv_sec == -1)
+ return -2;
+ /* [...snip...] */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/strdup-1.c b/gcc/testsuite/gcc.dg/analyzer/strdup-1.c
index 6b950ca..9ac3921 100644
--- a/gcc/testsuite/gcc.dg/analyzer/strdup-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/strdup-1.c
@@ -14,8 +14,27 @@ void test_2 (const char *s)
char *p = strdup (s);
free (p);
}
+
void test_3 (const char *s)
{
char *p = strdup (s); /* { dg-message "this call could return NULL" } */
requires_nonnull (p); /* { dg-warning "use of possibly-NULL 'p'" } */
}
+
+/* Repeat tests for __builtin_strdup. */
+void test_4 (const char *s)
+{
+ char *p = __builtin_strdup (s); /* { dg-message "allocated here" } */
+} /* { dg-warning "leak of 'p'" } */
+
+void test_5 (const char *s)
+{
+ char *p = __builtin_strdup (s);
+ free (p);
+}
+
+void test_6 (const char *s)
+{
+ char *p = __builtin_strdup (s); /* { dg-message "this call could return NULL" } */
+ requires_nonnull (p); /* { dg-warning "use of possibly-NULL 'p'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/strndup-1.c b/gcc/testsuite/gcc.dg/analyzer/strndup-1.c
index 23d9b60..5822353 100644
--- a/gcc/testsuite/gcc.dg/analyzer/strndup-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/strndup-1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "no strndup in libc" { *-*-darwin[789]* *-*-darwin10* } } */
#include <string.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/analyzer/switch.c b/gcc/testsuite/gcc.dg/analyzer/switch.c
index 870b00f..0b9e7e3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/switch.c
+++ b/gcc/testsuite/gcc.dg/analyzer/switch.c
@@ -8,23 +8,156 @@ void test (int i)
{
case 0:
__analyzer_eval (i == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != -1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != 0); /* { dg-warning "FALSE" } */
+ __analyzer_eval (i != 1); /* { dg-warning "TRUE" } */
break;
case 3 ... 5:
+ __analyzer_eval (i != 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i > 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i > 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i >= 2); /* { dg-warning "TRUE" } */
__analyzer_eval (i >= 3); /* { dg-warning "TRUE" } */
__analyzer_eval (i <= 5); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i < 6); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i <= 6); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i < 7); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != 6); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != 3); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i != 4); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i != 5); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i >= 4); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i >= 5); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i <= 3); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i <= 4); /* { dg-warning "UNKNOWN" } */
break;
default:
+ __analyzer_eval (i == -1); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i == 0); /* { dg-warning "FALSE" } */
__analyzer_eval (i == 2); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i == 3); /* { dg-warning "FALSE" } */
- __analyzer_eval (i == 4); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
- /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
- /* TODO(xfail^^^): we're only checking against endpoints of case
- ranges, not the insides. */
+ __analyzer_eval (i == 4); /* { dg-warning "FALSE" } */
__analyzer_eval (i == 5); /* { dg-warning "FALSE" } */
__analyzer_eval (i == 6); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i != 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != 1); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (i != 3); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != 4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != 5); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i != 6); /* { dg-warning "UNKNOWN" } */
break;
}
}
+
+/* Verify that the analyzer follows the correct paths on a
+ switch statement guarded by an if, using noinline to defeat
+ optimizations. */
+
+static void __attribute__((noinline))
+__analyzer_called_by_test_2 (int y)
+{
+ switch (y)
+ {
+ case 0:
+ __analyzer_dump_path (); /* { dg-bogus "path" } */
+ break;
+ case 1:
+ __analyzer_dump_path (); /* { dg-message "path" } */
+ break;
+ case 2:
+ __analyzer_dump_path (); /* { dg-bogus "path" } */
+ break;
+ default:
+ __analyzer_dump_path (); /* { dg-bogus "path" } */
+ break;
+ }
+}
+
+void test_2 (int x)
+{
+ if (x == 1)
+ __analyzer_called_by_test_2 (x);
+}
+
+void test_3 (int x, int y)
+{
+ if (y == 3)
+ switch (x)
+ {
+ case 0 ... 9:
+ case 20 ... 29:
+ if (x == y)
+ __analyzer_dump_path (); /* { dg-message "path" } */
+ else
+ __analyzer_dump_path (); /* { dg-message "path" } */
+ }
+}
+
+struct s4
+{
+ unsigned char level:3;
+ unsigned char key_id_mode:2;
+ unsigned char reserved:3;
+};
+
+void test_4 (struct s4 *p)
+{
+ switch (p->key_id_mode)
+ {
+ case 0:
+ __analyzer_dump_path (); /* { dg-message "path" } */
+ break;
+ case 1:
+ __analyzer_dump_path (); /* { dg-message "path" } */
+ break;
+ case 2:
+ __analyzer_dump_path (); /* { dg-message "path" } */
+ break;
+ case 3:
+ __analyzer_dump_path (); /* { dg-message "path" } */
+ break;
+ }
+ __analyzer_dump_path (); /* { dg-message "path" } */
+}
+
+int test_5 (unsigned v)
+{
+ switch (v)
+ {
+ case 0:
+ return 7;
+ break;
+ case 1:
+ return 23;
+ break;
+ default:
+ return v * 2;
+ }
+}
+
+int test_6 (unsigned v)
+{
+ switch (v)
+ {
+ case 0:
+ return 3;
+ case -1:
+ return 22;
+ }
+ return -3;
+}
+
+int g7 = -1;
+int test_7 ()
+{
+ switch (g7++) {
+ case 0:
+ return 32;
+
+ case 100:
+ return 42;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c b/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c
index 9d228e6..0eba646 100644
--- a/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c
@@ -1,6 +1,6 @@
#include "analyzer-decls.h"
-/* The example from store2.h */
+/* The example from store.h */
void test_1 (char a, char b, char c, char d, char e, char f,
int i, int j)
@@ -11,14 +11,16 @@ void test_1 (char a, char b, char c, char d, char e, char f,
__analyzer_eval (arr[2] == a); /* { dg-warning "TRUE" } */
__analyzer_eval (arr[3] == b); /* { dg-warning "TRUE" } */
- __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" } */ // TODO: report uninit
+ __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value 'arr\\\[4\\\]'" "uninit" { target *-*-* } .-1 } */
/* Replace one concrete binding's value with a different value. */
arr[3] = c; /* (3) */
__analyzer_eval (arr[2] == a); /* { dg-warning "TRUE" } */
__analyzer_eval (arr[3] == c); /* { dg-warning "TRUE" } */
__analyzer_eval (arr[3] == b); /* { dg-warning "UNKNOWN" } */
- __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" } */ // TODO: report uninit
+ __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value 'arr\\\[4\\\]'" "uninit" { target *-*-* } .-1 } */
/* Symbolic binding. */
arr[i] = d; /* (4) */
diff --git a/gcc/testsuite/gcc.dg/analyzer/symbolic-7.c b/gcc/testsuite/gcc.dg/analyzer/symbolic-7.c
new file mode 100644
index 0000000..665e0b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/symbolic-7.c
@@ -0,0 +1,46 @@
+#include "analyzer-decls.h"
+
+extern void maybe_write (int *);
+
+void test_1 (int i)
+{
+ /* An array with purely concrete bindings. */
+ int arr[2];
+ arr[0] = 1066;
+ arr[1] = 1776;
+
+ /* Concrete reads. */
+ __analyzer_eval (arr[0] == 1066); /* { dg-warning "TRUE" } */
+ __analyzer_eval (arr[1] == 1776); /* { dg-warning "TRUE" } */
+
+ /* Symbolic read. */
+ __analyzer_describe (0, arr[i]); /* { dg-warning "svalue: 'UNKNOWN\\(int\\)'" } */
+ __analyzer_eval (arr[i] == 1776); /* { dg-warning "UNKNOWN" } */
+}
+
+void test_2 (int i)
+{
+ /* An array that could have been touched. */
+ int arr[2];
+ maybe_write (arr);
+
+ /* Concrete reads. */
+ __analyzer_eval (arr[0] == 42); /* { dg-warning "UNKNOWN" } */
+
+ /* Symbolic read. */
+ __analyzer_eval (arr[i] == 42); /* { dg-warning "UNKNOWN" } */
+}
+
+void test_3 (int i)
+{
+ /* An array that can't have been touched. */
+ int arr[2];
+
+ /* Concrete reads. */
+ __analyzer_eval (arr[0] == 42); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value 'arr\\\[0\\\]'" "uninit" { target *-*-* } .-1 } */
+
+ /* Symbolic read. */
+ __analyzer_eval (arr[i] == 42); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value 'arr\\\[i\\\]'" "uninit" { target *-*-* } .-1 } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/symbolic-8.c b/gcc/testsuite/gcc.dg/analyzer/symbolic-8.c
new file mode 100644
index 0000000..f9c3596
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/symbolic-8.c
@@ -0,0 +1,11 @@
+/* Merger where "arr" has two different symbolic bindings. */
+
+void test (int i, int j, int flag)
+{
+ int arr[16];
+
+ if (flag)
+ arr[i] = 42;
+ else
+ arr[j] = 17;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c
new file mode 100644
index 0000000..6201fdb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c
@@ -0,0 +1,74 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+
+#include "../analyzer-decls.h"
+
+/* Copied from linux: arch/x86/include/asm/barrier.h (GPL-2.0) */
+
+static inline unsigned long array_index_mask_nospec(unsigned long index,
+ unsigned long size)
+{
+ unsigned long mask;
+
+ asm volatile ("cmp %1,%2; sbb %0,%0;"
+ :"=r" (mask)
+ :"g"(size),"r" (index)
+ :"cc");
+ return mask;
+}
+
+/* The analyzer ought to treat array_index_mask_nospec as being
+ effectively pure. */
+
+void test_1 (unsigned long index, unsigned long size)
+{
+ unsigned long a = array_index_mask_nospec (index, size);
+ unsigned long b = array_index_mask_nospec (index, size);
+ __analyzer_eval (a == b); /* { dg-warning "TRUE" } */
+}
+
+void test_2 (unsigned long index_a, unsigned long size_a,
+ unsigned long index_b, unsigned long size_b)
+{
+ unsigned long aa_1 = array_index_mask_nospec (index_a, size_a);
+ unsigned long ab_1 = array_index_mask_nospec (index_a, size_b);
+ unsigned long ba_1 = array_index_mask_nospec (index_b, size_a);
+ unsigned long bb_1 = array_index_mask_nospec (index_b, size_b);
+
+ unsigned long aa_2 = array_index_mask_nospec (index_a, size_a);
+ unsigned long ab_2 = array_index_mask_nospec (index_a, size_b);
+ unsigned long ba_2 = array_index_mask_nospec (index_b, size_a);
+ unsigned long bb_2 = array_index_mask_nospec (index_b, size_b);
+
+ __analyzer_eval (aa_1 == aa_2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ab_1 == ab_2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ba_1 == ba_2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (bb_1 == bb_2); /* { dg-warning "TRUE" } */
+
+ __analyzer_eval (aa_1 == ab_1); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (aa_1 == ba_1); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (aa_1 == bb_1); /* { dg-warning "UNKNOWN" } */
+
+ __analyzer_eval (ab_1 == ba_1); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (ab_1 == bb_1); /* { dg-warning "UNKNOWN" } */
+
+ __analyzer_eval (ba_1 == bb_1); /* { dg-warning "UNKNOWN" } */
+}
+
+/* Equivalent asm strings should be treated the same, rather
+ than requiring the results to come from the same stmt. */
+
+void test_3 (unsigned long index, unsigned long size)
+{
+ unsigned long a = array_index_mask_nospec (index, size);
+ unsigned long b;
+
+ /* Copy of the asm from array_index_mask_nospec. */
+ asm volatile ("cmp %1,%2; sbb %0,%0;"
+ :"=r" (b)
+ :"g"(size),"r" (index)
+ :"cc");
+
+ __analyzer_eval (a == b); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c
new file mode 100644
index 0000000..cf5cf97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c
@@ -0,0 +1,81 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+
+/* Adapted/reduced from linux kernel (GPL-2.0). */
+
+register unsigned long current_stack_pointer asm("rsp");
+
+struct pv_cpu_ops {
+ /* snip */
+ void (*cpuid)(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
+ unsigned int *edx);
+ /* snip */
+};
+struct paravirt_patch_template {
+ struct pv_cpu_ops cpu;
+ /* snip */
+};
+extern struct paravirt_patch_template pv_ops;
+
+/* snip */
+static void cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
+ unsigned int *edx) {
+ unsigned long __edi = __edi, __esi = __esi, __edx = __edx, __ecx = __ecx,
+ __eax = __eax;
+ asm volatile(
+ "771:\n\t"
+ "999:\n\t"
+ ".pushsection .discard.retpoline_safe\n\t"
+ " "
+ ".quad"
+ " "
+ " 999b\n\t"
+ ".popsection\n\t"
+ "call *%c[paravirt_opptr];"
+ "\n"
+ "772:\n"
+ ".pushsection .parainstructions,\"a\"\n"
+ " "
+ ".balign 8"
+ " "
+ "\n"
+ " "
+ ".quad"
+ " "
+ " 771b\n"
+ " .byte "
+ "%c[paravirt_typenum]"
+ "\n"
+ " .byte 772b-771b\n"
+ " .short "
+ "%c[paravirt_clobber]"
+ "\n"
+ ".popsection\n"
+ : "=D"(__edi), "=S"(__esi), "=d"(__edx), "=c"(__ecx),
+ "+r"(current_stack_pointer)
+ : [ paravirt_typenum ] "i"(
+ (__builtin_offsetof(struct paravirt_patch_template, cpu.cpuid) /
+ sizeof(void *))),
+ [ paravirt_opptr ] "i"(&(pv_ops.cpu.cpuid)),
+ [ paravirt_clobber ] "i"(((1 << 9) - 1)), "D"((unsigned long)(eax)),
+ "S"((unsigned long)(ebx)), "d"((unsigned long)(ecx)),
+ "c"((unsigned long)(edx))
+ : "memory", "cc", "rax", "r8", "r9", "r10", "r11");
+}
+
+extern void check_init_int(int v);
+
+void test(unsigned int op) {
+ unsigned int eax, ebx, ecx, edx;
+
+ eax = op;
+ ecx = 0;
+ cpuid(&eax, &ebx, &ecx, &edx);
+
+ check_init_int(eax);
+ check_init_int(ebx); /* { dg-bogus "use of uninitialized value 'ebx'" } */
+ check_init_int(ecx);
+ check_init_int(edx); /* { dg-bogus "use of uninitialized value 'edx'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c
new file mode 100644
index 0000000..c4b365f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c
@@ -0,0 +1,135 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+
+/* Adapted/reduced from linux kernel (GPL-2.0). */
+
+typedef __SIZE_TYPE__ size_t;
+
+#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
+
+#define __stringify_1(x...) #x
+#define __stringify(x...) __stringify_1(x)
+#define __ASM_FORM(x, ...) " " __stringify(x,##__VA_ARGS__) " "
+#define __ASM_FORM_RAW(x, ...) __stringify(x,##__VA_ARGS__)
+#define __ASM_SEL(a,b) __ASM_FORM(b)
+#define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(b)
+#define __ASM_REG(reg) __ASM_SEL_RAW(e##reg, r##reg)
+#define _ASM_PTR __ASM_SEL(.long, .quad)
+#define _ASM_ALIGN __ASM_SEL(.balign 4, .balign 8)
+#define _ASM_SP __ASM_REG(sp)
+
+
+register unsigned long current_stack_pointer asm(_ASM_SP);
+#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
+
+#define ANNOTATE_RETPOLINE_SAFE \
+ "999:\n\t" \
+ ".pushsection .discard.retpoline_safe\n\t" \
+ _ASM_PTR " 999b\n\t" \
+ ".popsection\n\t"
+
+/* Adapted from Linux arch/x86/include/asm/paravirt.h */
+
+struct pv_cpu_ops {
+ /* snip */
+ void (*cpuid)(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
+ unsigned int *edx);
+ /* snip */
+};
+
+struct paravirt_patch_template {
+ struct pv_cpu_ops cpu;
+ /* snip */
+};
+extern struct paravirt_patch_template pv_ops;
+
+#define PARAVIRT_PATCH(x) \
+ (offsetof(struct paravirt_patch_template, x) / sizeof(void *))
+
+#define paravirt_type(op) \
+ [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \
+ [paravirt_opptr] "i" (&(pv_ops.op))
+#define paravirt_clobber(clobber) \
+ [paravirt_clobber] "i" (clobber)
+
+#define CLBR_ANY ((1 << 9) - 1)
+
+#define _paravirt_alt(insn_string, type, clobber) \
+ "771:\n\t" insn_string "\n" "772:\n" \
+ ".pushsection .parainstructions,\"a\"\n" \
+ _ASM_ALIGN "\n" \
+ _ASM_PTR " 771b\n" \
+ " .byte " type "\n" \
+ " .byte 772b-771b\n" \
+ " .short " clobber "\n" \
+ ".popsection\n"
+
+#define paravirt_alt(insn_string) \
+ _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]")
+
+#define PARAVIRT_CALL \
+ ANNOTATE_RETPOLINE_SAFE \
+ "call *%c[paravirt_opptr];"
+
+#define PVOP_CALL_ARGS \
+ unsigned long __edi = __edi, __esi = __esi, \
+ __edx = __edx, __ecx = __ecx, __eax = __eax;
+
+#define PVOP_CALL_ARG1(x) "D" ((unsigned long)(x))
+#define PVOP_CALL_ARG2(x) "S" ((unsigned long)(x))
+#define PVOP_CALL_ARG3(x) "d" ((unsigned long)(x))
+#define PVOP_CALL_ARG4(x) "c" ((unsigned long)(x))
+
+#define PVOP_VCALL_CLOBBERS "=D" (__edi), \
+ "=S" (__esi), "=d" (__edx), \
+ "=c" (__ecx)
+/* void functions are still allowed [re]ax for scratch */
+#define PVOP_VCALLEE_CLOBBERS "=a" (__eax)
+
+#define VEXTRA_CLOBBERS , "rax", "r8", "r9", "r10", "r11"
+
+#define PVOP_TEST_NULL(op) ((void)pv_ops.op)
+
+#define ____PVOP_CALL(ret, op, clbr, call_clbr, extra_clbr, ...) \
+ ({ \
+ PVOP_CALL_ARGS; \
+ PVOP_TEST_NULL(op); \
+ asm volatile(paravirt_alt(PARAVIRT_CALL) \
+ : call_clbr, ASM_CALL_CONSTRAINT \
+ : paravirt_type(op), \
+ paravirt_clobber(clbr), \
+ ##__VA_ARGS__ \
+ : "memory", "cc" extra_clbr); \
+ ret; \
+ })
+
+#define __PVOP_VCALL(op, ...) \
+ (void)____PVOP_CALL(, op, CLBR_ANY, PVOP_VCALL_CLOBBERS, \
+ VEXTRA_CLOBBERS, ##__VA_ARGS__)
+
+#define PVOP_VCALL4(op, arg1, arg2, arg3, arg4) \
+ __PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2), \
+ PVOP_CALL_ARG3(arg3), PVOP_CALL_ARG4(arg4))
+
+static void cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
+ unsigned int *edx)
+{
+ PVOP_VCALL4(cpu.cpuid, eax, ebx, ecx, edx);
+}
+
+extern void check_init_int(int v);
+
+void test(unsigned int op) {
+ unsigned int eax, ebx, ecx, edx;
+
+ eax = op;
+ ecx = 0;
+ cpuid(&eax, &ebx, &ecx, &edx);
+
+ check_init_int(eax);
+ check_init_int(ebx); /* { dg-bogus "use of uninitialized value 'ebx'" } */
+ check_init_int(ecx);
+ check_init_int(edx); /* { dg-bogus "use of uninitialized value 'edx'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c
new file mode 100644
index 0000000..243931a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c
@@ -0,0 +1,46 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+
+#include "../analyzer-decls.h"
+
+typedef unsigned __INT32_TYPE__ u32;
+typedef unsigned __INT64_TYPE__ u64;
+
+extern void check_init_u32 (u32 v);
+extern void check_init_u64 (u32 v);
+
+/* Adapted from linux kernel: arch/x86/include/asm/processor.h (GPL-2.0). */
+
+static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+{
+ /* ecx is often an input as well as an output. */
+ asm volatile("cpuid"
+ : "=a" (*eax),
+ "=b" (*ebx),
+ "=c" (*ecx),
+ "=d" (*edx)
+ : "0" (*eax), "2" (*ecx)
+ : "memory");
+}
+
+static inline void cpuid(unsigned int op,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+{
+ *eax = op;
+ *ecx = 0;
+ native_cpuid(eax, ebx, ecx, edx);
+}
+
+void test_1 (void)
+{
+ u32 eax, ebx, ecx, edx;
+ cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); /* from "amd_get_topology". */
+
+ /* Verify that they are now initialized. */
+ check_init_u32 (eax);
+ check_init_u32 (ebx);
+ check_init_u32 (ecx);
+ check_init_u32 (edx);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c
new file mode 100644
index 0000000..d994787
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c
@@ -0,0 +1,210 @@
+/* Adapted from Linux: arch/x86/include/asm/paravirt.h */
+
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+
+/* Adapted/reduced from linux kernel (GPL-2.0). */
+
+#include "../analyzer-decls.h"
+
+typedef unsigned char u8;
+typedef unsigned __INT32_TYPE__ u32;
+typedef unsigned __INT64_TYPE__ u64;
+typedef __SIZE_TYPE__ size_t;
+
+#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
+
+#define __stringify_1(x...) #x
+#define __stringify(x...) __stringify_1(x)
+
+# define __ASM_FORM(x, ...) " " __stringify(x,##__VA_ARGS__) " "
+# define __ASM_FORM_RAW(x, ...) __stringify(x,##__VA_ARGS__)
+
+#ifndef __x86_64__
+/* 32 bit */
+# define __ASM_SEL(a,b) __ASM_FORM(a)
+# define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(a)
+#else
+/* 64 bit */
+# define __ASM_SEL(a,b) __ASM_FORM(b)
+# define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(b)
+#endif
+
+#define __ASM_REG(reg) __ASM_SEL_RAW(e##reg, r##reg)
+
+#define _ASM_PTR __ASM_SEL(.long, .quad)
+#define _ASM_ALIGN __ASM_SEL(.balign 4, .balign 8)
+
+#define _ASM_SP __ASM_REG(sp)
+
+
+register unsigned long current_stack_pointer asm(_ASM_SP);
+#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
+
+#define ANNOTATE_RETPOLINE_SAFE \
+ "999:\n\t" \
+ ".pushsection .discard.retpoline_safe\n\t" \
+ _ASM_PTR " 999b\n\t" \
+ ".popsection\n\t"
+
+/* Adapted from Linux arch/x86/include/asm/paravirt.h */
+
+
+/* snip */
+
+/* ./arch/x86/include/asm/paravirt.h I think; was:
+ PVOP_VCALL4(cpu.cpuid, eax, ebx, ecx, edx);
+
+*/
+
+#ifndef __x86_64__
+#define CLBR_ANY ((1 << 4) - 1)
+#else
+#define CLBR_ANY ((1 << 9) - 1)
+#endif /* X86_64 */
+
+struct pv_cpu_ops {
+ /* snip */
+ u64 (*read_msr_safe)(unsigned int msr, int *err);
+ /* snip */
+};
+
+struct paravirt_patch_template {
+ struct pv_cpu_ops cpu;
+ /* snip */
+};
+extern struct paravirt_patch_template pv_ops;
+
+#define PARAVIRT_PATCH(x) \
+ (offsetof(struct paravirt_patch_template, x) / sizeof(void *))
+
+#define paravirt_type(op) \
+ [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \
+ [paravirt_opptr] "i" (&(pv_ops.op))
+#define paravirt_clobber(clobber) \
+ [paravirt_clobber] "i" (clobber)
+
+/*
+ * Generate some code, and mark it as patchable by the
+ * apply_paravirt() alternate instruction patcher.
+ */
+#define _paravirt_alt(insn_string, type, clobber) \
+ "771:\n\t" insn_string "\n" "772:\n" \
+ ".pushsection .parainstructions,\"a\"\n" \
+ _ASM_ALIGN "\n" \
+ _ASM_PTR " 771b\n" \
+ " .byte " type "\n" \
+ " .byte 772b-771b\n" \
+ " .short " clobber "\n" \
+ ".popsection\n"
+
+/* Generate patchable code, with the default asm parameters. */
+#define paravirt_alt(insn_string) \
+ _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]")
+
+#define PARAVIRT_CALL \
+ ANNOTATE_RETPOLINE_SAFE \
+ "call *%c[paravirt_opptr];"
+
+#ifndef __x86_64__
+
+/* 32-bit. */
+
+#define PVOP_CALL_ARGS \
+ unsigned long __eax = __eax, __edx = __edx, __ecx = __ecx;
+
+#define PVOP_CALL_ARG1(x) "a" ((unsigned long)(x))
+#define PVOP_CALL_ARG2(x) "d" ((unsigned long)(x))
+
+#define PVOP_VCALL_CLOBBERS "=a" (__eax), "=d" (__edx), \
+ "=c" (__ecx)
+#define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS
+
+#define PVOP_VCALLEE_CLOBBERS "=a" (__eax), "=d" (__edx)
+#define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS
+
+#define EXTRA_CLOBBERS
+
+#else
+
+/* 64-bit. */
+
+/* [re]ax isn't an arg, but the return val */
+#define PVOP_CALL_ARGS \
+ unsigned long __edi = __edi, __esi = __esi, \
+ __edx = __edx, __ecx = __ecx, __eax = __eax;
+
+#define PVOP_CALL_ARG1(x) "D" ((unsigned long)(x))
+#define PVOP_CALL_ARG2(x) "S" ((unsigned long)(x))
+
+#define PVOP_VCALL_CLOBBERS "=D" (__edi), \
+ "=S" (__esi), "=d" (__edx), \
+ "=c" (__ecx)
+#define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax)
+#define PVOP_VCALLEE_CLOBBERS "=a" (__eax)
+#define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS
+
+#define EXTRA_CLOBBERS , "r8", "r9", "r10", "r11"
+#endif /* CONFIG_X86_32 */
+
+#define PVOP_TEST_NULL(op) ((void)pv_ops.op)
+
+#define PVOP_RETVAL(rettype) \
+ ({ unsigned long __mask = ~0UL; \
+ switch (sizeof(rettype)) { \
+ case 1: __mask = 0xffUL; break; \
+ case 2: __mask = 0xffffUL; break; \
+ case 4: __mask = 0xffffffffUL; break; \
+ default: break; \
+ } \
+ __mask & __eax; \
+ })
+
+#define ____PVOP_CALL(ret, op, clbr, call_clbr, extra_clbr, ...) \
+ ({ \
+ PVOP_CALL_ARGS; \
+ PVOP_TEST_NULL(op); \
+ asm volatile(paravirt_alt(PARAVIRT_CALL) \
+ : call_clbr, ASM_CALL_CONSTRAINT \
+ : paravirt_type(op), \
+ paravirt_clobber(clbr), \
+ ##__VA_ARGS__ \
+ : "memory", "cc" extra_clbr); \
+ ret; \
+ })
+
+#define __PVOP_CALL(rettype, op, ...) \
+ ____PVOP_CALL(PVOP_RETVAL(rettype), op, CLBR_ANY, \
+ PVOP_CALL_CLOBBERS, EXTRA_CLOBBERS, ##__VA_ARGS__)
+
+#define PVOP_CALL2(rettype, op, arg1, arg2) \
+ __PVOP_CALL(rettype, op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2))
+
+static inline u64 paravirt_read_msr_safe(unsigned msr, int *err)
+{
+ return PVOP_CALL2(u64, cpu.read_msr_safe, msr, err);
+}
+
+#define rdmsr_safe(msr, a, b) \
+({ \
+ int _err; \
+ u64 _l = paravirt_read_msr_safe(msr, &_err); \
+ (*a) = (u32)_l; \
+ (*b) = _l >> 32; \
+ _err; \
+})
+
+
+void check_init_int(int);
+void check_init_u32(u32);
+
+void test(void)
+{
+ int err;
+ u32 eax, edx;
+ err = rdmsr_safe(0, &eax, &edx);
+ check_init_int(err);
+ check_init_u32(eax);
+ check_init_u32(edx);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c
new file mode 100644
index 0000000..0a1c48f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c
@@ -0,0 +1,33 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+
+#include "../analyzer-decls.h"
+
+/* Adapted from Linux: arch/x86/include/asm/msr.h (GPL-2.0) */
+
+#ifdef __x86_64__
+#define DECLARE_ARGS(val, low, high) unsigned long low, high
+#define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32)
+#define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
+#else
+#define DECLARE_ARGS(val, low, high) unsigned long long val
+#define EAX_EDX_VAL(val, low, high) (val)
+#define EAX_EDX_RET(val, low, high) "=A" (val)
+#endif
+
+static unsigned long long __rdmsr(unsigned int msr)
+{
+ DECLARE_ARGS(val, low, high);
+
+ asm volatile("1: rdmsr\n"
+ "2:\n"
+ : EAX_EDX_RET(val, low, high) : "c" (msr));
+
+ return EAX_EDX_VAL(val, low, high);
+}
+
+void test (void)
+{
+ __analyzer_eval (__rdmsr (0)); /* { dg-warning "UNKNOWN" } */
+ __analyzer_eval (__rdmsr (1)); /* { dg-warning "UNKNOWN" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c
new file mode 100644
index 0000000..e90dccf5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c
@@ -0,0 +1,319 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-additional-options "-fsanitize=bounds -fno-analyzer-call-summaries" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+
+/* Reduced from linux kernel: drivers/staging/wfx/sta.c (GPL-2.0)
+ on x86_64 with "allyesconfig"
+
+ This test is deliberately not fully reduced, as an integration test
+ that the analyzer doesn't emit bogus "dereference of NULL" warnings
+ on the repeated wdev_to_wvif calls. */
+
+#define NULL ((void *)0)
+
+/* Types. */
+
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+__extension__ typedef unsigned long long __u64;
+
+typedef __u8 u8;
+typedef __u16 u16;
+typedef __u64 u64;
+
+enum { false = 0, true = 1 };
+typedef _Bool bool;
+
+struct device;
+
+typedef struct {
+ int counter;
+} atomic_t;
+
+struct static_key {
+ atomic_t enabled;
+ union {
+ unsigned long type;
+ struct jump_entry *entries;
+ struct static_key_mod *next;
+ };
+};
+
+struct static_key_true {
+ struct static_key key;
+};
+
+struct static_key_false {
+ struct static_key key;
+};
+
+struct _ddebug {
+ const char *modname;
+ const char *function;
+ const char *filename;
+ const char *format;
+ unsigned int lineno : 18;
+ unsigned int flags : 8;
+
+ union {
+ struct static_key_true dd_key_true;
+ struct static_key_false dd_key_false;
+ } key;
+
+} __attribute__((aligned(8)));
+
+enum nl80211_iftype {
+ /* [...snip...] */
+ NL80211_IFTYPE_AP,
+ /* [...snip...] */
+ NUM_NL80211_IFTYPES,
+ NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1
+};
+
+struct ieee80211_channel {
+ /* [...snip...] */
+ u16 hw_value;
+ /* [...snip...] */
+};
+
+struct cfg80211_chan_def {
+ struct ieee80211_channel *chan;
+ /* [...snip...] */
+};
+
+struct ieee80211_bss_conf {
+ /* [...snip...] */
+ bool assoc, ibss_joined;
+ /* [...snip...] */
+ struct cfg80211_chan_def chandef;
+ /* [...snip...] */
+ bool ps;
+ /* [...snip...] */
+};
+
+struct ieee80211_conf {
+ /* [...snip...] */
+ int power_level, dynamic_ps_timeout;
+ /* [...snip...] */
+};
+
+struct ieee80211_vif {
+ enum nl80211_iftype type;
+ struct ieee80211_bss_conf bss_conf;
+ /* [...snip...] */
+ u8 drv_priv[] __attribute__((__aligned__(sizeof(void *))));
+};
+
+struct ieee80211_hw {
+ struct ieee80211_conf conf;
+ /* [...snip...] */
+};
+
+struct wfx_dev {
+ /* [...snip...] */
+ struct device *dev;
+ struct ieee80211_hw *hw;
+ struct ieee80211_vif *vif[2];
+ /* [...snip...] */
+ int force_ps_timeout;
+};
+
+struct wfx_vif {
+ struct wfx_dev *wdev;
+ struct ieee80211_vif *vif;
+ /* [...snip...] */
+};
+
+/* Function decls. */
+
+extern __attribute__((__format__(printf, 1, 2))) void
+__warn_printk(const char *fmt, ...);
+
+extern bool ____wrong_branch_error(void);
+
+extern __attribute__((__format__(printf, 3, 4))) void
+__dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
+ const char *fmt, ...);
+
+bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor);
+
+/* Function defns. */
+
+static inline unsigned long array_index_mask_nospec(unsigned long index,
+ unsigned long size) {
+ unsigned long mask;
+
+ asm volatile("cmp %1,%2; sbb %0,%0;"
+ : "=r"(mask)
+ : "g"(size), "r"(index)
+ : "cc");
+ return mask;
+}
+
+static inline __attribute__((__always_inline__)) bool
+arch_static_branch(struct static_key *key, bool branch) {
+ asm goto("1:"
+ "jmp %l[l_yes] # objtool NOPs this \n\t"
+ ".pushsection __jump_table, \"aw\" \n\t"
+ " "
+ ".balign 8"
+ " "
+ "\n\t"
+ ".long 1b - . \n\t"
+ ".long %l[l_yes] - . \n\t"
+ " "
+ ".quad"
+ " "
+ "%c0 + %c1 - .\n\t"
+ ".popsection \n\t"
+ :
+ : "i"(key), "i"(2 | branch)
+ :
+ : l_yes);
+ asm("");
+
+ return false;
+l_yes:
+ return true;
+}
+
+static inline __attribute__((__always_inline__)) bool
+arch_static_branch_jump(struct static_key *const key, const bool branch) {
+ asm goto("1:"
+ "jmp %l[l_yes]\n\t"
+ ".pushsection __jump_table, \"aw\" \n\t"
+ " "
+ ".balign 8"
+ " "
+ "\n\t"
+ ".long 1b - . \n\t"
+ ".long %l[l_yes] - . \n\t"
+ " "
+ ".quad"
+ " "
+ "%c0 + %c1 - .\n\t"
+ ".popsection \n\t"
+ :
+ : "i"(key), "i"(branch)
+ :
+ : l_yes);
+ asm("");
+
+ return false;
+l_yes:
+ return true;
+}
+
+static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id) {
+ if (vif_id >=
+ (sizeof(wdev->vif) / sizeof((wdev->vif)[0]) + ((int)(sizeof(struct {
+ int : (-!!(__builtin_types_compatible_p(typeof((wdev->vif)),
+ typeof(&(wdev->vif)[0]))));
+ }))))) {
+ static struct _ddebug __attribute__((__aligned__(8)))
+ __attribute__((__section__("__dyndbg"))) __UNIQUE_ID_ddebug1678 = {
+ .modname = "wfx",
+ .function = __func__,
+ .filename = "drivers/staging/wfx/wfx.h",
+ .format = ("requesting non-existent vif: %d\n"),
+ .lineno = 97,
+ .flags = 0,
+ .key.dd_key_false = ((struct static_key_false){
+ .key = {.enabled = {0}, {.entries = (void *)0UL}},
+ })};
+ if (({
+ bool branch;
+ if (__builtin_types_compatible_p(
+ typeof(*&__UNIQUE_ID_ddebug1678.key.dd_key_false),
+ struct static_key_true))
+ branch = arch_static_branch_jump(
+ &(&__UNIQUE_ID_ddebug1678.key.dd_key_false)->key, false);
+ else if (__builtin_types_compatible_p(
+ typeof(*&__UNIQUE_ID_ddebug1678.key.dd_key_false),
+ struct static_key_false))
+ branch = arch_static_branch(
+ &(&__UNIQUE_ID_ddebug1678.key.dd_key_false)->key, false);
+ else
+ branch = ____wrong_branch_error();
+ __builtin_expect(!!(branch), 0);
+ }))
+ __dynamic_dev_dbg(&__UNIQUE_ID_ddebug1678, wdev->dev,
+ "requesting non-existent vif: %d\n", vif_id);
+ return NULL;
+ }
+ typeof(vif_id) _i = (vif_id);
+ typeof((sizeof(wdev->vif) / sizeof((wdev->vif)[0]) + ((int)(sizeof(struct {
+ int : (-!!(__builtin_types_compatible_p(typeof((wdev->vif)),
+ typeof(&(wdev->vif)[0]))));
+ }))))) _s =
+ ((sizeof(wdev->vif) / sizeof((wdev->vif)[0]) + ((int)(sizeof(struct {
+ int : (-!!(__builtin_types_compatible_p(typeof((wdev->vif)),
+ typeof(&(wdev->vif)[0]))));
+ })))));
+ unsigned long _mask = array_index_mask_nospec(_i, _s);
+ vif_id = (typeof(_i))(_i & _mask);
+ if (!wdev->vif[vif_id]) {
+ static struct _ddebug __attribute__((__aligned__(8)))
+ __attribute__((__section__("__dyndbg"))) __UNIQUE_ID_ddebug1681 = {
+ .modname = "wfx",
+ .function = __func__,
+ .filename = "drivers/staging/wfx/wfx.h",
+ .format = ("requesting non-allocated vif: %d\n"),
+ .lineno = 102,
+ .flags = 0,
+ .key.dd_key_false = ((struct static_key_false){
+ .key = {.enabled = {0}, {.entries = (void *)0UL}},
+ })};
+ if (({
+ bool branch;
+ if (__builtin_types_compatible_p(
+ typeof(*&__UNIQUE_ID_ddebug1681.key.dd_key_false),
+ struct static_key_true))
+ branch = arch_static_branch_jump(
+ &(&__UNIQUE_ID_ddebug1681.key.dd_key_false)->key, false);
+ else if (__builtin_types_compatible_p(
+ typeof(*&__UNIQUE_ID_ddebug1681.key.dd_key_false),
+ struct static_key_false))
+ branch = arch_static_branch(
+ &(&__UNIQUE_ID_ddebug1681.key.dd_key_false)->key, false);
+ else
+ branch = ____wrong_branch_error();
+ __builtin_expect(!!(branch), 0);
+ }))
+ __dynamic_dev_dbg(&__UNIQUE_ID_ddebug1681, wdev->dev,
+ "requesting non-allocated vif: %d\n", vif_id);
+ return NULL;
+ }
+ return (struct wfx_vif *)wdev->vif[vif_id]->drv_priv;
+}
+
+int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) {
+ struct ieee80211_channel *chan0 = NULL, *chan1 = NULL;
+ struct ieee80211_conf *conf = &wvif->wdev->hw->conf;
+
+ if (wdev_to_wvif(wvif->wdev, 0))
+ chan0 = wdev_to_wvif(wvif->wdev, 0)->vif->bss_conf.chandef.chan; /* { dg-bogus "dereference of NULL" } */
+ if (wdev_to_wvif(wvif->wdev, 1))
+ chan1 = wdev_to_wvif(wvif->wdev, 1)->vif->bss_conf.chandef.chan; /* { dg-bogus "dereference of NULL" } */
+ if (chan0 && chan1 && chan0->hw_value != chan1->hw_value &&
+ wvif->vif->type != NL80211_IFTYPE_AP) {
+
+ if (enable_ps)
+ *enable_ps = true;
+ if (wvif->wdev->force_ps_timeout > -1)
+ return wvif->wdev->force_ps_timeout;
+ else if (wfx_api_older_than(wvif->wdev, 3, 2))
+ return 0;
+ else
+ return 30;
+ }
+ if (enable_ps)
+ *enable_ps = wvif->vif->bss_conf.ps;
+ if (wvif->wdev->force_ps_timeout > -1)
+ return wvif->wdev->force_ps_timeout;
+ else if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps)
+ return conf->dynamic_ps_timeout;
+ else
+ return -1;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c
new file mode 100644
index 0000000..a18c58c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c
@@ -0,0 +1,77 @@
+/* { dg-do assemble { target x86_64-*-* } } */
+/* { dg-require-effective-target lp64 } */
+
+/* Reproducer for false positive from -Wanalyzer-null-dereference seen
+ in Linux kernel (drivers/staging/wfx/sta.c; GPL-2.0) due to
+ the analyzer not grokking that array_index_mask_nospec is
+ effectively pure, and thus not realizing that array_index_no_spec
+ is also pure, leading to wdev_to_wvif not being treated as pure,
+ and thus able to return non-NULL and then NULL. */
+
+typedef unsigned char u8;
+#define NULL ((void *)0)
+
+/* Types. */
+
+struct ieee80211_vif {
+ int placeholder;
+ /* snip */
+ u8 drv_priv[];
+};
+
+struct wfx_dev {
+ /* snip */
+ struct ieee80211_vif *vif[2];
+ /* snip */
+};
+
+struct wfx_vif {
+ struct wfx_dev *wdev;
+ struct ieee80211_vif *vif;
+ /* snip */
+};
+
+/* Copied from arch/x86/include/asm/barrier.h */
+
+static inline unsigned long array_index_mask_nospec(unsigned long index,
+ unsigned long size)
+{
+ unsigned long mask;
+
+ asm volatile ("cmp %1,%2; sbb %0,%0;"
+ :"=r" (mask)
+ :"g"(size),"r" (index)
+ :"cc");
+ return mask;
+}
+
+/* Simplified from include/linux/kernel.h */
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+/* Simplified from include/linux/nospec.h */
+
+#define array_index_nospec(index, size) \
+({ \
+ typeof(index) _i = (index); \
+ typeof(size) _s = (size); \
+ unsigned long _mask = array_index_mask_nospec(_i, _s); \
+ /* snip */ \
+ (typeof(_i)) (_i & _mask); \
+})
+
+/* Simplified from drivers/staging/wfx/wfx.h */
+
+static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id) {
+ vif_id = array_index_nospec(vif_id, ARRAY_SIZE(wdev->vif));
+ if (!wdev->vif[vif_id]) {
+ return NULL;
+ }
+ return (struct wfx_vif *)wdev->vif[vif_id]->drv_priv;
+}
+
+struct ieee80211_vif *test (struct wfx_vif *wvif) {
+ if (wdev_to_wvif(wvif->wdev, 1))
+ return wdev_to_wvif(wvif->wdev, 1)->vif; /* { dg-bogus "dereference of NULL" } */
+ else
+ return NULL;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr102225.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr102225.c
new file mode 100644
index 0000000..a7c3249
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr102225.c
@@ -0,0 +1,6 @@
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+
+void bad_realloc(char *s, int n)
+{
+ char *p = __builtin_realloc(s, n);
+} /* { dg-warning "leak" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr93649.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr93649.c
index 9d92939..314c8f3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/torture/pr93649.c
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr93649.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
/* { dg-additional-options "-Wno-incompatible-pointer-types -Wno-analyzer-too-complex" } */
/* TODO: ideally we shouldn't have -Wno-analyzer-too-complex above; it
appears to be needed due to the recursion. */
@@ -57,7 +58,7 @@ ts (struct dz *cx)
{
struct dz nt;
- if (nt.r5)
+ if (nt.r5) /* { dg-warning "use of uninitialized value 'nt.r5'" } */
{
m6 (cx);
h5 (cx);
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/switch-2.c b/gcc/testsuite/gcc.dg/analyzer/torture/switch-2.c
new file mode 100644
index 0000000..3da2e30
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/switch-2.c
@@ -0,0 +1,42 @@
+struct s
+{
+ int f0;
+ int f1;
+};
+
+int test (int cmd)
+{
+ int err = 0;
+ struct s foo;
+ struct s bar;
+
+ switch (cmd)
+ {
+ case 0:
+ foo.f0 = 0;
+ break;
+ case 1:
+ foo.f0 = 1;
+ break;
+ case 30 ... 50:
+ case 70 ... 80:
+ __builtin_memset (&bar, 0, sizeof (bar));
+ break;
+ }
+
+ switch (cmd)
+ {
+ default:
+ return -1;
+ case 0 ... 1:
+ return foo.f0;
+ break;
+ case 42:
+ return bar.f1;
+ break;
+ case 65:
+ return bar.f1;
+ break;
+ }
+ return err;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c b/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c
new file mode 100644
index 0000000..57b8acd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c
@@ -0,0 +1,158 @@
+typedef unsigned int __u32;
+__extension__ typedef unsigned long long __u64;
+
+extern unsigned long
+copy_from_user(void *to, const void *from, unsigned long n);
+
+extern unsigned long
+copy_to_user(void *to, const void *from, unsigned long n);
+
+struct mtrr_sentry {
+ __u64 base;
+ __u32 size;
+ __u32 type;
+};
+
+struct mtrr_gentry {
+ __u64 base;
+ __u32 size;
+ __u32 regnum;
+ __u32 type;
+ __u32 _pad;
+};
+
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+#define _IOC_TYPECHECK(t) (sizeof(t))
+
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
+
+#define MTRR_IOCTL_BASE 'M'
+
+#define EFAULT 14
+#define EINVAL 22
+#define ENOTTY 25
+
+#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
+#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
+#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)
+#define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)
+#define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)
+#define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)
+#define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)
+#define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)
+#define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)
+#define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)
+
+extern void check_init_u64 (__u64 v);
+extern void check_init_u32 (__u32 v);
+
+/* Adapted/reduced from arch/x86/kernel/cpu/mtrr/if.c: mtrr_ioctl,
+ which is GPL-2.0 */
+
+long mtrr_ioctl(unsigned int cmd, unsigned long __arg) {
+ int err = 0;
+ struct mtrr_sentry sentry;
+ struct mtrr_gentry gentry;
+ void *arg = (void *)__arg;
+
+ __builtin_memset(&gentry, 0, sizeof(gentry));
+
+ switch (cmd) {
+ case MTRRIOC_ADD_ENTRY:
+ case MTRRIOC_SET_ENTRY:
+ case MTRRIOC_DEL_ENTRY:
+ case MTRRIOC_KILL_ENTRY:
+ case MTRRIOC_ADD_PAGE_ENTRY:
+ case MTRRIOC_SET_PAGE_ENTRY:
+ case MTRRIOC_DEL_PAGE_ENTRY:
+ case MTRRIOC_KILL_PAGE_ENTRY:
+ if (copy_from_user(&sentry, arg, sizeof(sentry)))
+ return -EFAULT;
+ break;
+ case MTRRIOC_GET_ENTRY:
+ case MTRRIOC_GET_PAGE_ENTRY:
+ if (copy_from_user(&gentry, arg, sizeof(gentry)))
+ return -EFAULT;
+ break;
+ }
+
+ switch (cmd) {
+ default:
+ return -ENOTTY;
+ case MTRRIOC_ADD_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_SET_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_DEL_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_KILL_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_GET_ENTRY:
+ check_init_u64 (gentry.base);
+ check_init_u32 (gentry.size);
+ check_init_u32 (gentry.regnum);
+ check_init_u32 (gentry.type);
+ check_init_u32 (gentry._pad);
+ break;
+ case MTRRIOC_ADD_PAGE_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_SET_PAGE_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_DEL_PAGE_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_KILL_PAGE_ENTRY:
+ check_init_u64 (sentry.base);
+ check_init_u32 (sentry.size);
+ check_init_u32 (sentry.type);
+ break;
+ case MTRRIOC_GET_PAGE_ENTRY:
+ check_init_u64 (gentry.base);
+ check_init_u32 (gentry.size);
+ check_init_u32 (gentry.regnum);
+ check_init_u32 (gentry.type);
+ check_init_u32 (gentry._pad);
+ break;
+ }
+
+ return err;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/switch-4.c b/gcc/testsuite/gcc.dg/analyzer/torture/switch-4.c
new file mode 100644
index 0000000..f5cdb5c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/switch-4.c
@@ -0,0 +1,27 @@
+struct snd_ac97 {
+ // snip
+ unsigned int id;
+ // snip
+};
+
+int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg) {
+
+ switch (ac97->id) {
+ case 0x53544d02:
+ if (reg == 0x22 || reg == 0x7a)
+ return 1;
+ __attribute__((__fallthrough__));
+ case 0x414b4d00:
+ return 0;
+ }
+ return 1;
+}
+
+int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg) {
+ if (ac97->id == 0x414c4781)
+ {
+ if (!snd_ac97_valid_reg(ac97, reg))
+ return -22;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/switch-5.c b/gcc/testsuite/gcc.dg/analyzer/torture/switch-5.c
new file mode 100644
index 0000000..10b2f29
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/switch-5.c
@@ -0,0 +1,68 @@
+/* { dg-additional-options "-fno-analyzer-call-summaries" } */
+
+typedef unsigned char u8;
+typedef signed int s32;
+typedef unsigned int u32;
+
+enum v4l2_mpeg_video_hevc_profile {
+ V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN = 0,
+ V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE = 1,
+ V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10 = 2
+};
+enum v4l2_buf_type {
+ V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
+ V4L2_BUF_TYPE_VIDEO_OUTPUT = 2
+};
+struct v4l2_fmtdesc {
+ u32 index;
+ u32 type;
+};
+struct v4l2_ctrl;
+s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
+struct create_channel_param {
+ u8 profile;
+};
+
+u8
+hevc_profile_to_mcu_profile(enum v4l2_mpeg_video_hevc_profile profile) {
+ switch (profile) {
+ default:
+ case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN:
+ return 1;
+ case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10:
+ return 2;
+ case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE:
+ return 3;
+ }
+}
+
+int fill_create_channel_param(struct v4l2_ctrl *ctrl,
+ struct create_channel_param *param) {
+ enum v4l2_mpeg_video_hevc_profile profile;
+ profile = v4l2_ctrl_g_ctrl(ctrl);
+ param->profile = hevc_profile_to_mcu_profile(profile);
+ return 0;
+}
+
+int allegro_enum_fmt_vid(struct v4l2_fmtdesc *f) {
+ switch (f->type) {
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ if (f->index >= 1)
+ return -22;
+ break;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ if (f->index >= 2)
+ return -22;
+ break;
+ default:
+ return -22;
+ }
+ return 0;
+}
+
+int allegro_ioctl_streamon(struct v4l2_ctrl *ctrl,
+ struct create_channel_param *param) {
+ fill_create_channel_param(ctrl, param);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/ubsan-1.c b/gcc/testsuite/gcc.dg/analyzer/torture/ubsan-1.c
new file mode 100644
index 0000000..b9f34f1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/ubsan-1.c
@@ -0,0 +1,60 @@
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+/* { dg-additional-options "-fsanitize=bounds" } */
+
+#include <stdlib.h>
+#include "../analyzer-decls.h"
+
+int test_1 (int *arr, int i, int n)
+{
+ if (i >= n)
+ return 0;
+ return arr[i];
+}
+
+int test_2 (int *arr, int i, int n)
+{
+ if (i >= n)
+ return 0;
+ if (arr[i])
+ __analyzer_eval (arr[i]); /* { dg-warning "TRUE" } */
+ else
+ __analyzer_eval (arr[i]); /* { dg-warning "FALSE" } */
+}
+
+int test_3 (int arr[], int i, int n)
+{
+ if (i >= n)
+ return 0;
+ if (arr[i])
+ __analyzer_eval (arr[i]); /* { dg-warning "TRUE" } */
+ else
+ __analyzer_eval (arr[i]); /* { dg-warning "FALSE" } */
+}
+
+void test_4 (int i, int n)
+{
+ int arr[n];
+ arr[i] = 42;
+ __analyzer_eval (arr[i] == 42); /* { dg-warning "TRUE" } */
+}
+
+void test_5 (int i, int n)
+{
+ int *arr = malloc (sizeof(int) * n);
+ if (arr)
+ {
+ arr[i] = 42;
+ __analyzer_eval (arr[i] == 42); /* { dg-warning "TRUE" } */
+ }
+ free (arr);
+}
+
+int global;
+
+void test_6 (int i, int n)
+{
+ int arr[n];
+ int saved = global;
+ arr[i] = 42;
+ __analyzer_eval (saved == global); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-1.c b/gcc/testsuite/gcc.dg/analyzer/uninit-1.c
new file mode 100644
index 0000000..8fcdcd6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-1.c
@@ -0,0 +1,44 @@
+#include "analyzer-decls.h"
+
+int test_1 (void)
+{
+ int i;
+ return i; /* { dg-warning "use of uninitialized value 'i'" } */
+}
+
+int test_2 (void)
+{
+ int i;
+ return i * 2; /* { dg-warning "use of uninitialized value 'i'" } */
+}
+
+int test_3 (void)
+{
+ static int i;
+ return i;
+}
+
+int test_4 (void)
+{
+ int *p;
+ return *p; /* { dg-warning "use of uninitialized value 'p'" } */
+}
+
+int test_5 (int flag, int *q)
+{
+ int *p;
+ if (flag) /* { dg-message "following 'false' branch" } */
+ p = q;
+
+ /* There should be two enodes here,
+ i.e. not merging the init vs non-init states. */
+ __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */
+
+ return *p; /* { dg-warning "use of uninitialized value 'p'" } */
+}
+
+int test_6 (int i)
+{
+ int arr[10];
+ return arr[i]; /* { dg-warning "use of uninitialized value 'arr\\\[i\\\]'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-2.c b/gcc/testsuite/gcc.dg/analyzer/uninit-2.c
new file mode 100644
index 0000000..0b0b8b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-2.c
@@ -0,0 +1,14 @@
+typedef __SIZE_TYPE__ size_t;
+
+extern size_t strlen (const char *__s)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__pure__))
+ __attribute__ ((__nonnull__ (1)));
+
+extern char *read_file (const char *file);
+
+size_t test_1 (const char *file)
+{
+ char *str = read_file (file);
+ return strlen (str);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-3.c b/gcc/testsuite/gcc.dg/analyzer/uninit-3.c
new file mode 100644
index 0000000..fa33e0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-3.c
@@ -0,0 +1,36 @@
+/* Reduced from linux 5.3.11: drivers/net/wireless/ath/ath10k/usb.c */
+
+/* The original file has this licence header. */
+
+// SPDX-License-Identifier: ISC
+/*
+ * Copyright (c) 2007-2011 Atheros Communications Inc.
+ * Copyright (c) 2011-2012,2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com>
+ */
+
+/* Adapted from include/linux/compiler_attributes.h. */
+#define __printf(a, b) __attribute__((__format__(printf, a, b)))
+
+/* From drivers/net/wireless/ath/ath10k/core.h. */
+
+struct ath10k;
+
+/* From drivers/net/wireless/ath/ath10k/debug.h. */
+
+enum ath10k_debug_mask {
+ /* [...other values removed...] */
+ ATH10K_DBG_USB_BULK = 0x00080000,
+};
+
+extern unsigned int ath10k_debug_mask;
+
+__printf(3, 4) void __ath10k_dbg(struct ath10k *ar,
+ enum ath10k_debug_mask mask,
+ const char *fmt, ...);
+
+static void ath10k_usb_hif_tx_sg(struct ath10k *ar)
+{
+ if (ath10k_debug_mask & ATH10K_DBG_USB_BULK)
+ __ath10k_dbg(ar, ATH10K_DBG_USB_BULK, "usb bulk transmit failed: %d\n", 42);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-4.c b/gcc/testsuite/gcc.dg/analyzer/uninit-4.c
new file mode 100644
index 0000000..791b111
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-4.c
@@ -0,0 +1,39 @@
+/* Example of interprocedural detection of an uninitialized field
+ in a heap-allocated struct. */
+
+#include <stdlib.h>
+#include "analyzer-decls.h"
+
+struct foo
+{
+ int i;
+ int j;
+ int k;
+};
+
+struct foo *__attribute__((noinline))
+alloc_foo (int a, int b)
+{
+ struct foo *p = malloc (sizeof (struct foo));
+ if (!p)
+ return NULL;
+ p->i = a;
+ p->k = b;
+ return p;
+}
+
+void test (int x, int y, int z)
+{
+ struct foo *p = alloc_foo (x, z);
+ if (!p)
+ return;
+
+ __analyzer_eval (p->i == x); /* { dg-warning "TRUE" } */
+
+ __analyzer_eval (p->j == y); /* { dg-warning "UNKNOWN" "unknown" } */
+ /* { dg-warning "use of uninitialized value '\\*p\\.j'" "uninit" { target *-*-* } .-1 } */
+
+ __analyzer_eval (p->k == z); /* { dg-warning "TRUE" } */
+
+ free (p);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-6.c b/gcc/testsuite/gcc.dg/analyzer/uninit-6.c
new file mode 100644
index 0000000..75a99ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-6.c
@@ -0,0 +1,29 @@
+/* Reduced from uninit false positive seen on Linux kernel with
+ net/ethtool/ioctl.c */
+
+typedef signed char s8;
+typedef unsigned int u32;
+typedef __SIZE_TYPE__ size_t;
+
+void *memset(void *s, int c, size_t n);
+
+struct ethtool_link_settings {
+ u32 cmd;
+ s8 link_mode_masks_nwords;
+};
+
+struct ethtool_link_ksettings {
+ struct ethtool_link_settings base;
+ u32 lanes;
+};
+
+struct ethtool_link_settings
+ethtool_get_link_ksettings(void) {
+ struct ethtool_link_ksettings link_ksettings;
+
+ memset(&link_ksettings, 0, sizeof(link_ksettings));
+ link_ksettings.base.cmd = 0x0000004c;
+ link_ksettings.base.link_mode_masks_nwords = -3;
+
+ return link_ksettings.base;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-6b.c b/gcc/testsuite/gcc.dg/analyzer/uninit-6b.c
new file mode 100644
index 0000000..32ba30f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-6b.c
@@ -0,0 +1,29 @@
+/* Reduced from uninit false positive seen on Linux kernel with
+ net/ethtool/ioctl.c */
+
+typedef signed char s8;
+typedef unsigned int u32;
+typedef __SIZE_TYPE__ size_t;
+
+void *memset(void *s, int c, size_t n);
+
+struct ethtool_link_settings {
+ u32 cmd;
+ s8 link_mode_masks_nwords;
+};
+
+struct ethtool_link_ksettings {
+ u32 lanes;
+ struct ethtool_link_settings base;
+};
+
+struct ethtool_link_settings
+ethtool_get_link_ksettings(void) {
+ struct ethtool_link_ksettings link_ksettings;
+
+ memset(&link_ksettings, 0, sizeof(link_ksettings));
+ link_ksettings.base.cmd = 0x0000004c;
+ link_ksettings.base.link_mode_masks_nwords = -3;
+
+ return link_ksettings.base;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-pr94713.c b/gcc/testsuite/gcc.dg/analyzer/uninit-pr94713.c
new file mode 100644
index 0000000..cc337dc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-pr94713.c
@@ -0,0 +1,11 @@
+void f1 (int *);
+void f2 (int);
+
+int foo (void)
+{
+ int *p;
+
+ f1 (p); /* { dg-warning "use of uninitialized value 'p'" } */
+ f2 (p[0]); /* { dg-warning "use of uninitialized value 'p'" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/uninit-pr94714.c b/gcc/testsuite/gcc.dg/analyzer/uninit-pr94714.c
new file mode 100644
index 0000000..df07f98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/uninit-pr94714.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int main (void)
+{
+ int *p;
+ int i;
+
+ p = &i; /* { dg-bogus "uninitialized" } */
+ printf ("%d\n", p[0]); /* { dg-warning "use of uninitialized value '\\*p'" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/use-after-free-2.c b/gcc/testsuite/gcc.dg/analyzer/use-after-free-2.c
new file mode 100644
index 0000000..fc138ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/use-after-free-2.c
@@ -0,0 +1,8 @@
+int test (void)
+{
+ int *ptr = (int *)__builtin_malloc (sizeof (int));
+ *ptr = 42; /* { dg-warning "dereference of possibly-NULL 'ptr'" } */
+ __builtin_free (ptr);
+
+ return *ptr; /* { dg-warning "use after 'free' of 'ptr'" "use-after-free" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/use-after-free-3.c b/gcc/testsuite/gcc.dg/analyzer/use-after-free-3.c
new file mode 100644
index 0000000..b19fd3d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/use-after-free-3.c
@@ -0,0 +1,12 @@
+#include <stdlib.h>
+
+void test_1 (int x, int y, int *out)
+{
+ int *ptr = (int *)malloc (sizeof (int));
+ if (!ptr)
+ return;
+ *ptr = 19;
+
+ free (ptr);
+ *out = *ptr; /* { dg-warning "use after 'free' of 'ptr'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-3.c b/gcc/testsuite/gcc.dg/analyzer/zlib-3.c
index 5faada1..57f5dcd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/zlib-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/zlib-3.c
@@ -179,7 +179,7 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e,
f = 1 << (k - w);
for (j = i >> w; j < z; j += f)
- q[j] = r;
+ q[j] = r; /* { dg-warning "use of uninitialized value 'r.base'" } */
mask = (1 << w) - 1;
while ((i & mask) != x[h]) {
diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-6.c b/gcc/testsuite/gcc.dg/analyzer/zlib-6.c
index 0d814c0..c8e06c6 100644
--- a/gcc/testsuite/gcc.dg/analyzer/zlib-6.c
+++ b/gcc/testsuite/gcc.dg/analyzer/zlib-6.c
@@ -16,15 +16,8 @@ typedef struct inflate_blocks_state {
extern int inflate_flush(inflate_blocks_statef *, z_stream *, int);
-int inflate_blocks(inflate_blocks_statef *s, z_stream *z, int r) {
- uInt t;
- uLong b;
- uInt k;
- Byte *p;
- uInt n;
- Byte *q;
- uInt m;
-
+int inflate_blocks(inflate_blocks_statef *s, z_stream *z, int r,
+ uLong b, uInt k, Byte *p, uInt n, Byte *q, uInt m) {
while (k < (3)) {
{
if (n)
@@ -41,7 +34,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_stream *z, int r) {
return inflate_flush(s, z, r);
}
};
- b |= ((uLong)(n--, *p++)) << k; /* { dg-warning "use of uninitialized value" "uninit-warning-removed" { xfail *-*-* } } */
+ b |= ((uLong)(n--, *p++)) << k;
k += 8;
}
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-6a.c b/gcc/testsuite/gcc.dg/analyzer/zlib-6a.c
new file mode 100644
index 0000000..9676e0b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/zlib-6a.c
@@ -0,0 +1,47 @@
+typedef unsigned char Byte;
+typedef unsigned int uInt;
+typedef unsigned long uLong;
+
+typedef struct z_stream_s {
+ Byte *next_in;
+ uInt avail_in;
+ uLong total_in;
+} z_stream;
+
+typedef struct inflate_blocks_state {
+ uInt bitk;
+ uLong bitb;
+ Byte *write;
+} inflate_blocks_statef;
+
+extern int inflate_flush(inflate_blocks_statef *, z_stream *, int);
+
+int inflate_blocks(inflate_blocks_statef *s, z_stream *z, int r) {
+ uInt t;
+ uLong b;
+ uInt k;
+ Byte *p;
+ uInt n;
+ Byte *q;
+ uInt m;
+
+ while (k < (3)) { /* { dg-warning "use of uninitialized value 'k'" } */
+ {
+ if (n) /* { dg-warning "use of uninitialized value 'n'" } */
+ r = 0;
+ else {
+ {
+ s->bitb = b; /* { dg-warning "use of uninitialized value 'b'" } */
+ s->bitk = k; /* { dg-warning "use of uninitialized value 'k'" } */
+ z->avail_in = n; /* { dg-warning "use of uninitialized value 'n'" } */
+ z->total_in += p - z->next_in; /* { dg-warning "use of uninitialized value 'p'" } */
+ z->next_in = p; /* { dg-warning "use of uninitialized value 'p'" } */
+ s->write = q; /* { dg-warning "use of uninitialized value 'q'" } */
+ }
+ return inflate_flush(s, z, r);
+ }
+ };
+ b |= ((uLong)(n--, *p++)) << k; /* { dg-warning "use of uninitialized value" } */
+ k += 8; /* { dg-warning "use of uninitialized value 'k'" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/array-quals-1.c b/gcc/testsuite/gcc.dg/array-quals-1.c
index 2c04164..b9b55f7 100644
--- a/gcc/testsuite/gcc.dg/array-quals-1.c
+++ b/gcc/testsuite/gcc.dg/array-quals-1.c
@@ -7,26 +7,26 @@
/* { dg-additional-options "-fno-pie" { target pie } } */
/* The MMIX port always switches to the .data section at the end of a file. */
/* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* } } } */
-/* { dg-final { scan-assembler-symbol-section {^_?a$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?a$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
static const int a[2] = { 1, 2 };
/* { dg-final { scan-assembler-symbol-section {^_?a1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
const int a1[2] = { 1, 2 };
typedef const int ci;
-/* { dg-final { scan-assembler-symbol-section {^_?b$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?b$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
static ci b[2] = { 3, 4 };
/* { dg-final { scan-assembler-symbol-section {^_?b1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
ci b1[2] = { 3, 4 };
typedef int ia[2];
-/* { dg-final { scan-assembler-symbol-section {^_?c$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?c$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
static const ia c = { 5, 6 };
/* { dg-final { scan-assembler-symbol-section {^_?c1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
const ia c1 = { 5, 6 };
typedef const int cia[2];
-/* { dg-final { scan-assembler-symbol-section {^_?d$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?d$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
static cia d = { 7, 8 };
/* { dg-final { scan-assembler-symbol-section {^_?d1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
cia d1 = { 7, 8 };
-/* { dg-final { scan-assembler-symbol-section {^_?e$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?e$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
static cia e[2] = { { 1, 2 }, { 3, 4 } };
/* { dg-final { scan-assembler-symbol-section {^_?e1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
cia e1[2] = { { 1, 2 }, { 3, 4 } };
diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c
index 9ee56b6..3e75096 100644
--- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c
+++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c
@@ -2,6 +2,7 @@
assignment. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-prune-output "warning: using serial compilation" } */
extern void abort (void);
extern void exit (int);
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-5.c b/gcc/testsuite/gcc.dg/attr-alloc_size-5.c
index 7aa7cbf..4eea625 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-5.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-5.c
@@ -4,7 +4,7 @@
zero bytes. For standard allocation functions the return value is
implementation-defined and so relying on it may be a source of bugs. */
/* { dg-do compile } */
-/* { dg-options "-O2 -Wall -Walloc-zero" } */
+/* { dg-options "-O1 -Wall -Walloc-zero" } */
#define SCHAR_MAX __SCHAR_MAX__
#define SCHAR_MIN (-SCHAR_MAX - 1)
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-7.c b/gcc/testsuite/gcc.dg/attr-alloc_size-7.c
index 68602ec..3adde5c 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-7.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-7.c
@@ -4,7 +4,7 @@
of the maximum specified by -Walloc-size-larger-than=maximum. */
/* { dg-do compile } */
/* { dg-require-effective-target alloca } */
-/* { dg-options "-O2 -Wall -Walloc-size-larger-than=12345" } */
+/* { dg-options "-O1 -Wall -Walloc-size-larger-than=12345" } */
#define SIZE_MAX __SIZE_MAX__
#define MAXOBJSZ 12345
@@ -13,15 +13,40 @@ typedef __SIZE_TYPE__ size_t;
void sink (void*);
-static size_t maxobjsize (void)
+#pragma GCC push_options
+/* Verify that constant evaluation takes place even at -O0. */
+#pragma GCC optimize ("0")
+
+void test_cst (void *p)
{
- return MAXOBJSZ;
+ enum { max = MAXOBJSZ };
+
+ sink (__builtin_aligned_alloc (1, max));
+ sink (__builtin_aligned_alloc (1, max + 1)); /* { dg-warning "argument 2 value .12346\[lu\]*. exceeds maximum object size 12345" } */
+
+ sink (__builtin_alloca (max));
+ sink (__builtin_alloca (max + 2)); /* { dg-warning "argument 1 value .12347\[lu\]*. exceeds maximum object size 12345" } */
+
+ sink (__builtin_calloc (1, max));
+ sink (__builtin_calloc (max, 1));
+
+ sink (__builtin_calloc (max / 2, 3)); /* { dg-warning "product .6172\[lu\]* \\* 3\[lu\]*. of arguments 1 and 2 exceeds maximum object size 12345" } */
+ sink (__builtin_calloc (4, max / 3)); /* { dg-warning "product .4\[lu\]* \\* 4115\[lu\]*. of arguments 1 and 2 exceeds maximum object size 12345" } */
+
+ sink (__builtin_malloc (max));
+ sink (__builtin_malloc (max + 3)); /* { dg-warning "argument 1 value .12348\[lu\]*. exceeds maximum object size 12345" } */
+
+ sink (__builtin_realloc (p, max));
+ sink (__builtin_realloc (p, max + 4)); /* { dg-warning "argument 2 value .12349\[lu\]*. exceeds maximum object size 12345" } */
}
-void test_var (void *p)
+/* Variable evaluation needs -O1. */
+#pragma GCC pop_options
+
+__attribute__ ((noipa)) void test_var (void *p)
{
- size_t max = maxobjsize ();
+ size_t max = MAXOBJSZ;
sink (__builtin_aligned_alloc (1, max));
sink (__builtin_aligned_alloc (1, max + 1)); /* { dg-warning "argument 2 value .12346\[lu\]*. exceeds maximum object size 12345" } */
@@ -43,7 +68,15 @@ void test_var (void *p)
}
-void test_range (void *p, size_t range)
+/* Value range evaluation (apparently) needs -O2 here. */
+#pragma GCC optimize ("2")
+
+static size_t maxobjsize (void)
+{
+ return MAXOBJSZ;
+}
+
+__attribute__ ((noipa)) void test_range (void *p, size_t range)
{
/* Make sure the variable is at least as large as the maximum object
size but also make sure that it's guaranteed not to be too big to
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-8.c b/gcc/testsuite/gcc.dg/attr-alloc_size-8.c
index 91d7eb5..7b47b04 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-8.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-8.c
@@ -4,7 +4,7 @@
two more specific options override the more general latter option. */
/* { dg-do compile } */
/* { dg-require-effective-target alloca } */
-/* { dg-options "-O2 -Walloc-size-larger-than=123 -Walloca-larger-than=234 -Wvla-larger-than=345" } */
+/* { dg-options "-O -Walloc-size-larger-than=123 -Walloca-larger-than=234 -Wvla-larger-than=345" } */
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/gcc.dg/attr-nonstring-2.c b/gcc/testsuite/gcc.dg/attr-nonstring-2.c
index ba4757d..44a102c 100644
--- a/gcc/testsuite/gcc.dg/attr-nonstring-2.c
+++ b/gcc/testsuite/gcc.dg/attr-nonstring-2.c
@@ -26,8 +26,8 @@ void test_strnlen_array_cst (void)
T (strnlen (ns3, 1));
T (strnlen (ns3, 2));
T (strnlen (ns3, 3));
- T (strnlen (ns3, 4)); /* { dg-warning "specified bound 4 exceeds source size 3" } */
- T (strnlen (ns3, DIFF_MAX)); /* { dg-warning "specified bound \[0-9\]+ exceeds source size" } */
+ T (strnlen (ns3, 4)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound 4|specified bound 4 exceeds source size 3" } */
+ T (strnlen (ns3, DIFF_MAX)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound|specified bound \[0-9\]+ exceeds source size" } */
T (strnlen (ns3, SIZE_MAX)); /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size \[0-9\]+" } */
NONSTRING char ns5[5];
@@ -37,8 +37,8 @@ void test_strnlen_array_cst (void)
T (strnlen (ns5, 1));
T (strnlen (ns5, 2));
T (strnlen (ns5, 3));
- T (strnlen (ns5, 6)); /* { dg-warning "specified bound 6 exceeds source size 5" } */
- T (strnlen (ns5, DIFF_MAX)); /* { dg-warning "specified bound \[0-9\]+ exceeds source size 5" } */
+ T (strnlen (ns5, 6)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound 6|specified bound 6 exceeds source size 5" } */
+ T (strnlen (ns5, DIFF_MAX)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound|specified bound \[0-9\]+ exceeds source size 5" } */
T (strnlen (ns5, SIZE_MAX)); /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size \[0-9\]+" } */
}
@@ -52,8 +52,8 @@ void test_strnlen_array_range (void)
T (strnlen (ns3, UR (0, 9)));
T (strnlen (ns3, UR (3, 4)));
T (strnlen (ns3, UR (3, DIFF_MAX)));
- T (strnlen (ns3, UR (4, 5))); /* { dg-warning "specified bound \\\[4, 5] exceeds source size 3" } */
- T (strnlen (ns3, UR (DIFF_MAX, SIZE_MAX))); /* { dg-warning "specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds source size 3 " } */
+ T (strnlen (ns3, UR (4, 5))); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound \\\[4, 5]|specified bound \\\[4, 5] exceeds source size 3" } */
+ T (strnlen (ns3, UR (DIFF_MAX, SIZE_MAX))); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound \\\[\[0-9\]+, \[0-9\]+] |specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds source size 3 " } */
}
@@ -73,8 +73,8 @@ void test_strnlen_string_cst (void)
T (3, "12", 3, 1);
T (3, "12", 3, 9);
T (3, "123", 3, 1);
- T (3, "123", 3, 4); /* { dg-warning "specified bound 4 exceeds source size 3" } */
- T (3, "123", 3, 9); /* { dg-warning "specified bound 9 exceeds source size 3" } */
+ T (3, "123", 3, 4); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound 4|specified bound 4 exceeds source size 3" } */
+ T (3, "123", 3, 9); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound 9|specified bound 9 exceeds source size 3" } */
T (5, "1", 2, 1);
T (5, "1", 2, 2);
@@ -84,7 +84,7 @@ void test_strnlen_string_cst (void)
T (5, "12", 3, 9);
T (5, "123", 3, 1);
T (5, "123", 3, 5);
- T (5, "123", 3, 6); /* { dg-warning "specified bound 6 exceeds source size 5" } */
+ T (5, "123", 3, 6); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound 6|specified bound 6 exceeds source size 5" } */
/* Strnlen shouldn't trigger a warning for arrays of unknown size
(except for accesses to uninitialized elements when those are
@@ -110,6 +110,6 @@ void test_strnlen_string_range (void)
{
T (3, "1", 2, UR (0, 1));
T (3, "1", 2, UR (3, 9));
- T (3, "123", 3, UR (4, 5)); /* { dg-warning "specified bound \\\[4, 5] exceeds source size 3" } */
- T (3, "123", 3, UR (5, 9)); /* { dg-warning "specified bound \\\[5, 9] exceeds source size 3" } */
+ T (3, "123", 3, UR (4, 5)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound \\\[4, 5]|specified bound \\\[4, 5] exceeds source size 3" } */
+ T (3, "123", 3, UR (5, 9)); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound \\\[5, 9]|specified bound \\\[5, 9] exceeds source size 3" } */
}
diff --git a/gcc/testsuite/gcc.dg/attr-nonstring-4.c b/gcc/testsuite/gcc.dg/attr-nonstring-4.c
index f2416c1..6f03a56 100644
--- a/gcc/testsuite/gcc.dg/attr-nonstring-4.c
+++ b/gcc/testsuite/gcc.dg/attr-nonstring-4.c
@@ -40,7 +40,7 @@ void strnlen_cst (void)
T (NS, /* [] */, n);
T (NS, /* [] */, n + 1); /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size \[0-9\]+" } */
- T (NS, 9, n); /* { dg-warning "specified bound \[0-9\]+ exceeds source size 9" } */
+ T (NS, 9, n); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound \\d+|specified bound \\d+ exceeds source size 9" } */
T (NS, 10, n + 1); /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size \[0-9\]+" } */
}
@@ -59,6 +59,6 @@ void strnlen_range (void)
T (NS, /* [] */, n);
T (NS, /* [] */, n + 1); /* { dg-warning "specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds maximum object size \[0-9\]+" } */
- T (NS, 9, n); /* { dg-warning "specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds source size 9" } */
+ T (NS, 9, n); /* { dg-warning "argument 1 declared attribute 'nonstring' is smaller than the specified bound \\\[\\d+, \\d+]|specified bound \\\[\\d+, \\d+] exceeds source size 9" } */
T (NS, 10, n + 1); /* { dg-warning "specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds maximum object size \[0-9\]+" } */
}
diff --git a/gcc/testsuite/gcc.dg/attr-noreturn.c b/gcc/testsuite/gcc.dg/attr-noreturn.c
new file mode 100644
index 0000000..8d58f6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-noreturn.c
@@ -0,0 +1,64 @@
+/* Verify that attribute noreturn on global and local function declarations
+ is merged.
+ { dg-do compile }
+ { dg-options "-Wall -fdump-tree-optimized" } */
+
+void foo (void);
+
+int fnr_local_local (void)
+{
+ __attribute__ ((noreturn)) void fnr1 (void);
+
+ fnr1 ();
+
+ foo ();
+}
+
+int gnr_local_local (void)
+{
+ void fnr1 (void);
+
+ fnr1 ();
+
+ foo ();
+}
+
+
+int fnr_local_global (void)
+{
+ __attribute__ ((noreturn)) void fnr2 (void);
+
+ fnr2 ();
+
+ foo ();
+}
+
+void fnr2 (void);
+
+int gnr_local_global (void)
+{
+ fnr2 ();
+
+ foo ();
+}
+
+
+__attribute__ ((noreturn)) void fnr3 (void);
+
+int fnr_global_local (void)
+{
+ fnr3 ();
+
+ foo ();
+}
+
+int gnr_global_local (void)
+{
+ void fnr3 (void);
+
+ fnr3 ();
+
+ foo ();
+}
+
+/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/attr-returns-nonnull.c b/gcc/testsuite/gcc.dg/attr-returns-nonnull.c
new file mode 100644
index 0000000..22ee30a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-returns-nonnull.c
@@ -0,0 +1,58 @@
+/* Verify that attribute returns_nonnull on global and local function
+ declarations is merged.
+ { dg-do compile }
+ { dg-options "-Wall -fdump-tree-optimized" } */
+
+void foo (void);
+
+
+void frnn_local_local (void)
+{
+ __attribute__ ((returns_nonnull)) void* frnn1 (void);
+
+ if (!frnn1 ())
+ foo ();
+}
+
+void gnr_local_local (void)
+{
+ void* frnn1 (void);
+
+ if (!frnn1 ())
+ foo ();
+}
+
+void frnn_local_global (void)
+{
+ __attribute__ ((returns_nonnull)) void* frnn2 (void);
+
+ if (!frnn2 ())
+ foo ();
+}
+
+void* frnn2 (void);
+
+void gnr_local_global (void)
+{
+ if (!frnn2 ())
+ foo ();
+}
+
+__attribute__ ((returns_nonnull)) void* frnn3 (void);
+
+void frnn_global_local (void)
+{
+ if (!frnn3 ())
+ foo ();
+}
+
+void gnr_global_local (void)
+{
+ void* frnn3 (void);
+
+ if (!frnn3 ())
+ foo ();
+}
+
+
+/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/attr-unavailable-1.c b/gcc/testsuite/gcc.dg/attr-unavailable-1.c
new file mode 100644
index 0000000..768214f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-unavailable-1.c
@@ -0,0 +1,88 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef int INT1 __attribute__((unavailable));
+typedef INT1 INT2 __attribute__ ((__unavailable__));
+
+typedef INT1 INT1a; /* { dg-error "'INT1' is unavailable" "" } */
+typedef INT1 INT1b __attribute__ ((unavailable));
+
+INT1 should_be_unavailable; /* { dg-error "'INT1' is unavailable" "" } */
+INT1a should_not_be_unavailable;
+
+INT1 f1(void) __attribute__ ((unavailable));
+INT1 f2(void) { return 0; } /* { dg-error "'INT1' is unavailable" "" } */
+
+INT2 f3(void) __attribute__ ((__unavailable__));
+INT2 f4(void) { return 0; } /* { dg-error "'INT2' is unavailable" "" } */
+int f5(INT2 x); /* { dg-error "'INT2' is unavailable" "" } */
+int f6(INT2 x) __attribute__ ((__unavailable__)); /* { dg-error "'INT2' is unavailable" "" } */
+
+typedef enum {red, green, blue} Color __attribute__((unavailable));
+
+int g1;
+int g2 __attribute__ ((unavailable));
+int g3 __attribute__ ((__unavailable__));
+Color k; /* { dg-error "'Color' is unavailable" "" } */
+
+typedef struct {
+ int field1;
+ int field2 __attribute__ ((unavailable));
+ int field3;
+ int field4 __attribute__ ((__unavailable__));
+ union {
+ int field5;
+ int field6 __attribute__ ((unavailable));
+ } u1;
+ int field7:1;
+ int field8:1 __attribute__ ((unavailable));
+ union {
+ int field9;
+ int field10;
+ } u2 __attribute__ ((unavailable));
+} S1;
+
+int func1()
+{
+ INT1 w; /* { dg-error "'INT1' is unavailable" "" } */
+ int x __attribute__ ((unavailable));
+ int y __attribute__ ((__unavailable__));
+ int z;
+ int (*pf)() = f1; /* { dg-error "'f1' is unavailable" "" } */
+
+ z = w + x + y + g1 + g2 + g3; /* { dg-error "'x' is unavailable" "" } */
+ /* { dg-error "'y' is unavailable" "y" { target *-*-* } .-1 } */
+ /* { dg-error "'g2' is unavailable" "g2" { target *-*-* } .-2 } */
+ /* { dg-error "'g3' is unavailable" "g3" { target *-*-* } .-3 } */
+ return f1(); /* { dg-error "'f1' is unavailable" "f1" } */
+}
+
+int func2(S1 *p)
+{
+ S1 lp;
+
+ if (p->field1)
+ return p->field2; /* { dg-error "'field2' is unavailable" "" } */
+ else if (lp.field4) /* { dg-error "'field4' is unavailable" "" } */
+ return p->field3;
+
+ p->u1.field5 = g1 + p->field7;
+ p->u2.field9; /* { dg-error "'u2' is unavailable" "" } */
+ return p->u1.field6 + p->field8; /* { dg-error "'field6' is unavailable" "" } */
+ /* { dg-error "'field8' is unavailable" "field8" { target *-*-* } .-1 } */
+}
+
+struct SS1 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable" "" } */
+} __attribute__ ((unavailable));
+
+struct SS1 *p1; /* { dg-error "'SS1' is unavailable" "" } */
+
+struct __attribute__ ((__unavailable__)) SS2 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable" "" } */
+};
+
+struct SS2 *p2; /* { dg-error "'SS2' is unavailable" "" } */
diff --git a/gcc/testsuite/gcc.dg/attr-unavailable-2.c b/gcc/testsuite/gcc.dg/attr-unavailable-2.c
new file mode 100644
index 0000000..303f973
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-unavailable-2.c
@@ -0,0 +1,6 @@
+/* Test __attribute__((unavailable)). Test types without names. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct { int a; } __attribute__((unavailable)) x; /* { dg-error "type is unavailable" } */
+typeof(x) y; /* { dg-error "type is unavailable" } */
diff --git a/gcc/testsuite/gcc.dg/attr-unavailable-3.c b/gcc/testsuite/gcc.dg/attr-unavailable-3.c
new file mode 100644
index 0000000..7274c19
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-unavailable-3.c
@@ -0,0 +1,10 @@
+/* Test __attribute__((unavailable)). */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void func(void);
+void func(void) __attribute__((unavailable));
+
+void f(void) {
+ func(); /* { dg-error "'func' is unavailable" } */
+}
diff --git a/gcc/testsuite/gcc.dg/attr-unavailable-4.c b/gcc/testsuite/gcc.dg/attr-unavailable-4.c
new file mode 100644
index 0000000..9e39c50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-unavailable-4.c
@@ -0,0 +1,88 @@
+/* Test __attribute__ ((unavailable("message"))) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef int INT1 __attribute__((unavailable("You can't use INT1")));
+typedef INT1 INT2 __attribute__ ((__unavailable__("You can't use INT2")));
+
+typedef INT1 INT1a; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+typedef INT1 INT1b __attribute__ ((unavailable("You can't use INT1b")));
+
+INT1 should_be_unavailable; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+INT1a should_not_be_unavailable;
+
+INT1 f1(void) __attribute__ ((unavailable("You can't use f1")));
+INT1 f2(void) { return 0; } /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+
+INT2 f3(void) __attribute__ ((__unavailable__("You can't use f3")));
+INT2 f4(void) { return 0; } /* { dg-error "'INT2' is unavailable: You can't use INT2" "" } */
+int f5(INT2 x); /* { dg-error "'INT2' is unavailable: You can't use INT2" "" } */
+int f6(INT2 x) __attribute__ ((__unavailable__("You can't use f6"))); /* { dg-error "'INT2' is unavailable: You can't use INT2" "" } */
+
+typedef enum {red, green, blue} Color __attribute__((unavailable("You can't use Color")));
+
+int g1;
+int g2 __attribute__ ((unavailable("You can't use g2")));
+int g3 __attribute__ ((__unavailable__("You can't use g3")));
+Color k; /* { dg-error "'Color' is unavailable: You can't use Color" "" } */
+
+typedef struct {
+ int field1;
+ int field2 __attribute__ ((unavailable("You can't use field2")));
+ int field3;
+ int field4 __attribute__ ((__unavailable__("You can't use field4")));
+ union {
+ int field5;
+ int field6 __attribute__ ((unavailable("You can't use field6")));
+ } u1;
+ int field7:1;
+ int field8:1 __attribute__ ((unavailable("You can't use field8")));
+ union {
+ int field9;
+ int field10;
+ } u2 __attribute__ ((unavailable("You can't use u2")));
+} S1;
+
+int func1()
+{
+ INT1 w; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+ int x __attribute__ ((unavailable("Avoid x")));
+ int y __attribute__ ((__unavailable__("Bad y")));
+ int z;
+ int (*pf)() = f1; /* { dg-error "'f1' is unavailable: You can't use f1" "" } */
+
+ z = w + x + y + g1 + g2 + g3; /* { dg-error "'x' is unavailable: Avoid x" "" } */
+ /* { dg-error "'y' is unavailable: Bad y" "y" { target *-*-* } .-1 } */
+ /* { dg-error "'g2' is unavailable: You can't use g2" "g2" { target *-*-* } .-2 } */
+ /* { dg-error "'g3' is unavailable: You can't use g3" "g3" { target *-*-* } .-3 } */
+ return f1(); /* { dg-error "'f1' is unavailable: You can't use f1" "" } */
+}
+
+int func2(S1 *p)
+{
+ S1 lp;
+
+ if (p->field1)
+ return p->field2; /* { dg-error "'field2' is unavailable: You can't use field2" "" } */
+ else if (lp.field4) /* { dg-error "'field4' is unavailable: You can't use field4" "" } */
+ return p->field3;
+
+ p->u1.field5 = g1 + p->field7;
+ p->u2.field9; /* { dg-error "'u2' is unavailable: You can't use u2" "" } */
+ return p->u1.field6 + p->field8; /* { dg-error "'field6' is unavailable: You can't use field6" "" } */
+ /* { dg-error "'field8' is unavailable: You can't use field8" "field8" { target *-*-* } .-1 } */
+}
+
+struct SS1 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+} __attribute__ ((unavailable("You can't use SS1")));
+
+struct SS1 *p1; /* { dg-error "'SS1' is unavailable: You can't use SS1" "" } */
+
+struct __attribute__ ((__unavailable__("You can't use SS2"))) SS2 {
+ int x;
+ INT1 y; /* { dg-error "'INT1' is unavailable: You can't use INT1" "" } */
+};
+
+struct SS2 *p2; /* { dg-error "'SS2' is unavailable: You can't use SS2" "" } */
diff --git a/gcc/testsuite/gcc.dg/attr-unavailable-5.c b/gcc/testsuite/gcc.dg/attr-unavailable-5.c
new file mode 100644
index 0000000..051f960
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-unavailable-5.c
@@ -0,0 +1,6 @@
+/* Test __attribute__((unavailable)). Test types without names. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct { int a; } __attribute__((unavailable ("Do not use"))) x; /* { dg-error "type is unavailable" } */
+typeof(x) y; /* { dg-error "type is unavailable: Do not use" } */
diff --git a/gcc/testsuite/gcc.dg/attr-unavailable-6.c b/gcc/testsuite/gcc.dg/attr-unavailable-6.c
new file mode 100644
index 0000000..f5f4560
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-unavailable-6.c
@@ -0,0 +1,11 @@
+/* Test __attribute__((unavailable)). Test merging with multiple
+ declarations. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void func(void);
+void func(void) __attribute__((unavailable ("Do not use")));
+
+void f(void) {
+ func(); /* { dg-error "'func' is unavailable: Do not use" } */
+}
diff --git a/gcc/testsuite/gcc.dg/attr-vector_size.c b/gcc/testsuite/gcc.dg/attr-vector_size.c
index 00be26a..3f2ce88 100644
--- a/gcc/testsuite/gcc.dg/attr-vector_size.c
+++ b/gcc/testsuite/gcc.dg/attr-vector_size.c
@@ -22,14 +22,6 @@ DEFVEC (extern, 30);
#if __SIZEOF_SIZE_T__ > 4
-DEFVEC (extern, 31);
-DEFVEC (extern, 32);
-DEFVEC (extern, 33);
-DEFVEC (extern, 34);
-DEFVEC (extern, 60);
-DEFVEC (extern, 61);
-DEFVEC (extern, 62);
-
VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */
#else
@@ -49,14 +41,6 @@ void test_local_scope (void)
#if __SIZEOF_SIZE_T__ > 4
- DEFVEC (auto, 31);
- DEFVEC (auto, 32);
- DEFVEC (auto, 33);
- DEFVEC (auto, 34);
- DEFVEC (auto, 60);
- DEFVEC (auto, 61);
- DEFVEC (auto, 62);
-
VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */
#else
diff --git a/gcc/testsuite/gcc.dg/auto-init-sra-1.c b/gcc/testsuite/gcc.dg/auto-init-sra-1.c
new file mode 100644
index 0000000..88fd666
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-sra-1.c
@@ -0,0 +1,24 @@
+/* Verify that SRA total scalarization will not be confused by padding
+ and also not confused by auto initialization. */
+/* { dg-do compile } */
+/* { dg-options "-O1 --param sra-max-scalarization-size-Ospeed=16 -fdump-tree-release_ssa -ftrivial-auto-var-init=zero" } */
+
+struct S
+{
+ int i;
+ unsigned short f1;
+ char f2;
+ unsigned short f3, f4;
+};
+
+
+int foo (struct S *p)
+{
+ struct S l;
+
+ l = *p;
+ l.i++;
+ *p = l;
+}
+
+/* { dg-final { scan-tree-dump-times "l;" 0 "release_ssa" } } */
diff --git a/gcc/testsuite/gcc.dg/auto-init-sra-2.c b/gcc/testsuite/gcc.dg/auto-init-sra-2.c
new file mode 100644
index 0000000..d260f5a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-sra-2.c
@@ -0,0 +1,24 @@
+/* Verify that SRA total scalarization will not be confused by padding
+ and also not confused by auto initialization. */
+/* { dg-do compile } */
+/* { dg-options "-O1 --param sra-max-scalarization-size-Ospeed=16 -fdump-tree-release_ssa -ftrivial-auto-var-init=pattern" } */
+
+struct S
+{
+ int i;
+ unsigned short f1;
+ char f2;
+ unsigned short f3, f4;
+};
+
+
+int foo (struct S *p)
+{
+ struct S l;
+
+ l = *p;
+ l.i++;
+ *p = l;
+}
+
+/* { dg-final { scan-tree-dump-times "l;" 0 "release_ssa" } } */
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-1.c b/gcc/testsuite/gcc.dg/auto-init-uninit-1.c
new file mode 100644
index 0000000..502db59
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-1.c
@@ -0,0 +1,5 @@
+/* Spurious uninitialized variable warnings, case 1.
+ Taken from cppfiles.c (merge_include_chains) */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-1.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-12.c b/gcc/testsuite/gcc.dg/auto-init-uninit-12.c
new file mode 100644
index 0000000..65da110
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-12.c
@@ -0,0 +1,4 @@
+/* PR 23497 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-12.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-13.c b/gcc/testsuite/gcc.dg/auto-init-uninit-13.c
new file mode 100644
index 0000000..87dd8b5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-13.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+
+typedef _Complex float C;
+C foo()
+{
+ C f;
+ __imag__ f = 0;
+ return f; /* { dg-warning "is used" "unconditional" } */
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-14.c b/gcc/testsuite/gcc.dg/auto-init-uninit-14.c
new file mode 100644
index 0000000..9ffe00a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-14.c
@@ -0,0 +1,4 @@
+/* PR 24931 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-14.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-15.c b/gcc/testsuite/gcc.dg/auto-init-uninit-15.c
new file mode 100644
index 0000000..121f0cf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-15.c
@@ -0,0 +1,26 @@
+/* PR tree-optimization/17506
+ We issue an uninitialized variable warning at a wrong location at
+ line 11, which is very confusing. Make sure we print out a note to
+ make it less confusing. (not xfailed alternative)
+ But it is of course ok if we warn in bar about uninitialized use
+ of j. (not xfailed alternative) */
+/* { dg-do compile } */
+/* { dg-options "-O1 -Wuninitialized -ftrivial-auto-var-init=zero" } */
+
+inline int
+foo (int i)
+{
+ if (i) /* { dg-warning "used uninitialized" } */
+ return 1;
+ return 0;
+}
+
+void baz (void);
+
+void
+bar (void)
+{
+ int j; /* { dg-message "note: 'j' was declared here" "" } */
+ for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" "" { xfail *-*-* } } */
+ baz ();
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-16.c b/gcc/testsuite/gcc.dg/auto-init-uninit-16.c
new file mode 100644
index 0000000..38e1950
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-16.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized -ftrivial-auto-var-init=zero" } */
+/* -ftrivial-auto-var-init will make the uninitialized warning for address
+ taken auto var going away, FIXME later. */
+
+int foo, bar;
+
+static
+void decode_reloc(int reloc, int *is_alt)
+{
+ if (reloc >= 20)
+ *is_alt = 1;
+ else if (reloc >= 10)
+ *is_alt = 0;
+}
+
+void testfunc()
+{
+ int alt_reloc;
+
+ decode_reloc(foo, &alt_reloc);
+
+ if (alt_reloc) /* { dg-warning "may be used uninitialized" "" { xfail *-*-* } } */
+ bar = 42;
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-17.c b/gcc/testsuite/gcc.dg/auto-init-uninit-17.c
new file mode 100644
index 0000000..9eec944
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-17.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+
+typedef _Complex float C;
+C foo(int cond)
+{
+ C f;
+ __imag__ f = 0;
+ if (cond)
+ {
+ __real__ f = 1;
+ return f;
+ }
+ return f; /* { dg-warning "may be used" "unconditional" } */
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-18.c b/gcc/testsuite/gcc.dg/auto-init-uninit-18.c
new file mode 100644
index 0000000..1c9afa9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-18.c
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-18.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-19.c b/gcc/testsuite/gcc.dg/auto-init-uninit-19.c
new file mode 100644
index 0000000..38d27e4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-19.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+/* { dg-additional-options "-finline-small-functions" { target avr-*-* } } */
+
+int a, l, m;
+float *b;
+float c, d, e, g, h;
+unsigned char i, k;
+void
+fn1 (int p1, float *f1, float *f2, float *f3, unsigned char *c1, float *f4,
+ unsigned char *c2, float *p10)
+{
+ if (p1 & 8)
+ b[3] = p10[a];
+ /* { dg-warning "may be used uninitialized" "" { target { { nonpic || pie_enabled } || { hppa*64*-*-* *-*-darwin* } } } .-1 } */
+}
+
+void
+fn2 ()
+{
+ float *n;
+ if (l & 6)
+ n = &c + m;
+ fn1 (l, &d, &e, &g, &i, &h, &k, n);
+ /* { dg-warning "may be used uninitialized" "" { target { ! { { nonpic || pie_enabled } || { hppa*64*-*-* *-*-darwin* } } } } .-1 } */
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-2.c b/gcc/testsuite/gcc.dg/auto-init-uninit-2.c
new file mode 100644
index 0000000..4c32dc8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-2.c
@@ -0,0 +1,5 @@
+/* Spurious uninitialized variable warnings, case 2.
+ Taken from cpphash.c (macroexpand) */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-2.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-20.c b/gcc/testsuite/gcc.dg/auto-init-uninit-20.c
new file mode 100644
index 0000000..d81957e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-20.c
@@ -0,0 +1,4 @@
+/* Spurious uninitialized variable warnings, from gdb */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-20.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-21.c b/gcc/testsuite/gcc.dg/auto-init-uninit-21.c
new file mode 100644
index 0000000..cc61746
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-21.c
@@ -0,0 +1,4 @@
+/* PR69537, spurious warning because of a missed optimization. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-short-enums -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-21.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-22.c b/gcc/testsuite/gcc.dg/auto-init-uninit-22.c
new file mode 100644
index 0000000..1e522ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-22.c
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -Wuninitialized --param vect-max-version-for-alias-checks=20 -ftrivial-auto-var-init=zero" } */
+#include "uninit-22.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-23.c b/gcc/testsuite/gcc.dg/auto-init-uninit-23.c
new file mode 100644
index 0000000..f1f7839
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-23.c
@@ -0,0 +1,27 @@
+/* PR tree-optimization/78455 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized -ftrivial-auto-var-init=zero" } */
+
+int ij;
+
+void
+ql (void)
+{
+ int m5 = 0;
+
+ for (;;)
+ {
+ if (0)
+ for (;;)
+ {
+ int *go;
+ int *t4 = go; /* { dg-warning "is used uninitialized" } */
+
+ l1:
+ *t4 = (*t4 != 0) ? 0 : 2; /* { dg-warning "is used uninitialized" } */
+ }
+
+ if (ij != 0)
+ goto l1;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-24.c b/gcc/testsuite/gcc.dg/auto-init-uninit-24.c
new file mode 100644
index 0000000..0f839ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-24.c
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wmaybe-uninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-24.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-25.c b/gcc/testsuite/gcc.dg/auto-init-uninit-25.c
new file mode 100644
index 0000000..f36d95f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-25.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wmaybe-uninitialized -ftrivial-auto-var-init=zero" } */
+
+extern unsigned bar (void);
+extern void quux (void);
+
+unsigned foo (unsigned v)
+{
+ unsigned u;
+ if (v != 1)
+ u = bar ();
+
+ // Prevent the "dom" pass from changing the CFG layout based on the inference
+ // 'if (v != 1) is false then (v != 2) is true'. (Now it would have to
+ // duplicate the loop in order to do so, which is deemed expensive.)
+ for (int i = 0; i < 10; i++)
+ quux ();
+
+ if (v != 2)
+ return u; /* { dg-warning "may be used uninitialized" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-26.c b/gcc/testsuite/gcc.dg/auto-init-uninit-26.c
new file mode 100644
index 0000000..ae97ecf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-26.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wmaybe-uninitialized -ftrivial-auto-var-init=zero" } */
+
+extern unsigned bar (void);
+extern void quux (void);
+
+unsigned foo (unsigned v)
+{
+ unsigned u;
+ if (v != 100)
+ u = bar ();
+
+ // Prevent the "dom" pass from changing the CFG layout based on the inference
+ // 'if (v != 100) is false then (v < 105) is true'. (Now it would have to
+ // duplicate the loop in order to do so, which is deemed expensive.)
+ for (int i = 0; i < 10; i++)
+ quux ();
+
+ if (v < 105) /* v == 100 falls into this range. */
+ return u; /* { dg-warning "may be used uninitialized" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-3.c b/gcc/testsuite/gcc.dg/auto-init-uninit-3.c
new file mode 100644
index 0000000..5c10920
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-3.c
@@ -0,0 +1,5 @@
+/* Spurious uninit variable warnings, case 3.
+ Inspired by cppexp.c (parse_charconst) */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-3.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-34.c b/gcc/testsuite/gcc.dg/auto-init-uninit-34.c
new file mode 100644
index 0000000..1a68765
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-34.c
@@ -0,0 +1,60 @@
+/* PR middle-end/10138 - warn for uninitialized arrays passed as const*
+ arguments
+ Verify that passing pointers to uninitialized objects to arguments
+ to functions declared with attribute access is diagnosed where expected.
+ { dg-do compile }
+ { dg-options "-O -Wall -ftrivial-auto-var-init=zero" } */
+/* -ftrivial-auto-var-init will make the uninitialized warning for address
+ taken auto var going away, FIXME later. */
+
+#define RW(...) __attribute__ ((access (read_write, __VA_ARGS__)))
+
+RW (1) RW (3) void
+f4pi (int*, int*, int*, int*); // { dg-message "in a call to 'f4pi' declared with attribute 'access \\\(read_write, \[13\]\\\)'" }
+
+
+void nowarn_scalar (void)
+{
+ int i1 = 0, i2, i3 = 1, i4;
+ f4pi (&i1, &i2, &i3, &i4);
+}
+
+void warn_scalar_1 (void)
+{
+ int i1; // { dg-message "declared here" "" { xfail *-*-* } }
+ int i2, i3 = 1, i4;
+
+ f4pi (&i1, &i2, &i3, &i4); // { dg-warning "'i1' may be used uninitialized" "" { xfail *-*-* } }
+}
+
+void warn_scalar_2 (void)
+{
+ int j1 = 0, j2, j4;
+ int j3;
+
+ f4pi (&j1, &j2, &j3, &j4); // { dg-warning "'j3' may be used uninitialized" "" { xfail *-*-* } }
+}
+
+
+void nowarn_array_init (void)
+{
+ int a1[4] = { 0 }, a2[5], a3[6] = { 0 }, a4[7];
+
+ f4pi (a1, a2, a3, a4);
+}
+
+void warn_array_1 (void)
+{
+ int a1[4]; // { dg-message "'a1' declared here" }
+ int a2[5], a3[6] = { 0 }, a4[7];
+
+ f4pi (a1, a2, a3, a4); // { dg-warning "'a1' may be used uninitialized" }
+}
+
+void warn_array_2 (void)
+{
+ int a1[4] = { 0 }, a2[5], a4[7];
+ int a3[6]; // { dg-message "'a3' declared here" }
+
+ f4pi (a1, a2, a3, a4); // { dg-warning "'a3' may be used uninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-36.c b/gcc/testsuite/gcc.dg/auto-init-uninit-36.c
new file mode 100644
index 0000000..64377d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-36.c
@@ -0,0 +1,238 @@
+/* PR middle-end/10138 - warn for uninitialized arrays passed as const*
+ arguments
+ Verify that passing pointers to uninitialized objects to const
+ arguments to built-ins is diagnosed where expected.
+ { dg-do compile }
+ { dg-options "-O -Wall -ftrivial-auto-var-init=zero" }
+ { dg-require-effective-target alloca } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void* alloca (size_t);
+void* malloc (size_t);
+void* realloc (void*, size_t);
+
+void* memcpy (void*, const void*, size_t);
+char* strcpy (char*, const char*);
+size_t strlen (const char*);
+
+void sink (void*);
+
+void nowarn_array_memcpy (void *d, unsigned n)
+{
+ int a[2];
+ /* Diagnose this? */
+ memcpy (d, a, n /* Non-constant to avoid folding into MEM_REF. */);
+}
+
+void nowarn_array_plus_cst_memcpy (void *d, unsigned n)
+{
+ int a[3];
+ /* Diagnose this? */
+ memcpy (d, a + 1, n);
+}
+
+void nowarn_array_plus_var_memcpy (void *d, unsigned n, int i)
+{
+ int a[4];
+ /* Diagnose this? */
+ memcpy (d, a + i, n);
+}
+
+void nowarn_array_assign_memcpy (char *d, unsigned n)
+{
+ int a[3];
+ a[1] = 3;
+ memcpy (d, a, n);
+}
+
+void nowarn_array_init_memcpy (char *d, unsigned n)
+{
+ int a[4] = { 0 };
+ memcpy (d, a, n);
+}
+
+void nowarn_array_compound_memcpy (void *d, unsigned n)
+{
+ memcpy (d, (int[2]){ 0 }, n);
+}
+
+void nowarn_struct_assign_memcpy (void *d, unsigned n)
+{
+ struct S { int a, b, c, d; } s;
+ s.b = 1;
+ s.d = 2;
+ memcpy (d, &s, n);
+}
+
+
+void nowarn_array_init_strcpy (char *d[], unsigned n)
+{
+ char a[8] = "012";
+
+ strcpy (d[0], a);
+ strcpy (d[1], a + 1);
+ strcpy (d[1], a + 2);
+ strcpy (d[1], a + 3);
+ strcpy (d[1], a + 4);
+ strcpy (d[1], a + 5);
+ strcpy (d[1], a + 6);
+ strcpy (d[1], a + 7);
+}
+
+
+void nowarn_array_assign_strcpy (char *d[], unsigned n)
+{
+ char a[8];
+ a[0] = '0';
+ a[1] = '1';
+ a[2] = '2';
+ a[3] = '\0';
+
+ strcpy (d[0], a);
+ strcpy (d[1], a + 1);
+ strcpy (d[1], a + 2);
+ strcpy (d[1], a + 3);
+}
+
+void warn_array_plus_cst_strcpy (char *d, unsigned n)
+{
+ char a[8];
+ a[0] = '1';
+ a[1] = '2';
+ a[2] = '3';
+ a[3] = '\0';
+
+ strcpy (d, a + 4); // { dg-warning "\\\[-Wuninitialized" }
+ strcpy (d, a + 5); // { dg-warning "\\\[-Wuninitialized" }
+ strcpy (d, a + 6); // { dg-warning "\\\[-Wuninitialized" }
+ strcpy (d, a + 7); // { dg-warning "\\\[-Wuninitialized" }
+}
+
+void nowarn_array_plus_var_strcpy (char *d, int i)
+{
+ char a[8];
+ a[0] = '1';
+ a[1] = '2';
+ a[2] = '3';
+ a[3] = '\0';
+
+ strcpy (d, a + i);
+}
+
+
+size_t nowarn_array_assign_strlen (const char *s)
+{
+ char a[8];
+ a[0] = s[0];
+ a[1] = s[1];
+ a[2] = s[2];
+ a[3] = s[3];
+
+ size_t n = 0;
+
+ n += strlen (a);
+ n += strlen (a + 1);
+ n += strlen (a + 2);
+ n += strlen (a + 3);
+ return n;
+}
+
+size_t warn_array_plus_cst_strlen (const char *s)
+{
+ char a[8];
+ a[0] = s[0];
+ a[1] = s[1];
+ a[2] = s[2];
+ a[3] = s[3];
+
+ return strlen (a + 4); // { dg-warning "\\\[-Wuninitialized" }
+}
+
+size_t nowarn_array_plus_var_strlen (const char *s, int i)
+{
+ char a[8];
+ a[0] = s[0];
+ a[1] = s[1];
+ a[2] = s[2];
+ a[3] = s[3];
+
+ return strlen (a + i);
+}
+
+
+size_t nowarn_alloca_assign_strlen (int i)
+{
+ char *p = (char*)alloca (8);
+ p[i] = '\0';
+ return strlen (p);
+}
+
+size_t nowarn_alloca_escape_strlen (int i)
+{
+ char *p = (char*)alloca (8);
+ sink (p);
+ return strlen (p);
+}
+
+size_t warn_alloca_strlen (void)
+{
+ char *p = (char*)alloca (8);
+ return strlen (p); // { dg-warning "\\\[-Wuninitialized" }
+}
+
+
+size_t nowarn_malloc_assign_strlen (int i)
+{
+ char *p = (char*)malloc (8);
+ p[i] = '\0';
+ return strlen (p);
+}
+
+size_t nowarn_malloc_escape_strlen (int i)
+{
+ char *p = (char*)malloc (8);
+ sink (p);
+ return strlen (p);
+}
+
+size_t warn_malloc_strlen (void)
+{
+ char *p = (char*)malloc (8);
+ return strlen (p); // { dg-warning "\\\[-Wuninitialized" }
+}
+
+
+size_t nowarn_realloc_strlen (void *p)
+{
+ char *q = (char*)realloc (p, 8);
+ return strlen (q);
+}
+
+
+size_t nowarn_vla_assign_strlen (int n, int i)
+{
+ char vla[n];
+ vla[i] = '\0';
+ return strlen (vla);
+}
+
+size_t nowarn_vla_strcpy_strlen (int n, const char *s, int i)
+{
+ char vla[n];
+ strcpy (vla, s);
+ return strlen (vla + i);
+}
+
+size_t nowarn_vla_escape_strlen (int n, int i)
+{
+ char vla[n];
+ sink (vla);
+ return strlen (vla);
+}
+
+size_t warn_vla_strlen (unsigned n)
+{
+ char vla[n];
+ return strlen (vla); // { dg-warning "\\\[-Wuninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-37.c b/gcc/testsuite/gcc.dg/auto-init-uninit-37.c
new file mode 100644
index 0000000..2791b37
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-37.c
@@ -0,0 +1,156 @@
+/* PR middle-end/10138 - warn for uninitialized arrays passed as const arguments
+ Verify that -Wuninitialized and -Wmaybe-uninitialized trigger (or don't)
+ when passing uninitialized variables by reference to functions declared
+ with or without attribute access and with (or without) const qualified
+ arguments of array, VLA, or pointer types.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -ftrack-macro-expansion=0 -ftrivial-auto-var-init=zero" } */
+/* -ftrivial-auto-var-init will make the uninitialized warning for address
+ taken auto var going away, FIXME later. */
+
+#define NONE /* none */
+#define RO(...) __attribute__ ((access (read_only, __VA_ARGS__)))
+#define RW(...) __attribute__ ((access (read_write, __VA_ARGS__)))
+#define WO(...) __attribute__ ((access (write_only, __VA_ARGS__)))
+#define X(...) __attribute__ ((access (none, __VA_ARGS__)))
+
+#define CONCAT(x, y) x ## y
+#define CAT(x, y) CONCAT (x, y)
+#define UNIQ(pfx) CAT (pfx, __LINE__)
+
+extern void sink (void*);
+
+
+#define T1(attr, name, type) \
+ void UNIQ (CAT (test_, name))(void) { \
+ extern attr void UNIQ (name)(type); \
+ int x; \
+ UNIQ (name)(&x); \
+ sink (&x); \
+ }
+
+#define T2(attr, name, types) \
+ void UNIQ (CAT (test_, name))(void) { \
+ extern attr void UNIQ (name)(types); \
+ int x; \
+ UNIQ (name)(1, &x); \
+ sink (&x); \
+ }
+
+
+typedef int IA_[];
+typedef const int CIA_[];
+
+T1 (NONE, fia_, IA_);
+T1 (NONE, fcia_, CIA_); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (RO (1), froia_, IA_); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } }
+T1 (RW (1), frwia_, IA_); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (WO (1), fwoia_, IA_);
+T1 (X (1), fxia_, IA_);
+
+
+typedef int IA1[1];
+typedef const int CIA1[1];
+
+T1 (NONE, fia1, IA1);
+T1 (NONE, fcia1, CIA1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (RO (1), froia1, IA1); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } }
+T1 (RW (1), frwia1, IA1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (WO (1), fwoia1, IA1);
+T1 (X (1), fxia1, IA1);
+
+
+#define IARS1 int[restrict static 1]
+#define CIARS1 const int[restrict static 1]
+
+T1 (NONE, fiars1, IARS1);
+T1 (NONE, fciars1, CIARS1);// { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (RO (1), froiars1, IARS1); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } }
+T1 (RW (1), frwiars1, IARS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (WO (1), fwoiars1, IARS1);
+T1 (X (1), fxiars1, IARS1);
+
+
+#define IAS1 int[static 1]
+#define CIAS1 const int[static 1]
+
+T1 (NONE, fias1, IAS1);
+T1 (NONE, fcias1, CIAS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (RO (1), froias1, IAS1); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } }
+T1 (RW (1), frwias1, IAS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (WO (1), fwoias1, IAS1);
+T1 (X (1), fxias1, IAS1);
+
+
+#define IAX int[*]
+#define CIAX const int[*]
+
+T1 (NONE, fiax, IAX);
+T1 (NONE, fciax, CIAX); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (RO (1), froiax, IAX); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } }
+T1 (RW (1), frwiax, IAX); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (WO (1), fwoiax, IAX);
+T1 (X (1), fxiax, IAX);
+
+
+#define IAN int n, int[n]
+#define CIAN int n, const int[n]
+
+T2 (NONE, fian, IAN);
+T2 (NONE, fcian, CIAN); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T2 (RO (2, 1), froian, IAN); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } }
+T2 (RW (2, 1), frwian, IAN); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T2 (WO (2, 1), fwoian, IAN);
+T2 (X (2, 1), fxian, IAN);
+
+
+typedef int* IP;
+typedef const int* CIP;
+
+T1 (NONE, fip, IP);
+T1 (NONE, fcip, CIP); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (RO (1), froip, IP); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } }
+T1 (RW (1), frwip, IP); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } }
+T1 (WO (1), fwoip, IP);
+T1 (X (1), fxip, IP);
+
+
+/* Verify that the notes printed after the warning mention attribute
+ access only when the attribute is explicitly used in the declaration
+ and not otherwise. */
+
+void test_note_cst_restrict (void)
+{
+ extern void
+ fccar (const char[restrict]); // { dg-message "by argument 1 of type 'const char\\\[restrict]' to 'fccar'" "note" }
+
+ char a[1]; // { dg-message "'a' declared here" "note" }
+ fccar (a); // { dg-warning "'a' may be used uninitialized" }
+}
+
+void test_note_vla (int n)
+{
+ extern void
+ fccvla (const char[n]); // { dg-message "by argument 1 of type 'const char\\\[n]' to 'fccvla'" "note" }
+
+ char a[2]; // { dg-message "'a' declared here" "note" }
+ fccvla (a); // { dg-warning "'a' may be used uninitialized" }
+}
+
+void test_note_ro (void)
+{
+ extern RO (1) void
+ frocar (char[restrict]); // { dg-message "in a call to 'frocar' declared with attribute 'access \\\(read_only, 1\\\)'" "note" }
+
+ char a[3]; // { dg-message "'a' declared here" "note" }
+ frocar (a); // { dg-warning "'a' is used uninitialized" }
+}
+
+void test_note_rw (void)
+{
+ extern RW (1) void
+ frwcar (char[restrict]); // { dg-message "in a call to 'frwcar' declared with attribute 'access \\\(read_write, 1\\\)'" "note" }
+
+ char a[4]; // { dg-message "'a' declared here" "note" }
+ frwcar (a); // { dg-warning "'a' may be used uninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-4.c b/gcc/testsuite/gcc.dg/auto-init-uninit-4.c
new file mode 100644
index 0000000..29ec860
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-4.c
@@ -0,0 +1,10 @@
+/* Spurious uninit variable warnings, case 4.
+ Simplified version of cppexp.c (cpp_parse_expr).
+
+ This one is really fragile, it gets it right if you take out case
+ 1, or if the structure is replaced by an int, or if the structure
+ has fewer members (!) */
+
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-4.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-5.c b/gcc/testsuite/gcc.dg/auto-init-uninit-5.c
new file mode 100644
index 0000000..65b251a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-5.c
@@ -0,0 +1,6 @@
+/* Spurious uninitialized-variable warnings. */
+/* Disable jump threading, etc to test compiler analysis. */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -fno-tree-dce -fno-tree-vrp -fno-tree-dominator-opts -ftrivial-auto-var-init=zero" } */
+
+#include "uninit-5.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-6.c b/gcc/testsuite/gcc.dg/auto-init-uninit-6.c
new file mode 100644
index 0000000..7c10dfc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-6.c
@@ -0,0 +1,7 @@
+/* Spurious uninitialized variable warnings.
+ This one inspired by java/class.c:build_utf8_ref. */
+
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+
+#include "uninit-6.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-8.c b/gcc/testsuite/gcc.dg/auto-init-uninit-8.c
new file mode 100644
index 0000000..eaa9c0c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-8.c
@@ -0,0 +1,8 @@
+/* Uninitialized variable warning tests...
+ Inspired by part of optabs.c:expand_binop.
+ May be the same as uninit-1.c. */
+
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+
+#include "uninit-8.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-9.c b/gcc/testsuite/gcc.dg/auto-init-uninit-9.c
new file mode 100644
index 0000000..6dccf01
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-9.c
@@ -0,0 +1,8 @@
+/* Spurious uninitialized variable warnings. Slight variant on the
+ documented case, inspired by reg-stack.c:record_asm_reg_life. */
+
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+/* { dg-require-effective-target alloca } */
+
+#include "uninit-9.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-A.c b/gcc/testsuite/gcc.dg/auto-init-uninit-A.c
new file mode 100644
index 0000000..0ef1d92
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-A.c
@@ -0,0 +1,7 @@
+/* Inspired by part of java/parse.y.
+ May be a real bug in CSE. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall -ftrivial-auto-var-init=zero" } */
+
+#include "uninit-A.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-B.c b/gcc/testsuite/gcc.dg/auto-init-uninit-B.c
new file mode 100644
index 0000000..b6d3efd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-B.c
@@ -0,0 +1,17 @@
+/* Origin: PR c/179 from Gray Watson <gray@256.com>, adapted as a testcase
+ by Joseph Myers <jsm28@cam.ac.uk>. */
+/* -ftrivial-auto-var-init will make the uninitialized warning for address
+ taken auto var going away, FIXME later. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized -ftrivial-auto-var-init=zero" } */
+extern void foo (int *);
+extern void bar (int);
+
+void
+baz (void)
+{
+ int i;
+ if (i) /* { dg-warning "is used uninitialized" "uninit i warning" { xfail *-*-* } } */
+ bar (i);
+ foo (&i);
+}
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-C.c b/gcc/testsuite/gcc.dg/auto-init-uninit-C.c
new file mode 100644
index 0000000..be19796
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-C.c
@@ -0,0 +1,5 @@
+/* Spurious uninitialized variable warning, inspired by libgcc2.c. */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
+
+#include "uninit-C.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-H.c b/gcc/testsuite/gcc.dg/auto-init-uninit-H.c
new file mode 100644
index 0000000..e442fab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-H.c
@@ -0,0 +1,5 @@
+/* PR 14204 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wall -Werror -ftrivial-auto-var-init=zero" } */
+
+#include "uninit-H.c"
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-I.c b/gcc/testsuite/gcc.dg/auto-init-uninit-I.c
new file mode 100644
index 0000000..4f9ae6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-I.c
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized -ftrivial-auto-var-init=zero" } */
+#include "uninit-H.c"
diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-13.c b/gcc/testsuite/gcc.dg/builtin-bswap-13.c
new file mode 100644
index 0000000..6dc4c15
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtin-bswap-13.c
@@ -0,0 +1,329 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int test_s32_0_1(int x) { return __builtin_bswap32(x) & 1; }
+int test_s32_0_2(int x) { return __builtin_bswap32(x) & 2; }
+int test_s32_0_240(int x) { return __builtin_bswap32(x) & 240; }
+int test_s32_0_255(int x) { return __builtin_bswap32(x) & 255; }
+int test_s32_1_1(int x) { return (__builtin_bswap32(x) >> 1) & 1; }
+int test_s32_7_1(int x) { return (__builtin_bswap32(x) >> 7) & 1; }
+int test_s32_8_1(int x) { return (__builtin_bswap32(x) >> 8) & 1; }
+int test_s32_8_240(int x) { return (__builtin_bswap32(x) >> 8) & 240; }
+int test_s32_8_255(int x) { return (__builtin_bswap32(x) >> 8) & 255; }
+int test_s32_15_1(int x) { return (__builtin_bswap32(x) >> 15) & 1; }
+int test_s32_16_1(int x) { return (__builtin_bswap32(x) >> 16) & 1; }
+int test_s32_16_240(int x) { return (__builtin_bswap32(x) >> 16) & 240; }
+int test_s32_16_255(int x) { return (__builtin_bswap32(x) >> 16) & 255; }
+int test_s32_24_1(int x) { return (__builtin_bswap32(x) >> 24) & 1; }
+int test_s32_24_240(int x) { return (__builtin_bswap32(x) >> 24) & 240; }
+int test_s32_24_255(int x) { return (__builtin_bswap32(x) >> 24) & 255; }
+int test_s32_31_1(int x) { return (__builtin_bswap32(x) >> 31) & 1; }
+
+int test_S32_0_1(int x) { return (int)__builtin_bswap32(x) & 1; }
+int test_S32_0_2(int x) { return (int)__builtin_bswap32(x) & 2; }
+int test_S32_0_240(int x) { return (int)__builtin_bswap32(x) & 240; }
+int test_S32_0_255(int x) { return (int)__builtin_bswap32(x) & 255; }
+int test_S32_1_1(int x) { return ((int)__builtin_bswap32(x) >> 1) & 1; }
+int test_S32_7_1(int x) { return ((int)__builtin_bswap32(x) >> 7) & 1; }
+int test_S32_8_1(int x) { return ((int)__builtin_bswap32(x) >> 8) & 1; }
+int test_S32_8_240(int x) { return ((int)__builtin_bswap32(x) >> 8) & 240; }
+int test_S32_8_255(int x) { return ((int)__builtin_bswap32(x) >> 8) & 255; }
+int test_S32_15_1(int x) { return ((int)__builtin_bswap32(x) >> 15) & 1; }
+int test_S32_16_1(int x) { return ((int)__builtin_bswap32(x) >> 16) & 1; }
+int test_S32_16_240(int x) { return ((int)__builtin_bswap32(x) >> 16) & 240; }
+int test_S32_16_255(int x) { return ((int)__builtin_bswap32(x) >> 16) & 255; }
+int test_S32_24_1(int x) { return ((int)__builtin_bswap32(x) >> 24) & 1; }
+int test_S32_24_240(int x) { return ((int)__builtin_bswap32(x) >> 24) & 240; }
+int test_S32_24_255(int x) { return ((int)__builtin_bswap32(x) >> 24) & 255; }
+int test_S32_31_1(int x) { return ((int)__builtin_bswap32(x) >> 31) & 1; }
+
+unsigned int test_u32_24_255(unsigned int x) {
+ return (__builtin_bswap32(x) >> 24) & 255;
+}
+
+long long test_s64_0_1(long long x) {
+ return __builtin_bswap64(x) & 1;
+}
+long long test_s64_0_2(long long x) {
+ return __builtin_bswap64(x) & 2;
+}
+long long test_s64_0_240(long long x) {
+ return __builtin_bswap64(x) & 240;
+}
+long long test_s64_0_255(long long x) {
+ return __builtin_bswap64(x) & 255;
+}
+long long test_s64_7_1(long long x) {
+ return (__builtin_bswap64(x) >> 7) & 1;
+}
+long long test_s64_8_1(long long x) {
+ return (__builtin_bswap64(x) >> 8) & 1;
+}
+long long test_s64_8_240(long long x) {
+ return (__builtin_bswap64(x) >> 56) & 240;
+}
+long long test_s64_8_255(long long x) {
+ return (__builtin_bswap64(x) >> 8) & 255;
+}
+long long test_s64_9_1(long long x) {
+ return (__builtin_bswap64(x) >> 9) & 1;
+}
+long long test_s64_31_1(long long x) {
+ return (__builtin_bswap64(x) >> 31) & 1;
+}
+long long test_s64_32_1(long long x) {
+ return (__builtin_bswap64(x) >> 32) & 1;
+}
+long long test_s64_32_240(long long x) {
+ return (__builtin_bswap64(x) >> 32) & 240;
+}
+long long test_s64_32_255(long long x) {
+ return (__builtin_bswap64(x) >> 32) & 255;
+}
+long long test_s64_33_1(long long x) {
+ return (__builtin_bswap64(x) >> 33) & 1;
+}
+long long test_s64_48_1(long long x) {
+ return (__builtin_bswap64(x) >> 48) & 1;
+}
+long long test_s64_48_240(long long x) {
+ return (__builtin_bswap64(x) >> 48) & 240;
+}
+long long test_s64_48_255(long long x) {
+ return (__builtin_bswap64(x) >> 48) & 255;
+}
+long long test_s64_56_1(long long x) {
+ return (__builtin_bswap64(x) >> 56) & 1;
+}
+long long test_s64_56_240(long long x) {
+ return (__builtin_bswap64(x) >> 56) & 240;
+}
+long long test_s64_56_255(long long x) {
+ return (__builtin_bswap64(x) >> 56) & 255;
+}
+long long test_s64_57_1(long long x) {
+ return (__builtin_bswap64(x) >> 57) & 1;
+}
+long long test_s64_63_1(long long x) {
+ return (__builtin_bswap64(x) >> 63) & 1;
+}
+
+long long test_S64_0_1(long long x) {
+ return (long long)__builtin_bswap64(x) & 1;
+}
+long long test_S64_0_2(long long x) {
+ return (long long)__builtin_bswap64(x) & 2;
+}
+long long test_S64_0_240(long long x) {
+ return (long long)__builtin_bswap64(x) & 240;
+}
+long long test_S64_0_255(long long x) {
+ return (long long)__builtin_bswap64(x) & 255;
+}
+long long test_S64_7_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 7) & 1;
+}
+long long test_S64_8_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 8) & 1;
+}
+long long test_S64_8_240(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 56) & 240;
+}
+long long test_S64_8_255(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 8) & 255;
+}
+long long test_S64_9_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 9) & 1;
+}
+long long test_S64_31_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 31) & 1;
+}
+long long test_S64_32_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 32) & 1;
+}
+long long test_S64_32_240(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 32) & 240;
+}
+long long test_S64_32_255(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 32) & 255;
+}
+long long test_S64_33_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 33) & 1;
+}
+long long test_S64_48_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 48) & 1;
+}
+long long test_S64_48_240(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 48) & 240;
+}
+long long test_S64_48_255(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 48) & 255;
+}
+long long test_S64_56_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 56) & 1;
+}
+long long test_S64_56_240(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 56) & 240;
+}
+long long test_S64_56_255(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 56) & 255;
+}
+long long test_S64_57_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 57) & 1;
+}
+long long test_S64_63_1(long long x) {
+ return ((long long)__builtin_bswap64(x) >> 63) & 1;
+}
+
+unsigned long long test_u64_56_255(unsigned long long x) {
+ return (__builtin_bswap64(x) >> 56) & 255;
+}
+
+short test_s16_0_1(short x) {
+ return __builtin_bswap16(x) & 1;
+}
+short test_s16_0_240(short x) {
+ return __builtin_bswap16(x) & 240;
+}
+short test_s16_0_255(short x) {
+ return __builtin_bswap16(x) & 255;
+}
+short test_s16_1_1(short x) {
+ return (__builtin_bswap16(x) >> 1) & 1;
+}
+short test_s16_7_1(short x) {
+ return (__builtin_bswap16(x) >> 7) & 1;
+}
+short test_s16_8_1(short x) {
+ return (__builtin_bswap16(x) >> 8) & 1;
+}
+short test_s16_8_240(short x) {
+ return (__builtin_bswap16(x) >> 8) & 240;
+}
+short test_s16_8_255(short x) {
+ return (__builtin_bswap16(x) >> 8) & 255;
+}
+short test_s16_9_1(short x) {
+ return (__builtin_bswap16(x) >> 9) & 1;
+}
+short test_s16_15_1(short x) {
+ return (__builtin_bswap16(x) >> 15) & 1;
+}
+
+short test_S16_0_1(short x) {
+ return (short)__builtin_bswap16(x) & 1;
+}
+short test_S16_0_240(short x) {
+ return (short)__builtin_bswap16(x) & 240;
+}
+short test_S16_0_255(short x) {
+ return (short)__builtin_bswap16(x) & 255;
+}
+short test_S16_1_1(short x) {
+ return ((short)__builtin_bswap16(x) >> 1) & 1;
+}
+short test_S16_7_1(short x) {
+ return ((short)__builtin_bswap16(x) >> 7) & 1;
+}
+short test_S16_8_1(short x) {
+ return ((short)__builtin_bswap16(x) >> 8) & 1;
+}
+short test_S16_8_240(short x) {
+ return ((short)__builtin_bswap16(x) >> 8) & 240;
+}
+short test_S16_8_255(short x) {
+ return ((short)__builtin_bswap16(x) >> 8) & 255;
+}
+short test_S16_9_1(short x) {
+ return ((short)__builtin_bswap16(x) >> 9) & 1;
+}
+short test_S16_15_1(short x) {
+ return ((short)__builtin_bswap16(x) >> 15) & 1;
+}
+
+unsigned short test_u16_8_255(unsigned short x) {
+ return (__builtin_bswap16(x) >> 8) & 255;
+}
+
+
+/* Shifts only */
+int test_s32_24(int x) {
+ return __builtin_bswap32(x) >> 24;
+}
+int test_s32_25(int x) {
+ return __builtin_bswap32(x) >> 25;
+}
+int test_s32_30(int x) {
+ return __builtin_bswap32(x) >> 30;
+}
+int test_s32_31(int x) {
+ return __builtin_bswap32(x) >> 31;
+}
+
+unsigned int test_u32_24(unsigned int x) {
+ return __builtin_bswap32(x) >> 24;
+}
+unsigned int test_u32_25(unsigned int x) {
+ return __builtin_bswap32(x) >> 25;
+}
+unsigned int test_u32_30(unsigned int x) {
+ return __builtin_bswap32(x) >> 30;
+}
+unsigned int test_u32_31(unsigned int x) {
+ return __builtin_bswap32(x) >> 31;
+}
+
+long long test_s64_56(long long x) {
+ return __builtin_bswap64(x) >> 56;
+}
+long long test_s64_57(long long x) {
+ return __builtin_bswap64(x) >> 57;
+}
+long long test_s64_62(long long x) {
+ return __builtin_bswap64(x) >> 62;
+}
+long long test_s64_63(long long x) {
+ return __builtin_bswap64(x) >> 63;
+}
+
+unsigned long long test_u64_56(unsigned long long x) {
+ return __builtin_bswap64(x) >> 56;
+}
+unsigned long long test_u64_57(unsigned long long x) {
+ return __builtin_bswap64(x) >> 57;
+}
+unsigned long long test_u64_62(unsigned long long x) {
+ return __builtin_bswap64(x) >> 62;
+}
+unsigned long long test_u64_63(unsigned long long x) {
+ return __builtin_bswap64(x) >> 63;
+}
+
+short test_s16_8(short x) {
+ return __builtin_bswap16(x) >> 8;
+}
+short test_s16_9(short x) {
+ return __builtin_bswap16(x) >> 9;
+}
+short test_s16_14(short x) {
+ return __builtin_bswap16(x) >> 14;
+}
+short test_s16_15(short x) {
+ return __builtin_bswap16(x) >> 15;
+}
+
+unsigned short test_u16_8(unsigned short x) {
+ return __builtin_bswap16(x) >> 8;
+}
+unsigned short test_u16_9(unsigned short x) {
+ return __builtin_bswap16(x) >> 9;
+}
+unsigned short test_u16_14(unsigned short x) {
+ return __builtin_bswap16(x) >> 14;
+}
+unsigned short test_u16_15(unsigned short x) {
+ return __builtin_bswap16(x) >> 15;
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_bswap" "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-14.c b/gcc/testsuite/gcc.dg/builtin-bswap-14.c
new file mode 100644
index 0000000..62711d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtin-bswap-14.c
@@ -0,0 +1,302 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+
+__attribute__ ((noinline, noclone))
+static int rt32 (int x, int y, int z) {
+ return (__builtin_bswap32(x) >> y) & z;
+}
+#define TEST32(X,Y,Z) if(((__builtin_bswap32(X)>>Y)&Z)!=rt32(X,Y,Z)) abort()
+void test32(int x)
+{
+ TEST32(x,0,1);
+ TEST32(x,0,255);
+ TEST32(x,1,1);
+ TEST32(x,2,1);
+ TEST32(x,3,1);
+ TEST32(x,4,1);
+ TEST32(x,5,1);
+ TEST32(x,6,1);
+ TEST32(x,7,1);
+ TEST32(x,8,1);
+ TEST32(x,8,255);
+ TEST32(x,9,1);
+ TEST32(x,10,1);
+ TEST32(x,11,1);
+ TEST32(x,12,1);
+ TEST32(x,13,1);
+ TEST32(x,14,1);
+ TEST32(x,15,1);
+ TEST32(x,16,1);
+ TEST32(x,16,255);
+ TEST32(x,17,1);
+ TEST32(x,18,1);
+ TEST32(x,19,1);
+ TEST32(x,20,1);
+ TEST32(x,21,1);
+ TEST32(x,22,1);
+ TEST32(x,23,1);
+ TEST32(x,24,1);
+ TEST32(x,24,255);
+ TEST32(x,25,1);
+ TEST32(x,26,1);
+ TEST32(x,27,1);
+ TEST32(x,28,1);
+ TEST32(x,29,1);
+ TEST32(x,30,1);
+ TEST32(x,31,1);
+}
+
+#if __SIZEOF_LONG_LONG__ == 8
+__attribute__ ((noinline, noclone))
+static long long rt64 (long long x, int y, long long z) {
+ return (__builtin_bswap64(x) >> y) & z;
+}
+#define TEST64(X,Y,Z) if(((__builtin_bswap64(X)>>Y)&Z)!=rt64(X,Y,Z)) abort()
+void test64(long long x)
+{
+ TEST64(x,0,1);
+ TEST64(x,0,255);
+ TEST64(x,1,1);
+ TEST64(x,2,1);
+ TEST64(x,3,1);
+ TEST64(x,4,1);
+ TEST64(x,5,1);
+ TEST64(x,6,1);
+ TEST64(x,7,1);
+ TEST64(x,8,1);
+ TEST64(x,8,255);
+ TEST64(x,9,1);
+ TEST64(x,10,1);
+ TEST64(x,11,1);
+ TEST64(x,12,1);
+ TEST64(x,13,1);
+ TEST64(x,14,1);
+ TEST64(x,15,1);
+ TEST64(x,16,1);
+ TEST64(x,16,255);
+ TEST64(x,17,1);
+ TEST64(x,18,1);
+ TEST64(x,19,1);
+ TEST64(x,20,1);
+ TEST64(x,21,1);
+ TEST64(x,22,1);
+ TEST64(x,23,1);
+ TEST64(x,24,1);
+ TEST64(x,24,255);
+ TEST64(x,25,1);
+ TEST64(x,26,1);
+ TEST64(x,27,1);
+ TEST64(x,28,1);
+ TEST64(x,29,1);
+ TEST64(x,30,1);
+ TEST64(x,31,1);
+ TEST64(x,32,1);
+ TEST64(x,32,255);
+ TEST64(x,33,1);
+ TEST64(x,34,1);
+ TEST64(x,35,1);
+ TEST64(x,36,1);
+ TEST64(x,37,1);
+ TEST64(x,38,1);
+ TEST64(x,39,1);
+ TEST64(x,40,1);
+ TEST64(x,40,255);
+ TEST64(x,41,1);
+ TEST64(x,42,1);
+ TEST64(x,43,1);
+ TEST64(x,44,1);
+ TEST64(x,45,1);
+ TEST64(x,46,1);
+ TEST64(x,47,1);
+ TEST64(x,48,1);
+ TEST64(x,48,255);
+ TEST64(x,49,1);
+ TEST64(x,50,1);
+ TEST64(x,51,1);
+ TEST64(x,52,1);
+ TEST64(x,53,1);
+ TEST64(x,54,1);
+ TEST64(x,55,1);
+ TEST64(x,56,1);
+ TEST64(x,56,255);
+ TEST64(x,57,1);
+ TEST64(x,58,1);
+ TEST64(x,59,1);
+ TEST64(x,60,1);
+ TEST64(x,61,1);
+ TEST64(x,62,1);
+ TEST64(x,63,1);
+}
+#endif
+
+__attribute__ ((noinline, noclone))
+static int rt16 (int x, int y, int z) {
+ return (__builtin_bswap16(x) >> y) & z;
+}
+#define TEST16(X,Y,Z) if(((__builtin_bswap16(X)>>Y)&Z)!=rt16(X,Y,Z)) abort()
+void test16(int x)
+{
+ TEST16(x,0,1);
+ TEST16(x,0,255);
+ TEST16(x,1,1);
+ TEST16(x,2,1);
+ TEST16(x,3,1);
+ TEST16(x,4,1);
+ TEST16(x,5,1);
+ TEST16(x,6,1);
+ TEST16(x,7,1);
+ TEST16(x,8,1);
+ TEST16(x,8,255);
+ TEST16(x,9,1);
+ TEST16(x,10,1);
+ TEST16(x,11,1);
+ TEST16(x,12,1);
+ TEST16(x,13,1);
+ TEST16(x,14,1);
+ TEST16(x,15,1);
+}
+
+int main()
+{
+ test32(0x00000000);
+ test32(0xffffffff);
+ test32(0x00000001);
+ test32(0x00000002);
+ test32(0x00000004);
+ test32(0x00000008);
+ test32(0x00000010);
+ test32(0x00000020);
+ test32(0x00000040);
+ test32(0x00000080);
+ test32(0x00000100);
+ test32(0x00000200);
+ test32(0x00000400);
+ test32(0x00000800);
+ test32(0x00001000);
+ test32(0x00002000);
+ test32(0x00004000);
+ test32(0x00008000);
+ test32(0x00010000);
+ test32(0x00020000);
+ test32(0x00040000);
+ test32(0x00080000);
+ test32(0x00100000);
+ test32(0x00200000);
+ test32(0x00400000);
+ test32(0x00800000);
+ test32(0x01000000);
+ test32(0x02000000);
+ test32(0x04000000);
+ test32(0x08000000);
+ test32(0x10000000);
+ test32(0x20000000);
+ test32(0x40000000);
+ test32(0x80000000);
+ test32(0x12345678);
+ test32(0x87654321);
+ test32(0xdeadbeef);
+ test32(0xcafebabe);
+
+#if __SIZEOF_LONG_LONG__ == 8
+ test64(0x0000000000000000ll);
+ test64(0xffffffffffffffffll);
+ test64(0x0000000000000001ll);
+ test64(0x0000000000000002ll);
+ test64(0x0000000000000004ll);
+ test64(0x0000000000000008ll);
+ test64(0x0000000000000010ll);
+ test64(0x0000000000000020ll);
+ test64(0x0000000000000040ll);
+ test64(0x0000000000000080ll);
+ test64(0x0000000000000100ll);
+ test64(0x0000000000000200ll);
+ test64(0x0000000000000400ll);
+ test64(0x0000000000000800ll);
+ test64(0x0000000000001000ll);
+ test64(0x0000000000002000ll);
+ test64(0x0000000000004000ll);
+ test64(0x0000000000008000ll);
+ test64(0x0000000000010000ll);
+ test64(0x0000000000020000ll);
+ test64(0x0000000000040000ll);
+ test64(0x0000000000080000ll);
+ test64(0x0000000000100000ll);
+ test64(0x0000000000200000ll);
+ test64(0x0000000000400000ll);
+ test64(0x0000000000800000ll);
+ test64(0x0000000001000000ll);
+ test64(0x0000000002000000ll);
+ test64(0x0000000004000000ll);
+ test64(0x0000000008000000ll);
+ test64(0x0000000010000000ll);
+ test64(0x0000000020000000ll);
+ test64(0x0000000040000000ll);
+ test64(0x0000000080000000ll);
+ test64(0x0000000100000000ll);
+ test64(0x0000000200000000ll);
+ test64(0x0000000400000000ll);
+ test64(0x0000000800000000ll);
+ test64(0x0000001000000000ll);
+ test64(0x0000002000000000ll);
+ test64(0x0000004000000000ll);
+ test64(0x0000008000000000ll);
+ test64(0x0000010000000000ll);
+ test64(0x0000020000000000ll);
+ test64(0x0000040000000000ll);
+ test64(0x0000080000000000ll);
+ test64(0x0000100000000000ll);
+ test64(0x0000200000000000ll);
+ test64(0x0000400000000000ll);
+ test64(0x0000800000000000ll);
+ test64(0x0001000000000000ll);
+ test64(0x0002000000000000ll);
+ test64(0x0004000000000000ll);
+ test64(0x0008000000000000ll);
+ test64(0x0010000000000000ll);
+ test64(0x0020000000000000ll);
+ test64(0x0040000000000000ll);
+ test64(0x0080000000000000ll);
+ test64(0x0100000000000000ll);
+ test64(0x0200000000000000ll);
+ test64(0x0400000000000000ll);
+ test64(0x0800000000000000ll);
+ test64(0x1000000000000000ll);
+ test64(0x2000000000000000ll);
+ test64(0x4000000000000000ll);
+ test64(0x8000000000000000ll);
+ test64(0x0123456789abcdefll);
+ test64(0xfedcba9876543210ll);
+ test64(0xdeadbeefdeadbeefll);
+ test64(0xcafebabecafebabell);
+#endif
+
+ test16(0x0000);
+ test16(0xffff);
+ test16(0x0001);
+ test16(0x0002);
+ test16(0x0004);
+ test16(0x0008);
+ test16(0x0010);
+ test16(0x0020);
+ test16(0x0040);
+ test16(0x0080);
+ test16(0x0100);
+ test16(0x0200);
+ test16(0x0400);
+ test16(0x0800);
+ test16(0x1000);
+ test16(0x2000);
+ test16(0x4000);
+ test16(0x8000);
+ test16(0x1234);
+ test16(0x4321);
+ test16(0xdead);
+ test16(0xbeef);
+ test16(0xcafe);
+ test16(0xbabe);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-10.c b/gcc/testsuite/gcc.dg/builtin-object-size-10.c
index 2a212fa..bfcdf5c 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-10.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-10.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-objsz1-details" } */
+/* { dg-options "-O2 -fdump-tree-early_objsz-details" } */
// { dg-skip-if "packed attribute missing for drone_source_packet" { "epiphany-*-*" } }
typedef struct {
@@ -22,5 +22,5 @@ foo(char *x)
return dpkt;
}
-/* { dg-final { scan-tree-dump "maximum object size 21" "objsz1" } } */
-/* { dg-final { scan-tree-dump "maximum subobject size 16" "objsz1" } } */
+/* { dg-final { scan-tree-dump "maximum object size 21" "early_objsz" } } */
+/* { dg-final { scan-tree-dump "maximum subobject size 16" "early_objsz" } } */
diff --git a/gcc/testsuite/gcc.dg/builtins-70.c b/gcc/testsuite/gcc.dg/builtins-70.c
new file mode 100644
index 0000000..a0c2dc9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-70.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2021 Free Software Foundation.
+
+ Check that constant folding of built-in fmod functions doesn't
+ break anything and produces the expected results.
+
+/* { dg-do link } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern void link_error(void);
+
+extern double fmod(double,double);
+extern float fmodf(float,float);
+extern long double fmodl(long double,long double);
+
+int main()
+{
+ if (fmod (6.5, 2.3) < 1.8999 || fmod (6.5, 2.3) > 1.9001)
+ link_error ();
+ if (fmod (-6.5, 2.3) < -1.9001 || fmod (-6.5, 2.3) > -1.8999)
+ link_error ();
+ if (fmod (6.5, -2.3) < 1.8999 || fmod (6.5, -2.3) > 1.9001)
+ link_error ();
+ if (fmod (-6.5, -2.3) < -1.9001 || fmod (-6.5, -2.3) > -1.8999)
+ link_error ();
+
+ if (fmodf (6.5f, 2.3f) < 1.8999f || fmodf (6.5f, 2.3f) > 1.9001f)
+ link_error ();
+ if (fmodf (-6.5f, 2.3f) < -1.9001f || fmodf (-6.5f, 2.3f) > -1.8999f)
+ link_error ();
+ if (fmodf (6.5f, -2.3f) < 1.8999f || fmodf (6.5f, -2.3f) > 1.9001f)
+ link_error ();
+ if (fmodf (-6.5f, -2.3f) < -1.9001f || fmodf (-6.5f, -2.3f) > -1.8999f)
+ link_error ();
+
+ if (fmodl (6.5l, 2.3l) < 1.8999l || fmod (6.5l, 2.3l) > 1.9001l)
+ link_error ();
+ if (fmodl (-6.5l, 2.3l) < -1.9001l || fmod (-6.5l, 2.3l) > -1.8999l)
+ link_error ();
+ if (fmodl (6.5l, -2.3l) < 1.8999l || fmod (6.5l, -2.3l) > 1.9001l)
+ link_error ();
+ if (fmodl (-6.5l, -2.3l) < -1.9001l || fmod (-6.5l, -2.3l) > -1.8999l)
+ link_error ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/c11-digit-separators-1.c b/gcc/testsuite/gcc.dg/c11-digit-separators-1.c
new file mode 100644
index 0000000..fc83226
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-digit-separators-1.c
@@ -0,0 +1,7 @@
+/* Test C2x digit separators not in C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#define m(x) 0
+
+_Static_assert (m(1'2)+(3'4) == 0, "digit separators");
diff --git a/gcc/testsuite/gcc.dg/c11-qual-1.c b/gcc/testsuite/gcc.dg/c11-qual-1.c
new file mode 100644
index 0000000..f731e06
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-qual-1.c
@@ -0,0 +1,11 @@
+/* Test that qualifiers are lost in tertiary operator for pointers to arrays before C2X, PR98397 */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors -Wno-discarded-array-qualifiers" } */
+
+void foo(void)
+{
+ const int (*u)[1];
+ void *v;
+ _Static_assert(_Generic(1 ? u : v, const void*: 0, void*: 1), "qualifier not lost");
+ _Static_assert(_Generic(1 ? v : u, const void*: 0, void*: 1), "qualifier not lost");
+}
diff --git a/gcc/testsuite/gcc.dg/c11-unproto-1.c b/gcc/testsuite/gcc.dg/c11-unproto-1.c
new file mode 100644
index 0000000..ea9e807
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-unproto-1.c
@@ -0,0 +1,24 @@
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ valid-in-C2x usages are not accepted for C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+void f1 (); /* { dg-message "previous declaration" } */
+void f1 (float); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+void f2 (float); /* { dg-message "previous declaration" } */
+void f2 (); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+void f3 (); /* { dg-message "previous declaration" } */
+void f3 (char); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+void f4 (char); /* { dg-message "previous declaration" } */
+void f4 (); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+/* Built-in function case. */
+float sqrtf (); /* { dg-warning "conflicting types for built-in function" } */
diff --git a/gcc/testsuite/gcc.dg/c11-unproto-2.c b/gcc/testsuite/gcc.dg/c11-unproto-2.c
new file mode 100644
index 0000000..0557ae3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-unproto-2.c
@@ -0,0 +1,21 @@
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ invalid-in-C2x usages, in C11 mode. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+void f1 (); /* { dg-message "previous declaration" } */
+void f1 (int, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f2 (int, ...); /* { dg-message "previous declaration" } */
+void f2 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f3 (); /* { dg-message "previous declaration" } */
+void f3 (char, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f4 (char, ...); /* { dg-message "previous declaration" } */
+void f4 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c
index 221ebdd..477f30d 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c
@@ -20,7 +20,7 @@ g ([[maybe_unused]] int x, int y)
struct [[maybe_unused]] s { double d; };
-struct s2 { [[__maybe_unused__]] int a; int b [[maybe_unused]]; } x; /* { dg-warning "attribute ignored" } */
+struct s2 { [[__maybe_unused__]] int a; int b [[maybe_unused]]; } x;
enum e { E1 [[maybe_unused]] };
@@ -28,4 +28,4 @@ union [[maybe_unused]] u { int x; };
enum [[maybe_unused]] eu { E2 };
-union u2 { [[maybe_unused]] int a; int b [[maybe_unused]]; } y; /* { dg-warning "attribute ignored" } */
+union u2 { [[maybe_unused]] int a; int b [[maybe_unused]]; } y;
diff --git a/gcc/testsuite/gcc.dg/c2x-digit-separators-1.c b/gcc/testsuite/gcc.dg/c2x-digit-separators-1.c
new file mode 100644
index 0000000..6eadf2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-digit-separators-1.c
@@ -0,0 +1,39 @@
+/* Test C2x digit separators. Valid usages. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+_Static_assert (123'45'6 == 123456);
+_Static_assert (0'123 == 0123);
+_Static_assert (0x1'23 == 0x123);
+
+#define m(x) 0
+
+_Static_assert (m(1'2)+(3'4) == 34);
+
+_Static_assert (0x0'e-0xe == 0);
+
+#define a0 '.' -
+#define acat(x) a ## x
+_Static_assert (acat (0'.') == 0);
+
+#define c0(x) 0
+#define b0 c0 (
+#define bcat(x) b ## x
+_Static_assert (bcat (0'\u00c0')) == 0);
+
+extern void exit (int);
+extern void abort (void);
+
+int
+main (void)
+{
+ if (314'159e-0'5f != 3.14159f)
+ abort ();
+ exit (0);
+}
+
+#line 0'123
+_Static_assert (__LINE__ == 123);
+
+#line 4'56'7'8'9
+_Static_assert (__LINE__ == 456789);
diff --git a/gcc/testsuite/gcc.dg/c2x-digit-separators-2.c b/gcc/testsuite/gcc.dg/c2x-digit-separators-2.c
new file mode 100644
index 0000000..d72f8ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-digit-separators-2.c
@@ -0,0 +1,25 @@
+/* Test C2x digit separators. Invalid usages. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void
+tf (void)
+{
+ int i;
+ i = 1''2; /* { dg-error "adjacent digit separators" } */
+ i = 0x'0; /* { dg-error "digit separator after base indicator" } */
+ i = 0X'1; /* { dg-error "digit separator after base indicator" } */
+ i = 0b'0; /* { dg-error "digit separator after base indicator" } */
+ i = 0B'1; /* { dg-error "digit separator after base indicator" } */
+ i = 1'u; /* { dg-error "digit separator outside digit sequence" } */
+ float f = 1.2e-3'f; /* { dg-error "digit separator outside digit sequence" } */
+ i = 1'2'3'; /* { dg-error "12:missing terminating" } */
+ ;
+ double d;
+ d = 1'.2'3e-4; /* { dg-warning "multi-character" } */
+ /* { dg-error "expected" "parse error" { target *-*-* } .-1 } */
+ d = 1.2''3; /* { dg-error "adjacent digit separators" } */
+ d = 1.23e-4''5; /* { dg-error "adjacent digit separators" } */
+ d = 1.2'3e-4'5'; /* { dg-error "17:missing terminating" } */
+ /* { dg-error "expected" "parse error" { target *-*-* } .-1 } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-digit-separators-3.c b/gcc/testsuite/gcc.dg/c2x-digit-separators-3.c
new file mode 100644
index 0000000..cddb88f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-digit-separators-3.c
@@ -0,0 +1,12 @@
+/* Test C2x digit separators. Test token pasting avoided for preprocessed
+ output. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -save-temps" } */
+
+#define ZERO 0
+
+int
+f (void)
+{
+ return ZERO'0'0; /* { dg-error "expected" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-qual-1.c b/gcc/testsuite/gcc.dg/c2x-qual-1.c
new file mode 100644
index 0000000..4d33db1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-qual-1.c
@@ -0,0 +1,30 @@
+/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+/* test that qualifiers are preserved in tertiary operator for pointers to arrays in C2X */
+
+void f(void)
+{
+ const int (*u)[1];
+ void *v;
+ _Static_assert(_Generic(1 ? u : v, const void*: 1, void*: 0), "lost qualifier");
+ _Static_assert(_Generic(1 ? v : u, const void*: 1, void*: 0), "lost qualifier");
+}
+
+/* test that assignment of unqualified to qualified pointers works as expected */
+
+void g(void)
+{
+ int (*x)[3];
+ const int (*p)[3] = x;
+}
+
+/* test that assignment of qualified void pointers works as expected */
+
+void h(void)
+{
+ const void* x;
+ const int (*p)[3] = x;
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-qual-2.c b/gcc/testsuite/gcc.dg/c2x-qual-2.c
new file mode 100644
index 0000000..f60a5b1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-qual-2.c
@@ -0,0 +1,30 @@
+/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+
+/* test that qualifiers are preserved in tertiary operator for pointers to arrays in C2X */
+
+void f(void)
+{
+ const int (*u)[1];
+ void *v;
+ _Static_assert(_Generic(1 ? u : v, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */
+ _Static_assert(_Generic(1 ? v : u, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */
+}
+
+/* test that assignment of unqualified to qualified pointers works as expected */
+
+void g(void)
+{
+ int (*x)[3];
+ const int (*p)[3] = x; /* { dg-warning "arrays with different qualifiers" } */
+}
+
+/* test that assignment of qualified void pointers works as expected */
+
+void h(void)
+{
+ const void* x;
+ const int (*p)[3] = x; /* { dg-warning "array with qualifier on the element is not qualified before C2X" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-qual-3.c b/gcc/testsuite/gcc.dg/c2x-qual-3.c
new file mode 100644
index 0000000..31896fcb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-qual-3.c
@@ -0,0 +1,30 @@
+/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat -pedantic-errors" } */
+
+/* test that qualifiers are preserved in tertiary operator for pointers to arrays in C2X */
+
+void f(void)
+{
+ const int (*u)[1];
+ void *v;
+ _Static_assert(_Generic(1 ? u : v, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */
+ _Static_assert(_Generic(1 ? v : u, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */
+}
+
+/* test that assignment of unqualified to qualified pointers works as expected */
+
+void g(void)
+{
+ int (*x)[3];
+ const int (*p)[3] = x; /* { dg-warning "arrays with different qualifiers" } */
+}
+
+/* test that assignment of qualified void pointers works as expected */
+
+void h(void)
+{
+ const void* x;
+ const int (*p)[3] = x; /* { dg-warning "array with qualifier on the element is not qualified before C2X" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-qual-4.c b/gcc/testsuite/gcc.dg/c2x-qual-4.c
new file mode 100644
index 0000000..93b4723
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-qual-4.c
@@ -0,0 +1,105 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c2x" } */
+void tvoid(void* x);
+void transpose0(double* out, const double* in) { }
+void transpose1(double out[2][2], const double in[2][2]) { }
+void transpose2(double out[2][2][2], const double in[2][2][2]) { }
+// return
+int (*y2(const int x[3][3]))[3] { return x; } /* { dg-warning "return discards 'const' qualifier from pointer target type" } */
+const int (*y3(int x[3][3]))[3] { return x; }
+void test(void)
+{
+ double x0[2];
+ double y0[2];
+ const double z0[4];
+ double x1[2][2];
+ double y1[2][2];
+ double o1[2][3];
+ const double z1[2][2];
+ double x2[2][2][2];
+ double y2[2][2][2];
+ double o2[2][2][3];
+ const double z2[2][2][2];
+ // void pointers
+ tvoid(x0);
+ tvoid(x1);
+ tvoid(x2);
+ tvoid(z0); /* { dg-warning "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ tvoid(z1); /* { dg-warning "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ tvoid(z2); /* { dg-warning "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ void* p;
+ const void* pc;
+ p = x0;
+ p = x1;
+ p = x2;
+ p = z0; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ p = z1; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ p = z2; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ pc = x0;
+ pc = x1;
+ pc = x2;
+ pc = z0;
+ pc = z1;
+ pc = z2;
+ transpose0(pc, p); /* { dg-warning "passing argument 1 of 'transpose0' discards 'const' qualifier from pointer target type" } */
+ transpose1(pc, p); /* { dg-warning "passing argument 1 of 'transpose1' discards 'const' qualifier from pointer target type" } */
+ transpose2(pc, p); /* { dg-warning "passing argument 1 of 'transpose2' discards 'const' qualifier from pointer target type" } */
+ transpose0(p, pc);
+ transpose1(p, pc);
+ transpose2(p, pc);
+ // passing as arguments
+ transpose0(y0, x0);
+ transpose1(y1, x1);
+ transpose2(y2, x2);
+ // initialization
+ const double (*u0p) = x0;
+ const double (*u1p)[2] = x1;
+ const double (*u2p)[2][2] = x2;
+ double (*v0p) = z0; /* { dg-warning "initialization discards 'const' qualifier from pointer target type" } */
+ double (*v1p)[2] = z1; /* { dg-warning "initialization discards 'const' qualifier from pointer target type" } */
+ double (*v2p)[2][2] = z2; /* { dg-warning "initialization discards 'const' qualifier from pointer target type" } */
+ // subtraction
+ &(x0[1]) - &(z0[0]);
+ &(x1[1]) - &(z1[0]);
+ &(x2[1]) - &(z2[0]);
+ // comparison
+ x0 == z0;
+ x1 == z1;
+ x2 == z2;
+ x0 < z0;
+ x1 < z1;
+ x2 < z2;
+ x0 > z0;
+ x1 > z1;
+ x2 > z2;
+ // assignment
+ u0p = x0;
+ u1p = x1;
+ u2p = x2;
+ v0p = z0; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = z1; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = z2; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ // conditional expressions
+ (void)(1 ? x0 : z0);
+ (void)(1 ? x1 : z1);
+ (void)(1 ? x2 : z2);
+ (void)(1 ? x0 : x1); /* { dg-warning "pointer type mismatch in conditional expression" } */
+ (void)(1 ? x1 : x2); /* { dg-warning "pointer type mismatch in conditional expression" } */
+ (void)(1 ? x2 : x0); /* { dg-warning "pointer type mismatch in conditional expression" } */
+ v0p = (1 ? z0 : v0p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? z1 : v1p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = (1 ? z2 : v2p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v0p = (1 ? x0 : u0p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? x1 : u1p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = (1 ? x2 : u2p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ (1 ? x0 : z0)[0] = 1; /* { dg-error "assignment of read-only location" } */
+ (1 ? x1 : z1)[0][0] = 1; /* { dg-error "assignment of read-only location" } */
+ (1 ? x2 : z2)[0][0][0] = 1; /* { dg-error "assignment of read-only location" } */
+ v0p = (1 ? p : z0); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? p : z1); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = (1 ? p : z2); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v0p = (1 ? pc : x0); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? pc : x1); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = (1 ? pc : x2); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-qual-5.c b/gcc/testsuite/gcc.dg/c2x-qual-5.c
new file mode 100644
index 0000000..0801fa0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-qual-5.c
@@ -0,0 +1,101 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+void tvoid(void* x);
+void transpose0(double* out, const double* in) { }
+void transpose1(double out[2][2], const double in[2][2]) { }
+void transpose2(double out[2][2][2], const double in[2][2][2]) { }
+// return
+int (*x2(const int x[3][3]))[3] { return x; } /* { dg-error "return discards" } */
+const int (*x3(int x[3][3]))[3] { return x; }
+void test(void)
+{
+ double x0[2];
+ double y0[2];
+ const double z0[4];
+ double x1[2][2];
+ double y1[2][2];
+ double o1[2][3];
+ const double z1[2][2];
+ double x2[2][2][2];
+ double y2[2][2][2];
+ double o2[2][2][3];
+ const double z2[2][2][2];
+ // void pointers
+ tvoid(z0); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ tvoid(z1); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ tvoid(z2); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ void* p;
+ const void* pc;
+ p = x0;
+ p = x1;
+ p = x2;
+ p = z0; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ p = z1; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ p = z2; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ pc = x0;
+ pc = x1;
+ pc = x2;
+ pc = z0;
+ pc = z1;
+ pc = z2;
+ transpose0(pc, p); /* { dg-error "passing argument 1 of 'transpose0' discards 'const' qualifier from pointer target type" } */
+ transpose1(pc, p); /* { dg-error "passing argument 1 of 'transpose1' discards 'const' qualifier from pointer target type" } */
+ transpose2(pc, p); /* { dg-error "passing argument 1 of 'transpose2' discards 'const' qualifier from pointer target type" } */
+ transpose0(p, pc);
+ transpose1(p, pc);
+ transpose2(p, pc);
+ // passing as arguments
+ transpose0(y0, x0);
+ transpose1(y1, o1); /* { dg-error "passing argument 2 of 'transpose1' from incompatible pointer type" } */
+ transpose1(y1, x1);
+ transpose2(y2, o2); /* { dg-error "passing argument 2 of 'transpose2' from incompatible pointer type" } */
+ transpose2(y2, x2);
+ // initialization
+ const double (*x0p) = x0;
+ const double (*x1p)[2] = x1;
+ const double (*x2p)[2][2] = x2;
+ double (*v0p) = z0; /* { dg-error "initialization discards 'const' qualifier from pointer target type" } */
+ double (*v1p)[2] = z1; /* { dg-error "initialization discards" } */
+ double (*v2p)[2][2] = z2; /* { dg-error "initialization discards" } */
+ // assignment
+ x0p = x0;
+ x1p = x1;
+ x2p = x2;
+ // subtraction
+ &(x0[1]) - &(z0[0]);
+ &(x1[1]) - &(z1[0]);
+ &(x2[1]) - &(z2[0]);
+ // comparison
+ x0 == z0;
+ x1 == z1;
+ x2 == z2;
+ x0 < z0;
+ x1 < z1;
+ x2 < z2;
+ x0 > z0;
+ x1 > z1;
+ x2 > z2;
+ // conditional expressions
+ (void)(1 ? x0 : z0);
+ (void)(1 ? x1 : z1);
+ (void)(1 ? x2 : z2);
+ (void)(1 ? x0 : x1); /* { dg-error "pointer type mismatch in conditional expression" } */
+ (void)(1 ? x1 : x2); /* { dg-error "pointer type mismatch in conditional expression" } */
+ (void)(1 ? x2 : x0); /* { dg-error "pointer type mismatch in conditional expression" } */
+ v0p = (1 ? z0 : v0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? z1 : v1p); /* { dg-error "assignment discards" } */
+ v2p = (1 ? z2 : v2p); /* { dg-error "assignment discards" } */
+ v0p = (1 ? x0 : x0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? x1 : x1p); /* { dg-error "assignment discards" } */
+ v2p = (1 ? x2 : x2p); /* { dg-error "assignment discards" } */
+ (1 ? x0 : z0)[0] = 1; /* { dg-error "assignment of read-only location" } */
+ (1 ? x1 : z1)[0][0] = 1; /* { dg-error "assignment of read-only location" } */
+ (1 ? x2 : z2)[0][0][0] = 1; /* { dg-error "assignment of read-only location" } */
+ v0p = (1 ? p : z0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? p : z1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = (1 ? p : z2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v0p = (1 ? pc : x0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? pc : x1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = (1 ? pc : x2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-qual-6.c b/gcc/testsuite/gcc.dg/c2x-qual-6.c
new file mode 100644
index 0000000..9c91e20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-qual-6.c
@@ -0,0 +1,114 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat -pedantic-errors" } */
+void tvoid(void* x);
+void transpose0(double* out, const double* in) { }
+void transpose1(double out[2][2], const double in[2][2]) { }
+void transpose2(double out[2][2][2], const double in[2][2][2]) { }
+// return
+int (*x2(const int x[3][3]))[3] { return x; } /* { dg-warning "before C2X" } */
+ /* { dg-error "return discards" "" { target *-*-* } .-1 } */
+const int (*x3(int x[3][3]))[3] { return x; } /* { dg-warning "before C2X" } */
+void test(void)
+{
+ double x0[2];
+ double y0[2];
+ const double z0[4];
+ double x1[2][2];
+ double y1[2][2];
+ double o1[2][3];
+ const double z1[2][2];
+ double x2[2][2][2];
+ double y2[2][2][2];
+ double o2[2][2][3];
+ const double z2[2][2][2];
+ // void pointers
+ tvoid(z0); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ tvoid(z1); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ tvoid(z2); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */
+ void* p;
+ const void* pc;
+ p = x0;
+ p = x1;
+ p = x2;
+ p = z0; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ p = z1; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ p = z2; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ pc = x0;
+ pc = x1;
+ pc = x2;
+ pc = z0;
+ pc = z1;
+ pc = z2;
+ transpose0(pc, p); /* { dg-error "passing argument 1 of 'transpose0' discards 'const' qualifier from pointer target type" } */
+ transpose1(pc, p); /* { dg-error "passing argument 1 of 'transpose1' discards 'const' qualifier from pointer target type" } */
+ transpose2(pc, p); /* { dg-error "passing argument 1 of 'transpose2' discards 'const' qualifier from pointer target type" } */
+ transpose0(p, pc);
+ transpose1(p, pc); /* { dg-warning "before C2X" } */
+ transpose2(p, pc); /* { dg-warning "before C2X" } */
+ // passing as arguments
+ transpose0(y0, x0);
+ transpose1(y1, o1); /* { dg-error "passing argument 2 of 'transpose1' from incompatible pointer type" } */
+ transpose1(y1, x1); /* { dg-warning "before C2X" } */
+ transpose2(y2, o2); /* { dg-error "passing argument 2 of 'transpose2' from incompatible pointer type" } */
+ transpose2(y2, x2); /* { dg-warning "before C2X" } */
+ // initialization
+ const double (*x0p) = x0;
+ const double (*x1p)[2] = x1; /* { dg-warning "before C2X" } */
+ const double (*x2p)[2][2] = x2; /* { dg-warning "before C2X" } */
+ double (*v0p) = z0; /* { dg-error "initialization discards 'const' qualifier from pointer target type" } */
+ double (*v1p)[2] = z1; /* { dg-warning "before C2X" } */
+ /* { dg-error "initialization discards" "" { target *-*-* } .-1 } */
+ double (*v2p)[2][2] = z2; /* { dg-warning "before C2X" } */
+ /* { dg-error "initialization discards" "" { target *-*-* } .-1 } */
+
+ // assignment
+ x0p = x0;
+ x1p = x1; /* { dg-warning "before C2X" } */
+ x2p = x2; /* { dg-warning "before C2X" } */
+
+ // subtraction
+ &(x0[1]) - &(z0[0]);
+ &(x1[1]) - &(z1[0]); /* { dg-warning "before C2X" } */
+ &(x2[1]) - &(z2[0]); /* { dg-warning "before C2X" } */
+ // comparison
+ x0 == z0;
+ x1 == z1; /* { dg-warning "before C2X" } */
+ x2 == z2; /* { dg-warning "before C2X" } */
+ x0 < z0;
+ x1 < z1; /* { dg-warning "before C2X" } */
+ x2 < z2; /* { dg-warning "before C2X" } */
+ x0 > z0;
+ x1 > z1; /* { dg-warning "before C2X" } */
+ x2 > z2; /* { dg-warning "before C2X" } */
+ // conditional expressions
+ (void)(1 ? x0 : z0);
+ (void)(1 ? x1 : z1); /* { dg-warning "before C2X" } */
+ (void)(1 ? x2 : z2); /* { dg-warning "before C2X" } */
+ (void)(1 ? x0 : x1); /* { dg-error "pointer type mismatch in conditional expression" } */
+ (void)(1 ? x1 : x2); /* { dg-error "pointer type mismatch in conditional expression" } */
+ (void)(1 ? x2 : x0); /* { dg-error "pointer type mismatch in conditional expression" } */
+ v0p = (1 ? z0 : v0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? z1 : v1p); /* { dg-warning "before C2X" } */
+ /* { dg-error "assignment discards" "" { target *-*-* } .-1 } */
+ v2p = (1 ? z2 : v2p); /* { dg-warning "before C2X" } */
+ /* { dg-error "assignment discards" "" { target *-*-* } .-1 } */
+ v0p = (1 ? x0 : x0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? x1 : x1p); /* { dg-error "assignment discards" } */
+ /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */
+ v2p = (1 ? x2 : x2p); /* { dg-error "assignment discards" } */
+ /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */
+ (1 ? x0 : z0)[0] = 1; /* { dg-error "assignment of read-only location" } */
+ (1 ? x1 : z1)[0][0] = 1; /* { dg-error "assignment of read-only location" } */
+ /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */
+ (1 ? x2 : z2)[0][0][0] = 1; /* { dg-error "assignment of read-only location" } */
+ /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */
+ v0p = (1 ? p : z0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? p : z1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */
+ v2p = (1 ? p : z2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */
+ v0p = (1 ? pc : x0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v1p = (1 ? pc : x1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+ v2p = (1 ? pc : x2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-qual-7.c b/gcc/testsuite/gcc.dg/c2x-qual-7.c
new file mode 100644
index 0000000..5fe15e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-qual-7.c
@@ -0,0 +1,16 @@
+/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+/* test that _Atomic qualifier is not preserved in tertiary operator for pointers to arrays in C2X */
+
+void f(void)
+{
+ _Atomic void *u;
+ void *v;
+ _Static_assert(_Generic(1 ? u : v, _Atomic void*: 0, void*: 1), "_Atomic should be removed");
+ _Static_assert(_Generic(1 ? v : u, _Atomic void*: 0, void*: 1), "_Atomic should be removed");
+}
+
+
+
diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-1.c b/gcc/testsuite/gcc.dg/c2x-unproto-1.c
new file mode 100644
index 0000000..45d68f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-unproto-1.c
@@ -0,0 +1,20 @@
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ valid-in-C2x usages. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void f1 ();
+void f1 (float);
+
+void f2 (float);
+void f2 ();
+
+void f3 ();
+void f3 (char);
+
+void f4 (char);
+void f4 ();
+
+/* Built-in function case. */
+float sqrtf ();
diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-2.c b/gcc/testsuite/gcc.dg/c2x-unproto-2.c
new file mode 100644
index 0000000..f826b7c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-unproto-2.c
@@ -0,0 +1,21 @@
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ invalid-in-C2x usages. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void f1 (); /* { dg-message "previous declaration" } */
+void f1 (int, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f2 (int, ...); /* { dg-message "previous declaration" } */
+void f2 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f3 (); /* { dg-message "previous declaration" } */
+void f3 (char, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f4 (char, ...); /* { dg-message "previous declaration" } */
+void f4 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
index 75e902c..35dff89 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
@@ -1280,6 +1280,8 @@ subvalues (struct entry *e, char *p, char *letter)
if (e[0].len != 0)
output_FNB ('B', e);
return 1;
+ default:
+ return 0;
}
}
diff --git a/gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c b/gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c
new file mode 100644
index 0000000..2d5809a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c
@@ -0,0 +1,16 @@
+/* Test #elifdef and #elifndef not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#define A
+#undef B
+
+#if 0
+#elifdef A
+#error "#elifdef A applied"
+#endif
+
+#if 0
+#elifndef B
+#error "#elifndef B applied"
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c
new file mode 100644
index 0000000..b23e311
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c
@@ -0,0 +1,57 @@
+/* Test #elifdef and #elifndef in C2x. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#define A
+#undef B
+
+#if 0
+#elifdef A
+#define M1 1
+#endif
+
+#if M1 != 1
+#error "#elifdef A did not apply"
+#endif
+
+#if 0
+#elifdef B
+#error "#elifdef B applied"
+#endif
+
+#if 0
+#elifndef A
+#error "#elifndef A applied"
+#endif
+
+#if 0
+#elifndef B
+#define M2 2
+#endif
+
+#if M2 != 2
+#error "#elifndef B did not apply"
+#endif
+
+#if 0
+#elifdef A
+#else
+#error "#elifdef A did not apply"
+#endif
+
+#if 0
+#elifndef B
+#else
+#error "#elifndef B did not apply"
+#endif
+
+/* As with #elif, the syntax of the new directives is relaxed after a
+ non-skipped group. */
+
+#if 1
+#elifdef x * y
+#endif
+
+#if 1
+#elifndef !
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c
new file mode 100644
index 0000000..9132832
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c
@@ -0,0 +1,63 @@
+/* Test #elifdef and #elifndef in C2x: erroneous usages. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#define A
+#undef B
+
+#elifdef A /* { dg-error "#elifdef without #if" } */
+#elifdef B /* { dg-error "#elifdef without #if" } */
+#elifndef A /* { dg-error "#elifndef without #if" } */
+#elifndef B /* { dg-error "#elifndef without #if" } */
+
+#if 1 /* { dg-error "-:began here" } */
+#else
+#elifdef A /* { dg-error "#elifdef after #else" } */
+#endif
+
+#if 1 /* { dg-error "-:began here" } */
+#else
+#elifdef B /* { dg-error "#elifdef after #else" } */
+#endif
+
+#if 1 /* { dg-error "-:began here" } */
+#else
+#elifndef A /* { dg-error "#elifndef after #else" } */
+#endif
+
+#if 1 /* { dg-error "-:began here" } */
+#else
+#elifndef B /* { dg-error "#elifndef after #else" } */
+#endif
+
+#if 0
+#elifdef A = /* { dg-error "extra tokens at end of #elifdef directive" } */
+#endif
+
+#if 0
+#elifdef B = /* { dg-error "extra tokens at end of #elifdef directive" } */
+#endif
+
+#if 0
+#elifndef A = /* { dg-error "extra tokens at end of #elifndef directive" } */
+#endif
+
+#if 0
+#elifndef B = /* { dg-error "extra tokens at end of #elifndef directive" } */
+#endif
+
+#if 0
+#elifdef /* { dg-error "no macro name given in #elifdef directive" } */
+#endif
+
+#if 0
+#elifndef /* { dg-error "no macro name given in #elifndef directive" } */
+#endif
+
+#if 0
+#elifdef , /* { dg-error "macro names must be identifiers" } */
+#endif
+
+#if 0
+#elifndef , /* { dg-error "macro names must be identifiers" } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/pr100392.c b/gcc/testsuite/gcc.dg/cpp/pr100392.c
new file mode 100644
index 0000000..670ad2b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr100392.c
@@ -0,0 +1,5 @@
+/* PR preprocessor/100392 */
+/* { dg-do compile } */
+/* { dg-options "-save-temps -fdirectives-only" } */
+
+#include "pr100392.h"
diff --git a/gcc/testsuite/gcc.dg/cpp/pr100392.h b/gcc/testsuite/gcc.dg/cpp/pr100392.h
new file mode 100644
index 0000000..340bc92
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr100392.h
@@ -0,0 +1,4 @@
+/* PR preprocessor/100392 */
+
+/* No newline after ; below. */
+int i = 1; \ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/cpp/pr100646-1.c b/gcc/testsuite/gcc.dg/cpp/pr100646-1.c
new file mode 100644
index 0000000..8f2caf4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr100646-1.c
@@ -0,0 +1,5 @@
+/* PR preprocessor/100646 */
+/* { dg-do compile } */
+/* { dg-options "-fdirectives-only -save-temps -std=c17" } */
+int main () { return 0; }
+// Not newline terminated \ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/cpp/pr100646-2.c b/gcc/testsuite/gcc.dg/cpp/pr100646-2.c
new file mode 100644
index 0000000..a1deba1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr100646-2.c
@@ -0,0 +1,6 @@
+/* PR preprocessor/100646 */
+/* { dg-do compile } */
+/* { dg-options "-fdirectives-only -save-temps -std=c17" } */
+int main () { return 0; }
+/* { dg-warning "backslash-newline at end of file" "" { target *-*-* } .+1 } */
+// Not newline terminated\ \ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/cpp/pr101638.c b/gcc/testsuite/gcc.dg/cpp/pr101638.c
new file mode 100644
index 0000000..1030473
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr101638.c
@@ -0,0 +1,7 @@
+/* PR preprocessor/101638 */
+/* { dg-do preprocess } */
+/* { dg-options "-Wtraditional" } */
+
+#define foo(attr) __has_attribute(attr)
+#if foo(__deprecated__)
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-4-utf8.c b/gcc/testsuite/gcc.dg/cpp/ucnid-4-utf8.c
index ccc7a1e..0a527ef 100644
--- a/gcc/testsuite/gcc.dg/cpp/ucnid-4-utf8.c
+++ b/gcc/testsuite/gcc.dg/cpp/ucnid-4-utf8.c
@@ -9,9 +9,9 @@
Ö
΄
-٩ /* { dg-error "not valid at the start of an identifier" } */
-๙ /* { dg-error "not valid at the start of an identifier" } */
+๙
A๙
diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-4.c b/gcc/testsuite/gcc.dg/cpp/ucnid-4.c
index e41a3f5..dceed66 100644
--- a/gcc/testsuite/gcc.dg/cpp/ucnid-4.c
+++ b/gcc/testsuite/gcc.dg/cpp/ucnid-4.c
@@ -9,9 +9,9 @@
\u00D6
\u0384
-\u0669 /* { dg-error "not valid at the start of an identifier" } */
+\u0669
A\u0669
0\u00BA
0\u0669
-\u0E59 /* { dg-error "not valid at the start of an identifier" } */
+\u0E59
A\u0E59
diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-5-utf8.c b/gcc/testsuite/gcc.dg/cpp/ucnid-5-utf8.c
new file mode 100644
index 0000000..79767b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/ucnid-5-utf8.c
@@ -0,0 +1,17 @@
+/* { dg-do preprocess } */
+/* { dg-options "-std=c99 -pedantic" } */
+
+« /* not a preprocessing error because we lex it into its own token */
+¶ /* not a preprocessing error because we lex it into its own token */
+΄ /* not a preprocessing error because we lex it into its own token */
+
+٩ /* { dg-error "not valid at the start of an identifier" } */
+A٩
+0º
+0٩
+๙ /* { dg-error "not valid at the start of an identifier" } */
+A๙
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-1.c
new file mode 100644
index 0000000..bcbc949
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-gbtf" } */
+
+void func(void)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-2.c
new file mode 100644
index 0000000..70e2ff1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-2.c
@@ -0,0 +1,10 @@
+/* Check the BTF header information. */
+
+/* { dg-do compile } */
+/* { dg-options "-gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "0xeb9f.*btf_magic" 1} } */
+/* { dg-final { scan-assembler-times "0x1.*btf_version" 1 } } */
+/* { dg-final { scan-assembler-times "0.*btf_flags" 1 } } */
+
+int foo;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c
new file mode 100644
index 0000000..89a5701
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c
@@ -0,0 +1,23 @@
+/* Test BTF generation of anonymous struct.
+
+ We expect two BTF struct records:
+ - struct foo, with two fields "a" and "bar"
+ - struct <anonymous> with one field "b"
+
+ The anonymous struct should have a name of 0, pointing to the null string
+ at the start of the string table. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Struct type with 2 members (struct foo). */
+/* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* Struct type with 1 member (anon struct). */
+/* { dg-final { scan-assembler-times "\[\t \]0x4000001\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btt_name" 1 } } */
+
+struct foo
+{
+ int a;
+ struct { int b; } bar;
+} myfoo;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c
new file mode 100644
index 0000000..f3b120bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c
@@ -0,0 +1,23 @@
+/* Test BTF generation of anonymous union.
+
+ We expect a named struct type and an anonymous union type record to
+ be generated. The anonymous union record should have a name of 0,
+ pointing to the null string at the start of the string table. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Struct type with 1 member. */
+/* { dg-final { scan-assembler-times "\[\t \]0x4000001\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* Union type with 2 members. */
+/* { dg-final { scan-assembler-times "\[\t \]0x5000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btt_name" 1 } } */
+
+struct foo
+{
+ union
+ {
+ int value;
+ char ascii;
+ };
+} myfoo;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c
new file mode 100644
index 0000000..ab55445
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c
@@ -0,0 +1,31 @@
+/* BTF generation for array type.
+
+ Unsized arrays are encoded with a 0 for the number of elements.
+
+ In this testcase, 5 distinct BTF records for arrays are expected
+ b1 : cta_nelems = 2
+ c1 : cta_nelems = 3
+ a1 : cta_nelems = 2, 5
+ buf : cta_nelems = 0. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "0x3000000\[\t \]+\[^\n\]*btt_info" 5 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*bta_nelems" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*bta_nelems" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*bta_nelems" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*bta_nelems" 1 } } */
+
+int b1[2] = {0,1};
+int c1[5] = {0,1,2,3,4};
+int a1[2][3] = { {3,4,5}, {2,3,4} };
+
+/* Variable length struct using arrays. */
+struct my_array
+{
+ int flags;
+ int length;
+ int buf[];
+} my_array_obj;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c
new file mode 100644
index 0000000..c6bf521
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c
@@ -0,0 +1,34 @@
+/* Basic tests for BTF bitfields.
+
+ The structure containing bitfield members should be marked with KIND_FLAG=1
+ The bitfield member offsets should be encoded as:
+ (bit_size << 24) | bit_offset
+ - (0xa << 24) | 0x20
+ - (0x7 << 24) | 0x2a
+ - (0x13 << 24) | 0x40 - note that this is aligned to 0x40. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x84000004\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xa000020\[\t \]+\[^\n\]*btm_offset" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x700002a\[\t \]+\[^\n\]*btm_offset" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x13000040\[\t \]+\[^\n\]*btm_offset" 1 } } */
+
+struct bitt {
+ int a;
+ unsigned int bitfield_a : 10;
+ unsigned int bitfield_b : 7;
+ unsigned int bitfield_c : 19;
+} bitty;
+
+struct no_bitt {
+ int a;
+ int b;
+} no_bitty;
+
+int main ()
+{
+ return bitty.bitfield_b + bitty.a;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c
new file mode 100644
index 0000000..9665ab6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c
@@ -0,0 +1,26 @@
+/* Test BTF generation for struct with 0 size bitfield.
+
+ We expect a struct with 2 members to be generated. The size 0 bitfield
+ should not have any entry in the member list. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Struct with bitfield members, and 2 members. */
+/* { dg-final { scan-assembler-times "\[\t \]0x84000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+/* Bitfield size 31 (0x1f) at offset 0. */
+/* { dg-final { scan-assembler-times "\[\t \]0x1f000000\[\t \]+\[^\n\]*btm_offset" 1 } } */
+
+/* Bitfield size 32 (0x20) at offset 32. */
+/* { dg-final { scan-assembler-times "\[\t \]0x20000020\[\t \]+\[^\n\]*btm_offset" 1 } } */
+
+/* Only 2 members. */
+/* { dg-final { scan-assembler-times "btm_name" 2 } } */
+
+struct foo
+{
+ unsigned a : 31;
+ unsigned : 0;
+ unsigned c : 32;
+} myfoo;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c
new file mode 100644
index 0000000..2984a33
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c
@@ -0,0 +1,38 @@
+/* Test BTF generation for enum-type bitfields
+
+ It is allowed to have a bitfield type be an enum type.
+ We expect the following types:
+
+ [1] enum 'foo'(1U#B) size=4U#B
+ 'BAR' value=0
+ 'BAZ' value=1
+ 'QUZ' value=2
+ 'QUX' value=3
+ [2] int 'unsigned int' size=4 offset=0 bits=32
+ [3] struct 'bitt' size=4
+ member 'f' type=1 bitfield_size=2 bit_offset=0
+ */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Enum with 4 members. */
+/* { dg-final { scan-assembler-times "\[\t \]0x6000004\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* Struct with 1 bitfield member. */
+/* { dg-final { scan-assembler-times "\[\t \]0x84000001\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+/* Bitfield "f" points to type ID 1. */
+/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btm_type" 1 } } */
+
+enum foo
+{
+ BAR = 0,
+ BAZ = 1,
+ QUZ = 2,
+ QUX = 3
+};
+
+struct bitt
+{
+ enum foo f : 2;
+} bitty;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-4.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-4.c
new file mode 100644
index 0000000..af91845
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-4.c
@@ -0,0 +1,23 @@
+/* Test BTF generation for non-representable bitfields.
+
+ Due to the limitations of BTF, we only have 24 bits in which to store
+ the bitfield offset (in bits, from the beginning of the struct).
+
+ In this test, we construct a structure such that the bitfield will have
+ an offset so large as to be unrepresentable in BTF. We expect that the
+ resulting BTF will describe the rest of the structure, ignoring the
+ non-representable bitfield. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Struct with 3 members and no bitfield (kind_flag not set). */
+/* { dg-final { scan-assembler-times "\[\t \]0x4000003\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+struct bigly
+{
+ int a;
+ int b[((0xffffff + 1) / (8 * sizeof (int)))];
+ unsigned unsup : 7;
+ char c;
+} big;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c
new file mode 100644
index 0000000..33e2f64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c
@@ -0,0 +1,53 @@
+/* Test BTF generation of BTF_KIND_{CONST,VOLATILE,RESTRICT} records.
+
+ BTF const, volatile and restrict records are nameless type records pointing
+ to the type they modify.
+
+ Types:
+ [1] int 'int' size=4U offset=0 bits=32 SIGNED
+ [2] const <anonymous> type=1
+ [3] volatile <anonymous> type=1
+ [4] const <anonymous> type=3
+ [5] ptr <anonymous> type=1
+ [6] restrict <anonymous> type=5
+ [7] ptr <anonymous> type=2
+ [8] restrict <anonymous> type=7
+
+ Note:
+ - Type id 3 describes a volatile int.
+ - Type id 2 describes a const int.
+ - Type id 4 describes a const volatile int by modifying id 3.
+ - Type id 6 describes a restrict pointer to int.
+ - Type id 8 describes a restrict pointer to const int.
+ */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+/* { dg-options "-O0 -gbtf -gdwarf-4 -dA" { target { *-*-darwin* } } } */
+
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+
+/* types 5 and 7 are pointers, to 'int' and 'const int' respectively. */
+/* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 2 } } */
+
+/* type 3 has VOLATILE qualifier */
+/* { dg-final { scan-assembler-times "\[\t \]0x9000000\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+/* types 2 and 4 have CONST qualifier. */
+/* { dg-final { scan-assembler-times "\[\t \]0xa000000\[\t \]+\[^\n\]*btt_info" 2 } } */
+
+/* types 6 and 8 have RESTRICT qualifier. */
+/* { dg-final { scan-assembler-times "\[\t \]0xb000000\[\t \]+\[^\n\]*btt_info" 2 } } */
+
+const int a = 10;
+
+volatile int b;
+
+int * restrict c;
+
+const volatile int d = 20;
+
+const int * restrict e;
+
+const int * f;
+int const * g;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c
new file mode 100644
index 0000000..f809d93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c
@@ -0,0 +1,46 @@
+/* BTF generation of BTF_KIND_DATASEC records.
+
+ We expect 3 DATASEC records: one for each of .data, .rodata and .bss.
+ .rodata: the consts; c,e,my_cstruct
+ .bss: a,b,bigarr
+ .data: d
+
+ The type IDs of the variables placed in each section are not deterministic
+ so we cannot check them.
+ */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gbtf -dA" } */
+/* { dg-options "-O0 -gbtf -dA -msdata=none" { target { { powerpc*-*-* } && ilp32 } } } */
+
+/* Check for two DATASEC entries with vlen 3, and one with vlen 1. */
+/* { dg-final { scan-assembler-times "0xf000003\[\t \]+\[^\n\]*btt_info" 2 } } */
+/* { dg-final { scan-assembler-times "0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+/* The offset entry for each variable in a DATSEC should be 0 at compile time. */
+/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 } } */
+
+/* Check that strings for each DATASEC have been added to the BTF string table. */
+/* { dg-final { scan-assembler-times "ascii \".data.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \".rodata.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \".bss.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+int a;
+long long b;
+const long unsigned int c;
+
+int d = 137;
+
+const int e = -55;
+
+int bigarr[20][10];
+
+struct c_struct {
+ long x;
+ char c;
+};
+
+const struct c_struct my_cstruct = {
+ 99,
+ '?'
+};
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c
new file mode 100644
index 0000000..728493b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c
@@ -0,0 +1,30 @@
+/* Test BTF generation for enums. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x6000004\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x6000003\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"QAD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"QED.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"QOD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"QUD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"YES.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"NO.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"IDUNNO.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "bte_value" 7 } } */
+
+enum foo
+{
+ QAD,
+ QED,
+ QOD,
+ QUD,
+} a;
+
+enum barsigned
+{
+ YES=1000,
+ NO=-1000,
+ IDUNNO=0,
+} b;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-float-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-float-1.c
new file mode 100644
index 0000000..6876df0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-float-1.c
@@ -0,0 +1,20 @@
+/* Tests for BTF floating point type kinds. We expect a single record for each
+ of the base types: float, double and long double. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x10000000\[\t \]+\[^\n\]*btt_info" 3 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"float.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"double.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long double.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+
+float a;
+float b = 1.5f;
+
+double c;
+double d = -99.9;
+
+long double e;
+long double f = 1000.01;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c
new file mode 100644
index 0000000..c894fa2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c
@@ -0,0 +1,24 @@
+/* Test BTF generation of forwards.
+
+ Check that the KIND_FLAG (bit 31) of btt_info is set (1) for the forward to
+ union, and not set (0) for forward to struct. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x87000000\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x7000000\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+typedef struct _fwd_st
+{
+ struct unk_struct_type *data[4];
+} fwd_st_t;
+
+fwd_st_t struct_container;
+
+typedef struct _fwd_un
+{
+ union unk_union_type *options[4];
+} fwd_un_t;
+
+fwd_un_t union_container;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c
new file mode 100644
index 0000000..9fa1498
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c
@@ -0,0 +1,18 @@
+/* Test BTF generation for functions.
+
+ We expect to see one BTF_KIND_FUNC_PROTO with 2 named arguments.
+ The parameter names should appear in the auxilliary string table. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xd000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "farg_name" 2 } } */
+/* { dg-final { scan-assembler-times "farg_type" 2 } } */
+/* { dg-final { scan-assembler-times "ascii \"alpha.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"bravo.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+int funfoo (int alpha, long bravo)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c
new file mode 100644
index 0000000..3c7fda9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c
@@ -0,0 +1,18 @@
+/* Test BTF generation for functions with varargs.
+
+ We expect one BTF_KIND_FUNC_PROTO with two arguments. The second argument
+ should have "farg_name" and "farg_type" both of 0, representing varargs. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xd000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "farg_name" 2 } } */
+/* { dg-final { scan-assembler-times "farg_type" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*farg_name" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*farg_type" 1 } } */
+
+int fmt (const char * format, ...)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c
new file mode 100644
index 0000000..c83b823
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c
@@ -0,0 +1,22 @@
+/* Test BTF generation for a function with an unrepresentable parameter.
+
+ BTF has no encoding for floating point types, among others. Function
+ parameters of unrepresentable types are emitted as 'void' types.
+
+ We expect one BTF_KIND_FUNC_PROTO with 3 parameters, one of which
+ has type_id=0. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xd000003\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "farg_name" 3 } } */
+/* { dg-final { scan-assembler-times "farg_type" 3 } } */
+
+/* Exactly one function parameter should have type_id=0. */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*farg_type" 1 } } */
+
+int foo (int a, float __attribute__((__vector_size__(16))) f, long b)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c
new file mode 100644
index 0000000..2381dec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c
@@ -0,0 +1,44 @@
+/* Tests for BTF integer base types.
+
+ 0 f ff 00 ff
+ | 0 | encoding | offset | 00 | bits |
+ encoding:
+ signed 1 << 24
+ char 2 << 24
+
+ All offsets in this test should be 0.
+ This test does _not_ check number of bits, as it may vary between targets.
+ */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Check for 8 BTF_KIND_INT types. */
+/* { dg-final { scan-assembler-times "\[\t \]0x1000000\[\t \]+\[^\n\]*btt_info" 8 } } */
+
+/* Check the signed/char flags, but not bit size. */
+/* { dg-final { scan-assembler-times "\[\t \]0x10000..\[\t \]+\[^\n\]*bti_encoding" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x20000..\[\t \]+\[^\n\]*bti_encoding" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x30000..\[\t \]+\[^\n\]*bti_encoding" 1 } } */
+
+/* Check that there is a string entry for each type name. */
+/* { dg-final { scan-assembler-times "ascii \"unsigned char.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"signed char.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"short unsigned int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"short int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"unsigned int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long unsigned int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+
+unsigned char a = 11;
+signed char b = -22;
+
+unsigned short c = 33;
+signed short d = 44;
+
+unsigned int e = 55;
+signed int f = -66;
+
+unsigned long int g = 77;
+signed long int h = 88;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c
new file mode 100644
index 0000000..a14ac0f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c
@@ -0,0 +1,25 @@
+/* Test BTF generation for pointer types.
+
+ Two pointer types are expected:
+ - int *
+ - struct st *
+ */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 2 } } */
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"st.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+
+int foo = 10;
+int *pfoo = &foo;
+
+struct st
+{
+ int a;
+ int *pb;
+ struct st * next;
+};
+
+struct st * bar;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c
new file mode 100644
index 0000000..c77b224
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c
@@ -0,0 +1,13 @@
+/* Test BTF generation for pointers to void.
+
+ In this test, we expect that the pointer references type ID 0, the reserved
+ void typeid, and that no intermediate type is generated for void. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x1000000\[\t \]+\[^\n\]*btt_info" 0 } } */
+
+void *ptr;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c
new file mode 100644
index 0000000..bc32814
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c
@@ -0,0 +1,22 @@
+/* Test BTF generation of struct type.
+
+ Two BTF_KIND_STRUCT records are expected.
+ - struct foo with 3 members
+ - struct data with 2 members */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x4000003\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "btm_name" 5 } } */
+
+struct foo
+{
+ int after;
+ int before;
+ struct {
+ unsigned short n_valid;
+ int set[10];
+ } data;
+} my_foo;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c
new file mode 100644
index 0000000..c3aff09
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c
@@ -0,0 +1,19 @@
+/* Test BTF generation for struct type with a member which refers to an
+ unsupported type.
+
+ BTF does not support floating point types (among other things). When
+ generating BTF for a struct (or union) type, members which refer to
+ unsupported types should be skipped. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Expect a struct with only 2 members - 'f' should not be present. */
+/* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+
+struct with_float
+{
+ int a;
+ float __attribute__((__vector_size__(16))) f;
+ char c;
+} instance;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c
new file mode 100644
index 0000000..472cc63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c
@@ -0,0 +1,82 @@
+/* Test BTF generation for BTF_KIND_TYPEDEF records.
+
+ 7 typedef records are expected. We expect the following types (among others):
+ [1] int 'int' size=4 offset=0 bits=32 SIGNED
+ [2] typedef 'my_int' type=1
+ [3] typedef 'foo_int' type=1
+ [4] typedef 'bar_int' type=1
+ ..
+ [6] typedef 'CBAR' type=5
+ ..
+ [8] typedef 'CBARP' type=7
+ [9] struct '_node' size=16
+ ..
+ [11] typedef 'node_t' type=9
+ [12] struct '_arena'
+ ..
+ [15] typedef 'arena_t' type=12
+ [16] var 'a' type=2 linkage=1 (global)
+ [17] var 'suitcase' type=15 linkage=1 (global)
+ [18] var 'b' type=3 linkage=1 (global)
+ [19] var 'c' type=4 linkage=1 (global)
+ [20] var 'd' type=11 linkage=1 (global)
+ [21] var 'destination' type=6 linkage=1 (global)
+ [22] var 'ticket' type=8 linkage=1 (global)
+
+ Note that the order of the variables is not guaranteed, so we do not check
+ particular variables have exactly the right typedef. Instead, we check:
+ 1. 7 typedef records are generated, along with the correct strings for them.
+ 2. There is one variable pointing to each typedef. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x8000000\[\t \]+\[^\n\]*btt_info" 7 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"my_int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo_int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"bar_int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"CBAR.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"CBARP.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"node_t.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"arena_t.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*btv_type" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*btv_type" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*btv_type" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*btv_type" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x8\[\t \]+\[^\n\]*btv_type" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xb\[\t \]+\[^\n\]*btv_type" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*btv_type" 1 } } */
+
+typedef int my_int;
+typedef int foo_int;
+typedef int bar_int;
+
+typedef const bar_int CBAR;
+typedef const bar_int * CBARP;
+
+typedef struct _node
+{
+ foo_int name_off;
+ bar_int info;
+ struct _node * next;
+} node_t;
+
+
+typedef struct _arena
+{
+ node_t nodes[16];
+ my_int vardata;
+ bar_int flags;
+} arena_t;
+
+my_int a;
+foo_int b;
+bar_int c;
+node_t d;
+
+CBAR destination;
+CBARP ticket = &destination;
+
+arena_t suitcase;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c
new file mode 100644
index 0000000..d668437
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c
@@ -0,0 +1,16 @@
+/* Test BTF generation for union type. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* One union type with 4 members */
+/* { dg-final { scan-assembler-times "\[\t \]0x5000004\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "btm_name" 4 } } */
+
+union onion
+{
+ int redness;
+ char *name;
+ unsigned short freshness;
+ unsigned short flavor;
+} my_onion;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c
new file mode 100644
index 0000000..a79ed1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c
@@ -0,0 +1,33 @@
+/* BTF generation for variables. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* We expect 6 variables */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 6 } } */
+
+unsigned int x1;
+
+struct st
+{
+ int a;
+ int b;
+};
+
+union {
+ long int value;
+ struct st * pointer;
+} bar;
+
+enum
+{
+ FOO = 0,
+ BAR = 2,
+ BAZ,
+} lala;
+
+int arr[10][20];
+
+unsigned long * plong;
+
+struct st st_inst;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c
new file mode 100644
index 0000000..db0bdd7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c
@@ -0,0 +1,27 @@
+/* BTF generation for variables with removed type.
+
+ BTF does not support floating point types, so no representation for the type
+ 'float' will be emitted. In this test, we check to also ensure that the
+ variable 'bar' is not emitted, as it references a type that is not supported
+ in BTF. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* We expect only 3 variables. */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 3 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"baz.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"myst.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+
+int foo;
+float __attribute__((__vector_size__(16))) bar;
+int baz[10];
+
+struct st
+{
+ int a;
+ int b : 6;
+ int c : 2;
+} myst;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-3.c b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-3.c
new file mode 100644
index 0000000..8cae221
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-3.c
@@ -0,0 +1,36 @@
+/* Test BTF generation for static versus global variables.
+
+ BTF_KIND_VAR types represeting variables are followed by a 32-bit
+ "linkage", which can take one of currently two valid values:
+ 0 = static
+ 1 = global
+
+ In this test, make a few static and a few global variables, and ensure
+ they are noted with the correct "linkage" values. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* Expect 6 variables. */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 6 } } */
+
+/* 3 global, 3 static. */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btv_linkage" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btv_linkage" 3 } } */
+
+int a;
+
+static long b;
+
+struct foo {
+ int x;
+ int y;
+};
+
+struct foo g_foo;
+
+static struct foo s_foo;
+
+static unsigned int s_arr [10][5];
+
+unsigned int g_arr [20];
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf.exp b/gcc/testsuite/gcc.dg/debug/btf/btf.exp
new file mode 100644
index 0000000..15593fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf.exp
@@ -0,0 +1,48 @@
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Disable on ptx (in sync with DWARF testsuite)
+if { [istarget nvptx-*-*] } {
+ return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+set comp_output [gcc_target_compile \
+ "$srcdir/$subdir/../trivial.c" "trivial.S" assembly \
+ "additional_flags=-gbtf"]
+if { ! [string match "*: target system does not support the * debug format*" \
+ $comp_output] } {
+ remove-build-file "trivial.S"
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\] ]] \
+ "" $DEFAULT_CFLAGS
+}
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c
new file mode 100644
index 0000000..6f637df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-gctf" } */
+
+void func(void)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c
new file mode 100644
index 0000000..ccbb109
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c
@@ -0,0 +1,10 @@
+/* A LEVEL of 0 with -gctf turns off CTF debug info generation. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf0 -dA" } */
+
+/* { dg-final { scan-assembler-times "0xdff2.*CTF preamble magic number" 0} } */
+/* { dg-final { scan-assembler-times "0x4.*CTF preamble version" 0 } } */
+/* { dg-final { scan-assembler-times "0.*CTF preamble flags" 0 } } */
+
+const char * _CONTEXT_NAME = "foobar";
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c
new file mode 100644
index 0000000..93547d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c
@@ -0,0 +1,23 @@
+/* Test compilation and CTF generation of anonymous structs. An anonymous
+ struct type is encoded as no-name CTF struct type.
+
+ For this testcase, a single CTF anonymous struct is expected.
+ struct {} : ctt_name = 0 (point to offset 0 in the CTF string table to
+ denote empty string)
+
+ Two CTF struct records should be generated in total.
+ struct a : ctt_info = 0x1a000002 (2 fields)
+ struct {} : ctt_info = 0x1a000001 (1 field) */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 1 } } */
+/* { dg-final { scan-assembler-times "0x1a000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+struct a
+{
+ struct { int b1; } a1;
+ int a2;
+} my_a;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c
new file mode 100644
index 0000000..f45af9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c
@@ -0,0 +1,26 @@
+/* Test compilation and CTF generation of anonymous union. An anonymous union
+ is encoded as no-name CTF union type.
+
+ For this testcase, a single CTF anonymous union is expected.
+ struct {} : ctt_name = 0 (point to offset 0 in the CTF string table to
+ denote empty string)
+
+ Two CTF struct records should be generated in total.
+ struct anon_union : ctt_info = 0x1a000001 (1 field)
+ union {} : ctt_info = 0x1e000002 (2 fields) */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 1 } } */
+/* { dg-final { scan-assembler-times "0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "0x1e000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+struct anon_union
+{
+ union
+ {
+ char name;
+ int value;
+ };
+} my_anon_u;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c
new file mode 100644
index 0000000..006a758
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c
@@ -0,0 +1,31 @@
+/* CTF generation for array type.
+
+ Unsized arrays are encoded with a 0 for the number of elements.
+
+ In this testcase, 5 distinct CTF records for arrays are expected
+ b1 : cta_nelems = 2
+ c1 : cta_nelems = 3
+ a1 : cta_nelems = 2, 5
+ buf : cta_nelems = 0. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 5 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cta_nelems" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+
+int b1[2] = {0,1};
+int c1[5] = {0,1,2,3,4};
+int a1[2][3] = { {3,4,5}, {2,3,4} };
+
+/* Variable length struct using arrays. */
+struct my_array
+{
+ int flags;
+ int length;
+ int buf[];
+} my_array_obj;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c
new file mode 100644
index 0000000..2a19da0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c
@@ -0,0 +1,38 @@
+/* CTF generation for unsized arrays.
+
+ Unsized arrays are encoded with a 0 for the number of elements. The type
+ of array index is the INT type.
+
+ TBD_CTF_FORMAT_OPEN_ISSUES (1) -
+ This testcase makes a note of the case of a probable misrepresentation.
+ See Note 1 and Note 2 below.
+
+ In the CTF section, these types are encoded as :
+
+ Variables:
+ _CTF_NEWSTR -> 7: const char [0] (size 0x0)
+ _CTF_SECTION -> 6: const char [5] (size 0x5)
+ b1 -> 2: int [0] (size 0x0)
+ b2 -> 3: int [0] (size 0x0)
+
+ Note 1 : There is misrepresentation in that b1 and b2 are specified
+ differently by the user.
+ Note 2 : It is arguable though whether the representation for
+ _CTF_NEWSTR is incorrect. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 5 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+
+static int b1[] = {};
+
+int b2[0];
+
+const char _CTF_SECTION[] = ".ctf";
+
+extern const char _CTF_NEWSTR[];
+const char _CTF_NEWSTR[] = "ctfinfo";
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c
new file mode 100644
index 0000000..8def208
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c
@@ -0,0 +1,17 @@
+/* CTF generation for variable length arrays.
+
+ In this testcase, a specific flavor of vla appears in the function
+ signature.
+
+ TBD_CTF_FORMAT_OPEN_ISSUES (1) -
+ This testcase makes a note of another case of a probable misrepresentation.
+ See ctf-array-2.c for some context on how vla's are a case of a probable
+ misrepresentation in CTF. Nevertheless, compilation should not fail. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf" } */
+
+int foo (int a, int b[a][a])
+{
+ return b[a-1][a-3];
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c
new file mode 100644
index 0000000..013a8ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c
@@ -0,0 +1,13 @@
+/* CTF generation for array type.
+
+ Test CTF generation for single element arrays. In this testcase, one CTF
+ record for array is expected with cta_nelems = 1. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+
+int b[1];
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c
new file mode 100644
index 0000000..c4801a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c
@@ -0,0 +1,23 @@
+/* Test CTF generation works well with ((mode)) attribute.
+
+ In this testcase, CTF should report type of bqi to be an enum and
+ not an int. Also, CTF for typedef of enum should exist. However, there
+ are no direct and portable methods of checking that a CTF type / CTF
+ variable refers to a specific CTF type, so this testcase merely asserts
+ for existence of individual CTF records. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"B1.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"B2.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"B3.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "cte_value" 3} } */
+
+/* There are no better/direct methods to assert that the CTF for typedef of
+ enum has been added. */
+/* { dg-final { scan-assembler-times "\[\t \]0x22000003\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+typedef enum { B1 = 1, B2 = 2, B3 = 3 } B;
+B __attribute__ ((mode (QI))) bqi;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c
new file mode 100644
index 0000000..61f6b64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c
@@ -0,0 +1,22 @@
+/* Test CTF generation works well with ((used)) function attribute.
+
+ This attribute, attached to a function, means that code must be emitted for
+ the function even if it appears that the function is not referenced. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O2 -gctf -dA" } */
+
+/* These should be true for higher optimization levels. */
+/* { dg-final { scan-assembler-times "ascii \"keep_this.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"lose_this.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
+
+static int lose_this(int a)
+{
+ return a + 2;
+}
+
+__attribute__((used))
+static int keep_this(double a)
+{
+ return a * 2;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c
new file mode 100644
index 0000000..1deac90
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c
@@ -0,0 +1,30 @@
+/* CTF generation for bitfields.
+
+ In this testcase, two slices are expected - one for enum and the other for
+ int. CTF slices are unnamed records. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_bits" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*cts_bits" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 2 } } */
+
+enum color
+{
+ RED,
+ GREEN,
+ BLUE,
+ YELLOW,
+ ORANGE,
+ BLACK
+};
+
+struct quickcolor
+{
+ enum color col:3;
+ int brushid:2;
+ int strokes;
+};
+
+struct quickcolor qc;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c
new file mode 100644
index 0000000..aea0921
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c
@@ -0,0 +1,39 @@
+/* The bitfield type (int) may be shared, but slices are not de-duplicated.
+
+ In this testcase, it is expected to see a total of 6 CTF slices and 2 CTF
+ integer types for the bitfields - unsigned long long and signed long long.
+
+ cts_offset is the offset of the bitfield into a machine word.
+ TBD - hardcoding cts_offset checks into the testcase will cause it to break
+ across targets with different BIT_PER_WORD. Is there a way to add
+ cts_offset related checks in the testcase? */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*cts_type" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 3 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*cts_bits" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x21\[\t \]+\[^\n\]*cts_bits" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x10\[\t \]+\[^\n\]*cts_bits" 2 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"long long unsigned int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+struct fields
+{
+ unsigned long long u1 : 15;
+ unsigned long long u2 : 33;
+ unsigned long long u3 : 16;
+ signed long long s1 : 15;
+ signed long long s2 : 33;
+ signed long long s3 : 16;
+} flags;
+
+int i = 33;
+
+int main ()
+{
+ return flags.u1 + i;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c
new file mode 100644
index 0000000..8fbcf12
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c
@@ -0,0 +1,16 @@
+/* The bool bitfield type. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*cts_bits" 2 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"_Bool.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+#include <stdbool.h>
+
+struct open_file {
+ bool mmapped:1;
+ bool released:1;
+} of;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c
new file mode 100644
index 0000000..012069a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c
@@ -0,0 +1,19 @@
+/* The zero sized bitfield.
+
+ In this testcase, two slices are expected. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 2 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cts_bits" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xa\[\t \]+\[^\n\]*cts_bits" 1 } } */
+
+/* { dg-final { scan-assembler-times "ctm_name" 2 } } */
+struct foo
+{
+ int a:5;
+ unsigned:0;
+ int b:10;
+} foome;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c
new file mode 100644
index 0000000..a36dd9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c
@@ -0,0 +1,21 @@
+/* Tests for CTF complex base types.
+
+ CTF does not have representation for complex integer types.
+
+ This testcase has a mix of C constructs containing COMPLEX_TYPE. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-require-effective-target libc_has_complex_functions } */
+
+/* { dg-final { scan-assembler-times "ascii \"complex double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"complex long double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"complex float.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+#include <complex.h>
+
+double complex z1 = I * I;
+
+const long double complex z2 = I * I;
+
+float complex z4 = 1+2.11*I;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c
new file mode 100644
index 0000000..0137e9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c
@@ -0,0 +1,66 @@
+/* Test compilation of stubs with various qualifiers - const, restrict and
+ volatile.
+
+ Testcase includes a std header to allow testing of shared types across
+ files. Only one CTF record for int is expected.
+
+ CTF records for CVR qualifiers are no-name records. In this testcase, there
+ are 5 qualifiers across constructs. 2 more no-name CTF records correspond to
+ CTF pointer records.
+
+ TYPEID: name string (size) -> ref TYPEID : ref name string (size) -> ...
+
+ Types:
+ 1: long int (size 0x8)
+ 2: long unsigned int (size 0x8)
+ 3: size_t (size 0x8) -> 2: long unsigned int (size 0x8)
+ 4: int (size 0x4)
+ 5: const int (size 0x4) -> 4: int (size 0x4)
+ 6: volatile const int (size 0x4) -> 5: const int (size 0x4) -> 4: int (size 0x4)
+ 7: long long int (size 0x8)
+ 8: long double (size 0x10)
+ 9: int * (size 0x8) -> 4: int (size 0x4)
+ a: int *restrict (size 0x8) -> 9: int * (size 0x8) -> 4: int (size 0x4)
+ b: const int * (size 0x8) -> 5: const int (size 0x4) -> 4: int (size 0x4)
+ c: const int *restrict (size 0x8) -> b: const int * (size 0x8) -> 5: const int (size 0x4) -> 4: int (size 0x4)
+ d: INTP (size 0x8) -> 9: int * (size 0x8) -> 4: int (size 0x4)
+ e: const INTP (size 0x8) -> d: INTP (size 0x8) -> 9: int * (size 0x8) -> 4: int (size 0x4)
+ f: void (size 0x0)
+ 10: void (*) (size_t, int *restrict, const int *restrict) (size 0x0)
+ */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-options "-O0 -gctf -gdwarf-4 -dA" { target { *-*-darwin* } } } */
+
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 7 } } */
+
+/* type id 9, b have POINTER type. */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+/* type id 5, e have CONST qualifier. */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+/* type id a, c have RESTRICT qualifier. */
+/* { dg-final { scan-assembler-times "\[\t \]0x36000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+/* type id 6 has VOLATILE qualifier. */
+/* { dg-final { scan-assembler-times "\[\t \]0x2e000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+#include "stddef.h"
+
+const volatile int a = 5;
+int *restrict b;
+
+const int * i;
+int const * j;
+
+typedef int * INTP;
+const INTP int_p;
+
+void foo (size_t n, int *restrict p, const int *restrict q)
+{
+ while (n-- > 0)
+ *p++ = *q++;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c
new file mode 100644
index 0000000..4f328f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c
@@ -0,0 +1,30 @@
+/* Test compilation of stubs with various expressions involving const
+ qualifier.
+
+ In this testcase, a single CTF record for const int is expected. A total of
+ two const qualifier CTF records are expected (const int and const struct
+ s1). */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+struct mystruct
+{
+ struct
+ {
+ int a;
+ const int b;
+ } s1;
+ char * name;
+} my_a;
+
+struct s1
+{
+ int i;
+ const int ci;
+} s;
+
+const struct s1 cs;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c
new file mode 100644
index 0000000..97317a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c
@@ -0,0 +1,25 @@
+/* Test compilation of stubs with various expressions involving const and
+ volatile qualifiers.
+
+ In this testcase, it is expected to have const and volatile CTF
+ records. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"unsigned char.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x2e000000\[\t \]+\[^\n\]*ctt_info" 5 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 3 } } */
+/* Two arrays. */
+/* { dg-final { scan-assembler-times "\[\t \]0x12000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+
+const volatile unsigned char vicar = 11;
+
+const volatile unsigned char * vicarage = &vicar;
+
+volatile float vilify[2];
+
+const volatile char victor = 'Y';
+
+const volatile char vindictive[2];
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c
new file mode 100644
index 0000000..c1633ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c
@@ -0,0 +1,23 @@
+/* Test compilation of stubs with various qualifiers - const, restrict and
+ volatile.
+
+ CTF records for CVR qualifiers are no-name records. In this testcase, there
+ is 1 const qualifier. 1 more no-name CTF record corresponds to the CTF
+ pointer record. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+typedef const struct howto_struct howto_type;
+
+typedef struct entry
+{
+ int addend;
+ howto_type *howto;
+} how_ent;
+
+how_ent hent;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-1.c
new file mode 100644
index 0000000..1ad5f25
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-1.c
@@ -0,0 +1,7 @@
+/* Verify that CTF debug info can co-exist with dwarf. */
+/* { dg-do compile } */
+/* { dg-options "-gctf -gdwarf -dA" } */
+/* { dg-final { scan-assembler "0xdff2.*CTF preamble magic number" } } */
+
+void func (void)
+{ }
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-2.c
new file mode 100644
index 0000000..df2c1eb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-2.c
@@ -0,0 +1,7 @@
+/* Verify that CTF debug info can co-exist with dwarf. */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -gctf -dA" } */
+/* { dg-final { scan-assembler "0xdff2.*CTF preamble magic number" } } */
+
+void func (void)
+{ }
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c
new file mode 100644
index 0000000..9693544
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c
@@ -0,0 +1,21 @@
+/* CTF generation for enums. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"RED.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"GREEN.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"BLUE.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"YELLOW.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "cte_value" 4} } */
+
+
+enum foo_color
+{
+ RED,
+ GREEN,
+ BLUE,
+ YELLOW
+};
+
+enum foo_color my_color;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c
new file mode 100644
index 0000000..fd8aaec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c
@@ -0,0 +1,27 @@
+/* CTF generation for enums.
+
+ CTF represents enum values with an int32_t. For enum values not
+ representable with int32_t data type, the compiler skips adding CTF for
+ them. This will be fixed soon in the CTF format.
+ TBD_CTF_REPRESENTATION_LIMIT.
+
+ In this testcase, CTF for enumerator GFS_MONOTONIC will not be generated. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"GFS_MONOTONIC.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
+/* { dg-final { scan-assembler-times "ascii \"GFS_RUNTIME.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"GFS_STATIC.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "cte_value" 2} } */
+
+
+enum gomp_schedule_type
+{
+ GFS_RUNTIME,
+ GFS_STATIC,
+ GFS_MONOTONIC = 0x80000000U
+};
+
+enum gomp_schedule_type gsch_type;
+
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c
new file mode 100644
index 0000000..a683113
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c
@@ -0,0 +1,25 @@
+/* CTF is not generated for entities not at file-scope. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"SFOO.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
+/* { dg-final { scan-assembler-times "ascii \"gfoo.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+int foo (int n)
+{
+ typedef struct { int a[n]; } SFOO;
+
+ SFOO a;
+ __attribute__ ((noinline)) SFOO gfoo (void) { return a; }
+
+ a.a[0] = 1;
+ a.a[9] = 2;
+
+ SFOO b;
+ b = gfoo ();
+
+ return b.a[0] == 1 && b.a[9] == 2;
+}
+
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c
new file mode 100644
index 0000000..9e24b45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c
@@ -0,0 +1,16 @@
+/* Tests for CTF float base types.
+ - Verify that there is a single record for the base types. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "ascii \"float.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+float a;
+float b = 33;
+
+double c = 44;
+double d = 45;
+
+long double e;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c
new file mode 100644
index 0000000..fdec743
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c
@@ -0,0 +1,40 @@
+/* CTF forward type is generated for forward declarations of types in C.
+
+ Check that the ctf-kind of CTF_K_FOWARD type is CTF_K_STRUCT or CTF_K_UNION.
+ For forward types, the compiler encodes the CTF kind in the ctt_type field.
+ CTF_K_FORWARD is used as the CTF type as usual in the ctt_info. */
+
+/* Note - A value of 6 in "ctt_size or ctt_type" appears twice in this
+ testcase. This might be misconstrued as 2 CTK_K_FORWARD records of struct
+ type. The second assembler tag is due to a ref type in a CVR CTF record.
+ TBD - perhaps a more robust string pattern is needed. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x26000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*ctt_size or ctt_type" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x7\[\t \]+\[^\n\]*ctt_size or ctt_type" 2 } } */
+
+typedef struct __locale_struct
+{
+ struct __locale_data *__locales[13]; /* forward struct type. */
+
+ const int *__ctype_toupper;
+ const char *__names[13];
+} *__locale_t;
+
+typedef __locale_t locale_t;
+
+locale_t loc;
+
+typedef struct __inter_struct
+{
+ union __inter_data * __inters[13]; /* forward union type. */
+
+ const int * __ctype_kind;
+} * __inter_t;
+
+typedef __inter_t inter_t;
+
+inter_t inter;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c
new file mode 100644
index 0000000..a3154f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c
@@ -0,0 +1,16 @@
+/* CTF forward type is generated for forward declarations of enum types in C.
+
+ Check that the ctf-kind of CTF_K_FOWARD type is CTF_K_ENUM.
+ For forward types, the compiler encodes the CTF kind in the ctt_type field.
+ CTF_K_FORWARD is used as the CTF type as usual in the ctt_info. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x26000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x8\[\t \]+\[^\n\]*ctt_size or ctt_type" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"vibgyor.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+enum vibgyor;
+
+char * (*get_color_name) (enum vibgyor);
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c
new file mode 100644
index 0000000..86ca795
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c
@@ -0,0 +1,25 @@
+/* CTF function index sub-section.
+
+ A function index sub-section in the CTF section contains the offset to the
+ string name of the global function symbols. The number of entries in the
+ func info section and the func index section are always the same.
+
+ In this testcase, 2 records in the function index section are expected. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "funcinfo_name" 2 } } */
+/* { dg-final { scan-assembler-times "funcinfo_func_type" 2 } } */
+/* { dg-final { scan-assembler-times "ascii \"bar.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+int foo (void)
+{
+ return 0;
+}
+
+int bar (int a)
+{
+ return 33 + a;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c
new file mode 100644
index 0000000..cc1a600a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c
@@ -0,0 +1,24 @@
+/* CTF generation of function pointers. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000003\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"__foo_fn.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"destroy.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"func.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+int (*func) (int *, char);
+
+typedef int (*__foo_fn) (void *__cookie, char *__buf, int __nbytes);
+
+typedef struct object
+{
+ int myint;
+ char mychar;
+ void (*destroy)(struct object *);
+} object_t;
+
+object_t myobj;
+__foo_fn fooit;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c
new file mode 100644
index 0000000..a4a1104
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c
@@ -0,0 +1,22 @@
+/* CTF generation of function pointers.
+
+ In this testcase, there is a single function type expected for two
+ different function pointer types. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"rcu_callback_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"func.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+struct callback_head {
+ struct callback_head *next;
+ void (*func) (struct callback_head *head);
+} __attribute__ (( aligned (sizeof (void *))));
+#define rcu_head callback_head
+
+struct callback_head chead;
+
+typedef void (*rcu_callback_t) (struct rcu_head *head);
+
+rcu_callback_t rcb;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c
new file mode 100644
index 0000000..fe35d6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c
@@ -0,0 +1,21 @@
+/* CTF generation of function pointers.
+
+ In this testcase, there is a single function type expected. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo_init_callback.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"fn.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+struct foo;
+
+typedef void (* foo_init_callback) (struct foo *f1);
+
+struct foo
+{
+ /* Function to call to initialize. */
+ foo_init_callback fn;
+};
+
+struct foo f;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c
new file mode 100644
index 0000000..b8a7417
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c
@@ -0,0 +1,18 @@
+/* CTF generation of function pointers.
+
+ In this testcase, Type de-duplication of function type is exercised. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"var_assign_func_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+struct variable;
+
+typedef struct variable *var_assign_func_t (struct variable *);
+
+typedef struct variable {
+ var_assign_func_t *assign_func;
+} shell_var_t;
+
+shell_var_t a;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c
new file mode 100644
index 0000000..0b086a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c
@@ -0,0 +1,34 @@
+/* CTF generation for functions with varargs or otherwise.
+
+ In this testcase, it is expected to see one CTF_K_FUNCTION record with two
+ function arguments. The second function argument with a value of 0
+ corresponds to the ellipsis.
+
+ Example CTF section excerpt on x86_64 :
+
+ .long 0x5 # ctt_name (name = format)
+ .long 0x16000002 # ctt_info (CTF_K_FUNCTION with 2 arguments)
+ .long 0x2 # ctt_size or ctt_type (return typeID)
+ .long 0x2 # dtu_argv (TypeID of the First argument)
+ .long 0 # dtu_argv (TypeID of the second argument)
+ .ascii "\0" # ctf_string
+ .ascii "int\0" # ctf_string
+ .ascii "format\0" # ctf_string
+
+ */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x16000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "dtu_argv" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*dtu_argv" 1 } } */
+
+int foo (void);
+
+int bar (int);
+
+int * format (int * fmt, ...)
+{
+ return fmt;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c
new file mode 100644
index 0000000..8c68b2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c
@@ -0,0 +1,17 @@
+/* Tests for CTF integer base types.
+ - Verify that there is a single record for the base types. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"short int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+int a;
+int b = 33;
+
+short int c = 44;
+short int d = 45;
+
+long int e = 90;
+long int f;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c
new file mode 100644
index 0000000..ee3481a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c
@@ -0,0 +1,30 @@
+/* CTF objext index sub-section.
+
+ An object index sub-section in the CTF section contains the offset to the
+ string name of the global object symbols. The number of entries in the
+ obj info section and objt index section are always the same.
+
+ In this testcase, 4 records in the object index section are expected. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "objtinfo_name" 4 } } */
+/* { dg-final { scan-assembler-times "objtinfo_var_type" 4 } } */
+/* { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"b.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"a1.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"d_instance.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+static int b = 33;
+
+int a = 44;
+int a1[2] = {22, 33};
+
+struct d
+{
+ int d1;
+ int d2;
+};
+
+struct d d_instance;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c
new file mode 100644
index 0000000..e1fccec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c
@@ -0,0 +1,26 @@
+/* CTF generation for pointer types.
+
+ In this testcase, two CTF pointer type records are expected
+ - int *
+ - struct foo_struct *
+ */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"foo_struct.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+int b = 44;
+int * a = &b;
+
+struct foo_struct
+{
+ int bar_mem_1;
+ int bar_mem_2;
+ float d;
+ struct foo_struct *next;
+};
+
+struct foo_struct * node;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c
new file mode 100644
index 0000000..e36e5ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c
@@ -0,0 +1,25 @@
+/* CTF generation for pointer types.
+
+ In this testcase, de-duplication of pointer types is exercised. The
+ compostition of structs in this testcase is such that when adding CTF for
+ pointer type (link), the pointed-to-type type already adds the pointer to
+ struct link.
+
+ In this testcase, one CTF pointer type record is expected. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+struct link;
+
+typedef struct items {
+ struct link * link;
+ int str;
+} itemslist;
+
+itemslist il;
+
+struct link { struct link * next; };
+
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c
new file mode 100644
index 0000000..28547fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c
@@ -0,0 +1,11 @@
+/* Verify the CTF preamble in the CTF section. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler "0xdff2.*CTF preamble magic number" } } */
+/* { dg-final { scan-assembler "0x4.*CTF preamble version" } } */
+/* { dg-final { scan-assembler "0.*CTF preamble flags" } } */
+
+void func (void)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c
new file mode 100644
index 0000000..0c51839
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c
@@ -0,0 +1,38 @@
+/* CTF does not have representation for some types at this time. These types
+ are skipped in the CTF generation phase in the compiler.
+
+ An explicit CTF type with kind CTF_K_UNKNOWN is created for types that do
+ not have representation in CTF. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"unknown.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+/* { dg-require-effective-target libc_has_complex_functions } */
+
+#include <complex.h>
+
+typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16)));
+La_x86_64_xmm a1;
+
+/* GCC also supports complex integer data types. */
+complex char a;
+complex signed char b;
+complex unsigned char c;
+complex short int d;
+complex short unsigned int e;
+complex int f;
+complex unsigned int g;
+complex long int h;
+complex long unsigned int i;
+complex long long int j;
+
+enum gomp_schedule_type
+{
+ GFS_RUNTIME,
+ GFS_STATIC,
+ GFS_MONOTONIC = 0x80000000U
+};
+
+enum gomp_schedule_type gsch_type;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c
new file mode 100644
index 0000000..79d5cb2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c
@@ -0,0 +1,18 @@
+/* CTF does not have representation for some types at this time. These types
+ are skipped in the CTF generation phase in the compiler.
+
+ Skip IEEE interchange and extended formats for CTF generation.
+
+ In this testcase, CTF records for types are not added as CTF has no
+ representation for IEEE interchange and extended formats.
+
+ CTF records for variables do exist, however. The referenced type is
+ CTF_TYPE_NULLID. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf" } */
+
+/* { dg-require-effective-target float16 } */
+/* { dg-add-options float16 } */
+
+_Float16 f16;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c
new file mode 100644
index 0000000..394fa2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c
@@ -0,0 +1,20 @@
+/* CTF does not have representation for some types at this time. These types
+ are skipped in the CTF generation phase in the compiler.
+
+ Skip IEEE interchange and extended formats for CTF generation.
+
+ In this testcase, CTF records for types are not added as CTF has no
+ representation for IEEE interchange and extended formats.
+
+ CTF records for variables and pointer do exist, however. The referenced
+ type is CTF_TYPE_NULLID. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf" } */
+
+/* { dg-require-effective-target float32 } */
+/* { dg-require-effective-target float32x } */
+
+_Float32 f32;
+_Float32x f32x;
+_Float32 * f32p;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c
new file mode 100644
index 0000000..7033121
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c
@@ -0,0 +1,21 @@
+/* CTF does not have representation for some types at this time. These types
+ are skipped in the CTF generation phase in the compiler.
+
+ Skip IEEE interchange and extended formats for CTF generation.
+
+ In this testcase, CTF records for types are not added as CTF has no
+ representation for IEEE interchange and extended formats.
+
+ CTF records for variables and pointer do exist, however. The referenced
+ type is CTF_TYPE_NULLID. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf" } */
+
+/* { dg-require-effective-target float64 } */
+/* { dg-require-effective-target float64x } */
+/* { dg-add-options float64 } */
+/* { dg-add-options float64x } */
+
+_Float64 f64;
+_Float64x f64x;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c
new file mode 100644
index 0000000..026f9e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c
@@ -0,0 +1,19 @@
+/* CTF does not have representation for some types at this time. These types
+ are skipped in the CTF generation phase in the compiler.
+
+ Skip IEEE interchange and extended formats for CTF generation.
+
+ In this testcase, CTF records for types are not added as CTF has no
+ representation for IEEE interchange and extended formats.
+
+ CTF records for variables and pointer do exist, however. The referenced
+ type is CTF_TYPE_NULLID. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf" } */
+
+/* { dg-require-effective-target float128 } */
+/* { dg-require-effective-target float128x } */
+
+_Float128 f128;
+_Float128x f128x;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c
new file mode 100644
index 0000000..f2dbe08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c
@@ -0,0 +1,18 @@
+/* CTF does not have representation for some types at this time. These types
+ are skipped in the CTF generation phase in the compiler.
+
+ Skip Decimal Floating Point format types for CTF generation.
+
+ In this testcase, CTF records for types are not added as CTF has no
+ representation for Decimal floating point format.
+
+ CTF records for variables do exist, however. The referenced type is
+ CTF_TYPE_NULLID. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf" } */
+/* { dg-require-effective-target dfp } */
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c
new file mode 100644
index 0000000..a9d86de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c
@@ -0,0 +1,18 @@
+/* CTF does not have representation for some types at this time. These types
+ are skipped in the CTF generation phase in the compiler.
+
+ Skip IEEE interchange and extended formats for CTF generation.
+
+ In this testcase, CTF records for types are not added as CTF has no
+ representation for IEEE interchange and extended formats. This testcase
+ checks that CTF generation skips the 128-bit float gracefully, when code
+ generation is for a 32-bit environment. */
+
+/* { dg-do compile } */
+/* { dg-options "-gctf -m32" } */
+
+/* { dg-require-effective-target float128 } */
+/* { dg-require-effective-target float128x } */
+
+_Float128 f128;
+_Float128x f128x;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-8.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-8.c
new file mode 100644
index 0000000..2413e91
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-8.c
@@ -0,0 +1,27 @@
+/* CTF does not have representation for _Atomic qualifier. This qualifier is
+ skipped in the CTF generation phase in the compiler.
+
+ In this testcase, CTF records for the _Atomic qualifier are not added as
+ CTF has no representation for it. CTF records for the underlying type are,
+ however, added. So, CTF records for typedef, const and the underlying
+ struct are expected. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x1a000003\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ctm_name" 3 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"comp_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"comp_type_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"c1.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+typedef struct comp_type
+{
+ int a;
+ float b;
+ char c;
+} comp_type_t;
+
+_Atomic const comp_type_t c1;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c
new file mode 100644
index 0000000..0a0f1f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c
@@ -0,0 +1,26 @@
+/* CTF String Table as generated by the compiler is expected to have only a
+ single empty string. Just an optimization by the compiler, it is not
+ mandated by the CTF format. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "ascii \".0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+union wait
+{
+ int w_status;
+ struct
+ {
+ int __w_termsig;
+ int __w_coredump;
+ } __wait_terminated;
+ struct
+ {
+ int __w_stopval;
+ int __w_stopsig;
+ } __wait_stopped;
+};
+
+typedef union { union wait * __uptr; int * iptr; } __WAIT_STATUS;
+
+__WAIT_STATUS waitstatus;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c
new file mode 100644
index 0000000..19711c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c
@@ -0,0 +1,25 @@
+/* Test compilation of struct type.
+
+ In this testcase, two CTF_K_STRUCT records are expected
+ struct a : ctt_info = 0x1a000004 (4 field members)
+ struct b : ctt_into = 0x1a000002 (2 field members)
+*/
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x1a000004\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x1a000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ctm_name" 6 } } */
+
+struct a
+{
+ int d1;
+ int d2;
+ float c;
+ struct b
+ {
+ int time;
+ int wall;
+ } b1;
+} my_a;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c
new file mode 100644
index 0000000..09b4d2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c
@@ -0,0 +1,32 @@
+/* Test for compilation of self-referntial structs.
+
+ Further, the compiler is expected to generate a single CTF struct type for
+ struct dmx_dtdef (due to Type de-duplication at CTF generation). */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "ascii \"dmx_dtdef.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"dtd_name.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"dtd_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"dmx_dtdef_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+struct link
+{
+ struct link * next;
+} * s_link;
+
+typedef long dmx_id_t;
+
+typedef struct dmx_dtdef
+{
+ char * dtd_name;
+ dmx_id_t dtd_type;
+} dmx_dtdef_t;
+
+typedef struct dmx_bundle
+{
+ dmx_id_t dmb_type;
+ dmx_dtdef_t * dmb_dtd;
+} dmx_bundle_t;
+
+dmx_bundle_t dbt;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c
new file mode 100644
index 0000000..d6c6b6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c
@@ -0,0 +1,65 @@
+/* Test Compilation of mixed constructs containing structs and arrays.
+
+ Further, the compiler is expected to generate a single CTF struct type for
+ struct cmodel (due to Type de-duplication at the time of CTF generation).
+
+ const qualifier in fields of structs should be processed. It appears as a
+ no-name CTF record with appropriate ctt_info. In this testcase, there are
+ two const qualifiers - const char and const struct cmodel. However, due to
+ way the debug information is represented in DWARF die, 3 const qualifier
+ records appear in the CTF section.
+
+ <1><e1>: Abbrev Number: 14 (DW_TAG_typedef)
+ <e2> DW_AT_name : (indirect string, offset: 0x114): cmodel_t
+ <e9> DW_AT_type : <0x9a>
+ <1><ed>: Abbrev Number: 13 (DW_TAG_const_type)
+ <ee> DW_AT_type : <0xe1>
+ <1><f2>: Abbrev Number: 4 (DW_TAG_array_type)
+ <f3> DW_AT_type : <0xed>
+ <f7> DW_AT_sibling : <0x102>
+
+ <2><101>: Abbrev Number: 0
+ <1><102>: Abbrev Number: 13 (DW_TAG_const_type)
+ <103> DW_AT_type : <0xf2>
+ <1><107>: Abbrev Number: 15 (DW_TAG_variable)
+ <108> DW_AT_name : (indirect string, offset: 0x57): _models
+ <10f> DW_AT_type : <0x102>
+ <1><11d>: Abbrev Number: 0
+
+ This results in:
+
+ _models -> e: const const cmodel_t [3] (size 0x30) -> d: const cmodel_t [3] (size 0x30)
+
+ Deemed as acceptable for now. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"cmodel.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"cname.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"cpointer.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"cmodel_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+/* 3 const records are expected. */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 3 } } */
+
+struct a
+{
+ int a1[2];
+ struct { int b[3]; } a2;
+};
+
+struct a my_a;
+
+typedef struct cmodel
+{
+ const char *cname;
+ int ccode;
+ int cpointer;
+} cmodel_t;
+
+static const cmodel_t _models[] = {
+ {"ILP32", 0, 4},
+ {"LP64", 0, 8},
+ {"", 0, 0}
+};
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c
new file mode 100644
index 0000000..37094b5d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c
@@ -0,0 +1,15 @@
+/* CTF generation for struct type in presence of DWARF2.
+
+ In case of DWARF2, the data member location is an expression containing
+ the location. CTF generation feeds off DWARF dies; this testcase tests
+ that the location expr is handled. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA -gdwarf-2" } */
+
+/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctm_offset" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x20\[\t \]+\[^\n\]*ctm_offset" 1 } } */
+
+static struct ranges {int from, to;} lim_regs[] = {{ 16, 7}, { 16, 6}, { 20, 7},{ 20, 6}};
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c
new file mode 100644
index 0000000..22005ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* This tests the following scenario:
+
+ 1. struct foo;
+ 2. struct foo *a_foo;
+ 3. struct foo { int bar; };
+ 4. void baz (struct foo *f) { f->bar = 0; }
+
+ At 2. a forward for struct foo is generated and at 3. the struct
+ type is fully defined. When a pointer to foo is encountered at 4.,
+ an additional CTF type for the completed struct shall be emitted as
+ well. The linker will deduplicate both types. */
+
+struct foo;
+struct foo *a_foo;
+struct foo { int bar; };
+void baz (struct foo *f) { f->bar = 0; }
+
+/* { dg-final { scan-assembler-times "\[\t \]\"bar.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c
new file mode 100644
index 0000000..569e5e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* This tests the following scenario:
+
+ 1. struct foo;
+ 2. struct foo *a_foo;
+ 3. struct foo { int bar; };
+ 4. void baz (struct foo **f) { f->bar = 0; }
+
+ At 2. a forward for struct foo is generated and at 3. the struct
+ type is fully defined. When a pointer to a pointer to foo is
+ encountered at 4., an additional CTF type for the completed struct
+ shall be emitted as well. The linker will deduplicate both
+ types. */
+
+struct foo;
+struct foo *a_foo;
+struct foo { int bar; };
+void baz (struct foo **f) { (*f)->bar = 0; }
+
+/* { dg-final { scan-assembler-times "\[\t \]\"bar.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c
new file mode 100644
index 0000000..aa40ab0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c
@@ -0,0 +1,68 @@
+/* CTF_K_TYPEDEF record generation.
+
+ In this testcase, 7 typedef records are expected.
+
+ Further, the declared variables must be of type typedef
+
+ Variables:
+ a -> 2: my_int (size 0x4) -> 1: int (size 0x4)
+ b -> 3: bar_int (size 0x4) -> 1: int (size 0x4)
+ c -> 4: foo_int (size 0x4) -> 1: int (size 0x4)
+ d -> 7: my_array (size 0x8) -> 5: struct (size 0x8)
+ e -> 9: CINT (size 0x4) -> 8: const int (size 0x4) -> 1: int (size 0x4)
+ f -> c: CINTP (size 0x8) -> b: const int * (size 0x8) -> a: const int (size 0x4) -> 1: int (size 0x4)
+ g -> f: my_node_t (size 0x8) -> d: struct my_node (size 0x8)
+
+ There is no direct way to check that the variables are of type typedef.
+ So in this testcase, we simply check that:
+ 1. The typedef records are generated (Check for 7 specific ctt_info, and
+ check for the ascii strings for the typedef names).
+ 2. The ctv_typeidx are distinct (each pointing to a specfic unique type).
+ Note that if variables were not of type typedef, ctv_typeidx will not be
+ unique (type of a, b, c will all point to int); hence, the check.
+ */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 7 } } */
+/* { dg-final { scan-assembler-times "ascii \"my_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"bar_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"my_array.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"CINT.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"CINTP.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"my_node_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x9\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xa\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xc\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+
+typedef int my_int;
+typedef int bar_int;
+typedef int foo_int;
+
+typedef struct { int a[2]; } my_array;
+
+typedef const int CINT;
+typedef const int * CINTP;
+
+typedef struct my_node
+{
+ int flags;
+ char value;
+} my_node_t;
+
+my_int a;
+bar_int b;
+foo_int c;
+
+my_array d;
+CINT e = 3;
+CINTP f = &e;
+
+my_node_t g;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c
new file mode 100644
index 0000000..8c9d3bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c
@@ -0,0 +1,20 @@
+/* CTF_K_TYPEDEF record generation.
+
+ In this testcase, typedef of type void should be generated. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo_void_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"void.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+typedef void foo_void_type;
+
+struct bar
+{
+ int a;
+ foo_void_type *b;
+};
+
+struct bar c;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c
new file mode 100644
index 0000000..93d0845
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c
@@ -0,0 +1,24 @@
+/* Type de-duplication of CTF_K_TYPEDEF records.
+
+ In this testcase, a single CTF record for typedef is expected. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+typedef struct foo foo_type;
+
+struct bar
+{
+ struct foo * f1;
+ foo_type * f2;
+};
+
+struct testme {
+ struct bar * b1;
+};
+
+struct testme * t1;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c
new file mode 100644
index 0000000..19e8f49
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+typedef struct my_int
+{
+ int upper;
+ int lower;
+ struct bitmask
+ {
+ int flags;
+ } my_mask;
+} my_int_t;
+
+my_int_t mit;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c
new file mode 100644
index 0000000..deeb85a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c
@@ -0,0 +1,17 @@
+/* Test compilation of typedef composition in structs. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+typedef struct
+{
+ int day, month, year;
+} Date;
+
+typedef struct
+{
+ Date filedDate, fixedDate;
+ int severity;
+} BugRef;
+
+BugRef CR2112;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c
new file mode 100644
index 0000000..6d6918b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c
@@ -0,0 +1,32 @@
+/* Test CTF generation for a typedef instantiation with CVR quals.
+
+ Caveat: There is no direct way to test that the type of foo is
+ "const my_int_t" via scanning the assembly. This test instead
+ checks for the presence of some of the CTF constructs involved
+ individually. Specifically, it checks for CTF const record and
+ CTF typedef record.
+
+ Variables:
+ foo -> 4: const my_int_t (size 0x8) -> 3: my_int_t (size 0x8) -> 1: struct my_int (size 0x8)
+
+ Types:
+ 1: struct my_int (size 0x8)
+ 2: int (size 0x4)
+ 3: my_int_t (size 0x8) -> 1: struct my_int (size 0x8)
+ 4: const my_int_t (size 0x8) -> 3: my_int_t (size 0x8) -> 1: struct my_int (size 0x8)
+*/
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+typedef struct my_int
+{
+ int upper;
+ int lower;
+} my_int_t;
+
+const my_int_t foo = {10, 20};
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c
new file mode 100644
index 0000000..929d532
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c
@@ -0,0 +1,14 @@
+/* CTF generation for union type. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x1e000004\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ctm_name" 4 } } */
+
+union c
+{
+ int c1;
+ int c2;
+ int c3;
+ int c4;
+} my_u_c;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c
new file mode 100644
index 0000000..8c3ab10
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c
@@ -0,0 +1,25 @@
+/* CTF generation for global variables.
+
+ In this testcase, 7 records in the variable info section are expected. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ctv_name" 7 } } */
+
+float var1;
+double var2;
+long double var3;
+
+char ascii = 'a';
+
+int a = 33;
+int a1[2] = {22, 33};
+
+struct d
+{
+ int d1;
+ int d2;
+};
+
+struct d d_instance;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c
new file mode 100644
index 0000000..75c3ed7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c
@@ -0,0 +1,16 @@
+/* CTF generation for static variables inside a function.
+
+ In this testcase, CTF record for bstatic is NOT expected. CTF generation
+ is only carried out for variables at file-scope or global-scope. */
+
+/* { dg-do compile ) */
+/* { dg-options "-O0 -gctf -dA" } */
+
+/* { dg-final { scan-assembler-times "ctv_name" 0 } } */
+/* { dg-final { scan-assembler-times "ascii \"bstatic.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
+
+int foo (int a)
+{
+ static int bstatic = 3;
+ return a + bstatic;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp b/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp
new file mode 100644
index 0000000..7ad6723
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp
@@ -0,0 +1,48 @@
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Disable on ptx (in sync with DWARF testsuite)
+if { [istarget nvptx-*-*] } {
+ return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+set comp_output [gcc_target_compile \
+ "$srcdir/$subdir/../trivial.c" "trivial.S" assembly \
+ "additional_flags=-gctf"]
+if { ! [string match "*: target system does not support the * debug format*" \
+ $comp_output] } {
+ remove-build-file "trivial.S"
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\] ]] \
+ "" $DEFAULT_CFLAGS
+}
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
index bd34f0d..3b50e9f 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
@@ -9,7 +9,7 @@
/* We do not know which is output first so look for both invalid abstract
origins on the lexical blocks (knowing that the abstract instance has
no attribute following the DW_TAG_lexical_block. */
-/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +\[^(\].*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" { xfail { { *-*-aix* || *-*-solaris2.* } && { ! gas } } } } } */
+/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT.*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" { xfail { { *-*-aix* || *-*-solaris2.* } && { ! gas } } } } } */
/* { dg-final { scan-assembler-not "DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x(\[0-9a-f\]*)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT_abstract_origin.*\\(DIE \\(0x\\1\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT" } } */
int foo (int i)
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c
new file mode 100644
index 0000000..17f6463
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c
@@ -0,0 +1,20 @@
+/* PR debug/100515 */
+/* { dg-do compile } */
+/* { dg-require-effective-target fopenmp } */
+/* { dg-options "-g -O2 -fopenmp" } */
+
+void
+foo (int x)
+{
+#pragma omp taskloop
+ for (int i = 0; i < x; i++)
+ ;
+}
+
+void
+bar (int x)
+{
+#pragma omp taskloop
+ for (int i = 0; i < x; i++)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/pr57351.c b/gcc/testsuite/gcc.dg/debug/pr57351.c
index 972f3e9..236d74d 100644
--- a/gcc/testsuite/gcc.dg/debug/pr57351.c
+++ b/gcc/testsuite/gcc.dg/debug/pr57351.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_neon } */
+/* { dg-require-effective-target arm_arch_v7a_ok } */
/* { dg-options "-std=c99 -Os -g -march=armv7-a" } */
/* { dg-add-options arm_neon } */
diff --git a/gcc/testsuite/gcc.dg/diagnostic-input-charset-1.c b/gcc/testsuite/gcc.dg/diagnostic-input-charset-1.c
new file mode 100644
index 0000000..4e56833
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/diagnostic-input-charset-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-iconv "CP850" } */
+/* { dg-options "-finput-charset=CP850 -fdiagnostics-show-caret" } */
+
+/* Test that diagnostics are converted to UTF-8; this file is encoded in
+ CP850. Why CP850? -finput-charset only supports encodings that are a
+ superset of ASCII. But encodings that look like latin-1 are automatically
+ converted by expect to UTF-8, and hence by the time dg sees them, it can't
+ verify they were actually output in UTF-8. So codepage 850 was chosen as one
+ that is hopefully available and meets the requirements of matching ASCII and
+ not matching latin-1. */
+const char *section = ""
+/* { dg-error "expected .* at end of input" "" { target *-*-*} .-1 } */
+/* { dg-begin-multiline-output "" }
+ const char *section = "§"
+ ^~~~~
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/diagnostic-input-utf8-bom.c b/gcc/testsuite/gcc.dg/diagnostic-input-utf8-bom.c
new file mode 100644
index 0000000..1a3f352
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/diagnostic-input-utf8-bom.c
@@ -0,0 +1,14 @@
+int 1;
+/* { dg-do compile } */
+/* { dg-options "-fdiagnostics-show-caret" } */
+
+/* This file begins with a UTF-8 byte order mark. Verify that diagnostics
+ still point to the right place, since the stripping of the BOM happens twice,
+ once when libcpp reads the file, and once when diagnostics infrastucture
+ reads it. */
+
+/* { dg-error "expected .* before numeric constant" "" { target *-*-*} 1 } */
+/* { dg-begin-multiline-output "" }
+ int 1;
+ ^
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges-2.c b/gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges-2.c
index 302e233..1cbcad5 100644
--- a/gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges-2.c
+++ b/gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges-2.c
@@ -3,21 +3,25 @@
int test_uninit_1 (void)
{
- int result;
- return result; /* { dg-warning "uninitialized" } */
-/* { dg-begin-multiline-output "" }
- return result;
- ^~~~~~
+ int result_1; /* { dg-message "declared here" } */
+ return result_1; /* { dg-warning "uninitialized" } */
+ /* { dg-begin-multiline-output "" }
+ return result_1;
+ ^~~~~~~~
+ int result_1;
+ ^~~~~~~~
{ dg-end-multiline-output "" } */
}
int test_uninit_2 (void)
{
- int result;
- result += 3; /* { dg-warning "uninitialized" } */
-/* { dg-begin-multiline-output "" }
- result += 3;
- ~~~~~~~^~~~
+ int result_2; /* { dg-message "declared here" } */
+ result_2 += 3; /* { dg-warning "uninitialized" } */
+ /* { dg-begin-multiline-output "" }
+ result_2 += 3;
+ ~~~~~~~~~^~~~
+ int result_2;
+ ^~~~~~~~
{ dg-end-multiline-output "" } */
- return result;
+ return result_2;
}
diff --git a/gcc/testsuite/gcc.dg/fold-convlshift-1.c b/gcc/testsuite/gcc.dg/fold-convlshift-1.c
new file mode 100644
index 0000000..b6f57f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-convlshift-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+unsigned int foo(unsigned int i)
+{
+ int t1 = i;
+ int t2 = t1 << 8;
+ return t2;
+}
+
+int bar(int i)
+{
+ unsigned int t1 = i;
+ unsigned int t2 = t1 << 8;
+ return t2;
+}
+
+/* { dg-final { scan-tree-dump-not "\\(int\\)" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "\\(unsigned int\\)" "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/fold-convlshift-2.c b/gcc/testsuite/gcc.dg/fold-convlshift-2.c
new file mode 100644
index 0000000..f21358c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-convlshift-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+unsigned int foo(unsigned char c)
+{
+ int t1 = c;
+ int t2 = t1 << 8;
+ return t2;
+}
+
+int bar(unsigned char c)
+{
+ unsigned int t1 = c;
+ unsigned int t2 = t1 << 8;
+ return t2;
+}
+
+/* { dg-final { scan-tree-dump-times "\\(int\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 1 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/fold-convlshift-3.c b/gcc/testsuite/gcc.dg/fold-convlshift-3.c
new file mode 100644
index 0000000..8d01191
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-convlshift-3.c
@@ -0,0 +1,8 @@
+/* PR middle-end/102029 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+int *
+foo (const __PTRDIFF_TYPE__ l)
+{
+ return (int *) (l << 2);
+}
diff --git a/gcc/testsuite/gcc.dg/fold-eqbswap-1.c b/gcc/testsuite/gcc.dg/fold-eqbswap-1.c
new file mode 100644
index 0000000..ed9820b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-eqbswap-1.c
@@ -0,0 +1,113 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int test1(int x, int y)
+{
+#if __SIZEOF_INT__ == 4
+ return __builtin_bswap32(x) == __builtin_bswap32(y);
+#else
+ return x == y;
+#endif
+}
+
+int test2(int x, int y)
+{
+#if __SIZEOF_INT__ == 4
+ return __builtin_bswap32(x) != __builtin_bswap32(y);
+#else
+ return x != y;
+#endif
+}
+
+int test3(int x)
+{
+#if __SIZEOF_INT__ == 4
+ return __builtin_bswap32(x) == 12345;
+#else
+ return x;
+#endif
+}
+
+int test4(int x)
+{
+#if __SIZEOF_INT__ == 4
+ return __builtin_bswap32(x) != 12345;
+#else
+ return x;
+#endif
+}
+
+int test1ll(long long x, long long y)
+{
+#if __SIZEOF_LONG_LONG__ == 8
+ return __builtin_bswap64(x) == __builtin_bswap64(y);
+#else
+ return x == y;
+#endif
+}
+
+int test2ll(long long x, long long y)
+{
+#if __SIZEOF_LONG_LONG__ == 8
+ return __builtin_bswap64(x) != __builtin_bswap64(y);
+#else
+ return x != y;
+#endif
+}
+
+int test3ll(long long x)
+{
+#if __SIZEOF_LONG_LONG__ == 8
+ return __builtin_bswap64(x) == 12345;
+#else
+ return (int)x;
+#endif
+}
+
+int test4ll(long long x)
+{
+#if __SIZEOF_LONG_LONG__ == 8
+ return __builtin_bswap64(x) != 12345;
+#else
+ return (int)x;
+#endif
+}
+
+int test1s(short x, short y)
+{
+#if __SIZEOF_SHORT__ == 2
+ return __builtin_bswap16(x) == __builtin_bswap16(y);
+#else
+ return x == y;
+#endif
+}
+
+int test2s(short x, short y)
+{
+#if __SIZEOF_SHORT__ == 2
+ return __builtin_bswap16(x) != __builtin_bswap16(y);
+#else
+ return x != y;
+#endif
+}
+
+int test3s(short x)
+{
+#if __SIZEOF_SHORT__ == 2
+ return __builtin_bswap16(x) == 12345;
+#else
+ return (int)x;
+#endif
+}
+
+int test4s(short x)
+{
+#if __SIZEOF_SHORT__ == 2
+ return __builtin_bswap16(x) != 12345;
+#else
+ return (int)x;
+#endif
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_bswap" 0 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/fold-eqrotate-1.c b/gcc/testsuite/gcc.dg/fold-eqrotate-1.c
new file mode 100644
index 0000000..7d2b637
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-eqrotate-1.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int test1(unsigned int x, unsigned int y)
+{
+#if __SIZEOF_INT__ == 4
+ unsigned int r1 = (x << 16) | (x >> 16);
+ unsigned int r2 = (y << 16) | (y >> 16);
+ return r1 == r2;
+#else
+ return x == y;
+#endif
+}
+
+int test2(unsigned int x)
+{
+#if __SIZEOF_INT__ == 4
+ unsigned int r1 = (x << 16) | (x >> 16);
+ return r1 == 12345;
+#else
+ return x == 12345;
+#endif
+}
+
+int test3(unsigned int x)
+{
+#if __SIZEOF_INT__ == 4
+ unsigned int r1 = (x << 16) | (x >> 16);
+ return r1 == 0;
+#else
+ return x == 0;
+#endif
+}
+
+int test4(unsigned int x)
+{
+#if __SIZEOF_INT__ == 4
+ unsigned int r1 = (x << 16) | (x >> 16);
+ return r1 == ~0;
+#else
+ return x == ~0;
+#endif
+}
+
+/* { dg-final { scan-tree-dump-times "r>>" 0 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/fold-ior-4.c b/gcc/testsuite/gcc.dg/fold-ior-4.c
new file mode 100644
index 0000000..8f7213e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-ior-4.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+unsigned int test_ior(unsigned char i)
+{
+ return i | (i<<8) | (i<<16) | (i<<24);
+}
+
+unsigned int test_xor(unsigned char i)
+{
+ return i ^ (i<<8) ^ (i<<16) ^ (i<<24);
+}
+
+unsigned int test_ior_1s(unsigned char i)
+{
+ return i | (i<<8);
+}
+
+unsigned int test_ior_1u(unsigned char i)
+{
+ unsigned int t = i;
+ return t | (t<<8);
+}
+
+unsigned int test_xor_1s(unsigned char i)
+{
+ return i ^ (i<<8);
+}
+
+unsigned int test_xor_1u(unsigned char i)
+{
+ unsigned int t = i;
+ return t ^ (t<<8);
+}
+
+unsigned int test_ior_2s(unsigned char i)
+{
+ return (i<<8) | (i<<16);
+}
+
+unsigned int test_ior_2u(unsigned char i)
+{
+ unsigned int t = i;
+ return (t<<8) | (t<<16);
+}
+
+unsigned int test_xor_2s(unsigned char i)
+{
+ return (i<<8) ^ (i<<16);
+}
+
+unsigned int test_xor_2u(unsigned char i)
+{
+ unsigned int t = i;
+ return (t<<8) ^ (t<<16);
+}
+
+/* { dg-final { scan-tree-dump-not " \\^ " "optimized" } } */
+/* { dg-final { scan-tree-dump-not " \\| " "optimized" } } */
+/* { dg-final { scan-tree-dump-times " \\* 16843009" 2 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/fold-ior-5.c b/gcc/testsuite/gcc.dg/fold-ior-5.c
new file mode 100644
index 0000000..8de5697
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-ior-5.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+unsigned int test_ior(unsigned char i)
+{
+ return (i | (i<<16)) | ((i<<24) | (i<<8));
+}
+
+unsigned int test_xor(unsigned char i)
+{
+ return (i ^ (i<<16)) ^ ((i<<24) ^ (i<<8));
+}
+
+/* { dg-final { scan-tree-dump-not " \\^ " "optimized" } } */
+/* { dg-final { scan-tree-dump-not " \\| " "optimized" } } */
+/* { dg-final { scan-tree-dump-times " \\* 16843009" 2 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/format/c90-printf-1.c b/gcc/testsuite/gcc.dg/format/c90-printf-1.c
index c8652fc..8ffd63f 100644
--- a/gcc/testsuite/gcc.dg/format/c90-printf-1.c
+++ b/gcc/testsuite/gcc.dg/format/c90-printf-1.c
@@ -240,7 +240,7 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
printf ("%n", cn); /* { dg-warning "3:constant" "%n with const" } */
printf ((const char *)L"foo"); /* { dg-warning "25:wide" "wide string" } */
printf ("%n", (int *)0); /* { dg-warning "3:null" "%n with NULL" } */
- printf ("%s", (char *)0); /* { dg-warning "3:null" "%s with NULL" } */
+ printf ("%s", (char *)0); /* { dg-warning "12:'%s' directive argument is null" "%s with NULL" } */
/* Test for correct column locations within strings with embedded
escape sequences. */
printf ("\\\a\n \"\t%5n\n", n); /* { dg-warning "25:width" "width with %n" } */
diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-10.c b/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
index a2f99fe..dd930f9 100644
--- a/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
+++ b/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
@@ -64,8 +64,8 @@ void test_cdiag (tree t, gimple *gc)
cdiag ("%D", t); /* { dg-warning ".D. conversion used unquoted" } */
cdiag ("%E", t);
cdiag ("%F", t); /* { dg-warning ".F. conversion used unquoted" } */
- cdiag ("%G", gc);
- cdiag ("%K", t);
+ cdiag ("%G", gc); /* { dg-warning "format" } */
+ cdiag ("%K", t); /* { dg-warning "format" } */
cdiag ("%R"); /* { dg-warning "unmatched color reset directive" } */
cdiag ("%r", ""); /* { dg-warning "unterminated color directive" } */
@@ -80,8 +80,8 @@ void test_cdiag (tree t, gimple *gc)
cdiag ("%<%D%>", t);
cdiag ("%<%E%>", t);
cdiag ("%<%F%>", t);
- cdiag ("%<%G%>", gc); /* { dg-warning ".G. conversion used within a quoted sequence" } */
- cdiag ("%<%K%>", t); /* { dg-warning ".K. conversion used within a quoted sequence" } */
+ cdiag ("%<%G%>", gc); /* { dg-warning "format" } */
+ cdiag ("%<%K%>", t); /* { dg-warning "format" } */
cdiag ("%<%R%>"); /* { dg-warning "unmatched color reset directive" } */
cdiag ("%<%r%>", ""); /* { dg-warning "unterminated color directive" } */
@@ -103,8 +103,8 @@ void test_tdiag (tree t, gimple *gc)
tdiag ("%D", t); /* { dg-warning ".D. conversion used unquoted" } */
tdiag ("%E", t);
- tdiag ("%G", gc);
- tdiag ("%K", t);
+ tdiag ("%G", gc); /* { dg-warning "format" } */
+ tdiag ("%K", t); /* { dg-warning "format" } */
tdiag ("%R"); /* { dg-warning "unmatched color reset directive" } */
tdiag ("%r", ""); /* { dg-warning "unterminated color directive" } */
@@ -118,8 +118,8 @@ void test_tdiag (tree t, gimple *gc)
tdiag ("%<%D%>", t);
tdiag ("%<%E%>", t);
- tdiag ("%<%G%>", gc); /* { dg-warning ".G. conversion used within a quoted sequence" } */
- tdiag ("%<%K%>", t); /* { dg-warning ".K. conversion used within a quoted sequence" } */
+ tdiag ("%<%G%>", gc); /* { dg-warning "format" } */
+ tdiag ("%<%K%>", t); /* { dg-warning "format" } */
tdiag ("%<%R%>"); /* { dg-warning "unmatched color reset directive" } */
tdiag ("%<%r%>", ""); /* { dg-warning "unterminated color directive" } */
@@ -138,8 +138,8 @@ void test_cxxdiag (tree t, gimple *gc)
cxxdiag ("%D", t); /* { dg-warning ".D. conversion used unquoted" } */
cxxdiag ("%E", t);
cxxdiag ("%F", t); /* { dg-warning ".F. conversion used unquoted" } */
- cxxdiag ("%G", gc);
- cxxdiag ("%K", t);
+ cxxdiag ("%G", gc); /* { dg-warning "format" } */
+ cxxdiag ("%K", t); /* { dg-warning "format" } */
cxxdiag ("%R"); /* { dg-warning "unmatched color reset directive" } */
cxxdiag ("%r", ""); /* { dg-warning "unterminated color directive" } */
diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c
index 262e7e5..80d24b6 100644
--- a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c
+++ b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c
@@ -375,7 +375,7 @@ void test_cdiag_identifier (tree t, gimple *gc)
cdiag ("ident z_ with trailing underscore"); /* { dg-warning "unquoted identifier or keyword 'z_'" } */
cdiag ("v_ variable"); /* { dg-warning "unquoted identifier or keyword 'v_'" } */
cdiag ("call foo_bar"); /* { dg-warning "unquoted identifier or keyword 'foo_bar'" } */
- cdiag ("unqoted x_y ident"); /* { dg-warning "unquoted identifier or keyword 'x_y'" } */
+ cdiag ("unquoted x_y ident"); /* { dg-warning "unquoted identifier or keyword 'x_y'" } */
cdiag ("size_t type"); /* { dg-warning "unquoted identifier or keyword 'size_t'" } */
cdiag ("bigger than INT_MAX");/* { dg-warning "unquoted identifier or keyword 'INT_MAX'" } */
diff --git a/gcc/testsuite/gcc.dg/format/strfmon-1.c b/gcc/testsuite/gcc.dg/format/strfmon-1.c
index 934242a..a790db5 100644
--- a/gcc/testsuite/gcc.dg/format/strfmon-1.c
+++ b/gcc/testsuite/gcc.dg/format/strfmon-1.c
@@ -57,7 +57,7 @@ foo (char *s, size_t m, double d, long double ld)
strfmon (s, m, "%n%n", d); /* { dg-warning "matching" "too few args" } */
strfmon (s, m, ""); /* { dg-warning "zero-length" "empty" } */
strfmon (s, m, NULL); /* { dg-warning "null" "null format string" } */
- strfmon (s, m, "%"); /* { dg-warning "trailing" "tailing %" } */
+ strfmon (s, m, "%"); /* { dg-warning "trailing" "trailing %" } */
strfmon (s, m, "%n\0", d); /* { dg-warning "embedded" "embedded NUL" } */
strfmon (s, m, "%^^n", d); /* { dg-warning "repeated" "repeated flag" } */
}
diff --git a/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c b/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c
new file mode 100644
index 0000000..a42a768
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-skip-if "profile-info-section" { powerpc-ibm-aix* } } */
+/* { dg-options "-fprofile-arcs -fprofile-info-section" } */
+
+#define assert(expr) \
+ ((expr) \
+ ? (void)0 \
+ : (__builtin_printf ("%s:%i: Assertion `%s' failed.\n", \
+ __FILE__, __LINE__, #expr), \
+ __builtin_abort ()))
+
+struct gcov_info;
+
+extern void
+__gcov_info_to_gcda (const struct gcov_info *__info,
+ void (*__filename_fn) (const char *, void *),
+ void (*__dump_fn) (const void *, unsigned, void *),
+ void *(*__allocate_fn) (unsigned, void *),
+ void *__arg);
+
+extern const struct gcov_info *my_info;
+
+static unsigned counter;
+
+static void
+filename (const char *f, void *arg)
+{
+ assert (arg == &counter);
+ assert (__builtin_strstr (f, "gcov-info-to-gcda.c") == 0);
+}
+
+static void
+dump (const void *d, unsigned n, void *arg)
+{
+ unsigned *m = (unsigned *)arg;
+ assert (arg == &counter);
+
+ if (*m == 0)
+ {
+ const unsigned *u = d;
+ assert (*u == 0x67636461);
+ }
+
+ *m += n;
+}
+
+static void *
+allocate (unsigned length, void *arg)
+{
+ assert (arg == &counter);
+ return __builtin_malloc (length);
+}
+
+int main()
+{
+ __asm__ volatile (".set my_info, .LPBX2");
+ __gcov_info_to_gcda (my_info, filename, dump, allocate, &counter);
+ assert (counter > 4);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gimplefe-45.c b/gcc/testsuite/gcc.dg/gimplefe-45.c
new file mode 100644
index 0000000..b1d3cbb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-45.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fgimple" } */
+
+/* This used to ICE when simplifying (A & C) != 0 ? D : 0
+ for pointer types. */
+
+int *__GIMPLE ()
+p (int n)
+{
+ int *_2;
+ int *_t;
+ int *_t1;
+ _t = (int*)8;
+ _t1 = 0;
+ n = n & 2;
+ _2 = n != 0 ? _t : _t1;
+ return _2;
+}
+
diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-10.c b/gcc/testsuite/gcc.dg/gimplefe-error-10.c
new file mode 100644
index 0000000..13d86ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-error-10.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+__GIMPLE
+void foo() {
+ int t1;
+ t1_1 = t1_1(); /* { dg-error "invalid call" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-11.c b/gcc/testsuite/gcc.dg/gimplefe-error-11.c
new file mode 100644
index 0000000..9c29717
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-error-11.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+int bar();
+__GIMPLE
+int foo()
+{
+ if (bar()) /* { dg-error "comparison required" } */
+ goto bb1;
+ else
+ goto bb2;
+}
diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-9.c b/gcc/testsuite/gcc.dg/gimplefe-error-9.c
new file mode 100644
index 0000000..87014c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-error-9.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+void __GIMPLE
+foo()
+{
+bb1:
+bb1:; /* { dg-error "duplicate" } */
+}
diff --git a/gcc/testsuite/gcc.dg/goacc/loop-processing-1.c b/gcc/testsuite/gcc.dg/goacc/loop-processing-1.c
index bd4c07e..78b9aed 100644
--- a/gcc/testsuite/gcc.dg/goacc/loop-processing-1.c
+++ b/gcc/testsuite/gcc.dg/goacc/loop-processing-1.c
@@ -1,5 +1,5 @@
/* Make sure that OpenACC loop processing happens. */
-/* { dg-additional-options "-O2 -fdump-tree-oaccdevlow" } */
+/* { dg-additional-options "-O2 -fdump-tree-oaccloops" } */
extern int place ();
@@ -15,4 +15,4 @@ void vector_1 (int *ary, int size)
}
}
-/* { dg-final { scan-tree-dump {OpenACC loops.*Loop 0\(0\).*Loop 24\(1\).*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 1, 36\);.*Head-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 1, 36\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_FORK, \.data_dep\.[0-9_]+, 0\);.*Tail-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_TAIL_MARK, \.data_dep\.[0-9_]+, 1\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_JOIN, \.data_dep\.[0-9_]+, 0\);.*Loop 6\(6\).*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 2, 6\);.*Head-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 2, 6\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_FORK, \.data_dep\.[0-9_]+, 1\);.*Head-1:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, \.data_dep\.[0-9_]+, 1\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_FORK, \.data_dep\.[0-9_]+, 2\);.*Tail-1:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_TAIL_MARK, \.data_dep\.[0-9_]+, 2\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_JOIN, \.data_dep\.[0-9_]+, 2\);.*Tail-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_TAIL_MARK, \.data_dep\.[0-9_]+, 1\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_JOIN, \.data_dep\.[0-9_]+, 1\);} "oaccdevlow" } } */
+/* { dg-final { scan-tree-dump {OpenACC loops.*Loop 0\(0\).*Loop 24\(1\).*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 1, 36\);.*Head-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 1, 36\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_FORK, \.data_dep\.[0-9_]+, 0\);.*Tail-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_TAIL_MARK, \.data_dep\.[0-9_]+, 1\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_JOIN, \.data_dep\.[0-9_]+, 0\);.*Loop 6\(6\).*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 2, 6\);.*Head-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, 0, 2, 6\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_FORK, \.data_dep\.[0-9_]+, 1\);.*Head-1:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_HEAD_MARK, \.data_dep\.[0-9_]+, 1\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_FORK, \.data_dep\.[0-9_]+, 2\);.*Tail-1:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_TAIL_MARK, \.data_dep\.[0-9_]+, 2\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_JOIN, \.data_dep\.[0-9_]+, 2\);.*Tail-0:.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_TAIL_MARK, \.data_dep\.[0-9_]+, 1\);.*\.data_dep\.[0-9_]+ = \.UNIQUE \(OACC_JOIN, \.data_dep\.[0-9_]+, 1\);} "oaccloops" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-5.c b/gcc/testsuite/gcc.dg/gomp/atomic-5.c
index 70cfb35..36d1422 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-5.c
+++ b/gcc/testsuite/gcc.dg/gomp/atomic-5.c
@@ -27,7 +27,7 @@ void f1(void)
#pragma omp atomic
bar() += 1; /* { dg-error "lvalue required" } */
#pragma omp atomic a /* { dg-error "expected end of line" } */
- x++; /* { dg-error "expected 'read', 'write', 'update', 'capture', 'seq_cst', 'acq_rel', 'release', 'relaxed' or 'hint' clause" "" { target *-*-* } .-1 } */
+ x++; /* { dg-error "expected 'read', 'write', 'update', 'capture', 'compare', 'weak', 'fail', 'seq_cst', 'acq_rel', 'release', 'relaxed' or 'hint' clause" "" { target *-*-* } .-1 } */
#pragma omp atomic
; /* { dg-error "expected expression" } */
#pragma omp atomic
diff --git a/gcc/testsuite/gcc.dg/gomp/barrier-2.c b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
index c0d62f5..ef605a0 100644
--- a/gcc/testsuite/gcc.dg/gomp/barrier-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
@@ -16,8 +16,7 @@ void f1(void)
void f2(void)
{
- label: /* { dg-error "label at end of compound statement" } */
- /* { dg-warning "defined but not used" "" { target *-*-* } .-1 } */
+ label: /* { dg-warning "defined but not used" } */
#pragma omp barrier /* { dg-error "may only be used in compound statements" } */
}
diff --git a/gcc/testsuite/gcc.dg/gomp/clause-1.c b/gcc/testsuite/gcc.dg/gomp/clause-1.c
index 9d34b041..8e7cc95 100644
--- a/gcc/testsuite/gcc.dg/gomp/clause-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/clause-1.c
@@ -56,7 +56,7 @@ foo (int x)
;
#pragma omp p reduction (|:d) /* { dg-error "has invalid type for" } */
;
-#pragma omp p reduction (&&:d) /* { dg-error "has invalid type for" } */
+#pragma omp p reduction (&:d) /* { dg-error "has invalid type for" } */
;
#pragma omp p copyin (d) /* { dg-error "must be 'threadprivate'" } */
;
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c b/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
index b9a4161..9397820 100644
--- a/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
+++ b/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
@@ -15,7 +15,7 @@ f1 (int x)
lab:
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
- x++; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "" { target *-*-* } .-1 } */
+ x++;
}
return x;
}
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c b/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
index 39c2c1d..3da5dc7 100644
--- a/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
@@ -17,7 +17,7 @@ f1 (int x)
lab:
#pragma omp declare variant (fn0) match (user={condition(0)})
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
- x++; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "" { target *-*-* } .-1 } */
+ x++;
}
return x;
}
diff --git a/gcc/testsuite/gcc.dg/gomp/nesting-1.c b/gcc/testsuite/gcc.dg/gomp/nesting-1.c
index 52fcda7..ed457ce 100644
--- a/gcc/testsuite/gcc.dg/gomp/nesting-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/nesting-1.c
@@ -19,9 +19,13 @@ f1 (void)
}
#pragma omp single /* { dg-error "may not be closely nested" } */
;
- #pragma omp master /* { dg-error "may not be closely nested" } */
- ;
+ #pragma omp master /* { dg-error "may not be closely nested" } */
+ ;
+ #pragma omp masked /* { dg-error "may not be closely nested" } */
+ ;
#pragma omp barrier /* { dg-error "may not be closely nested" } */
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
#pragma omp sections
{
@@ -50,6 +54,16 @@ f1 (void)
}
#pragma omp sections
{
+ #pragma omp masked /* { dg-error "may not be closely nested" } */
+ ;
+ }
+ #pragma omp sections
+ {
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
+ }
+ #pragma omp sections
+ {
#pragma omp section
;
}
@@ -81,6 +95,15 @@ f1 (void)
#pragma omp section
#pragma omp master /* { dg-error "may not be closely nested" } */
;
+ #pragma omp section
+ #pragma omp masked /* { dg-error "may not be closely nested" } */
+ ;
+ }
+ #pragma omp sections
+ {
+ #pragma omp section
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
#pragma omp single
{
@@ -97,7 +120,11 @@ f1 (void)
;
#pragma omp master /* { dg-error "may not be closely nested" } */
;
+ #pragma omp masked /* { dg-error "may not be closely nested" } */
+ ;
#pragma omp barrier /* { dg-error "may not be closely nested" } */
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
#pragma omp master
{
@@ -115,6 +142,27 @@ f1 (void)
#pragma omp master
;
#pragma omp barrier /* { dg-error "may not be closely nested" } */
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
+ }
+ #pragma omp masked filter (1)
+ {
+ #pragma omp for /* { dg-error "may not be closely nested" } */
+ for (j = 0; j < 3; j++)
+ ;
+ #pragma omp sections /* { dg-error "may not be closely nested" } */
+ {
+ ;
+ #pragma omp section
+ ;
+ }
+ #pragma omp single /* { dg-error "may not be closely nested" } */
+ ;
+ #pragma omp master
+ ;
+ #pragma omp barrier /* { dg-error "may not be closely nested" } */
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
#pragma omp task
{
@@ -131,7 +179,11 @@ f1 (void)
;
#pragma omp master /* { dg-error "may not be closely nested" } */
;
+ #pragma omp masked /* { dg-error "may not be closely nested" } */
+ ;
#pragma omp barrier /* { dg-error "may not be closely nested" } */
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
#pragma omp parallel
{
@@ -148,7 +200,42 @@ f1 (void)
;
#pragma omp master
;
+ #pragma omp masked
+ ;
+ #pragma omp barrier
+ #pragma omp scope
+ ;
+ #pragma omp scope
+ {
+ #pragma omp scope
+ ;
+ }
+ }
+ #pragma omp scope
+ {
+ #pragma omp for
+ for (j = 0; j < 3; j++)
+ ;
+ #pragma omp sections
+ {
+ ;
+ #pragma omp section
+ ;
+ }
+ #pragma omp single
+ ;
+ #pragma omp master
+ ;
+ #pragma omp masked
+ ;
#pragma omp barrier
+ #pragma omp scope
+ ;
+ #pragma omp scope
+ {
+ #pragma omp scope
+ ;
+ }
}
}
@@ -171,7 +258,11 @@ f2 (void)
;
#pragma omp master
;
+ #pragma omp masked
+ ;
#pragma omp barrier /* { dg-error "may not be closely nested" } */
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
}
@@ -182,6 +273,8 @@ f3 (void)
{
#pragma omp ordered /* { dg-error "may not be closely nested" } */
;
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
}
@@ -192,6 +285,8 @@ f4 (void)
{
#pragma omp ordered /* { dg-error "may not be closely nested" } */
;
+ #pragma omp scope /* { dg-error "may not be closely nested" } */
+ ;
}
}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr100508.c b/gcc/testsuite/gcc.dg/gomp/pr100508.c
new file mode 100644
index 0000000..c3fa2fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr100508.c
@@ -0,0 +1,14 @@
+/* PR middle-end/100508 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -fopenmp-simd" } */
+
+typedef int __attribute__((__vector_size__(32))) V;
+V j;
+
+#pragma omp declare simd
+int
+foo (void)
+{
+ V m = j;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/scan-1.c b/gcc/testsuite/gcc.dg/gomp/scan-1.c
new file mode 100644
index 0000000..807071d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/scan-1.c
@@ -0,0 +1,51 @@
+int baz (void);
+void qux (int);
+int r;
+
+int
+foo (void)
+{
+ int r = 0, i;
+ void bar (void) { r++; }
+ #pragma omp parallel for reduction(inscan, +:r)
+ for (i = 0; i < 64; i++)
+ {
+ r += baz ();
+ #pragma omp scan inclusive(r)
+ qux (r);
+ }
+ #pragma omp parallel for reduction(inscan, +:r)
+ for (i = 0; i < 64; i++)
+ {
+ qux (r);
+ #pragma omp scan exclusive(r)
+ r += baz ();
+ }
+ bar ();
+ return r;
+}
+
+int
+corge (void)
+{
+ int r = 0, i;
+ void bar (void)
+ {
+ #pragma omp parallel for reduction(inscan, +:r)
+ for (i = 0; i < 64; i++)
+ {
+ r += baz ();
+ #pragma omp scan inclusive(r)
+ qux (r);
+ }
+ #pragma omp parallel for reduction(inscan, +:r)
+ for (i = 0; i < 64; i++)
+ {
+ qux (r);
+ #pragma omp scan exclusive(r)
+ r += baz ();
+ }
+ }
+ bar ();
+ return r;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c
index 75554de..9f7c84d 100644
--- a/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c
@@ -7,6 +7,7 @@ int addit(int a, int b, int *c)
return a + b;
}
/* { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-4 } */
+/* { dg-final { scan-tree-dump {(?n)^__attribute__\(\(omp declare simd \(notinbranch aligned\(2:32\)\), omp declare simd \(inbranch uniform\(2\) linear\(1:66\)\)\)\)$} "optimized" } } */
#pragma omp declare simd uniform(a) aligned(a:32) linear(k:1) notinbranch
float setArray(float *a, float x, int k)
@@ -14,6 +15,7 @@ float setArray(float *a, float x, int k)
a[k] = a[k] + x;
return a[k];
}
+/* { dg-final { scan-tree-dump {(?n)^__attribute__\(\(omp declare simd \(notinbranch uniform\(0\) aligned\(0:32\) linear\(2:1\)\)\)\)$} "optimized" } } */
/* { dg-final { scan-tree-dump "_ZGVbN4ua32vl_setArray" "optimized" { target i?86-*-* x86_64-*-* } } } */
/* { dg-final { scan-tree-dump "_ZGVbN4vvva32_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/fuse-1.c b/gcc/testsuite/gcc.dg/graphite/fuse-1.c
index 204d3b2..527b6e5 100644
--- a/gcc/testsuite/gcc.dg/graphite/fuse-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/fuse-1.c
@@ -1,6 +1,6 @@
/* Check that the two loops are fused and that we manage to fold the two xor
operations. */
-/* { dg-options "-O2 -floop-nest-optimize -fdump-tree-forwprop-all -fdump-tree-graphite-all" } */
+/* { dg-options "-O2 -floop-nest-optimize -fdump-tree-forwprop4 -fdump-tree-graphite-all" } */
/* Make sure we fuse the loops like this:
AST generated by isl:
@@ -12,7 +12,7 @@ for (int c0 = 0; c0 <= 99; c0 += 1) {
/* { dg-final { scan-tree-dump-times "AST generated by isl:.*for \\(int c0 = 0; c0 <= 99; c0 \\+= 1\\) \\{.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*\\}" 1 "graphite" } } */
/* Check that after fusing the loops, the scalar computation is also fused. */
-/* { dg-final { scan-tree-dump-times "gimple_simplified to\[^\\n\]*\\^ 12" 1 "forwprop4" } } */
+/* { dg-final { scan-tree-dump-times " \\^ 12;" 2 "forwprop4" } } */
#define MAX 100
int A[MAX];
diff --git a/gcc/testsuite/gcc.dg/guality/example.c b/gcc/testsuite/gcc.dg/guality/example.c
index 26d25c2..6f1c017 100644
--- a/gcc/testsuite/gcc.dg/guality/example.c
+++ b/gcc/testsuite/gcc.dg/guality/example.c
@@ -1,5 +1,6 @@
-/* { dg-do run { xfail *-*-* } } */
+/* { dg-do run { xfail { ! aarch64*-*-* } } } */
/* { dg-options "-g" } */
+/* { dg-xfail-run-if "" aarch64*-*-* "*" { "-O[01g]" } } */
#define GUALITY_DONT_FORCE_LIVE_AFTER -1
diff --git a/gcc/testsuite/gcc.dg/guality/guality.c b/gcc/testsuite/gcc.dg/guality/guality.c
index db015e6..a4de564 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.c
+++ b/gcc/testsuite/gcc.dg/guality/guality.c
@@ -1,4 +1,4 @@
-/* { dg-do run { xfail *-*-* } } */
+/* { dg-do run { xfail { ! aarch64*-*-* } } } */
/* { dg-options "-g" } */
/* { dg-require-effective-target alloca } */
diff --git a/gcc/testsuite/gcc.dg/guality/inline-params.c b/gcc/testsuite/gcc.dg/guality/inline-params.c
index f4c5f15..6be240a 100644
--- a/gcc/testsuite/gcc.dg/guality/inline-params.c
+++ b/gcc/testsuite/gcc.dg/guality/inline-params.c
@@ -3,7 +3,7 @@
inlining inlines the functions too early to test the real IPA passes (such
as IPA-CP). */
/* { dg-options "-g -fno-early-inlining -fno-ipa-sra" } */
-/* { dg-xfail-run-if "" { "*-*-*" } { "-O2" "-O3" "-Os" } } */
+/* { dg-xfail-run-if "" { ! aarch64*-*-* } { "-O2" "-O3" "-Os" } } */
#define GUALITY_DONT_FORCE_LIVE_AFTER -1
diff --git a/gcc/testsuite/gcc.dg/guality/loop-1.c b/gcc/testsuite/gcc.dg/guality/loop-1.c
index 8da447d..1b1f6d3 100644
--- a/gcc/testsuite/gcc.dg/guality/loop-1.c
+++ b/gcc/testsuite/gcc.dg/guality/loop-1.c
@@ -17,6 +17,6 @@ foo (int n)
/* The following works only with final value replacement or with the NOP
but not without (which means -Og). Vectorization breaks it, so disable
that. At -O3 it currently fails, PR89983. */
- __asm__ volatile (NOP : : "g" (i) : "memory"); /* { dg-final { gdb-test . "i" "1" } } */
+ __asm__ volatile (NOP : : "g" (i) : "memory"); /* { dg-final { gdb-test . "i" "1" { xfail { aarch64*-*-* && { any-opts "-ftracer" } } } } } */
}
int main() { foo(1); }
diff --git a/gcc/testsuite/gcc.dg/guality/pr101905.c b/gcc/testsuite/gcc.dg/guality/pr101905.c
new file mode 100644
index 0000000..71b7516
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/pr101905.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
+/* { dg-options "-g -ffixed-r15" } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+register unsigned long long regVar asm ("r15");
+
+int
+main()
+{
+ regVar = 0xdeadbeefcafebabeULL;
+ asm ("nop" : "+r" (regVar));
+ asm volatile ("nop"); /* { dg-final { gdb-test . "regVar" "0xdeadbeefcafebabeULL" } } */
+ asm volatile ("nop" : : "r" (regVar));
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-1.c b/gcc/testsuite/gcc.dg/guality/pr36728-1.c
index 0ab475a..5864c2a 100644
--- a/gcc/testsuite/gcc.dg/guality/pr36728-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr36728-1.c
@@ -32,7 +32,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
/* { dg-final { gdb-test 16 "arg5" "5" } } */
/* { dg-final { gdb-test 16 "arg6" "6" } } */
/* { dg-final { gdb-test 16 "arg7" "30" } } */
-/* { dg-final { gdb-test 16 "y" "2" } } */
+/* { dg-final { gdb-test 16 "y" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 18 "arg3" "3" } } */
diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-2.c b/gcc/testsuite/gcc.dg/guality/pr36728-2.c
index 7ba8663..6e8d775 100644
--- a/gcc/testsuite/gcc.dg/guality/pr36728-2.c
+++ b/gcc/testsuite/gcc.dg/guality/pr36728-2.c
@@ -25,21 +25,21 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
and arg2. So it is expected that these values are unavailable in
some of these tests. */
-/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 16 "arg3" "3" } } */
-/* { dg-final { gdb-test 16 "arg4" "4" } } */
-/* { dg-final { gdb-test 16 "arg5" "5" } } */
-/* { dg-final { gdb-test 16 "arg6" "6" } } */
-/* { dg-final { gdb-test 16 "arg7" "30" } } */
-/* { dg-final { gdb-test 16 "y" "2" } } */
-/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 18 "arg3" "3" } } */
-/* { dg-final { gdb-test 18 "arg4" "4" } } */
-/* { dg-final { gdb-test 18 "arg5" "5" } } */
-/* { dg-final { gdb-test 18 "arg6" "6" } } */
-/* { dg-final { gdb-test 18 "arg7" "30" } } */
+/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 16 "arg3" "3" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 16 "arg4" "4" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 16 "arg5" "5" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 16 "arg6" "6" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 16 "arg7" "30" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 16 "y" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
+/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 18 "arg3" "3" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 18 "arg4" "4" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 18 "arg5" "5" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 18 "arg6" "6" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
+/* { dg-final { gdb-test 18 "arg7" "30" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */
/* { dg-final { gdb-test 18 "*x" "(char) 25" } } */
/* { dg-final { gdb-test 18 "y" "2" } } */
diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-3.c b/gcc/testsuite/gcc.dg/guality/pr36728-3.c
index 4700d50..589009b 100644
--- a/gcc/testsuite/gcc.dg/guality/pr36728-3.c
+++ b/gcc/testsuite/gcc.dg/guality/pr36728-3.c
@@ -30,7 +30,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
/* { dg-final { gdb-test 14 "arg5" "5" } } */
/* { dg-final { gdb-test 14 "arg6" "6" } } */
/* { dg-final { gdb-test 14 "arg7" "30" } } */
-/* { dg-final { gdb-test 14 "y" "2" } } */
+/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { any-opts "-O3" } } } } } */
/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 16 "arg3" "3" } } */
diff --git a/gcc/testsuite/gcc.dg/guality/pr41353-1.c b/gcc/testsuite/gcc.dg/guality/pr41353-1.c
index cd30632..6639a52 100644
--- a/gcc/testsuite/gcc.dg/guality/pr41353-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr41353-1.c
@@ -22,7 +22,7 @@ f2 (int i, int j)
{
j += i;
/* { dg-final { gdb-test .+4 "i" "37" } } */
- /* { dg-final { gdb-test .+3 "j" "28 + 37" { xfail *-*-* } } } */
+ /* { dg-final { gdb-test .+3 "j" "28 + 37" { xfail { no-opts "-O0" } } } } */
int i1 = 2 * i; /* { dg-final { gdb-test .+2 "i1" "2 * 37" } } */
int i2 = 3 * i; /* { dg-final { gdb-test .+1 "i2" "3 * 37" } } */
return j;
diff --git a/gcc/testsuite/gcc.dg/guality/pr41447-1.c b/gcc/testsuite/gcc.dg/guality/pr41447-1.c
index 308ef94..9fde33e 100644
--- a/gcc/testsuite/gcc.dg/guality/pr41447-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr41447-1.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-g" } */
+/* { dg-xfail-run-if "" { aarch64*-*-* } { "-O2" "-O3" "-Os" } { "-fno-fat-lto-objects" } } */
#include "guality.h"
diff --git a/gcc/testsuite/gcc.dg/guality/pr43077-1.c b/gcc/testsuite/gcc.dg/guality/pr43077-1.c
index 39bd26a..2d93762 100644
--- a/gcc/testsuite/gcc.dg/guality/pr43077-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr43077-1.c
@@ -24,7 +24,7 @@ int __attribute__((noinline))
foo (unsigned long *p, unsigned long *q)
{
int ret;
- asm volatile ("" : "=r" (ret), "=r" (*p), "=r" (*q) : "0" (1), "1" (2), "2" (3));
+ asm volatile ("" : "=r" (ret), "=r" (*p), "=r" (*q) : "0" (1), "1" (2l), "2" (3l));
return ret;
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr49888.c b/gcc/testsuite/gcc.dg/guality/pr49888.c
index 4f3a250..919cfc9 100644
--- a/gcc/testsuite/gcc.dg/guality/pr49888.c
+++ b/gcc/testsuite/gcc.dg/guality/pr49888.c
@@ -4,7 +4,7 @@
static int v __attribute__((used));
-static void __attribute__((noinline, noclone))
+static void __attribute__((noipa))
f (int *p)
{
int c = *p;
diff --git a/gcc/testsuite/gcc.dg/guality/pr54200.c b/gcc/testsuite/gcc.dg/guality/pr54200.c
index e873d1b..ba14221 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54200.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54200.c
@@ -17,7 +17,7 @@ foo (int z, int x, int b)
else
{
int a = (x + z) + b;
- return a; /* { dg-final { gdb-test . "z" "3" } } */
+ return a; /* { dg-final { gdb-test . "z" "3" { xfail { aarch64*-*-* && { no-opts "-O0" "-Og" } } } } } */
}
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-1.c b/gcc/testsuite/gcc.dg/guality/pr54519-1.c
index a4105ab..81703eb 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54519-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54519-1.c
@@ -16,11 +16,11 @@ fn2 (int x, int y, int z)
{
fn1 (x);
fn1 (x); /* { dg-final { gdb-test .+2 "x" "36" } } */
- if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" } } */
- fn1 (x); /* { dg-final { gdb-test . "z" "6" } } */
+ if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
+ fn1 (x); /* { dg-final { gdb-test . "z" "6" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" } } */
- if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" } } */
- fn1 (x); /* { dg-final { gdb-test . "z" "8" } } */
+ if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
+ fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
fn1 (x);
fn1 (x + a);
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-2.c b/gcc/testsuite/gcc.dg/guality/pr54519-2.c
index 6bc1683..e1368bf 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54519-2.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54519-2.c
@@ -14,7 +14,7 @@ fn2 (int x, int y)
if (y)
{
fn1 (x); /* { dg-final { gdb-test .+1 "x" "6" } } */
- fn1 (x); /* { dg-final { gdb-test . "y" "25" } } */
+ fn1 (x); /* { dg-final { gdb-test . "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
fn1 (x);
fn1 (x);
y = -2 + x;
diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-3.c b/gcc/testsuite/gcc.dg/guality/pr54519-3.c
index da18247..fabab96 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54519-3.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54519-3.c
@@ -16,11 +16,11 @@ fn2 (int x, int y, int z)
{
fn1 (x);
fn1 (x); /* { dg-final { gdb-test .+2 "x" "36" } } */
- if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" } } */
- fn1 (x); /* { dg-final { gdb-test . "z" "6" } } */
+ if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
+ fn1 (x); /* { dg-final { gdb-test . "z" "6" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" } } */
- if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" } } */
- fn1 (x); /* { dg-final { gdb-test . "z" "8" } } */
+ if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
+ fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
fn1 (x);
fn1 (x + a);
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-4.c b/gcc/testsuite/gcc.dg/guality/pr54519-4.c
index c82de58..fd8465f 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54519-4.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54519-4.c
@@ -14,7 +14,7 @@ fn2 (int x, int y)
if (y)
{
fn1 (x); /* { dg-final { gdb-test .+1 "x" "6" } } */
- fn1 (x); /* { dg-final { gdb-test . "y" "25" } } */
+ fn1 (x); /* { dg-final { gdb-test . "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
fn1 (x);
fn1 (x);
y = -2 + x;
diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-5.c b/gcc/testsuite/gcc.dg/guality/pr54519-5.c
index 0903fbf..76fa1e3 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54519-5.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54519-5.c
@@ -14,7 +14,7 @@ fn2 (int x, int y)
if (y)
{
fn1 (x); /* { dg-final { gdb-test .+1 "x" "6" } } */
- fn1 (x); /* { dg-final { gdb-test . "y" "25" } } */
+ fn1 (x); /* { dg-final { gdb-test . "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */
fn1 (x);
fn1 (x);
y = -2 + x;
diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-6.c b/gcc/testsuite/gcc.dg/guality/pr54519-6.c
index bb3fb5f..732c268 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54519-6.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54519-6.c
@@ -7,7 +7,7 @@
static inline void
f1 (int x, int y)
{
- asm volatile (NOP); /* { dg-final { gdb-test .+1 "x" "2" } } */
+ asm volatile (NOP); /* { dg-final { gdb-test .+1 "x" "2" { xfail { aarch64*-*-* && { any-opts "-Os" } } } } } */
asm volatile (NOP); /* { dg-final { gdb-test . "y" "0" } } */
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr54693-2.c b/gcc/testsuite/gcc.dg/guality/pr54693-2.c
index 1741a38..68aa6c6 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54693-2.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54693-2.c
@@ -19,7 +19,7 @@ foo (int x, int y, int z)
{ /* { dg-final { gdb-test .+2 "i" "v + 1" } } */
/* { dg-final { gdb-test .+1 "x" "10 - i" } } */
bar (i); /* { dg-final { gdb-test . "y" "20 - 2 * i" } } */
- /* { dg-final { gdb-test .-1 "z" "30 - 3 * i" } } */
+ /* { dg-final { gdb-test .-1 "z" "30 - 3 * i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-Os" } } } } } */
i++, x--, y -= 2, z -= 3;
}
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr54970.c b/gcc/testsuite/gcc.dg/guality/pr54970.c
index 2e0bc57..e60cc04 100644
--- a/gcc/testsuite/gcc.dg/guality/pr54970.c
+++ b/gcc/testsuite/gcc.dg/guality/pr54970.c
@@ -8,39 +8,39 @@
int
main ()
{
- int a[] = { 1, 2, 3 }; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { *-*-* } } } } */
+ int a[] = { 1, 2, 3 }; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { no-opts "-O0" "-Og" } } } } */
int *p = a + 2; /* { dg-final { gdb-test .+3 "a\[1\]" "2" } } */
int *q = a + 1; /* { dg-final { gdb-test .+2 "a\[2\]" "3" } } */
/* { dg-final { gdb-test .+1 "*p" "3" } } */
asm volatile (NOP); /* { dg-final { gdb-test . "*q" "2" } } */
- *p += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { *-*-* } } } } */
+ *p += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { no-opts "-O0" "-Og" } } } } */
/* { dg-final { gdb-test .+3 "a\[1\]" "2" } } */
/* { dg-final { gdb-test .+2 "a\[2\]" "13" } } */
/* { dg-final { gdb-test .+1 "*p" "13" } } */
asm volatile (NOP); /* { dg-final { gdb-test . "*q" "2" } } */
- *q += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { *-*-* } } } } */
+ *q += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { no-opts "-O0" "-Og" } } } } */
/* { dg-final { gdb-test .+3 "a\[1\]" "12" } } */
/* { dg-final { gdb-test .+2 "a\[2\]" "13" } } */
/* { dg-final { gdb-test .+1 "*p" "13" } } */
asm volatile (NOP); /* { dg-final { gdb-test . "*q" "12" } } */
__builtin_memcpy (&a, (int [3]) { 4, 5, 6 }, sizeof (a));
- /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { *-*-* } } } } */
+ /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */
/* { dg-final { gdb-test .+3 "a\[1\]" "5" } } */
/* { dg-final { gdb-test .+2 "a\[2\]" "6" } } */
/* { dg-final { gdb-test .+1 "*p" "6" } } */
asm volatile (NOP); /* { dg-final { gdb-test . "*q" "5" } } */
- *p += 20; /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { *-*-* } } } } */
+ *p += 20; /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */
/* { dg-final { gdb-test .+3 "a\[1\]" "5" } } */
/* { dg-final { gdb-test .+2 "a\[2\]" "26" } } */
/* { dg-final { gdb-test .+1 "*p" "26" } } */
asm volatile (NOP); /* { dg-final { gdb-test . "*q" "5" } } */
- *q += 20; /* { dg-final { gdb-test .+8 "a\[0\]" "4" { xfail { *-*-* } } } } */
+ *q += 20; /* { dg-final { gdb-test .+8 "a\[0\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */
/* { dg-final { gdb-test .+7 "a\[1\]" "25" } } */
/* { dg-final { gdb-test .+6 "a\[2\]" "26" } } */
/* { dg-final { gdb-test .+5 "*p" "26" } } */
/* { dg-final { gdb-test .+4 "p\[-1\]" "25" } } */
- /* { dg-final { gdb-test .+3 "p\[-2\]" "4" { xfail { *-*-* } } } } */
- /* { dg-final { gdb-test .+2 "q\[-1\]" "4" { xfail { *-*-* } } } } */
+ /* { dg-final { gdb-test .+3 "p\[-2\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */
+ /* { dg-final { gdb-test .+2 "q\[-1\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */
/* { dg-final { gdb-test .+1 "q\[1\]" "26" } } */
asm volatile (NOP); /* { dg-final { gdb-test . "*q" "25" } } */
return 0;
diff --git a/gcc/testsuite/gcc.dg/guality/pr56154-1.c b/gcc/testsuite/gcc.dg/guality/pr56154-1.c
index 4f02bc9..d6da4a7 100644
--- a/gcc/testsuite/gcc.dg/guality/pr56154-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr56154-1.c
@@ -17,7 +17,7 @@ foo (int fd, union U x)
asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:17 "x.a" "4" } } */
z = x.a;
x.a = 6;
- asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:20 "x.a" "6" } } */
+ asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:20 "x.a" "6" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
return result;
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr59776.c b/gcc/testsuite/gcc.dg/guality/pr59776.c
index 7c95a9f..0e48559 100644
--- a/gcc/testsuite/gcc.dg/guality/pr59776.c
+++ b/gcc/testsuite/gcc.dg/guality/pr59776.c
@@ -9,14 +9,14 @@ struct S { float f, g; };
__attribute__((noipa)) void
foo (struct S *p)
{
- struct S s1, s2; /* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" } } */
- s1 = *p; /* { dg-final { gdb-test pr59776.c:17 "s1.g" "6.0" } } */
- s2 = s1; /* { dg-final { gdb-test pr59776.c:17 "s2.f" "0.0" } } */
- *(int *) &s2.f = 0; /* { dg-final { gdb-test pr59776.c:17 "s2.g" "6.0" { xfail *-*-* } } } */
- asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.f" "5.0" } } */
- asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.g" "6.0" } } */
- s2 = s1; /* { dg-final { gdb-test pr59776.c:20 "s2.f" "5.0" } } */
- asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s2.g" "6.0" { xfail *-*-* } } } */
+ struct S s1, s2; /* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
+ s1 = *p; /* { dg-final { gdb-test pr59776.c:17 "s1.g" "6.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
+ s2 = s1; /* { dg-final { gdb-test pr59776.c:17 "s2.f" "0.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
+ *(int *) &s2.f = 0; /* { dg-final { gdb-test pr59776.c:17 "s2.g" "6.0" { xfail { no-opts "-O0" } } } } */
+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.f" "5.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.g" "6.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
+ s2 = s1; /* { dg-final { gdb-test pr59776.c:20 "s2.f" "5.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s2.g" "6.0" { xfail { no-opts "-O0" } } } } */
asm volatile (NOP : : : "memory");
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr68860-1.c b/gcc/testsuite/gcc.dg/guality/pr68860-1.c
index 8c8d835..bbd9d6e 100644
--- a/gcc/testsuite/gcc.dg/guality/pr68860-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr68860-1.c
@@ -31,7 +31,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int a
/* { dg-final { gdb-test 14 "arg6" "6" } } */
/* { dg-final { gdb-test 14 "arg7" "30" } } */
/* { dg-final { gdb-test 14 "arg8" "7" } } */
-/* { dg-final { gdb-test 14 "y" "2" } } */
+/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { { any-opts "-O2" "-O3" } && { no-opts "-flto" } } } } } } */
/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 16 "arg3" "3" } } */
diff --git a/gcc/testsuite/gcc.dg/guality/pr68860-2.c b/gcc/testsuite/gcc.dg/guality/pr68860-2.c
index 070efbc..a18a04e 100644
--- a/gcc/testsuite/gcc.dg/guality/pr68860-2.c
+++ b/gcc/testsuite/gcc.dg/guality/pr68860-2.c
@@ -31,7 +31,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int a
/* { dg-final { gdb-test 14 "arg6" "6" } } */
/* { dg-final { gdb-test 14 "arg7" "30" } } */
/* { dg-final { gdb-test 14 "arg8" "7" } } */
-/* { dg-final { gdb-test 14 "y" "2" } } */
+/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { any-opts "-O3" } } } } } */
/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */
/* { dg-final { gdb-test 16 "arg3" "3" } } */
diff --git a/gcc/testsuite/gcc.dg/guality/pr90074.c b/gcc/testsuite/gcc.dg/guality/pr90074.c
index 1294928..2fd8842 100644
--- a/gcc/testsuite/gcc.dg/guality/pr90074.c
+++ b/gcc/testsuite/gcc.dg/guality/pr90074.c
@@ -25,7 +25,7 @@ int main()
debug stmt for the final value of the loop during loop distribution
which would fix the UNSUPPORTED cases.
c is optimized out at -Og for no obvious reason. */
- optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "8" } } */
- /* { dg-final { gdb-test .-1 "c + 1" "2" } } */
+ optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "8" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
+ /* { dg-final { gdb-test .-1 "c + 1" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/guality/pr90716.c b/gcc/testsuite/gcc.dg/guality/pr90716.c
index b2f5c9d..fe7e556 100644
--- a/gcc/testsuite/gcc.dg/guality/pr90716.c
+++ b/gcc/testsuite/gcc.dg/guality/pr90716.c
@@ -20,6 +20,6 @@ int main()
Instead test j + 1 which will make the test UNSUPPORTED if i
is optimized out. Since the test previously had wrong debug
with j == 0 this is acceptable. */
- optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" } } */
+ optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/guality/sra-1.c b/gcc/testsuite/gcc.dg/guality/sra-1.c
index 8ad57cf..e9b920e 100644
--- a/gcc/testsuite/gcc.dg/guality/sra-1.c
+++ b/gcc/testsuite/gcc.dg/guality/sra-1.c
@@ -18,7 +18,7 @@ f1 (int k)
asm ("" : "+r" (a.i));
a.j++;
bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" } } */
- bar (a.j); /* { dg-final { gdb-test . "a.j" "14" } } */
+ bar (a.j); /* { dg-final { gdb-test . "a.j" "14" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
return a.i + a.j;
}
@@ -29,7 +29,7 @@ f2 (int k)
asm ("" : "+r" (a[0]));
a[1]++;
bar (a[0]); /* { dg-final { gdb-test .+1 "a\[0\]" "4" } } */
- bar (a[1]); /* { dg-final { gdb-test . "a\[1\]" "14" } } */
+ bar (a[1]); /* { dg-final { gdb-test . "a\[1\]" "14" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
return a[0] + a[1];
}
@@ -39,8 +39,8 @@ f3 (int k)
struct B a = { 4, k + 6 };
asm ("" : "+r" (a.i));
a.j++;
- bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" } } */
- bar (a.j); /* { dg-final { gdb-test . "a.j" "14" } } */
+ bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */
+ bar (a.j); /* { dg-final { gdb-test . "a.j" "14" { xfail { aarch64*-*-* && { any-opts "-Og" "-fno-fat-lto-objects" } } } } } */
return a.i + a.j;
}
diff --git a/gcc/testsuite/gcc.dg/ipa/inline-8.c b/gcc/testsuite/gcc.dg/ipa/inline-8.c
index 388283c..c51eec2 100644
--- a/gcc/testsuite/gcc.dg/ipa/inline-8.c
+++ b/gcc/testsuite/gcc.dg/ipa/inline-8.c
@@ -6,13 +6,13 @@
#include <math.h>
extern int isnanf (float);
/* Can't be inlined because isnanf will be optimized out. */
-int
+static int
cmp (float a)
{
return isnanf (a);
}
/* Can be inlined. */
-int
+static int
move (int a)
{
return a;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
index df7e356..4a22e39 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
@@ -24,7 +24,7 @@ ox (struct bovid cow)
}
int
-main (int argc, char **argv)
+main (int argc, char *argv[])
{
struct bovid cow;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c
index 8f3bb5d..c34c89e 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-additional-options "-msse2" { target ia32 } } */
-/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* } } */
+/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* powerpc-wrs-vxworks* } } */
typedef int __attribute__((__vector_size__(16))) vectype;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-23.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-23.c
new file mode 100644
index 0000000..f438b50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-23.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern int g;
+
+static int __attribute__((noinline))
+bar (int i, int j)
+{
+ return 2*g + i;
+}
+
+static int __attribute__((noinline))
+foo (int i, int j)
+{
+ if (i > 5)
+ j = 22;
+ return bar (i, j) + 1;
+}
+
+int
+entry (int l, int k)
+{
+ return foo (l, k);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-24.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-24.c
new file mode 100644
index 0000000..7b5bf08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-24.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wmaybe-uninitialized -Werror" } */
+
+int *ttmp_1;
+_Bool pt_ins_tipdo, pq_ins_apd, pq_ins_tt2;
+int gtrphdt;
+
+void pl_ins(int, _Bool, _Bool);
+inline void pt_ins(int *, _Bool apdo) {
+ int list = *ttmp_1;
+ pl_ins(list, apdo, pt_ins_tipdo);
+}
+void pq_ins(int *t) {
+ if (pq_ins_tt2)
+ pt_ins(t, pq_ins_apd);
+}
+int gtr_post_hd() {
+ pq_ins(&gtrphdt);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/modref-1.c b/gcc/testsuite/gcc.dg/ipa/modref-1.c
index 858567d..5314e7d 100644
--- a/gcc/testsuite/gcc.dg/ipa/modref-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/modref-1.c
@@ -10,15 +10,15 @@ void a(char *ptr, char *ptr2)
__attribute__((noinline))
void b(char *ptr)
{
- a(ptr+1,&ptr[2]);
+ a(ptr+1,&ptr[3]);
}
int main()
{
- char c[3]={0,1,0};
+ char c[4]={0,1,0,0};
b(c);
- return c[0]+c[2];
+ return c[0]+c[3];
}
/* Check that both param offsets are determined correctly. */
/* { dg-final { scan-ipa-dump "param offset:1" "modref" } } */
-/* { dg-final { scan-ipa-dump "param offset:2" "modref" } } */
+/* { dg-final { scan-ipa-dump "param offset:3" "modref" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/pr100600.c b/gcc/testsuite/gcc.dg/ipa/pr100600.c
new file mode 100644
index 0000000..8a3d0e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr100600.c
@@ -0,0 +1,22 @@
+/* PR ipa/100600 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a, b, c;
+long d(long x, long e, long f, long g) {
+ long h, i;
+ for (; h < e; h++) {
+ i = f;
+ for (; i < g; i++)
+ c = b + a;
+ }
+ return h + i;
+}
+
+long j(long x, long e, long y, long g) {
+ long h, i;
+ for (; h < e; h++)
+ for (; i < g; i++)
+ c = b + a;
+ return h + i;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr101066.c b/gcc/testsuite/gcc.dg/ipa/pr101066.c
new file mode 100644
index 0000000..1ceb6e4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr101066.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-Os -fno-ipa-cp -fno-inline" } */
+
+int a = 1, c, d, e;
+int *b = &a;
+static int g(int *h) {
+ c = *h;
+ return d;
+}
+static void f(int *h) {
+ e = *h;
+ *b = 0;
+ g(h);
+}
+int main() {
+ f(b);
+ if (c)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr93385.c b/gcc/testsuite/gcc.dg/ipa/pr93385.c
new file mode 100644
index 0000000..6d1d0d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr93385.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-dce -fno-ipa-cp -fno-tree-dce" } */
+
+char a, b;
+
+#ifdef __SIZEOF_INT128__
+#define T unsigned __int128
+#else
+#define T unsigned
+#endif
+
+static inline int
+c (T d)
+{
+ char e = 0;
+ d %= (unsigned) d;
+ e -= 0;
+ __builtin_strncpy (&a, &e, 1);
+ return e + b;
+}
+
+int
+main (void)
+{
+ c (~0);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c b/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c
index 4c40d63..9552b73 100644
--- a/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c
+++ b/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-local-pure-const-details" } */
+/* { dg-options "-O2 -fdump-tree-local-pure-const-details -fdelete-null-pointer-checks" } */
void *foo(int cond1, int cond2, int cond3)
{
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-3.c b/gcc/testsuite/gcc.dg/ipa/remref-3.c
new file mode 100644
index 0000000..8a82ca6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-3.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-cp-details -fdump-tree-optimized" } */
+
+static double global = 0.0;
+
+double foo_temp5;
+
+static void foo(double *ptr) {
+ static double abcd;
+ double v, exp_res;
+ v = *ptr;
+ exp_res = __builtin_exp(v);
+ foo_temp5 = exp_res * abcd;
+ abcd += foo_temp5;
+}
+
+void entry()
+{
+ foo(&global);
+}
+
+/* { dg-final { scan-ipa-dump "Removed a reference" "cp" } } */
+/* { dg-final { scan-tree-dump-not "builtin_exp" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-4.c b/gcc/testsuite/gcc.dg/ipa/remref-4.c
new file mode 100644
index 0000000..5a55437
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-4.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-cp-details -fdump-tree-optimized" } */
+
+static double global = 0.0;
+double foo_temp5;
+
+static void foo(double *ptr) {
+ static double abcd;
+ double v, exp_res;
+ v = *ptr;
+ exp_res = __builtin_exp(v);
+ foo_temp5 = exp_res * abcd;
+ abcd += foo_temp5;
+}
+
+double last_value;
+
+static void bar(double *ptr)
+{
+ last_value = *ptr;
+ foo (ptr);
+}
+
+void entry()
+{
+ bar (&global);
+}
+
+/* { dg-final { scan-ipa-dump "Removed a reference" "cp" } } */
+/* { dg-final { scan-ipa-dump "replaced it with LOAD" "cp" } } */
+/* { dg-final { scan-tree-dump-not "builtin_exp" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-5.c b/gcc/testsuite/gcc.dg/ipa/remref-5.c
new file mode 100644
index 0000000..c520e34
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-5.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-cp-details -fdump-tree-optimized" } */
+
+static double global = 0.0;
+double foo_temp5;
+
+static void foo(double *ptr) {
+ static double abcd;
+ double v, exp_res;
+ v = *ptr;
+ exp_res = __builtin_exp(v);
+ foo_temp5 = exp_res * abcd;
+ abcd += foo_temp5;
+}
+
+double last_value;
+
+static void bar(double *ptr)
+{
+ last_value = *ptr;
+ for (unsigned i = 0; i < 200; i++)
+ foo (ptr);
+}
+
+void entry()
+{
+ bar (&global);
+}
+
+void decoy(double *ptr)
+{
+ bar (ptr);
+}
+
+
+/* { dg-final { scan-ipa-dump "Removed a reference" "cp" } } */
+/* { dg-final { scan-ipa-dump "replaced it with LOAD" "cp" } } */
+/* { dg-final { scan-tree-dump-times "builtin_exp" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-6.c b/gcc/testsuite/gcc.dg/ipa/remref-6.c
new file mode 100644
index 0000000..7deae31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-6.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-early-inlining -fno-ipa-cp -fdump-ipa-inline -fdump-tree-optimized" } */
+
+static double global = 0.0;
+
+double foo_temp5;
+
+static void foo(double *ptr) {
+ static double abcd;
+ double v, exp_res;
+ v = *ptr;
+ exp_res = __builtin_exp(v);
+ foo_temp5 = exp_res * abcd;
+ abcd += foo_temp5;
+}
+
+void entry()
+{
+ foo(&global);
+}
+
+/* { dg-final { scan-ipa-dump "Removed a reference" "inline" } } */
+/* { dg-final { scan-ipa-dump "replaced it with LOAD" "inline" } } */
+/* { dg-final { scan-tree-dump-not "builtin_exp" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/local1.c b/gcc/testsuite/gcc.dg/local1.c
index e9f653b..448c71b 100644
--- a/gcc/testsuite/gcc.dg/local1.c
+++ b/gcc/testsuite/gcc.dg/local1.c
@@ -10,7 +10,7 @@
the later daclaration is the same as the linkage specified at
the prior declaration. If no prior declaration is visible,
or if the prior declaration specifies no linkage, then the
- identifer has external linkage.
+ identifier has external linkage.
This is PR 14366. */
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-2.c b/gcc/testsuite/gcc.dg/loop-unswitch-2.c
index f8d314e..0931f6e 100644
--- a/gcc/testsuite/gcc.dg/loop-unswitch-2.c
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-details" } */
+/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-details -fdisable-tree-thread2 -fdisable-tree-thread3" } */
void foo (float **a, float **b, float *c, int n, int m, int l)
{
diff --git a/gcc/testsuite/gcc.dg/lto/pr101868_0.c b/gcc/testsuite/gcc.dg/lto/pr101868_0.c
new file mode 100644
index 0000000..c84d19b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr101868_0.c
@@ -0,0 +1,33 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options { "-O2 -fno-strict-aliasing -flto" } } */
+
+typedef unsigned long VALUE;
+
+__attribute__ ((cold))
+void rb_check_type(VALUE, int);
+
+static VALUE
+repro(VALUE dummy, VALUE hash)
+{
+ if (hash == 0) {
+ rb_check_type(hash, 1);
+ }
+ else if (*(long *)hash) {
+ rb_check_type(hash, 1);
+ }
+
+
+ return *(long *)hash;
+}
+
+static VALUE (*that)(VALUE dummy, VALUE hash) = repro;
+
+int
+main(int argc, char **argv)
+{
+ argc--;
+ that(0, argc);
+
+ rb_check_type(argc, argc);
+
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr101868_1.c b/gcc/testsuite/gcc.dg/lto/pr101868_1.c
new file mode 100644
index 0000000..146c14a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr101868_1.c
@@ -0,0 +1,23 @@
+typedef unsigned long VALUE;
+
+
+__attribute__ ((noreturn)) void rexc_raise(VALUE mesg);
+
+VALUE rb_donothing(VALUE klass);
+
+static void
+funexpected_type(VALUE x, int xt, int t)
+{
+ rexc_raise(rb_donothing(0));
+}
+
+__attribute__ ((cold))
+void
+rb_check_type(VALUE x, int t)
+{
+ int xt;
+
+ if (x == 0) {
+ funexpected_type(x, xt, t);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr101868_2.c b/gcc/testsuite/gcc.dg/lto/pr101868_2.c
new file mode 100644
index 0000000..e6f01b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr101868_2.c
@@ -0,0 +1,11 @@
+typedef unsigned long VALUE;
+
+static void thing(void) {}
+static void (*ptr)(void) = &thing;
+
+VALUE
+rb_donothing(VALUE klass)
+{
+ ptr();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr101868_3.c b/gcc/testsuite/gcc.dg/lto/pr101868_3.c
new file mode 100644
index 0000000..6121762
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr101868_3.c
@@ -0,0 +1,8 @@
+typedef unsigned long VALUE;
+
+__attribute__((noreturn))
+void
+rexc_raise(VALUE mesg)
+{
+ __builtin_exit(0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr101949_0.c b/gcc/testsuite/gcc.dg/lto/pr101949_0.c
new file mode 100644
index 0000000..142dffe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr101949_0.c
@@ -0,0 +1,20 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options { "-O2 -fipa-pta -flto -flto-partition=1to1" } } */
+
+extern int bar (int (*)(int *), int *);
+
+static int x;
+
+static int __attribute__ ((noinline)) foo (int *p)
+{
+ *p = 1;
+ x = 0;
+ return *p;
+}
+
+int main ()
+{
+ if (bar (foo, &x) != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr101949_1.c b/gcc/testsuite/gcc.dg/lto/pr101949_1.c
new file mode 100644
index 0000000..871d15c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr101949_1.c
@@ -0,0 +1,4 @@
+int __attribute__((noinline,noclone)) bar (int (*fn)(int *), int *p)
+{
+ return fn (p);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr48622_1.c b/gcc/testsuite/gcc.dg/lto/pr48622_1.c
new file mode 100644
index 0000000..4d05bae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr48622_1.c
@@ -0,0 +1,6 @@
+/* { dg-options "-fno-lto" } */
+
+typedef unsigned int u8 __attribute__ ((mode (QI)));
+u8 ashift_qi_1 (u8)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr99849_0.c b/gcc/testsuite/gcc.dg/lto/pr99849_0.c
new file mode 100644
index 0000000..d489cee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr99849_0.c
@@ -0,0 +1,23 @@
+/* PR lto/99849 */
+/* { dg-lto-do link } */
+/* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target shared } */
+/* { dg-extra-ld-options { -shared } } */
+/* { dg-lto-options { { -flto -flto-partition=1to1 -O2 -Wno-incompatible-pointer-types -Wno-discarded-qualifiers -fPIC } } } */
+
+struct { struct A *a; } *b;
+struct B { int *b; };
+struct C { int *c; };
+const struct D { struct C d; } d;
+struct A { struct { struct C e; }; };
+struct E { void *e; } e = { &( &(const struct D) { (void *) &d })->d };
+struct C f = { &( &(const struct D) { (void *) &d })->d };
+struct A g[] = { &e, &f };
+void foo () { b->a = g; }
+struct E h = { foo };
+void bar ();
+int baz () { bar (h); }
+struct B i = { (int *) baz };
+void qux ();
+void corge () { qux (i); }
+void *j __attribute__((__used__)) = corge;
diff --git a/gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-2.c b/gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-2.c
new file mode 100644
index 0000000..2e93ee5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-2.c
@@ -0,0 +1,15 @@
+/* { dg-require-effective-target global_constructor } */
+/* { dg-options "-O2 -fprofile-generate -fprofile-update=single -fdump-tree-optimized" } */
+
+__attribute__ ((no_profile_instrument_function))
+int foo()
+{
+ return 0;
+}
+
+int bar()
+{
+ return foo();
+}
+
+/* { dg-final { scan-tree-dump-not " = foo \\(\\)" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/nonnull-6.c b/gcc/testsuite/gcc.dg/nonnull-6.c
new file mode 100644
index 0000000..8f36870
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/nonnull-6.c
@@ -0,0 +1,15 @@
+/* PR c/100783 - ICE on -Wnonnull and erroneous type
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+__attribute__((nonnull (1))) void
+f1 (char[][n]); // { dg-error "undeclared" }
+
+__attribute__((nonnull (2))) void
+f2 (int n, char[n][m]); // { dg-error "undeclared" }
+
+__attribute__((nonnull (1))) void
+f3 (char[*][n]); // { dg-error "undeclared" }
+
+__attribute__((nonnull (1))) void
+f4 (char[f1]); // { dg-error "size" }
diff --git a/gcc/testsuite/gcc.dg/old-style-asm-1.c b/gcc/testsuite/gcc.dg/old-style-asm-1.c
index 8af0077..f9406ff0 100644
--- a/gcc/testsuite/gcc.dg/old-style-asm-1.c
+++ b/gcc/testsuite/gcc.dg/old-style-asm-1.c
@@ -1,6 +1,9 @@
/* PR inline-asm/8832 */
/* { dg-do compile } */
-/* { dg-options "-O2 -dP" } */
+/* { dg-options "-O2 -dP -fdisable-tree-ethread -fdisable-tree-thread1 -fdisable-tree-thread2 -fdisable-tree-thread3 -fdisable-tree-thread4" } */
+
+/* Note: Threader will duplicate BBs and replace one conditional branch by an
+ unconditional one. */
/* Verify that GCC doesn't optimize
old style asm instructions. */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c
index a4a3a79..56a2071b 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
/* { dg-require-effective-target stdint_types } */
-/* { dg-options "-O2 -fdump-tree-bswap" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-additional-options "-mzarch" { target s390*-*-* } } */
#include <stdint.h>
@@ -58,4 +58,4 @@ swap64_c (uint64_t x)
}
-/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 3 "bswap" } } */
+/* { dg-final { scan-tree-dump-times "= __builtin_bswap64 \\\(" 3 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c b/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c
index 89b251f..c6d9604 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
/* { dg-require-effective-target stdint_types } */
-/* { dg-options "-O2 -fdump-tree-bswap" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-additional-options "-mzarch" { target s390*-*-* } } */
#include <stdint.h>
@@ -23,4 +23,4 @@ swap64_c (uint64_t x)
}
-/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 1 "bswap" } } */
+/* { dg-final { scan-tree-dump-times "= __builtin_bswap64 \\\(" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c
index c403d04..2d24f43 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
/* { dg-require-effective-target stdint_types } */
-/* { dg-options "-O2 -fdump-tree-bswap" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-additional-options "-march=z900" { target s390*-*-* } } */
#include <stdint.h>
@@ -89,4 +89,4 @@ swap32_f (unsigned in)
return in;
}
-/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 6 "bswap" } } */
+/* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 6 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c
index 9418a83..7cd1b40 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
/* { dg-require-effective-target stdint_types } */
-/* { dg-options "-O2 -fdump-tree-bswap" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-additional-options "-march=z900" { target s390-*-* } } */
typedef int SItype __attribute__ ((mode (SI)));
@@ -20,4 +20,4 @@ swap32 (SItype in)
| (((in >> 24) & 0xFF) << 0);
}
-/* { dg-final { scan-tree-dump-not "32 bit bswap implementation found at" "bswap" } } */
+/* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
index b4d8b9a..91a5284 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
-/* { dg-options "-O2 -fdump-tree-bswap -fno-inline-functions" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fno-inline-functions" } */
/* { dg-additional-options "-march=z900" { target s390-*-* } } */
struct L { unsigned int l[2]; };
@@ -28,4 +28,4 @@ bar (double a, struct L *p)
foo (a, p);
}
-/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 2 "bswap" } } */
+/* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 2 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
new file mode 100644
index 0000000..3c089b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
@@ -0,0 +1,38 @@
+/* PR tree-optimization/42587 */
+/* { dg-do compile } */
+/* { dg-require-effective-target bswap } */
+/* { dg-options "-O2 -fdump-tree-store-merging" } */
+/* { dg-additional-options "-march=z900" { target s390-*-* } } */
+
+typedef unsigned char u8;
+typedef unsigned int u32;
+union __anonunion_out_195
+{
+ u32 value;
+ u8 bytes[4];
+};
+union __anonunion_in_196
+{
+ u32 value;
+ u8 bytes[4];
+};
+extern void acpi_ut_track_stack_ptr (void);
+u32 acpi_ut_dword_byte_swap (u32 value);
+u32
+acpi_ut_dword_byte_swap (u32 value)
+{
+ union __anonunion_out_195 out;
+ union __anonunion_in_196 in;
+
+ {
+ acpi_ut_track_stack_ptr ();
+ in.value = value;
+ out.bytes[0] = in.bytes[3];
+ out.bytes[1] = in.bytes[2];
+ out.bytes[2] = in.bytes[1];
+ out.bytes[3] = in.bytes[0];
+ return (out.value);
+ }
+}
+
+/* { dg-final { scan-tree-dump "32 bit bswap implementation found at" "store-merging" } } */
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.c b/gcc/testsuite/gcc.dg/pch/valid-1.c
index d445c47..6e9abda 100644
--- a/gcc/testsuite/gcc.dg/pch/valid-1.c
+++ b/gcc/testsuite/gcc.dg/pch/valid-1.c
@@ -1,7 +1,7 @@
/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g" } */
-#include "valid-1.h"/* { dg-warning "created with -gnone, but used with -g" } */
+#include "valid-1.h"/* { dg-warning "created with .none. debug info, but used with" } */
/* { dg-error "No such file" "no such file" { target *-*-* } 0 } */
/* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */
/* { dg-message "terminated" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
index 05133d5..61dd490 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
@@ -53,13 +53,6 @@ public:
const supernode *node,
const gimple *stmt) const FINAL OVERRIDE;
- void on_condition (sm_context *sm_ctxt,
- const supernode *node,
- const gimple *stmt,
- tree lhs,
- enum tree_code op,
- tree rhs) const FINAL OVERRIDE;
-
bool can_purge_p (state_t s) const FINAL OVERRIDE;
void check_for_pyobject_usage_without_gil (sm_context *sm_ctxt,
@@ -365,20 +358,6 @@ gil_state_machine::on_stmt (sm_context *sm_ctxt,
return false;
}
-/* Implementation of state_machine::on_condition vfunc for
- gil_state_machine. */
-
-void
-gil_state_machine::on_condition (sm_context *sm_ctxt ATTRIBUTE_UNUSED,
- const supernode *node ATTRIBUTE_UNUSED,
- const gimple *stmt ATTRIBUTE_UNUSED,
- tree lhs ATTRIBUTE_UNUSED,
- enum tree_code op ATTRIBUTE_UNUSED,
- tree rhs ATTRIBUTE_UNUSED) const
-{
- // Empty
-}
-
bool
gil_state_machine::can_purge_p (state_t s ATTRIBUTE_UNUSED) const
{
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c
index 71e6740..ac72503 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c
@@ -115,6 +115,8 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
+ global_dc->caret_max_width = 80;
+
register_callback (plugin_name,
PLUGIN_PRE_GENERICIZE,
callback,
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
index 49b78cc..d2bfca0 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
@@ -133,7 +133,7 @@ test_inlining (gimple *stmt)
return;
}
- warning_at (call->location, 0, "%G%s", call,
+ warning_at (call->location, 0, "%s",
TREE_STRING_POINTER (t_string));
}
@@ -169,6 +169,8 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
+ global_dc->caret_max_width = 80;
+
pass_info.pass = new pass_test_inlining (g);
pass_info.reference_pass_name = "*warn_function_noreturn";
pass_info.ref_pass_instance_number = 1;
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
index 7672875..5c2da02 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
@@ -450,6 +450,8 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
+ global_dc->caret_max_width = 80;
+
pass_info.pass = make_pass_test_show_path (g);
pass_info.reference_pass_name = "whole-program";
pass_info.ref_pass_instance_number = 1;
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
index cf99697..aa73dca 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
@@ -208,6 +208,8 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
+ global_dc->caret_max_width = 80;
+
pass_info.pass = new pass_test_string_literals (g);
pass_info.reference_pass_name = "ssa";
pass_info.ref_pass_instance_number = 1;
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
index 89cc95a..4a89d84 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
@@ -89,6 +89,8 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
+ global_dc->caret_max_width = 130;
+
register_callback (plugin_name,
PLUGIN_PRE_GENERICIZE,
callback,
diff --git a/gcc/testsuite/gcc.dg/pointer-array-quals-1.c b/gcc/testsuite/gcc.dg/pointer-array-quals-1.c
index 921a37e..498ab22 100644
--- a/gcc/testsuite/gcc.dg/pointer-array-quals-1.c
+++ b/gcc/testsuite/gcc.dg/pointer-array-quals-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* Origin: Martin Uecker <uecker@eecs.berkeley.edu> */
-/* { dg-options "-Wdiscarded-array-qualifiers" } */
+/* { dg-options "" } */
void tvoid(void* x);
void transpose0(double* out, const double* in) { }
void transpose1(double out[2][2], const double in[2][2]) { }
diff --git a/gcc/testsuite/gcc.dg/pointer-array-quals-2.c b/gcc/testsuite/gcc.dg/pointer-array-quals-2.c
index 30689c7..4c95d8a 100644
--- a/gcc/testsuite/gcc.dg/pointer-array-quals-2.c
+++ b/gcc/testsuite/gcc.dg/pointer-array-quals-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-Wdiscarded-array-qualifiers -pedantic-errors" } */
+/* { dg-options "-pedantic-errors" } */
/* Origin: Martin Uecker <uecker@eecs.berkeley.edu> */
void tvoid(void* x);
void transpose0(double* out, const double* in) { }
diff --git a/gcc/testsuite/gcc.dg/pr100142.c b/gcc/testsuite/gcc.dg/pr100142.c
new file mode 100644
index 0000000..aec146c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100142.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fpreprocessed" } */
+
+void
+foo (void)
+{
+ assert (1); /* { dg-warning "implicit" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr100225.c b/gcc/testsuite/gcc.dg/pr100225.c
new file mode 100644
index 0000000..b321634
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100225.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/100225 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fmodulo-sched" } */
+
+void
+vorbis_synthesis_lapout (void);
+
+void
+ov_info (int **lappcm, int ov_info_i)
+{
+ while (ov_info_i < 1)
+ lappcm[ov_info_i++] = __builtin_alloca (1);
+
+ vorbis_synthesis_lapout ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr100239.c b/gcc/testsuite/gcc.dg/pr100239.c
new file mode 100644
index 0000000..1ade810
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100239.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/100239 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+typedef short __attribute__((__vector_size__ (8 * sizeof (short)))) V;
+V v, w;
+
+void
+foo (void)
+{
+ w = __builtin_shuffle (v != v, 0 < (V) {}, (V) {192} >> 5);
+}
diff --git a/gcc/testsuite/gcc.dg/pr100292.c b/gcc/testsuite/gcc.dg/pr100292.c
new file mode 100644
index 0000000..675a60c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100292.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+typedef unsigned char __attribute__((__vector_size__ (4))) V;
+
+extern void bar (V v);
+
+void
+foo (char c)
+{
+ bar (c <= (V) 127);
+}
diff --git a/gcc/testsuite/gcc.dg/pr100349.c b/gcc/testsuite/gcc.dg/pr100349.c
new file mode 100644
index 0000000..dd7977a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100349.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -w" }
+
+#include <stdint.h>
+uint8_t a;
+b(int8_t c) {
+ int d;
+e:
+ uint32_t f;
+ for (;;)
+ for (c = 10; c; c++)
+ if (0 > (a = c) ?: d) {
+ f = a;
+ goto e;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr100373.c b/gcc/testsuite/gcc.dg/pr100373.c
new file mode 100644
index 0000000..d4cd52a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100373.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+int a;
+_Thread_local int b;
+void c()
+{
+ long d = b;
+ a = 0;
+ b = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr100414.c b/gcc/testsuite/gcc.dg/pr100414.c
new file mode 100644
index 0000000..7876f6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100414.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-dce -fno-tree-dse -fchecking" } */
+
+int i;
+void
+foo (void)
+{
+ i &= i && __builtin_bswap16 (i);
+}
diff --git a/gcc/testsuite/gcc.dg/pr100464.c b/gcc/testsuite/gcc.dg/pr100464.c
new file mode 100644
index 0000000..46cc37df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100464.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcompare-debug" } */
+
+int *a;
+static int b, c, d, e, g, h;
+int f;
+void i() {
+ int *j[] = {&e, &b, &b, &d, &b, &b, &g, &e, &g, &b, &b,
+ &b, &b, &g, &e, &e, &b, &b, &d, &b, &b, &e,
+ &e, &g, &b, &b, &b, &b, &g, &e, &g, &c, &e};
+ int **k = &j[5];
+ for (; f;)
+ b |= *a;
+ *k = &h;
+}
+int main() {}
diff --git a/gcc/testsuite/gcc.dg/pr100509.c b/gcc/testsuite/gcc.dg/pr100509.c
new file mode 100644
index 0000000..9405e2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100509.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+struct X {
+ int a;
+};
+const int a = 0;
+static struct X A __attribute__((alias("a")));
+void foo() { struct X b = A; }
diff --git a/gcc/testsuite/gcc.dg/pr100512.c b/gcc/testsuite/gcc.dg/pr100512.c
new file mode 100644
index 0000000..70b90e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100512.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+
+#include <stdint.h>
+int a;
+void b() {
+ int16_t *c;
+ uint16_t d = 2;
+ if (0 == d) {
+ uint64_t e;
+ uint64_t *f = &e;
+ for (;;) {
+ if (e += 0 >= 0)
+ for (;;)
+ ;
+ g:
+ for (; a;) {
+ int16_t i = &d;
+ *c = i && *f;
+ }
+ }
+ }
+ goto g;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr100521.c b/gcc/testsuite/gcc.dg/pr100521.c
new file mode 100644
index 0000000..fd9f0db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100521.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+__builtin_clz (int a)
+{
+ return __builtin_clz(a);
+}
diff --git a/gcc/testsuite/gcc.dg/pr100547.c b/gcc/testsuite/gcc.dg/pr100547.c
new file mode 100644
index 0000000..2d3da4e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100547.c
@@ -0,0 +1,35 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O -g" } */
+
+typedef int __attribute__((vector_size(
+ ((((((((((((((((((((((((((((((8 * sizeof(short)) * sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)) *
+ sizeof(short)))) V; /* { dg-error "number of vector components" } */
+void k() { V w = { 0 }; }
diff --git a/gcc/testsuite/gcc.dg/pr100563.c b/gcc/testsuite/gcc.dg/pr100563.c
new file mode 100644
index 0000000..f6a5fcd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100563.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-Og -Wno-pointer-to-int-cast" } */
+unsigned long long e(void);
+void f(int);
+void a() {
+ short b = -1, c = (int)&b;
+ unsigned long long d = e();
+ f(b >= d);
+}
diff --git a/gcc/testsuite/gcc.dg/pr100590.c b/gcc/testsuite/gcc.dg/pr100590.c
new file mode 100644
index 0000000..5cd3687
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100590.c
@@ -0,0 +1,13 @@
+/* PR rtl-optimization/100590 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-dce -w" } */
+
+int
+foo (void)
+{
+ int x;
+ asm goto ("" : "+r" (x) : : : lab);
+ return 0;
+ lab:
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.dg/pr100619.c b/gcc/testsuite/gcc.dg/pr100619.c
new file mode 100644
index 0000000..5df02bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100619.c
@@ -0,0 +1,24 @@
+/* PR c/100619 - ICE on a VLA parameter with too many dimensions
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+extern int n;
+
+#define A10 [n][n][n][n][n][n][n][n][n][n]
+#define A100 A10 A10 A10 A10 A10 A10 A10 A10 A10 A10 A10
+#define A1000 A100 A100 A100 A100 A100 A100 A100 A100 A100 A100 A100
+
+void f10 (int A10);
+void f10 (int A10);
+
+void f100 (int A100);
+void f100 (int A100);
+
+void f1000 (int A1000);
+void f1000 (int A1000);
+
+void fx_1000 (int [ ]A1000);
+void fx_1000 (int [1]A1000); // { dg-warning "-Warray-parameter" }
+
+void fn_1000 (int [n ]A1000);
+void fn_1000 (int [n + 1]A1000); // { dg-warning "-Wvla-parameter" }
diff --git a/gcc/testsuite/gcc.dg/pr100781.c b/gcc/testsuite/gcc.dg/pr100781.c
new file mode 100644
index 0000000..c0e008a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100781.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 --param=evrp-mode=ranger -fcompare-debug " } */
+
+struct a {
+ int b;
+};
+long c(short d, long e, struct a f) {
+g:;
+ int h = f.b <= e, i = d, n = h >= d;
+ if (!n)
+ goto j;
+ goto k;
+j:;
+ long l = 5;
+ if (l)
+ goto m;
+ d = 0;
+m:
+ if (d)
+ return f.b;
+k:
+ goto g;
+}
+int main() { }
+
diff --git a/gcc/testsuite/gcc.dg/pr100788.c b/gcc/testsuite/gcc.dg/pr100788.c
new file mode 100644
index 0000000..6f510ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100788.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "--coverage -Wno-error=coverage-invalid-line-number" } */
+
+void
+foo() // { dg-warning "function starts on a higher line number than it ends" }
+{
+#line 1
+}
+
+int main()
+{
+ foo ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr100790.c b/gcc/testsuite/gcc.dg/pr100790.c
new file mode 100644
index 0000000..31e0eff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100790.c
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-O2 -w" }
+
+__builtin_clz(int x) { x ? __builtin_clz(x) : 32; }
diff --git a/gcc/testsuite/gcc.dg/pr100791.c b/gcc/testsuite/gcc.dg/pr100791.c
new file mode 100644
index 0000000..96cf34f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100791.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+static inline int __attribute__((__always_inline__))
+foo ()
+{
+ return log_bad_request(0, __builtin_va_arg_pack()); /* { dg-warning "implicit" } */
+}
+void log_bad_request() { foo (0); } /* { dg-warning "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/pr100887.c b/gcc/testsuite/gcc.dg/pr100887.c
new file mode 100644
index 0000000..027025f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100887.c
@@ -0,0 +1,14 @@
+/* PR target/100887 */
+/* { dg-do compile } */
+/* { dg-options "-Wno-psabi -w" } */
+/* { dg-additional-options "-mavx512f" { target { i?86-*-* x86_64-*-* } } } */
+
+typedef unsigned long long __attribute__((__vector_size__ (2 * sizeof (long long)))) U;
+typedef unsigned long long __attribute__((__vector_size__ (4 * sizeof (long long)))) V;
+typedef unsigned long long __attribute__((__vector_size__ (8 * sizeof (long long)))) W;
+
+U
+foo (V v)
+{
+ return __builtin_shufflevector ((W){}, v, 0, 8);
+}
diff --git a/gcc/testsuite/gcc.dg/pr101008.c b/gcc/testsuite/gcc.dg/pr101008.c
new file mode 100644
index 0000000..c06208d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101008.c
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/101008 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+typedef unsigned __attribute__((__vector_size__(32))) U;
+typedef unsigned __attribute__((__vector_size__(16))) V;
+
+int c, r;
+
+V v;
+
+void
+foo(void)
+{
+ U u = __builtin_shufflevector (v, (V)(v != c) | (V)(c == v),
+ 4, 3, 5, 5, 1, 2, 3, 0);
+ r = ((union { U a; int b; }) u).b;
+}
diff --git a/gcc/testsuite/gcc.dg/pr101028.c b/gcc/testsuite/gcc.dg/pr101028.c
new file mode 100644
index 0000000..501e6af
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101028.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+typedef struct {
+ double x, y;
+} PointInfo;
+
+typedef struct {
+ PointInfo point;
+} PrimitiveInfo;
+
+int TraceBezier_alpha, TraceBezier_i;
+double TraceBezier_weight;
+PointInfo *TraceBezier_points;
+PrimitiveInfo *TraceBezier_primitive_info;
+
+void TracePath() {
+ double *coefficients;
+ PointInfo point;
+ long j;
+ for (; TraceBezier_i; TraceBezier_i++) {
+ point.x = point.y = TraceBezier_alpha = 1.0;
+ j = 0;
+ for (; j < 4; j++) {
+ point.x += TraceBezier_alpha * coefficients[j] *
+ TraceBezier_primitive_info->point.x;
+ point.y += TraceBezier_alpha * TraceBezier_primitive_info->point.y;
+ TraceBezier_alpha *= TraceBezier_weight;
+ TraceBezier_primitive_info++;
+ }
+ TraceBezier_points[TraceBezier_i] = point;
+ TraceBezier_weight += 1.0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr101062.c b/gcc/testsuite/gcc.dg/pr101062.c
new file mode 100644
index 0000000..6c37ed8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101062.c
@@ -0,0 +1,29 @@
+/* PR middle-end/101062 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-toplevel-reorder -frename-registers" } */
+
+union U { signed b : 5; };
+int c;
+volatile union U d[7] = { { 8 } };
+short e = 1;
+
+__attribute__((noipa)) void
+foo ()
+{
+ d[6].b = 0;
+ d[6].b = 0;
+ d[6].b = 0;
+ d[6].b = 0;
+ d[6].b = 0;
+ e = 0;
+ c = 0;
+}
+
+int
+main ()
+{
+ foo ();
+ if (e != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr101156.c b/gcc/testsuite/gcc.dg/pr101156.c
new file mode 100644
index 0000000..5c25bd7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101156.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fchecking" } */
+
+struct S { int i; };
+void baz(struct S *p)
+{
+ __builtin_setjmp(p--);
+}
diff --git a/gcc/testsuite/gcc.dg/pr101170.c b/gcc/testsuite/gcc.dg/pr101170.c
new file mode 100644
index 0000000..fc81062
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101170.c
@@ -0,0 +1,37 @@
+/* PR middle-end/101170 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+#include <stdarg.h>
+
+struct S { int a; int b[4]; } s;
+va_list ap;
+int i;
+long long l;
+
+struct S
+foo (int x)
+{
+ struct S a = {};
+ do
+ if (x)
+ return a;
+ while (1);
+}
+
+__attribute__((noipa)) void
+bar (void)
+{
+ for (; i; i++)
+ l |= va_arg (ap, long long) << s.b[i];
+ if (l)
+ foo (l);
+}
+
+void
+baz (int v, ...)
+{
+ va_start (ap, v);
+ bar ();
+ va_end (ap);
+}
diff --git a/gcc/testsuite/gcc.dg/pr101171.c b/gcc/testsuite/gcc.dg/pr101171.c
new file mode 100644
index 0000000..8d2bcab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101171.c
@@ -0,0 +1,13 @@
+/* PR c/101171 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+extern void foo (void);
+int x = 0x1234;
+
+void
+bar (void)
+{
+ if (x != (sizeof ((enum T) 0x1234))) /* { dg-error "conversion to incomplete type" } */
+ foo ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr101172.c b/gcc/testsuite/gcc.dg/pr101172.c
new file mode 100644
index 0000000..b9d098b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101172.c
@@ -0,0 +1,20 @@
+/* PR middle-end/101172 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+union U
+{
+ int a[3];
+ struct
+ {
+ int a : 3;
+ struct this_struct var; /* { dg-error "field 'var' has incomplete type" } */
+ } b;
+};
+
+const union U hello = {.a = {1, 2, 3}};
+
+void foo()
+{
+ int x = hello.b.a;
+}
diff --git a/gcc/testsuite/gcc.dg/pr101223.c b/gcc/testsuite/gcc.dg/pr101223.c
new file mode 100644
index 0000000..6d5a247
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101223.c
@@ -0,0 +1,44 @@
+/* PR tree-optimization/101223 */
+/* { dg-do run } */
+/* { dg-options "-O2 " } */
+
+struct {
+ int a : 1;
+} b;
+int c = 1, d;
+int foo1() {
+ for (; d < 2; d++) {
+ int e = ~c, f = 0, g;
+ if (e) {
+ f = c;
+ g = b.a;
+ b.a = f;
+ if (b.a >= g)
+ __builtin_abort();
+ }
+ c = f;
+ b.a = g;
+ }
+ return 0;
+}
+
+int foo2() {
+ for (; d < 2; d++) {
+ int e = ~c, f = 0, g;
+ if (e) {
+ f = c;
+ g = b.a;
+ b.a = f;
+ if (g <= b.a)
+ __builtin_abort();
+ }
+ c = f;
+ b.a = g;
+ }
+ return 0;
+}
+int main ()
+{
+ return foo1() + foo2();
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr101254.c b/gcc/testsuite/gcc.dg/pr101254.c
new file mode 100644
index 0000000..b2460ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101254.c
@@ -0,0 +1,27 @@
+/* PR tree-optimization/101254 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fwrapv" } */
+
+int
+foo (long long imin, long long imax)
+{
+ if (imin > imax)
+ return 0;
+ else if (imax - imin < 0 || (imax - imin) + 1 < 0)
+ return 0;
+ return 1;
+}
+
+int
+main ()
+{
+ long long imax = __LONG_LONG_MAX__;
+ long long imin = -imax - 1;
+ if (!foo (-10, 10))
+ __builtin_abort ();
+ if (foo (-10, imax))
+ __builtin_abort ();
+ if (foo (imin, imax))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr101266.c b/gcc/testsuite/gcc.dg/pr101266.c
new file mode 100644
index 0000000..d198089
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101266.c
@@ -0,0 +1,8 @@
+/* PR debug/101266 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+
+void
+foo (int (*p)[(int){1}])
+{
+}
diff --git a/gcc/testsuite/gcc.dg/pr101294.c b/gcc/testsuite/gcc.dg/pr101294.c
new file mode 100644
index 0000000..ca59b35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101294.c
@@ -0,0 +1,15 @@
+/* PR middle-end/101294 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+/* { dg-additional-options "-mavx" { target avx } } */
+
+typedef __attribute__((__vector_size__ (sizeof (unsigned long long)))) unsigned long long U;
+typedef __attribute__((__vector_size__ (4 * sizeof (unsigned long long)))) unsigned long long V;
+
+extern U x;
+
+void
+foo (void)
+{
+ x = __builtin_shufflevector ((U){}, (V){}, 3);
+}
diff --git a/gcc/testsuite/gcc.dg/pr101384.c b/gcc/testsuite/gcc.dg/pr101384.c
new file mode 100644
index 0000000..7030c0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101384.c
@@ -0,0 +1,39 @@
+/* PR target/101384 */
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-psabi -w" } */
+
+typedef unsigned char __attribute__((__vector_size__ (16))) U;
+typedef unsigned short __attribute__((__vector_size__ (8 * sizeof (short)))) V;
+
+U u;
+V v;
+
+__attribute__((noipa)) U
+foo (void)
+{
+ U y = (U) { 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff,
+ 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff } + u;
+ return y;
+}
+
+__attribute__((noipa)) V
+bar (void)
+{
+ V y = (V) { 0x8000, 0xffff, 0x8000, 0xffff,
+ 0x8000, 0xffff, 0x8000, 0xffff } + v;
+ return y;
+}
+
+int
+main ()
+{
+ U x = foo ();
+ for (unsigned i = 0; i < 16; i++)
+ if (x[i] != ((i & 3) ? 0xff : 0x80))
+ __builtin_abort ();
+ V y = bar ();
+ for (unsigned i = 0; i < 8; i++)
+ if (y[i] != ((i & 1) ? 0xffff : 0x8000))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr101403.c b/gcc/testsuite/gcc.dg/pr101403.c
new file mode 100644
index 0000000..88df112
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101403.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+unsigned int foo (unsigned int a)
+{
+ unsigned int u = 0;
+ unsigned short b = __builtin_bswap16 (a);
+ return b >> (u, 12);
+}
+
+int main (void)
+{
+ unsigned int x = foo (0x80);
+ if (x != 0x0008)
+ __builtin_abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr101419.c b/gcc/testsuite/gcc.dg/pr101419.c
new file mode 100644
index 0000000..2cce383
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101419.c
@@ -0,0 +1,62 @@
+/* PR tree-optimization/101419 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef __SIZE_TYPE__ size_t;
+void baz (int, int) __attribute__((__warning__("detected overflow")));
+
+union U {
+ int i;
+ char c;
+};
+
+static void
+foo (union U *u)
+{
+ if (__builtin_object_size (&u->c, 1) < sizeof (u->c))
+ baz (__builtin_object_size (&u->c, 1), sizeof (u->c)); /* { dg-bogus "detected overflow" } */
+ __builtin_memset (&u->c, 0, sizeof (u->c));
+
+ if (__builtin_object_size (&u->i, 1) < sizeof (u->i))
+ baz (__builtin_object_size (&u->i, 1), sizeof (u->i)); /* { dg-bogus "detected overflow" } */
+ __builtin_memset (&u->i, 0, sizeof (u->i));
+}
+
+void
+bar (union U *u)
+{
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ foo (u);
+ for (j = 0; j < 2; j++)
+ asm volatile ("");
+ }
+}
+
+static void
+qux (void *p, size_t q)
+{
+ if (__builtin_object_size (p, 1) < q)
+ baz (__builtin_object_size (p, 1), q); /* { dg-bogus "detected overflow" } */
+ __builtin_memset (p, 0, q);
+}
+
+static void
+corge (union U *u)
+{
+ qux (&u->c, sizeof (u->c));
+ qux (&u->i, sizeof (u->i));
+}
+
+void
+garply (union U *u)
+{
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ corge (u);
+ for (j = 0; j < 2; j++)
+ asm volatile ("");
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr101496.c b/gcc/testsuite/gcc.dg/pr101496.c
new file mode 100644
index 0000000..091d4ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101496.c
@@ -0,0 +1,22 @@
+/* PR tree-optimization/101496 */
+/* { dg-do compile } */
+/* { dg-options "-O2 " } */
+
+int c_1, li_2, us_3, func_14_s_5;
+
+void func_14() {
+ {
+ unsigned uli_8 = 0;
+ lbl1806324B:
+ if (uli_8 /= us_3 |= func_14_s_5 < 0 | func_14_s_5 != c_1) {
+ uli_8 += c_1 >= us_3;
+ if (uli_8)
+ ;
+ else
+ li_2 &&func_14_s_5 <= c_1 ?: 0;
+ unsigned *ptr_9 = &uli_8;
+ }
+ }
+ goto lbl1806324B;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr101497.c b/gcc/testsuite/gcc.dg/pr101497.c
new file mode 100644
index 0000000..fcfe059
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101497.c
@@ -0,0 +1,13 @@
+/* PR tree-optimization/101497 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wno-div-by-zero" } */
+
+char uc_1;
+int i_4, func_12_uli_6;
+void func_12() {
+ int *ptr_8 = &func_12_uli_6;
+ *ptr_8 = 0 >= 211 - uc_1 <= 0;
+ i_4 %= 0;
+ i_4 *= *ptr_8;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr101741.c b/gcc/testsuite/gcc.dg/pr101741.c
new file mode 100644
index 0000000..6587dca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101741.c
@@ -0,0 +1,16 @@
+/* PR tree-optimization/101741 */
+/* { dg-do compile } */
+/* { dg-options "-O2 " } */
+
+int
+foo (void);
+
+unsigned int
+toupper (int c)
+{
+ c = foo ();
+ while (c)
+ c = toupper (c);
+
+ return c;
+}
diff --git a/gcc/testsuite/gcc.dg/pr101858.c b/gcc/testsuite/gcc.dg/pr101858.c
new file mode 100644
index 0000000..61fcca6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101858.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+int foo(int a)
+{
+ if (a < (int*)((__INTPTR_TYPE__)1 << a))
+ a = 0;
+ return a;
+}
diff --git a/gcc/testsuite/gcc.dg/pr101938.c b/gcc/testsuite/gcc.dg/pr101938.c
new file mode 100644
index 0000000..8277755
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101938.c
@@ -0,0 +1,28 @@
+// { dg-do run }
+// { dg-require-effective-target lp64 }
+// { dg-options "-O2 -fwrapv" }
+
+typedef long long int int64;
+#define INT64CONST(x) (x##LL)
+/* -9223372036854775808ULL */
+#define INT64_MIN (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)
+
+static void __attribute__((noipa)) foo(int64 arg1, int64 arg2) {
+ int64 a1 = -arg1;
+ int64 a2 = (arg2 < 0) ? arg2 : -arg2;
+
+ if (a1 > a2) {
+ int64 swap = arg1;
+ arg1 = arg2;
+ arg2 = swap;
+ }
+
+ if (arg1 == INT64_MIN && arg2 == -1) return;
+
+ __builtin_abort();
+}
+
+int main() {
+ foo(-1, INT64_MIN);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr102141.c b/gcc/testsuite/gcc.dg/pr102141.c
new file mode 100644
index 0000000..f3fc8d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102141.c
@@ -0,0 +1,11 @@
+/* PR tree-optimization/102141 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+unsigned int __attribute__((__vector_size__ (4))) v;
+
+void
+foo (unsigned long long x)
+{
+ v &= (unsigned) (x >> 56 | x >> 40 & 0xff00);
+}
diff --git a/gcc/testsuite/gcc.dg/pr102152.c b/gcc/testsuite/gcc.dg/pr102152.c
new file mode 100644
index 0000000..4e0c1f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102152.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-loop-vectorize -fno-tree-fre" } */
+/* { dg-additional-options "-march=armv8-a+sve" { target aarch64-*-* } } */
+
+
+
+signed char i;
+
+void
+foo (void)
+{
+ for (i = 0; i < 6; i += 5)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/pr102207.c b/gcc/testsuite/gcc.dg/pr102207.c
new file mode 100644
index 0000000..08540d0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102207.c
@@ -0,0 +1,24 @@
+/* PR tree-optimization/102207 */
+/* { dg-do run { target int128 } } */
+/* { dg-options "-O2" } */
+
+typedef unsigned __int128 u128;
+
+u128
+foo (unsigned short a)
+{
+ u128 g;
+ __builtin_sub_overflow ((unsigned long long) -a, 1, &g);
+ return g;
+}
+
+int
+main ()
+{
+ if (__SIZEOF_LONG_LONG__ * __CHAR_BIT__ != 64
+ || __SIZEOF_SHORT__ * __CHAR_BIT__ != 16)
+ return 0;
+ if (foo (1) != 0xfffffffffffffffeULL)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr102224.c b/gcc/testsuite/gcc.dg/pr102224.c
new file mode 100644
index 0000000..9f09ba5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102224.c
@@ -0,0 +1,49 @@
+/* PR target/102224 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+__attribute__((noipa)) float
+foo (float x)
+{
+ return x * __builtin_copysignf (1.0f, x);
+}
+
+__attribute__((noipa)) float
+bar (float x, float y)
+{
+ return x * __builtin_copysignf (1.0f, y);
+}
+
+__attribute__((noipa)) float
+baz (float z, float x)
+{
+ return x * __builtin_copysignf (1.0f, x);
+}
+
+__attribute__((noipa)) float
+qux (float z, float x, float y)
+{
+ return x * __builtin_copysignf (1.0f, y);
+}
+
+int
+main ()
+{
+ if (foo (1.0f) != 1.0f
+ || foo (-4.0f) != 4.0f)
+ __builtin_abort ();
+ if (bar (1.25f, 7.25f) != 1.25f
+ || bar (1.75f, -3.25f) != -1.75f
+ || bar (-2.25f, 7.5f) != -2.25f
+ || bar (-3.0f, -4.0f) != 3.0f)
+ __builtin_abort ();
+ if (baz (5.5f, 1.0f) != 1.0f
+ || baz (4.25f, -4.0f) != 4.0f)
+ __builtin_abort ();
+ if (qux (1.0f, 1.25f, 7.25f) != 1.25f
+ || qux (2.0f, 1.75f, -3.25f) != -1.75f
+ || qux (3.0f, -2.25f, 7.5f) != -2.25f
+ || qux (4.0f, -3.0f, -4.0f) != 3.0f)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr102269.c b/gcc/testsuite/gcc.dg/pr102269.c
new file mode 100644
index 0000000..9d41b8f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102269.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+void fn() { int a[0]; }
diff --git a/gcc/testsuite/gcc.dg/pr102273.c b/gcc/testsuite/gcc.dg/pr102273.c
new file mode 100644
index 0000000..568e44e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102273.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+void bar();
+
+struct A { char d; };
+void foo()
+{
+ struct A e;
+ void baz() { bar(e); }
+}
diff --git a/gcc/testsuite/gcc.dg/pr20126.c b/gcc/testsuite/gcc.dg/pr20126.c
index 257832a..10aeec7 100644
--- a/gcc/testsuite/gcc.dg/pr20126.c
+++ b/gcc/testsuite/gcc.dg/pr20126.c
@@ -1,5 +1,5 @@
-/* dg-do run */
-/* dg-options "-O2" */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
/* PR target/20126 was not really target-specific, but rather a loop's
failure to take into account the possibility that a DEST_ADDR giv
@@ -34,6 +34,10 @@ foo (S *x, S *y)
while (e <= g)
{
const char *t = e + 1;
+ /* The pointer E below increases but the bound H stays constant,
+ letting the latter exceed the size remaining in the argument
+ pointed to by the formed, which might be detected by
+ -Wstringop-overread. */
if (__builtin_memcmp (e, f, h) == 0)
return 1;
e = t;
@@ -48,3 +52,5 @@ main (void)
abort ();
return 0;
}
+
+/* { dg-prune-output "-Wstringop-overread" } */
diff --git a/gcc/testsuite/gcc.dg/pr43864-4.c b/gcc/testsuite/gcc.dg/pr43864-4.c
index 3c6cc50..8a25b0f 100644
--- a/gcc/testsuite/gcc.dg/pr43864-4.c
+++ b/gcc/testsuite/gcc.dg/pr43864-4.c
@@ -22,7 +22,7 @@ int f(int c, int b, int d)
return r - r2;
}
-/* { dg-final { scan-tree-dump-times "if " 0 "pre"} } */
-/* { dg-final { scan-tree-dump-times "(?n)_.*\\+.*_" 1 "pre"} } */
-/* { dg-final { scan-tree-dump-times "(?n)_.*-.*_" 2 "pre"} } */
+/* During PRE elimination we should simplify this to return b * 2. */
+/* { dg-final { scan-tree-dump-times "if " 0 "pre" } } */
+/* { dg-final { scan-tree-dump "_\[0-9\]+ = b_\[0-9\]+\\(D\\) \\* 2;\[\\r\\n\]\[^\\r\\n\]*return _\[0-9\]+;" "pre" } } */
/* { dg-final { scan-tree-dump-not "Invalid sum" "pre"} } */
diff --git a/gcc/testsuite/gcc.dg/pr48552-1.c b/gcc/testsuite/gcc.dg/pr48552-1.c
index 11ee401..4cd7c59 100644
--- a/gcc/testsuite/gcc.dg/pr48552-1.c
+++ b/gcc/testsuite/gcc.dg/pr48552-1.c
@@ -15,7 +15,7 @@ f2 (void *x)
{
__asm volatile ("" : "=r" (*x)); /* { dg-warning "dereferencing" "deref" } */
} /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */
- /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */
+
void
f3 (void *x)
{
@@ -39,7 +39,7 @@ f6 (void *x)
{
__asm volatile ("" : "=g" (*x)); /* { dg-warning "dereferencing" "deref" } */
} /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */
- /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */
+
void
f7 (struct S *x)
{
diff --git a/gcc/testsuite/gcc.dg/pr48552-2.c b/gcc/testsuite/gcc.dg/pr48552-2.c
index 2d2a00c..e22600a 100644
--- a/gcc/testsuite/gcc.dg/pr48552-2.c
+++ b/gcc/testsuite/gcc.dg/pr48552-2.c
@@ -15,7 +15,7 @@ f2 (void *x)
{
__asm ("" : "=r" (*x)); /* { dg-warning "dereferencing" "deref" } */
} /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */
- /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */
+
void
f3 (void *x)
{
@@ -39,7 +39,7 @@ f6 (void *x)
{
__asm ("" : "=g" (*x)); /* { dg-warning "dereferencing" "deref" } */
} /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */
- /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */
+
void
f7 (struct S *x)
{
diff --git a/gcc/testsuite/gcc.dg/pr56727-2.c b/gcc/testsuite/gcc.dg/pr56727-2.c
index c54369e..77fdf4b 100644
--- a/gcc/testsuite/gcc.dg/pr56727-2.c
+++ b/gcc/testsuite/gcc.dg/pr56727-2.c
@@ -18,4 +18,4 @@ void h ()
/* { dg-final { scan-assembler "@(PLT|plt)" { target i?86-*-* x86_64-*-* } } } */
/* { dg-final { scan-assembler "@(PLT|plt)" { target { powerpc*-*-linux* && ilp32 } } } } */
-/* { dg-final { scan-assembler "bl f\n\\s*nop" { target { powerpc*-*-linux* && lp64 } } } } */
+/* { dg-final { scan-assembler "(bl f\n\\s*nop)|(bl f@notoc)" { target { powerpc*-*-linux* && lp64 } } } } */
diff --git a/gcc/testsuite/gcc.dg/pr68217.c b/gcc/testsuite/gcc.dg/pr68217.c
index c5b0d1f..eb4f15e 100644
--- a/gcc/testsuite/gcc.dg/pr68217.c
+++ b/gcc/testsuite/gcc.dg/pr68217.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fno-tree-ccp" } */
int foo (void)
{
diff --git a/gcc/testsuite/gcc.dg/pr68317.c b/gcc/testsuite/gcc.dg/pr68317.c
index 891d129..bd053a7 100644
--- a/gcc/testsuite/gcc.dg/pr68317.c
+++ b/gcc/testsuite/gcc.dg/pr68317.c
@@ -1,5 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -fdisable-tree-ethread" } */
+
+/* Note: Threader will collapse loop. */
typedef int int32_t __attribute__((mode (__SI__)));
diff --git a/gcc/testsuite/gcc.dg/pr78213.c b/gcc/testsuite/gcc.dg/pr78213.c
index ebc2cce..04bf038 100644
--- a/gcc/testsuite/gcc.dg/pr78213.c
+++ b/gcc/testsuite/gcc.dg/pr78213.c
@@ -1,12 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fself-test" } */
-
-/* When this test was written -fself-test took no argument, but it
- has subsequently gained a mandatory argument, giving the path
- to selftest support files (within the srcdir).
- It's not clear how to provide this path sanely from
- within DejaGnu, so for now, this test is disabled. */
-/* { dg-skip-if "" { *-*-* } } */
+/* { dg-options "-fself-test=$srcdir/selftests" } */
/* Verify that -fself-test does not fail on a non empty source. */
@@ -15,4 +8,5 @@ int i;
while (i--)
bar();
}
-/* { dg-message "fself\-test: " "-fself-test" { target *-*-* } 0 } */
+
+/* { dg-regexp {^-fself-test: [0-9]+ pass\(es\) in [.0-9]+ seconds$|.*: note: self-tests are not enabled in this build$} } */
diff --git a/gcc/testsuite/gcc.dg/pr78888.c b/gcc/testsuite/gcc.dg/pr78888.c
new file mode 100644
index 0000000..77a130c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr78888.c
@@ -0,0 +1,29 @@
+/* PR tree-optimization/78888 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+void kill (void);
+void keep (void);
+
+void g (int x)
+{
+ if (__builtin_toupper ((unsigned char)x) == 'a')
+ kill ();
+ if (__builtin_toupper ((unsigned char)x) == 'z')
+ kill ();
+ if (__builtin_tolower ((unsigned char)x) == 'A')
+ kill ();
+ if (__builtin_tolower ((unsigned char)x) == 'Z')
+ kill ();
+
+ if (__builtin_toupper ((unsigned char)x) == 'A')
+ keep ();
+ if (__builtin_toupper ((unsigned char)x) == 'Z')
+ keep ();
+ if (__builtin_tolower ((unsigned char)x) == 'a')
+ keep ();
+ if (__builtin_tolower ((unsigned char)x) == 'z')
+ keep ();
+}
+/* { dg-final { scan-tree-dump-not "kill" "evrp" } } */
+/* { dg-final { scan-tree-dump-times "keep" 4 "evrp"} } */
diff --git a/gcc/testsuite/gcc.dg/pr79214.c b/gcc/testsuite/gcc.dg/pr79214.c
index 3f5d935..2f93eed 100644
--- a/gcc/testsuite/gcc.dg/pr79214.c
+++ b/gcc/testsuite/gcc.dg/pr79214.c
@@ -22,67 +22,67 @@ static size_t range (void)
void test_bzero (void)
{
- bzero (d, range ()); /* { dg-warning ".__builtin_(bzero|memset). writing 4 or more bytes into a region of size 3 overflows the destination" } */
+ bzero (d, range ()); /* { dg-warning ".__builtin_(bzero|memset). writing 4 or more bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
void test_memcpy (void)
{
- memcpy (d, s, range ()); /* { dg-warning ".__builtin_memcpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */
+ memcpy (d, s, range ()); /* { dg-warning ".__builtin_memcpy. writing 4 or more bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
void test_memmove (void)
{
- memmove (d, d + 1, range ()); /* { dg-warning ".__builtin_memmove. writing 4 or more bytes into a region of size 3 overflows the destination" } */
+ memmove (d, d + 1, range ()); /* { dg-warning ".__builtin_memmove. writing 4 or more bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
void test_mempcpy (void)
{
- mempcpy (d, s, range ()); /* { dg-warning ".__builtin_mempcpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */
+ mempcpy (d, s, range ()); /* { dg-warning ".__builtin_mempcpy. writing 4 or more bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
void test_memset (int n)
{
- memset (d, n, range ()); /* { dg-warning ".__builtin_memset. writing 4 or more bytes into a region of size 3 overflows the destination" } */
+ memset (d, n, range ()); /* { dg-warning ".__builtin_memset. writing 4 or more bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
void test_strcat (int i)
{
const char *s = i < 0 ? "123" : "4567";
- strcat (d, s); /* { dg-warning ".__builtin_strcat. writing between 4 and 5 bytes into a region of size 3 overflows the destination" } */
+ strcat (d, s); /* { dg-warning ".__builtin_strcat. writing between 4 and 5 bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
char* test_stpcpy (int i)
{
const char *s = i < 0 ? "123" : "4567";
- return stpcpy (d, s); /* { dg-warning ".__builtin_stpcpy. writing between 4 and 5 bytes into a region of size 3 overflows the destination" } */
+ return stpcpy (d, s); /* { dg-warning ".__builtin_stpcpy. writing between 4 and 5 bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
char* test_stpncpy (int i)
{
const char *s = i < 0 ? "123" : "4567";
- return stpncpy (d, s, range ()); /* { dg-warning ".__builtin_stpncpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */
+ return stpncpy (d, s, range ()); /* { dg-warning ".__builtin_stpncpy. writing 4 or more bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
char* test_strcpy (int i)
{
const char *s = i < 0 ? "123" : "4567";
- return strcpy (d, s); /* { dg-warning ".__builtin_strcpy. writing between 4 and 5 bytes into a region of size 3 overflows the destination" } */
+ return strcpy (d, s); /* { dg-warning ".__builtin_strcpy. writing between 4 and 5 bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
char* test_strncpy (int i)
{
const char *s = i < 0 ? "123" : "4567";
- return strncpy (d, s, range ()); /* { dg-warning ".__builtin_strncpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */
+ return strncpy (d, s, range ()); /* { dg-warning ".__builtin_strncpy. writing 4 or more bytes into a region of size 3 overflows the destination" "pr?????" { xfail { *-*-* } } } */
}
char* test_strncat (int i)
{
const char *s = i < 0 ? "123" : "4567";
- return strncat (d, s, range ()); /* { dg-warning ".__builtin_strncat. specified bound \\\[4, \[0-9\]+] exceeds destination size 3" } */
+ return strncat (d, s, range ()); /* { dg-warning ".__builtin_strncat. specified bound \\\[4, \[0-9\]+] exceeds destination size 3" "pr?????" { xfail { *-*-* } } } */
}
diff --git a/gcc/testsuite/gcc.dg/pr79412.c b/gcc/testsuite/gcc.dg/pr79412.c
new file mode 100644
index 0000000..b60d5e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr79412.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+int a;
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } .-1 } */
+void fn1 ()
+{
+ a++;
+}
+int a[] = {2}; /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/pr79972.c b/gcc/testsuite/gcc.dg/pr79972.c
index 1d2b8be..4d3064f 100644
--- a/gcc/testsuite/gcc.dg/pr79972.c
+++ b/gcc/testsuite/gcc.dg/pr79972.c
@@ -6,7 +6,8 @@
int
f (int dim, int *b, int *c)
{
- int newcentroid[3][dim]; /* { dg-warning "unbounded use of variable-length array" } */
+ /* -Wvla-larger-than is only issued with optimization (see PR 100510). */
+ int newcentroid[3][dim];
int *a = newcentroid[2];
int i, dist = 0;
__builtin_memcpy (newcentroid, c, sizeof (newcentroid));
diff --git a/gcc/testsuite/gcc.dg/pr80776-1.c b/gcc/testsuite/gcc.dg/pr80776-1.c
index af41c0c..b9bce62 100644
--- a/gcc/testsuite/gcc.dg/pr80776-1.c
+++ b/gcc/testsuite/gcc.dg/pr80776-1.c
@@ -17,7 +17,15 @@ Foo (void)
__builtin_unreachable ();
if (! (0 <= i && i <= 999999))
__builtin_unreachable ();
- /* The correctness bits for [E]VRP cannot handle chained conditionals
- when deciding to ignore a unreachable branch for setting SSA range info. */
- sprintf (number, "%d", i); /* { dg-bogus "writing" "" { xfail *-*-* } } */
+
+ /* Legacy evrp sets the range of i to [0, MAX] *before* the first conditional,
+ and to [0,999999] *before* the second conditional. This is because both
+ evrp and VRP use trickery to set global ranges when this particular use of
+ a __builtin_unreachable is in play (see uses of
+ assert_unreachable_fallthru_edge_p).
+
+ Setting these ranges at the definition site, causes VRP to remove the
+ unreachable code altogether, leaving the following sprintf unguarded. This
+ causes the bogus warning below. */
+ sprintf (number, "%d", i); /* { dg-bogus "writing" "" } */
}
diff --git a/gcc/testsuite/gcc.dg/pr81192.c b/gcc/testsuite/gcc.dg/pr81192.c
index 71bbc13..6cab605 100644
--- a/gcc/testsuite/gcc.dg/pr81192.c
+++ b/gcc/testsuite/gcc.dg/pr81192.c
@@ -1,4 +1,4 @@
-/* { dg-options "-Os -fdump-tree-pre-details -fdisable-tree-evrp" } */
+/* { dg-options "-Os -fdump-tree-pre-details -fdisable-tree-evrp -fno-tree-dse" } */
/* Disable tree-evrp because the new version of evrp sees
<bb 3> :
@@ -16,6 +16,8 @@ produces
# iftmp.2_12 = PHI <2147483647(3), iftmp.2_11(4)>
which causes the situation being tested to dissapear before we get to PRE. */
+/* Likewise disable DSE which also elides the tail merging "opportunity". */
+
#if __SIZEOF_INT__ == 2
#define unsigned __UINT32_TYPE__
#define int __INT32_TYPE__
diff --git a/gcc/testsuite/gcc.dg/pr84877.c b/gcc/testsuite/gcc.dg/pr84877.c
index 8a34dd4..234fcd2 100644
--- a/gcc/testsuite/gcc.dg/pr84877.c
+++ b/gcc/testsuite/gcc.dg/pr84877.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { xfail { cris-*-* sparc*-*-* } } } */
/* { dg-options "-O2" } */
#include <inttypes.h>
diff --git a/gcc/testsuite/gcc.dg/pr86058.c b/gcc/testsuite/gcc.dg/pr86058.c
new file mode 100644
index 0000000..89628c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr86058.c
@@ -0,0 +1,19 @@
+/* PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for
+ -Wmaybe-uninitialized warning
+ The test fails on a number of non-x86 targets due to pr100073.
+ { dg-do compile { target i?86-*-* x86_64-*-* } }
+ { dg-options "-O2 -Wuninitialized -Wmaybe-uninitialized" } */
+
+extern void foo (int *);
+
+void zip (int *out, int indx)
+{
+ int arr[10];
+
+ for (int i = 0; i < indx; ++i)
+ out[i] = arr[i] + 1; // { dg-warning "'arr\\\[i]' may be used uninitialized" "pr99944" { xfail *-*-* } }
+ // { dg-warning "'arr' may be used uninitialized" "actual" { target *-*-* } .-1 }
+
+ foo (arr);
+ foo (out);
+}
diff --git a/gcc/testsuite/gcc.dg/pr86723.c b/gcc/testsuite/gcc.dg/pr86723.c
new file mode 100644
index 0000000..e3fd6b9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr86723.c
@@ -0,0 +1,63 @@
+/* PR tree-optimization/86723 */
+/* { dg-do run { target { ilp32 || lp64 } } } */
+/* { dg-options "-O2" } */
+
+__attribute__((noipa)) int
+foo (unsigned long long value)
+{
+ return (((value & 0x00000000000000ffull) << 56)
+ | ((value & 0x000000000000ff00ull) << 40)
+ | ((value & 0x0000000000ff0000ull) << 24)
+ | ((value & 0x00000000ff000000ull) << 8)
+ | ((value & 0x000000ff00000000ull) >> 8)
+ | ((value & 0x0000ff0000000000ull) >> 24)
+ | ((value & 0x00ff000000000000ull) >> 40)
+ | ((value & 0xff00000000000000ull) >> 56));
+}
+
+__attribute__((noipa)) int
+bar (unsigned long long value)
+{
+ return (((value & 0x000000ff00000000ull) >> 8)
+ | ((value & 0x0000ff0000000000ull) >> 24)
+ | ((value & 0x00ff000000000000ull) >> 40)
+ | ((value & 0xff00000000000000ull) >> 56));
+}
+
+__attribute__((noipa)) unsigned long long
+baz (unsigned long long value)
+{
+ return (((value & 0x00000000000000ffull) << 56)
+ | ((value & 0x000000000000ff00ull) << 40)
+ | ((value & 0x00000000ff000000ull) << 8)
+ | ((value & 0x000000ff00000000ull) >> 8)
+ | ((value & 0x0000ff0000000000ull) >> 24)
+ | ((value & 0xff00000000000000ull) >> 56));
+}
+
+__attribute__((noipa)) unsigned int
+qux (unsigned int value)
+{
+ return (((value & 0x000000ff) << 24)
+ | ((value & 0x00ff0000) >> 8)
+ | ((value & 0xff000000) >> 24));
+}
+
+__attribute__((noipa)) unsigned int
+corge (unsigned int value)
+{
+ return (((value & 0x000000ff) << 24)
+ | ((value & 0xff000000) >> 24));
+}
+
+int
+main ()
+{
+ if (foo (0x0102030405060708ull) != 0x04030201
+ || bar (0x0102030405060708ull) != 0x04030201
+ || baz (0x0102030405060708ull) != 0x0807000504030001ull
+ || qux (0x01020304) != 0x04000201
+ || corge (0x01020304) != 0x04000001)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr89984.c b/gcc/testsuite/gcc.dg/pr89984.c
new file mode 100644
index 0000000..471fe92
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr89984.c
@@ -0,0 +1,20 @@
+/* PR target/89984 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+__attribute__((noipa)) float
+foo (float x, float y)
+{
+ return x * __builtin_copysignf (1.0f, y) + y;
+}
+
+int
+main ()
+{
+ if (foo (1.25f, 7.25f) != 1.25f + 7.25f
+ || foo (1.75f, -3.25f) != -1.75f + -3.25f
+ || foo (-2.25f, 7.5f) != -2.25f + 7.5f
+ || foo (-3.0f, -4.0f) != 3.0f + -4.0f)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr93210.c b/gcc/testsuite/gcc.dg/pr93210.c
index ec4194b..134d32b 100644
--- a/gcc/testsuite/gcc.dg/pr93210.c
+++ b/gcc/testsuite/gcc.dg/pr93210.c
@@ -1,7 +1,7 @@
/* PR tree-optimization/93210 */
/* { dg-do run } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
-/* { dg-final { scan-tree-dump-times "return \[0-9]\[0-9a-fA-FxX]*;" 31 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "(?:return|<retval> =) \[0-9]\[0-9a-fA-FxX]*;" 31 "optimized" } } */
#ifdef __SIZEOF_INT128__
typedef unsigned __int128 L;
diff --git a/gcc/testsuite/gcc.dg/pr94589-1.c b/gcc/testsuite/gcc.dg/pr94589-1.c
new file mode 100644
index 0000000..de404ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr94589-1.c
@@ -0,0 +1,35 @@
+/* PR tree-optimization/94589 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g0 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[45]" 14 "optimized" } } */
+
+#define A __attribute__((noipa))
+A int f1 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == 0; }
+A int f2 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != 0; }
+A int f3 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c > 0; }
+A int f4 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c < 0; }
+A int f5 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c >= 0; }
+A int f6 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c <= 0; }
+A int f7 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == -1; }
+A int f8 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != -1; }
+A int f9 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c > -1; }
+A int f10 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c <= -1; }
+A int f11 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == 1; }
+A int f12 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != 1; }
+A int f13 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c < 1; }
+A int f14 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c >= 1; }
+A int f15 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == 0; }
+A int f16 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != 0; }
+A int f17 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c > 0; }
+A int f18 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c < 0; }
+A int f19 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c >= 0; }
+A int f20 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c <= 0; }
+A int f21 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == -1; }
+A int f22 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != -1; }
+A int f23 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c > -1; }
+A int f24 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c <= -1; }
+A int f25 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == 1; }
+A int f26 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != 1; }
+A int f27 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c < 1; }
+A int f28 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c >= 1; }
diff --git a/gcc/testsuite/gcc.dg/pr94589-2.c b/gcc/testsuite/gcc.dg/pr94589-2.c
new file mode 100644
index 0000000..9481b76
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr94589-2.c
@@ -0,0 +1,35 @@
+/* PR tree-optimization/94589 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g0 -ffast-math -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 14 "optimized" } } */
+
+#define A __attribute__((noipa))
+A int f1 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == 0; }
+A int f2 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != 0; }
+A int f3 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c > 0; }
+A int f4 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c < 0; }
+A int f5 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c >= 0; }
+A int f6 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c <= 0; }
+A int f7 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == -1; }
+A int f8 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != -1; }
+A int f9 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c > -1; }
+A int f10 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c <= -1; }
+A int f11 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == 1; }
+A int f12 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != 1; }
+A int f13 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c < 1; }
+A int f14 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c >= 1; }
+A int f15 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == 0; }
+A int f16 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != 0; }
+A int f17 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c > 0; }
+A int f18 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c < 0; }
+A int f19 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c >= 0; }
+A int f20 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c <= 0; }
+A int f21 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == -1; }
+A int f22 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != -1; }
+A int f23 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c > -1; }
+A int f24 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c <= -1; }
+A int f25 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == 1; }
+A int f26 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != 1; }
+A int f27 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c < 1; }
+A int f28 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c >= 1; }
diff --git a/gcc/testsuite/gcc.dg/pr94589-3.c b/gcc/testsuite/gcc.dg/pr94589-3.c
new file mode 100644
index 0000000..df82fab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr94589-3.c
@@ -0,0 +1,97 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -g" } */
+
+#include "pr94589-1.c"
+
+#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort ()
+#define D(fn, i, r) if (fn (i) != r) __builtin_abort ()
+
+int
+main ()
+{
+ C (f1, 7, 8, 0);
+ C (f1, 8, 8, 1);
+ C (f1, 9, 8, 0);
+ C (f2, 7, 8, 1);
+ C (f2, 8, 8, 0);
+ C (f2, 9, 8, 1);
+ C (f3, 7, 8, 0);
+ C (f3, 8, 8, 0);
+ C (f3, 9, 8, 1);
+ C (f4, 7, 8, 1);
+ C (f4, 8, 8, 0);
+ C (f4, 9, 8, 0);
+ C (f5, 7, 8, 0);
+ C (f5, 8, 8, 1);
+ C (f5, 9, 8, 1);
+ C (f6, 7, 8, 1);
+ C (f6, 8, 8, 1);
+ C (f6, 9, 8, 0);
+ C (f7, 7, 8, 1);
+ C (f7, 8, 8, 0);
+ C (f7, 9, 8, 0);
+ C (f8, 7, 8, 0);
+ C (f8, 8, 8, 1);
+ C (f8, 9, 8, 1);
+ C (f9, 7, 8, 0);
+ C (f9, 8, 8, 1);
+ C (f9, 9, 8, 1);
+ C (f10, 7, 8, 1);
+ C (f10, 8, 8, 0);
+ C (f10, 9, 8, 0);
+ C (f11, 7, 8, 0);
+ C (f11, 8, 8, 0);
+ C (f11, 9, 8, 1);
+ C (f12, 7, 8, 1);
+ C (f12, 8, 8, 1);
+ C (f12, 9, 8, 0);
+ C (f13, 7, 8, 1);
+ C (f13, 8, 8, 1);
+ C (f13, 9, 8, 0);
+ C (f14, 7, 8, 0);
+ C (f14, 8, 8, 0);
+ C (f14, 9, 8, 1);
+ D (f15, 4, 0);
+ D (f15, 5, 1);
+ D (f15, 6, 0);
+ D (f16, 4, 1);
+ D (f16, 5, 0);
+ D (f16, 6, 1);
+ D (f17, 4, 0);
+ D (f17, 5, 0);
+ D (f17, 6, 1);
+ D (f18, 4, 1);
+ D (f18, 5, 0);
+ D (f18, 6, 0);
+ D (f19, 4, 0);
+ D (f19, 5, 1);
+ D (f19, 6, 1);
+ D (f20, 4, 1);
+ D (f20, 5, 1);
+ D (f20, 6, 0);
+ D (f21, 4, 1);
+ D (f21, 5, 0);
+ D (f21, 6, 0);
+ D (f22, 4, 0);
+ D (f22, 5, 1);
+ D (f22, 6, 1);
+ D (f23, 4, 0);
+ D (f23, 5, 1);
+ D (f23, 6, 1);
+ D (f24, 4, 1);
+ D (f24, 5, 0);
+ D (f24, 6, 0);
+ D (f25, 4, 0);
+ D (f25, 5, 0);
+ D (f25, 6, 1);
+ D (f26, 4, 1);
+ D (f26, 5, 1);
+ D (f26, 6, 0);
+ D (f27, 4, 1);
+ D (f27, 5, 1);
+ D (f27, 6, 0);
+ D (f28, 4, 0);
+ D (f28, 5, 0);
+ D (f28, 6, 1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr94589-4.c b/gcc/testsuite/gcc.dg/pr94589-4.c
new file mode 100644
index 0000000..b2557fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr94589-4.c
@@ -0,0 +1,97 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -g -ffast-math" } */
+
+#include "pr94589-2.c"
+
+#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort ()
+#define D(fn, i, r) if (fn (i) != r) __builtin_abort ()
+
+int
+main ()
+{
+ C (f1, 7.0, 8.0, 0);
+ C (f1, 8.0, 8.0, 1);
+ C (f1, 9.0, 8.0, 0);
+ C (f2, 7.0, 8.0, 1);
+ C (f2, 8.0, 8.0, 0);
+ C (f2, 9.0, 8.0, 1);
+ C (f3, 7.0, 8.0, 0);
+ C (f3, 8.0, 8.0, 0);
+ C (f3, 9.0, 8.0, 1);
+ C (f4, 7.0, 8.0, 1);
+ C (f4, 8.0, 8.0, 0);
+ C (f4, 9.0, 8.0, 0);
+ C (f5, 7.0, 8.0, 0);
+ C (f5, 8.0, 8.0, 1);
+ C (f5, 9.0, 8.0, 1);
+ C (f6, 7.0, 8.0, 1);
+ C (f6, 8.0, 8.0, 1);
+ C (f6, 9.0, 8.0, 0);
+ C (f7, 7.0, 8.0, 1);
+ C (f7, 8.0, 8.0, 0);
+ C (f7, 9.0, 8.0, 0);
+ C (f8, 7.0, 8.0, 0);
+ C (f8, 8.0, 8.0, 1);
+ C (f8, 9.0, 8.0, 1);
+ C (f9, 7.0, 8.0, 0);
+ C (f9, 8.0, 8.0, 1);
+ C (f9, 9.0, 8.0, 1);
+ C (f10, 7.0, 8.0, 1);
+ C (f10, 8.0, 8.0, 0);
+ C (f10, 9.0, 8.0, 0);
+ C (f11, 7.0, 8.0, 0);
+ C (f11, 8.0, 8.0, 0);
+ C (f11, 9.0, 8.0, 1);
+ C (f12, 7.0, 8.0, 1);
+ C (f12, 8.0, 8.0, 1);
+ C (f12, 9.0, 8.0, 0);
+ C (f13, 7.0, 8.0, 1);
+ C (f13, 8.0, 8.0, 1);
+ C (f13, 9.0, 8.0, 0);
+ C (f14, 7.0, 8.0, 0);
+ C (f14, 8.0, 8.0, 0);
+ C (f14, 9.0, 8.0, 1);
+ D (f15, 4.0, 0);
+ D (f15, 5.0, 1);
+ D (f15, 6.0, 0);
+ D (f16, 4.0, 1);
+ D (f16, 5.0, 0);
+ D (f16, 6.0, 1);
+ D (f17, 4.0, 0);
+ D (f17, 5.0, 0);
+ D (f17, 6.0, 1);
+ D (f18, 4.0, 1);
+ D (f18, 5.0, 0);
+ D (f18, 6.0, 0);
+ D (f19, 4.0, 0);
+ D (f19, 5.0, 1);
+ D (f19, 6.0, 1);
+ D (f20, 4.0, 1);
+ D (f20, 5.0, 1);
+ D (f20, 6.0, 0);
+ D (f21, 4.0, 1);
+ D (f21, 5.0, 0);
+ D (f21, 6.0, 0);
+ D (f22, 4.0, 0);
+ D (f22, 5.0, 1);
+ D (f22, 6.0, 1);
+ D (f23, 4.0, 0);
+ D (f23, 5.0, 1);
+ D (f23, 6.0, 1);
+ D (f24, 4.0, 1);
+ D (f24, 5.0, 0);
+ D (f24, 6.0, 0);
+ D (f25, 4.0, 0);
+ D (f25, 5.0, 0);
+ D (f25, 6.0, 1);
+ D (f26, 4.0, 1);
+ D (f26, 5.0, 1);
+ D (f26, 6.0, 0);
+ D (f27, 4.0, 1);
+ D (f27, 5.0, 1);
+ D (f27, 6.0, 0);
+ D (f28, 4.0, 0);
+ D (f28, 5.0, 0);
+ D (f28, 6.0, 1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr95580.c b/gcc/testsuite/gcc.dg/pr95580.c
index 330a313..77d8150 100644
--- a/gcc/testsuite/gcc.dg/pr95580.c
+++ b/gcc/testsuite/gcc.dg/pr95580.c
@@ -1,6 +1,6 @@
/* PR c/95580 */
/* { dg-do compile } */
-/* { dg-options "-O1 -W -fno-tree-dce" } */
+/* { dg-options "-O1 -W -fno-tree-dce -fno-tree-dse" } */
void bar (void);
diff --git a/gcc/testsuite/gcc.dg/pr96392.c b/gcc/testsuite/gcc.dg/pr96392.c
new file mode 100644
index 0000000..662bacb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96392.c
@@ -0,0 +1,33 @@
+/* PR tree-optimization/96392 */
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+double plus0(int x)
+{
+ return x + 0.0;
+}
+
+double sub0(int x)
+{
+ return x - 0.0;
+}
+
+double mult0(int x)
+{
+ return 0.0 * x;
+}
+
+double negate(int x)
+{
+ return 0.0 - x;
+}
+
+double subtract(int x)
+{
+ return (double)x - (double)x;
+}
+
+/* { dg-final { scan-tree-dump-not " \\+ " "optimized" } } */
+/* { dg-final { scan-tree-dump-not " \\- " "optimized" } } */
+/* { dg-final { scan-tree-dump-not " \\* " "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/pr96542.c b/gcc/testsuite/gcc.dg/pr96542.c
new file mode 100644
index 0000000..5014f2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96542.c
@@ -0,0 +1,27 @@
+/* { dg-do compile} */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+
+unsigned char
+foo (unsigned int x)
+{
+ _Bool y = x;
+ return (((unsigned char) ~0) >> y) * 2;
+}
+
+unsigned char
+bar (unsigned int x)
+{
+ return (((unsigned char) ~0) >> (_Bool) x) * 2;
+}
+
+unsigned
+baz (unsigned int x)
+{
+ if (x >= 4) return 32;
+ return (-1U >> x) * 16;
+}
+
+/* { dg-final { scan-tree-dump-times "254" 2 "evrp" } } */
+/* { dg-final { scan-tree-dump "= PHI <32.*, 4294967280" "evrp" } } */
+
diff --git a/gcc/testsuite/gcc.dg/pr96573.c b/gcc/testsuite/gcc.dg/pr96573.c
new file mode 100644
index 0000000..c7d8f9e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96573.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/96573 */
+/* { dg-do compile { target { lp64 || ilp32 } } } */
+/* { dg-require-effective-target bswap } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump "__builtin_bswap\|VEC_PERM_EXPR\[^\n\r]*7, 6, 5, 4, 3, 2, 1, 0" "optimized" { xfail vect_variable_length } } } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void *
+foo (void * const p)
+{
+ const size_t m = sizeof (p) - 1;
+ const unsigned char * const o = (unsigned char*) &p;
+ void *n;
+ unsigned char * const q = (unsigned char *) &n;
+ unsigned char i;
+ for (i = 0; i <= m; ++i)
+ q[m - i] = o[i];
+ return n;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97567-2.c b/gcc/testsuite/gcc.dg/pr97567-2.c
index dee31c6..c3ead54 100644
--- a/gcc/testsuite/gcc.dg/pr97567-2.c
+++ b/gcc/testsuite/gcc.dg/pr97567-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile} */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp -fdisable-tree-ethread" } */
char a[2];
diff --git a/gcc/testsuite/gcc.dg/pr98099.c b/gcc/testsuite/gcc.dg/pr98099.c
index 12e52f2..c78d43e 100644
--- a/gcc/testsuite/gcc.dg/pr98099.c
+++ b/gcc/testsuite/gcc.dg/pr98099.c
@@ -1,8 +1,9 @@
/* PR middle-end/98099 */
/* Reported by G. Steinmetz <gscfq@t-online.de> */
-/* { dg-do compile { target dfp } } */
-/* { dg-options "-fsso-struct=big-endian" } */
+/* { dg-do compile { target { dfp && { be || le } } } } */
+/* { dg-options "-fsso-struct=big-endian" { target le } } */
+/* { dg-options "-fsso-struct=little-endian" { target be } } */
struct S { _Decimal128 a; };
diff --git a/gcc/testsuite/gcc.dg/pr99122-3.c b/gcc/testsuite/gcc.dg/pr99122-3.c
index 6aa5b29..6a908ad 100644
--- a/gcc/testsuite/gcc.dg/pr99122-3.c
+++ b/gcc/testsuite/gcc.dg/pr99122-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -g -fno-ipa-cp -w" } */
+/* { dg-options "-O2 -g -w" } */
static int foo ();
diff --git a/gcc/testsuite/gcc.dg/pr99230.c b/gcc/testsuite/gcc.dg/pr99230.c
new file mode 100644
index 0000000..eb3f982
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99230.c
@@ -0,0 +1,40 @@
+/* PR debug/99230 */
+/* { dg-do compile } */
+/* { dg-options "-O2 --param logical-op-non-short-circuit=0 -fcompare-debug --param=jump-table-max-growth-ratio-for-speed=5000" } */
+
+extern void fn2 (void);
+extern void fn3 (int);
+int a, b;
+void
+fn1 (void)
+{
+ int c;
+ short d;
+ switch (a) {
+ case 22000:
+ fn2 ();
+ case 22300:
+ b = 0;
+ case 22600:
+ case 22601:
+ case 22900:
+ fn3 (1);
+ case 20100:
+ fn3 (2);
+ case 20200:
+ fn3 (3);
+ case 20300:
+ fn3 (4);
+ case 20400:
+ fn3 (5);
+ case 20310:
+ fn3 (4);
+ case 20410:
+ fn3 (5);
+ }
+ if (d || c) {
+ do
+ ;
+ while (0);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr99296.c b/gcc/testsuite/gcc.dg/pr99296.c
new file mode 100644
index 0000000..4a0b3f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99296.c
@@ -0,0 +1,7 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-bit-ccp" }
+
+struct {
+ signed a : 1;
+} b, c;
+void d() { b.a |= c.a |= 0 != 2; }
diff --git a/gcc/testsuite/gcc.dg/pr99830.c b/gcc/testsuite/gcc.dg/pr99830.c
new file mode 100644
index 0000000..75226f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99830.c
@@ -0,0 +1,10 @@
+/* PR debug/99830 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fno-expensive-optimizations -fno-split-wide-types -g" } */
+
+int foo (long a, __int128 b, short c, int d, unsigned e, __int128 f)
+{
+ __builtin_memmove (2 + (char *) &f, foo, 1);
+ c >>= (char) f;
+ return c;
+}
diff --git a/gcc/testsuite/gcc.dg/pr99882.c b/gcc/testsuite/gcc.dg/pr99882.c
new file mode 100644
index 0000000..ebc074f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99882.c
@@ -0,0 +1,37 @@
+/* PR tree-optimization/99882 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+void
+foo (char *p, void *q)
+{
+ __INTPTR_TYPE__ i = (__INTPTR_TYPE__) q;
+ p[2] = i;
+ i >>= 8;
+ p[3] = i;
+ i >>= 8;
+ p[4] = i;
+ i >>= 8;
+ p[5] = i;
+ i >>= 8;
+ p[6] = i;
+ i >>= 8;
+ p[7] = i;
+ i >>= 8;
+ p[8] = i;
+ i >>= 8;
+ p[9] = i;
+}
+
+void
+bar (char *p, void *q)
+{
+ __INTPTR_TYPE__ i = (__INTPTR_TYPE__) q;
+ p[2] = i;
+ i >>= 8;
+ p[3] = i;
+ i >>= 8;
+ p[4] = i;
+ i >>= 8;
+ p[5] = i;
+}
diff --git a/gcc/testsuite/gcc.dg/pr99990.c b/gcc/testsuite/gcc.dg/pr99990.c
new file mode 100644
index 0000000..6878b00
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99990.c
@@ -0,0 +1,12 @@
+/* PR c/99990 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <stdarg.h>
+
+void
+foo ()
+{
+ va_arg (0, long); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */
+ void *b[] = 0; /* { dg-error "invalid initializer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pragma-diag-10.c b/gcc/testsuite/gcc.dg/pragma-diag-10.c
new file mode 100644
index 0000000..127b299
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pragma-diag-10.c
@@ -0,0 +1,20 @@
+/* PR middle-end/98512 - #pragma GCC diagnostic ignored ineffective
+ in conjunction with alias attribute
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+void *
+__rawmemchr_ppc (const void *s, int c)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Wstringop-overread"
+ if (c != 0)
+ return __builtin_memchr (s, c, (unsigned long)-1); // { dg-bogus "specified bound \\d+ exceeds maximum object size" }
+#pragma GCC diagnostic pop
+
+ return (char *)s + __builtin_strlen (s);
+}
+
+extern __typeof (__rawmemchr_ppc) __EI___rawmemchr_ppc
+ __attribute__((alias ("__rawmemchr_ppc")));
diff --git a/gcc/testsuite/gcc.dg/pragma-diag-9.c b/gcc/testsuite/gcc.dg/pragma-diag-9.c
new file mode 100644
index 0000000..9aac379
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pragma-diag-9.c
@@ -0,0 +1,141 @@
+/* Verify that #pragma GCC diagnostic down the inlining stack suppresses
+ a warning that would otherwise be issued for inlined calls higher up
+ the inlining stack.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Wno-array-bounds" } */
+
+extern void* memset (void*, int, __SIZE_TYPE__);
+
+static void warn0 (int *p)
+{
+ memset (p, __LINE__, 3); // { dg-warning "\\\[-Wstringop-overflow" }
+}
+
+static void warn1 (int *p)
+{
+ warn0 (p + 1);
+}
+
+static void warn2 (int *p)
+{
+ warn1 (p + 1);
+}
+
+int a2[2]; // { dg-message "at offset 12 into destination object 'a2' of size 8" }
+
+void warn3 (void)
+{
+ warn2 (a2 + 1);
+}
+
+
+// Verify suppression at the innermost frame of the inlining stack.
+
+static void ignore0 (int *p)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+ memset (p, __LINE__, 3);
+#pragma GCC diagnostic pop
+}
+
+static void nowarn1_ignore0 (int *p)
+{
+ ignore0 (p + 1);
+}
+
+static void nowarn2_ignore0 (int *p)
+{
+ nowarn1_ignore0 (p + 1);
+}
+
+int b2[2];
+
+void nowarn3_ignore0 (void)
+{
+ nowarn2_ignore0 (b2 + 1);
+}
+
+
+// Verify suppression at the second innermost frame of the inlining stack.
+
+static void nowarn0_ignore1 (int *p)
+{
+ memset (p, __LINE__, 3);
+}
+
+static void ignore1 (int *p)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+ nowarn0_ignore1 (p + 1);
+#pragma GCC diagnostic pop
+}
+
+void nowarn2_ignore1 (int *p)
+{
+ ignore1 (p + 1);
+}
+
+int c2[2];
+
+void nowarn3_ignore1 (void)
+{
+ nowarn2_ignore1 (c2 + 1);
+}
+
+
+// Verify suppression at the third innermost frame of the inlining stack.
+
+static void nowarn0_ignore2 (int *p)
+{
+ memset (p, __LINE__, 3);
+}
+
+static void nowarn1_ignore2 (int *p)
+{
+ nowarn0_ignore2 (p + 1);
+}
+
+static void ignore2 (int *p)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+ nowarn1_ignore2 (p + 1);
+#pragma GCC diagnostic pop
+}
+
+int d2[2];
+
+void nowarn3_ignore2 (void)
+{
+ ignore2 (c2 + 1);
+}
+
+
+// Verify suppression at the outermost frame of the inlining stack.
+
+static void nowarn0_ignore3 (int *p)
+{
+ memset (p, __LINE__, 3);
+}
+
+static void nowarn1_ignore3 (int *p)
+{
+ nowarn0_ignore3 (p + 1);
+}
+
+static void nowarn2_ignore3 (int *p)
+{
+ nowarn1_ignore3 (p + 1);
+}
+
+int e2[2];
+
+void ignore3 (void)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+ nowarn2_ignore3 (e2 + 1);
+#pragma GCC diagnostic pop
+}
diff --git a/gcc/testsuite/gcc.dg/predict-1.c b/gcc/testsuite/gcc.dg/predict-1.c
index 9e5605a..d2e753e 100644
--- a/gcc/testsuite/gcc.dg/predict-1.c
+++ b/gcc/testsuite/gcc.dg/predict-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
+/* { dg-options "-O2 -fdump-tree-profile_estimate --disable-tree-evrp" } */
extern int global;
diff --git a/gcc/testsuite/gcc.dg/predict-9.c b/gcc/testsuite/gcc.dg/predict-9.c
index f491c51..cb68a21 100644
--- a/gcc/testsuite/gcc.dg/predict-9.c
+++ b/gcc/testsuite/gcc.dg/predict-9.c
@@ -1,5 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-profile_estimate -fno-finite-loops" } */
+/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-profile_estimate -fno-finite-loops -fdisable-tree-ethread" } */
+
+/* Note: Threader causes removal of for loop. */
extern int global;
extern int global2;
diff --git a/gcc/testsuite/gcc.dg/sancov/attribute.c b/gcc/testsuite/gcc.dg/sancov/attribute.c
new file mode 100644
index 0000000..7cfa913
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sancov/attribute.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize-coverage=trace-pc -fdump-tree-optimized" } */
+
+void foo(void)
+{
+}
+
+void
+__attribute__((no_sanitize_coverage))
+bar(void)
+{
+}
+
+static void inline
+__attribute__((always_inline))
+inline_fn(void)
+{
+}
+
+void
+__attribute__((no_sanitize_coverage))
+baz(void)
+{
+ inline_fn();
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/shrink-wrap-loop.c b/gcc/testsuite/gcc.dg/shrink-wrap-loop.c
index 52dfc27..6e1be893 100644
--- a/gcc/testsuite/gcc.dg/shrink-wrap-loop.c
+++ b/gcc/testsuite/gcc.dg/shrink-wrap-loop.c
@@ -1,6 +1,58 @@
/* { dg-do compile { target { { { i?86-*-* x86_64-*-* } && lp64 } || { arm_thumb2 } } } } */
/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } */
+/*
+Our new threader is threading things a bit too early, and causing the
+testcase in gcc.dg/shrink-wrap-loop.c to fail.
+
+ The gist is this BB inside a loop:
+
+ <bb 6> :
+ # p_2 = PHI <p2_6(D)(2), p_12(5)>
+ if (p_2 != 0B)
+ goto <bb 3>; [INV]
+ else
+ goto <bb 7>; [INV]
+
+Our threader can move this check outside of the loop (good). This is
+done before branch probabilities are calculated and causes the probs
+to be calculated as:
+
+<bb 2> [local count: 216361238]:
+ if (p2_6(D) != 0B)
+ goto <bb 7>; [54.59%]
+ else
+ goto <bb 6>; [45.41%]
+
+Logically this seems correct to me. A simple check outside of a loop
+should slightly but not overwhelmingly favor a non-zero value.
+
+Interestingly however, the old threader couldn't get this, but the IL
+ended up identical, albeit with different probabilities. What happens
+is that, because the old code could not thread this, the p2 != 0 check
+would remain inside the loop and probs would be calculated thusly:
+
+ <bb 6> [local count: 1073741824]:
+ # p_2 = PHI <p2_6(D)(2), p_12(5)>
+ if (p_2 != 0B)
+ goto <bb 3>; [94.50%]
+ else
+ goto <bb 7>; [5.50%]
+
+Then when the loop header copying pass ("ch") shuffled things around,
+the IL would end up identical to my early threader code, but with the
+probabilities would remain as 94.5/5.5.
+
+The above discrepancy causes the RTL ifcvt pass to generate different
+code, and by the time we get to the shrink wrapping pass, things look
+sufficiently different such that the legacy code can actually shrink
+wrap, whereas our new code does not.
+
+IMO, if the loop-ch pass moves conditionals outside of a loop, the
+probabilities should be adjusted, but that does mean the shrink wrap
+won't happen for this contrived testcase.
+ */
+
int foo (int *p1, int *p2);
int
@@ -16,4 +68,4 @@ test (int *p1, int *p2)
return 1;
}
-/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */
+/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/sibcall-1.c b/gcc/testsuite/gcc.dg/sibcall-1.c
index e8a9551..367ee43 100644
--- a/gcc/testsuite/gcc.dg/sibcall-1.c
+++ b/gcc/testsuite/gcc.dg/sibcall-1.c
@@ -7,6 +7,9 @@
/* { dg-do run } */
/* { dg-options "-O2 -foptimize-sibling-calls" } */
+/* See note in recurser_void() as to why we disable threading. */
+/* { dg-additional-options "-fdisable-tree-thread1" } */
+
/* The option -foptimize-sibling-calls is the default, but serves as
marker. Self-recursion tail calls are optimized for all targets,
regardless of presence of sibcall patterns. */
@@ -26,6 +29,13 @@ int main ()
void
recurser_void (int n)
{
+ /* In some architectures like ppc64*, jump threading may thread
+ paths such that there are two calls into track(), one for
+ track(0) and one for track(7). The track(7) call can be
+ transformed into a jump instead of a call, which means that
+ different calls into track() may end up with a different
+ &stackpos. This is the reason we disable jump threading for this
+ test. */
if (n == 0 || n == 7)
track (n);
diff --git a/gcc/testsuite/gcc.dg/sms-1.c b/gcc/testsuite/gcc.dg/sms-1.c
index 26868c3..098e1aa 100644
--- a/gcc/testsuite/gcc.dg/sms-1.c
+++ b/gcc/testsuite/gcc.dg/sms-1.c
@@ -40,5 +40,3 @@ main ()
return 0;
}
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
-
diff --git a/gcc/testsuite/gcc.dg/sms-10.c b/gcc/testsuite/gcc.dg/sms-10.c
index d85e8e2..df3bba2 100644
--- a/gcc/testsuite/gcc.dg/sms-10.c
+++ b/gcc/testsuite/gcc.dg/sms-10.c
@@ -113,6 +113,3 @@ main ()
return 0;
}
-
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
-
diff --git a/gcc/testsuite/gcc.dg/sms-2.c b/gcc/testsuite/gcc.dg/sms-2.c
index 7b96f55..f8375f9 100644
--- a/gcc/testsuite/gcc.dg/sms-2.c
+++ b/gcc/testsuite/gcc.dg/sms-2.c
@@ -31,5 +31,3 @@ fun (nb)
sy = 0;
}
}
-
-/* { dg-final { scan-rtl-dump-times "SMS loop many exits" 1 "sms" { target powerpc*-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/sms-3.c b/gcc/testsuite/gcc.dg/sms-3.c
index 822b516..5e56ecf 100644
--- a/gcc/testsuite/gcc.dg/sms-3.c
+++ b/gcc/testsuite/gcc.dg/sms-3.c
@@ -38,6 +38,3 @@ main ()
foo (6, 3);
return 0;
}
-
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
-
diff --git a/gcc/testsuite/gcc.dg/sms-4.c b/gcc/testsuite/gcc.dg/sms-4.c
index f5ebb55..8416b8b 100644
--- a/gcc/testsuite/gcc.dg/sms-4.c
+++ b/gcc/testsuite/gcc.dg/sms-4.c
@@ -34,6 +34,3 @@ main ()
foo (5, a, b, c, dst);
return 0;
}
-
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
-
diff --git a/gcc/testsuite/gcc.dg/sms-6.c b/gcc/testsuite/gcc.dg/sms-6.c
index e57e015..d6fa45a 100644
--- a/gcc/testsuite/gcc.dg/sms-6.c
+++ b/gcc/testsuite/gcc.dg/sms-6.c
@@ -41,5 +41,3 @@ int main()
return 0;
}
-
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 3 "sms" { target powerpc*-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/sms-8.c b/gcc/testsuite/gcc.dg/sms-8.c
index 7ccaa45..dc0a3fc 100644
--- a/gcc/testsuite/gcc.dg/sms-8.c
+++ b/gcc/testsuite/gcc.dg/sms-8.c
@@ -34,7 +34,3 @@ main ()
res = foo (3, 4);
return 0;
}
-
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
-
-
diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-23.c b/gcc/testsuite/gcc.dg/spellcheck-options-23.c
new file mode 100644
index 0000000..575a28d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/spellcheck-options-23.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize-coverage=tracecmp" } */
+
+/* { dg-error "unrecognized argument in option '-fsanitize-coverage=tracecmp'" "" { target *-*-* } 0 } */
+/* { dg-message "valid arguments to '-fsanitize-coverage=' are: trace-cmp trace-pc; did you mean 'trace-cmp'?" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/spellcheck-stdlib.c b/gcc/testsuite/gcc.dg/spellcheck-stdlib.c
index 1ae3b5e..7297a92 100644
--- a/gcc/testsuite/gcc.dg/spellcheck-stdlib.c
+++ b/gcc/testsuite/gcc.dg/spellcheck-stdlib.c
@@ -38,6 +38,16 @@ void test_stdio_h (void)
/* { dg-message "'EOF' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */
}
+/* Missing <stdlib.h>. */
+
+void test_stdlib (int i)
+{
+ i = EXIT_SUCCESS; /* { dg-error "'EXIT_SUCCESS' undeclared" } */
+ /* { dg-message "'EXIT_SUCCESS' is defined in header '<stdlib.h>'; did you forget to '#include <stdlib.h>'?" "" { target *-*-* } .-1 } */
+ i = EXIT_FAILURE; /* { dg-error "'EXIT_FAILURE' undeclared" } */
+ /* { dg-message "'EXIT_FAILURE' is defined in header '<stdlib.h>'; did you forget to '#include <stdlib.h>'?" "" { target *-*-* } .-1 } */
+}
+
/* Missing <errno.h>. */
int test_errno_h (void)
diff --git a/gcc/testsuite/gcc.dg/sso-12.c b/gcc/testsuite/gcc.dg/sso-12.c
new file mode 100644
index 0000000..3bed280
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sso-12.c
@@ -0,0 +1,27 @@
+/* Test scalar_storage_order attribute and pointer fields */
+
+/* { dg-do run } */
+/* { dg-options "-Wno-pedantic" } */
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+struct __attribute__((scalar_storage_order("big-endian"))) Rec
+{
+ int *p;
+};
+#else
+struct __attribute__((scalar_storage_order("little-endian"))) Rec
+{
+ int *p;
+};
+#endif
+
+int main (int argc)
+{
+ struct Rec r = { &argc };
+ int *p = &argc;
+
+ if (__builtin_memcmp (&r.p, &p, sizeof (int *)) != 0)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/sso-13.c b/gcc/testsuite/gcc.dg/sso-13.c
new file mode 100644
index 0000000..ddfde00
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sso-13.c
@@ -0,0 +1,24 @@
+/* Test support of scalar_storage_order attribute */
+
+/* { dg-do compile } */
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define REV_ENDIANNESS __attribute__((scalar_storage_order("big-endian")))
+#else
+#define REV_ENDIANNESS __attribute__((scalar_storage_order("little-endian")))
+#endif
+
+typedef struct tIp6Addr
+{
+ unsigned int s6_addr32[4];
+} tIp6Addr;
+
+struct _tBeTimNetAddr
+{
+ unsigned char isIPv4;
+ union
+ {
+ unsigned int addr;
+ tIp6Addr addr6; /* { dg-warning "type punning toggles" } */
+ } REV_ENDIANNESS u;
+} REV_ENDIANNESS;
diff --git a/gcc/testsuite/gcc.dg/sso-14.c b/gcc/testsuite/gcc.dg/sso-14.c
new file mode 100644
index 0000000..aeff3fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sso-14.c
@@ -0,0 +1,56 @@
+/* PR c/100920 */
+/* Testcase by George Thopas <george.thopas@gmail.com> */
+
+/* { dg-do compile } */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define REV_ENDIANNESS __attribute__((scalar_storage_order("big-endian")))
+#else
+#define REV_ENDIANNESS __attribute__((scalar_storage_order("little-endian")))
+#endif
+
+struct s_1 {
+ int val;
+} REV_ENDIANNESS;
+
+typedef struct s_1 t_1;
+
+struct s_2 {
+ char val;
+} REV_ENDIANNESS;
+
+typedef struct s_2 t_2;
+
+struct s12 {
+ t_1 a[1];
+ t_2 b[1];
+} REV_ENDIANNESS;
+
+typedef struct s12 t_s12;
+
+union u12 {
+ t_1 a[1];
+ t_2 b[1];
+} REV_ENDIANNESS;
+
+typedef union u12 t_u12;
+
+int main(void)
+{
+ t_s12 *msg1 = __builtin_alloca(10);
+ t_u12 *msg2 = __builtin_alloca(10);
+ int same;
+
+ msg1 = malloc (sizeof (t_s12));
+ msg2 = malloc (sizeof (t_s12));
+
+ memset (msg1, 0, sizeof (t_s12));
+ memcpy (msg2, msg1, sizeof (t_s12));
+ same = memcmp (msg1, msg2, sizeof (t_s12));
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/sso-15.c b/gcc/testsuite/gcc.dg/sso-15.c
new file mode 100644
index 0000000..d8a711d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sso-15.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define REV_ENDIANNESS __attribute__((scalar_storage_order("big-endian")))
+#else
+#define REV_ENDIANNESS __attribute__((scalar_storage_order("little-endian")))
+#endif
+
+struct X { int *p; } REV_ENDIANNESS;
+
+struct X x;
+
+struct X __attribute__((noinline)) foo (int *p)
+{
+ struct X x;
+ x.p = p;
+ return x;
+}
+
+void __attribute((noinline)) bar (void)
+{
+ *x.p = 1;
+}
+
+extern void abort (void);
+
+int main (void)
+{
+ int i = 0;
+ x = foo(&i);
+ bar();
+ if (i != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/sso-16.c b/gcc/testsuite/gcc.dg/sso-16.c
new file mode 100644
index 0000000..7bf8938
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sso-16.c
@@ -0,0 +1,100 @@
+/* { dg-do run } */
+/* { dg-require-effective-target int32plus } */
+/* { dg-options "-O3" } */
+
+typedef __INT32_TYPE__ int32_t;
+
+#define BIG_ENDIAN __attribute__((scalar_storage_order("big-endian")))
+
+/* host order version (little endian)*/
+struct _ip6_addr {
+ union {
+ char addr8[16];
+ int32_t addr32[4];
+ } u;
+};
+
+typedef struct _ip6_addr t_ip6_addr;
+
+struct _net_addr {
+ char is_v4;
+ union {
+ int32_t addr;
+ t_ip6_addr addr6;
+ } u;
+};
+
+typedef struct _net_addr t_net_addr;
+
+/* big endian version */
+struct _be_ip6_addr {
+ union {
+ char addr8[16];
+ } BIG_ENDIAN u;
+} BIG_ENDIAN;
+
+typedef struct _be_ip6_addr t_be_ip6_addr;
+
+struct _be_net_addr {
+ char is_v4;
+ union {
+ t_be_ip6_addr addr6;
+ int32_t addr;
+ } BIG_ENDIAN u;
+} BIG_ENDIAN;
+
+typedef struct _be_net_addr t_be_net_addr;
+
+/* convert */
+t_be_ip6_addr be_ip6_addr(const t_ip6_addr ip6)
+{
+ t_be_ip6_addr rc = {
+ .u.addr8[0] = ip6.u.addr8[0],
+ .u.addr8[1] = ip6.u.addr8[1],
+ .u.addr8[2] = ip6.u.addr8[2],
+ .u.addr8[3] = ip6.u.addr8[3],
+ .u.addr8[4] = ip6.u.addr8[4],
+ .u.addr8[5] = ip6.u.addr8[5],
+ .u.addr8[6] = ip6.u.addr8[6],
+ .u.addr8[7] = ip6.u.addr8[7],
+ .u.addr8[8] = ip6.u.addr8[8],
+ .u.addr8[9] = ip6.u.addr8[9],
+ .u.addr8[10] = ip6.u.addr8[10],
+ .u.addr8[11] = ip6.u.addr8[11],
+ .u.addr8[12] = ip6.u.addr8[12],
+ .u.addr8[13] = ip6.u.addr8[13],
+ .u.addr8[14] = ip6.u.addr8[14],
+ .u.addr8[15] = ip6.u.addr8[15],
+ };
+ return rc;
+}
+
+t_be_net_addr __attribute__((noipa)) be_net_addr(const t_net_addr ip)
+{
+ t_be_net_addr rc = {.is_v4 = ip.is_v4 };
+ if (ip.is_v4) {
+ rc.u.addr = ip.u.addr;
+ } else {
+ rc.u.addr6 = be_ip6_addr(ip.u.addr6);
+ }
+ return rc;
+}
+
+int main(void)
+{
+ t_be_net_addr out = { };
+
+ t_net_addr in = {
+ .is_v4 = 0,
+ .u.addr6.u.addr8 =
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
+ };
+
+ out = be_net_addr(in);
+
+ // actually first 4 bytes are swapped
+ if (in.u.addr6.u.addr8[0] != out.u.addr6.u.addr8[0])
+ __builtin_abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/sso-9.c b/gcc/testsuite/gcc.dg/sso-9.c
deleted file mode 100644
index 765f16a..0000000
--- a/gcc/testsuite/gcc.dg/sso-9.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Test support of scalar_storage_order attribute */
-
-/* { dg-do compile } */
-
-#include <stdarg.h>
-
-int x;
-
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-struct __attribute__((scalar_storage_order("big-endian"))) Rec
-{
- va_list v;
-};
-#else
-struct __attribute__((scalar_storage_order("little-endian"))) Rec
-{
- va_list v;
-};
-#endif
-
-void foo (int i, ...)
-{
- struct Rec a;
- va_start (a.v, i);
- a.v = 0, x = va_arg (a.v, int); /* { dg-error "type|reverse storage order" } */
- va_end (a.v);
-}
diff --git a/gcc/testsuite/gcc.dg/strlenopt-73.c b/gcc/testsuite/gcc.dg/strlenopt-73.c
index 6523949..170b66a 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-73.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-73.c
@@ -69,6 +69,13 @@ void test_copy_cond_equal_length (void)
T ( 0 ==, 33, 1, (i0 ? a32 : b32) + 32);
}
+#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) \
+ || defined(__s390__) || defined(__powerpc64__)
+
+/* The following tests assume GCC transforms the memcpy calls into
+ long long assignments which it does only on targets that define
+ the MOVE_MAX macro to 8 or higher. Enable on a set of targets
+ known to do that. */
const char a4[16] = "0123";
const char b4[16] = "3210";
@@ -84,12 +91,14 @@ void test_copy_cond_unequal_length_i64 (void)
T (0 <, 16, 8, i0 ? a4 + 2 : b4 + 3);
}
+#endif
+
-#if __i386__ && __SIZEOF_INT128__ == 16
+#if defined(__x86_64__) && __SIZEOF_INT128__ == 16
/* The following tests assume GCC transforms the memcpy calls into
int128_t assignments which it does only on targets that define
- the MOVE_MAX macro to 16. That's only s390 and i386 with
+ the MOVE_MAX macro to 16. That's only s390 and x86_64 with
int128_t support. */
const char a8[32] = "01234567";
diff --git a/gcc/testsuite/gcc.dg/strlenopt-80.c b/gcc/testsuite/gcc.dg/strlenopt-80.c
index 9124fe4..a853402 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-80.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-80.c
@@ -3,7 +3,7 @@
The optimization is only implemented for MEM_REF stores and other
targets than those below may not transform the memcpy call into
such a store.
- { dg-do compile { target aarch64*-*-* i?86-*-* powerpc*-*-* x86_64-*-* } }
+ { dg-do compile { target { { aarch64*-*-* i?86-*-* x86_64-*-* } || { { powerpc*-*-* } && lp64 } } } }
{ dg-options "-O2 -Wall -fdump-tree-optimized" } */
diff --git a/gcc/testsuite/gcc.dg/strlenopt-95.c b/gcc/testsuite/gcc.dg/strlenopt-95.c
new file mode 100644
index 0000000..6e0a79d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/strlenopt-95.c
@@ -0,0 +1,65 @@
+/* Verify strlen results of vector assignments.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+
+#include "strlenopt.h"
+
+#define V(N) __attribute__ ((vector_size (N)))
+
+typedef V (1) char VC1;
+typedef V (2) char VC2;
+typedef V (4) char VC4;
+typedef V (8) char VC8;
+typedef V (16) char VC16;
+
+extern char a[];
+
+#define A(expr) ((expr) ? (void)0 : abort ())
+
+void test_fold (int i)
+{
+ *(VC4*)a = (VC4){ };
+ A (strlen (a) == 0);
+ A (!a[1] && !a[2] && !a[3]);
+
+ *(VC4*)a = (VC4){ 0, 1 };
+ A (strlen (a) == 0);
+ A (a[1] == 1 && !a[2] && !a[3]);
+
+ *(VC4*)a = (VC4){ 1 };
+ A (strlen (a) == 1);
+ A (!a[1] && !a[2] && !a[3]);
+
+ *(VC4*)a = (VC4){ 1, 0, 3 };
+ A (strlen (a) == 1);
+ A (!a[1] && a[2] == 3 && !a[3]);
+
+ *(VC4*)a = (VC4){ 1, 2 };
+ A (strlen (a) == 2);
+ A (!a[2] && !a[3]);
+
+ *(VC4*)a = (VC4){ 1, 2, 0, 4 };
+ A (strlen (a) == 2);
+ A (!a[2] && a[3] == 4);
+
+ *(VC4*)a = (VC4){ 1, 2, 3 };
+ A (strlen (a) == 3);
+ A (!a[3]);
+
+ *(VC8*)a = (VC8){ 1, 2, 3, 0, 5 };
+ A (strlen (a) == 3);
+
+ *(VC8*)a = (VC8){ 1, 2, 3, 0, 5, 6 };
+ A (strlen (a) == 3);
+
+ *(VC8*)a = (VC8){ 1, 2, 3, 0, 5, 6, 7, 8 };
+ A (strlen (a) == 3);
+ A (strlen (a + 1) == 2);
+ A (strlen (a + 2) == 1);
+ A (strlen (a + 3) == 0);
+
+ A (a[4] == 5 && a[5] == 6 && a[6] == 7 && a[7] == 8);
+}
+
+/* { dg-final { scan-tree-dump-not "abort \\(" "optimized" } }
+ { dg-final { scan-tree-dump-not "strlen \\(" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tls/pr99466-1.c b/gcc/testsuite/gcc.dg/tls/pr99466-1.c
new file mode 100644
index 0000000..446850e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/pr99466-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-require-effective-target tls_emulated } */
+/* { dg-add-options tls } */
+__attribute__((weak))
+__thread int tlsvar = 3;
+/* { dg-final { scan-assembler ".weak_definition ___emutls_t.tlsvar" { target *-*-darwin* } } } */
+/* { dg-final { scan-assembler-not ".private_extern ___emutls_t.tlsvar" { target *-*-darwin* } } } */
diff --git a/gcc/testsuite/gcc.dg/tls/pr99466-2.c b/gcc/testsuite/gcc.dg/tls/pr99466-2.c
new file mode 100644
index 0000000..86ffaad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/pr99466-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-require-visibility "" } */
+/* { dg-require-effective-target tls_emulated } */
+/* { dg-add-options tls } */
+__attribute__((weak))
+__attribute__((visibility ("hidden")))
+__thread int tlsvar = 3;
+/* { dg-final { scan-assembler ".weak_definition ___emutls_t.tlsvar" { target *-*-darwin* } } } */
+/* { dg-final { scan-assembler ".private_extern ___emutls_t.tlsvar" { target *-*-darwin* } } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr100053.c b/gcc/testsuite/gcc.dg/torture/pr100053.c
new file mode 100644
index 0000000..3d17675
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100053.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+int __attribute__((returns_twice,noipa)) x() { return 0; }
+void __attribute__((noipa)) ar() {}
+void __attribute__((noipa)) as() { __builtin_abort (); }
+int a1, a2, a3;
+void __attribute__((noipa)) v(int init)
+{
+ if (!init) {
+ as();
+ if (a1)
+ goto aq;
+ x ();
+ }
+ ar();
+aq:
+ if (!init)
+ as();
+}
+
+int main()
+{
+ v(1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100329.c b/gcc/testsuite/gcc.dg/torture/pr100329.c
new file mode 100644
index 0000000..2a4331b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100329.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target lra } } */
+/* { dg-additional-options "--param tree-reassoc-width=2" } */
+
+unsigned int a0;
+
+unsigned int
+foo (unsigned int a1, unsigned int a2)
+{
+ unsigned int x;
+
+ asm goto ("" : "=r" (x) : : : lab);
+ a0 = x;
+
+ lab:
+ return x + a1 + a2 + 1;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100398.c b/gcc/testsuite/gcc.dg/torture/pr100398.c
new file mode 100644
index 0000000..41eadde
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100398.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int
+test5_limit (void)
+{
+ int addr;
+
+ asm goto ("" : "+r" (addr) : : : t_err);
+ return 0;
+
+ t_err:
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100492.c b/gcc/testsuite/gcc.dg/torture/pr100492.c
new file mode 100644
index 0000000..75229c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100492.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-additional-options "-ftree-loop-distribution" } */
+
+extern void abort (void);
+
+signed char a, c;
+int b, d, *e = &d, g;
+signed static char f;
+int main() {
+ int h = 0;
+ int a_ = a;
+ for (; a_ < 1; a = ++a_) {
+ int *i[5], **j = &i[4], ***k[3][2] = {{&j}}, ****l = &k[2][1], *****m = &l;
+ char *n = &c;
+ f = *e = g = 0;
+ for (; g < 2; g++) {
+ for (b = 0; b < 3; b++)
+ h = (h && (*n = 0)) == 0;
+ if (g)
+ break;
+ }
+ }
+ if (f != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100519.c b/gcc/testsuite/gcc.dg/torture/pr100519.c
new file mode 100644
index 0000000..89dff66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100519.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target lra } } */
+/* { dg-additional-options "--param tree-reassoc-width=2" } */
+
+unsigned int foo_a1, foo_a2;
+
+unsigned int foo()
+{
+ unsigned int v0, x;
+ asm goto("" : "=r"(x) : : : lab);
+lab:
+ v0 += x + x;
+ return v0 + x + foo_a1 + foo_a2;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100566.c b/gcc/testsuite/gcc.dg/torture/pr100566.c
new file mode 100644
index 0000000..ed85691
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100566.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+
+volatile int s, c;
+
+__attribute__((noipa)) void
+foo (void)
+{
+ if (c++ > 1)
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) int
+bar (void)
+{
+ int i = 0, j = s;
+ if (j == 0)
+ goto lab;
+ for (i = 0; i < j; i++)
+ {
+ lab:
+ foo ();
+ if (!j)
+ goto lab;
+ }
+ return 0;
+}
+
+int
+main ()
+{
+ s = 1;
+ bar ();
+ if (c != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100672.c b/gcc/testsuite/gcc.dg/torture/pr100672.c
new file mode 100644
index 0000000..cc62e71
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100672.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-additional-options "-w -Wno-psabi" } */
+
+typedef long long __attribute__((__vector_size__ (4 * sizeof (long long)))) V;
+
+V
+foo (V v)
+{
+ return -(v >> 1);
+}
+
+int
+main (void)
+{
+ V v = foo ((V) { -2, -4, -6, -8 });
+ if (v[0] != 1 || v[1] != 2 || v[2] != 3 || v[3] != 4)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100778.c b/gcc/testsuite/gcc.dg/torture/pr100778.c
new file mode 100644
index 0000000..7997f2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100778.c
@@ -0,0 +1,31 @@
+/* { dg-do run { target *-*-*gnu* } } */
+/* { dg-additional-options "-fno-tree-sink -fno-math-errno -ftree-vectorize -D_GNU_SOURCE" } */
+/* { dg-require-effective-target fenv_exceptions } */
+
+#include <fenv.h>
+
+double a[2];
+void __attribute__((noipa)) foo ()
+{
+ double x = a[0];
+ double y = a[1];
+ double norm = __builtin_sqrt (x*x + y*y);
+ if (norm > 1.)
+ {
+ x = x / norm;
+ y = y / norm;
+ }
+ a[0] = x;
+ a[1] = y;
+}
+
+int main()
+{
+ feenableexcept (FE_INVALID);
+ a[0] = 0.;
+ a[1] = 0.;
+ foo ();
+ if (a[0] != 0. || a[1] != 0.)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100923.c b/gcc/testsuite/gcc.dg/torture/pr100923.c
new file mode 100644
index 0000000..05a6341
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100923.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+int a = 1, b, c, *d = &a, *e = &a, f;
+void g(int h) {}
+void k(int *l)
+{
+ int ***j;
+ if (c)
+ {
+ *j = &l;
+ ***j;
+ }
+ g(*l);
+ *e = f;
+ if (*l)
+ {
+ int i = b / a;
+ a = i;
+ }
+}
+int main()
+{
+ k(d);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr100934.c b/gcc/testsuite/gcc.dg/torture/pr100934.c
new file mode 100644
index 0000000..43b7884
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr100934.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+int a, b, c, d, e;
+int main()
+{
+ int f = 0, g = 0;
+ for (; f < 2; f++)
+ {
+ int h, i;
+ for (h = 0; h < 2; h++)
+ {
+ b = e = g ? a % g : 0;
+ c = d;
+ for (i = 0; i < 1; i++)
+ g = 0;
+ for (; g < 2; g++)
+ ;
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101009.c b/gcc/testsuite/gcc.dg/torture/pr101009.c
new file mode 100644
index 0000000..2bbed1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101009.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fno-tree-sra -fno-tree-pre -ftree-loop-distribution" } */
+
+struct a {
+ unsigned b;
+ unsigned c;
+} e, *f = &e;
+int d = 1;
+int main() {
+ for (; d; d--) {
+ struct a g[] = {{2, 1}, {2, 1}};
+ *f = g[1];
+ }
+ if (e.c != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101025.c b/gcc/testsuite/gcc.dg/torture/pr101025.c
new file mode 100644
index 0000000..483e0ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101025.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+int a[10];
+int b, d, g;
+volatile char c;
+short e;
+volatile int f;
+int main()
+{
+ for (; d <= 9; d++) {
+ b = e = 0;
+ for (; e < 4; e++)
+ a[e] = 4;
+ for (; b <= 3; b++)
+ if (g)
+ f = 0;
+ else
+ a[b] = c;
+ }
+ if (a[1] != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101031.c b/gcc/testsuite/gcc.dg/torture/pr101031.c
new file mode 100644
index 0000000..daf3bcf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101031.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+
+int a;
+char b, e;
+static char *c = &b;
+static long d;
+void f(void);
+void __attribute__((noipa)) h() {
+ int g = 0;
+ for (; g < 2; ++g) {
+ d = *c;
+ *c = 1;
+ b = 0;
+ }
+ f();
+}
+void __attribute__((noipa)) f() {
+ if (d++)
+ c = &e;
+ for (; a;)
+ ;
+}
+int main() {
+ h();
+ if (b != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101088.c b/gcc/testsuite/gcc.dg/torture/pr101088.c
new file mode 100644
index 0000000..00fce39
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101088.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+
+int bh, on, h0;
+
+void
+qw (int n2)
+{
+ int *e5;
+
+ if (n2 == 0)
+ {
+ n2 = 1;
+ while (n2 != 0)
+ for (n2 = 0; n2 < 1; ++n2)
+ {
+ }
+
+ e5 = &n2;
+ }
+ else
+ e5 = &on;
+
+ while (h0 < 1)
+ {
+ if (on == 0)
+ {
+ ++*e5;
+ bh = 0;
+ }
+ else
+ {
+ bh = 0;
+ ++on;
+ *e5 = on;
+ h0 = *e5;
+ if (h0 == 0)
+ {
+ *e5 = 0;
+ ++h0;
+ }
+ }
+
+ ++h0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101105.c b/gcc/testsuite/gcc.dg/torture/pr101105.c
new file mode 100644
index 0000000..9222351
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101105.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+
+short a;
+int b[5][4] = {2, 2};
+int d;
+short e(int f) { return f == 0 || a && f == 1 ? 0 : a; }
+int main() {
+ int g, h;
+ g = 3;
+ for (; g >= 0; g--) {
+ h = 3;
+ for (; h >= 0; h--)
+ b[g][h] = b[0][1] && e(1);
+ }
+ d = b[0][1];
+ if (d != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101151.c b/gcc/testsuite/gcc.dg/torture/pr101151.c
new file mode 100644
index 0000000..15c9a7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101151.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+int a, *b = &a, c, d;
+int main() {
+ *b;
+ if (a) {
+ L1:
+ a = 0;
+ L2:
+ if (d) {
+ while (b)
+ ;
+ goto L1;
+ }
+ }
+ if (c)
+ goto L2;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101173.c b/gcc/testsuite/gcc.dg/torture/pr101173.c
new file mode 100644
index 0000000..0c9090d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101173.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-additional-options "-floop-interchange" } */
+
+int a[6][9];
+int main()
+{
+ a[1][3] = 8;
+ for (int b = 1; b <= 5; b++)
+ for (int d = 0; d <= 5; d++)
+#pragma GCC unroll 0
+ for (int c = 0; c <= 5; c++)
+ a[b][c] = a[b][c + 2] & 216;
+ for (int e = 0; e < 6; e++)
+ for (int f = 0; f < 9; f++)
+ if (a[e][f] != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101202.c b/gcc/testsuite/gcc.dg/torture/pr101202.c
new file mode 100644
index 0000000..e76c908
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101202.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize" } */
+
+int printf(const char *, ...);
+unsigned a, b, d;
+int c, e, f;
+int main()
+{
+ while (a)
+ if (b)
+ {
+ f = a;
+ while (e)
+ {
+ int h, i;
+ if (d)
+ {
+ h = a;
+ i = d;
+L:
+ d = a | d && c;
+ if (a)
+ {
+ printf("%d", a);
+ goto L;
+ }
+ }
+ a = h;
+ d = i;
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101229.c b/gcc/testsuite/gcc.dg/torture/pr101229.c
new file mode 100644
index 0000000..3708031
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101229.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+int a[1024];
+void foo()
+{
+ for (int i; i; i += 4) {
+ int suma = a[i];
+ int sumb = a[i + 1];
+ int sumc;
+ for (unsigned j = 0; j < 77; ++j) {
+ suma = (suma ^ i) + 1;
+ sumb = (sumb ^ i) + 2;
+ sumc = suma ^ i;
+ }
+ a[i] = suma;
+ a[i + 1] = sumb;
+ a[i + 2] = sumc;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101230-1.c b/gcc/testsuite/gcc.dg/torture/pr101230-1.c
new file mode 100644
index 0000000..f10ca8b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101230-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-signed-zeros" } */
+
+
+double distance3d_sqr_pt4d_pt4d(void);
+
+int update_r_k_curr_cluster;
+void update_r_k(void) {
+ double curr_distance = distance3d_sqr_pt4d_pt4d();
+ for (int cluster; cluster; cluster++)
+ if (0 < curr_distance) {
+ curr_distance = 0;
+ update_r_k_curr_cluster = cluster;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101278.c b/gcc/testsuite/gcc.dg/torture/pr101278.c
new file mode 100644
index 0000000..1d25658
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101278.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+struct X { int counter; };
+
+struct X __attribute__((noipa)) foo (struct X x)
+{
+ x.counter++;
+ if (x.counter == 5)
+ __builtin_exit (0);
+ return x;
+}
+
+int
+main ()
+{
+ struct X x;
+ x.counter = 0;
+ for (int i = 0; i < 10; ++i)
+ x = foo (x);
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101394.c b/gcc/testsuite/gcc.dg/torture/pr101394.c
new file mode 100644
index 0000000..87fbdad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101394.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+int a, b, c, d;
+void h();
+int e() __attribute__((returns_twice));
+void f() {
+ int *g = (int *)(__INTPTR_TYPE__)c;
+ if (b) {
+ h();
+ g--;
+ if (a)
+ if (d)
+ h();
+ }
+ if (g++)
+ e();
+ c = (__INTPTR_TYPE__)g;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr101512.c b/gcc/testsuite/gcc.dg/torture/pr101512.c
new file mode 100644
index 0000000..a25da2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101512.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-w -Wno-psabi" } */
+
+int n();
+typedef unsigned long V __attribute__ ((vector_size (64)));
+V
+foo (int i, V v)
+{
+ i = ((V)(V){n()})[n()];
+ return v + i;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr102124.c b/gcc/testsuite/gcc.dg/torture/pr102124.c
new file mode 100644
index 0000000..a158b4a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr102124.c
@@ -0,0 +1,27 @@
+/* PR tree-optimization/102124 */
+
+int
+foo (const unsigned char *a, const unsigned char *b, unsigned long len)
+{
+ int ab, ba;
+ unsigned long i;
+ for (i = 0, ab = 0, ba = 0; i < len; i++)
+ {
+ ab |= a[i] - b[i];
+ ba |= b[i] - a[i];
+ }
+ return (ab | ba) >= 0;
+}
+
+int
+main ()
+{
+ unsigned char a[32] = { 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a' };
+ unsigned char b[32] = { 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a' };
+ unsigned char c[32] = { 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b' };
+ if (!foo (a, b, 16))
+ __builtin_abort ();
+ if (foo (a, c, 16))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr102139.c b/gcc/testsuite/gcc.dg/torture/pr102139.c
new file mode 100644
index 0000000..06c1357
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr102139.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-additional-options "-ftree-slp-vectorize" } */
+
+typedef double aligned_double __attribute__((aligned(2*sizeof(double))));
+
+void __attribute__((noipa))
+bar (int aligned, double *p)
+{
+ if (aligned)
+ {
+ *(aligned_double *)p = 3.;
+ p[1] = 4.;
+ }
+ else
+ {
+ p[2] = 0.;
+ p[3] = 1.;
+ }
+}
+
+void __attribute__((noipa))
+foo (int i)
+{
+ if (i)
+ __builtin_exit (0);
+}
+void __attribute__((noipa))
+baz (double *p)
+{
+ p[0] = 0.;
+ p[1] = 1.;
+ foo (1);
+ *(aligned_double *)p = 3.;
+ p[1] = 4.;
+}
+
+double x[8] __attribute__((aligned(2*sizeof (double))));
+int main()
+{
+ bar (0, &x[1]);
+ baz (&x[1]);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr102149.c b/gcc/testsuite/gcc.dg/torture/pr102149.c
new file mode 100644
index 0000000..34a8c21
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr102149.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fno-vect-cost-model" } */
+
+int a[8];
+int *b = &a[6];
+char c;
+int main()
+{
+ int d = 7;
+ for (; d >= 0; d--)
+ {
+ *b = 1;
+ c = a[d] >> 3;
+ a[d] = c;
+ }
+ if (a[6] != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr69170.c b/gcc/testsuite/gcc.dg/torture/pr69170.c
index 2af0bde..a39125a 100644
--- a/gcc/testsuite/gcc.dg/torture/pr69170.c
+++ b/gcc/testsuite/gcc.dg/torture/pr69170.c
@@ -6,7 +6,7 @@ typedef struct {
char buf[];
} hash_state;
int a;
-hash_state b;
+extern hash_state b;
void fn1()
{
a = 0;
diff --git a/gcc/testsuite/gcc.dg/torture/pr70025.c b/gcc/testsuite/gcc.dg/torture/pr70025.c
index 6c43a0a..7cf28c4 100644
--- a/gcc/testsuite/gcc.dg/torture/pr70025.c
+++ b/gcc/testsuite/gcc.dg/torture/pr70025.c
@@ -80,3 +80,8 @@ main ()
__builtin_abort ();
return 0;
}
+
+/* At -O3 the loop in bar() is vectorized and results in a (possibly
+ unreachable) out-of-bounds store to p.d7[8]:
+ _22(D)->d7[8] = _122;
+ { dg-prune-output "-Wstringop-overflow" } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr79334-0.c b/gcc/testsuite/gcc.dg/torture/pr79334-0.c
new file mode 100644
index 0000000..fa45a6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr79334-0.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-additional-sources "pr79334-1.c" } */
+
+extern int d[][8];
+
+static void __attribute__((noinline))
+func_that_exits (int flag)
+{
+ if (!flag)
+ __builtin_exit (0);
+}
+
+int main ()
+{
+ int e = 0;
+ while (1)
+ {
+ func_that_exits (e);
+ /* We do not know whether d[1024][0] will trap. */
+ e = d[1024][0];
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr79334-1.c b/gcc/testsuite/gcc.dg/torture/pr79334-1.c
new file mode 100644
index 0000000..b1c8a27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr79334-1.c
@@ -0,0 +1 @@
+int d[1][8];
diff --git a/gcc/testsuite/gcc.dg/torture/pr93491.c b/gcc/testsuite/gcc.dg/torture/pr93491.c
new file mode 100644
index 0000000..2cb4c0c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr93491.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+
+extern void exit (int);
+
+__attribute__((noipa))
+void f(int i)
+{
+ exit(i);
+}
+
+__attribute__((const,noipa))
+int g(int i)
+{
+ return 1 / i;
+}
+
+int main()
+{
+ while (1)
+ {
+ f(0);
+ f(g(0));
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr94947-1.c b/gcc/testsuite/gcc.dg/torture/pr94947-1.c
index ab8b488..832e40d 100644
--- a/gcc/testsuite/gcc.dg/torture/pr94947-1.c
+++ b/gcc/testsuite/gcc.dg/torture/pr94947-1.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-additional-sources "pr94947-2.c" } */
/* { dg-additional-options "-fipa-pta -flto-partition=1to1" } */
+/* { dg-prune-output "warning: using serial compilation" } */
extern void abort ();
extern void baz ();
diff --git a/gcc/testsuite/gcc.dg/torture/pr96513.c b/gcc/testsuite/gcc.dg/torture/pr96513.c
new file mode 100644
index 0000000..5ee040e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr96513.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+typedef struct {
+ short a;
+ short b;
+} c;
+c *d;
+int e, f, i, j, k, l, m, n, o, p;
+c g, h;
+void q() {
+ do {
+ if (o) {
+ (*d).a = (*d).b = d[e].a = d[e].a * 3 + 1 >> 15;
+ d[e].b = d[e].b * 3 + 1 >> 15;
+ }
+ n = -(d[e].b * g.b) >> 5;
+ m = d[e].b * g.a + 1 >> 5;
+ l = d[f].a * -d[f].b * h.b + 1 >> 5;
+ k = d[f].a * h.b + d[f].b * h.a + 1 >> 5;
+ j = n + l;
+ i = m - k;
+ (*d).a += j;
+ d[e].a -= i;
+ ++d;
+ } while (--p);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr98601.c b/gcc/testsuite/gcc.dg/torture/pr98601.c
new file mode 100644
index 0000000..ee9d076
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr98601.c
@@ -0,0 +1,14 @@
+/* PR rtl-optimization/98601 */
+/* { dg-do compile } */
+
+void
+foo (void *p)
+{
+ asm ("" : "=m" (*p)); /* { dg-warning "dereferencing 'void \\*' pointer" } */
+}
+
+void
+bar (void *p)
+{
+ asm volatile ("" : : "m" (*p)); /* { dg-warning "dereferencing 'void \\*' pointer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99652-1.c b/gcc/testsuite/gcc.dg/torture/pr99652-1.c
new file mode 100644
index 0000000..c2395ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99652-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-mgeneral-regs-only" } */
+
+inline double
+foo (void)
+{
+ return 1.0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99652-2.c b/gcc/testsuite/gcc.dg/torture/pr99652-2.c
new file mode 100644
index 0000000..beefad8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99652-2.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-mno-80387" } */
+
+inline double
+foo (void)
+{
+ return 1.0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99694.c b/gcc/testsuite/gcc.dg/torture/pr99694.c
new file mode 100644
index 0000000..df31696
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99694.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-w" } */
+
+#include <stdint.h>
+
+int a, b, c;
+void d() {
+ uint16_t e;
+ int32_t *f;
+ int32_t *g;
+ if (a) {
+ int32_t *k;
+ for (;; *k += 1) {
+ int32_t **i = &f;
+ int32_t **l = &g;
+ for (e = 6; e; e++) {
+ g = k = f;
+ j:
+ **l = 0;
+ }
+ *i = c;
+ }
+ }
+ uint16_t i = &e;
+ b = i / 0;
+ goto j;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99824.c b/gcc/testsuite/gcc.dg/torture/pr99824.c
new file mode 100644
index 0000000..9022d4a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99824.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+
+unsigned int
+strlenx(char *s)
+{
+ char *orig_s = s;
+ for (; *s; ++s)
+ ;
+ return s - orig_s;
+}
+
+struct i2c_adapter {
+ char name[48];
+};
+
+struct {
+ int instance;
+ struct i2c_adapter i2c_adap[];
+} * init_cx18_i2c_cx;
+
+const struct i2c_adapter cx18_i2c_adap_template = {""};
+int init_cx18_i2c___trans_tmp_1;
+
+void
+init_cx18_i2c()
+{
+ int i = 0;
+ for (;; i++) {
+ init_cx18_i2c_cx->i2c_adap[i] = cx18_i2c_adap_template;
+ init_cx18_i2c___trans_tmp_1
+ = strlenx(init_cx18_i2c_cx->i2c_adap[i].name);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99880.c b/gcc/testsuite/gcc.dg/torture/pr99880.c
new file mode 100644
index 0000000..7e09899
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99880.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize" } */
+
+unsigned a;
+int b, c, d, e;
+void f() {
+ b = 5;
+ for (; b <= 51; b++)
+ ;
+ unsigned int g = -8;
+ while (g) {
+ g += 5;
+ int h = 10;
+ do {
+ h -= a = 1;
+ for (; a; a++)
+ ;
+ c *= c >= d >= b;
+ } while (h);
+ c -= e;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99947.c b/gcc/testsuite/gcc.dg/torture/pr99947.c
new file mode 100644
index 0000000..2cf3ec6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99947.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+int a, b, d, e;
+short c;
+void f() {
+ for (; e; e++) {
+ int g = 6;
+ for (; g > 2; g--) {
+ int i = -8;
+ while (i < 20) {
+ i += 5;
+ a += b;
+ }
+ c *= d;
+ }
+ b--;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99954.c b/gcc/testsuite/gcc.dg/torture/pr99954.c
new file mode 100644
index 0000000..7d44703
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99954.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+
+#include <assert.h>
+
+#define CONTAINER_KIND union
+
+typedef CONTAINER_KIND container { int value; } container;
+
+void move(container* end, container* start) {
+ container* p;
+ for (p = end; p > start; p--) {
+ (p)->value = (p-1)->value;
+ }
+}
+
+#define N 100
+
+int main(int argc, char* argv[]) {
+ container vals[N];
+ int i;
+ for (i=0; i<N; i++) {
+ vals[i].value = argc + i;
+ }
+ move(&vals[N-1], &vals[0]);
+ assert(vals[0].value == argc + 0);
+ for (i=1; i<N; i++) {
+ assert(vals[i].value == argc + i - 1);
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/vshuf-4.inc b/gcc/testsuite/gcc.dg/torture/vshuf-4.inc
index d041b33..fb35df8 100644
--- a/gcc/testsuite/gcc.dg/torture/vshuf-4.inc
+++ b/gcc/testsuite/gcc.dg/torture/vshuf-4.inc
@@ -25,7 +25,9 @@ T (21, 2, 6, 3, 7) \
T (22, 1, 2, 3, 0) \
T (23, 2, 1, 0, 3) \
T (24, 2, 5, 6, 3) \
-T (25, 0, 1, 4, 5)
+T (25, 0, 1, 4, 5) \
+T (26, 1, 5, 3, 7) \
+T (27, 0, 5, 2, 7)
#define EXPTESTS \
T (116, 1, 2, 4, 3) \
T (117, 7, 3, 3, 0) \
diff --git a/gcc/testsuite/gcc.dg/torture/vshuf-8.inc b/gcc/testsuite/gcc.dg/torture/vshuf-8.inc
index de358f3..d628039 100644
--- a/gcc/testsuite/gcc.dg/torture/vshuf-8.inc
+++ b/gcc/testsuite/gcc.dg/torture/vshuf-8.inc
@@ -27,7 +27,9 @@ T (23, 6, 5, 4, 3, 2, 1, 0, 7) \
T (24, 0, 1, 2, 3, 8, 9, 10, 11) \
T (25, 0, 1, 2, 3, 12, 13, 14, 15) \
T (26, 0, 1, 8, 9, 10, 11, 12, 13) \
-T (27, 0, 8, 9, 10, 11, 12, 13, 14)
+T (27, 0, 8, 9, 10, 11, 12, 13, 14) \
+T (28, 1, 9, 3, 11, 5, 13, 7, 15) \
+T (29, 0, 9, 2, 11, 4, 13, 6, 15)
#define EXPTESTS \
T (116, 9, 3, 9, 4, 7, 0, 0, 6) \
T (117, 4, 14, 12, 8, 9, 6, 0, 10) \
diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
index bbba052..594c3f3 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */
+/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-tree-einline-optimized" } */
volatile int one;
static int
add1 (int val)
@@ -22,7 +22,7 @@ int
main (void)
{
int i, val = 0;
- for (i = 0; i < 100000; i++)
+ for (i = 0; i < 10000000; i++)
{
val = do_op (val, add1);
val = do_op (val, sub1);
@@ -31,5 +31,5 @@ main (void)
}
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "profile"} } */
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "profile"} } */
-/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "afdo"} } */
-/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "afdo"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "Inlining add1/1 into main/4." "einline"} } */
+/* { dg-final-use-autofdo { scan-tree-dump "Inlining sub1/2 into main/4." "einline"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c
index 138b85a..7020452 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */
static int a1 (void)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-11.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-11.c
new file mode 100644
index 0000000..73117c4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-11.c
@@ -0,0 +1,32 @@
+/* PR middle-end/100732 - ICE on sprintf %s with integer argument
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+
+char d[32];
+
+void gb (_Bool b)
+{
+ __builtin_snprintf (d, 32, "%s", b); // { dg-warning "\\\[-Wformat" }
+}
+
+void gi (int i)
+{
+ __builtin_snprintf (d, 32, "%s", i); // { dg-warning "\\\[-Wformat" }
+}
+
+void gd (char *d, double x)
+{
+ __builtin_snprintf (d, 32, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+
+struct X { int i; };
+
+void gx (char *d, struct X x)
+{
+ __builtin_snprintf (d, 32, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+/* Also verify that the invalid sprintf call isn't folded to strcpy.
+ { dg-final { scan-tree-dump-times "snprintf" 4 "optimized" } }
+ { dg-final { scan-tree-dump-not "strcpy" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-12.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-12.c
new file mode 100644
index 0000000..9e26356
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-12.c
@@ -0,0 +1,36 @@
+/* PR middle-end/100732 - ICE on sprintf %s with integer argument
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+
+#define snprintf(d, n, f, ...) \
+ __builtin___snprintf_chk (d, n, 0, 32, f, __VA_ARGS__)
+
+int n;
+
+void gb (char *d, _Bool b)
+{
+ snprintf (d, n, "%s", b); // { dg-warning "\\\[-Wformat" }
+}
+
+void gi (char *d, int i)
+{
+ snprintf (d, n, "%s", i); // { dg-warning "\\\[-Wformat" }
+}
+
+void gd (char *d, double x)
+{
+ snprintf (d, n, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+
+struct X { int i; };
+
+void gx (char *d, struct X x)
+{
+ snprintf (d, n, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+
+/* Also verify that the invalid sprintf call isn't folded to strcpy.
+ { dg-final { scan-tree-dump-times "snprintf_chk" 4 "optimized" } }
+ { dg-final { scan-tree-dump-not "strcpy" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-28.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-28.c
new file mode 100644
index 0000000..c1d0083
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-28.c
@@ -0,0 +1,30 @@
+/* PR middle-end/100732 - ICE on sprintf %s with integer argument
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+
+void gb (char *d, _Bool b)
+{
+ __builtin_sprintf (d, "%s", b); // { dg-warning "\\\[-Wformat" }
+}
+
+void gi (char *d, int i)
+{
+ __builtin_sprintf (d, "%s", i); // { dg-warning "\\\[-Wformat" }
+}
+
+void gd (char *d, double x)
+{
+ __builtin_sprintf (d, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+
+struct X { int i; };
+
+void gx (char *d, struct X x)
+{
+ __builtin_sprintf (d, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+/* Also verify that the invalid sprintf call isn't folded to strcpy.
+ { dg-final { scan-tree-dump-times "sprintf" 4 "optimized" } }
+ { dg-final { scan-tree-dump-not "strcpy" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-29.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-29.c
new file mode 100644
index 0000000..d0f7db2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-29.c
@@ -0,0 +1,40 @@
+/* PR middle-end/100732 - ICE on sprintf %s with integer argument
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+
+#define sprintf(d, f, ...) \
+ __builtin___sprintf_chk (d, 0, 32, f, __VA_ARGS__)
+
+
+void fi (int i, const char *s)
+{
+ sprintf (i, "%s", s); // { dg-warning "\\\[-Wint-conversion" }
+}
+
+void gb (char *d, _Bool b)
+{
+ sprintf (d, "%s", b); // { dg-warning "\\\[-Wformat" }
+}
+
+void gi (char *d, int i)
+{
+ sprintf (d, "%s", i); // { dg-warning "\\\[-Wformat" }
+}
+
+void gd (char *d, double x)
+{
+ sprintf (d, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+
+struct X { int i; };
+
+void gx (char *d, struct X x)
+{
+ sprintf (d, "%s", x); // { dg-warning "\\\[-Wformat" }
+}
+
+
+/* Also verify that the invalid sprintf call isn't folded to strcpy.
+ { dg-final { scan-tree-dump-times "sprintf_chk" 5 "optimized" } }
+ { dg-final { scan-tree-dump-not "strcpy" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-3.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-3.c
index fae2a1b..ec55f26 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-3.c
@@ -15,7 +15,7 @@ extern void string_lt_0_fail ();
extern void string_eq_0_fail ();
extern void string_gt_0_fail ();
-void test_string (char *d, const char *s)
+void test_string_eq_min (char *d, const char *s)
{
int n = __builtin_sprintf (d, "%-s", s);
@@ -23,13 +23,36 @@ void test_string (char *d, const char *s)
or INT_MAX. (This is a white box test based on knowing that
the optimization computes its own values of the two constants.) */
if (n == INT_MIN) string_eq_min_fail ();
+}
+
+void test_string_eq_max (char *d, const char *s)
+{
+ int n = __builtin_sprintf (d, "%-s", s);
+
if (n == INT_MAX) string_eq_max_fail ();
+}
+
+void test_string_lt_0 (char *d, const char *s)
+{
+ int n = __builtin_sprintf (d, "%-s", s);
/* The return value could be negative when strlen(s) is in excess
of 4095 (the maximum number of bytes a single directive is required
to handle). */
if (n < 0) string_lt_0_fail ();
+}
+
+void test_string_eq_0 (char *d, const char *s)
+{
+ int n = __builtin_sprintf (d, "%-s", s);
+
if (n == 0) string_eq_0_fail ();
+}
+
+void test_string_gt_0 (char *d, const char *s)
+{
+ int n = __builtin_sprintf (d, "%-s", s);
+
if (n > 0) string_gt_0_fail ();
}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c
new file mode 100644
index 0000000..677b634
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c
@@ -0,0 +1,38 @@
+/* PR middle-end/100307 - spurious -Wplacement-new with negative pointer
+ offset
+ { dg-do compile }
+ { dg-options "-O0 -Wall" } */
+
+extern int sprintf (char*, const char*, ...);
+
+char a[4];
+
+void nowarn_1m1 ()
+{
+ char *p = a + 1;
+ sprintf (p - 1, "%i", 123); // { dg-bogus "-Wformat-overflow" }
+}
+
+void nowarn_4m3 ()
+{
+ char *p = a + 4;
+ sprintf (p - 3, "%i", 12); // { dg-bogus "-Wformat-overflow" }
+}
+
+void warn_2m1 ()
+{
+ char *p = a + 2;
+ sprintf (p - 1, "%i", 123); // { dg-warning "-Wformat-overflow" "pr100325" }
+}
+
+void warn_3m1 ()
+{
+ char *p = a + 3;
+ sprintf (p - 1, "%i", 12); // { dg-warning "-Wformat-overflow" "pr100325" }
+}
+
+void warn_4m1 ()
+{
+ char *p = a + 4;
+ sprintf (p - 1, "%i", 1); // { dg-warning "-Wformat-overflow" "pr100325" }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-27.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-27.c
new file mode 100644
index 0000000..8188dd8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-27.c
@@ -0,0 +1,20 @@
+/* PR middle-end/100325 - missing warning with -O0 on sprintf overflow with
+ pointer plus offset
+ { dg-do compile }
+ { dg-options "-O0 -Wall" } */
+
+#define S(n) (&"0123456789"[10 - n])
+
+extern int sprintf (char*, const char*, ...);
+
+char d[10];
+
+void nowarn_d10_s9 ()
+{
+ sprintf (d, "%s", S (9)); // { dg-bogus "-Wformat-overflow" }
+}
+
+void warn_d10_s10 ()
+{
+ sprintf (d, "%s", S (10)); // { dg-warning "-Wformat-overflow" }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp-trans.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp-trans.c
new file mode 100644
index 0000000..8ee8e3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp-trans.c
@@ -0,0 +1,144 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+/* Simple tests to make sure transitives are working. */
+void keep();
+void kill();
+
+void
+f1 (int x, int y, int z)
+{
+ if (x > y)
+ if (y > z)
+ {
+ if (x > z)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+void
+f2 (int w, int x, int y, int z)
+{
+ // Test one equivalence.
+ if (w == z)
+ if (x > y)
+ if (y > z)
+ {
+ if (x > w)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+void
+f3 (int a, int w, int x, int y, int z)
+{
+ // Test two equivlaences.
+ if (a == x)
+ if (w == z)
+ if (x > y)
+ if (y > z)
+ {
+ if (a > w)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+void
+f4 (int x, int y, int z)
+{
+ // test X > Y >= Z
+ if (x > y)
+ if (y >= z)
+ {
+ if (x > z)
+ keep ();
+ else
+ kill ();
+ }
+}
+void
+f5 (int x, int y, int z)
+{
+ // test X >= Y > Z
+ if (x >= y)
+ if (y > z)
+ {
+ if (x > z)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+void
+f6 (int x, int y, int z)
+{
+ // test X >= Y >= Z
+ if (x >= y)
+ if (y >= z)
+ {
+ if (x > z)
+ keep ();
+ else if (x == z)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+void
+f7 (int x, int y, int z)
+{
+ // test Y <= X , Z <= Y
+ if (y <= x)
+ if (z <= y)
+ {
+ if (x > z)
+ keep ();
+ else if (x == z)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+void
+f8 (int x, int y, int z)
+{
+ // test X >= Y, Z <= Y
+ if (x >= y)
+ if (z <= y)
+ {
+ if (x > z)
+ keep ();
+ else if (x == z)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+void
+f9 (int x, int y, int z)
+{
+ // test Y <= X Y >= Z
+ if (y <= x)
+ if (y >= z)
+ {
+ if (x > z)
+ keep ();
+ else if (x == z)
+ keep ();
+ else
+ kill ();
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "kill" "evrp" } } */
+/* { dg-final { scan-tree-dump-times "keep" 13 "evrp"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp1.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp1.c
index 8c6e4e6..f5f38c4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/evrp1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
int foo (int i);
int bar (int j)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c
index f1373bd..d791305 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp -fdelete-null-pointer-checks" } */
extern void link_error ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp2.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp2.c
index e6d4235..fc92cdf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/evrp2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
int foo (int i);
int bar2 (int j)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp3.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp3.c
index 1a3bbd5..805652b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/evrp3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
int foo (int i);
void bar (int j)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c
new file mode 100644
index 0000000..2c5ff41
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c
@@ -0,0 +1,16 @@
+/* Confirm the ranger is picking up a relationship with equivalences. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+extern void foo ();
+
+void f (unsigned int a, unsigned int b)
+{
+ if (a == b)
+ for (unsigned i = 0; i < a; i++)
+ if (i == b) // Confirm i < a also means i < b.
+ foo (); /* Unreachable */
+}
+
+/* { dg-final { scan-tree-dump-times "foo\\(" 0 "evrp"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp4.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp4.c
index 6710e6b..e3f4531 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/evrp4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
int foo (int *p);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp6.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp6.c
index 35d4d74..aaeec68 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/evrp6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp6.c
@@ -1,6 +1,5 @@
-
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c
index 9e0cedf..67846a5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c
@@ -1,5 +1,8 @@
/* { dg-do compile { target size32plus } } */
-/* { dg-options "-O2 -ftree-loop-distribution -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */
+/* The desire is to show we can generate a memset from the outer loop
+ store. Both store motion and PRE expose a DSE opportunity for this
+ zeroing - while desirable this defeats the purpose of this testcase. */
+/* { dg-options "-O2 -fno-tree-loop-im -fno-tree-pre -ftree-loop-distribution -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */
#define N (1024)
double a[N][N], b[N][N], c[N][N];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-16.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-16.c
new file mode 100644
index 0000000..781555e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-16.c
@@ -0,0 +1,22 @@
+/* PR/101280 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-linterchange-details" } */
+
+void dummy (double *, double *);
+#define LEN_2D 32
+double aa[LEN_2D][LEN_2D], bb[LEN_2D][LEN_2D];
+double s231(int iterations)
+{
+// loop interchange
+// loop with data dependency
+ for (int nl = 0; nl < 100*(iterations/LEN_2D); nl++) {
+ for (int i = 0; i < LEN_2D; ++i) {
+ for (int j = 1; j < LEN_2D; j++) {
+ aa[j][i] = aa[j - 1][i] + bb[j][i];
+ }
+ }
+ dummy(aa[0],bb[0]);
+ }
+}
+
+/* { dg-final { scan-tree-dump "loops interchanged" "linterchange" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
index 3ac217b..a277c70 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
@@ -10,17 +10,17 @@ void a(char *ptr, char *ptr2)
__attribute__((noinline))
void b(char *ptr)
{
- a(ptr+1,&ptr[2]);
+ a(ptr+1,&ptr[3]);
}
int main()
{
- char c[4]={0,1,2,0};
+ char c[5]={0,1,2,0,0};
b(c);
- return c[0]+c[3];
+ return c[0]+c[4];
}
/* Check that both param offsets are determined correctly and the computation
is optimized out. */
/* { dg-final { scan-tree-dump "param offset:1" "modref1" } } */
-/* { dg-final { scan-tree-dump "param offset:2" "modref1" } } */
+/* { dg-final { scan-tree-dump "param offset:3" "modref1" } } */
/* { dg-final { scan-tree-dump "return 0" "modref1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-6.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-6.c
new file mode 100644
index 0000000..2d97a49
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-6.c
@@ -0,0 +1,37 @@
+/* { dg-options "-O2 -fdump-tree-modref1 -fdump-tree-optimized" } */
+/* { dg-do compile } */
+int c;
+__attribute__ ((noinline))
+int *test (int *b)
+{
+ c++;
+ return *b ? &c : 0;
+}
+__attribute__ ((noinline, pure))
+int *pure_test (int *b)
+{
+ return *b && c ? &c : 0;
+}
+__attribute__ ((noinline, const))
+int *const_test (int *b)
+{
+ return b ? &c : 0;
+}
+void escape (int *);
+
+int test2()
+{
+ int a = 42;
+ escape (test (&a));
+ escape (pure_test (&a));
+ escape (const_test (&a));
+ return a;
+}
+/* Flags for normal call. */
+/* { dg-final { scan-tree-dump "parm 0 flags: direct noclobber noescape nodirectescape not_returned" "modref1" } } */
+/* Flags for pure call. */
+/* { dg-final { scan-tree-dump "parm 0 flags: direct not_returned" "modref1" } } */
+/* Flags for const call. */
+/* { dg-final { scan-tree-dump "parm 0 flags: not_returned" "modref1" } } */
+/* Overall we want to make "int a" non escaping. */
+/* { dg-final { scan-tree-dump "return 42" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-7.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-7.c
new file mode 100644
index 0000000..53ffa1c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-7.c
@@ -0,0 +1,13 @@
+/* { dg-options "-O2 --param modref-max-accesses=1 -fdump-tree-modref1" } */
+/* { dg-do compile } */
+struct a {
+ int array[10];
+ int tail;
+};
+int test(struct a *a, int p)
+{
+ a->array[p] = 0;
+ a->array[0] = 1;
+}
+/* All three accesses combine to one bigger access. */
+/* { dg-final { scan-tree-dump-not "param=modref-max-accesses" "modref1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-8.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-8.c
new file mode 100644
index 0000000..15ae4ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-8.c
@@ -0,0 +1,25 @@
+/* { dg-options "-O2 --param modref-max-adjustments=8 -fdump-tree-modref1" } */
+/* { dg-do compile } */
+void
+set (char *p)
+{
+ p[1]=1;
+ p[0]=0;
+ p[2]=2;
+ p[4]=4;
+ p[3]=3;
+}
+
+void
+recurse (char *p, int n)
+{
+ *p = 0;
+ if (n)
+ recurse (p+1,n-1);
+}
+/* { dg-final { scan-tree-dump-not "param=modref-max-accesses" "modref1" } } */
+/* { dg-final { scan-tree-dump "param=modref-max-adjustments" "modref1" } } */
+/* In set all accesses should merge together. */
+/* { dg-final { scan-tree-dump "access: Parm 0 param offset:0 offset:0 size:8 max_size:40" "modref1" } } */
+/* In recurse we should cap the recrusion after 8 attempts and set max_size to -1. */
+/* { dg-final { scan-tree-dump "access: Parm 0 param offset:0 offset:0 size:8 max_size:-1 adjusted 8 times" "modref1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-9.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-9.c
new file mode 100644
index 0000000..02de2f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-9.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O2 --param modref-max-accesses=2 -fdump-tree-modref1" } */
+/* { dg-do compile } */
+void
+test(char *a)
+{
+ a[0] = 0;
+ a[1] = 1;
+ a[3] = 3;
+ a[7] = 7;
+ a[9] = 9;
+}
+/* We allow only two accesses per function.
+ It is best to group together {0,1,3} and {7,9}. */
+/* { dg-final { scan-tree-dump "access: Parm 0 param offset:0 offset:0 size:8 max_size:32" "modref1" } } */
+/* { dg-final { scan-tree-dump "access: Parm 0 param offset:7 offset:0 size:8 max_size:24" "modref1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c
index 4c190e6..3681fa7 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c
@@ -7,4 +7,4 @@ int eqm1_phi (unsigned long a) { return a ? 0 : -1; }
int spaceship1 (long a) { return a > 0 ? 1 : a < 0 ? -1 : 0; }
int spaceship2 (long a) { return a > 0 ? 1 : a == 0 ? 0 : -1; }
-/* { dg-final { scan-tree-dump-times " = -\[^\r\n\]*_.;" 4 "optimized"} } */
+/* { dg-final { scan-tree-dump-times " = -\[^\r\n\]*_\[0-9\]*;" 4 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c
index ac3018e..6aec689 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c
@@ -9,4 +9,6 @@ foo (int i)
return i;
}
-/* { dg-final { scan-tree-dump-not "ABS" "optimized" } } */
+/* We should not have ABS_EXPR but ABSU_EXPR instead. */
+/* { dg-final { scan-tree-dump-not "ABS_EXPR" "optimized" } } */
+/* { dg-final { scan-tree-dump "ABSU" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-23.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-23.c
new file mode 100644
index 0000000..ff658cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-23.c
@@ -0,0 +1,44 @@
+/* { dg-options "-O2 -fdump-tree-phiopt" } */
+
+int f0(int A)
+{
+// A == 0? A : -A same as -A
+ if (A == 0) return A;
+ return -A;
+}
+
+int f1(int A)
+{
+// A != 0? A : -A same as A
+ if (A != 0) return A;
+ return -A;
+}
+int f2(int A)
+{
+// A >= 0? A : -A same as abs (A)
+ if (A >= 0) return A;
+ return -A;
+}
+int f3(int A)
+{
+// A > 0? A : -A same as abs (A)
+ if (A > 0) return A;
+ return -A;
+}
+int f4(int A)
+{
+// A <= 0? A : -A same as -abs (A)
+ if (A <= 0) return A;
+ return -A;
+}
+int f5(int A)
+{
+// A < 0? A : -A same as -abs (A)
+ if (A < 0) return A;
+ return -A;
+}
+
+/* These should be optimized in phiopt1 but is confused by predicts. */
+/* { dg-final { scan-tree-dump-not "if" "phiopt1" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-not "if" "phiopt2" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-24.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-24.c
new file mode 100644
index 0000000..eb89dec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-24.c
@@ -0,0 +1,44 @@
+/* { dg-options "-O2 -fno-signed-zeros -fdump-tree-phiopt" } */
+
+float f0(float A)
+{
+// A == 0? A : -A same as -A
+ if (A == 0) return A;
+ return -A;
+}
+
+float f1(float A)
+{
+// A != 0? A : -A same as A
+ if (A != 0) return A;
+ return -A;
+}
+float f2(float A)
+{
+// A >= 0? A : -A same as abs (A)
+ if (A >= 0) return A;
+ return -A;
+}
+float f3(float A)
+{
+// A > 0? A : -A same as abs (A)
+ if (A > 0) return A;
+ return -A;
+}
+float f4(float A)
+{
+// A <= 0? A : -A same as -abs (A)
+ if (A <= 0) return A;
+ return -A;
+}
+float f5(float A)
+{
+// A < 0? A : -A same as -abs (A)
+ if (A < 0) return A;
+ return -A;
+}
+
+/* These should be optimized in phiopt1 but is confused by predicts. */
+/* { dg-final { scan-tree-dump-not "if" "phiopt1" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-not "if" "phiopt2" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25.c
new file mode 100644
index 0000000..c52c92e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25.c
@@ -0,0 +1,83 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+unsigned short test_bswap16(unsigned short x)
+{
+ return x ? __builtin_bswap16(x) : 0;
+}
+
+unsigned int test_bswap32(unsigned int x)
+{
+ return x ? __builtin_bswap32(x) : 0;
+}
+
+unsigned long long test_bswap64(unsigned long long x)
+{
+ return x ? __builtin_bswap64(x) : 0;
+}
+
+int test_clrsb(int x)
+{
+ return x ? __builtin_clrsb(x) : (__SIZEOF_INT__*8-1);
+}
+
+int test_clrsbl(long x)
+{
+ return x ? __builtin_clrsbl(x) : (__SIZEOF_LONG__*8-1);
+}
+
+int test_clrsbll(long long x)
+{
+ return x ? __builtin_clrsbll(x) : (__SIZEOF_LONG_LONG__*8-1);
+}
+
+#if 0
+/* BUILT_IN_FFS is transformed by match.pd */
+int test_ffs(unsigned int x)
+{
+ return x ? __builtin_ffs(x) : 0;
+}
+
+int test_ffsl(unsigned long x)
+{
+ return x ? __builtin_ffsl(x) : 0;
+}
+
+int test_ffsll(unsigned long long x)
+{
+ return x ? __builtin_ffsll(x) : 0;
+}
+#endif
+
+int test_parity(int x)
+{
+ return x ? __builtin_parity(x) : 0;
+}
+
+int test_parityl(long x)
+{
+ return x ? __builtin_parityl(x) : 0;
+}
+
+int test_parityll(long long x)
+{
+ return x ? __builtin_parityll(x) : 0;
+}
+
+int test_popcount(int x)
+{
+ return x ? __builtin_popcount(x) : 0;
+}
+
+int test_popcountl(long x)
+{
+ return x ? __builtin_popcountl(x) : 0;
+}
+
+int test_popcountll(long long x)
+{
+ return x ? __builtin_popcountll(x) : 0;
+}
+
+/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
index 18ecbd5..51e1f6d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
@@ -18,5 +18,5 @@ int f(int t, int c)
/* There should be one ifs as one of them should be changed into
a conditional and the other should be there still. */
/* { dg-final { scan-tree-dump-times "if" 1 "optimized" } }*/
-/* { dg-final { scan-tree-dump-times "\[^\r\n\]*_. = c_\[0-9\]*.D. != 0" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\[^\r\n\]*_\[0-9\]* = c_\[0-9\]*.D. != 0" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount4l.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount4l.c
index 69fb2d1..269e56e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/popcount4l.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount4l.c
@@ -25,6 +25,7 @@ int popcount64c(unsigned long x)
return (x * h01) >> shift;
}
-/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" { target int32plus } } } */
+/* { dg-final { scan-tree-dump "\.POPCOUNT" "optimized" { target { ! int32plus } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount4ll.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount4ll.c
index c1588be..7abadf6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/popcount4ll.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount4ll.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { lp64 } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target popcountll } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
@@ -16,4 +16,5 @@ int popcount64c(unsigned long long x)
return (x * h01) >> shift;
}
-/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" { target { lp64 } } } } */
+/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 2 "optimized" { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount5ll.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount5ll.c
index edb191b..2afe081 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/popcount5ll.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount5ll.c
@@ -1,5 +1,5 @@
/* PR tree-optimization/94800 */
-/* { dg-do compile { target { lp64 } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target popcountll } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
@@ -19,4 +19,5 @@ int popcount64c(unsigned long long x)
return x >> shift;
}
-/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" { target { lp64 } } } } */
+/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 2 "optimized" { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c
new file mode 100644
index 0000000..8d70228
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void a()
+{
+#if defined __s390__
+ register int b asm("r5");
+#elif defined __x86_64__
+ register int b asm("eax");
+#else
+ volatile int b;
+#endif
+ if (b)
+ b = 1;
+ for (; b;)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c
new file mode 100644
index 0000000..0cf0ad2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+
+struct a {
+ int b : 4;
+} d;
+static int c, e;
+static const struct a f;
+static void g(const struct a h) {
+ for (; c < 1; c++)
+ d = h;
+ e = h.b;
+ c = h.b;
+}
+int main() {
+ g(f);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100794.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100794.c
new file mode 100644
index 0000000..6f707ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100794.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-vectorize -fdump-tree-pcom-details -fdisable-tree-vect" } */
+
+extern double arr[100];
+extern double foo (double, double);
+extern double sum;
+
+void
+test (int i_0, int i_n)
+{
+ int i;
+ for (i = i_0; i < i_n - 1; i++)
+ {
+ double a = arr[i];
+ double b = arr[i + 1];
+ sum += a * b;
+ }
+}
+
+/* { dg-final { scan-tree-dump "Executing predictive commoning without unrolling" "pcom" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr101189.c b/gcc/testsuite/gcc.dg/tree-ssa/pr101189.c
new file mode 100644
index 0000000..5730708
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr101189.c
@@ -0,0 +1,17 @@
+/* PR tree-optimization/101189 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+static int a, b;
+int main() {
+ int d = 0, e, f = 5;
+ if (a)
+ f = 0;
+ for (; f < 4; f++)
+ ;
+ e = f ^ -f;
+ e && d;
+ if (!e)
+ e || b;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr101335.c b/gcc/testsuite/gcc.dg/tree-ssa/pr101335.c
new file mode 100644
index 0000000..921362c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr101335.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+unsigned a = 0xFFFFFFFF;
+int b;
+int main()
+{
+ int c = ~a;
+ unsigned d = c - 10;
+ if (d > c)
+ c = 20;
+ b = -(c | 0);
+ if (b > -8)
+ __builtin_abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr101824.c b/gcc/testsuite/gcc.dg/tree-ssa/pr101824.c
new file mode 100644
index 0000000..d5987e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr101824.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-pcom-details -fdump-tree-optimized" } */
+
+int main()
+{
+ volatile int y;
+ void bar()
+ {
+ __builtin_printf ("%d", y);
+ }
+ while (y)
+ ;
+ return 0;
+}
+
+/* Make sure the load from y is correctly interpreted as volatile, even
+ when going through FRAME. */
+/* { dg-final { scan-tree-dump-not "Executing predictive commoning" "pcom" } } */
+/* { dg-final { scan-tree-dump " ={v} FRAME" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c
index c1e7b58..d7fff14 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c
@@ -1,7 +1,7 @@
/* PR middle-end/20739 */
-/* dg-do compile */
-/* dg-options "-O" */
+/* { dg-do compile } */
+/* { dg-options "-O" } */
/* We used to fail to compile this because gimplification dropped the
conversion that added the const qualifier to the sub-expression
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c
index 719360a..4ea5f21 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c
@@ -6,6 +6,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-dominator-opts -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1-details" } */
+/* { dg-additional-options "-fdisable-tree-ethread -fdisable-tree-thread1" } */
int
foo (int a)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c
index cc7d4cd..b9edabc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c
@@ -5,6 +5,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details" } */
+/* { dg-additional-options "-fdisable-tree-ethread -fdisable-tree-thread1" } */
struct f {
int i;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21417.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21417.c
index 4845119..b934c9c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21417.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21417.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread4-details" } */
+/* { dg-options "-O2 -fdisable-tree-thread3 -fdump-tree-thread4-details" } */
struct tree_common
{
@@ -49,5 +49,5 @@ L23:
/* We should thread the backedge to the top of the loop; ie we only
execute the if (expr->common.code != 142) test once per loop
iteration. */
-/* { dg-final { scan-tree-dump-times "FSM jump thread" 1 "thread4" } } */
+/* { dg-final { scan-tree-dump-times "jump thread" 1 "thread4" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c
index 2aee42f..f8d7353 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp-details" } */
+/* { dg-options "-O2 -fdump-tree-evrp-details -fdisable-tree-ethread" } */
extern void g (void);
extern void bar (int);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c
index 9c67a3a..72dce83 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c
@@ -2,7 +2,7 @@
Make sure VRP folds the second "if" statement. */
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details -fdisable-tree-ethread -fdisable-tree-thread1" } */
int
foo (int a)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr49039.c b/gcc/testsuite/gcc.dg/tree-ssa/pr49039.c
index 4bc0a81..a2044d0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr49039.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr49039.c
@@ -1,6 +1,6 @@
/* PR tree-optimization/49039 */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdisable-tree-ethread -fdisable-tree-thread1" } */
extern void bar (void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c
index d44c7dc..ddc53fb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c
@@ -1,6 +1,6 @@
/* PR tree-optimization/61839. */
/* { dg-do run } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fdisable-tree-evrp -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdisable-tree-evrp -fdump-tree-optimized -fdisable-tree-ethread -fdisable-tree-thread1" } */
/* { dg-require-effective-target int32plus } */
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_2.c
index cfec54d..0e0f4c0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_2.c
@@ -45,10 +45,40 @@ int bar2 ()
return 0;
}
+/* Ensure we are folding modulus sub-ranges properly. */
+__attribute__ ((noinline))
+int mod (int a, int b)
+{
+ int v1, v2;
+ v1 = (a < 10) ? 12 : 24;
+ v2 = (b > 20) ? 3 : 6;
+
+ if (a > 20)
+ v1 = v1 * 2;
+ if (b > 20)
+ v2 = v2 * 2;
+
+ if (a == b)
+ v2 = 0;
+
+ /* v1 == 12, 24, or 48. v2 == 0, 3, 6, or 12. */
+ int c = v1 % v2;
+ if (c == 0)
+ ;
+ else
+ __builtin_abort ();
+ return 0;
+}
+
+/* EVRP now makes transformations in all functions, leaving a single
+ * builtin_abort call in bar2. */
+/* { dg-final { scan-tree-dump-times "__builtin_abort" 1 "evrp" } } */
-/* Dont optimize 972195717 / 0 in function foo. */
-/* { dg-final { scan-tree-dump-times "972195717 / " 1 "evrp" } } */
-/* Dont optimize 972195717 % 0 in function bar. */
-/* { dg-final { scan-tree-dump-times "972195717 % " 1 "evrp" } } */
-/* May optimize in function bar2, but EVRP doesn't perform this yet. */
+/* Make sure to optimize 972195717 / 0 in function foo. */
+/* { dg-final { scan-tree-dump-times "972195717 / " 0 "evrp" } } */
+/* Make sure to optimize 972195717 % 0 in function bar. */
+/* { dg-final { scan-tree-dump-times "972195717 % " 0 "evrp" } } */
+/* Make sure to optimize 972195717 % [1,2] function bar2. */
/* { dg-final { scan-tree-dump-times "972195715 % " 0 "evrp" } } */
+/* [12,12][24,24][48,48] % [0,0][3,3][6,6][12,12] == [0,0] */
+/* { dg-final { scan-tree-dump-times "%" 0 "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_3.c
index 5ceb073..cc322d6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_3.c
@@ -1,6 +1,6 @@
/* PR tree-optimization/61839. */
/* { dg-do run } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-optimized -fdisable-tree-ethread -fdisable-tree-thread1" } */
__attribute__ ((noinline))
int foo (int a, unsigned b)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c b/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c
index 28ffbb7..b694ec1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c
@@ -1,6 +1,5 @@
-
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
__extension__ typedef __UINT32_TYPE__ uint32_t;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c
index 896c8bf..e1464e2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c
@@ -32,9 +32,9 @@ foo (int N, int c, int b, int *a)
pt--;
}
-/* There are 4 FSM jump threading opportunities, all of which will be
+/* There are 4 jump threading opportunities, all of which will be
realized, which will eliminate testing of FLAG, completely. */
-/* { dg-final { scan-tree-dump-times "Registering FSM" 4 "thread1"} } */
+/* { dg-final { scan-tree-dump-times "Registering jump" 4 "thread1"} } */
/* There should be no assignments or references to FLAG, verify they're
eliminated as early as possible. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c b/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c
index 59d562e..af8b7a5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c
@@ -37,5 +37,5 @@ c_finish_omp_clauses (tree clauses)
}
}
-/* There are 3 FSM jump threading opportunities. */
-/* { dg-final { scan-tree-dump-times "Registering FSM" 3 "thread1"} } */
+/* There are 3 jump threading opportunities. */
+/* { dg-final { scan-tree-dump-times "Registering jump" 3 "thread1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c
index 960491f..dfabb48 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile { target sparc*-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -fdump-tree-thread1-details -fdisable-tree-ethread" } */
-/* { dg-final { scan-tree-dump "FSM did not thread around loop and would copy too many statements" "thread1" } } */
+/* { dg-final { scan-tree-dump "Did not thread around loop and would copy too many statements" "thread1" } } */
typedef __builtin_va_list __gnuc_va_list;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr70232.c b/gcc/testsuite/gcc.dg/tree-ssa/pr70232.c
index 6cc987a..d636672 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr70232.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr70232.c
@@ -1,12 +1,12 @@
/* { dg-do compile } */
/* { dg-options "-O2 -w -fdump-tree-vrp1-details -fdump-tree-vrp2-details -fdump-tree-dom2-details -fdump-tree-dom3-details" } */
-/* All the threads found by the FSM threader should have too
- many statements to be profitable. */
-/* { dg-final { scan-tree-dump-not "Registering FSM " "dom2"} } */
-/* { dg-final { scan-tree-dump-not "Registering FSM " "dom3"} } */
-/* { dg-final { scan-tree-dump-not "Registering FSM " "vrp1"} } */
-/* { dg-final { scan-tree-dump-not "Registering FSM " "vrp2"} } */
+/* All the threads found by the threader should have too many
+ statements to be profitable. */
+/* { dg-final { scan-tree-dump-not "Registering jump " "dom2"} } */
+/* { dg-final { scan-tree-dump-not "Registering jump " "dom3"} } */
+/* { dg-final { scan-tree-dump-not "Registering jump " "vrp1"} } */
+/* { dg-final { scan-tree-dump-not "Registering jump " "vrp2"} } */
typedef _Bool bool;
typedef unsigned char uint8_t;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
index cf74e15..f9fc212 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
@@ -124,7 +124,7 @@ enum STATES FMS( u8 **in , u32 *transitions) {
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump "Jumps threaded: 1\[1-9\]" "thread1" } } */
-/* { dg-final { scan-tree-dump-times "Invalid sum" 3 "thread1" } } */
+/* { dg-final { scan-tree-dump-times "Invalid sum" 4 "thread1" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread1" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread2" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread3" { target { ! aarch64*-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr77445.c b/gcc/testsuite/gcc.dg/tree-ssa/pr77445.c
index 98eb0f2..883a63d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr77445.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr77445.c
@@ -25,5 +25,5 @@ main (int argc)
if (b)
test2 ();
}
-/* { dg-final { scan-tree-dump-times "Registering FSM jump thread" 2 "thread3" } } */
+/* { dg-final { scan-tree-dump-times "Registering jump thread" 2 "thread3" } } */
/* { dg-final { scan-tree-dump-not "Invalid sum" "thread3" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c
index 748375b..bfc703d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -funroll-loops -fdump-tree-lim2-details" } */
+/* { dg-additional-options "--param max-completely-peeled-insns=200" { target { s390*-*-* } } } */
#define TYPE unsigned int
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c
index ca2e6bb..9130d9b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -funroll-loops -fdump-tree-lim2-details" } */
+/* { dg-additional-options "--param max-completely-peeled-insns=200" { target { s390*-*-* } } } */
#define TYPE int
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
index 3c02701..496c78b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
@@ -13,4 +13,4 @@ int foo()
}
/* Listed targets xfailed due to PR84958. */
-/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* } } } } */
+/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* || vect_variable_length } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr88087.c b/gcc/testsuite/gcc.dg/tree-ssa/pr88087.c
index d0061b6..c48dba5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr88087.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr88087.c
@@ -1,17 +1,17 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+/* { dg-options "-O2 -fno-code-hoisting -fdump-tree-pre-stats" } */
int f();
int d;
-void c()
+void c(int x)
{
- for (;;)
- {
- f();
- int (*fp)() __attribute__((const)) = (void *)f;
- d = fp();
- }
+ int (*fp)() __attribute__((const)) = (void *)f;
+ if (x)
+ d = fp ();
+ int tem = fp ();
+ f();
+ d = tem;
}
-/* We shouldn't ICE and hoist the const call of fp out of the loop. */
+/* We shouldn't ICE and PRE the const call. */
/* { dg-final { scan-tree-dump "Eliminated: 1" "pre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-1.c
index 8ee1850..d9fb2ed 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
unsigned test(unsigned k, unsigned b) {
unsigned a[2];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-2.c
index 9b96875..bb39df2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
int c;
unsigned test(unsigned k, unsigned b) {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-3.c
index 0fac9f9..0016637 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
unsigned a[2];
unsigned test(unsigned k, unsigned b) {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-4.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-4.c
index 54b8c11..127cbdf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
int *p;
unsigned test(unsigned k, unsigned b) {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-5.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-5.c
index b2d0411..6a00f54 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
int test(int b, int k) {
struct {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-6.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-6.c
index 8d3c4f7..ecc083e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
int test(int b, int k) {
typedef struct {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-7-comp-ref.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-7-comp-ref.c
index c35a2af..4fad2d1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-7-comp-ref.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-7-comp-ref.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
typedef union {
int i;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c
index f9e66ae..5f93112 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
int *t;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr93781-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr93781-1.c
index 5ebd805..b2505f3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr93781-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr93781-1.c
@@ -12,7 +12,9 @@ void foo (unsigned int arg)
if (a < 0)
b = x;
- /* In the fullness of time, we will delete this call. */
if (b >= 5)
kill ();;
}
+
+/* { dg-final { scan-tree-dump-not "kill" "evrp" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c
new file mode 100644
index 0000000..7e1aaaa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/94589 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int
+foo (int x)
+{
+ return (x & 23) == x;
+/* { dg-final { scan-tree-dump " & -24;" "optimized" } } */
+/* { dg-final { scan-tree-dump-not " & 23;" "optimized" } } */
+/* { dg-final { scan-tree-dump " == 0" "optimized" } } */
+}
+
+int
+bar (int x)
+{
+ return (x | 137) != 137;
+/* { dg-final { scan-tree-dump " & -138;" "optimized" } } */
+/* { dg-final { scan-tree-dump-not " \\| 137;" "optimized" } } */
+/* { dg-final { scan-tree-dump " != 0" "optimized" } } */
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c
new file mode 100644
index 0000000..b4ae2be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c
@@ -0,0 +1,57 @@
+/* PR tree-optimization/95527 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-original" } */
+/* { dg-final { scan-tree-dump "a & 7\\) == 0" "original" } } */
+/* { dg-final { scan-tree-dump "b & 63\\) != 0" "original" } } */
+/* { dg-final { scan-tree-dump-times "return 0;" 2 "original" } } */
+/* { dg-final { scan-tree-dump-times "return 1;" 2 "original" } } */
+/* { dg-final { scan-tree-dump "g & 15\\) == 8" "original" } } */
+/* { dg-final { scan-tree-dump "h & 255\\) != 128" "original" } } */
+
+int
+f1 (int a)
+{
+ return __builtin_ctz (a) >= 3;
+}
+
+int
+f2 (int b)
+{
+ return __builtin_ctz (b) < 6;
+}
+
+int
+f3 (int c)
+{
+ return __builtin_ctz (c) < 0;
+}
+
+int
+f4 (int d)
+{
+ return __builtin_ctz (d) >= 0;
+}
+
+int
+f5 (int e)
+{
+ return __builtin_ctz (e) >= __SIZEOF_INT__ * __CHAR_BIT__;
+}
+
+int
+f6 (int f)
+{
+ return __builtin_ctz (f) < __SIZEOF_INT__ * __CHAR_BIT__;
+}
+
+int
+f7 (int g)
+{
+ return __builtin_ctz (g) == 3;
+}
+
+int
+f8 (int h)
+{
+ return __builtin_ctz (h) != 7;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c
index 5704952..4d4d4c8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c
@@ -58,4 +58,4 @@ bar (int16_t res[16], uint8_t *val1, uint8_t *val2)
}
}
-/* { dg-final { scan-tree-dump {Deleted dead store:.*tmp} "dse3" } } */
+/* { dg-final { scan-tree-dump {Deleted dead store:.*tmp} "dse4" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c
new file mode 100644
index 0000000..9e505ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c
@@ -0,0 +1,51 @@
+/* PR tree-optimization/96928 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times " = a_\[0-9]*\\\(D\\\) >> " 5 "phiopt2" } } */
+/* The following check is done at optimized because a ^ (~b) is rewritten as ~(a^b)
+ and in the case of match.pd optimizing these ?:, the ~ is moved out already
+ by the time we get to phiopt2. */
+/* { dg-final { scan-tree-dump-times "c_\[0-9]*\\\(D\\\) \\\^" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " = ~" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " = \[abc_0-9\\\(\\\)D]* \\\^ " 5 "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not "a < 0" "phiopt2" } } */
+
+int
+foo (int a)
+{
+ if (a < 0)
+ return ~a;
+ return a;
+}
+
+int
+bar (int a, int b)
+{
+ if (a < 0)
+ return ~b;
+ return b;
+}
+
+unsigned
+baz (int a, unsigned int b)
+{
+ if (a < 0)
+ return ~b;
+ return b;
+}
+
+unsigned
+qux (int a, unsigned int c)
+{
+ if (a >= 0)
+ return ~c;
+ return c;
+}
+
+int
+corge (int a, int b)
+{
+ if (a >= 0)
+ return b;
+ return ~b;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96928.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96928.c
index 2091357..e8fd82f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr96928.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96928.c
@@ -1,8 +1,11 @@
/* PR tree-optimization/96928 */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-phiopt2" } */
+/* { dg-options "-O2 -fdump-tree-phiopt2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " = a_\[0-9]*\\\(D\\\) >> " 5 "phiopt2" } } */
-/* { dg-final { scan-tree-dump-times " = ~c_\[0-9]*\\\(D\\\);" 1 "phiopt2" } } */
+/* The following check is done at optimized because a ^ (~b) is rewritten as ~(a^b)
+ and in the case of match.pd optimizing these ?:, the ~ is moved out already
+ by the time we get to phiopt2. */
+/* { dg-final { scan-tree-dump-times "\\\^ c_\[0-9]*\\\(D\\\);" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times " = ~" 1 "phiopt2" } } */
/* { dg-final { scan-tree-dump-times " = \[abc_0-9\\\(\\\)D]* \\\^ " 5 "phiopt2" } } */
/* { dg-final { scan-tree-dump-not "a < 0" "phiopt2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97009.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97009.c
new file mode 100644
index 0000000..741dbc2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr97009.c
@@ -0,0 +1,66 @@
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+
+static int __attribute__((noipa))
+get_5 (void)
+{
+ return 5;
+}
+
+static int __attribute__((noipa))
+verify_5 (int v)
+{
+ if (v != 5)
+ __builtin_abort ();
+}
+
+struct T
+{
+ int w;
+ int a[4];
+};
+
+struct S
+{
+ int v;
+ int x;
+ struct T t[2];
+ char alotofstuff[128];
+};
+
+volatile int vol;
+
+void __attribute__((noipa))
+consume_t (struct T t)
+{
+ vol = t.a[0];
+}
+
+int __attribute__((noipa))
+foo (int l1, int l2)
+{
+ struct S s1, s2, s3;
+ int i, j;
+
+ s1.v = get_5 ();
+ for (i = 0; i < l1; i++)
+ {
+ for (j = 0; j < l2; j++)
+ s1.t[i].a[j] = get_5 ();
+ consume_t(s1.t[i]);
+ }
+
+ s2 = s1;
+
+ s3 = s2;
+ for (i = 0; i < l1; i++)
+ for (j = 0; j < l2; j++)
+ verify_5 (s3.t[i].a[j]);
+}
+
+int
+main (int argc, char *argv[])
+{
+ foo (2, 4);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C b/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C
new file mode 100644
index 0000000..9c798e6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C
@@ -0,0 +1,348 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+extern void __assert_fail(const char*, const char*, int, const char*);
+namespace Eigen {
+enum { AutoAlign };
+template <int, typename>
+struct conditional;
+template <typename Else>
+struct conditional<false, Else> {
+ typedef Else type;
+};
+template <typename T>
+struct remove_reference {
+ typedef T type;
+};
+struct is_arithmetic {
+ enum { value };
+};
+template <typename>
+struct traits;
+template <typename T>
+struct traits<const T> : traits<T> {};
+template <typename>
+struct evaluator;
+template <typename>
+struct EigenBase;
+template <typename>
+class PlainObjectBase;
+template <typename, int _Rows, int _Cols, int = AutoAlign, int = _Rows,
+ int = _Cols>
+class Matrix;
+template <typename>
+class MatrixBase;
+template <typename, typename>
+class CwiseNullaryOp;
+template <typename, typename, typename>
+class CwiseBinaryOp;
+template <typename>
+struct scalar_constant_op;
+template <int _Rows>
+struct size_at_compile_time {
+ enum { ret = _Rows };
+};
+struct ref_selector {
+ typedef const Matrix<float, 3, 1>& type;
+};
+template <typename Derived>
+struct dense_xpr_base {
+ typedef MatrixBase<Derived> type;
+};
+template <typename Derived, typename = typename traits<Derived>::XprKind>
+struct generic_xpr_base {
+ typedef typename dense_xpr_base<Derived>::type type;
+};
+template <typename Expr, typename Scalar = typename Expr::Scalar>
+struct plain_constant_type {
+ ;
+ typedef CwiseNullaryOp<scalar_constant_op<Scalar>,
+ Matrix<Scalar, traits<Expr>::ColsAtCompileTime,
+ traits<Expr>::MaxRowsAtCompileTime,
+ traits<Expr>::MaxColsAtCompileTime>>
+ type;
+};
+struct scalar_product_op {
+ float operator()(float a, float b) { return a * b; }
+};
+template <typename>
+struct scalar_constant_op {
+ scalar_constant_op(float other) : m_other(other) {}
+ float operator()() { return m_other; }
+ float m_other;
+};
+struct assign_op {
+ void assignCoeff(float& a, float b) { a = b; }
+};
+template <typename Derived>
+class DenseCoeffsBase : public EigenBase<Derived> {
+ public:
+ typedef typename traits<Derived>::Scalar Scalar;
+ typedef
+ typename conditional<is_arithmetic::value, Scalar>::type CoeffReturnType;
+};
+template <typename Derived>
+class DenseBase : public DenseCoeffsBase<Derived> {
+ public:
+ enum {
+ RowsAtCompileTime = traits<Derived>::RowsAtCompileTime,
+ SizeAtCompileTime = size_at_compile_time<RowsAtCompileTime>::ret,
+ MaxSizeAtCompileTime
+ };
+};
+template <typename Derived>
+class MatrixBase : public DenseBase<Derived> {
+ public:
+ using DenseBase<Derived>::derived;
+ template <typename T>
+ CwiseBinaryOp<scalar_product_op, const Derived,
+ const typename plain_constant_type<Derived, T>::type>
+ operator*(T& scalar) {
+ return CwiseBinaryOp<scalar_product_op, const Derived,
+ const typename plain_constant_type<Derived>::type>(
+ derived(), typename plain_constant_type<Derived>::type(derived().rows(),
+ 0, scalar));
+ }
+};
+template <typename Derived>
+struct EigenBase {
+ const Derived& derived() const { return *static_cast<const Derived*>(this); }
+ Derived& const_cast_derived() const {
+ return *static_cast<Derived*>(const_cast<EigenBase*>(this));
+ }
+};
+template <typename>
+struct binary_evaluator;
+template <typename T>
+struct evaluator<const T> : evaluator<T> {
+ evaluator(const T& xpr) : evaluator<T>(xpr) {}
+};
+template <typename Derived>
+struct evaluator {
+ typedef Derived PlainObjectType;
+ typedef typename PlainObjectType::Scalar Scalar;
+ evaluator(const PlainObjectType& m) : m_data(m.data()) {}
+ typename PlainObjectType::CoeffReturnType coeff(long row, long) {
+ return m_data[row];
+ }
+ Scalar& coeffRef(long row, long) { return const_cast<Scalar*>(m_data)[row]; }
+ const Scalar* m_data;
+};
+template <typename Scalar, int Rows, int Cols, int Options, int MaxRows,
+ int MaxCols>
+struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
+ : evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols>>> {
+ typedef Matrix<Scalar, Rows, Cols> XprType;
+ evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType>>(m) {}
+};
+struct nullary_wrapper {
+ template <typename IndexType>
+ float operator()(scalar_constant_op<float> op, IndexType, IndexType) const {
+ return op();
+ }
+};
+template <typename NullaryOp, typename PlainObjectType>
+struct evaluator<CwiseNullaryOp<NullaryOp, PlainObjectType>> {
+ typedef CwiseNullaryOp<NullaryOp, PlainObjectType> XprType;
+ evaluator(XprType n) : m_functor(n.functor()) {}
+ template <typename IndexType>
+ typename XprType::CoeffReturnType coeff(IndexType row, IndexType col) {
+ return m_wrapper(m_functor, row, col);
+ }
+ NullaryOp m_functor;
+ nullary_wrapper m_wrapper;
+};
+template <typename BinaryOp, typename Lhs, typename Rhs>
+struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>>
+ : binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
+ evaluator(CwiseBinaryOp<BinaryOp, Lhs, Rhs> xpr)
+ : binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>>(xpr) {}
+};
+template <typename BinaryOp, typename Lhs, typename Rhs>
+struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
+ typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
+ binary_evaluator(XprType xpr) : m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()) {}
+ typename XprType::CoeffReturnType coeff(long row, long col) {
+ return m_functor(m_lhsImpl.coeff(row, col), m_rhsImpl.coeff(row, col));
+ }
+ BinaryOp m_functor;
+ evaluator<Lhs> m_lhsImpl;
+ evaluator<Rhs> m_rhsImpl;
+};
+template <typename Kernel, int Index, int Stop>
+struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling {
+ enum { outer, inner = Index };
+ static void run(Kernel kernel) {
+ kernel.assignCoeffByOuterInner(outer, inner);
+ copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, Index + 1,
+ Stop>::run(kernel);
+ }
+};
+template <typename Kernel, int Stop>
+struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, Stop,
+ Stop> {
+ static void run(Kernel) {}
+};
+template <typename Kernel>
+struct dense_assignment_loop {
+ static void run(Kernel kernel) {
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
+ enum { size = DstXprType::SizeAtCompileTime, alignedSize = 0 };
+ copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, alignedSize,
+ size>::run(kernel);
+ }
+};
+template <typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT,
+ typename Functor>
+class generic_dense_assignment_kernel {
+ typedef typename DstEvaluatorTypeT::XprType DstXprType;
+
+ public:
+ typedef DstEvaluatorTypeT DstEvaluatorType;
+ typedef SrcEvaluatorTypeT SrcEvaluatorType;
+ generic_dense_assignment_kernel(DstEvaluatorType dst, SrcEvaluatorType src,
+ Functor, DstXprType& dstExpr)
+ : m_dst(dst), m_src(src), m_dstExpr(dstExpr) {}
+ long assignCoeff_col;
+ void assignCoeffByOuterInner(long, long inner) {
+ long __trans_tmp_1 = inner;
+ m_functor.assignCoeff(m_dst.coeffRef(__trans_tmp_1, assignCoeff_col),
+ m_src.coeff(__trans_tmp_1, assignCoeff_col));
+ }
+ DstEvaluatorType m_dst;
+ SrcEvaluatorType m_src;
+ Functor m_functor;
+ DstXprType& m_dstExpr;
+};
+template <typename DstXprType, typename SrcXprType, typename Functor>
+void call_dense_assignment_loop(DstXprType& dst, SrcXprType src, Functor func) {
+ typedef evaluator<DstXprType> DstEvaluatorType;
+ typedef evaluator<SrcXprType> SrcEvaluatorType;
+ SrcEvaluatorType srcEvaluator(src);
+ DstEvaluatorType dstEvaluator(dst);
+ typedef generic_dense_assignment_kernel<DstEvaluatorType, SrcEvaluatorType,
+ Functor>
+ Kernel;
+ Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived());
+ dense_assignment_loop<Kernel>::run(kernel);
+}
+template <typename Dst, typename Src, typename Func>
+void call_assignment_no_alias(Dst& dst, Src src, Func func) {
+ enum { NeedToTranspose };
+ typename conditional<NeedToTranspose, Dst&>::type actualDst(dst);
+ CwiseBinaryOp<scalar_product_op, const Matrix<float, 3, 1>,
+ const CwiseNullaryOp<scalar_constant_op<float>,
+ const Matrix<float, 3, 1, 0, 2, 3>>>
+ __trans_tmp_4 = src;
+ call_dense_assignment_loop(actualDst, __trans_tmp_4, func);
+}
+template <int Size>
+struct plain_array {
+ float array[Size];
+};
+template <int Size, int _Rows>
+class DenseStorage {
+ plain_array<Size> m_data;
+
+ public:
+ DenseStorage() {}
+ DenseStorage(const DenseStorage&);
+ static long rows() { return _Rows; }
+ const float* data() const { return m_data.array; }
+ float* data() { return m_data.array; }
+};
+template <typename Derived>
+class PlainObjectBase : public dense_xpr_base<Derived>::type {
+ public:
+ typedef typename dense_xpr_base<Derived>::type Base;
+ typedef typename traits<Derived>::Scalar Scalar;
+ DenseStorage<Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime> m_storage;
+ long rows() const { return m_storage.rows(); }
+ const Scalar* data() const { return m_storage.data(); }
+ PlainObjectBase() {}
+ template <typename OtherDerived>
+ PlainObjectBase(const DenseBase<OtherDerived>& other) {
+ _set_noalias(other);
+ }
+ template <typename OtherDerived>
+ void _set_noalias(const DenseBase<OtherDerived>& other) {
+ call_assignment_no_alias(this->derived(), other.derived(), assign_op());
+ }
+};
+template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
+ int _MaxCols>
+struct traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>> {
+ typedef _Scalar Scalar;
+ typedef int XprKind;
+ enum {
+ RowsAtCompileTime = _Rows,
+ ColsAtCompileTime,
+ MaxRowsAtCompileTime,
+ MaxColsAtCompileTime,
+ };
+};
+template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
+ int _MaxCols>
+class Matrix
+ : public PlainObjectBase<
+ Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>> {
+ public:
+ typedef PlainObjectBase<Matrix> Base;
+ typedef typename traits<Matrix>::Scalar Scalar;
+ Matrix(Scalar& x, Scalar& y, Scalar& z) {
+ m_storage.data()[0] = x;
+ m_storage.data()[1] = y;
+ m_storage.data()[2] = z;
+ }
+ template <typename OtherDerived>
+ Matrix(const EigenBase<OtherDerived>& other) : Base(other.derived()) {}
+ using Base::m_storage;
+};
+template <typename BinaryOp, typename Lhs, typename Rhs>
+struct traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
+ typedef typename traits<Lhs>::XprKind XprKind;
+ enum { RowsAtCompileTime };
+ typedef float Scalar;
+};
+template <typename>
+class CwiseBinaryOpImpl;
+template <typename, typename, typename RhsType>
+class CwiseBinaryOp : public CwiseBinaryOpImpl<RhsType> {
+ public:
+ typedef ref_selector::type LhsNested;
+ typedef RhsType RhsNested;
+ CwiseBinaryOp(const Matrix<float, 3, 1>& aLhs, RhsType& aRhs)
+ : m_lhs(aLhs), m_rhs(aRhs) {}
+ remove_reference<LhsNested>::type& lhs() { return m_lhs; }
+ typename remove_reference<RhsNested>::type& rhs() { return m_rhs; }
+ LhsNested m_lhs;
+ RhsNested m_rhs;
+};
+template <typename>
+class CwiseBinaryOpImpl
+ : public generic_xpr_base<CwiseBinaryOp<
+ scalar_product_op, const Matrix<float, 3, 1>,
+ const CwiseNullaryOp<scalar_constant_op<float>,
+ const Matrix<float, 3, 1, 0, 2, 3>>>>::type {};
+template <typename NullaryOp, typename PlainObjectType>
+struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType>>
+ : traits<PlainObjectType> {};
+template <typename, typename PlainObjectType>
+class CwiseNullaryOp
+ : public dense_xpr_base<CwiseNullaryOp<int, PlainObjectType>>::type {
+ public:
+ CwiseNullaryOp(long rows, long, scalar_constant_op<float> func)
+ : m_functor(func) {
+ rows ? void() : __assert_fail("", "", 1, __PRETTY_FUNCTION__);
+ }
+ scalar_constant_op<float> functor() { return m_functor; }
+ scalar_constant_op<float> m_functor;
+};
+} // namespace Eigen
+Eigen::Matrix<float, 3, 1> should_inline(float x, float y, float z,
+ float scale) {
+ return Eigen::Matrix<float, 3, 1>(x, y, z) * scale;
+}
+
+// We should inline everything to should_inline
+
+/* { dg-final { scan-tree-dump-times "Function" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c
new file mode 100644
index 0000000..0fda566
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-cselim -fallow-store-data-races -fdump-tree-cselim-details" } */
+
+void f (int*);
+
+void g3 (int i)
+{
+ int x = 0;
+ if (i)
+ x = i;
+ f (&x);
+}
+
+/* { dg-final { scan-tree-dump "Conditional store replacement happened" "cselim" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c
index 4bc2ea5..f68be2b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-do run } */
-/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details -fno-tree-pre" } */
+/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */
void abort (void);
@@ -45,6 +45,5 @@ int main(void)
/* Verify that both loops were transformed and unrolled. */
/* { dg-final { scan-tree-dump-times "Unrolling 2 times." 2 "pcom"} } */
-/* Also check that we undid the transformation previously made by PRE.
- ??? PRE now does the predictive commoning in count_averages. */
-/* dg-final { scan-tree-dump-times "looparound ref" 1 "pcom" } */
+/* Also check that we undid the transformation previously made by PRE. */
+/* { dg-final { scan-tree-dump-times "looparound ref" 1 "pcom" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-1.c
new file mode 100644
index 0000000..c3ccb5d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-thread1-details --param logical-op-non-short-circuit=1" } */
+
+// Copied from ssa-dom-thread-11.c
+
+static int *bb_ticks;
+extern void frob (void);
+void
+mark_target_live_regs (int b, int block, int bb_tick)
+{
+ if (b == block && b != -1 && bb_tick == bb_ticks[b])
+ return;
+ if (b != -1)
+ frob ();
+}
+
+/* When the first two conditionals in the first IF are true, but
+ the third conditional is false, then there's a jump threading
+ opportunity to bypass the second IF statement. */
+/* { dg-final { scan-tree-dump-times "Registering.*jump thread" 1 "thread1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-2.c
new file mode 100644
index 0000000..d2689b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-2.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-thread2-details -w" } */
+
+// Copied from ssa-dom-thread-12.c.
+
+typedef long unsigned int size_t;
+union tree_node;
+typedef union tree_node *tree;
+typedef union gimple_statement_d *gimple;
+typedef const union gimple_statement_d *const_gimple;
+union gimple_statement_d
+{
+ unsigned num_ops;
+ tree exp;
+};
+
+unsigned int x;
+static inline tree
+gimple_op (const_gimple gs, unsigned i)
+{
+ if (!(i < gs->num_ops))
+ abort ();
+ return gs->exp;
+}
+
+unsigned char
+scan_function (gimple stmt)
+{
+ unsigned i;
+ for (i = 0; i < stmt->num_ops - 3 ; i++)
+ gimple_call_arg (stmt, i);
+ gimple_op (stmt, 1);
+}
+
+/* The test which bypasses the loop is simplified prior to DOM to check
+ that stmt->num_ops - 3 != 0. When that test is false, we can derive
+ a value for stmt->num_ops. That in turn allows us to thread the jump
+ for the conditional at the start of the call to gimple_op. */
+/* { dg-final { scan-tree-dump-times "Registering.*jump thread" 1 "thread2"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-3.c
new file mode 100644
index 0000000..79ec067
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-3.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-ethread-details -w --param logical-op-non-short-circuit=1" } */
+
+// Copied from ssa-dom-thread-14.c
+
+enum optab_methods
+{
+ OPTAB_DIRECT,
+ OPTAB_LIB,
+ OPTAB_WIDEN,
+ OPTAB_LIB_WIDEN,
+ OPTAB_MUST_WIDEN
+};
+struct optab_d { };
+typedef struct optab_d *optab;
+void
+expand_shift_1 (int code, int unsignedp, int rotate,
+ optab lshift_optab, optab rshift_arith_optab)
+{
+ int left = (code == 42 || code == 0xde);
+ int attempt;
+ enum optab_methods methods;
+ if (attempt == 0)
+ methods = OPTAB_DIRECT;
+ else if (attempt == 1)
+ methods = OPTAB_WIDEN;
+ if ((!unsignedp || (!left && methods == OPTAB_WIDEN)))
+ {
+ enum optab_methods methods1 = methods;
+ if (unsignedp)
+ methods1 = OPTAB_MUST_WIDEN;
+ expand_binop (left ? lshift_optab : rshift_arith_optab,
+ unsignedp, methods1);
+ }
+}
+
+/* When UNSIGNEDP is true, LEFT is false and METHOD == OPTAB_WIDEN
+ we will enter the TRUE arm of the conditional and we can thread
+ the test to compute the first first argument of the expand_binop
+ call if we look backwards through the boolean logicals. */
+/* { dg-final { scan-tree-dump-times "Registering.*jump thread" 1 "ethread"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-4.c
new file mode 100644
index 0000000..d5aa2e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-4.c
@@ -0,0 +1,83 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O2 -fdump-tree-vrp-details -fdump-tree-thread1-details --param logical-op-non-short-circuit=1" } */
+/* { dg-final { scan-tree-dump-times "Registering jump" 8 "thread1" } } */
+
+/* Copied from ssa-thread-14. */
+
+void foo (void);
+void bar (void);
+void blah (void);
+
+/* One jump threaded here. */
+
+void
+baz_1 (int a, int b, int c)
+{
+ if (a && b)
+ foo ();
+ if (!b && c)
+ bar ();
+}
+
+/* One jump threaded here. */
+
+void
+baz_2 (int a, int b, int c)
+{
+ if (a && b)
+ foo ();
+ if (b || c)
+ bar ();
+}
+
+/* One jump threaded here. */
+
+void
+baz_3 (int a, int b, int c)
+{
+ if (a && b > 10)
+ foo ();
+ if (b < 5 && c)
+ bar ();
+}
+
+/* Two jumps threaded here. */
+
+void
+baz_4 (int a, int b, int c)
+{
+ if (a && b)
+ {
+ foo ();
+ if (c)
+ bar ();
+ }
+ if (b && c)
+ blah ();
+}
+
+/* Two jumps threaded here. */
+
+void
+baz_5 (int a, int b, int c)
+{
+ if (a && b)
+ {
+ foo ();
+ if (c)
+ bar ();
+ }
+ if (!b || !c)
+ blah ();
+}
+
+/* One jump threaded here. */
+
+void
+baz_6 (int a, int b, int c)
+{
+ if (a == 39 && b == 41)
+ foo ();
+ if (c == 12 || b == 41)
+ bar ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-5.c b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-5.c
new file mode 100644
index 0000000..b7ca99a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-5.c
@@ -0,0 +1,80 @@
+// { dg-do compile }
+// { dg-options "-fgimple -O2 -fdump-tree-thread1-details" }
+
+/* This tests that we can thread BB4->BB999 coming in through the
+ following path:
+
+ latch many insns
+ | |
+ V V
+ 6 -> 7 -> 3 -> 4 -> 999
+
+ The ranger based threader cannot thread this because BB4 has too
+ many instructions so it gives up looking back. However, if we were
+ able to looking further, we would notice that a profitable path
+ passing through the loop latch (BB7) exists.
+
+ That is, 3->4->N in isolation is not profitable, but 6->7->3->4->N is.
+
+ It is not clear whether handling this case in the backwards
+ threader is profitable, as it would increase the search space
+ considerably. The test is being added to note a regression from
+ the old backward threader code.
+
+ This test has been distilled from libphobos/src/std/net/isemail.d.
+
+ The ranger threader stops at the 3->4 subpath with: "did not thread
+ around loop and would copy too many statements". */
+
+
+extern void bar();
+extern int random();
+
+int __GIMPLE (ssa,startwith("thread1"))
+foo (int key)
+{
+ int context;
+ int _1454;
+
+ __BB(2):
+ goto __BB3;
+
+ // Loop header.
+ __BB(3):
+ context_448 = __PHI (__BB2: 0, __BB7: context_450);
+ if (key_5(D) > 0)
+ goto __BB999;
+ else
+ goto __BB4;
+
+ __BB(4):
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ switch (context_448) {default: L5; case 0: L999; }
+
+ __BB(5):
+ L5:
+ goto __BB6;
+
+ __BB(6):
+ context_450 = __PHI (__BB5: 0);
+ _1454 = random ();
+ if (_1454 > 0)
+ goto __BB999;
+ else
+ goto __BB7;
+
+ // Loop latch.
+ __BB(7):
+ goto __BB3;
+
+ __BB(999):
+ L999:
+ return 5;
+}
+
+// { dg-final { scan-tree-dump-times "Registering.*jump thread.*incoming edge; \\(6, 7\\) \\(7, 3\\) \\(3, 4\\) \\(4, 999\\) nocopy" 1 "thread1" { xfail *-*-* } } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-4.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-4.c
index dac931c..8ef7646 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-4.c
@@ -1,5 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details -w" } */
+/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details -w -fdisable-tree-thread1 -fdisable-tree-thread2" } */
+
+/* Note: Threader causes the infinite loop in val & 1 sooner. */
powi_cost (long n)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-40.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-40.c
new file mode 100644
index 0000000..aa7349e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-40.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int foo(int x)
+{
+ int p = 7;
+ int q = p - (x & 5);
+ return q & 2;
+}
+
+/* { dg-final { scan-tree-dump "return 2;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-41.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-41.c
new file mode 100644
index 0000000..d2b054e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-41.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int foo(int x)
+{
+ int p = x & 24;
+ int r = 1 << p;
+ return r & (1<<17);
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
index 863aa79..fdfe37e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
@@ -21,11 +21,12 @@ int main(void)
return 0;
}
-/* We now can prove the infiniteness of the loop during CCP and fail
- to eliminate the code inside the infinite loop because we start
- by marking the j % 7 condition as useful. See PR45178. */
+/* We now can prove the infiniteness of the loop during CCP but we
+ still want to eliminate the code inside the infinite loop. See PR45178. */
/* We should eliminate the inner condition, but the loop must be preserved
- as it is infinite. Therefore there should be just one goto and no PHI. */
+ as it is infinite. Therefore there should be just one goto and no PHI
+ and no if. */
/* { dg-final { scan-tree-dump-times "PHI " 0 "cddce1" } } */
+/* { dg-final { scan-tree-dump-times "if " 0 "cddce1" } } */
/* { dg-final { scan-tree-dump-times "goto" 1 "cddce1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c
index 5f90613..856ab38 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom2-details --param logical-op-non-short-circuit=1" } */
+/* { dg-options "-O2 -fdump-tree-dom2-details --param logical-op-non-short-circuit=1 -fdisable-tree-thread1 -fdisable-tree-thread2" } */
static int *bb_ticks;
extern void frob (void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-12.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-12.c
index 63bd12a..bad5e0a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-12.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-12.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
+/* { dg-options "-O2 -fdump-tree-dom2-details -w -fdisable-tree-thread2" } */
typedef long unsigned int size_t;
union tree_node;
typedef union tree_node *tree;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-14.c
index 4e6a911..3bc4b37 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-14.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-14.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom2-details -w --param logical-op-non-short-circuit=1" } */
+/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-ethread -fdisable-tree-thread2" } */
enum optab_methods
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c
index d4759b8..60d4f76 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1-details -fdump-tree-dom2-details -std=gnu89 --param logical-op-non-short-circuit=0" } */
+/* { dg-options "-O2 -fdump-tree-vrp1-details -fdump-tree-thread1-details -std=gnu89 --param logical-op-non-short-circuit=0" } */
#include "ssa-dom-thread-4.c"
@@ -21,4 +21,5 @@
condition.
All the cases are picked up by VRP1 as jump threads. */
-/* { dg-final { scan-tree-dump-times "Threaded" 4 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "Registering jump" 6 "thread1" } } */
+/* { dg-final { scan-tree-dump-times "Threaded" 2 "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c
index e1c33e8..823ada9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-dom2-stats -fdisable-tree-ethread" } */
+/* { dg-options "-O2 -fdump-tree-thread3-stats -fdump-tree-dom2-stats -fdisable-tree-ethread" } */
void foo();
void bla();
@@ -26,4 +26,4 @@ void thread_latch_through_header (void)
case. And we want to thread through the header as well. These
are both caught by threading in DOM. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom2"} } */
-/* { dg-final { scan-tree-dump-times "Jumps threaded: 1" 1 "thread1"} } */
+/* { dg-final { scan-tree-dump-times "Jumps threaded: 1" 1 "thread3"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
index 16a9ef4..b0a7d42 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
@@ -1,41 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread1-details -fdump-tree-thread2-details" } */
+/* { dg-options "-O2 -fdump-tree-thread1-details -fdump-tree-thread3-details" } */
-/* All the threads in the thread1 dump start on a X->BB12 edge, as can
- be seen in the dump:
-
- Registering FSM jump thread: (x, 12) incoming edge; ...
- etc
- etc
-
- Before the new evrp, we were threading paths that started at the
- following edges:
-
- Registering FSM jump thread: (10, 12) incoming edge
- Registering FSM jump thread: (6, 12) incoming edge
- Registering FSM jump thread: (9, 12) incoming edge
-
- This was because the PHI at BB12 had constant values coming in from
- BB10, BB6, and BB9:
-
- # state_10 = PHI <state_11(7), 0(10), state_11(5), 1(6), state_11(8), 2(9), state_11(11)>
-
- Now with the new evrp, we get:
-
- # state_10 = PHI <0(7), 0(10), state_11(5), 1(6), 0(8), 2(9), 1(11)>
-
- Thus, we have 3 more paths that are known to be constant and can be
- threaded. Which means that by the second threading pass, we can
- only find one profitable path.
-
- For the record, all these extra constants are better paths coming
- out of switches. For example:
-
- SWITCH_BB -> BBx -> BBy -> BBz -> PHI
-
- We now know the value of the switch index at PHI. */
-/* { dg-final { scan-tree-dump-times "FSM" 6 "thread1" } } */
-/* { dg-final { scan-tree-dump-times "FSM" 1 "thread2" } } */
+/* { dg-final { scan-tree-dump-times "Registering jump" 6 "thread1" } } */
+/* { dg-final { scan-tree-dump-times "Registering jump" 1 "thread3" } } */
int sum0, sum1, sum2, sum3;
int foo (char *s, char **ret)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index bad5bc1..e3d4b31 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -1,23 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-thread2-stats -fdump-tree-dom2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp2-stats -fno-guess-branch-probability" } */
-/* Here we have the same issue as was commented in ssa-dom-thread-6.c.
- The PHI coming into the threader has a lot more constants, so the
- threader can thread more paths.
-
-$ diff clean/a.c.105t.mergephi2 a.c.105t.mergephi2
-252c252
-< # s_50 = PHI <s_49(10), 5(14), s_51(18), s_51(22), 1(26), 1(29), 1(31), s_51(5), 4(12), 1(15), 5(17), 1(19), 3(21), 1(23), 6(25), 7(28), s_51(30)>
----
-> # s_50 = PHI <s_49(10), 5(14), 4(18), 5(22), 1(26), 1(29), 1(31), s_51(5), 4(12), 1(15), 5(17), 1(19), 3(21), 1(23), 6(25), 7(28), 7(30)>
-272a273
-
- I spot checked a few and they all have the same pattern. We are
- basically tracking the switch index better through multiple
- paths. */
-
-/* { dg-final { scan-tree-dump "Jumps threaded: 19" "thread1" } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 18" "thread1" } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread3" { target { ! aarch64*-*-* } } } } */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom2" } } */
/* aarch64 has the highest CASE_VALUES_THRESHOLD in GCC. It's high enough
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c
index 271e666..e3c33f49 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dse1-details -fno-short-enums -fno-tree-fre" } */
-/* { dg-skip-if "temporary variable for constraint_expr is never used" { msp430-*-* } } */
+/* { dg-skip-if "we want a BIT_FIELD_REF from fold_truth_andor" { ! lp64 } } */
+/* { dg-skip-if "temporary variable names are not x and y" { mmix-knuth-mmixware } } */
enum constraint_expr_type
{
@@ -30,15 +31,5 @@ constraint_equal (struct constraint a, struct constraint b)
&& constraint_expr_equal (a.rhs, b.rhs);
}
-/* Most targets should be using this test. */
-/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware } } } } } */
-/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware } } } } } */
-
-/* The c6x port generates significantly different gimple which
- changes the SRA and DSE decisions. Verify we remove all
- dead stores. Similarly for mmix. */
-/* { dg-final { scan-tree-dump-times "Deleted dead store: \[ax\].. = " 2 "dse1" { target tic6x-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Deleted dead store: \[by\].. = " 2 "dse1" { target tic6x-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Deleted dead store: x::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */
-/* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */
-
+/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" } } */
+/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
index b81cabe..3bf4e76 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
@@ -17,5 +17,6 @@ int foo (int *p, int b)
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse1"} } */
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */
-/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse5"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
index f4ef89c..4990ae0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
@@ -22,5 +22,6 @@ foo(int cond, struct z *s)
/* { dg-final { scan-tree-dump-times "Deleted dead store" 3 "dse1"} } */
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */
-/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse5"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c
new file mode 100644
index 0000000..9128eea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-dse1" } */
+
+int a[2];
+void foo(int i, int k)
+{
+ a[0] = i;
+ if (k)
+ a[0] = a[i] + k;
+ else
+ a[0] = a[i] + 3;
+ a[0] = 0;
+}
+
+/* Only the last store remains. */
+/* { dg-final { scan-tree-dump-times " = " 1 "dse1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c
new file mode 100644
index 0000000..34108c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-dse1" } */
+
+int a[2];
+void foo(int i, int k, int j)
+{
+ a[0] = i;
+ if (k)
+ a[0] = a[i] + k;
+ else
+ {
+ if (j)
+ a[1] = 1;
+ a[0] = a[i] + 3;
+ }
+ a[0] = 0;
+}
+
+/* The last stores to a[0] and a[1] remain. */
+/* { dg-final { scan-tree-dump-times " = " 2 "dse1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c
new file mode 100644
index 0000000..f8785e9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-dse1-details" } */
+
+struct X { int x; };
+struct X x;
+
+extern struct X foo (void);
+void bar()
+{
+ x = foo();
+ x = (struct X){};
+}
+
+extern struct X __attribute__((const)) foo2 (int);
+void bar2()
+{
+ x = foo2 (1);
+ x = foo2 (2);
+}
+
+/* { dg-final { scan-tree-dump-times "Deleted dead store in call LHS: x = foo " 1 "dse1" } } */
+/* { dg-final { scan-tree-dump-times "Deleted dead store: x = foo2 " 1 "dse1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-48.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-48.c
index b3d6102..5e74c78 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-48.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-48.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-fre1-details" } */
+/* { dg-options "-O -fdump-tree-fre1-details -fdisable-tree-ethread" } */
int foo (int i)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c
new file mode 100644
index 0000000..4999a3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-fre4" } */
+
+extern void foo(void);
+
+static int a[2], b, *c[2];
+
+int main() {
+ for (b = 0; b < 2; b++)
+ c[b] = &a[1];
+ if (!c[0])
+ foo();
+ return 0;
+}
+
+/* Even when vectorizing we should eliminate the call to foo. */
+/* { dg-final { scan-tree-dump-not "foo" "fre4" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c
new file mode 100644
index 0000000..c67fcea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-fre1" } */
+
+extern void foo(void);
+int a, c, *f, **d = &f;
+char b;
+int main()
+{
+ if (a) {
+ b = 0;
+ int *g = &c;
+ *g = 0;
+ f = *d;
+ *d = f;
+ if ((2 ^ b) == 0)
+ foo();
+ }
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "foo" "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c
new file mode 100644
index 0000000..7f66b7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-fre1" } */
+
+void bar ();
+void foo (int pred, int *other)
+{
+ *other = 0;
+ if (*other)
+ goto cnt;
+ if (pred)
+ {
+ *other = 1;
+cnt:
+ if (!pred)
+ bar ();
+ }
+}
+
+/* The first VN pass should figure that if (!pred) is false because
+ if (*other) is and thus the predicate test is redundant. */
+/* { dg-final { scan-tree-dump-not "bar" "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c
new file mode 100644
index 0000000..99c7375
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c
@@ -0,0 +1,17 @@
+/* PR tree-optimization/79333 */
+/* { dg-do compile } */
+/* { dg-require-effective-target c99_runtime } */
+/* { dg-options "-O -ffinite-math-only -fdump-tree-fre1" } */
+
+extern __inline __attribute__ ((__always_inline__,__gnu_inline__))
+double __attribute__ ((__nothrow__ , __leaf__))
+fabs (double __x) { return __builtin_fabs (__x); }
+
+double f(float f)
+{
+ double t1 = fabs(f);
+ double t2 = f / t1;
+ return t2;
+}
+
+/* { dg-final { scan-tree-dump "copysign" "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-15.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-15.c
new file mode 100644
index 0000000..5efb956
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-15.c
@@ -0,0 +1,18 @@
+/* PR/101293 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim2-details" } */
+
+struct X { int i; int j; };
+
+void foo(struct X *x, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ int *p = &x->j;
+ int tem = *p;
+ x->j += tem * i;
+ }
+}
+
+/* Make sure LIM can handle unifying MEM[x, 4] and MEM[x].j */
+/* { dg-final { scan-tree-dump "Executing store motion" "lim2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-16.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-16.c
new file mode 100644
index 0000000..741582b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-16.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim2-details" } */
+
+volatile int flag, bar;
+double foo (double *valp)
+{
+ double sum = 0;
+ for (int i = 0; i < 256; ++i)
+ {
+ for (int j = 0; j < 256; ++j)
+ bar = flag;
+ if (flag)
+ sum += 1.;
+ sum += *valp; // we should move the load of *valp out of the loop
+ }
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-17.c
new file mode 100644
index 0000000..1c840e5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-17.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim2-details" } */
+
+volatile int flag, bar;
+double foo (double *valp)
+{
+ double sum = 0;
+ for (int i = 0; i < 256; ++i)
+ {
+ if (flag)
+ for (int j = 0; j < 256; ++j)
+ bar = flag;
+ if (flag)
+ sum += 1.;
+ sum += *valp; // we should move the load of *valp out of the loop
+ }
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c
index 411585a..57b5016 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c
@@ -7,4 +7,4 @@ foo (int a, int b, int c)
return c ? x : a;
}
/* We should sink the x = a * b calculation into the branch that returns x. */
-/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c
index 37e4d2f..535cb32 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c
@@ -16,4 +16,4 @@ void foo (void)
}
}
-/* { dg-final { scan-tree-dump-times "Sinking # VUSE" 4 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sinking # VUSE" 4 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c
index a65ba35..584fd91 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c
@@ -21,5 +21,5 @@ void test ()
/* We should sink/merge all stores and end up with a single BB. */
-/* { dg-final { scan-tree-dump-times "MEM\[^\n\r\]* = 0;" 3 "sink" } } */
-/* { dg-final { scan-tree-dump-times "<bb " 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "MEM\[^\n\r\]* = 0;" 3 "sink1" } } */
+/* { dg-final { scan-tree-dump-times "<bb " 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c
index 771cd44..f5418b0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c
@@ -13,5 +13,5 @@ void foo (int b)
/* We should have sunk the store and inserted a PHI to merge the
stored values. */
-/* { dg-final { scan-tree-dump-times " = PHI" 1 "sink" } } */
-/* { dg-final { scan-tree-dump-times "x = " 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times " = PHI" 1 "sink1" } } */
+/* { dg-final { scan-tree-dump-times "x = " 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c
index 610c8d6..012b165 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c
@@ -10,5 +10,5 @@ int f(int n)
return j;
}
-/* { dg-final { scan-tree-dump "Sinking j_. = __builtin_ffs" "sink" } } */
+/* { dg-final { scan-tree-dump "Sinking j_. = __builtin_ffs" "sink1" } } */
/* { dg-final { scan-tree-dump "return 2;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c
index cf2e2a0..d0aeeb3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c
@@ -12,4 +12,4 @@ int my_f(int a, int b)
}
/* We should sink the call to pure_f to the if block. */
-/* { dg-final { scan-tree-dump "Sinking # VUSE" "sink" } } */
+/* { dg-final { scan-tree-dump "Sinking # VUSE" "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c
new file mode 100644
index 0000000..421c78e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c
@@ -0,0 +1,212 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-sink-stats" } */
+
+#include <stdint.h>
+
+#define HLOG 16
+#define MAX_LIT (1 << 5)
+typedef const uint8_t *LZF_HSLOT;
+typedef LZF_HSLOT LZF_STATE[1 << (HLOG)];
+
+int
+compute_on_bytes (uint8_t *in_data, int in_len, uint8_t *out_data, int out_len)
+{
+ LZF_STATE htab;
+
+ uint8_t *ip = in_data;
+ uint8_t *op = out_data;
+ uint8_t *in_end = ip + in_len;
+ uint8_t *out_end = op + out_len;
+ uint8_t *ref;
+
+ unsigned long off;
+ unsigned int hval;
+ int lit;
+
+ if (!in_len || !out_len)
+ return 0;
+
+ lit = 0;
+ op++;
+ hval = (((ip[0]) << 8) | ip[1]);
+
+ while (ip < in_end - 2)
+ {
+ uint8_t *hslot;
+
+ hval = (((hval) << 8) | ip[2]);
+ hslot = (uint8_t*)(htab + (((hval >> (3 * 8 - 16)) - hval * 5) & ((1 << (16)) - 1)));
+
+ ref = *hslot + in_data;
+ *hslot = ip - in_data;
+
+ if (1 && (off = ip - ref - 1) < (1 << 13) && ref > in_data
+ && ref[2] == ip[2]
+ && ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0]))
+ {
+ unsigned int len = 2;
+ unsigned int maxlen = in_end - ip - len;
+ maxlen
+ = maxlen > ((1 << 8) + (1 << 3)) ? ((1 << 8) + (1 << 3)) : maxlen;
+
+ if ((op + 3 + 1 >= out_end) != 0)
+ if (op - !lit + 3 + 1 >= out_end)
+ return 0;
+
+ op[-lit - 1] = lit - 1;
+ op -= !lit;
+
+ for (;;)
+ {
+ if (maxlen > 16)
+ {
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ len++;
+ if (ref[len] != ip[len])
+ break;
+ }
+
+ do
+ {
+ len++;
+ }
+ while (len < maxlen && ip[len] == ref[len]);
+
+ break;
+ }
+
+ len -= 2;
+ ip++;
+
+ if (len < 7)
+ {
+ *op++ = (off >> 8) + (len << 5);
+ }
+ else
+ {
+ *op++ = (off >> 8) + (7 << 5);
+ *op++ = len - 7;
+ }
+ *op++ = off;
+ lit = 0;
+ op++;
+ ip += len + 1;
+
+ if (ip >= in_end - 2)
+ break;
+
+ --ip;
+ --ip;
+
+ hval = (((ip[0]) << 8) | ip[1]);
+ hval = (((hval) << 8) | ip[2]);
+ htab[(((hval >> (3 * 8 - 16)) - hval * 5) & ((1 << (16)) - 1))]
+ = (LZF_HSLOT)(ip - in_data);
+ ip++;
+
+ hval = (((hval) << 8) | ip[2]);
+ htab[(((hval >> (3 * 8 - 16)) - hval * 5) & ((1 << (16)) - 1))]
+ = (LZF_HSLOT)(ip - in_data);
+ ip++;
+ }
+ else
+ {
+ if (op >= out_end)
+ return 0;
+
+ lit++;
+ *op++ = *ip++;
+
+ if (lit == (1 << 5))
+ {
+ op[-lit - 1] = lit - 1;
+ lit = 0;
+ op++;
+ }
+ }
+ }
+ if (op + 3 > out_end) /* at most 3 bytes can be missing here */
+ return 0;
+
+ while (ip < in_end)
+ {
+ lit++;
+ *op++ = *ip++;
+ if (lit == MAX_LIT)
+ {
+ op[-lit - 1] = lit - 1; /* stop run */
+ lit = 0;
+ op++; /* start run */
+ }
+ }
+
+ op[-lit - 1] = lit - 1; /* end run */
+ op -= !lit; /* undo run if length is zero */
+
+ return op - out_data;
+ }
+
+ /* For this case, pass sink2 sinks statements from hot loop header to loop
+ exits after gimple loop optimizations, which generates instructions executed
+ each iteration in loop, but the results are used outside of loop:
+ With -m64,
+ "Sinking _367 = (uint8_t *) _320;
+ from bb 31 to bb 90
+ Sinking _320 = _321 + ivtmp.25_326;
+ from bb 31 to bb 90
+ Sinking _321 = (unsigned long) ip_229;
+ from bb 31 to bb 90
+ Sinking len_158 = _322 + 4294967295;
+ from bb 31 to bb 33"
+ When -m32, Power and X86 will sink 3 instructions, but arm ilp32 couldn't
+ sink due to ivopts chooses two IV candidates instead of one, which is
+ expected, so this case is restricted to lp64 only so far. */
+
+ /* { dg-final { scan-tree-dump-times "Sunk statements: 4" 1 "sink2" { target lp64 } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c
index 6aa5a18..a0b4734 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c
@@ -9,4 +9,4 @@ bar (int a, int b, int c)
return y;
}
/* We should sink the x = a * b calculation into the else branch */
-/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c
index 599997e..ad88ccc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c
@@ -12,4 +12,4 @@ main (int argc)
}
}
/* We should sink the a = argc + 1 calculation into the if branch */
-/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c
index 784edd2..1e3cfa9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c
@@ -17,4 +17,4 @@ main (int argc)
foo2 (a);
}
/* We should sink the first a = b + c calculation into the else branch */
-/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c
index dbdde39..f04da5d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c
@@ -44,4 +44,4 @@ void foo(int16_t runs[], uint8_t alpha[], int x, int count)
}
/* We should not sink the next_runs = runs + x calculation after the loop. */
-/* { dg-final { scan-tree-dump-times "Sunk statements:" 0 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements:" 0 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c
index 1abae9f..31f5af3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c
@@ -14,4 +14,4 @@ int foo(int *a, int r)
/* *a = 1 should be sunk to the else block. */
-/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c
index ec3288f..bd74844 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c
@@ -15,4 +15,4 @@ int foo(int *a, int r, short *b)
/* *a = 1 should be sunk to the else block. */
-/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c
index 48af421..4b23b56 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c
@@ -24,4 +24,4 @@ int foo(int *a, int r, short *b)
/* *a = 1 should be sunk into the default case. */
-/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c
index 509a763..32bfc81 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c
@@ -15,4 +15,4 @@ int foo(int *a, int r, int *b)
/* *a = 1 should be sunk to the else block. */
-/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
index 67e1e89..672a54e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp2-details --param logical-op-non-short-circuit=1" } */
+/* { dg-additional-options "-fdisable-tree-ethread -fdisable-tree-thread1 -fdisable-tree-thread2" } */
/* { dg-final { scan-tree-dump-not "IRREDUCIBLE_LOOP" "vrp2" } } */
void abort (void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
index fb9840e..08c0b8d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
@@ -1,8 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread2-details -fdump-tree-thread3-details -fdump-tree-thread4-details -fno-finite-loops --param early-inlining-insns=14 -fno-inline-functions" } */
-/* { dg-final { scan-tree-dump "FSM" "thread2" } } */
-/* { dg-final { scan-tree-dump "FSM" "thread3" } } */
-/* { dg-final { scan-tree-dump "FSM" "thread4" { xfail *-*-* } } } */
+/* { dg-options "-O2 -fdump-tree-thread3-details -fdump-tree-thread4-details -fno-finite-loops --param early-inlining-insns=14 -fno-inline-functions" } */
+/* { dg-final { scan-tree-dump "Registering jump thread" "thread3" } } */
+/* { dg-final { scan-tree-dump "Registering jump thread" "thread4" } } */
typedef struct bitmap_head_def *bitmap;
typedef const struct bitmap_head_def *const_bitmap;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c
index 061f223..ad38b89 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-ethread-details" } */
-/* { dg-final { scan-tree-dump "FSM" "ethread" } } */
+/* { dg-final { scan-tree-dump "Registering jump thread" "ethread" } } */
typedef struct rtx_def *rtx;
typedef const struct rtx_def *const_rtx;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-14.c
index 38661c8..f9152b9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-14.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-14.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-additional-options "-O2 -fdump-tree-vrp-details --param logical-op-non-short-circuit=1" } */
+/* { dg-additional-options "-fdisable-tree-thread1" } */
/* { dg-final { scan-tree-dump-times "Threaded jump" 8 "vrp1" } } */
void foo (void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-10.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-10.c
new file mode 100644
index 0000000..484dcc1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-10.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-tailc-details" } */
+
+struct A {};
+
+struct A goo(void);
+struct A foo(void)
+{
+ return goo();
+}
+
+/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-11.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-11.c
new file mode 100644
index 0000000..36e4417
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-11.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-tailc-details" } */
+
+struct A {};
+
+void goo(void);
+struct A foo(void)
+{
+ goo();
+}
+
+/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-12.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-12.c
new file mode 100644
index 0000000..0eeb3ab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-12.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-tailc-details" } */
+
+struct A {};
+
+struct A goo(void);
+void foo(void)
+{
+ goo();
+}
+
+/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-13.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-13.c
new file mode 100644
index 0000000..855b3312
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-13.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-tailc-details" } */
+
+struct A {};
+struct B{};
+
+struct B goo(void);
+struct A foo(void)
+{
+ struct A a;
+ goo();
+ return a;
+}
+
+/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-8.c b/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-8.c
new file mode 100644
index 0000000..ecde499
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-8.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr1-details" } */
+
+struct A {};
+
+struct A foo()
+{
+ return foo();
+}
+
+/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c
index 4be538f..2285c55 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks -fdisable-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks -fdisable-tree-evrp -fdisable-tree-ethread -fdisable-tree-thread1" } */
struct A
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c
index bafb65a..1d7ea4e8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdisable-tree-ethread -fdisable-tree-thread1" } */
struct A
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp05.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp05.c
index 8c611e9..c17cd1b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp05.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp05.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining -fdisable-tree-ethread -fdisable-tree-thread1" } */
inline int ten()
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp06.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp06.c
index a872bc4..acb03c2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp06.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp06.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdisable-tree-ethread -fdisable-tree-thread1" } */
int baz (void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
index 0f3f280..31a5415 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks -fdisable-tree-ethread -fdisable-tree-thread1" } */
int
foo (int i, int *p)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c
index 56cc50c..fad0051 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1 -std=gnu89" } */
+/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1 -std=gnu89 -fdisable-tree-ethread -fdisable-tree-thread1" } */
foo (int *p)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c
index 40373fd..98a8da6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fwrapv -O1 -ftree-vrp -fdisable-tree-evrp -fdump-tree-vrp1" } */
+/* { dg-options "-fwrapv -O1 -ftree-vrp -fdisable-tree-evrp -fdump-tree-vrp1 -fdisable-tree-ethread -fdisable-tree-thread1" } */
#include <limits.h>
extern void abort ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c
index 4a3b0d7..f9df67f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fwrapv -O1 -fno-tree-fre -fdisable-tree-evrp -ftree-vrp -fdump-tree-vrp1" } */
+/* { dg-options "-fwrapv -O1 -fno-tree-fre -fdisable-tree-evrp -ftree-vrp -fdump-tree-vrp1 -fdisable-tree-ethread -fdisable-tree-thread1" } */
extern void abort ();
extern void exit (int);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
index dfe44b3..91015da 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-evrp-details -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-evrp-details -fdump-tree-optimized -fno-tree-ccp" } */
struct rtx_def;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c
index f1d3863..88833eb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fno-tree-fre -fdisable-tree-evrp" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fno-tree-fre -fdisable-tree-evrp -fdisable-tree-ethread -fdisable-tree-thread1" } */
/* This is from PR14052. */
diff --git a/gcc/testsuite/gcc.dg/typedef-var-2.c b/gcc/testsuite/gcc.dg/typedef-var-2.c
index 716d29c..bc119a0 100644
--- a/gcc/testsuite/gcc.dg/typedef-var-2.c
+++ b/gcc/testsuite/gcc.dg/typedef-var-2.c
@@ -4,12 +4,13 @@
int f (void)
{
extern float v;
-
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } .-1 } */
return (v > 0.0f);
}
extern int t;
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } .-1 } */
typedef float t; /* { dg-error "redeclared as different kind of symbol" } */
-t v = 4.5f;
+t v = 4.5f; /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/ucnid-5-utf8.c b/gcc/testsuite/gcc.dg/ucnid-5-utf8.c
index 8e10467..43310b6 100644
--- a/gcc/testsuite/gcc.dg/ucnid-5-utf8.c
+++ b/gcc/testsuite/gcc.dg/ucnid-5-utf8.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-skip-if "No dollar in identfiers" { avr-*-* powerpc-ibm-aix* } } */
+/* { dg-skip-if "No dollar in identifiers" { avr-*-* powerpc-ibm-aix* } } */
/* { dg-skip-if "" { ! ucn } } */
/* { dg-options "-std=c99 -fdollars-in-identifiers -g" } */
void abort (void);
diff --git a/gcc/testsuite/gcc.dg/ucnid-5.c b/gcc/testsuite/gcc.dg/ucnid-5.c
index dc282a7..6f0f475 100644
--- a/gcc/testsuite/gcc.dg/ucnid-5.c
+++ b/gcc/testsuite/gcc.dg/ucnid-5.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-skip-if "No dollar in identfiers" { avr-*-* powerpc-ibm-aix* } } */
+/* { dg-skip-if "No dollar in identifiers" { avr-*-* powerpc-ibm-aix* } } */
/* { dg-options "-std=c99 -fdollars-in-identifiers -g" } */
void abort (void);
diff --git a/gcc/testsuite/gcc.dg/uninit-15-O0.c b/gcc/testsuite/gcc.dg/uninit-15-O0.c
index a3fd2b63..1ddddee 100644
--- a/gcc/testsuite/gcc.dg/uninit-15-O0.c
+++ b/gcc/testsuite/gcc.dg/uninit-15-O0.c
@@ -14,7 +14,7 @@ void baz();
void bar()
{
- int j; /* { dg-message "was declared here" {} { xfail *-*-* } } */
- for (; foo(j); ++j)
+ int j; /* { dg-message "declared here" } */
+ for (; foo(j); ++j) /* { dg-warning "is used uninitialized" } */
baz();
}
diff --git a/gcc/testsuite/gcc.dg/uninit-15.c b/gcc/testsuite/gcc.dg/uninit-15.c
index 8ee10c2..7352662 100644
--- a/gcc/testsuite/gcc.dg/uninit-15.c
+++ b/gcc/testsuite/gcc.dg/uninit-15.c
@@ -1,7 +1,7 @@
/* PR tree-optimization/17506
- We issue an uninitialized variable warning at a wrong location at
+ We used to issue an uninitialized variable warning at a wrong location at
line 11, which is very confusing. Make sure we print out a note to
- make it less confusing. (not xfailed alternative)
+ make it less confusing. (xfailed alternative)
But it is of course ok if we warn in bar about uninitialized use
of j. (not xfailed alternative) */
/* { dg-do compile } */
@@ -10,7 +10,7 @@
inline int
foo (int i)
{
- if (i) /* { dg-warning "used uninitialized" } */
+ if (i) /* { dg-warning "used uninitialized" "" { xfail *-*-* } } */
return 1;
return 0;
}
@@ -20,7 +20,7 @@ void baz (void);
void
bar (void)
{
- int j; /* { dg-message "note: 'j' was declared here" "" } */
- for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" "" { xfail *-*-* } } */
+ int j; /* { dg-message "note: 'j' was declared here" } */
+ for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" } */
baz ();
}
diff --git a/gcc/testsuite/gcc.dg/uninit-23.c b/gcc/testsuite/gcc.dg/uninit-23.c
index d64eb7d..87b4e98 100644
--- a/gcc/testsuite/gcc.dg/uninit-23.c
+++ b/gcc/testsuite/gcc.dg/uninit-23.c
@@ -18,7 +18,7 @@ ql (void)
int *t4 = go; /* { dg-warning "is used uninitialized" } */
l1:
- *t4 = (*t4 != 0) ? 0 : 2;
+ *t4 = (*t4 != 0) ? 0 : 2; /* { dg-warning "is used uninitialized" } */
}
if (ij != 0)
diff --git a/gcc/testsuite/gcc.dg/uninit-38.c b/gcc/testsuite/gcc.dg/uninit-38.c
index 8dacc8c..0d70bcd 100644
--- a/gcc/testsuite/gcc.dg/uninit-38.c
+++ b/gcc/testsuite/gcc.dg/uninit-38.c
@@ -1,5 +1,5 @@
-/* Verify that dereferencing uninitialized allocated objects and VLAs
- correctly reflects offsets into the objects.
+/* Verify that dereferencing uninitialized VLAs correctly reflects
+ offsets into the objects.
The test's main purpose is to exercise the formatting of MEM_REFs.
If -Wuninitialized gets smarter and detects uninitialized accesses
before they're turned into MEM_REFs the test will likely need to
@@ -18,41 +18,6 @@ extern void* malloc (size_t);
void sink (void*, ...);
-#undef T
-#define T(Type, idx, off) \
- __attribute__ ((noipa)) \
- void UNIQ (test_)(int n) \
- { \
- void *p = malloc (n); \
- Type *q = (Type*)((char*)p + off); \
- sink (p, q[idx]); \
- } \
- typedef void dummy_type
-
-T (int, 0, 0); // { dg-warning "'\\*\\(int \\*\\)p' is used uninitialized" }
-T (int, 0, 1); // { dg-warning "'\\*\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)'" }
-T (int, 0, 2); // { dg-warning "'\\*\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)'" }
-T (int, 0, 3); // { dg-warning "'\\*\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)'" }
-T (int, 0, 4); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[1]'" }
-T (int, 0, 5); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[1]'" }
-T (int, 0, 6); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)\\)\\\[1]'" }
-T (int, 0, 7); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)\\)\\\[1]'" }
-T (int, 0, 8); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[2]'" }
-T (int, 0, 9); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[2]'" }
-
-
-T (int, 1, 0); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[1]' is used uninitialized" }
-T (int, 1, 1); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[1]'" }
-T (int, 1, 2); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)\\)\\\[1]'" }
-T (int, 1, 3); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)\\)\\\[1]'" }
-T (int, 1, 4); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[2]'" }
-T (int, 1, 5); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[2]'" }
-T (int, 1, 6); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)\\)\\\[2]'" }
-T (int, 1, 7); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)\\)\\\[2]'" }
-T (int, 1, 8); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[3]'" }
-T (int, 1, 9); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[3]'" }
-
-#undef T
#define T(Type, idx, off) \
__attribute__ ((noipa)) \
void UNIQ (test_)(int n) \
diff --git a/gcc/testsuite/gcc.dg/uninit-41.c b/gcc/testsuite/gcc.dg/uninit-41.c
new file mode 100644
index 0000000..b485611
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-41.c
@@ -0,0 +1,121 @@
+/* Verify that calls to non-modifying built-ins aren't considered
+ potentially modifying.
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void* alloca (size_t);
+void* calloc (size_t, size_t);
+void* malloc (size_t);
+int printf (const char *, ...);
+int scanf (const char *, ...);
+int sprintf (char *, const char *, ...);
+int snprintf (char *, size_t, const char *, ...);
+int puts (const char *);
+char* strcpy (char*, const char*);
+size_t strlen (const char*);
+
+void noproto ();
+
+void sink (int, ...);
+
+extern char a[];
+
+void nowarn_noproto (const char *fmt)
+{
+ int i;
+ noproto (&i);
+ sink (i);
+}
+
+void nowarn_scanf (const char *fmt)
+{
+ int i;
+ scanf ("%i", &i);
+ sink (i);
+}
+
+void test_puts_sprintf_alloca (const char *fmt)
+{
+ char *p;
+ {
+ p = alloca (8);
+ sprintf (a, fmt, p); // fmt might contain %n
+ puts (p);
+ }
+
+ {
+ p = alloca (8);
+ snprintf (0, 0, fmt, p); // same as above
+ puts (p);
+ }
+}
+
+void test_puts_alloca (const char *s)
+{
+ char *p = alloca (8);
+
+ {
+ char a[] = "foo";
+ puts (a);
+ }
+
+ puts (p); // { dg-warning "-Wuninitialized" }
+
+ {
+ p = alloca (strlen (s) + 1);
+ strcpy (p, s);
+ puts (p);
+ }
+
+ {
+ /* Verify that the puts() calls above isn't considered to have
+ potentially modified *P, and same for the one below. */
+ p = alloca (strlen (s));
+ puts (p); // { dg-warning "-Wuninitialized" }
+ puts (p + 1); // { dg-warning "-Wuninitialized" }
+ }
+}
+
+
+void test_puts_malloc (const char *s, const char *t)
+{
+ char *p;
+
+ {
+ p = malloc (strlen (s) + 1);
+ strcpy (p, s);
+ puts (p);
+ }
+
+ {
+ p = malloc (strlen (t));
+ puts (p); // { dg-warning "-Wuninitialized" }
+ }
+}
+
+
+void test_puts_vla (const char *s, const char *t)
+{
+ {
+ char a[strlen (s) + 1];
+ strcpy (a, s);
+ puts (a);
+ }
+
+ {
+ char b[strlen (t)];
+ puts (b); // { dg-warning "-Wuninitialized" }
+ }
+}
+
+
+void test_printf_puts (const char *s)
+{
+ char *p = __builtin_malloc (1);
+
+ printf ("%s", s);
+
+ puts (p); // { dg-warning "-Wuninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-42.c b/gcc/testsuite/gcc.dg/uninit-42.c
new file mode 100644
index 0000000..efaaacd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-42.c
@@ -0,0 +1,87 @@
+/* PR middle-end/101734 - missing warning reading from a write-only object
+ Verify that reading objects pointed to by arguments
+ declared with attribute access none or write-only is diagnosed by
+ -Wmaybe-uninitialized.
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+#define A(mode, ...) __attribute__ ((access (mode, __VA_ARGS__)))
+
+void sink (void *, ...);
+
+
+A (write_only, 1, 2)
+int nowarn_wo_assign_r0 (int *p, int n)
+{
+ *p = n;
+ return *p;
+}
+
+A (write_only, 1, 2)
+int nowarn_wo_sink_r0 (int *p, int n)
+{
+ sink (p, p + 1, p + n);
+ return *p;
+}
+
+A (write_only, 1, 2)
+int warn_wo_r0 (int *p, int n)
+{
+ return *p; // { dg-warning "'\\*p' may be used uninitialized \\\[-Wmaybe-uninitialized" }
+}
+
+
+A (write_only, 1, 2)
+int nowarn_wo_w1_r1 (int *p, int n)
+{
+ p[1] = n;
+ return p[1];
+}
+
+A (write_only, 1, 2)
+int warn_wo_r1 (int *p, int n)
+{
+ return p[1]; // { dg-warning "'p\\\[1]' may be used uninitialized" }
+}
+
+
+A (write_only, 1, 2)
+int nowarn_wo_rwi_rj (int *p, int n, int i, int j)
+{
+ p[i] = n;
+ return p[j];
+}
+
+A (write_only, 1, 2)
+ int warn_wo_ri (int *p, int n, int i)
+{
+ return p[i]; // { dg-warning " may be used uninitialized" }
+}
+
+
+
+A (none, 1, 2)
+int* nowarn_none_sink_return (int *p, int n)
+{
+ sink (p, p + 1, p + n);
+ return p;
+}
+
+A (none, 1, 2)
+int warn_none_r0 (int *p, int n)
+{
+ (void)&n;
+ return *p; // { dg-warning "'\\*p' may be used uninitialized" }
+}
+
+A (none, 1, 2)
+int warn_none_r1 (int *p, int n)
+{
+ return p[1]; // { dg-warning "'p\\\[1]' may be used uninitialized" }
+}
+
+A (write_only, 1, 2)
+int warn_none_ri (int *p, int n, int i)
+{
+ return p[i]; // { dg-warning " may be used uninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr100250.c b/gcc/testsuite/gcc.dg/uninit-pr100250.c
new file mode 100644
index 0000000..8e7a787
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr100250.c
@@ -0,0 +1,29 @@
+/* PR middle-end/100250 - ICE related to -Wmaybe-uninitialized
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+extern void f (int D, const int[D], const int[D]);
+
+void g (int D, const int a[D], const int b[D], const int c[D], const int d[D])
+{
+ int c2[D];
+
+ for (int i = 0; i < D; i++) {
+
+ if (a[i] >= D) __builtin_abort ();
+ if (b[i] != d[a[i]]) __builtin_abort ();
+
+ c2[a[i]] = c[i];
+ }
+
+ f (D, d, c2);
+}
+
+void h (int D, const int d[D])
+{
+ int a[D];
+ int b[D];
+ int c[D];
+
+ g (D, a, b, c, d); // { dg-warning "-Wmaybe-uninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr100732.c b/gcc/testsuite/gcc.dg/uninit-pr100732.c
new file mode 100644
index 0000000..9c847ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr100732.c
@@ -0,0 +1,21 @@
+/* PR middle-end/100732 - ICE on sprintf %s with integer argument
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+
+void nowarn_s_i (char *d, int i)
+{
+ __builtin_sprintf (d, "%s", i); // { dg-warning "\\\[-Wformat" }
+}
+
+void warn_s_i (char *d)
+{
+ int i;
+ __builtin_sprintf (d, "%s", i); // { dg-warning "\\\[-Wformat" }
+ // { dg-warning "\\\[-Wuninitialized" "" { target *-*-* } .-1 }
+}
+
+void warn_i_i (char *d)
+{
+ int i;
+ __builtin_sprintf (d, "%i", i); // { dg-warning "\\\[-Wuninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr101300.c b/gcc/testsuite/gcc.dg/uninit-pr101300.c
new file mode 100644
index 0000000..4392e8ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr101300.c
@@ -0,0 +1,53 @@
+/* PR middle-end/101300 - -fsanitize=undefined suppresses -Wuninitialized
+ for a VLA read at -O0
+ { dg-do compile }
+ { dg-options "-O0 -Wall -fsanitize=undefined" } */
+
+int warn_vla_rd0 (int n)
+{
+ char a[n];
+ return a[0]; // { dg-warning "\\\[-Wuninitialized]" }
+}
+
+int warn_vla_rd1 (int n)
+{
+ char a[n];
+ return a[1]; // { dg-warning "\\\[-Wuninitialized]" }
+}
+
+int warn_vla_rdi (int n, int i)
+{
+ char a[n];
+ return a[i]; // { dg-warning "\\\[-Wuninitialized]" }
+}
+
+
+int warn_vla_wr0_rd2_1_0 (int n)
+{
+ char a[n];
+ a[0] = __LINE__;
+ int x = a[2]; // { dg-warning "\\\[-Wuninitialized]" }
+ int y = a[1]; // { dg-warning "\\\[-Wuninitialized]" }
+ int z = a[0];
+ return x + y + z;
+}
+
+int warn_vla_wr1_rd2_1_0 (int n)
+{
+ char a[n];
+ a[1] = __LINE__;
+ int x = a[2]; // { dg-warning "\\\[-Wuninitialized]" }
+ int y = a[1];
+ int z = a[0]; // { dg-warning "\\\[-Wuninitialized]" }
+ return x + y + z;
+}
+
+int warn_vla_wr2_rd2_1_0 (int n)
+{
+ char a[n];
+ a[2] = __LINE__;
+ int x = a[2];
+ int y = a[1]; // { dg-warning "\\\[-Wuninitialized]" }
+ int z = a[0]; // { dg-warning "\\\[-Wuninitialized]" }
+ return x + y + z;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr101494.c b/gcc/testsuite/gcc.dg/uninit-pr101494.c
new file mode 100644
index 0000000..d3267b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr101494.c
@@ -0,0 +1,60 @@
+/* PR middle-end/101494 - bogus -Wmaybe-uninitialized on memrchr of size 0
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void* alloca (size_t);
+
+__attribute__ ((malloc, alloc_size (1))) void* alloc (size_t);
+
+__attribute__ ((access (read_only, 1, 2))) void* sink (void*, size_t);
+
+void test_alloca_zero (size_t i)
+{
+ char *p = alloca (0);
+ sink (p, 0); // { dg-bogus "\\\[-Wuninitialized" }
+}
+
+void test_alloca_zero_pi (size_t i)
+{
+ char *p = alloca (0);
+ sink (p + i, 0);
+}
+
+void test_alloca_cst (void)
+{
+ char *p = alloca (7);
+ sink (p, 0); // { dg-bogus "\\\[-Wuninitialized" }
+}
+
+void test_alloca_cst_p1 (void)
+{
+ char *p = alloca (7);
+ sink (p + 1, 0); // { dg-bogus "\\\[-Wuninitialized" }
+}
+
+void test_alloca_cst_p7 (void)
+{
+ char *p = alloca (7);
+ sink (p + 7, 0); // { dg-bogus "\\\[-Wuninitialized" }
+}
+
+void test_alloca_var (size_t n)
+{
+ char *p = alloca (n);
+ sink (p, 0); // { dg-bogus "\\\[-Wuninitialized" }
+}
+
+void test_alloca_var_p1 (size_t n)
+{
+ char *p = alloca (n);
+ sink (p + 1, 0); // { dg-bogus "\\\[-Wuninitialized" }
+}
+
+void test_alloca_var_pn (size_t n)
+{
+ char *p = alloca (n);
+ sink (p + n, 0); // { dg-bogus "\\\[-Wuninitialized" }
+}
+
diff --git a/gcc/testsuite/gcc.dg/uninit-pr101573.c b/gcc/testsuite/gcc.dg/uninit-pr101573.c
new file mode 100644
index 0000000..a574844
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr101573.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -Wuninitialized" } */
+
+int main(int argc, char **argv)
+{
+ int a;
+ for(; a < 5; ++a) /* { dg-warning "is used uninitialized" } */
+ ;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr44547.c b/gcc/testsuite/gcc.dg/uninit-pr44547.c
new file mode 100644
index 0000000..ee1035a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr44547.c
@@ -0,0 +1,61 @@
+/* PR tree-optimization/44547 - -Wuninitialized reports false warning
+ in nested switch statements
+ { dg-do compile }
+ { dg-options "-O1 -Wall" } */
+
+__attribute__ ((noipa)) int test_O1 (int argc)
+{
+ switch( argc )
+ {
+ case 1:
+ case 2:
+ case 4:
+ {
+ int n;
+ switch( argc )
+ {
+ case 1:
+ case 2:
+ case 4:
+ n = argc;
+ break;
+ }
+
+ return n;
+
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+#pragma GCC optimize ("2")
+
+__attribute__ ((noipa)) int test_O2 (int argc)
+{
+ switch( argc )
+ {
+ case 1:
+ case 2:
+ case 4:
+ {
+ int n;
+ switch( argc )
+ {
+ case 1:
+ case 2:
+ case 4:
+ n = argc;
+ break;
+ }
+
+ return n;
+
+ break;
+ }
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr55060.c b/gcc/testsuite/gcc.dg/uninit-pr55060.c
new file mode 100644
index 0000000..b2f2cb1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr55060.c
@@ -0,0 +1,30 @@
+/* PR tree-optimization/55060 - False un-initialized variable warnings
+ { dg-do compile }
+ { dg-options "-O1 -Wuninitialized" } */
+
+static void a(int *i) { }
+static void b(int p) { }
+int foo(void) {
+ int i;
+ a(&i);
+ b(i); // { dg-bogus "\\\[-Wuninitialized" }
+ return 0;
+}
+
+static void c(int *i) { }
+extern void d(int p);
+int bar(void) {
+ int i;
+ c(&i);
+ d(i); // { dg-warning "\\\[-Wuninitialized" }
+ return 0;
+}
+
+extern void e(int *i);
+static void f(int p) {};
+int baz(void) {
+ int i;
+ e(&i);
+ f(i); // { dg-bogus "\\\[-Wuninitialized" }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr59970.c b/gcc/testsuite/gcc.dg/uninit-pr59970.c
new file mode 100644
index 0000000..145af65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr59970.c
@@ -0,0 +1,79 @@
+/* PR tree-optimization/59970 - Bogus -Wmaybe-uninitialized at low optimization
+ levels
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+#pragma GCC push_options
+#pragma GCC optimize ("1")
+
+__attribute__ ((noipa)) int
+d_demangle_callback_O1 (const char *mangled)
+{
+ enum { DCT_TYPE, DCT_GLOBAL_DTORS } type;
+ int dc;
+
+ /* Fails for -Og and -O1. */
+ if (mangled)
+ type = DCT_GLOBAL_DTORS;
+ else
+ type = DCT_TYPE;
+
+ /* If both cases assign the same value, all is fine. */
+ switch (type)
+ {
+ case DCT_TYPE:
+ dc = 0 /* 1 */;
+ break;
+ case DCT_GLOBAL_DTORS:
+ dc = /* 0 */ 1;
+ break;
+
+ /* If this is added, all is fine. */
+#ifdef ABORT
+ default:
+ __builtin_unreachable ();
+#endif
+ }
+
+ return dc; // { dg-bogus "uninitialized" }
+}
+
+#pragma GCC pop_options
+
+
+#pragma GCC optimize ("Og")
+
+__attribute__ ((noipa)) int
+d_demangle_callback_Og (const char *mangled)
+{
+ enum { DCT_TYPE, DCT_GLOBAL_DTORS } type;
+ int dc;
+
+ /* Fails for -Og. */
+ /* Removing either the function call or the array dereference, it'll be like
+ the TOGGLE1 case. */
+ extern int cmp (void);
+ if (cmp () && mangled[0])
+ type = DCT_GLOBAL_DTORS;
+ else
+ type = DCT_TYPE;
+
+ /* If both cases assign the same value, all is fine. */
+ switch (type)
+ {
+ case DCT_TYPE:
+ dc = 0 /* 1 */;
+ break;
+ case DCT_GLOBAL_DTORS:
+ dc = /* 0 */ 1;
+ break;
+
+ /* If this is added, all is fine. */
+#ifdef ABORT
+ default:
+ __builtin_unreachable ();
+#endif
+ }
+
+ return dc; // { dg-bogus "uninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr61112.c b/gcc/testsuite/gcc.dg/uninit-pr61112.c
new file mode 100644
index 0000000..d8f9c80
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr61112.c
@@ -0,0 +1,89 @@
+/* PR tree-optimization/61112 - repeated conditional triggers false-positive
+ -Wmaybe-uninitialized warning
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+int p;
+
+void foo_c0 (int x, int y, int z)
+{
+ int w;
+ if (x)
+ w = z;
+ if (y)
+ w = __LINE__;
+
+ if (x || y)
+ p = w; // { dg-bogus "-Wmaybe-uninitialized" }
+}
+
+
+void foo_c5_1_1 (int x, int y, int z, int a)
+{
+ int w;
+ if (x)
+ w = z;
+ if (y)
+ w = __LINE__;
+ if (a)
+ w = __LINE__;
+
+ if (x || y || a)
+ p = w;
+}
+
+void foo_c5_1_2 (int x, int y, int z, int a)
+{
+ int w;
+ if (x)
+ w = z;
+ if (y)
+ w = __LINE__;
+ if (a)
+ w = __LINE__;
+
+ if (x || a || y)
+ p = w;
+}
+
+void foo_c5_1_3 (int x, int y, int z, int a)
+{
+ int w;
+ if (x)
+ w = z;
+ if (y)
+ w = __LINE__;
+ if (a)
+ w = __LINE__;
+
+ if (a || x || y)
+ p = w;
+}
+
+void foo_c5_2 (int x, int y, int z, int a)
+{
+ int w;
+ if (x)
+ w = __LINE__;
+ if (y)
+ w = z;
+ if (a)
+ w = __LINE__;
+
+ if (x || y || a)
+ p = w; // { dg-bogus "-Wmaybe-uninitialized" }
+}
+
+void foo_c5_3 (int x, int y, int z, int a)
+{
+ int w;
+ if (x)
+ w = __LINE__;
+ if (y)
+ w = __LINE__;
+ if (a)
+ w = z;
+
+ if (x || y || a)
+ p = w; // { dg-bogus "-Wmaybe-uninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr61677.c b/gcc/testsuite/gcc.dg/uninit-pr61677.c
new file mode 100644
index 0000000..a982fae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr61677.c
@@ -0,0 +1,26 @@
+/* PR tree-optimization/61677 - False positive with -Wmaybe-uninitialized
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+void *xmalloc (void);
+
+struct menu { struct menu *parent; };
+
+struct jump_key { int offset; };
+
+void f (struct menu *menu)
+{
+ int i;
+ struct menu *submenu[8], *location;
+ struct jump_key *jump;
+ location = menu;
+ for (i = 0; menu && i < 8; menu = menu->parent)
+ submenu[i++] = menu;
+ if (location)
+ jump = xmalloc ();
+ while (--i >= 0) {
+ menu = submenu[i];
+ if (location)
+ jump->offset = 42;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr61869.c b/gcc/testsuite/gcc.dg/uninit-pr61869.c
new file mode 100644
index 0000000..ef4f436
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr61869.c
@@ -0,0 +1,47 @@
+/* PR tree-optimization/61869 - Spurious uninitialized warning (lim1 pass,
+ pretty-printed internal var
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef struct data {
+ struct data *next;
+} data;
+
+typedef struct list {
+ unsigned dummy;
+ struct list *next;
+ data *start;
+ int flags;
+} list;
+
+typedef struct iterator {
+ struct data *ptr;
+ unsigned dummy;
+} iterator;
+
+iterator start (list *a) {
+ iterator i = {
+ *(a->flags ? &a->start : 0),
+ 0
+ };
+ return i;
+}
+
+void g (iterator *i);
+
+void f (list *b)
+{
+ list *a;
+ iterator i; // { dg-bogus "-Wmaybe-uninitialized" }
+
+ for (a = b; a; a = a->next)
+ for (i = start (a); i.ptr; i.ptr = i.ptr->next)
+ {
+ if (i.ptr)
+ return;
+ }
+
+ for (a = b; a; a = a->next)
+ for (i = start (a); i.ptr; i.ptr = i.ptr->next)
+ g(&i);
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr65178.c b/gcc/testsuite/gcc.dg/uninit-pr65178.c
new file mode 100644
index 0000000..21eb354
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr65178.c
@@ -0,0 +1,21 @@
+/* PR tree-optimizatiom/65178 - incorrect -Wmaybe-uninitialized when using
+ nested loops
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+void *bar (int);
+
+char *foo (void)
+{
+ char *c = "bla";
+ char *buf;
+ for (int a = 1;; a = 0)
+ {
+ for (char *s = c; *s; ++s)
+ {
+ }
+ if (!a) break;
+ buf = (char *) bar (1);
+ }
+ return buf; // { dg-bogus "\\\[-Wmaybe-uninitialized" }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr65182.c b/gcc/testsuite/gcc.dg/uninit-pr65182.c
new file mode 100644
index 0000000..45b538d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr65182.c
@@ -0,0 +1,44 @@
+/* PR middle-end/65182 - -Wuninitialized fails when pointer to variable
+ later passed to function
+ { dg-do compile }
+ { dg-options "-O0 -Wall" } */
+
+void bar (int *a);
+
+int baz (void);
+
+__attribute__ ((noipa)) void foo_O0 (int *b)
+{
+ int a;
+
+ if (a) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ *b = 0;
+ return;
+ }
+
+ bar (&a);
+
+ a = baz ();
+
+ *b = a + 2;
+}
+
+#pragma GCC optimize ("2")
+
+__attribute__ ((noipa)) void foo_O2 (int *b)
+{
+ int a;
+
+ if (a) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ *b = 0;
+ return;
+ }
+
+ bar (&a);
+
+ a = baz ();
+
+ *b = a + 3;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr89230-1.c b/gcc/testsuite/gcc.dg/uninit-pr89230-1.c
new file mode 100644
index 0000000..1c07c4f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr89230-1.c
@@ -0,0 +1,25 @@
+/* PR middle-end/89230 - Bogus uninited usage warning with printf
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct S { int i, j; };
+
+/* attribute__ ((malloc)) */ struct S* f (void);
+
+int g (void)
+{
+ struct S *p = f (), *q;
+
+ if (p->i || !(q = f ()) || p->j != q->i)
+ {
+ __builtin_printf ("%i", p->i);
+
+ if (p->i)
+ return 1;
+
+ if (!q) // { dg-bogus "\\\[-Wmaybe-uninitialized" }
+ return 2;
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr89230-2.c b/gcc/testsuite/gcc.dg/uninit-pr89230-2.c
new file mode 100644
index 0000000..473d2da
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr89230-2.c
@@ -0,0 +1,54 @@
+/* PR middle-end/89230 - Bogus uninited usage warning with printf
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+extern void* memset (void*, int, size_t);
+extern int printf (const char*, ...);
+extern int rand (void);
+
+struct S
+{
+ int a;
+ int b;
+};
+
+struct H
+{
+ int c;
+ int d;
+};
+
+void getblk (void* blk)
+{
+ struct S* s = (struct S*) blk;
+ memset (blk, 0, 512);
+ s->a = rand () & 1;
+}
+
+struct H* gethdr (void* blk)
+{
+ memset (blk, 0, 512);
+ return rand () & 1 ? (struct H*) blk : 0;
+}
+
+int main (void)
+{
+ char blk[512], tmp[512];
+ struct S *s = (struct S*) blk;
+ struct H *h;
+
+ getblk (blk);
+
+ if (s->a || !(h = gethdr (tmp)) || s->a != h->d) {
+
+ printf ("%d\n", s->b);
+ if (s->a)
+ printf ("s->a = %d\n", s->a);
+ else if (!h)
+ printf ("!h\n");
+ else
+ printf ("h->d = %d\n", h->d);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr93100.c b/gcc/testsuite/gcc.dg/uninit-pr93100.c
new file mode 100644
index 0000000..531a5c3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr93100.c
@@ -0,0 +1,75 @@
+/* PR tree-optimization/93100 - gcc -fsanitize=address inhibits -Wuninitialized
+ { dg-do compile }
+ { dg-options "-Wall -fsanitize=address" }
+ { dg-skip-if "sanitize address" { "powerpc-ibm-aix*" } } */
+
+struct A
+{
+ _Bool b;
+ int i;
+};
+
+void warn_A_b_O0 (void)
+{
+ struct A a;
+
+ if (a.b) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ (void)&a;
+ }
+}
+
+void warn_A_i_O0 (void)
+{
+ struct A a;
+
+ if (a.i) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ (void)&a;
+ }
+}
+
+#pragma GCC optimize ("1")
+
+void warn_A_b_O1 (void)
+{
+ struct A a;
+
+ if (a.b) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ (void)&a;
+ }
+}
+
+void warn_A_i_O1 (void)
+{
+ struct A a;
+
+ if (a.i) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ (void)&a;
+ }
+}
+
+
+#pragma GCC optimize ("2")
+
+void warn_A_b_O2 (void)
+{
+ struct A a;
+
+ if (a.b) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ (void)&a;
+ }
+}
+
+void warn_A_i_O2 (void)
+{
+ struct A a;
+
+ if (a.i) // { dg-warning "\\\[-Wuninitialized" }
+ {
+ (void)&a;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr98583.c b/gcc/testsuite/gcc.dg/uninit-pr98583.c
new file mode 100644
index 0000000..638b029
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr98583.c
@@ -0,0 +1,31 @@
+/* PR middle-end/98583 - missing -Wuninitialized reading from a second VLA
+ in its own block
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+void f (int*);
+void g (int);
+
+void h1 (int n)
+{
+ int a[n];
+ f (a);
+
+ int b[n];
+ g (b[1]); // { dg-warning "\\\[-Wuninitialized" }
+}
+
+void h2 (int n, int i, int j)
+{
+ if (i)
+ {
+ int a[n];
+ f (a);
+ }
+
+ if (j)
+ {
+ int b[n];
+ g (b[1]); // { dg-warning "\\\[-Wmaybe-uninitialized" }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-9_b.c b/gcc/testsuite/gcc.dg/uninit-pred-9_b.c
index d9ae75e..8c2d28c 100644
--- a/gcc/testsuite/gcc.dg/uninit-pred-9_b.c
+++ b/gcc/testsuite/gcc.dg/uninit-pred-9_b.c
@@ -1,4 +1,3 @@
-
/* { dg-do compile } */
/* { dg-options "-Wuninitialized -O2" } */
@@ -21,7 +20,7 @@ int foo (int n, int l, int m, int r)
blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */
if ( (n <= 8) && (m < 99) && (r < 19) )
- blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */
+ blah(v); /* { dg-bogus "uninitialized" "pr101674" { xfail powerpc64*-*-* mmix-*-* cris-*-* } } */
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/uninit-suppress_3.c b/gcc/testsuite/gcc.dg/uninit-suppress_3.c
new file mode 100644
index 0000000..7bbe9ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-suppress_3.c
@@ -0,0 +1,98 @@
+/* PR middle-end/98871 - Cannot silence -Wmaybe-uninitialized at declaration
+ site
+ { dg-do compile }
+ { dg-options "-O1 -Wall" } */
+
+struct A
+{
+ int x;
+};
+
+// Verify that suppression works at every inlining level.
+
+static int f0 (int *x)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+
+ return ++*x;
+
+#pragma GCC diagnostic pop
+}
+
+static int f1 (int *p, int n)
+{
+ struct A a;
+ for (int i = 0; i < n; ++i) {
+ if (p[i] > 1) {
+ a = (struct A){p[i]};
+ }
+ }
+
+ return f0 (&a.x);
+}
+
+int f2 (void)
+{
+ int a[] = { 1, 2, 3, 4 };
+ return f1 (a, 4);
+}
+
+
+static int g0 (int *x)
+{
+ return ++*x;
+}
+
+static int g1 (int *p, int n)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+
+ struct A a;
+ for (int i = 0; i < n; ++i) {
+ if (p[i] > 1) {
+ a = (struct A){p[i]};
+ }
+ }
+
+ return g0 (&a.x);
+
+#pragma GCC diagnostic pop
+}
+
+int g2 (void)
+{
+ int a[] = { 1, 2, 3, 4, 5 };
+ return g1 (a, 5);
+}
+
+
+static int h0 (int *x)
+{
+ return ++*x;
+}
+
+static int h1 (int *p, int n)
+{
+ struct A a;
+ for (int i = 0; i < n; ++i) {
+ if (p[i] > 1) {
+ a = (struct A){p[i]};
+ }
+ }
+
+ return h0 (&a.x);
+}
+
+int h2 (void)
+{
+ int a[] = { 1, 2, 3, 4, 5, 6 };
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+
+ return h1 (a, 6);
+
+#pragma GCC diagnostic pop
+}
diff --git a/gcc/testsuite/gcc.dg/unroll-10.c b/gcc/testsuite/gcc.dg/unroll-10.c
new file mode 100644
index 0000000..0559915
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/unroll-10.c
@@ -0,0 +1,13 @@
+/* { dg-options "-O3 -fdump-tree-unrolljam" } */
+
+void
+f (int *restrict x, int *restrict y, int z[restrict 100][100])
+{
+ for (int j = 0; j < 100; ++j)
+ for (int i = 0; i < 100; ++i)
+ x[i] += y[i] * z[j][i];
+}
+
+/* The loop should be unrolled 2 times, leaving one load from x,
+ one load from y and 2 loads from z. */
+/* { dg-final { scan-tree-dump-times { = \(*\*} 4 "unrolljam" } } */
diff --git a/gcc/testsuite/gcc.dg/unroll-9.c b/gcc/testsuite/gcc.dg/unroll-9.c
new file mode 100644
index 0000000..2d65ec3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/unroll-9.c
@@ -0,0 +1,12 @@
+/* { dg-options "-O3 -fdump-tree-unrolljam -fno-math-errno" } */
+
+void
+f (float *restrict x, float y[100][100])
+{
+ for (int j = 0; j < 100; ++j)
+ for (int i = 0; i < 100; ++i)
+ x[i] += __builtin_expf (y[j][i]);
+}
+
+/* The loop should be unrolled 2 times, without a tail loop. */
+/* { dg-final { scan-tree-dump-times "__builtin_expf" 2 "unrolljam" } } */
diff --git a/gcc/testsuite/gcc.dg/unroll-and-jam.c b/gcc/testsuite/gcc.dg/unroll-and-jam.c
index 7eb6421..b8f4f16 100644
--- a/gcc/testsuite/gcc.dg/unroll-and-jam.c
+++ b/gcc/testsuite/gcc.dg/unroll-and-jam.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-O3 -floop-unroll-and-jam -fno-tree-loop-im --param unroll-jam-min-percent=0 -fdump-tree-unrolljam-details" } */
+/* { dg-additional-options "--param max-completely-peel-times=16" { target { s390*-*-* } } } */
/* { dg-require-effective-target int32plus } */
#include <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-16.c b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
index e68a9b6..664e93e 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
@@ -1,5 +1,8 @@
/* { dg-require-effective-target vect_int } */
+/* See note below as to why we disable threading. */
+/* { dg-additional-options "-fdisable-tree-thread1" } */
+
#include <stdarg.h>
#include "tree-vect.h"
@@ -27,6 +30,10 @@ main1 (int dummy)
*pout++ = *pin++ + a;
*pout++ = *pin++ + a;
*pout++ = *pin++ + a;
+ /* In some architectures like ppc64, jump threading may thread
+ the iteration where i==0 such that we no longer optimize the
+ BB. Another alternative to disable jump threading would be
+ to wrap the read from `i' into a function returning i. */
if (arr[i] = i)
a = i;
else
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-39.c b/gcc/testsuite/gcc.dg/vect/bb-slp-39.c
index 255bb10..ee596cf 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-39.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-39.c
@@ -16,4 +16,5 @@ void foo (double *p)
}
/* See that we vectorize three SLP instances. */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "slp2" { target { ! s390*-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 5 "slp2" { target { s390*-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-43.c b/gcc/testsuite/gcc.dg/vect/bb-slp-43.c
index 40bd2e0..a65d951 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-43.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-43.c
@@ -14,4 +14,4 @@ f (int *restrict x, short *restrict y)
}
/* { dg-final { scan-tree-dump-not "mixed mask and nonmask" "slp2" } } */
-/* { dg-final { scan-tree-dump-not "vector operands from scalars" "slp2" { target { { vect_int && vect_bool_cmp } && { vect_unpack && vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-not "vector operands from scalars" "slp2" { target { { vect_int && vect_bool_cmp } && { vect_unpack && vect_hw_misalign } } xfail vect_variable_length } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-71.c b/gcc/testsuite/gcc.dg/vect/bb-slp-71.c
new file mode 100644
index 0000000..6816511
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-71.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+int a[4], b[4];
+
+void __attribute__((noipa))
+foo(int x, int y)
+{
+ int tem0 = x + 1;
+ int tem1 = y + 2;
+ int tem2 = x + 3;
+ int tem3 = y + 4;
+ a[0] = tem0 + b[1];
+ a[1] = tem1 + b[0];
+ a[2] = tem2 + b[2];
+ a[3] = tem3 + b[3];
+}
+
+int main()
+{
+ check_vect ();
+
+ b[0] = 10;
+ b[1] = 14;
+ b[2] = 18;
+ b[3] = 22;
+ foo (-1, -3);
+ if (a[0] != 14 || a[1] != 9 || a[2] != 20 || a[3] != 23)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-72.c b/gcc/testsuite/gcc.dg/vect/bb-slp-72.c
new file mode 100644
index 0000000..5b243fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-72.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+double x[2], y[2], z[2], w[2];
+
+void __attribute__((noipa)) foo ()
+{
+ double tem0 = x[1] + y[1];
+ double tem1 = x[0] - y[0];
+ double tem2 = z[1] * tem0;
+ double tem3 = z[0] * tem1;
+ z[0] = tem2 - w[0];
+ z[1] = tem3 + w[1];
+}
+
+int main()
+{
+ check_vect ();
+
+ x[0] = 1.; x[1] = 2.;
+ y[0] = 7.; y[1] = -5.;
+ z[0] = 2.; z[1] = 3.;
+ w[0] = 9.; w[1] = -5.;
+ foo ();
+ if (z[0] != -18. || z[1] != -17.)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-73.c b/gcc/testsuite/gcc.dg/vect/bb-slp-73.c
new file mode 100644
index 0000000..d4c8a51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-73.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+double x[2], y[2], z[2], w[2];
+
+void __attribute__((noipa)) foo ()
+{
+ double tem0 = x[1] + y[1];
+ double tem1 = x[0] - y[0];
+ double tem2 = z[1] * tem0;
+ double tem3 = z[0] * tem1;
+ z[0] = tem2 - w[1];
+ z[1] = tem3 + w[0];
+}
+
+int main()
+{
+ check_vect ();
+
+ x[0] = 1.; x[1] = 2.;
+ y[0] = 7.; y[1] = -5.;
+ z[0] = 2.; z[1] = 3.;
+ w[0] = 9.; w[1] = -5.;
+ foo ();
+ if (z[0] != -4. || z[1] != -3.)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-74.c b/gcc/testsuite/gcc.dg/vect/bb-slp-74.c
new file mode 100644
index 0000000..9c1ebb7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-74.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vect_double } */
+
+#include "tree-vect.h"
+
+double a[2], b[2], c[2];
+
+void __attribute__((noipa)) foo ()
+{
+ double tem0 = a[1] + b[1];
+ double tem1 = a[0] - b[0];
+ c[0] = 2. * tem0;
+ c[1] = 5. * tem1;
+}
+
+int main()
+{
+ check_vect ();
+
+ a[0] = 1.; a[1] = 3.;
+ b[0] = -5.; b[1] = 13.;
+ foo ();
+ if (c[0] != 32. || c[1] != 30.)
+ __builtin_abort ();
+ return 0;
+}
+
+/* We'd like to see at most one VEC_PERM_EXPR, not one for a blend
+ and one for a permute materialized somewhere else. But addsub
+ pattern recog can likely get in the way here. */
+/* { dg-final { scan-tree-dump-times " \[^ \]\+ = VEC_PERM_EXPR" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr100778-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr100778-1.c
new file mode 100644
index 0000000..9f8b7ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr100778-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double foo (int x, double *p)
+{
+ double res = p[0] + p[1];
+ double tem = p[0] / x;
+ if (x)
+ {
+ p[0] = tem;
+ p[1] /= x;
+ }
+ return res + tem;
+}
+
+/* We may not SLP vectorize the FP division because it can trap and it
+ is distributed between two basic-blocks. */
+/* { dg-final { scan-tree-dump "Build SLP failed: different BB for PHI or possibly trapping operation in _\[0-9\]+ = _\[0-9\]+ / _\[0-9\]+;" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr101207.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101207.c
new file mode 100644
index 0000000..1f51d66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101207.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-additional-options "-ffast-math" } */
+
+#include "tree-vect.h"
+
+double a[2];
+double x, y;
+
+void __attribute__((noipa)) foo ()
+{
+ x = a[1] - a[0];
+ y = a[0] + a[1];
+}
+
+int main()
+{
+ check_vect ();
+
+ a[0] = 0.;
+ a[1] = 1.;
+ foo ();
+ if (x != 1. || y != 1.)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr101242.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101242.c
new file mode 100644
index 0000000..d885446
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101242.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+
+typedef struct {
+ double real;
+ double imag;
+} complex;
+typedef struct {
+ complex e[3][3];
+} su3_matrix;
+su3_matrix check_su3_c;
+double check_su3_ar, check_su3_ari, check_su3_max;
+int arireturn();
+int check_su3() {
+ check_su3_ar = check_su3_c.e[0][0].real * check_su3_c.e[1][0].real +
+ check_su3_c.e[0][0].imag * check_su3_c.e[1][0].imag +
+ check_su3_c.e[0][1].real * check_su3_c.e[1][1].real +
+ check_su3_c.e[0][1].imag * check_su3_c.e[1][1].imag +
+ check_su3_c.e[0][2].real * check_su3_c.e[1][2].real +
+ check_su3_c.e[0][2].imag * check_su3_c.e[1][2].imag;
+ check_su3_max = check_su3_c.e[0][0].real * check_su3_c.e[2][0].real +
+ check_su3_c.e[0][0].imag * check_su3_c.e[2][0].imag +
+ check_su3_c.e[0][1].real * check_su3_c.e[2][1].real +
+ check_su3_c.e[0][1].imag * check_su3_c.e[2][1].imag +
+ check_su3_c.e[0][2].real * check_su3_c.e[2][2].real +
+ check_su3_c.e[0][2].imag * check_su3_c.e[2][2].imag;
+ check_su3_ari = check_su3_ar;
+ if (check_su3_ari)
+ check_su3_max = check_su3_c.e[1][0].real * check_su3_c.e[2][0].real +
+ check_su3_c.e[1][0].imag * check_su3_c.e[2][0].imag +
+ check_su3_c.e[1][1].real * check_su3_c.e[2][1].real +
+ check_su3_c.e[1][1].imag * check_su3_c.e[2][1].imag +
+ check_su3_c.e[1][2].real * check_su3_c.e[2][2].real +
+ check_su3_c.e[1][2].imag * check_su3_c.e[2][2].imag;
+ if (check_su3_max)
+ arireturn();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c
new file mode 100644
index 0000000..d1c9c02
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-additional-options "-w -Wno-psabi" } */
+
+#include "tree-vect.h"
+
+typedef int v4si __attribute__((vector_size(16)));
+
+int a[4];
+int b[4];
+
+void __attribute__((noipa))
+foo (v4si x)
+{
+ b[0] = a[3] + x[0];
+ b[1] = a[2] + x[1];
+ b[2] = a[1] + x[2];
+ b[3] = a[0] + x[3];
+}
+
+int main()
+{
+ check_vect ();
+ for (int i = 0; i < 4; ++i)
+ a[i] = i;
+ v4si x = (v4si) { 8, 6, 4, 2 };
+ foo (x);
+ if (b[0] != 11 || b[1] != 8 || b[2] != 5 || b[3] != 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c
new file mode 100644
index 0000000..ac89883
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-additional-options "-O3 -w -Wno-psabi" } */
+
+#include "tree-vect.h"
+
+int res[6] = { 5, 7, 11, 3, 3, 3 };
+int a[6] = {5, 5, 8};
+int c;
+
+int main()
+{
+ check_vect ();
+ for (int b = 0; b <= 4; b++)
+ for (; c <= 4; c++) {
+ a[0] |= 1;
+ for (int e = 0; e <= 4; e++)
+ a[e + 1] |= 3;
+ }
+ for (int d = 0; d < 6; d++)
+ if (a[d] != res[d])
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr101756.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101756.c
new file mode 100644
index 0000000..de7f180
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101756.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* SIMD support can emit additional diagnostics. */
+/* { dg-additional-options "-w" } */
+
+__attribute__ ((simd)) int
+tq (long int ea, int of, int kk)
+{
+ int bc;
+
+ for (bc = 0; bc < 2; ++bc)
+ {
+ ++ea;
+ of |= !!kk < !!ea;
+ }
+
+ return of;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c
new file mode 100644
index 0000000..6b427aa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vect_float} */
+/* { dg-additional-options "-w -Wno-psabi -ffast-math" } */
+
+#include "tree-vect.h"
+
+typedef float v4sf __attribute__((vector_size(sizeof(float)*4)));
+
+float __attribute__((noipa))
+f(v4sf v)
+{
+ return v[0]+v[1]+v[2]+v[3];
+}
+
+float __attribute__((noipa))
+g(float *v)
+{
+ return v[0]+v[1]+v[2]+v[3];
+}
+
+float __attribute__((noipa))
+h(float *v)
+{
+ return 2*v[0]+3*v[1]+4*v[2]+5*v[3];
+}
+
+int
+main ()
+{
+ check_vect ();
+ v4sf v = (v4sf) { 1.f, 3.f, 4.f, 2.f };
+ if (f (v) != 10.f)
+ abort ();
+ if (g (&v[0]) != 10.f)
+ abort ();
+ if (h (&v[0]) != 37.f)
+ abort ();
+ return 0;
+}
+
+/* We are lacking an effective target for .REDUC_PLUS support. */
+/* { dg-final { scan-tree-dump-times "basic block part vectorized" 3 "slp2" { target x86_64-*-* } } } */
+/* { dg-final { scan-tree-dump-not " = VEC_PERM_EXPR" "slp2" { target x86_64-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c
index 246f38f..d9f173b 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c
@@ -25,6 +25,6 @@ main1 (void)
with no word loads (lw, lwu, lwz, lwzu, or their indexed forms)
or word stores (stw, stwu, stwx, stwux, or their indexed forms). */
-/* { dg-final { scan-assembler "\t(lvx|lxv|lvsr|stxv)" } } */
+/* { dg-final { scan-assembler "\t(lvx|lxv|lvsr|stxv|plxv|pstxv)" } } */
/* { dg-final { scan-assembler-not "\tlwz?u?x? " { xfail { powerpc-ibm-aix* } } } } */
/* { dg-final { scan-assembler-not "\tstwu?x? " } } */
diff --git a/gcc/testsuite/gcc.dg/gimplefe-40.c b/gcc/testsuite/gcc.dg/vect/gimplefe-40.c
index 3c5bb4c..3c5bb4c 100644
--- a/gcc/testsuite/gcc.dg/gimplefe-40.c
+++ b/gcc/testsuite/gcc.dg/vect/gimplefe-40.c
diff --git a/gcc/testsuite/gcc.dg/gimplefe-41.c b/gcc/testsuite/gcc.dg/vect/gimplefe-41.c
index e52a3a5..e52a3a5 100644
--- a/gcc/testsuite/gcc.dg/gimplefe-41.c
+++ b/gcc/testsuite/gcc.dg/vect/gimplefe-41.c
diff --git a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c
index 23a3b39..bcdf7f0 100644
--- a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c
+++ b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c
@@ -3,7 +3,9 @@
extern void accumulate (int x, int *a);
-int test_missing_function_defn (int *arr, int n) /* { dg-message "vectorized 0 loops in function" } */
+int test_missing_function_defn (int *arr, int n) /* { dg-note "5: vectorized 0 loops in function" } */
+/* { dg-prune-output "note: " } as we're not interested in matching any further
+ notes. */
{
int sum = 0;
for (int i = 0; i < n; ++i) /* { dg-missed "21: couldn't vectorize loop" } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145.c b/gcc/testsuite/gcc.dg/vect/pr101145.c
new file mode 100644
index 0000000..cd11c03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145.c
@@ -0,0 +1,187 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-O3" } */
+#include <limits.h>
+
+unsigned __attribute__ ((noinline))
+foo (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
+{
+ while (n < ++l)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+foo_1 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned)
+{
+ while (UINT_MAX - 64 < ++l)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+foo_2 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
+{
+ l = UINT_MAX - 32;
+ while (n < ++l)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+foo_3 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
+{
+ while (n <= ++l)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+foo_4 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
+{ // infininate
+ while (0 <= ++l)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+foo_5 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
+{
+ //no loop
+ l = UINT_MAX;
+ while (n < ++l)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+bar (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
+{
+ while (--l < n)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+bar_1 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned)
+{
+ while (--l < 64)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+unsigned __attribute__ ((noinline))
+bar_2 (int *__restrict__ a, int *__restrict__ b, unsigned l, unsigned n)
+{
+ l = 32;
+ while (--l < n)
+ *a++ = *b++ + 1;
+ return l;
+}
+
+
+int a[3200], b[3200];
+int fail;
+
+int
+main ()
+{
+ unsigned l, n;
+ unsigned res;
+ /* l > n*/
+ n = UINT_MAX - 64;
+ l = n + 32;
+ res = foo (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ l = n;
+ res = foo (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ l = n - 1;
+ res = foo (a, b, l, n);
+ if (res != l + 1)
+ fail++;
+
+ l = n - 32;
+ res = foo (a, b, l, n);
+ if (res != l + 1)
+ fail++;
+
+ l = UINT_MAX;
+ res = foo (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ l = n + 32;
+ res = foo_1 (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ l = n + 32;
+ res = foo_2 (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ l = n;
+ res = foo_3 (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ l = n - 1;
+ res = foo_3 (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ l = n - 2;
+ res = foo_3 (a, b, l, n);
+ if (res != l + 1)
+ fail++;
+
+ res = foo_5 (a, b, l, n);
+ if (res != 0)
+ fail++;
+
+ n = 64;
+ l = n - 32;
+ res = bar (a, b, l, n);
+ res++;
+ if (res != 0)
+ fail++;
+
+ l = n;
+ res = bar (a, b, l, n);
+ res++;
+ if (res != 0)
+ fail++;
+
+ l = n + 1;
+ res = bar (a, b, l, n);
+ res++;
+ if (res != l)
+ fail++;
+
+ l = 0;
+ res = bar (a, b, l, n);
+ res++;
+ if (res != l)
+ fail++;
+
+ l = 32;
+ res = bar_1 (a, b, l, n);
+ res++;
+ if (res != 0)
+ fail++;
+
+ res = bar_1 (a, b, l, n);
+ res++;
+ if (res != 0)
+ fail++;
+
+ if (fail)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 7 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145.inc b/gcc/testsuite/gcc.dg/vect/pr101145.inc
new file mode 100644
index 0000000..615d2e5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145.inc
@@ -0,0 +1,65 @@
+TYPE __attribute__ ((noinline))
+foo_sign (int *__restrict__ a, int *__restrict__ b, TYPE l, TYPE n)
+{
+ TYPE i;
+ for (i = l; n < i; i += C)
+ *a++ = *b++ + 1;
+ return i;
+}
+
+TYPE __attribute__ ((noinline))
+bar_sign (int *__restrict__ a, int *__restrict__ b, TYPE l, TYPE n)
+{
+ TYPE i;
+ for (i = l; i < n; i -= C)
+ *a++ = *b++ + 1;
+ return i;
+}
+
+int __attribute__ ((noinline)) neq (int a, int b) { return a != b; }
+
+int a[1000], b[1000];
+int fail;
+
+int
+main ()
+{
+ TYPE res;
+ TYPE l;
+ TYPE n;
+ n = N_BASE;
+ l = n - C;
+ res = foo_sign (a, b, l, n);
+ if (res != l)
+ fail++;
+
+ l = n;
+ res = foo_sign (a, b, l, n);
+ if (res != l)
+ fail++;
+
+ l = n + C;
+ res = foo_sign (a, b, l, n);
+ if (neq ((res - MIN) / C, 0))
+ fail++;
+
+ n = N_BASE_DOWN;
+ l = n - C;
+ res = bar_sign (a, b, l, n);
+ if (neq ((MAX - res) / C, 0))
+ fail++;
+
+ l = n;
+ res = bar_sign (a, b, l, n);
+ if (res != l)
+ fail++;
+
+ l = n + C;
+ res = bar_sign (a, b, l, n);
+ if (res != l)
+ fail++;
+
+ if (fail)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145_1.c b/gcc/testsuite/gcc.dg/vect/pr101145_1.c
new file mode 100644
index 0000000..9332b2c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145_1.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-O3" } */
+#define TYPE signed char
+#define MIN -128
+#define MAX 127
+#define N_BASE (MAX - 32)
+#define N_BASE_DOWN (MIN + 32)
+
+#define C 3
+
+#include "pr101145.inc"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145_2.c b/gcc/testsuite/gcc.dg/vect/pr101145_2.c
new file mode 100644
index 0000000..fa2c6be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145_2.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-O3" } */
+#define TYPE unsigned char
+#define MIN 0
+#define MAX 255
+#define N_BASE (MAX - 32 + 1)
+#define N_BASE_DOWN (MIN + 32)
+
+#define C 2
+
+#include "pr101145.inc"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145_3.c b/gcc/testsuite/gcc.dg/vect/pr101145_3.c
new file mode 100644
index 0000000..9f43c82
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145_3.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-O3" } */
+#define TYPE int *
+#define MIN ((TYPE)0)
+#define MAX ((TYPE)((long long)-1))
+#define N_BASE (MIN - 32)
+#define N_BASE_DOWN (MIN + 32)
+
+#define C 1
+
+#include "pr101145.inc"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145inf.c b/gcc/testsuite/gcc.dg/vect/pr101145inf.c
new file mode 100644
index 0000000..ed49f56
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145inf.c
@@ -0,0 +1,25 @@
+/* { dg-do run { target *-*-linux* *-*-gnu* *-*-uclinux* } } */
+/* { dg-options "-O3" } */
+#include <limits.h>
+#include "pr101145inf.inc"
+
+__attribute__ ((noinline))
+unsigned foo(unsigned val, unsigned start)
+{
+ unsigned cnt = 0;
+ for (unsigned i = start; val <= i; i+=16)
+ cnt++;
+ return cnt;
+}
+
+void test_finite ()
+{
+ unsigned n = foo (16, UINT_MAX - 32);
+ if (n != 3)
+ __builtin_abort ();
+}
+
+void test_infinite ()
+{
+ foo (15, UINT_MAX - 32);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145inf.inc b/gcc/testsuite/gcc.dg/vect/pr101145inf.inc
new file mode 100644
index 0000000..4aa3d04
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145inf.inc
@@ -0,0 +1,28 @@
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+
+void test_finite ();
+void test_infinite ();
+
+void do_exit (int i)
+{
+ exit (0);
+}
+
+int main(void)
+{
+ test_finite ();
+ struct sigaction s;
+ sigemptyset (&s.sa_mask);
+ s.sa_handler = do_exit;
+ s.sa_flags = 0;
+ sigaction (SIGALRM, &s, NULL);
+ alarm (1);
+
+ test_infinite ();
+
+ __builtin_abort ();
+ return 1;
+}
+
diff --git a/gcc/testsuite/gcc.dg/vect/pr101145inf_1.c b/gcc/testsuite/gcc.dg/vect/pr101145inf_1.c
new file mode 100644
index 0000000..4ee3e31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101145inf_1.c
@@ -0,0 +1,23 @@
+/* { dg-do run { target *-*-linux* *-*-gnu* *-*-uclinux* } } */
+/* { dg-options "-O3" } */
+#include <limits.h>
+#include "pr101145inf.inc"
+
+__attribute__ ((noinline))
+unsigned foo(unsigned val, unsigned start)
+{
+ unsigned cnt = 0;
+ for (unsigned i = start; i < val; i-=16)
+ cnt++;
+ return cnt;
+}
+
+void test_finite ()
+{
+ foo (UINT_MAX - 15, 32);
+}
+
+void test_infinite ()
+{
+ foo (UINT_MAX - 14, 32);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr101445.c b/gcc/testsuite/gcc.dg/vect/pr101445.c
new file mode 100644
index 0000000..f8a6e9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101445.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+int a[35] = { 1, 1, 3 };
+
+void __attribute__((noipa))
+foo ()
+{
+ for (int b = 4; b >= 0; b--)
+ {
+ int tem = a[b * 5 + 3 + 1];
+ a[b * 5 + 3] = tem;
+ a[b * 5 + 2] = tem;
+ a[b * 5 + 1] = tem;
+ a[b * 5 + 0] = tem;
+ }
+}
+
+int main()
+{
+ check_vect ();
+ foo ();
+ for (int d = 0; d < 25; d++)
+ if (a[d] != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr101505.c b/gcc/testsuite/gcc.dg/vect/pr101505.c
new file mode 100644
index 0000000..e2b8945
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101505.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O1" } */
+
+int n2;
+
+__attribute__ ((simd)) char
+w7 (void)
+{
+ short int xb = n2;
+ int qp;
+
+ for (qp = 0; qp < 2; ++qp)
+ xb = xb < 1;
+
+ return xb;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr102046.c b/gcc/testsuite/gcc.dg/vect/pr102046.c
new file mode 100644
index 0000000..ae48b49
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr102046.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3 -fvect-cost-model=dynamic" } */
+/* { dg-additional-options "-march=btver2" { target x86_64-*-* i?86-*-* } } */
+
+struct S
+{
+ unsigned a, b;
+};
+
+struct S g;
+
+void
+foo (struct S *o)
+{
+ struct S s = g;
+ s.b *= 3;
+ s.a -= s.a / 2;
+ *o = s;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr34195.c b/gcc/testsuite/gcc.dg/vect/pr34195.c
new file mode 100644
index 0000000..e36950b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr34195.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float } */
+
+#define M 11
+
+struct S
+{
+ float x;
+ float y;
+} pS[100];
+
+float a[1000];
+float b[1000];
+
+void
+foo (int n)
+{
+ int i, j;
+
+ for (i = 0; i < n; i++)
+ {
+ pS[i].x = 0;
+ pS[i].y = 0;
+
+ for (j = 0; j < M; j++)
+ {
+ pS[i].x += (a[i]+b[i]);
+ pS[i].y += (a[i]-b[i]);
+ }
+ }
+}
+
+/* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr56541.c b/gcc/testsuite/gcc.dg/vect/pr56541.c
index d5def68..fa86142 100644
--- a/gcc/testsuite/gcc.dg/vect/pr56541.c
+++ b/gcc/testsuite/gcc.dg/vect/pr56541.c
@@ -24,4 +24,4 @@ void foo()
}
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { ! vect_cond_mixed } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_floatint_cvt } xfail { ! vect_cond_mixed } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr65947-7.c b/gcc/testsuite/gcc.dg/vect/pr65947-7.c
index 287f57e..16cdcd1 100644
--- a/gcc/testsuite/gcc.dg/vect/pr65947-7.c
+++ b/gcc/testsuite/gcc.dg/vect/pr65947-7.c
@@ -9,7 +9,7 @@ extern void abort (void) __attribute__ ((noreturn));
/* Condition reduction with comparison is a different type to the data. Will
fail to vectorize. */
-int
+int __attribute__ ((noipa))
condition_reduction (short *a, int min_v, int *b)
{
int last = N + 65;
@@ -52,4 +52,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_fold_extract_last } } } */
+/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" { target { ! vect_fold_extract_last } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr71264.c b/gcc/testsuite/gcc.dg/vect/pr71264.c
index 5f6407a..1381e0e 100644
--- a/gcc/testsuite/gcc.dg/vect/pr71264.c
+++ b/gcc/testsuite/gcc.dg/vect/pr71264.c
@@ -19,5 +19,4 @@ void test(uint8_t *ptr, uint8_t *mask)
}
}
-/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { xfail sparc*-*-* } } } */
-
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { xfail { { s390*-*-* sparc*-*-* } || vect32 } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97769.c b/gcc/testsuite/gcc.dg/vect/pr97769.c
index 127f91a..59e0b46 100644
--- a/gcc/testsuite/gcc.dg/vect/pr97769.c
+++ b/gcc/testsuite/gcc.dg/vect/pr97769.c
@@ -25,7 +25,7 @@ fn2(tmp *p1)
{
char *d = (char *)p1->d1;
int *b = p1->h1;
- for (int a; a; a++, d += 4)
+ for (int a = 0; a; a++, d += 4)
fn1(d, *b++);
}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97832-1.c b/gcc/testsuite/gcc.dg/vect/pr97832-1.c
new file mode 100644
index 0000000..063fc7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97832-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+/* { dg-require-effective-target vect_double } */
+
+double a[1024], b[1024], c[1024];
+
+void foo()
+{
+ for (int i = 0; i < 256; ++i)
+ {
+ a[2*i] = a[2*i] + b[2*i] - c[2*i];
+ a[2*i+1] = a[2*i+1] - b[2*i+1] - c[2*i+1];
+ }
+}
+
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97832-2.c b/gcc/testsuite/gcc.dg/vect/pr97832-2.c
new file mode 100644
index 0000000..4f05781
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97832-2.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+/* { dg-require-effective-target vect_double } */
+
+void foo1x1(double* restrict y, const double* restrict x, int clen)
+{
+ int xi = clen & 2;
+ double f_re = x[0+xi+0];
+ double f_im = x[4+xi+0];
+ int clen2 = (clen+xi) * 2;
+#pragma GCC unroll 0
+ for (int c = 0; c < clen2; c += 8) {
+ // y[c] = y[c] - x[c]*conj(f);
+#pragma GCC unroll 4
+ for (int k = 0; k < 4; ++k) {
+ double x_re = x[c+0+k];
+ double x_im = x[c+4+k];
+ double y_re = y[c+0+k];
+ double y_im = y[c+4+k];
+ y_re = y_re - x_re * f_re - x_im * f_im;;
+ y_im = y_im + x_re * f_im - x_im * f_re;
+ y[c+0+k] = y_re;
+ y[c+4+k] = y_im;
+ }
+ }
+}
+
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97832-3.c b/gcc/testsuite/gcc.dg/vect/pr97832-3.c
new file mode 100644
index 0000000..ad1225d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97832-3.c
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+/* { dg-require-effective-target vect_double } */
+
+void foo(double* restrict y, const double* restrict x0, const double* restrict x1, int clen)
+{
+ int xi = clen & 2;
+ double f00_re = x0[0+xi+0];
+ double f10_re = x1[0+xi+0];
+ double f01_re = x0[0+xi+1];
+ double f11_re = x1[0+xi+1];
+ double f00_im = x0[4+xi+0];
+ double f10_im = x1[4+xi+0];
+ double f01_im = x0[4+xi+1];
+ double f11_im = x1[4+xi+1];
+ int clen2 = (clen+xi) * 2;
+ double* y0 = &y[0];
+ double* y1 = &y[clen2];
+ #pragma GCC unroll 0
+ for (int c = 0; c < clen2; c += 8) {
+ // y0[c] = y0[c] - x0[c]*conj(f00) - x1[c]*conj(f10);
+ // y1[c] = y1[c] - x0[c]*conj(f01) - x1[c]*conj(f11);
+ #pragma GCC unroll 4
+ for (int k = 0; k < 4; ++k) {
+ double x0_re = x0[c+0+k];
+ double x0_im = x0[c+4+k];
+ double y0_re = y0[c+0+k];
+ double y0_im = y0[c+4+k];
+ double y1_re = y1[c+0+k];
+ double y1_im = y1[c+4+k];
+ y0_re = y0_re - x0_re * f00_re - x0_im * f00_im;
+ y0_im = y0_im + x0_re * f00_im - x0_im * f00_re;
+ y1_re = y1_re - x0_re * f01_re - x0_im * f01_im;
+ y1_im = y1_im + x0_re * f01_im - x0_im * f01_re;
+ double x1_re = x1[c+0+k];
+ double x1_im = x1[c+4+k];
+ y0_re = y0_re - x1_re * f10_re - x1_im * f10_im;
+ y0_im = y0_im + x1_re * f10_im - x1_im * f10_re;
+ y1_re = y1_re - x1_re * f11_re - x1_im * f11_im;
+ y1_im = y1_im + x1_re * f11_im - x1_im * f11_re;
+ y0[c+0+k] = y0_re;
+ y0[c+4+k] = y0_im;
+ y1[c+0+k] = y1_re;
+ y1[c+4+k] = y1_im;
+ }
+ }
+}
+
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97832-4.c b/gcc/testsuite/gcc.dg/vect/pr97832-4.c
new file mode 100644
index 0000000..74ae27f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97832-4.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+/* { dg-require-effective-target vect_double } */
+
+void foo1x1(double* restrict y, const double* restrict x, int clen)
+{
+ int xi = clen & 2;
+ double f_re = x[0+xi+0];
+ double f_im = x[4+xi+0];
+ int clen2 = (clen+xi) * 2;
+#pragma GCC unroll 0
+ for (int c = 0; c < clen2; c += 8) {
+#pragma GCC unroll 4
+ for (int k = 0; k < 4; ++k) {
+ double x_re = x[k];
+ double x_im = x[c+4+k];
+ double y_re = y[c+0+k];
+ double y_im = y[c+4+k];
+ y_re = y_re - x_re * f_re - x_im * f_im;;
+ y_im = y_im + x_re * f_im - x_im * f_re;
+ y[c+0+k] = y_re;
+ y[c+4+k] = y_im;
+ }
+ }
+}
+
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr99102.c b/gcc/testsuite/gcc.dg/vect/pr99102.c
index 62d4d33..6c1a13f 100644
--- a/gcc/testsuite/gcc.dg/vect/pr99102.c
+++ b/gcc/testsuite/gcc.dg/vect/pr99102.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -ftree-vectorize" } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details" } */
/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */
long a[44];
short d, e = -7;
diff --git a/gcc/testsuite/gcc.dg/vect/pr99540.c b/gcc/testsuite/gcc.dg/vect/pr99540.c
new file mode 100644
index 0000000..9136b09
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr99540.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftrapv -ffloat-store -march=armv8.2-a+sve" { target aarch64*-*-* } } */
+
+float *MSalign2m2m_rec_initverticalw, *MSalign2m2m_rec_currentw;
+
+void
+match_ribosum (int MSalign2m2m_rec_i, int MSalign2m2m_rec_lgth1,
+ int MSalign2m2m_rec_lgth2)
+{
+ float **WMMTX;
+
+ while (MSalign2m2m_rec_i < 1)
+ WMMTX[MSalign2m2m_rec_i++][0] = MSalign2m2m_rec_initverticalw[0];
+
+ while (MSalign2m2m_rec_i < MSalign2m2m_rec_lgth1)
+ MSalign2m2m_rec_initverticalw[MSalign2m2m_rec_i++] += 0.1;
+
+ while (MSalign2m2m_rec_i < MSalign2m2m_rec_lgth2)
+ MSalign2m2m_rec_currentw[MSalign2m2m_rec_i++] += 0.1;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr99856.c b/gcc/testsuite/gcc.dg/vect/pr99856.c
new file mode 100644
index 0000000..e5d2a45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr99856.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_unpack } */
+/* { dg-require-effective-target vect_pack_trunc } */
+
+#define SHIFTFORDIV255(a)\
+ ((((a) >> 8) + a) >> 8)
+
+#define DIV255(a)\
+ SHIFTFORDIV255(a + 0x80)
+
+typedef unsigned char uint8_t;
+
+void
+opSourceOver_premul(uint8_t* restrict Rrgba,
+ const uint8_t* restrict Srgba,
+ const uint8_t* restrict Drgba, int len)
+{
+ Rrgba = __builtin_assume_aligned (Rrgba, __BIGGEST_ALIGNMENT__);
+ Srgba = __builtin_assume_aligned (Rrgba, __BIGGEST_ALIGNMENT__);
+ Drgba = __builtin_assume_aligned (Rrgba, __BIGGEST_ALIGNMENT__);
+ int i = 0;
+ for (; i < len*4; i += 4)
+ {
+ uint8_t Sa = Srgba[i + 3];
+ Rrgba[i + 0] = DIV255(Srgba[i + 0] * 255 + Drgba[i + 0] * (255 - Sa));
+ Rrgba[i + 1] = DIV255(Srgba[i + 1] * 255 + Drgba[i + 1] * (255 - Sa));
+ Rrgba[i + 2] = DIV255(Srgba[i + 2] * 255 + Drgba[i + 2] * (255 - Sa));
+ Rrgba[i + 3] = DIV255(Srgba[i + 3] * 255 + Drgba[i + 3] * (255 - Sa));
+ }
+}
+
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-21.c b/gcc/testsuite/gcc.dg/vect/slp-21.c
index bf8f434..4b83adb 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-21.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-21.c
@@ -210,7 +210,7 @@ int main (void)
Not all vect_perm targets support that, and it's a bit too specific to have
its own effective-target selector, so we just test targets directly. */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { aarch64*-*-* arm*-*-* powerpc64*-*-* } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_strided4 && { ! { aarch64*-*-* arm*-*-* powerpc64*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { powerpc64*-*-* s390*-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_strided4 && { ! { powerpc64*-*-* s390*-*-* } } } } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { ! { vect_strided4 } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-28.c b/gcc/testsuite/gcc.dg/vect/slp-28.c
index 7778bad..0bb5f0eb 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-28.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-28.c
@@ -88,6 +88,7 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! vect32 } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target vect32 } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! vect32 } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-3.c b/gcc/testsuite/gcc.dg/vect/slp-3.c
index 46ab584..80ded18 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-3.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-3.c
@@ -141,8 +141,8 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! vect_partial_vectors } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_partial_vectors } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target { ! vect_partial_vectors } } } }*/
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target vect_partial_vectors } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! { vect_partial_vectors || vect32 } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target { vect_partial_vectors || vect32 } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target { ! { vect_partial_vectors || vect32 } } } } }*/
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { vect_partial_vectors || vect32 } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-50.c b/gcc/testsuite/gcc.dg/vect/slp-50.c
new file mode 100644
index 0000000..17509e6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-50.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math" } */
+
+typedef int Quantum;
+typedef struct {
+ Quantum blue, green;
+} PixelPacket;
+PixelPacket *EnhanceImage_image_q;
+int EnhanceImage_image_x;
+float EnhanceImage_image_distance_squared_total_weight;
+void EnhanceImage_image_distance_squared()
+{
+ float zero_1;
+ for (; EnhanceImage_image_x; EnhanceImage_image_x++) {
+ EnhanceImage_image_distance_squared_total_weight += 5.0;
+ EnhanceImage_image_q->green = EnhanceImage_image_q->blue =
+ zero_1 + EnhanceImage_image_distance_squared_total_weight / 2 - 1;
+ EnhanceImage_image_q++;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c
index ab75f44..873eddf 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c
@@ -57,13 +57,13 @@ int main (int argc, const char* argv[])
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { target { ! { vect_perm_short || vect_load_lanes } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_short || vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { target { ! { { vect_perm_short || vect32 } || vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { { vect_perm_short || vect32 } || vect_load_lanes } } } } */
/* We don't try permutes with a group size of 3 for variable-length
vectors. */
/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { { ! vect_perm3_short } && { ! vect_partial_vectors_usage_1 } } } xfail vect_variable_length } } } */
/* Try to vectorize the epilogue using partial vectors. */
/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 2 "vect" { target { vect_perm_short && { { ! vect_perm3_short } && vect_partial_vectors_usage_1 } } xfail vect_variable_length } } } */
/* { dg-final { scan-tree-dump-not "permutation requires at least three vectors" "vect" { target vect_perm3_short } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { { ! vect_perm3_short } || vect_load_lanes } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_short && { ! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { { ! { vect_perm3_short || vect32 } } || vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { { vect_perm3_short || vect32 } && { ! vect_load_lanes } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c
index a2f86fb..260d65c 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c
@@ -16,5 +16,5 @@ double dotprod(const double *a, const double *b, unsigned long long n)
/* We should use a SLP reduction even without -ffast-math by using a
VF of one. */
-/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" { xfail vect_variable_length } } } */
/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c b/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c
index 35d2a3c..c97da52 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c
@@ -253,4 +253,4 @@ main (int argc, char **argv)
check (res, ne);
}
-/* { dg-final { scan-tree-dump-times "VECTORIZED" 18 "vect" { target sse4_runtime } } } */
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 18 "vect" { target sse4_runtime } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
index 81fdb67c..addcf60 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
@@ -40,4 +40,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { xfail { ! vect_hw_misalign } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { ! vect_load_lanes } xfail { ! vect_hw_misalign } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-3.c b/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-3.c
index dbf5091..1666526 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-3.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-fdump-tree-cunroll-details" } */
+/* { dg-additional-options "-fdump-tree-cunroll-details --param vect-epilogues-nomask=0" } */
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-10.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-10.c
new file mode 100644
index 0000000..7ce8696
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-10.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 unsigned
+#define SIGNEDNESS_3 unsigned
+#define SIGNEDNESS_4 signed
+
+#include "vect-reduc-dot-9.c"
+
+/* { dg-final { scan-tree-dump-not "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-11.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-11.c
new file mode 100644
index 0000000..0f7cbbb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-11.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 unsigned
+#define SIGNEDNESS_4 signed
+
+#include "vect-reduc-dot-9.c"
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-12.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-12.c
new file mode 100644
index 0000000..0841261
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-12.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+
+#include "vect-reduc-dot-9.c"
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-13.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-13.c
new file mode 100644
index 0000000..7ee0f45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-13.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define SIGNEDNESS_1 signed
+#define SIGNEDNESS_2 unsigned
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+
+#include "vect-reduc-dot-9.c"
+
+/* { dg-final { scan-tree-dump-not "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-14.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-14.c
new file mode 100644
index 0000000..2de1434
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-14.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define SIGNEDNESS_1 signed
+#define SIGNEDNESS_2 unsigned
+#define SIGNEDNESS_3 unsigned
+#define SIGNEDNESS_4 signed
+
+#include "vect-reduc-dot-9.c"
+
+/* { dg-final { scan-tree-dump-not "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-15.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-15.c
new file mode 100644
index 0000000..dc48f95
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-15.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define SIGNEDNESS_1 signed
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 unsigned
+#define SIGNEDNESS_4 signed
+
+#include "vect-reduc-dot-9.c"
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-16.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-16.c
new file mode 100644
index 0000000..aec6287
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-16.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define SIGNEDNESS_1 signed
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+
+#include "vect-reduc-dot-9.c"
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-17.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-17.c
new file mode 100644
index 0000000..38f86fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-17.c
@@ -0,0 +1,53 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#include "tree-vect.h"
+
+#define N 50
+
+#ifndef SIGNEDNESS_1
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 unsigned
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+#endif
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+f (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 char *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 int mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+#define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
+#define OFFSET 20
+
+int
+main (void)
+{
+ check_vect ();
+
+ SIGNEDNESS_3 char a[N];
+ SIGNEDNESS_4 char b[N];
+ SIGNEDNESS_1 int expected = 0x12345;
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = BASE + i * 5;
+ b[i] = BASE + OFFSET + i * 4;
+ asm volatile ("" ::: "memory");
+ expected += (SIGNEDNESS_2 int) (a[i] * b[i]);
+ }
+ if (f (0x12345, a, b) != expected)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-18.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-18.c
new file mode 100644
index 0000000..2e86ebe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-18.c
@@ -0,0 +1,53 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#include "tree-vect.h"
+
+#define N 50
+
+#ifndef SIGNEDNESS_1
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+#endif
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+f (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 char *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 int mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+#define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
+#define OFFSET 20
+
+int
+main (void)
+{
+ check_vect ();
+
+ SIGNEDNESS_3 char a[N];
+ SIGNEDNESS_4 char b[N];
+ SIGNEDNESS_1 int expected = 0x12345;
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = BASE + i * 5;
+ b[i] = BASE + OFFSET + i * 4;
+ asm volatile ("" ::: "memory");
+ expected += (SIGNEDNESS_2 int) (a[i] * b[i]);
+ }
+ if (f (0x12345, a, b) != expected)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-19.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-19.c
new file mode 100644
index 0000000..d00f24a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-19.c
@@ -0,0 +1,52 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#include "tree-vect.h"
+
+#define N 50
+
+#ifndef SIGNEDNESS_1
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+#endif
+
+SIGNEDNESS_1 long long __attribute__ ((noipa))
+f (SIGNEDNESS_1 long long res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 short *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 long long mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+#define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
+#define OFFSET 20
+
+int
+main (void)
+{
+ check_vect ();
+
+ SIGNEDNESS_3 char a[N];
+ SIGNEDNESS_4 short b[N];
+ SIGNEDNESS_1 long long expected = 0x12345;
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = BASE + i * 5;
+ b[i] = BASE + OFFSET + i * 4;
+ asm volatile ("" ::: "memory");
+ expected += (SIGNEDNESS_2 int) (a[i] * b[i]);
+ }
+ if (f (0x12345, a, b) != expected)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-20.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-20.c
new file mode 100644
index 0000000..17adbca8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-20.c
@@ -0,0 +1,52 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#include "tree-vect.h"
+
+#define N 50
+
+#ifndef SIGNEDNESS_1
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+#endif
+
+SIGNEDNESS_1 long long __attribute__ ((noipa))
+f (SIGNEDNESS_1 long long res, SIGNEDNESS_3 short *restrict a,
+ SIGNEDNESS_4 char *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 long long mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+#define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
+#define OFFSET 20
+
+int
+main (void)
+{
+ check_vect ();
+
+ SIGNEDNESS_3 short a[N];
+ SIGNEDNESS_4 char b[N];
+ SIGNEDNESS_1 long long expected = 0x12345;
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = BASE + i * 5;
+ b[i] = BASE + OFFSET + i * 4;
+ asm volatile ("" ::: "memory");
+ expected += (SIGNEDNESS_2 int) (a[i] * b[i]);
+ }
+ if (f (0x12345, a, b) != expected)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-21.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-21.c
new file mode 100644
index 0000000..6cc6a4f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-21.c
@@ -0,0 +1,52 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#include "tree-vect.h"
+
+#define N 50
+
+#ifndef SIGNEDNESS_1
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+#endif
+
+SIGNEDNESS_1 long long __attribute__ ((noipa))
+f (SIGNEDNESS_1 long long res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 short *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 int mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+#define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
+#define OFFSET 20
+
+int
+main (void)
+{
+ check_vect ();
+
+ SIGNEDNESS_3 char a[N];
+ SIGNEDNESS_4 short b[N];
+ SIGNEDNESS_1 long long expected = 0x12345;
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = BASE + i * 5;
+ b[i] = BASE + OFFSET + i * 4;
+ asm volatile ("" ::: "memory");
+ expected += (SIGNEDNESS_2 int) (a[i] * b[i]);
+ }
+ if (f (0x12345, a, b) != expected)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-22.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-22.c
new file mode 100644
index 0000000..e13d3d5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-22.c
@@ -0,0 +1,52 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#include "tree-vect.h"
+
+#define N 50
+
+#ifndef SIGNEDNESS_1
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 unsigned
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+#endif
+
+SIGNEDNESS_1 long long __attribute__ ((noipa))
+f (SIGNEDNESS_1 long long res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 short *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 int mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+#define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
+#define OFFSET 20
+
+int
+main (void)
+{
+ check_vect ();
+
+ SIGNEDNESS_3 char a[N];
+ SIGNEDNESS_4 short b[N];
+ SIGNEDNESS_1 long long expected = 0x12345;
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = BASE + i * 5;
+ b[i] = BASE + OFFSET + i * 4;
+ asm volatile ("" ::: "memory");
+ expected += (SIGNEDNESS_2 int) (a[i] * b[i]);
+ }
+ if (f (0x12345, a, b) != expected)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-not "vect_recog_dot_prod_pattern: detected" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-9.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-9.c
new file mode 100644
index 0000000..d1049c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-9.c
@@ -0,0 +1,53 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#include "tree-vect.h"
+
+#define N 50
+
+#ifndef SIGNEDNESS_1
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 unsigned
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+#endif
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+f (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 char *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 short mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+#define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
+#define OFFSET 20
+
+int
+main (void)
+{
+ check_vect ();
+
+ SIGNEDNESS_3 char a[N];
+ SIGNEDNESS_4 char b[N];
+ SIGNEDNESS_1 int expected = 0x12345;
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = BASE + i * 5;
+ b[i] = BASE + OFFSET + i * 4;
+ asm volatile ("" ::: "memory");
+ expected += (SIGNEDNESS_2 short) (a[i] * b[i]);
+ }
+ if (f (0x12345, a, b) != expected)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-not "vect_recog_dot_prod_pattern: detected" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_usdot_qi } } } */
diff --git a/gcc/testsuite/gcc.dg/vla-stexp-1.c b/gcc/testsuite/gcc.dg/vla-stexp-1.c
new file mode 100644
index 0000000..97d6693
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vla-stexp-1.c
@@ -0,0 +1,18 @@
+/* PR29970*/
+/* { dg-do run } */
+/* { dg-options "-Wall -O0" } */
+
+int foo(void)
+{
+ int n = 0;
+ return sizeof(*({ n = 10; struct foo { int x[n]; } x; &x; }));
+}
+
+
+int main()
+{
+ if (sizeof(struct foo { int x[10]; }) != foo())
+ __builtin_abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vla-stexp-2.c b/gcc/testsuite/gcc.dg/vla-stexp-2.c
new file mode 100644
index 0000000..176f400
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vla-stexp-2.c
@@ -0,0 +1,33 @@
+/* PR101838 */
+/* { dg-do run } */
+/* { dg-options "-Wpedantic -O0" } */
+
+
+int bar0(
+ int (*a)[*],
+ int (*b)[sizeof(*a)]
+);
+
+
+int bar(
+ struct f { /* { dg-warning "will not be visible outside of this definition" } */
+ int a[*]; } v, /* { dg-warning "variably modified type" } */
+ int (*b)[sizeof(struct f)] // should not warn about zero size
+);
+
+int foo(void)
+{
+ int n = 0;
+ return sizeof(typeof(*({ n = 10; struct foo { /* { dg-warning "braced-groups" } */
+ int x[n]; /* { dg-warning "variably modified type" } */
+ } x; &x; })));
+}
+
+
+int main()
+{
+ if (sizeof(struct foo { int x[10]; }) != foo())
+ __builtin_abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c b/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c
index 2afd2b5..846e930 100644
--- a/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c
+++ b/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c
@@ -143,14 +143,17 @@ T (v0 ? b[1] : "", bsz);
T (v0 ? b[2] : "", bsz);
T (v0 ? b[3] : "", bsz);
-T (v0 ? "" : b[0], bsz + 1); /* { dg-warning "bound 6 may exceed source size 5" } */
-T (v0 ? "" : b[1], bsz + 1);
-T (v0 ? "" : b[2], bsz + 1);
-T (v0 ? "" : b[3], bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
-T (v0 ? b[0] : "", bsz + 1); /* { dg-warning "bound 6 may exceed source size 5" } */
-T (v0 ? b[1] : "", bsz + 1);
-T (v0 ? b[2] : "", bsz + 1);
-T (v0 ? b[3] : "", bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
+/* The warnings below are strictly correct but the strnlen calls are safe
+ because the reads are bounded by the length of the constant arguments.
+ It might make sense to relax the warning to avoid triggering for them. */
+T (v0 ? "" : b[0], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? "" : b[1], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? "" : b[2], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? "" : b[3], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[0] : "", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[1] : "", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[2] : "", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[3] : "", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
T (v0 ? "" : b[i0], bsz);
T (v0 ? "" : b[i1], bsz);
@@ -164,11 +167,11 @@ T (v0 ? b[i3] : "", bsz);
T (v0 ? "" : b[i0], bsz + 1);
T (v0 ? "" : b[i1], bsz + 1);
T (v0 ? "" : b[i2], bsz + 1);
-T (v0 ? "" : b[i3], bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
+T (v0 ? "" : b[i3], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" "pr86937" } */
T (v0 ? b[i0] : "", bsz + 1);
T (v0 ? b[i1] : "", bsz + 1);
T (v0 ? b[i2] : "", bsz + 1);
-T (v0 ? b[i3] : "", bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
+T (v0 ? b[i3] : "", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" "pr86937" } */
T (v0 ? "1234" : b[3], bsz);
T (v0 ? "1234" : b[i3], bsz);
@@ -180,15 +183,15 @@ T (v0 ? b[0] : b[2], bsz);
T (v0 ? b[2] : b[3], bsz);
T (v0 ? b[3] : b[2], bsz);
-T (v0 ? "1234" : b[3], bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
-T (v0 ? "1234" : b[i3], bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
-T (v0 ? b[3] : "1234", bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
-T (v0 ? b[i3] : "1234", bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
+T (v0 ? "1234" : b[3], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? "1234" : b[i3], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[3] : "1234", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[i3] : "1234", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
-T (v0 ? a : b[3], bsz + 1); /* { dg-warning "bound 6 may exceed source size 5" "pr86937" { xfail *-*-*} } */
-T (v0 ? b[0] : b[2], bsz + 1); /* { dg-warning "bound 6 may exceed source size 5" "pr86937" } */
-T (v0 ? b[2] : b[3], bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
-T (v0 ? b[3] : b[2], bsz + 1); /* { dg-warning "unterminated" "pr86937" { xfail *-*-* } } */
+T (v0 ? a : b[3], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[0] : b[2], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[2] : b[3], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
+T (v0 ? b[3] : b[2], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */
struct A { char a[5], b[5]; };
diff --git a/gcc/testsuite/gcc.misc-tests/linkage.exp b/gcc/testsuite/gcc.misc-tests/linkage.exp
index afed2b8..2cb109e 100644
--- a/gcc/testsuite/gcc.misc-tests/linkage.exp
+++ b/gcc/testsuite/gcc.misc-tests/linkage.exp
@@ -38,6 +38,18 @@ if { [isnative] && ![is_remote host] } then {
# Need to ensure ABI for native compiler matches gcc
set native_cflags ""
+ if [istarget "mips*-linux*"] {
+ set file_string [exec file "linkage-x.o"]
+ if [ string match "*64*" $file_string ] {
+ set native_cflags "-mabi=64"
+ }
+ if [ string match "*ELF 32*" $file_string ] {
+ set native_cflags "-mabi=32"
+ }
+ if [ string match "*N32*" $file_string ] {
+ set native_cflags "-mabi=n32"
+ }
+ }
if [istarget "sparc*-sun-solaris2*"] {
set file_string [exec file "linkage-x.o"]
if [ string match "*64*" $file_string ] {
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c
index bd9bb11..cd27098 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target stdint_types_mbig_endian } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
/* { dg-additional-options "-mbig-endian -save-temps" } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c
index 58bdee5..ae0a953 100755
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target stdint_types_mbig_endian } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
/* { dg-additional-options "-mbig-endian --save-temps" } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c
new file mode 100644
index 0000000..31e51b0d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c
@@ -0,0 +1,129 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c99" } */
+
+#include <arm_neon.h>
+
+typedef __typeof(((int32x4_t *) 0)[0][0]) int32_elt;
+typedef __typeof(((uint32x4_t *) 0)[0][0]) uint32_elt;
+
+typedef int32_elt gnu_int32x4_t __attribute__((vector_size(16)));
+typedef uint32_elt gnu_uint32x4_t __attribute__((vector_size(16)));
+
+#define X_gnu_int32x4_t 1
+#define X_gnu_uint32x4_t 2
+#define X_int32x4_t 3
+#define X_uint32x4_t 4
+
+#define CHECK(T) T: X_##T
+
+#define CHECK_TYPE(EXPR, TYPE) \
+ do { \
+ int x[_Generic (EXPR, \
+ CHECK (gnu_int32x4_t), \
+ CHECK (gnu_uint32x4_t), \
+ CHECK (int32x4_t), \
+ CHECK (uint32x4_t), \
+ default : 0) == X_##TYPE ? 1 : -1]; \
+ } while (0)
+
+void
+f (gnu_int32x4_t sg, gnu_uint32x4_t ug, int32x4_t sn, uint32x4_t un, int c)
+{
+ CHECK_TYPE (sg, gnu_int32x4_t);
+ CHECK_TYPE (ug, gnu_uint32x4_t);
+ CHECK_TYPE (sn, int32x4_t);
+ CHECK_TYPE (un, uint32x4_t);
+
+ CHECK_TYPE (sg + 1, gnu_int32x4_t);
+ CHECK_TYPE (ug + 1, gnu_uint32x4_t);
+ CHECK_TYPE (sn + 1, int32x4_t);
+ CHECK_TYPE (un + 1, uint32x4_t);
+
+ CHECK_TYPE (1 + sg, gnu_int32x4_t);
+ CHECK_TYPE (1 + ug, gnu_uint32x4_t);
+ CHECK_TYPE (1 + sn, int32x4_t);
+ CHECK_TYPE (1 + un, uint32x4_t);
+
+ CHECK_TYPE (sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (sn + sn, int32x4_t);
+ CHECK_TYPE (un + un, uint32x4_t);
+
+ /* Traditional behavior for mixed signs is to pick the signedness of the
+ first operand. We don't have any Arm-specific reason for preferring that
+ behavior, but including the tests helps to demonstrate the points in the
+ comments below. */
+ CHECK_TYPE (sg + ug, gnu_int32x4_t);
+ CHECK_TYPE (ug + sg, gnu_uint32x4_t);
+ CHECK_TYPE (sn + un, int32x4_t);
+ CHECK_TYPE (un + sn, uint32x4_t);
+
+ /* Nothing specifies the type of mixed GNU and arm_neon.h operations, but:
+
+ - it would be surprising if sg + un had a different signedness from
+ sg + ug
+
+ - it would also be mildly surprising if sg + un had a different type from
+ both of its operands
+
+ So in cases where the operands differ in both signedness and ABI, it seems
+ more consistent to ignore the ABI difference and apply the usual rules for
+ differences in sign. */
+ CHECK_TYPE (sg + un, gnu_int32x4_t);
+ CHECK_TYPE (ug + sn, gnu_uint32x4_t);
+ CHECK_TYPE (sn + ug, int32x4_t);
+ CHECK_TYPE (un + sg, uint32x4_t);
+
+ /* And if the first vector wins when operands differ in both signedness
+ and ABI, it seems more consistent to do the same if the operands differ
+ only in ABI. */
+ CHECK_TYPE (sg + sn, gnu_int32x4_t);
+ CHECK_TYPE (ug + un, gnu_uint32x4_t);
+ CHECK_TYPE (sn + sg, int32x4_t);
+ CHECK_TYPE (un + ug, uint32x4_t);
+
+ CHECK_TYPE (c ? sg + sg : sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + ug : ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + sn : sn, int32x4_t);
+ CHECK_TYPE (c ? un + un : un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg + 1 : sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + 1 : ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + 1 : sn, int32x4_t);
+ CHECK_TYPE (c ? un + 1 : un, uint32x4_t);
+
+ CHECK_TYPE (c ? 1 + sg : sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? 1 + ug : ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? 1 + sn : sn, int32x4_t);
+ CHECK_TYPE (c ? 1 + un : un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg : sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug : ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn : sn + sn, int32x4_t);
+ CHECK_TYPE (c ? un : un + un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg : sg + 1, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug : ug + 1, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn : sn + 1, int32x4_t);
+ CHECK_TYPE (c ? un : un + 1, uint32x4_t);
+
+ CHECK_TYPE (c ? sg : 1 + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug : 1 + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn : 1 + sn, int32x4_t);
+ CHECK_TYPE (c ? un : 1 + un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg + sg : sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + ug : ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + sn : sn + sn, int32x4_t);
+ CHECK_TYPE (c ? un + un : un + un, uint32x4_t);
+
+ CHECK_TYPE (c ? sg + sg : sg + 1, gnu_int32x4_t);
+ CHECK_TYPE (c ? ug + ug : ug + 1, gnu_uint32x4_t);
+ CHECK_TYPE (c ? sn + sn : sn + 1, int32x4_t);
+ CHECK_TYPE (c ? un + un : un + 1, uint32x4_t);
+
+ CHECK_TYPE (c ? 1 + sg : sg + sg, gnu_int32x4_t);
+ CHECK_TYPE (c ? 1 + ug : ug + ug, gnu_uint32x4_t);
+ CHECK_TYPE (c ? 1 + sn : sn + sn, int32x4_t);
+ CHECK_TYPE (c ? 1 + un : un + un, uint32x4_t);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c
index 96bca23..61c7c51 100755
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target stdint_types_mbig_endian } */
/* { dg-require-effective-target arm_v8_2a_i8mm_ok } */
/* { dg-add-options arm_v8_2a_i8mm } */
/* { dg-additional-options "-mbig-endian -save-temps" } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c
new file mode 100644
index 0000000..18d1767
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c
@@ -0,0 +1,67 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { arm*-*-* } } */
+/* { dg-options "-O3" } */
+
+
+#include <arm_neon.h>
+
+float32x2_t foo_f32 (float32x2_t a, float32x2_t b, float32x2_t c)
+{
+ return vmla_f32 (a, b, c);
+}
+
+float32x4_t fooq_f32 (float32x4_t a, float32x4_t b, float32x4_t c)
+{
+ return vmlaq_f32 (a, b, c);
+}
+
+float32x2_t foo_n_f32 (float32x2_t a, float32x2_t b, float32_t c)
+{
+ return vmla_n_f32 (a, b, c);
+}
+
+float32x4_t fooq_n_f32 (float32x4_t a, float32x4_t b, float32_t c)
+{
+ return vmlaq_n_f32 (a, b, c);
+}
+
+float32x2_t foo_lane_f32 (float32x2_t a,
+ float32x2_t b,
+ float32x2_t v)
+{
+ return vmla_lane_f32 (a, b, v, 0);
+}
+
+float32x4_t fooq_lane_f32 (float32x4_t a,
+ float32x4_t b,
+ float32x2_t v)
+{
+ return vmlaq_lane_f32 (a, b, v, 0);
+}
+
+float32x2_t foo_laneq_f32 (float32x2_t a,
+ float32x2_t b,
+ float32x4_t v)
+{
+ return vmla_laneq_f32 (a, b, v, 0);
+}
+
+float32x4_t fooq_laneq_f32 (float32x4_t a,
+ float32x4_t b,
+ float32x4_t v)
+{
+ return vmlaq_laneq_f32 (a, b, v, 0);
+}
+
+float64x1_t foo_f64 (float64x1_t a, float64x1_t b, float64x1_t c)
+{
+ return vmla_f64 (a, b, c);
+}
+
+float64x2_t fooq_f64 (float64x2_t a, float64x2_t b, float64x2_t c)
+{
+ return vmlaq_f64 (a, b, c);
+}
+
+/* { dg-final { scan-assembler-times {\tfmul\t} 10} } */
+/* { dg-final { scan-assembler-times {\tfadd\t} 10} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c
new file mode 100644
index 0000000..6c51d04
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c
@@ -0,0 +1,67 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { arm*-*-* } } */
+/* { dg-options "-O3" } */
+
+
+#include <arm_neon.h>
+
+float32x2_t foo_f32 (float32x2_t a, float32x2_t b, float32x2_t c)
+{
+ return vmls_f32 (a, b, c);
+}
+
+float32x4_t fooq_f32 (float32x4_t a, float32x4_t b, float32x4_t c)
+{
+ return vmlsq_f32 (a, b, c);
+}
+
+float32x2_t foo_n_f32 (float32x2_t a, float32x2_t b, float32_t c)
+{
+ return vmls_n_f32 (a, b, c);
+}
+
+float32x4_t fooq_n_f32 (float32x4_t a, float32x4_t b, float32_t c)
+{
+ return vmlsq_n_f32 (a, b, c);
+}
+
+float32x2_t foo_lane_f32 (float32x2_t a,
+ float32x2_t b,
+ float32x2_t v)
+{
+ return vmls_lane_f32 (a, b, v, 0);
+}
+
+float32x4_t fooq_lane_f32 (float32x4_t a,
+ float32x4_t b,
+ float32x2_t v)
+{
+ return vmlsq_lane_f32 (a, b, v, 0);
+}
+
+float32x2_t foo_laneq_f32 (float32x2_t a,
+ float32x2_t b,
+ float32x4_t v)
+{
+ return vmls_laneq_f32 (a, b, v, 0);
+}
+
+float32x4_t fooq_laneq_f32 (float32x4_t a,
+ float32x4_t b,
+ float32x4_t v)
+{
+ return vmlsq_laneq_f32 (a, b, v, 0);
+}
+
+float64x1_t foo_f64 (float64x1_t a, float64x1_t b, float64x1_t c)
+{
+ return vmls_f64 (a, b, c);
+}
+
+float64x2_t fooq_f64 (float64x2_t a, float64x2_t b, float64x2_t c)
+{
+ return vmlsq_f64 (a, b, c);
+}
+
+/* { dg-final { scan-assembler-times {\tfmul\t} 10} } */
+/* { dg-final { scan-assembler-times {\tfsub\t} 10} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c b/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c
index 513721c..8ee7d11 100644
--- a/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c
+++ b/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c
@@ -3,6 +3,8 @@
/* { dg-require-effective-target vect_float } */
/* { dg-options "-Ofast" } */
+#pragma GCC target "+nosve"
+
#include <arm_neon.h>
void s_mult_i (int32_t* restrict res, int32_t* restrict a, int32_t b)
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-1.c b/gcc/testsuite/gcc.target/aarch64/auto-init-1.c
new file mode 100644
index 0000000..0fa4708
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-1.c
@@ -0,0 +1,32 @@
+/* Verify zero initialization for integer and pointer type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+enum E {
+ N1 = 0,
+ N2,
+ N3
+};
+
+extern void bar (char, short, int, enum E, long, long long, int *, bool);
+
+void foo()
+{
+ char temp1;
+ short temp2;
+ int temp3;
+ enum E temp4;
+ long temp5;
+ long long temp6;
+ int *temp7;
+ bool temp8;
+
+ bar (temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8);
+ return;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_int 0" 11 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-2.c b/gcc/testsuite/gcc.target/aarch64/auto-init-2.c
new file mode 100644
index 0000000..2c54e6d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-2.c
@@ -0,0 +1,35 @@
+/* Verify pattern initialization for integer and pointer type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-O -ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+enum E {
+ N1 = 0,
+ N2,
+ N3
+};
+
+extern void bar (char, short, int, enum E, long, long long, int *, bool);
+
+void foo()
+{
+ char temp1;
+ short temp2;
+ int temp3;
+ enum E temp4;
+ long temp5;
+ long long temp6;
+ int *temp7;
+ bool temp8;
+
+ bar (temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8);
+ return;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfe\\\]" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffefe" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 2 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfefefefefefefefe" 2 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-3.c b/gcc/testsuite/gcc.target/aarch64/auto-init-3.c
new file mode 100644
index 0000000..7008f76
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-3.c
@@ -0,0 +1,19 @@
+/* Verify zero initialization for floating point type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+long double result;
+
+long double foo()
+{
+ float temp1;
+ double temp2;
+ long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_double\:SF 0\.0" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "const_double\:DF 0\.0" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "const_double\:TF 0\.0" 1 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-4.c b/gcc/testsuite/gcc.target/aarch64/auto-init-4.c
new file mode 100644
index 0000000..1019704
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-4.c
@@ -0,0 +1,19 @@
+/* Verify pattern initialization for floating point type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-O -ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+long double result;
+
+long double foo()
+{
+ float temp1;
+ double temp2;
+ long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump "\\-0x0\\.fefefep\\+127" "expand" } } */
+/* { dg-final { scan-rtl-dump "\\-0x0\\.f7f7f7f7f7f7fp\\+1009" "expand" } } */
+/* { dg-final { scan-rtl-dump "\\-0x0\\.ff7f7f7f7f7f7f7f7f7f7f7f7f7fp\\+16128" "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-5.c b/gcc/testsuite/gcc.target/aarch64/auto-init-5.c
new file mode 100644
index 0000000..ac69ac3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-5.c
@@ -0,0 +1,19 @@
+/* Verify zero initialization for complex type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+
+_Complex long double result;
+
+_Complex long double foo()
+{
+ _Complex float temp1;
+ _Complex double temp2;
+ _Complex long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-assembler-times "\.word\t0" 14 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-6.c b/gcc/testsuite/gcc.target/aarch64/auto-init-6.c
new file mode 100644
index 0000000..27c16b3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-6.c
@@ -0,0 +1,18 @@
+/* Verify pattern initialization for complex type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+
+_Complex long double result;
+
+_Complex long double foo()
+{
+ _Complex float temp1;
+ _Complex double temp2;
+ _Complex long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 3 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-7.c b/gcc/testsuite/gcc.target/aarch64/auto-init-7.c
new file mode 100644
index 0000000..ac27fbe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-7.c
@@ -0,0 +1,32 @@
+/* Verify zero initialization for array, union, and structure type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+struct S
+{
+ int f1;
+ float f2;
+ char f3[20];
+};
+
+union U
+{
+ char u1[5];
+ int u2;
+ float u3;
+};
+
+double result;
+
+double foo()
+{
+ int temp1[3];
+ double temp2[3];
+ struct S temp3;
+ union U temp4;
+
+ result = temp1[2] + temp2[1] + temp3.f2 + temp4.u3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_int 0" 8 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-8.c b/gcc/testsuite/gcc.target/aarch64/auto-init-8.c
new file mode 100644
index 0000000..3943f5a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-8.c
@@ -0,0 +1,32 @@
+/* Verify pattern initialization for array, union, and structure type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct S
+{
+ int f1;
+ float f2;
+ char f3[20];
+};
+
+union U
+{
+ char u1[5];
+ int u2;
+ float u3;
+};
+
+double result;
+
+double foo()
+{
+ int temp1[3];
+ double temp2[3];
+ struct S temp3;
+ union U temp4;
+
+ result = temp1[2] + temp2[1] + temp3.f2 + temp4.u3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 4 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
new file mode 100644
index 0000000..d3a88c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
@@ -0,0 +1,17 @@
+/* Verify zero initialization for structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_aligned {
+ int internal1;
+ long long internal2;
+} __attribute__ ((aligned(64)));
+
+int foo ()
+{
+ struct test_aligned var;
+ return var.internal1;
+}
+
+/* { dg-final { scan-assembler-times "stp\tq0, q0," 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-10.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-10.c
new file mode 100644
index 0000000..b0f3acb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-10.c
@@ -0,0 +1,22 @@
+/* Verify pattern initialization for array type with structure element with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+
+int foo ()
+{
+ struct test_trailing_hole var[10];
+ return var[2].four;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-11.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-11.c
new file mode 100644
index 0000000..02f7edc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-11.c
@@ -0,0 +1,27 @@
+/* Verify zero initialization for union type with structure field with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+union test_union_padding {
+ struct test_trailing_hole u1;
+ long long u2;
+};
+
+
+int foo ()
+{
+ union test_union_padding var;
+ return var.u1.four;
+}
+
+/* { dg-final { scan-assembler "stp\txzr, xzr," } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-12.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-12.c
new file mode 100644
index 0000000..555972f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-12.c
@@ -0,0 +1,27 @@
+/* Verify pattern initialization for union type with structure field with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+union test_union_padding {
+ struct test_trailing_hole u1;
+ long long u2;
+};
+
+
+int foo ()
+{
+ union test_union_padding var;
+ return var.u1.four;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
new file mode 100644
index 0000000..aceceb8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
@@ -0,0 +1,18 @@
+/* Verify pattern initialization for structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern" } */
+
+struct test_aligned {
+ int internal1;
+ long long internal2;
+} __attribute__ ((aligned(64)));
+
+int foo ()
+{
+ struct test_aligned var;
+ return var.internal1;
+}
+
+/* { dg-final { scan-assembler-times "stp\tq0, q0," 2 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
new file mode 100644
index 0000000..085c386
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
@@ -0,0 +1,27 @@
+/* Verify zero initialization for nested structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_aligned {
+ unsigned internal1;
+ unsigned long long internal2;
+} __attribute__ ((aligned(64)));
+
+struct test_big_hole {
+ char one;
+ char two;
+ char three;
+ /* 61 byte padding hole here. */
+ struct test_aligned four;
+} __attribute__ ((aligned(64)));
+
+
+int foo ()
+{
+ struct test_big_hole var;
+ return var.four.internal1;
+}
+
+/* { dg-final { scan-assembler-times "stp\tq0, q0," 4 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
new file mode 100644
index 0000000..7a6ddbc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
@@ -0,0 +1,27 @@
+/* Verify pattern initialization for nested structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern" } */
+
+struct test_aligned {
+ unsigned internal1;
+ unsigned long long internal2;
+} __attribute__ ((aligned(64)));
+
+struct test_big_hole {
+ char one;
+ char two;
+ char three;
+ /* 61 byte padding hole here. */
+ struct test_aligned four;
+} __attribute__ ((aligned(64)));
+
+
+int foo ()
+{
+ struct test_big_hole var;
+ return var.four.internal1;
+}
+
+/* { dg-final { scan-assembler-times "stp\tq0, q0," 5 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-5.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-5.c
new file mode 100644
index 0000000..3c45a6c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-5.c
@@ -0,0 +1,22 @@
+/* Verify zero initialization for structure type automatic variables with
+ tail padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_trailing_hole {
+ char *one;
+ char *two;
+ char *three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var;
+ return var.four;
+}
+
+/* { dg-final { scan-assembler-times "stp\txzr, xzr," 2 } } */
+
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-6.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-6.c
new file mode 100644
index 0000000..bfef23d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-6.c
@@ -0,0 +1,20 @@
+/* Verify pattern initialization for structure type automatic variables with
+ tail padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ char *one;
+ char *two;
+ char *three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var;
+ return var.four;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-7.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-7.c
new file mode 100644
index 0000000..cb96c3a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-7.c
@@ -0,0 +1,20 @@
+/* Verify zero initialization for structure type automatic variables with
+ padding and has explicit initialization. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var = {.one = 1,.two = 2, .four = 'c'};
+ return var.four;
+}
+
+/* { dg-final { scan-assembler "stp\txzr, xzr," } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-8.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-8.c
new file mode 100644
index 0000000..ce7c7cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-8.c
@@ -0,0 +1,22 @@
+/* Verify pattern initialization for structure type automatic variables with
+ padding and has explicit initialization. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var = {.one = 1,.two = 2, .four = 'c'};
+ return var.four;
+}
+
+/* { dg-final { scan-assembler "stp\txzr, xzr," } } */
+
+
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
new file mode 100644
index 0000000..c81e5ff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
@@ -0,0 +1,21 @@
+/* Verify zero initialization for array type with structure element with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+
+int foo ()
+{
+ struct test_trailing_hole var[10];
+ return var[2].four;
+}
+
+/* { dg-final { scan-assembler-times "stp\tq0, q0," 5 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/info_16 b/gcc/testsuite/gcc.target/aarch64/cpunative/info_16
new file mode 100644
index 0000000..2c04ff1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/cpunative/info_16
@@ -0,0 +1,8 @@
+processor : 0
+BogoMIPS : 100.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 asimddp sve sve2
+CPU implementer : 0xfe
+CPU architecture: 8
+CPU variant : 0x0
+CPU part : 0xd08
+CPU revision : 2
diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/info_17 b/gcc/testsuite/gcc.target/aarch64/cpunative/info_17
new file mode 100644
index 0000000..2c04ff1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/cpunative/info_17
@@ -0,0 +1,8 @@
+processor : 0
+BogoMIPS : 100.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 asimddp sve sve2
+CPU implementer : 0xfe
+CPU architecture: 8
+CPU variant : 0x0
+CPU part : 0xd08
+CPU revision : 2
diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c
new file mode 100644
index 0000000..a424e7c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_16" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod\+sve2} } } */
+
+/* Test a normal looking procinfo. */
diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c
new file mode 100644
index 0000000..c269c5f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_17" } */
+/* { dg-additional-options "-march=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod\+sve2} } } */
+
+/* Test a normal looking procinfo. */
diff --git a/gcc/testsuite/gcc.target/aarch64/csinv-neg-1.c b/gcc/testsuite/gcc.target/aarch64/csinv-neg-1.c
new file mode 100644
index 0000000..e528883
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/csinv-neg-1.c
@@ -0,0 +1,112 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/*
+** inv1:
+** cmp w0, 0
+** csinv w0, w1, w2, ne
+** ret
+*/
+unsigned long long
+inv1(unsigned a, unsigned b, unsigned c)
+{
+ unsigned t = a ? b : ~c;
+ return t;
+}
+
+/*
+** inv1_local:
+** cmp w0, 0
+** csinv w0, w1, w2, ne
+** ret
+*/
+unsigned long long
+inv1_local(unsigned a, unsigned b, unsigned c)
+{
+ unsigned d = ~c;
+ unsigned t = a ? b : d;
+ return t;
+}
+
+/*
+** inv_zero1:
+** cmp w0, 0
+** csinv w0, wzr, w1, ne
+** ret
+*/
+unsigned long long
+inv_zero1(unsigned a, unsigned b)
+{
+ unsigned t = a ? 0 : ~b;
+ return t;
+}
+
+/*
+** inv_zero2:
+** cmp w0, 0
+** csinv w0, wzr, w1, eq
+** ret
+*/
+unsigned long long
+inv_zero2(unsigned a, unsigned b)
+{
+ unsigned t = a ? ~b : 0;
+ return t;
+}
+
+
+/*
+** inv2:
+** cmp w0, 0
+** csinv w0, w2, w1, eq
+** ret
+*/
+unsigned long long
+inv2(unsigned a, unsigned b, unsigned c)
+{
+ unsigned t = a ? ~b : c;
+ return t;
+}
+
+/*
+** inv2_local:
+** cmp w0, 0
+** csinv w0, w2, w1, eq
+** ret
+*/
+unsigned long long
+inv2_local(unsigned a, unsigned b, unsigned c)
+{
+ unsigned d = ~b;
+ unsigned t = a ? d : c;
+ return t;
+}
+
+/*
+** neg1:
+** cmp w0, 0
+** csneg w0, w1, w2, ne
+** ret
+*/
+unsigned long long
+neg1(unsigned a, unsigned b, unsigned c)
+{
+ unsigned t = a ? b : -c;
+ return t;
+}
+
+
+/*
+** neg2:
+** cmp w0, 0
+** csneg w0, w2, w1, eq
+** ret
+*/
+unsigned long long
+neg2(unsigned a, unsigned b, unsigned c)
+{
+ unsigned t = a ? -b : c;
+ return t;
+}
+
+/* { dg-final { check-function-bodies "**" "" "" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/extract_zero_extend.c b/gcc/testsuite/gcc.target/aarch64/extract_zero_extend.c
index 0209305..193b945 100644
--- a/gcc/testsuite/gcc.target/aarch64/extract_zero_extend.c
+++ b/gcc/testsuite/gcc.target/aarch64/extract_zero_extend.c
@@ -70,12 +70,3 @@ foo_siv4hi (siv4hi a)
/* { dg-final { scan-assembler-times "umov\\t" 8 } } */
/* { dg-final { scan-assembler-not "and\\t" } } */
-
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extenddiv16qi" "final" } } */
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extenddiv8qi" "final" } } */
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extenddiv8hi" "final" } } */
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extenddiv4hi" "final" } } */
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extendsiv16qi" "final" } } */
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extendsiv8qi" "final" } } */
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extendsiv8hi" "final" } } */
-/* { dg-final { scan-rtl-dump "aarch64_get_lane_zero_extendsiv4hi" "final" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c b/gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c
new file mode 100644
index 0000000..7b2ab65
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv8-a+nosimd" } */
+
+#include <stdint.h>
+
+uint64_t test_double_to_uint64(double x) {
+ return (uint64_t)x;
+}
+
+int64_t test_double_to_int64(double x) {
+ return (int64_t)x;
+}
+
+uint32_t test_float_to_uint32(float x) {
+ return (uint32_t)x;
+}
+
+int32_t test_float_to_int32(float x) {
+ return (int32_t)x;
+}
+
+/* { dg-final { scan-assembler-not {\tfcvtz[su]\td[0-9]*, d[0-9]*} } } */
+/* { dg-final { scan-assembler-not {\tfcvtz[su]\ts[0-9]*, s[0-9]*} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c b/gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c
new file mode 100644
index 0000000..a2b5758
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c
@@ -0,0 +1,59 @@
+/* { dg-options "-O" } */
+
+#pragma GCC target "+simd+fp16"
+
+__Float16x4_t
+f1 (__Float16x4_t x, __Float16x4_t y)
+{
+ return x * y[0];
+}
+
+__Float16x4_t
+f2 (__Float16x4_t x, __Float16x4_t y)
+{
+ return x * y[3];
+}
+
+__Float16x4_t
+f3 (__Float16x4_t x, __Float16x8_t y)
+{
+ return x * y[0];
+}
+
+__Float16x4_t
+f4 (__Float16x4_t x, __Float16x8_t y)
+{
+ return x * y[7];
+}
+
+__Float16x8_t
+f5 (__Float16x8_t x, __Float16x4_t y)
+{
+ return x * y[0];
+}
+
+__Float16x8_t
+f6 (__Float16x8_t x, __Float16x4_t y)
+{
+ return x * y[3];
+}
+
+__Float16x8_t
+f7 (__Float16x8_t x, __Float16x8_t y)
+{
+ return x * y[0];
+}
+
+__Float16x8_t
+f8 (__Float16x8_t x, __Float16x8_t y)
+{
+ return x * y[7];
+}
+
+/* { dg-final { scan-assembler-times {\tfmul\tv0.4h, v0.4h, v1.h\[0\]} 2 } } */
+/* { dg-final { scan-assembler-times {\tfmul\tv0.4h, v0.4h, v1.h\[3\]} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmul\tv0.4h, v0.4h, v1.h\[7\]} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tfmul\tv0.8h, v0.8h, v1.h\[0\]} 2 } } */
+/* { dg-final { scan-assembler-times {\tfmul\tv0.8h, v0.8h, v1.h\[3\]} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmul\tv0.8h, v0.8h, v1.h\[7\]} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/insv_1.c b/gcc/testsuite/gcc.target/aarch64/insv_1.c
index 9efa22e..a1d26b0 100644
--- a/gcc/testsuite/gcc.target/aarch64/insv_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/insv_1.c
@@ -16,7 +16,7 @@ typedef struct bitfield
bitfield
bfi1 (bitfield a)
{
- /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 0, 8" } } */
+ /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 0, 8" { xfail *-*-* } } } */
a.eight = 3;
return a;
}
@@ -24,7 +24,7 @@ bfi1 (bitfield a)
bitfield
bfi2 (bitfield a)
{
- /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 16, 5" } } */
+ /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 16, 5" { xfail *-*-* } } } */
a.five = 7;
return a;
}
diff --git a/gcc/testsuite/gcc.target/aarch64/lane-bound-1.c b/gcc/testsuite/gcc.target/aarch64/lane-bound-1.c
new file mode 100644
index 0000000..bbbe679
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/lane-bound-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+#include <arm_neon.h>
+
+void
+f (float32x4_t **ptr)
+{
+ float32x4_t res = vsetq_lane_f32 (0.0f, **ptr, 0);
+ **ptr = res;
+}
+/* GCC should be able to remove the call to "__builtin_aarch64_im_lane_boundsi"
+ and optimize out the second load from *ptr. */
+/* { dg-final { scan-tree-dump-times "__builtin_aarch64_im_lane_boundsi" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " = \\\*ptr_" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/lane-bound-2.c b/gcc/testsuite/gcc.target/aarch64/lane-bound-2.c
new file mode 100644
index 0000000..923c946
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/lane-bound-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-original" } */
+void
+f (void)
+{
+ __builtin_aarch64_im_lane_boundsi (16, 4, 0);
+ __builtin_aarch64_im_lane_boundsi (8, 8, 0);
+}
+/* GCC should be able to optimize these out before gimplification. */
+/* { dg-final { scan-tree-dump-times "__builtin_aarch64_im_lane_boundsi" 0 "original" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c b/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c
index 47479ff..e3c83e8 100644
--- a/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c
+++ b/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c
@@ -1,28 +1,12 @@
-/* This test is a copy of gcc.dg/torture/pr34330.c: here we are looking for
- specific patterns being matched in the AArch64 backend. */
-
/* { dg-do compile } */
-/* { dg-options "-Os -ftree-vectorize -dp" } */
+/* { dg-options "-O2 -dp" } */
/* { dg-require-effective-target lp64 } */
-
-struct T
-{
- int t;
- struct { short s1, s2, s3, s4; } *s;
-};
-
void
-foo (int *a, int *b, int *c, int *d, struct T *e)
+f (int x0, int *x1, long x2)
{
- int i;
- for (i = 0; i < e->t; i++)
- {
- e->s[i].s1 = a[i];
- e->s[i].s2 = b[i];
- e->s[i].s3 = c[i];
- e->s[i].s4 = d[i];
- }
+ asm volatile ("// foo %0 %1"
+ :: "r,w" (x0), "Q,m" (x1[x2]));
}
-/* { dg-final { scan-assembler-times "add_lsl_di" 3 } } */
+/* { dg-final { scan-assembler-times "add_lsl_di" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/memset-strict-align-1.c b/gcc/testsuite/gcc.target/aarch64/memset-strict-align-1.c
new file mode 100644
index 0000000..5cdc8a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/memset-strict-align-1.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -mstrict-align" } */
+
+struct s { char x[95]; };
+void foo (struct s *);
+void bar (void) { struct s s1 = {}; foo (&s1); }
+
+/* memset (s1 = {}, sizeof = 95) should be expanded out
+ such that there are no overlap stores when -mstrict-align
+ is in use.
+ so 2 pair 16 bytes stores (64 bytes).
+ 1 16 byte stores
+ 1 8 byte store
+ 1 4 byte store
+ 1 2 byte store
+ 1 1 byte store
+ */
+
+/* { dg-final { scan-assembler-times "stp\tq" 2 } } */
+/* { dg-final { scan-assembler-times "str\tq" 1 } } */
+/* { dg-final { scan-assembler-times "str\txzr" 1 } } */
+/* { dg-final { scan-assembler-times "str\twzr" 1 } } */
+/* { dg-final { scan-assembler-times "strh\twzr" 1 } } */
+/* { dg-final { scan-assembler-times "strb\twzr" 1 } } */
+
+/* Also one store pair for the frame-pointer and the LR. */
+/* { dg-final { scan-assembler-times "stp\tx" 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/narrow_high_combine.c b/gcc/testsuite/gcc.target/aarch64/narrow_high_combine.c
new file mode 100644
index 0000000..50ecab0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/narrow_high_combine.c
@@ -0,0 +1,231 @@
+/* { dg-skip-if "" { arm*-*-* } } */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <arm_neon.h>
+
+#define TEST_1_ARITH(name, rettype, rmwtype, intype, fs, rs) \
+ rettype test_1_ ## name ## _ ## fs ## _high_combine \
+ (rmwtype a, intype b, intype c) \
+ { \
+ return vcombine_ ## rs (a, name ## _ ## fs (b, c)); \
+ }
+
+TEST_1_ARITH (vaddhn, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_ARITH (vaddhn, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_ARITH (vaddhn, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_ARITH (vaddhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_ARITH (vaddhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_ARITH (vaddhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_ARITH (vraddhn, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_ARITH (vraddhn, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_ARITH (vraddhn, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_ARITH (vraddhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_ARITH (vraddhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_ARITH (vraddhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_ARITH (vsubhn, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_ARITH (vsubhn, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_ARITH (vsubhn, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_ARITH (vsubhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_ARITH (vsubhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_ARITH (vsubhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_ARITH (vrsubhn, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_ARITH (vrsubhn, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_ARITH (vrsubhn, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_ARITH (vrsubhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_ARITH (vrsubhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_ARITH (vrsubhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+#define TEST_2_ARITH(name, rettype, intype, fs, rs) \
+ rettype test_2_ ## name ## _ ## fs ## _high_combine \
+ (intype a, intype b, intype c) \
+ { \
+ return vcombine_ ## rs (name ## _ ## fs (a, c), \
+ name ## _ ## fs (b, c)); \
+ }
+
+TEST_2_ARITH (vaddhn, int8x16_t, int16x8_t, s16, s8)
+TEST_2_ARITH (vaddhn, int16x8_t, int32x4_t, s32, s16)
+TEST_2_ARITH (vaddhn, int32x4_t, int64x2_t, s64, s32)
+TEST_2_ARITH (vaddhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_ARITH (vaddhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_ARITH (vaddhn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_ARITH (vraddhn, int8x16_t, int16x8_t, s16, s8)
+TEST_2_ARITH (vraddhn, int16x8_t, int32x4_t, s32, s16)
+TEST_2_ARITH (vraddhn, int32x4_t, int64x2_t, s64, s32)
+TEST_2_ARITH (vraddhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_ARITH (vraddhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_ARITH (vraddhn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_ARITH (vsubhn, int8x16_t, int16x8_t, s16, s8)
+TEST_2_ARITH (vsubhn, int16x8_t, int32x4_t, s32, s16)
+TEST_2_ARITH (vsubhn, int32x4_t, int64x2_t, s64, s32)
+TEST_2_ARITH (vsubhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_ARITH (vsubhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_ARITH (vsubhn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_ARITH (vrsubhn, int8x16_t, int16x8_t, s16, s8)
+TEST_2_ARITH (vrsubhn, int16x8_t, int32x4_t, s32, s16)
+TEST_2_ARITH (vrsubhn, int32x4_t, int64x2_t, s64, s32)
+TEST_2_ARITH (vrsubhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_ARITH (vrsubhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_ARITH (vrsubhn, uint32x4_t, uint64x2_t, u64, u32)
+
+#define TEST_1_SHIFT(name, rettype, rmwtype, intype, fs, rs) \
+ rettype test_1_ ## name ## _ ## fs ## _high_combine \
+ (rmwtype a, intype b) \
+ { \
+ return vcombine_ ## rs (a, name ## _ ## fs (b, 4)); \
+ }
+
+TEST_1_SHIFT (vshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_SHIFT (vshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_SHIFT (vshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_SHIFT (vshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_SHIFT (vshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_SHIFT (vshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_SHIFT (vrshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_SHIFT (vrshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_SHIFT (vrshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_SHIFT (vrshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_SHIFT (vrshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_SHIFT (vrshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_SHIFT (vqshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_SHIFT (vqshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_SHIFT (vqshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_SHIFT (vqshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_SHIFT (vqshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_SHIFT (vqshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_SHIFT (vqrshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_SHIFT (vqrshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_SHIFT (vqrshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_SHIFT (vqrshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_SHIFT (vqrshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_SHIFT (vqrshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_SHIFT (vqshrun_n, uint8x16_t, uint8x8_t, int16x8_t, s16, u8)
+TEST_1_SHIFT (vqshrun_n, uint16x8_t, uint16x4_t, int32x4_t, s32, u16)
+TEST_1_SHIFT (vqshrun_n, uint32x4_t, uint32x2_t, int64x2_t, s64, u32)
+
+TEST_1_SHIFT (vqrshrun_n, uint8x16_t, uint8x8_t, int16x8_t, s16, u8)
+TEST_1_SHIFT (vqrshrun_n, uint16x8_t, uint16x4_t, int32x4_t, s32, u16)
+TEST_1_SHIFT (vqrshrun_n, uint32x4_t, uint32x2_t, int64x2_t, s64, u32)
+
+#define TEST_2_SHIFT(name, rettype, intype, fs, rs) \
+ rettype test_2_ ## name ## _ ## fs ## _high_combine \
+ (intype a, intype b) \
+ { \
+ return vcombine_ ## rs (name ## _ ## fs (a, 4), \
+ name ## _ ## fs (b, 4)); \
+ }
+
+TEST_2_SHIFT (vshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_2_SHIFT (vshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_2_SHIFT (vshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_2_SHIFT (vshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_SHIFT (vshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_SHIFT (vshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_SHIFT (vrshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_2_SHIFT (vrshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_2_SHIFT (vrshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_2_SHIFT (vrshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_SHIFT (vrshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_SHIFT (vrshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_SHIFT (vqshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_2_SHIFT (vqshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_2_SHIFT (vqshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_2_SHIFT (vqshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_SHIFT (vqshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_SHIFT (vqshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_SHIFT (vqrshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_2_SHIFT (vqrshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_2_SHIFT (vqrshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_2_SHIFT (vqrshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_SHIFT (vqrshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_SHIFT (vqrshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_SHIFT (vqshrun_n, uint8x16_t, int16x8_t, s16, u8)
+TEST_2_SHIFT (vqshrun_n, uint16x8_t, int32x4_t, s32, u16)
+TEST_2_SHIFT (vqshrun_n, uint32x4_t, int64x2_t, s64, u32)
+
+TEST_2_SHIFT (vqrshrun_n, uint8x16_t, int16x8_t, s16, u8)
+TEST_2_SHIFT (vqrshrun_n, uint16x8_t, int32x4_t, s32, u16)
+TEST_2_SHIFT (vqrshrun_n, uint32x4_t, int64x2_t, s64, u32)
+
+#define TEST_1_UNARY(name, rettype, rmwtype, intype, fs, rs) \
+ rettype test_1_ ## name ## _ ## fs ## _high_combine \
+ (rmwtype a, intype b) \
+ { \
+ return vcombine_ ## rs (a, name ## _ ## fs (b)); \
+ }
+
+TEST_1_UNARY (vmovn, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_UNARY (vmovn, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_UNARY (vmovn, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_UNARY (vmovn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_UNARY (vmovn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_UNARY (vmovn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_UNARY (vqmovn, int8x16_t, int8x8_t, int16x8_t, s16, s8)
+TEST_1_UNARY (vqmovn, int16x8_t, int16x4_t, int32x4_t, s32, s16)
+TEST_1_UNARY (vqmovn, int32x4_t, int32x2_t, int64x2_t, s64, s32)
+TEST_1_UNARY (vqmovn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8)
+TEST_1_UNARY (vqmovn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16)
+TEST_1_UNARY (vqmovn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32)
+
+TEST_1_UNARY (vqmovun, uint8x16_t, uint8x8_t, int16x8_t, s16, u8)
+TEST_1_UNARY (vqmovun, uint16x8_t, uint16x4_t, int32x4_t, s32, u16)
+TEST_1_UNARY (vqmovun, uint32x4_t, uint32x2_t, int64x2_t, s64, u32)
+
+#define TEST_2_UNARY(name, rettype, intype, fs, rs) \
+ rettype test_2_ ## name ## _ ## fs ## _high_combine \
+ (intype a, intype b) \
+ { \
+ return vcombine_ ## rs (name ## _ ## fs (a), \
+ name ## _ ## fs (b)); \
+ }
+
+TEST_2_UNARY (vmovn, int8x16_t, int16x8_t, s16, s8)
+TEST_2_UNARY (vmovn, int16x8_t, int32x4_t, s32, s16)
+TEST_2_UNARY (vmovn, int32x4_t, int64x2_t, s64, s32)
+TEST_2_UNARY (vmovn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_UNARY (vmovn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_UNARY (vmovn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_UNARY (vqmovn, int8x16_t, int16x8_t, s16, s8)
+TEST_2_UNARY (vqmovn, int16x8_t, int32x4_t, s32, s16)
+TEST_2_UNARY (vqmovn, int32x4_t, int64x2_t, s64, s32)
+TEST_2_UNARY (vqmovn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_2_UNARY (vqmovn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_2_UNARY (vqmovn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_2_UNARY (vqmovun, uint8x16_t, int16x8_t, s16, u8)
+TEST_2_UNARY (vqmovun, uint16x8_t, int32x4_t, s32, u16)
+TEST_2_UNARY (vqmovun, uint32x4_t, int64x2_t, s64, u32)
+
+/* { dg-final { scan-assembler-times "\\taddhn2\\tv" 12} } */
+/* { dg-final { scan-assembler-times "\\tsubhn2\\tv" 12} } */
+/* { dg-final { scan-assembler-times "\\trsubhn2\\tv" 12} } */
+/* { dg-final { scan-assembler-times "\\traddhn2\\tv" 12} } */
+/* { dg-final { scan-assembler-times "\\trshrn2\\tv" 12} } */
+/* { dg-final { scan-assembler-times "\\tshrn2\\tv" 12} } */
+/* { dg-final { scan-assembler-times "\\tsqshrun2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsqrshrun2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsqshrn2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tuqshrn2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsqrshrn2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tuqrshrn2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\txtn2\\tv" 12} } */
+/* { dg-final { scan-assembler-times "\\tuqxtn2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsqxtn2\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsqxtun2\\tv" 6} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/narrow_zero_high_half.c b/gcc/testsuite/gcc.target/aarch64/narrow_zero_high_half.c
new file mode 100644
index 0000000..dd5ddf8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/narrow_zero_high_half.c
@@ -0,0 +1,130 @@
+/* { dg-skip-if "" { arm*-*-* } } */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <arm_neon.h>
+
+#define TEST_SHIFT(name, rettype, intype, fs, rs) \
+ rettype test_ ## name ## _ ## fs ## _zero_high \
+ (intype a) \
+ { \
+ return vcombine_ ## rs (name ## _ ## fs (a, 4), \
+ vdup_n_ ## rs (0)); \
+ }
+
+TEST_SHIFT (vshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_SHIFT (vshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_SHIFT (vshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_SHIFT (vshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_SHIFT (vshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_SHIFT (vshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_SHIFT (vrshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_SHIFT (vrshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_SHIFT (vrshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_SHIFT (vrshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_SHIFT (vrshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_SHIFT (vrshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_SHIFT (vqshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_SHIFT (vqshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_SHIFT (vqshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_SHIFT (vqshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_SHIFT (vqshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_SHIFT (vqshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_SHIFT (vqrshrn_n, int8x16_t, int16x8_t, s16, s8)
+TEST_SHIFT (vqrshrn_n, int16x8_t, int32x4_t, s32, s16)
+TEST_SHIFT (vqrshrn_n, int32x4_t, int64x2_t, s64, s32)
+TEST_SHIFT (vqrshrn_n, uint8x16_t, uint16x8_t, u16, u8)
+TEST_SHIFT (vqrshrn_n, uint16x8_t, uint32x4_t, u32, u16)
+TEST_SHIFT (vqrshrn_n, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_SHIFT (vqshrun_n, uint8x16_t, int16x8_t, s16, u8)
+TEST_SHIFT (vqshrun_n, uint16x8_t, int32x4_t, s32, u16)
+TEST_SHIFT (vqshrun_n, uint32x4_t, int64x2_t, s64, u32)
+
+TEST_SHIFT (vqrshrun_n, uint8x16_t, int16x8_t, s16, u8)
+TEST_SHIFT (vqrshrun_n, uint16x8_t, int32x4_t, s32, u16)
+TEST_SHIFT (vqrshrun_n, uint32x4_t, int64x2_t, s64, u32)
+
+#define TEST_UNARY(name, rettype, intype, fs, rs) \
+ rettype test_ ## name ## _ ## fs ## _zero_high \
+ (intype a) \
+ { \
+ return vcombine_ ## rs (name ## _ ## fs (a), \
+ vdup_n_ ## rs (0)); \
+ }
+
+TEST_UNARY (vmovn, int8x16_t, int16x8_t, s16, s8)
+TEST_UNARY (vmovn, int16x8_t, int32x4_t, s32, s16)
+TEST_UNARY (vmovn, int32x4_t, int64x2_t, s64, s32)
+TEST_UNARY (vmovn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_UNARY (vmovn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_UNARY (vmovn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_UNARY (vqmovun, uint8x16_t, int16x8_t, s16, u8)
+TEST_UNARY (vqmovun, uint16x8_t, int32x4_t, s32, u16)
+TEST_UNARY (vqmovun, uint32x4_t, int64x2_t, s64, u32)
+
+TEST_UNARY (vqmovn, int8x16_t, int16x8_t, s16, s8)
+TEST_UNARY (vqmovn, int16x8_t, int32x4_t, s32, s16)
+TEST_UNARY (vqmovn, int32x4_t, int64x2_t, s64, s32)
+TEST_UNARY (vqmovn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_UNARY (vqmovn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_UNARY (vqmovn, uint32x4_t, uint64x2_t, u64, u32)
+
+#define TEST_ARITH(name, rettype, intype, fs, rs) \
+ rettype test_ ## name ## _ ## fs ## _zero_high \
+ (intype a, intype b) \
+ { \
+ return vcombine_ ## rs (name ## _ ## fs (a, b), \
+ vdup_n_ ## rs (0)); \
+ }
+
+TEST_ARITH (vaddhn, int8x16_t, int16x8_t, s16, s8)
+TEST_ARITH (vaddhn, int16x8_t, int32x4_t, s32, s16)
+TEST_ARITH (vaddhn, int32x4_t, int64x2_t, s64, s32)
+TEST_ARITH (vaddhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_ARITH (vaddhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_ARITH (vaddhn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_ARITH (vraddhn, int8x16_t, int16x8_t, s16, s8)
+TEST_ARITH (vraddhn, int16x8_t, int32x4_t, s32, s16)
+TEST_ARITH (vraddhn, int32x4_t, int64x2_t, s64, s32)
+TEST_ARITH (vraddhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_ARITH (vraddhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_ARITH (vraddhn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_ARITH (vsubhn, int8x16_t, int16x8_t, s16, s8)
+TEST_ARITH (vsubhn, int16x8_t, int32x4_t, s32, s16)
+TEST_ARITH (vsubhn, int32x4_t, int64x2_t, s64, s32)
+TEST_ARITH (vsubhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_ARITH (vsubhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_ARITH (vsubhn, uint32x4_t, uint64x2_t, u64, u32)
+
+TEST_ARITH (vrsubhn, int8x16_t, int16x8_t, s16, s8)
+TEST_ARITH (vrsubhn, int16x8_t, int32x4_t, s32, s16)
+TEST_ARITH (vrsubhn, int32x4_t, int64x2_t, s64, s32)
+TEST_ARITH (vrsubhn, uint8x16_t, uint16x8_t, u16, u8)
+TEST_ARITH (vrsubhn, uint16x8_t, uint32x4_t, u32, u16)
+TEST_ARITH (vrsubhn, uint32x4_t, uint64x2_t, u64, u32)
+
+/* { dg-final { scan-assembler-not "dup\\t" } } */
+
+/* { dg-final { scan-assembler-times "\\tshrn\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\trshrn\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsqshrn\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\tuqshrn\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\tsqrshrn\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\tuqrshrn\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\tsqshrun\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\tsqrshrun\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\txtn\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsqxtun\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\tuqxtn\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\tsqxtn\\tv" 3} } */
+/* { dg-final { scan-assembler-times "\\taddhn\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\tsubhn\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\trsubhn\\tv" 6} } */
+/* { dg-final { scan-assembler-times "\\traddhn\\tv" 6} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr100028.c b/gcc/testsuite/gcc.target/aarch64/pr100028.c
new file mode 100644
index 0000000..a25b929
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr100028.c
@@ -0,0 +1,22 @@
+/* PR target/100028 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#define W 3
+#define L 11
+
+int
+foo (int d, int s)
+{
+ int wmask = (1 << W) - 1;
+ return (d & ~wmask) | ((s >> L) & wmask);
+}
+
+long long int
+bar (long long int d, long long int s)
+{
+ long long int wmask = (1LL << W) - 1;
+ return (d & ~wmask) | ((s >> L) & wmask);
+}
+
+/* { dg-final { scan-assembler-times {\tbfxil\t} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr100056.c b/gcc/testsuite/gcc.target/aarch64/pr100056.c
new file mode 100644
index 0000000..0b77824
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr100056.c
@@ -0,0 +1,58 @@
+/* PR target/100056 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not {\t[us]bfiz\tw[0-9]+, w[0-9]+, 11} } } */
+
+int
+or_shift_u8 (unsigned char i)
+{
+ return i | (i << 11);
+}
+
+int
+or_shift_u3a (unsigned i)
+{
+ i &= 7;
+ return i | (i << 11);
+}
+
+int
+or_shift_u3b (unsigned i)
+{
+ i = (i << 29) >> 29;
+ return i | (i << 11);
+}
+
+int
+or_shift_s16 (signed short i)
+{
+ return i | (i << 11);
+}
+
+int
+or_shift_s8 (signed char i)
+{
+ return i | (i << 11);
+}
+
+int
+or_shift_s13 (int i)
+{
+ i = (i << 19) >> 19;
+ return i | (i << 11);
+}
+
+int
+or_shift_s3 (int i)
+{
+ i = (i << 29) >> 29;
+ return i | (i << 11);
+}
+
+int
+or_shift_u8_asm (unsigned char x)
+{
+ unsigned char i = x;
+ asm volatile ("" : "+r" (i));
+ return i | (i << 11);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr100075.c b/gcc/testsuite/gcc.target/aarch64/pr100075.c
new file mode 100644
index 0000000..1ece5fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr100075.c
@@ -0,0 +1,21 @@
+/* PR target/100075 */
+/* { dg-do compile } */
+/* { dg-require-effective-target aarch64_little_endian } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not {\tsbfx\tx[0-9]+, x[0-9]+, 16, 16} } } */
+/* { dg-final { scan-assembler {\tneg\tw[0-9]+, w[0-9]+, asr 16} } } */
+/* { dg-final { scan-assembler {\textr\tw[0-9]+, w[0-9]+, w[0-9]+, 16} } } */
+
+struct S { short x, y; };
+
+struct S
+f1 (struct S p)
+{
+ return (struct S) { -p.y, p.x };
+}
+
+struct S
+f2 (struct S p)
+{
+ return (struct S) { p.y, -p.x };
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr70398.c b/gcc/testsuite/gcc.target/aarch64/pr70398.c
index dbe5ad1..784a670 100644
--- a/gcc/testsuite/gcc.target/aarch64/pr70398.c
+++ b/gcc/testsuite/gcc.target/aarch64/pr70398.c
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require-effective-target static } */
/* { dg-options "-O -fno-tree-loop-optimize -fno-tree-ter -static" } */
unsigned int in[8 * 8] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
diff --git a/gcc/testsuite/gcc.target/aarch64/pr91710.c b/gcc/testsuite/gcc.target/aarch64/pr91710.c
new file mode 100644
index 0000000..496eb50
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr91710.c
@@ -0,0 +1,16 @@
+/* PR target/91710 */
+/* { dg-do compile } */
+
+struct S { unsigned int i:4; };
+
+unsigned int test1(struct S s) { /* { dg-bogus "parameter passing for argument of type" } */
+ return s.i;
+}
+
+unsigned int test2(unsigned x, struct S s) { /* { dg-bogus "parameter passing for argument of type" } */
+ return x - s.i;
+}
+
+unsigned int test3(unsigned x, unsigned y, struct S s) { /* { dg-bogus "parameter passing for argument of type" } */
+ return x - y - s.i;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr98772.c b/gcc/testsuite/gcc.target/aarch64/pr98772.c
index 6632215..8259251 100644
--- a/gcc/testsuite/gcc.target/aarch64/pr98772.c
+++ b/gcc/testsuite/gcc.target/aarch64/pr98772.c
@@ -1,5 +1,8 @@
/* { dg-do run } */
/* { dg-options "-O3 -save-temps" } */
+
+#pragma GCC target "+nosve"
+
#include <stdint.h>
#include <string.h>
diff --git a/gcc/testsuite/gcc.target/aarch64/pr99767.c b/gcc/testsuite/gcc.target/aarch64/pr99767.c
new file mode 100644
index 0000000..5bbfcbd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr99767.c
@@ -0,0 +1,16 @@
+/* PR target/99767 */
+/* { dg-do compile } */
+/* { dg-options " -O1 -fopenmp-simd -fno-tree-dce -march=armv8-a+sve" } */
+
+int a[1024], b[1024];
+
+void
+foo (void)
+{
+ #pragma omp simd
+ for (int i = 0; i < 1024; i++)
+ if (b[i] > 23) {
+ a[i] = b[i] + 1;
+ int v = 1 / 0; /* { dg-warning "division by zero" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr99808.c b/gcc/testsuite/gcc.target/aarch64/pr99808.c
new file mode 100644
index 0000000..713360f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr99808.c
@@ -0,0 +1,14 @@
+/* PR target/99808 */
+/* PR target/99037 */
+/* { dg-do compile } */
+/* { dg-options "-Og -fweb -fno-forward-propagate -g" } */
+
+#include <arm_neon.h>
+
+float32x4_t
+foo (void)
+{
+ float64x2_t arg2 = vcombine_f64 ((float64x1_t) 0ULL, (float64x1_t) 1ULL);
+ return vcvt_high_f32_f64 ((float32x2_t) 1ULL, arg2);
+}
+
diff --git a/gcc/testsuite/gcc.target/aarch64/pr99873_1.c b/gcc/testsuite/gcc.target/aarch64/pr99873_1.c
new file mode 100644
index 0000000..bc4d81e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr99873_1.c
@@ -0,0 +1,17 @@
+/* { dg-options "-O3" } */
+
+#pragma GCC target "+nosve"
+
+void
+f (int *restrict x, int *restrict y, int *restrict z, int n)
+{
+ for (int i = 0; i < n; i += 3)
+ {
+ x[i] = y[i] + z[i];
+ x[i + 1] = y[i + 1] - z[i + 1];
+ x[i + 2] = y[i + 2] | z[i + 2];
+ }
+}
+
+/* { dg-final { scan-assembler-times {\tld3\t} 2 } } */
+/* { dg-final { scan-assembler-times {\tst3\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr99873_2.c b/gcc/testsuite/gcc.target/aarch64/pr99873_2.c
new file mode 100644
index 0000000..b73fbdc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr99873_2.c
@@ -0,0 +1,20 @@
+/* { dg-options "-O3" } */
+
+#include <stdint.h>
+
+#pragma GCC target "+nosve"
+
+void __attribute ((noipa))
+foo (uint64_t *__restrict x, uint64_t *__restrict y, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ x[i] += y[i];
+ x[i + 1] += y[i + 1];
+ x[i + 2] |= y[i + 2];
+ x[i + 3] |= y[i + 3];
+ }
+}
+
+/* { dg-final { scan-assembler-not {\tld4\t} } } */
+/* { dg-final { scan-assembler-not {\tst4\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr99873_3.c b/gcc/testsuite/gcc.target/aarch64/pr99873_3.c
new file mode 100644
index 0000000..ccbab6d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr99873_3.c
@@ -0,0 +1,20 @@
+/* { dg-options "-O3" } */
+
+#include <stdint.h>
+
+#pragma GCC target "+nosve"
+
+void __attribute ((noipa))
+foo (uint32_t *__restrict x, uint32_t *__restrict y, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ x[i] += y[i];
+ x[i + 1] += y[i + 1];
+ x[i + 2] |= y[i + 2];
+ x[i + 3] |= y[i + 3];
+ }
+}
+
+/* { dg-final { scan-assembler-times {\tld4\t} 2 } } */
+/* { dg-final { scan-assembler-times {\tst4\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr99988.c b/gcc/testsuite/gcc.target/aarch64/pr99988.c
new file mode 100644
index 0000000..7cca496
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr99988.c
@@ -0,0 +1,66 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O2 -mbranch-protection=standard" } */
+/* { dg-final { scan-assembler-times {bti j} 13 } } */
+int a;
+int c();
+int d();
+int e();
+int f();
+int g();
+void h() {
+ switch (a) {
+ case 0:
+ case 56:
+ case 57:
+ break;
+ case 58:
+ case 59:
+ case 61:
+ case 62:
+ c();
+ case 64:
+ case 63:
+ d();
+ case 66:
+ case 65:
+ d();
+ case 68:
+ case 67:
+ d();
+ case 69:
+ case 70:
+ d();
+ case 71:
+ case 72:
+ case 88:
+ case 87:
+ d();
+ case 90:
+ case 89:
+ d();
+ case 92:
+ case 1:
+ d();
+ case 93:
+ case 73:
+ case 4:
+ e();
+ case 76:
+ case 5:
+ f();
+ case 7:
+ case 8:
+ case 84:
+ case 85:
+ break;
+ case 6:
+ case 299:
+ case 9:
+ case 80:
+ case 2:
+ case 3:
+ e();
+ default:
+ g();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/ssra.c b/gcc/testsuite/gcc.target/aarch64/simd/ssra.c
index e9c2e04..bd6b6bf 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/ssra.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/ssra.c
@@ -1,6 +1,7 @@
/* { dg-do compile { target aarch64*-*-* } } */
/* { dg-options "-O3" } */
-/* { dg-skip-if "" { *-*-* } {"*sve*"} {""} } */
+
+#pragma GCC target "+nosve"
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/usra.c b/gcc/testsuite/gcc.target/aarch64/simd/usra.c
index 4e7446d..10712b2 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/usra.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/usra.c
@@ -1,6 +1,7 @@
/* { dg-do compile { target aarch64*-*-* } } */
/* { dg-options "-O3" } */
-/* { dg-skip-if "" { *-*-* } {"*sve*"} {""} } */
+
+#pragma GCC target "+nosve"
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c b/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c
index 921c5f1..4abb8e9 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c
@@ -1,6 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O3" } */
+#pragma GCC target "+nosve"
+
typedef int __attribute__ ((mode (SI))) int32_t;
typedef int __attribute__ ((mode (DI))) int64_t;
typedef unsigned __attribute__ ((mode (SI))) size_t;
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vmulx_laneq_f64_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vmulx_laneq_f64_1.c
index db79d53..9ef001e 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vmulx_laneq_f64_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vmulx_laneq_f64_1.c
@@ -72,5 +72,5 @@ main (void)
set_and_test_case3 ();
return 0;
}
-/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[dD\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]\n" 1 } } */
/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[dD\]\\\[1\\\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vmulxd_laneq_f64_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vmulxd_laneq_f64_1.c
index 3f8303c..232ade9 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vmulxd_laneq_f64_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vmulxd_laneq_f64_1.c
@@ -58,5 +58,5 @@ main (void)
set_and_test_case3 ();
return 0;
}
-/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[dD\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]\n" 1 } } */
/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[dD\]\[0-9\]+, ?\[dD\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[dD\]\\\[1\\\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_lane_f32_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_lane_f32_1.c
index 124dcd8..37aa0ec 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_lane_f32_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_lane_f32_1.c
@@ -57,5 +57,5 @@ main (void)
set_and_test_case3 ();
return 0;
}
-/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]\n" 1 } } */
/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[1\\\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_laneq_f32_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_laneq_f32_1.c
index 255f096..c9f2484 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_laneq_f32_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vmulxs_laneq_f32_1.c
@@ -79,7 +79,7 @@ main (void)
set_and_test_case3 ();
return 0;
}
-/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]\n" 1 } } */
/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[1\\\]\n" 1 } } */
/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[2\\\]\n" 1 } } */
/* { dg-final { scan-assembler-times "fmulx\[ \t\]+\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[3\\\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlalh_lane_s16.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlalh_lane_s16.c
index 21ae724..6b96d1c 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlalh_lane_s16.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlalh_lane_s16.c
@@ -11,4 +11,4 @@ t_vqdmlalh_lane_s16 (int32_t a, int16_t b, int16x4_t c)
return vqdmlalh_lane_s16 (a, b, c, 0);
}
-/* { dg-final { scan-assembler-times "sqdmlal\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[hH\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmlal\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[hH\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c
index 79db7b7..a780ddb 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c
@@ -11,4 +11,4 @@ t_vqdmlals_lane_s32 (int64_t a, int32_t b, int32x2_t c)
return vqdmlals_lane_s32 (a, b, c, 0);
}
-/* { dg-final { scan-assembler-times "sqdmlal\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmlal\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlslh_lane_s16.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlslh_lane_s16.c
index 185507b..8bbac1a 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlslh_lane_s16.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlslh_lane_s16.c
@@ -11,4 +11,4 @@ t_vqdmlslh_lane_s16 (int32_t a, int16_t b, int16x4_t c)
return vqdmlslh_lane_s16 (a, b, c, 0);
}
-/* { dg-final { scan-assembler-times "sqdmlsl\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[hH\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmlsl\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[hH\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c
index f692923..069ba91 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c
@@ -11,4 +11,4 @@ t_vqdmlsls_lane_s32 (int64_t a, int32_t b, int32x2_t c)
return vqdmlsls_lane_s32 (a, b, c, 0);
}
-/* { dg-final { scan-assembler-times "sqdmlsl\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmlsl\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_lane_s16.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_lane_s16.c
index debf191..fcd496b 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_lane_s16.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_lane_s16.c
@@ -11,4 +11,4 @@ t_vqdmullh_lane_s16 (int16_t a, int16x4_t b)
return vqdmullh_lane_s16 (a, b, 0);
}
-/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[hH\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[hH\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_laneq_s16.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_laneq_s16.c
index e810c47..db77fff 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_laneq_s16.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmullh_laneq_s16.c
@@ -11,4 +11,4 @@ t_vqdmullh_laneq_s16 (int16_t a, int16x8_t b)
return vqdmullh_laneq_s16 (a, b, 0);
}
-/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[hH\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[sS\]\[0-9\]+, ?\[hH\]\[0-9\]+, ?\[hH\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_lane_s32.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_lane_s32.c
index a5fe60f..04bbe7f 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_lane_s32.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_lane_s32.c
@@ -11,4 +11,4 @@ t_vqdmulls_lane_s32 (int32_t a, int32x2_t b)
return vqdmulls_lane_s32 (a, b, 0);
}
-/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_laneq_s32.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_laneq_s32.c
index bd856d8..e8e2368 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_laneq_s32.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmulls_laneq_s32.c
@@ -11,4 +11,4 @@ t_vqdmulls_laneq_s32 (int32_t a, int32x4_t b)
return vqdmulls_laneq_s32 (a, b, 0);
}
-/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[vV\]\[0-9\]+\.\[sS\]\\\[0\\\]\n" 1 } } */
+/* { dg-final { scan-assembler-times "sqdmull\[ \t\]+\[dD\]\[0-9\]+, ?\[sS\]\[0-9\]+, ?\[sS\]\[0-9\]\n" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vusdot-autovec.c b/gcc/testsuite/gcc.target/aarch64/simd/vusdot-autovec.c
new file mode 100644
index 0000000..b99a945
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vusdot-autovec.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=armv8.2-a+i8mm" } */
+
+#define N 480
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+f (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 char *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 short mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+g (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict b,
+ SIGNEDNESS_4 char *restrict a)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 short mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {\tusdot\t} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/smov_1.c b/gcc/testsuite/gcc.target/aarch64/smov_1.c
new file mode 100644
index 0000000..53280ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/smov_1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=armv8.2-a+sve" } */
+
+/* Check that we avoid an explicit sxth in favour of smov. */
+
+#include <arm_sve.h>
+
+int foo(svint16_t a) {
+ return svminv_s16(svptrue_b16(), a);
+}
+
+/* { dg-final { scan-assembler-not "sxth" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp b/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp
index 622fc92..439a012 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp
+++ b/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp
@@ -28,16 +28,9 @@ if {![istarget aarch64*-*-*] } then {
# Load support procs.
load_lib gcc-dg.exp
-# If a testcase doesn't have special options, use these.
-global DEFAULT_CFLAGS
-if ![info exists DEFAULT_CFLAGS] then {
- set DEFAULT_CFLAGS " -ansi -pedantic-errors"
-}
-
# Initialize `dg'.
dg-init
-# Force SVE if we're not testing it already.
if { [check_effective_target_aarch64_sve] } {
set sve_flags ""
} else {
@@ -52,9 +45,11 @@ if { [check_effective_target_ilp32] } {
set pattern "*"
}
-# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/$pattern.\[cCS\]]] \
- $sve_flags $DEFAULT_CFLAGS
+aarch64-with-arch-dg-options $sve_flags {
+ # Main loop.
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/$pattern.\[cCS\]]] \
+ "" $sve_flags
+}
# All done.
dg-finish
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp
index 6146e65..3522991 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp
@@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve] } {
set sve_flags "-march=armv8.2-a+sve"
}
+# Turn off any codegen tweaks by default that may affect expected assembly.
+# Tests relying on those should turn them on explicitly.
+set sve_flags "$sve_flags -mtune=generic -moverride=tune=none"
+
global gcc_runtest_parallelize_limit_minor
if { [info exists gcc_runtest_parallelize_limit_minor] } {
set old_limit_minor $gcc_runtest_parallelize_limit_minor
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp
index a33b65a..2f36f1c 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp
@@ -44,6 +44,10 @@ if { [check_effective_target_aarch64_sve] } {
set sve_flags "-march=armv8.2-a+sve"
}
+# Turn off any codegen tweaks by default that may affect expected assembly.
+# Tests relying on those should turn them on explicitly.
+set sve_flags "$sve_flags -moverride=tune=none"
+
# Main loop.
set files [glob -nocomplain \
"$srcdir/$subdir/general/*.c" \
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f16.c
index 35f5c15..8bcd094 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f16.c
@@ -218,7 +218,7 @@ TEST_UNIFORM_ZD (div_h4_f16_x_tied1, svfloat16_t, __fp16,
z0 = svdiv_x (p0, z0, d4))
/*
-** div_h4_f16_x_untied: { xfail *-*-* }
+** div_h4_f16_x_untied:
** mov z0\.h, h4
** fdivr z0\.h, p0/m, z0\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f32.c
index 40cc203..546c61d 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f32.c
@@ -218,7 +218,7 @@ TEST_UNIFORM_ZD (div_s4_f32_x_tied1, svfloat32_t, float,
z0 = svdiv_x (p0, z0, d4))
/*
-** div_s4_f32_x_untied: { xfail *-*-* }
+** div_s4_f32_x_untied:
** mov z0\.s, s4
** fdivr z0\.s, p0/m, z0\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f64.c
index 56acbbe..1e24bc26 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/div_f64.c
@@ -218,7 +218,7 @@ TEST_UNIFORM_ZD (div_d4_f64_x_tied1, svfloat64_t, double,
z0 = svdiv_x (p0, z0, d4))
/*
-** div_d4_f64_x_untied: { xfail *-*-* }
+** div_d4_f64_x_untied:
** mov z0\.d, d4
** fdivr z0\.d, p0/m, z0\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f16.c
index 03cc034..e293be6 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f16.c
@@ -239,7 +239,7 @@ TEST_UNIFORM_ZD (divr_h4_f16_x_tied1, svfloat16_t, __fp16,
z0 = svdivr_x (p0, z0, d4))
/*
-** divr_h4_f16_x_untied: { xfail *-*-* }
+** divr_h4_f16_x_untied:
** mov z0\.h, h4
** fdiv z0\.h, p0/m, z0\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f32.c
index c2b65fc..04a7ac4 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f32.c
@@ -239,7 +239,7 @@ TEST_UNIFORM_ZD (divr_s4_f32_x_tied1, svfloat32_t, float,
z0 = svdivr_x (p0, z0, d4))
/*
-** divr_s4_f32_x_untied: { xfail *-*-* }
+** divr_s4_f32_x_untied:
** mov z0\.s, s4
** fdiv z0\.s, p0/m, z0\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f64.c
index 0a72a37..bef1a9b 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/divr_f64.c
@@ -239,7 +239,7 @@ TEST_UNIFORM_ZD (divr_d4_f64_x_tied1, svfloat64_t, double,
z0 = svdivr_x (p0, z0, d4))
/*
-** divr_d4_f64_x_untied: { xfail *-*-* }
+** divr_d4_f64_x_untied:
** mov z0\.d, d4
** fdiv z0\.d, p0/m, z0\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f16.c
index 7656f9e..4b31484 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mad_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svmad_x (p0, z1, z0, d4))
/*
-** mad_h4_f16_x_untied: { xfail *-*-* }
+** mad_h4_f16_x_untied:
** mov z0\.h, h4
** fmla z0\.h, p0/m, z1\.h, z2\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f32.c
index dbdd2b9..d5dbc85 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mad_s4_f32_x_tied2, svfloat32_t, float,
z0 = svmad_x (p0, z1, z0, d4))
/*
-** mad_s4_f32_x_untied: { xfail *-*-* }
+** mad_s4_f32_x_untied:
** mov z0\.s, s4
** fmla z0\.s, p0/m, z1\.s, z2\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f64.c
index 9782812..7b5dc22 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mad_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mad_d4_f64_x_tied2, svfloat64_t, double,
z0 = svmad_x (p0, z1, z0, d4))
/*
-** mad_d4_f64_x_untied: { xfail *-*-* }
+** mad_d4_f64_x_untied:
** mov z0\.d, d4
** fmla z0\.d, p0/m, z1\.d, z2\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f16.c
index f22a582..d32ce58 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mla_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svmla_x (p0, z1, z0, d4))
/*
-** mla_h4_f16_x_untied: { xfail *-*-* }
+** mla_h4_f16_x_untied:
** mov z0\.h, h4
** fmad z0\.h, p0/m, z2\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f32.c
index 1d95eb0..d10ba69 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mla_s4_f32_x_tied2, svfloat32_t, float,
z0 = svmla_x (p0, z1, z0, d4))
/*
-** mla_s4_f32_x_untied: { xfail *-*-* }
+** mla_s4_f32_x_untied:
** mov z0\.s, s4
** fmad z0\.s, p0/m, z2\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f64.c
index 74fd292..94c1e0b 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mla_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mla_d4_f64_x_tied2, svfloat64_t, double,
z0 = svmla_x (p0, z1, z0, d4))
/*
-** mla_d4_f64_x_untied: { xfail *-*-* }
+** mla_d4_f64_x_untied:
** mov z0\.d, d4
** fmad z0\.d, p0/m, z2\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f16.c
index 87fba3d..b58104d 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mls_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svmls_x (p0, z1, z0, d4))
/*
-** mls_h4_f16_x_untied: { xfail *-*-* }
+** mls_h4_f16_x_untied:
** mov z0\.h, h4
** fmsb z0\.h, p0/m, z2\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f32.c
index 04ce1ec..7d6e605 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mls_s4_f32_x_tied2, svfloat32_t, float,
z0 = svmls_x (p0, z1, z0, d4))
/*
-** mls_s4_f32_x_untied: { xfail *-*-* }
+** mls_s4_f32_x_untied:
** mov z0\.s, s4
** fmsb z0\.s, p0/m, z2\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f64.c
index 1e2108a..a6ed28e 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mls_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (mls_d4_f64_x_tied2, svfloat64_t, double,
z0 = svmls_x (p0, z1, z0, d4))
/*
-** mls_d4_f64_x_untied: { xfail *-*-* }
+** mls_d4_f64_x_untied:
** mov z0\.d, d4
** fmsb z0\.d, p0/m, z2\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f16.c
index fe11457..894961a 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (msb_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svmsb_x (p0, z1, z0, d4))
/*
-** msb_h4_f16_x_untied: { xfail *-*-* }
+** msb_h4_f16_x_untied:
** mov z0\.h, h4
** fmls z0\.h, p0/m, z1\.h, z2\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f32.c
index f7a9f27..0d09159 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (msb_s4_f32_x_tied2, svfloat32_t, float,
z0 = svmsb_x (p0, z1, z0, d4))
/*
-** msb_s4_f32_x_untied: { xfail *-*-* }
+** msb_s4_f32_x_untied:
** mov z0\.s, s4
** fmls z0\.s, p0/m, z1\.s, z2\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f64.c
index e3ff414..52dc396 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/msb_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (msb_d4_f64_x_tied2, svfloat64_t, double,
z0 = svmsb_x (p0, z1, z0, d4))
/*
-** msb_d4_f64_x_untied: { xfail *-*-* }
+** msb_d4_f64_x_untied:
** mov z0\.d, d4
** fmls z0\.d, p0/m, z1\.d, z2\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f16.c
index ce02c3c..b8d6bf5 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f16.c
@@ -303,7 +303,7 @@ TEST_UNIFORM_ZD (mulx_h4_f16_x_tied1, svfloat16_t, __fp16,
z0 = svmulx_x (p0, z0, d4))
/*
-** mulx_h4_f16_x_untied: { xfail *-*-* }
+** mulx_h4_f16_x_untied:
** mov z0\.h, h4
** fmulx z0\.h, p0/m, z0\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f32.c
index e0d3695..b8f5c13 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f32.c
@@ -303,7 +303,7 @@ TEST_UNIFORM_ZD (mulx_s4_f32_x_tied1, svfloat32_t, float,
z0 = svmulx_x (p0, z0, d4))
/*
-** mulx_s4_f32_x_untied: { xfail *-*-* }
+** mulx_s4_f32_x_untied:
** mov z0\.s, s4
** fmulx z0\.s, p0/m, z0\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f64.c
index 6af5703..746cc94 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/mulx_f64.c
@@ -303,7 +303,7 @@ TEST_UNIFORM_ZD (mulx_d4_f64_x_tied1, svfloat64_t, double,
z0 = svmulx_x (p0, z0, d4))
/*
-** mulx_d4_f64_x_untied: { xfail *-*-* }
+** mulx_d4_f64_x_untied:
** mov z0\.d, d4
** fmulx z0\.d, p0/m, z0\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f16.c
index abfe0a0..92e0664 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmad_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svnmad_x (p0, z1, z0, d4))
/*
-** nmad_h4_f16_x_untied: { xfail *-*-* }
+** nmad_h4_f16_x_untied:
** mov z0\.h, h4
** fnmla z0\.h, p0/m, z1\.h, z2\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f32.c
index ab86385..cef731e 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmad_s4_f32_x_tied2, svfloat32_t, float,
z0 = svnmad_x (p0, z1, z0, d4))
/*
-** nmad_s4_f32_x_untied: { xfail *-*-* }
+** nmad_s4_f32_x_untied:
** mov z0\.s, s4
** fnmla z0\.s, p0/m, z1\.s, z2\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f64.c
index c236ff5..43b97c0 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmad_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmad_d4_f64_x_tied2, svfloat64_t, double,
z0 = svnmad_x (p0, z1, z0, d4))
/*
-** nmad_d4_f64_x_untied: { xfail *-*-* }
+** nmad_d4_f64_x_untied:
** mov z0\.d, d4
** fnmla z0\.d, p0/m, z1\.d, z2\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f16.c
index f7ac377..75d0ec7 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmla_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svnmla_x (p0, z1, z0, d4))
/*
-** nmla_h4_f16_x_untied: { xfail *-*-* }
+** nmla_h4_f16_x_untied:
** mov z0\.h, h4
** fnmad z0\.h, p0/m, z2\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f32.c
index ef9542d..da594d3 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmla_s4_f32_x_tied2, svfloat32_t, float,
z0 = svnmla_x (p0, z1, z0, d4))
/*
-** nmla_s4_f32_x_untied: { xfail *-*-* }
+** nmla_s4_f32_x_untied:
** mov z0\.s, s4
** fnmad z0\.s, p0/m, z2\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f64.c
index 441821f..73f15f4 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmla_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmla_d4_f64_x_tied2, svfloat64_t, double,
z0 = svnmla_x (p0, z1, z0, d4))
/*
-** nmla_d4_f64_x_untied: { xfail *-*-* }
+** nmla_d4_f64_x_untied:
** mov z0\.d, d4
** fnmad z0\.d, p0/m, z2\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f16.c
index 8aa6c75..ccf7e51 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmls_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svnmls_x (p0, z1, z0, d4))
/*
-** nmls_h4_f16_x_untied: { xfail *-*-* }
+** nmls_h4_f16_x_untied:
** mov z0\.h, h4
** fnmsb z0\.h, p0/m, z2\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f32.c
index 42ea13f..10d3450 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmls_s4_f32_x_tied2, svfloat32_t, float,
z0 = svnmls_x (p0, z1, z0, d4))
/*
-** nmls_s4_f32_x_untied: { xfail *-*-* }
+** nmls_s4_f32_x_untied:
** mov z0\.s, s4
** fnmsb z0\.s, p0/m, z2\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f64.c
index 994c2a7..bf2a441 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmls_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmls_d4_f64_x_tied2, svfloat64_t, double,
z0 = svnmls_x (p0, z1, z0, d4))
/*
-** nmls_d4_f64_x_untied: { xfail *-*-* }
+** nmls_d4_f64_x_untied:
** mov z0\.d, d4
** fnmsb z0\.d, p0/m, z2\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f16.c
index c114014..5311ceb 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f16.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmsb_h4_f16_x_tied2, svfloat16_t, __fp16,
z0 = svnmsb_x (p0, z1, z0, d4))
/*
-** nmsb_h4_f16_x_untied: { xfail *-*-* }
+** nmsb_h4_f16_x_untied:
** mov z0\.h, h4
** fnmls z0\.h, p0/m, z1\.h, z2\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f32.c
index c2204e0..6f1407a 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f32.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmsb_s4_f32_x_tied2, svfloat32_t, float,
z0 = svnmsb_x (p0, z1, z0, d4))
/*
-** nmsb_s4_f32_x_untied: { xfail *-*-* }
+** nmsb_s4_f32_x_untied:
** mov z0\.s, s4
** fnmls z0\.s, p0/m, z1\.s, z2\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f64.c
index 56592d3..5e4e1dd 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/nmsb_f64.c
@@ -281,7 +281,7 @@ TEST_UNIFORM_ZD (nmsb_d4_f64_x_tied2, svfloat64_t, double,
z0 = svnmsb_x (p0, z1, z0, d4))
/*
-** nmsb_d4_f64_x_untied: { xfail *-*-* }
+** nmsb_d4_f64_x_untied:
** mov z0\.d, d4
** fnmls z0\.d, p0/m, z1\.d, z2\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f16.c
index bf4a0ab..48a5746 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f16.c
@@ -336,7 +336,7 @@ TEST_UNIFORM_ZD (sub_h4_f16_x_tied1, svfloat16_t, __fp16,
z0 = svsub_x (p0, z0, d4))
/*
-** sub_h4_f16_x_untied: { xfail *-*-* }
+** sub_h4_f16_x_untied:
** mov z0\.h, h4
** fsubr z0\.h, p0/m, z0\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f32.c
index 05be52b..32d57be 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f32.c
@@ -336,7 +336,7 @@ TEST_UNIFORM_ZD (sub_s4_f32_x_tied1, svfloat32_t, float,
z0 = svsub_x (p0, z0, d4))
/*
-** sub_s4_f32_x_untied: { xfail *-*-* }
+** sub_s4_f32_x_untied:
** mov z0\.s, s4
** fsubr z0\.s, p0/m, z0\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f64.c
index 2179382..cdc2558 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/sub_f64.c
@@ -336,7 +336,7 @@ TEST_UNIFORM_ZD (sub_d4_f64_x_tied1, svfloat64_t, double,
z0 = svsub_x (p0, z0, d4))
/*
-** sub_d4_f64_x_untied: { xfail *-*-* }
+** sub_d4_f64_x_untied:
** mov z0\.d, d4
** fsubr z0\.d, p0/m, z0\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f16.c
index e14357d..6929b28 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f16.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f16.c
@@ -285,7 +285,7 @@ TEST_UNIFORM_ZD (subr_h4_f16_x_tied1, svfloat16_t, __fp16,
z0 = svsubr_x (p0, z0, d4))
/*
-** subr_h4_f16_x_untied: { xfail *-*-* }
+** subr_h4_f16_x_untied:
** mov z0\.h, h4
** fsub z0\.h, p0/m, z0\.h, z1\.h
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f32.c
index 98dc7ad..5bf90a3 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f32.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f32.c
@@ -285,7 +285,7 @@ TEST_UNIFORM_ZD (subr_s4_f32_x_tied1, svfloat32_t, float,
z0 = svsubr_x (p0, z0, d4))
/*
-** subr_s4_f32_x_untied: { xfail *-*-* }
+** subr_s4_f32_x_untied:
** mov z0\.s, s4
** fsub z0\.s, p0/m, z0\.s, z1\.s
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f64.c
index 81f1112..7091c40 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f64.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/asm/subr_f64.c
@@ -285,7 +285,7 @@ TEST_UNIFORM_ZD (subr_d4_f64_x_tied1, svfloat64_t, double,
z0 = svsubr_x (p0, z0, d4))
/*
-** subr_d4_f64_x_untied: { xfail *-*-* }
+** subr_d4_f64_x_untied:
** mov z0\.d, d4
** fsub z0\.d, p0/m, z0\.d, z1\.d
** ret
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c
index e1b99fa..33ed8f7 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-int svadd_n_u8_x; /* { dg-message "note: previous declaration of 'svadd_n_u8_x' was here" } */
+int svadd_n_u8_x; /* { dg-message "note: previous declaration of 'svadd_n_u8_x'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svadd_n_u8_x' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c
index 7f653f1..6799668 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-int svadd_n_u8_x = 1; /* { dg-message "note: previous definition of 'svadd_n_u8_x' was here" } */
+int svadd_n_u8_x = 1; /* { dg-message "note: previous definition of 'svadd_n_u8_x'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svadd_n_u8_x' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c
index d9ff15a..41988b2 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-extern __SVInt8_t svadd_u8_x (__SVBool_t, __SVInt8_t, __SVInt8_t); /* { dg-message "note: previous declaration of 'svadd_u8_x' was here" } */
+extern __SVInt8_t svadd_u8_x (__SVBool_t, __SVInt8_t, __SVInt8_t); /* { dg-message "note: previous declaration of 'svadd_u8_x'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svadd_u8_x'} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c
index 1f04e46..01d1ca7 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-typedef int svadd_u8_x; /* { dg-message "note: previous declaration of 'svadd_u8_x' was here" } */
+typedef int svadd_u8_x; /* { dg-message "note: previous declaration of 'svadd_u8_x'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svadd_u8_x' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c
new file mode 100644
index 0000000..05232d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c
@@ -0,0 +1,103 @@
+/* { dg-options "-msve-vector-bits=256" } */
+
+#include <arm_sve.h>
+
+typedef svint32_t vls_svint32_t __attribute__((arm_sve_vector_bits(256)));
+typedef svuint32_t vls_svuint32_t __attribute__((arm_sve_vector_bits(256)));
+
+typedef int32_t gnu_svint32_t __attribute__((vector_size(32)));
+typedef uint32_t gnu_svuint32_t __attribute__((vector_size(32)));
+
+#define X_gnu_svint32_t 1
+#define X_gnu_svuint32_t 2
+#define X_vls_svint32_t 3
+#define X_vls_svuint32_t 4
+
+#define CHECK(T) T: X_##T
+
+#define CHECK_TYPE(EXPR, TYPE) \
+ do { \
+ int x[_Generic (EXPR, \
+ CHECK (gnu_svint32_t), \
+ CHECK (gnu_svuint32_t), \
+ CHECK (vls_svint32_t), \
+ CHECK (vls_svuint32_t), \
+ default : 0) == X_##TYPE ? 1 : -1]; \
+ } while (0)
+
+void
+f (gnu_svint32_t sg, gnu_svuint32_t ug, vls_svint32_t sn, vls_svuint32_t un, int c)
+{
+ CHECK_TYPE (sg, gnu_svint32_t);
+ CHECK_TYPE (ug, gnu_svuint32_t);
+ CHECK_TYPE (sn, vls_svint32_t);
+ CHECK_TYPE (un, vls_svuint32_t);
+
+ CHECK_TYPE (sg + 1, gnu_svint32_t);
+ CHECK_TYPE (ug + 1, gnu_svuint32_t);
+ CHECK_TYPE (sn + 1, vls_svint32_t);
+ CHECK_TYPE (un + 1, vls_svuint32_t);
+
+ CHECK_TYPE (1 + sg, gnu_svint32_t);
+ CHECK_TYPE (1 + ug, gnu_svuint32_t);
+ CHECK_TYPE (1 + sn, vls_svint32_t);
+ CHECK_TYPE (1 + un, vls_svuint32_t);
+
+ CHECK_TYPE (sg + sg, gnu_svint32_t);
+ CHECK_TYPE (ug + ug, gnu_svuint32_t);
+ CHECK_TYPE (sn + sn, vls_svint32_t);
+ CHECK_TYPE (un + un, vls_svuint32_t);
+
+ /* Traditional behavior for mixed signs is to pick the signedness of the
+ first operand. We don't have any Arm-specific reason for preferring that
+ behavior. */
+ CHECK_TYPE (sg + ug, gnu_svint32_t);
+ CHECK_TYPE (ug + sg, gnu_svuint32_t);
+ CHECK_TYPE (sn + un, vls_svint32_t);
+ CHECK_TYPE (un + sn, vls_svuint32_t);
+
+ CHECK_TYPE (c ? sg + sg : sg, gnu_svint32_t);
+ CHECK_TYPE (c ? ug + ug : ug, gnu_svuint32_t);
+ CHECK_TYPE (c ? sn + sn : sn, vls_svint32_t);
+ CHECK_TYPE (c ? un + un : un, vls_svuint32_t);
+
+ CHECK_TYPE (c ? sg + 1 : sg, gnu_svint32_t);
+ CHECK_TYPE (c ? ug + 1 : ug, gnu_svuint32_t);
+ CHECK_TYPE (c ? sn + 1 : sn, vls_svint32_t);
+ CHECK_TYPE (c ? un + 1 : un, vls_svuint32_t);
+
+ CHECK_TYPE (c ? 1 + sg : sg, gnu_svint32_t);
+ CHECK_TYPE (c ? 1 + ug : ug, gnu_svuint32_t);
+ CHECK_TYPE (c ? 1 + sn : sn, vls_svint32_t);
+ CHECK_TYPE (c ? 1 + un : un, vls_svuint32_t);
+
+ CHECK_TYPE (c ? sg : sg + sg, gnu_svint32_t);
+ CHECK_TYPE (c ? ug : ug + ug, gnu_svuint32_t);
+ CHECK_TYPE (c ? sn : sn + sn, vls_svint32_t);
+ CHECK_TYPE (c ? un : un + un, vls_svuint32_t);
+
+ CHECK_TYPE (c ? sg : sg + 1, gnu_svint32_t);
+ CHECK_TYPE (c ? ug : ug + 1, gnu_svuint32_t);
+ CHECK_TYPE (c ? sn : sn + 1, vls_svint32_t);
+ CHECK_TYPE (c ? un : un + 1, vls_svuint32_t);
+
+ CHECK_TYPE (c ? sg : 1 + sg, gnu_svint32_t);
+ CHECK_TYPE (c ? ug : 1 + ug, gnu_svuint32_t);
+ CHECK_TYPE (c ? sn : 1 + sn, vls_svint32_t);
+ CHECK_TYPE (c ? un : 1 + un, vls_svuint32_t);
+
+ CHECK_TYPE (c ? sg + sg : sg + sg, gnu_svint32_t);
+ CHECK_TYPE (c ? ug + ug : ug + ug, gnu_svuint32_t);
+ CHECK_TYPE (c ? sn + sn : sn + sn, vls_svint32_t);
+ CHECK_TYPE (c ? un + un : un + un, vls_svuint32_t);
+
+ CHECK_TYPE (c ? sg + sg : sg + 1, gnu_svint32_t);
+ CHECK_TYPE (c ? ug + ug : ug + 1, gnu_svuint32_t);
+ CHECK_TYPE (c ? sn + sn : sn + 1, vls_svint32_t);
+ CHECK_TYPE (c ? un + un : un + 1, vls_svuint32_t);
+
+ CHECK_TYPE (c ? 1 + sg : sg + sg, gnu_svint32_t);
+ CHECK_TYPE (c ? 1 + ug : ug + ug, gnu_svuint32_t);
+ CHECK_TYPE (c ? 1 + sn : sn + sn, vls_svint32_t);
+ CHECK_TYPE (c ? 1 + un : un + un, vls_svuint32_t);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c
index 3af36de..c575492 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c
@@ -106,8 +106,8 @@ statements (int n)
/* Pointer assignment. */
- gnu_sc_ptr = sve_sc_ptr;
- sve_sc_ptr = gnu_sc_ptr;
+ gnu_sc_ptr = sve_sc_ptr; /* { dg-warning {incompatible pointer type} } */
+ sve_sc_ptr = gnu_sc_ptr; /* { dg-warning {incompatible pointer type} } */
/* Pointer arithmetic. */
@@ -120,8 +120,8 @@ statements (int n)
sve_sc_ptr -= 0; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */
sve_sc_ptr -= 1; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */
sve_sc_ptr - sve_sc_ptr; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */
- gnu_sc_ptr - sve_sc_ptr; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */
- sve_sc_ptr - gnu_sc_ptr; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */
+ gnu_sc_ptr - sve_sc_ptr; /* { dg-error {invalid operands to binary -} } */
+ sve_sc_ptr - gnu_sc_ptr; /* { dg-error {invalid operands to binary -} } */
sve_sc1 = sve_sc_ptr[0]; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */
sve_sc1 = sve_sc_ptr[1]; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */
@@ -133,18 +133,18 @@ statements (int n)
sve_sc_ptr <= &sve_sc1;
sve_sc_ptr > &sve_sc1;
sve_sc_ptr >= &sve_sc1;
- gnu_sc_ptr == sve_sc_ptr;
- gnu_sc_ptr != sve_sc_ptr;
- gnu_sc_ptr < sve_sc_ptr;
- gnu_sc_ptr <= sve_sc_ptr;
- gnu_sc_ptr > sve_sc_ptr;
- gnu_sc_ptr >= sve_sc_ptr;
- sve_sc_ptr == gnu_sc_ptr;
- sve_sc_ptr != gnu_sc_ptr;
- sve_sc_ptr < gnu_sc_ptr;
- sve_sc_ptr <= gnu_sc_ptr;
- sve_sc_ptr > gnu_sc_ptr;
- sve_sc_ptr >= gnu_sc_ptr;
+ gnu_sc_ptr == sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ gnu_sc_ptr != sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ gnu_sc_ptr < sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ gnu_sc_ptr <= sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ gnu_sc_ptr > sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ gnu_sc_ptr >= sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ sve_sc_ptr == gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ sve_sc_ptr != gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ sve_sc_ptr < gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ sve_sc_ptr <= gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ sve_sc_ptr > gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
+ sve_sc_ptr >= gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */
/* Conditional expressions. */
@@ -154,8 +154,8 @@ statements (int n)
0 ? 0 : sve_sc1; /* { dg-error {type mismatch in conditional expression} } */
0 ?: sve_sc1; /* { dg-error {type mismatch in conditional expression} } */
0 ? sve_sc_ptr : sve_sc_ptr;
- 0 ? sve_sc_ptr : gnu_sc_ptr;
- 0 ? gnu_sc_ptr : sve_sc_ptr;
+ 0 ? sve_sc_ptr : gnu_sc_ptr; /* { dg-warning {pointer type mismatch} } */
+ 0 ? gnu_sc_ptr : sve_sc_ptr; /* { dg-warning {pointer type mismatch} } */
/* Generic associations. */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c
index 70b2d9d..28fba53 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t' was here" } */
+int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svbool_t' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c
index 8278c1c..22b7934 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-typedef struct svint8x2_t svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */
+typedef struct svint8x2_t svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svint8x2_t'} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c
index 62bab1f..61449a0 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-#pragma GCC aarch64 "arm_sve.h" /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */
+#pragma GCC aarch64 "arm_sve.h" /* { dg-message "note: previous declaration of 'svint8x2_t'" } */
int svint8x2_t; /* { dg-error {'svint8x2_t' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c
index ffd86ae..a4afb78 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-int svint8_t; /* { dg-message "note: previous declaration of 'svint8_t' was here" } */
+int svint8_t; /* { dg-message "note: previous declaration of 'svint8_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svint8_t' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c
index f42dd96..c22c105 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-int svuint16_t; /* { dg-message "note: previous declaration of 'svuint16_t' was here" } */
+int svuint16_t; /* { dg-message "note: previous declaration of 'svuint16_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svuint16_t' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c
index 91c95a1..2c4014e 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-int svfloat32_t; /* { dg-message "note: previous declaration of 'svfloat32_t' was here" } */
+int svfloat32_t; /* { dg-message "note: previous declaration of 'svfloat32_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svfloat32_t' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c
index 3cb6b8a..30bf077 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-typedef int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t' was here" } */
+typedef int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svbool_t'} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c
index c051897..5d81b2b 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-typedef __SVBool_t svbool_t; /* { dg-message "note: previous declaration of 'svbool_t' was here" } */
+typedef __SVBool_t svbool_t; /* { dg-message "note: previous declaration of 'svbool_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {redefinition of typedef 'svbool_t'} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c
index 41614a3..88ed541 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */
+int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svint8x2_t' redeclared} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c
index 83b6855..ec67386 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-typedef int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */
+typedef int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t'" } */
#pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svint8x2_t'} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c
index e2e7470..621666c 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c
@@ -85,19 +85,19 @@ f (int c)
(void) (c ? fs8 : ss8); // { dg-error {type mismatch|different types} }
(void) (c ? fs8 : fs8);
- (void) (c ? fs8 : gs8); // { dg-error {type mismatch|different types} "" { xfail c++ } }
+ (void) (c ? fs8 : gs8); // { dg-error {type mismatch|different types} }
(void) (c ? gs8 : ss8); // { dg-error {type mismatch|different types} }
- (void) (c ? gs8 : fs8); // { dg-error {type mismatch|different types} "" { xfail c++ } }
+ (void) (c ? gs8 : fs8); // { dg-error {type mismatch|different types} }
(void) (c ? gs8 : gs8);
sb = fb;
fb = sb;
(void) (c ? sb : sb);
- (void) (c ? sb : fb); // { dg-error {type mismatch|different types} "" { xfail *-*-* } }
+ (void) (c ? sb : fb); // { dg-error {type mismatch|different types} "" { xfail c } }
- (void) (c ? fb : sb); // { dg-error {type mismatch|different types} "" { xfail *-*-* } }
+ (void) (c ? fb : sb); // { dg-error {type mismatch|different types} "" { xfail c } }
(void) (c ? fb : fb);
}
@@ -123,24 +123,22 @@ g (int c)
void *select __attribute__((unused));
diff = ss8 - ss8; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
- diff = ss8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } }
- // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 }
- diff = ss8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } }
- // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 }
+ diff = ss8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" }
+ diff = ss8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" }
- diff = fs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } }
- // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 }
+ diff = fs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" }
diff = fs8 - fs8;
- diff = fs8 - gs8;
+ diff = fs8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" }
- diff = gs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } }
- // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 }
- diff = gs8 - fs8;
+ diff = gs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" }
+ diff = gs8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" }
diff = gs8 - gs8;
- fs8 = ss8; // { dg-error {invalid conversion} "" { xfail c } }
+ fs8 = ss8; // { dg-error {invalid conversion} "" { target c++ } }
+ // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
fs8 = fs8;
- fs8 = gs8;
+ fs8 = gs8; // { dg-error {invalid conversion} "" { target c++ } }
+ // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
fs8 = su8; // { dg-error {cannot convert} "c++" { target c++ } }
// { dg-warning {incompatible pointer type} "c" { target c } .-1 }
@@ -150,36 +148,48 @@ g (int c)
// { dg-warning {incompatible pointer type} "c" { target c } .-1 }
fs8 = ss16; // { dg-error {cannot convert} "c++" { target c++ } }
- // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
+ // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
fs8 = fs16; // { dg-error {cannot convert} "c++" { target c++ } }
- // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
+ // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
fs8 = gs16; // { dg-error {cannot convert} "c++" { target c++ } }
- // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
+ // { dg-warning {incompatible pointer type} "c" { target c } .-1 }
select = c ? ss8 : ss8;
- select = c ? ss8 : fs8; // { dg-error {distinct pointer types} "" { xfail c } }
- select = c ? ss8 : gs8; // { dg-error {distinct pointer types} "" { xfail c } }
+ select = c ? ss8 : fs8; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c } .-1 }
+ select = c ? ss8 : gs8; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c } .-1 }
- select = c ? fs8 : ss8; // { dg-error {distinct pointer types} "" { xfail c } }
+ select = c ? fs8 : ss8; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c } .-1 }
select = c ? fs8 : fs8;
- select = c ? fs8 : gs8; // { dg-error {distinct pointer types} "" { xfail *-*-* } }
+ select = c ? fs8 : gs8; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c } .-1 }
- select = c ? gs8 : ss8; // { dg-error {distinct pointer types} "" { xfail c } }
- select = c ? gs8 : fs8; // { dg-error {distinct pointer types} "" { xfail *-*-* } }
+ select = c ? gs8 : ss8; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c } .-1 }
+ select = c ? gs8 : fs8; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c } .-1 }
select = c ? gs8 : gs8;
diff = sb - sb; // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} }
- diff = sb - fb; // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} }
+ diff = sb - fb; // { dg-error {invalid operands} "" { target c++ } }
+ // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} "c" { target c } .-1 }
- diff = fb - sb; // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} }
+ diff = fb - sb; // { dg-error {invalid operands} "" { target c++ } }
+ // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} "c" { target c } .-1 }
diff = fb - fb;
- sb = fb;
- fb = sb;
+ sb = fb; // { dg-error {invalid conversion} "" { target c++ } }
+ // { dg-warning {incompatible pointer type} "c" { target c xfail c } .-1 }
+ fb = sb; // { dg-error {invalid conversion} "" { target c++ } }
+ // { dg-warning {incompatible pointer type} "c" { target c xfail c } .-1 }
select = c ? sb : sb;
- select = c ? sb : fb; // { dg-error {type mismatch|different types} "" { xfail *-*-* } }
+ select = c ? sb : fb; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c xfail c } .-1 }
- select = c ? fb : sb; // { dg-error {type mismatch|different types} "" { xfail *-*-* } }
+ select = c ? fb : sb; // { dg-error {distinct pointer types} "" { target c++ } }
+ // { dg-warning {pointer type mismatch} "c" { target c xfail c } .-1 }
select = c ? fb : fb;
}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cntb_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cntb_1.c
new file mode 100644
index 0000000..b43fcf0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cntb_1.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <arm_sve.h>
+
+unsigned int
+foo (unsigned int x)
+{
+ unsigned long tmp = x;
+ tmp += svcntb ();
+ x = tmp;
+ return x - svcntb ();
+}
+
+/* { dg-final { scan-tree-dump-not { POLY_INT_CST } optimized } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c
new file mode 100644
index 0000000..7f1079c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c
@@ -0,0 +1,17 @@
+/* { dg-options "-Os" } */
+
+#include <arm_sve.h>
+extern char b[];
+int x;
+void f() {
+ while (x) {
+ x = svaddv(
+ svnot_z(svnot_z(svptrue_pat_b8(SV_VL6),
+ svmov_z(svptrue_pat_b8(SV_VL1),
+ svptrue_pat_b16(SV_VL3))),
+ svptrue_pat_b64(SV_VL2)),
+ svdup_s32(8193));
+ for (int j = x; j; j++)
+ b[j] = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/clastb_4.c b/gcc/testsuite/gcc.target/aarch64/sve/clastb_4.c
index 788e29f..7603d47 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/clastb_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/clastb_4.c
@@ -6,4 +6,4 @@
#include "clastb_2.c"
/* { dg-final { scan-tree-dump "operating on partial vectors." "vect" } } */
-/* { dg-final { scan-assembler {\tclastb\tw[0-9]+, p[0-7], w[0-9]+, z[0-9]+\.h} } } */
+/* { dg-final { scan-assembler {\tclastb\th[0-9]+, p[0-7], h[0-9]+, z[0-9]+\.h} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/cond_arith_6.c b/gcc/testsuite/gcc.target/aarch64/sve/cond_arith_6.c
new file mode 100644
index 0000000..4085ab1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/cond_arith_6.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O3 -msve-vector-bits=128" } */
+
+void
+f (float *x)
+{
+ for (int i = 0; i < 100; ++i)
+ if (x[i] > 1.0f)
+ x[i] -= 1.0f;
+}
+
+/* { dg-final { scan-assembler {\tld1w\tz} } } */
+/* { dg-final { scan-assembler {\tfcmgt\tp} } } */
+/* { dg-final { scan-assembler {\tfsub\tz} } } */
+/* { dg-final { scan-assembler {\tst1w\tz} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_12.c b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_12.c
new file mode 100644
index 0000000..4c5226e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_12.c
@@ -0,0 +1,19 @@
+/* { dg-options "-O3 -mtune=neoverse-512tvb" } */
+
+void
+f (float x[restrict 10][1024],
+ float y[restrict 10][1024], float z)
+{
+ for (int i = 0; i < 10; ++i)
+ {
+#pragma GCC unroll 10
+ for (int j = 0; j < 10; ++j)
+ x[j][i] = y[j][i] * z;
+ }
+}
+
+/* We should unroll the outer loop, with 2x 16-byte vectors and 1x
+ 8-byte vectors. */
+/* { dg-final { scan-assembler-not {\tptrue\t} } } */
+/* { dg-final { scan-assembler {\tv[0-9]+\.4s,} } } */
+/* { dg-final { scan-assembler {\tv[0-9]+\.2s,} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_1.c b/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_1.c
index 532847b..39b46da 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_1.c
@@ -56,15 +56,19 @@ TEST_ALL (DUP_LANE)
/* { dg-final { scan-assembler-not {\ttbl\t} } } */
-/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.d, z[0-9]+\.d\[0\]} 2 } } */
+/* { dg-final { scan-assembler-times {\tmov\tz[0-9]+\.d, d[0-9]} 2 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.d, z[0-9]+\.d\[0\]} 2 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.d, z[0-9]+\.d\[2\]} 2 } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.d, z[0-9]+\.d\[3\]} 2 } } */
-/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.s, z[0-9]+\.s\[0\]} 2 } } */
+/* { dg-final { scan-assembler-times {\tmov\tz[0-9]+\.s, s[0-9]} 2 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.s, z[0-9]+\.s\[0\]} 2 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.s, z[0-9]+\.s\[5\]} 2 } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.s, z[0-9]+\.s\[7\]} 2 } } */
-/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.h, z[0-9]+\.h\[0\]} 2 } } */
+/* { dg-final { scan-assembler-times {\tmov\tz[0-9]+\.h, h[0-9]} 2 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.h, z[0-9]+\.h\[0\]} 2 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.h, z[0-9]+\.h\[6\]} 2 } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.h, z[0-9]+\.h\[15\]} 2 } } */
-/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.b, z[0-9]+\.b\[0\]} 1 } } */
+/* { dg-final { scan-assembler-times {\tmov\tz[0-9]+\.b, b[0-9]} 1 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.b, z[0-9]+\.b\[0\]} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.b, z[0-9]+\.b\[19\]} 1 } } */
/* { dg-final { scan-assembler-times {\tdup\tz[0-9]+\.b, z[0-9]+\.b\[31\]} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/extract_1.c b/gcc/testsuite/gcc.target/aarch64/sve/extract_1.c
index df51ce3..dbcc1d9 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/extract_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/extract_1.c
@@ -56,7 +56,8 @@ typedef _Float16 vnx8hf __attribute__((vector_size (32)));
TEST_ALL (EXTRACT)
-/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tx[0-9]+, d[0-9]\n} 2 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\td[0-9]+, v[0-9]+\.d\[0\]\n} } } */
/* { dg-final { scan-assembler-times {\tdup\td[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
@@ -64,7 +65,8 @@ TEST_ALL (EXTRACT)
/* { dg-final { scan-assembler-times {\tlastb\tx[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
/* { dg-final { scan-assembler-times {\tlastb\td[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tw[0-9]+, s[0-9]\n} 2 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[3\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\ts[0-9]+, v[0-9]+\.s\[0\]\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/extract_2.c b/gcc/testsuite/gcc.target/aarch64/sve/extract_2.c
index 0642604..a487746 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/extract_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/extract_2.c
@@ -56,7 +56,8 @@ typedef _Float16 vnx16hf __attribute__((vector_size (64)));
TEST_ALL (EXTRACT)
-/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tx[0-9]+, d[0-9]\n} 2 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\td[0-9]+, v[0-9]+\.d\[0\]\n} } } */
/* { dg-final { scan-assembler-times {\tdup\td[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
@@ -64,7 +65,8 @@ TEST_ALL (EXTRACT)
/* { dg-final { scan-assembler-times {\tlastb\tx[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
/* { dg-final { scan-assembler-times {\tlastb\td[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tw[0-9]+, s[0-9]\n} 2 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[3\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\ts[0-9]+, v[0-9]+\.s\[0\]\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/extract_3.c b/gcc/testsuite/gcc.target/aarch64/sve/extract_3.c
index 604f1f6..bf10bf1 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/extract_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/extract_3.c
@@ -77,7 +77,8 @@ typedef _Float16 vnx32hf __attribute__((vector_size (128)));
TEST_ALL (EXTRACT)
-/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tx[0-9]+, d[0-9]\n} 5 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\td[0-9]+, v[0-9]+\.d\[0\]\n} } } */
/* { dg-final { scan-assembler-times {\tdup\td[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
@@ -86,7 +87,8 @@ TEST_ALL (EXTRACT)
/* { dg-final { scan-assembler-times {\tlastb\tx[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
/* { dg-final { scan-assembler-times {\tlastb\td[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tw[0-9]+, s[0-9]\n} 5 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[3\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\ts[0-9]+, v[0-9]+\.s\[0\]\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/extract_4.c b/gcc/testsuite/gcc.target/aarch64/sve/extract_4.c
index 8b45e317..9805678 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/extract_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/extract_4.c
@@ -84,7 +84,8 @@ typedef _Float16 v128hf __attribute__((vector_size (256)));
TEST_ALL (EXTRACT)
-/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tx[0-9]+, d[0-9]\n} 6 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\td[0-9]+, v[0-9]+\.d\[0\]\n} } } */
/* { dg-final { scan-assembler-times {\tdup\td[0-9]+, v[0-9]+\.d\[1\]\n} 1 } } */
@@ -93,7 +94,8 @@ TEST_ALL (EXTRACT)
/* { dg-final { scan-assembler-times {\tlastb\tx[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
/* { dg-final { scan-assembler-times {\tlastb\td[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tfmov\tw[0-9]+, s[0-9]\n} 6 { target aarch64_little_endian } } } */
+/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[0\]\n} 1 { target aarch64_big_endian } } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[1\]\n} 1 } } */
/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s\[3\]\n} 1 } } */
/* { dg-final { scan-assembler-not {\tdup\ts[0-9]+, v[0-9]+\.s\[0\]\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/ld1_extend.c b/gcc/testsuite/gcc.target/aarch64/sve/ld1_extend.c
new file mode 100644
index 0000000..7f78cb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/ld1_extend.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+void foo (signed char * __restrict__ a, signed char * __restrict__ b, short * __restrict__ c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ c[i] = a[i] + b[i];
+}
+
+/* { dg-final { scan-assembler-times {\tld1sb\t} 4 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/live_1.c b/gcc/testsuite/gcc.target/aarch64/sve/live_1.c
index e8d92ec..80ee176 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/live_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/live_1.c
@@ -32,10 +32,9 @@ TEST_ALL (EXTRACT_LAST)
/* { dg-final { scan-assembler-times {\twhilelo\tp[0-7].s, } 4 } } */
/* { dg-final { scan-assembler-times {\twhilelo\tp[0-7].d, } 4 } } */
-/* { dg-final { scan-assembler-times {\tlastb\tw[0-9]+, p[0-7], z[0-9]+\.b\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tlastb\tw[0-9]+, p[0-7], z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tlastb\tb[0-9]+, p[0-7], z[0-9]+\.b\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tlastb\th[0-9]+, p[0-7], z[0-9]+\.h\n} 2 } } */
/* { dg-final { scan-assembler-times {\tlastb\tw[0-9]+, p[0-7], z[0-9]+\.s\n} 1 } } */
/* { dg-final { scan-assembler-times {\tlastb\tx[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tlastb\th[0-9]+, p[0-7], z[0-9]+\.h\n} 1 } } */
/* { dg-final { scan-assembler-times {\tlastb\ts[0-9]+, p[0-7], z[0-9]+\.s\n} 1 } } */
/* { dg-final { scan-assembler-times {\tlastb\td[0-9]+, p[0-7], z[0-9]+\.d\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c
index 08b2745..505767a 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */
/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c
index c823470..f7d4360 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c
index 52c9291..1aef903 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint16_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxth\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c
index 1552ed8..fb58b52 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */
/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c
index 484d9da..34b2cc0 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c
@@ -10,7 +10,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2){
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c
index 23ddeb9..529c073 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */
/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c
index 4dd1e08..b6b0119 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c
index a31a2d4..a61eed4 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint16_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxth\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c
index 416567b..a3fde4b 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */
/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c
index 3f7c3dd..8e01f3f 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c
@@ -10,7 +10,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2){
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c
index 593de65..763c81b 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */
/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c
index ec34e75..17fddcd 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c
index 561a104..4e8c4d0 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint16_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxth\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c
index 3ce1c3f..26103cf 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c
@@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2)
/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */
/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c
index e6a4291..06e1b58 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c
@@ -10,7 +10,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2){
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */
-/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */
+/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */
/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
/* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c b/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c
index ff049f5..b57e321 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c
@@ -21,14 +21,14 @@ TEST_TYPE (uint8_t, 32, 2, 250)
TEST_TYPE (int8_t, 64, -110, 110)
TEST_TYPE (uint8_t, 64, 3, 253)
-TEST_TYPE (int16_t, 64, -128, 123)
+TEST_TYPE (int16_t, 64, -123, 123)
TEST_TYPE (uint16_t, 64, 3, 255)
-TEST_TYPE (int8_t, 128, -120, 120)
+TEST_TYPE (int8_t, 128, -119, 120)
TEST_TYPE (uint8_t, 128, 4, 251)
-TEST_TYPE (int16_t, 128, -128, 123)
+TEST_TYPE (int16_t, 128, -123, 123)
TEST_TYPE (uint16_t, 128, 2, 255)
-TEST_TYPE (int32_t, 128, -128, 123)
+TEST_TYPE (int32_t, 128, -123, 123)
TEST_TYPE (uint32_t, 128, 4, 255)
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, p[0-7]/m, z[0-9]+\.b, z[0-9]+\.b\n} 6 } } */
@@ -37,9 +37,9 @@ TEST_TYPE (uint32_t, 128, 4, 255)
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-100\n} 1 } } */
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-110\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-120\n} 1 } } */
-/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.h, z[0-9]+\.h, #-128\n} 2 } } */
-/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.s, z[0-9]+\.s, #-128\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-119\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.h, z[0-9]+\.h, #-123\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.s, z[0-9]+\.s, #-123\n} 1 } } */
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #50\n} 6 } } */
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.h, z[0-9]+\.h, #50\n} 4 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/part_vect_single_iter_epilog.c b/gcc/testsuite/gcc.target/aarch64/sve/part_vect_single_iter_epilog.c
new file mode 100644
index 0000000..a03229e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/part_vect_single_iter_epilog.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+void
+foo (short * __restrict__ a, short * __restrict__ b, short * __restrict__ c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ c[i] = a[i] + b[i];
+}
+
+/* { dg-final { scan-assembler-times {\twhilelo\tp[0-9]+.h, wzr, [xw][0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c b/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c
new file mode 100644
index 0000000..5259338
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c
@@ -0,0 +1,25 @@
+/* { dg-additional-options "-O2 -fno-schedule-insns" } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "arm_sve.h"
+
+/*
+** foo:
+** ptrue (p[0-7])\.d, all
+** pfalse (p[0-7])\.b
+** ptrue (p[0-7])\.s, all
+** trn1 (p[0-7])\.d, \2\.d, \3\.d
+** trn1 \2\.d, \1\.d, \3\.d
+** faddv (h[0-31]), \4\, (z[0-31]).h
+** faddv (h[0-31]), \2\, \6\.h
+** str \5, [x0]
+** str \7, [x0, 2]
+** ret
+*/
+void foo(svfloat16_t in, float16_t *dst) {
+ const svbool_t pg_q0 = svdupq_n_b16(1, 0, 1, 0, 0, 0, 0, 0);
+ const svbool_t pg_f0 = svdupq_n_b16(1, 0, 0, 0, 0, 0, 0, 0);
+ dst[0] = svaddv_f16(pg_f0, in);
+ dst[1] = svaddv_f16(pg_q0, in);
+}
+
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr100302.c b/gcc/testsuite/gcc.target/aarch64/sve/pr100302.c
new file mode 100644
index 0000000..de6e8f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr100302.c
@@ -0,0 +1,12 @@
+/* PR target/100302 */
+/* { dg-do compile } */
+/* { dg-options "-march=armv8.2-a+sve -O1 -ftree-loop-vectorize -fno-tree-scev-cprop --param vect-partial-vector-usage=0 -fvect-cost-model=unlimited" } */
+
+long int x;
+
+void
+foo (void)
+{
+ for (x = 0; x >= 0; ++x)
+ ;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr81003.c b/gcc/testsuite/gcc.target/aarch64/sve/pr81003.c
new file mode 100644
index 0000000..661a6f9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr81003.c
@@ -0,0 +1,10 @@
+/* { dg-options "-O3" } */
+
+unsigned int a, b;
+
+void
+foo (void)
+{
+ for (b = 0; b < 13; b += 2)
+ a &= !!b;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c b/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c
index 7e7be4e..818291e 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c
@@ -11,5 +11,6 @@ f (int *restrict x, int *restrict y, int *restrict z, int n)
}
}
-/* { dg-final { scan-assembler-times {\tld2w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 2 } } */
-/* { dg-final { scan-assembler-times {\tst2w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7], \[x[0-9]+, x[0-9]+, lsl 2\]\n} 1 } } */
+/* { dg-final { scan-assembler {\tptrue\tp[0-7]\.d, all\n} } } */
+/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+.s, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+.s, p[0-7], \[x[0-9]+, x[0-9]+, lsl 2\]\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c b/gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c
new file mode 100644
index 0000000..5936b87
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+void
+f (int *restrict x, int *restrict y, int *restrict z, int n)
+{
+ for (int i = 0; i < n; i += 3)
+ {
+ x[i] = y[i] + z[i];
+ x[i + 1] = y[i + 1] - z[i + 1];
+ x[i + 2] = y[i + 2] | z[i + 2];
+ }
+}
+
+/* { dg-final { scan-assembler-times {\tld3w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tst3w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7], \[x[0-9]+, x[0-9]+, lsl 2\]\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr97141.c b/gcc/testsuite/gcc.target/aarch64/sve/pr97141.c
new file mode 100644
index 0000000..942e4a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr97141.c
@@ -0,0 +1,10 @@
+/* { dg-options "-O3" } */
+
+int a;
+short b, c;
+short d(short e, short f) { return e + f; }
+void g(void) {
+ a = -9;
+ for (; a != 51; a = d(a, 5))
+ b |= c;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98119.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98119.c
new file mode 100644
index 0000000..da6208c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98119.c
@@ -0,0 +1,13 @@
+/* { dg-options "-O3 -msve-vector-bits=512 -mtune=thunderx" } */
+
+void
+f (unsigned short *x)
+{
+ for (int i = 0; i < 1000; ++i)
+ x[i] += x[i - 16];
+}
+
+/* { dg-final { scan-assembler-not {\tubfx\t[wx][0-9]+, [wx][0-9]+, #?1, #?5\n} } } */
+/* { dg-final { scan-assembler-not {\tand\tx[0-9]+, x[0-9]+, #?-63\n} } } */
+/* { dg-final { scan-assembler {\tubfx\t[wx][0-9]+, [wx][0-9]+, #?1, #?4\n} } } */
+/* { dg-final { scan-assembler {\tand\tx[0-9]+, x[0-9]+, #?-31\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c
new file mode 100644
index 0000000..fdbe55e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c
@@ -0,0 +1,11 @@
+/* { dg-do link } */
+/* { dg-options "-flto -O -ftree-vectorize --param=aarch64-autovec-preference=3" } */
+/* { dg-additional-sources "pr98268-2.c" } */
+
+short d, e;
+void f(char, long*);
+int main() {
+ long x;
+ f(-114, &x);
+ return d == e;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c
new file mode 100644
index 0000000..de3b05d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize --param=aarch64-autovec-preference=3" } */
+
+extern short d[], e[];
+void f(char a, long *b) {
+ for (int c = 0; c < a - 12; c++) {
+ d[c] = b[c];
+ e[c] = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98726.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98726.c
new file mode 100644
index 0000000..2395cab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98726.c
@@ -0,0 +1,9 @@
+/* { dg-options "-O3" } */
+
+int a, c;
+char b;
+int d() {
+ a = 0;
+ for (; a <= 21; a = (short)a + 1)
+ b &= c;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c
new file mode 100644
index 0000000..f4b95da
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O3" } */
+
+void
+f (int *restrict x, int *restrict y, int *restrict z, int n)
+{
+ for (int i = 0; i < n; i += 3)
+ {
+ x[i] = y[i] + z[i];
+ x[i + 1] = y[i + 1] - z[i + 1];
+ x[i + 2] = y[i + 2] | z[i + 2];
+ }
+}
+
+/* { dg-final { scan-assembler-times {\tld3w\t} 2 } } */
+/* { dg-final { scan-assembler-times {\tst3w\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c
new file mode 100644
index 0000000..03dc4ef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c
@@ -0,0 +1,18 @@
+/* { dg-options "-O3" } */
+
+#include <stdint.h>
+
+void __attribute ((noipa))
+foo (uint64_t *__restrict x, uint64_t *__restrict y, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ x[i] += y[i];
+ x[i + 1] += y[i + 1];
+ x[i + 2] |= y[i + 2];
+ x[i + 3] |= y[i + 3];
+ }
+}
+
+/* { dg-final { scan-assembler-times {\tld4d\t} 2 } } */
+/* { dg-final { scan-assembler-times {\tst4d\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c
new file mode 100644
index 0000000..87a0141
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c
@@ -0,0 +1,18 @@
+/* { dg-options "-O3" } */
+
+#include <stdint.h>
+
+void __attribute ((noipa))
+foo (uint32_t *__restrict x, uint32_t *__restrict y, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ x[i] += y[i];
+ x[i + 1] += y[i + 1];
+ x[i + 2] |= y[i + 2];
+ x[i + 3] |= y[i + 3];
+ }
+}
+
+/* { dg-final { scan-assembler-times {\tld4w\t} 2 } } */
+/* { dg-final { scan-assembler-times {\tst4w\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c
new file mode 100644
index 0000000..1fe1813
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target aarch64_sve_hw } } */
+/* { dg-options "-O2 -ftree-vectorize" } */
+
+#include <arm_sve.h>
+
+static void e(short *g, short p2) { *g ^= p2; }
+static short m[23];
+int main() {
+ for (unsigned i = 0; i < 23; ++i)
+ m[i] = 4;
+ if (svaddv(svptrue_pat_b32(SV_VL1), svdup_u32(1)) != 1)
+ __builtin_abort();
+ for (unsigned i = 0; i < 3; ++i)
+ e(m, m[i]);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c
new file mode 100644
index 0000000..50d432d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c
@@ -0,0 +1,5 @@
+/* { dg-options "-O2 -ftree-vectorize" } */
+
+#include "pr99929_1.c"
+
+/* { dg-final { scan-assembler {\tptrue\tp[0-7].[bhsd], vl1\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_10.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_10.c
new file mode 100644
index 0000000..fb817b7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_10.c
@@ -0,0 +1,77 @@
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+unsigned short __attribute__((noipa))
+add_loop (unsigned short *x, int n)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < n; ++i)
+ res += x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+min_loop (unsigned short *x, int n)
+{
+ unsigned short res = ~0;
+ for (int i = 0; i < n; ++i)
+ res = res < x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+max_loop (unsigned short *x, int n)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < n; ++i)
+ res = res > x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+and_loop (unsigned short *x, int n)
+{
+ unsigned short res = ~0;
+ for (int i = 0; i < n; ++i)
+ res &= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+or_loop (unsigned short *x, int n)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < n; ++i)
+ res |= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+eor_loop (unsigned short *x, int n)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < n; ++i)
+ res ^= x[i];
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tuaddv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumin\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tuminv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumax\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tumaxv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tandv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teorv\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_10_run.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_10_run.c
new file mode 100644
index 0000000..1dd579b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_10_run.c
@@ -0,0 +1,49 @@
+/* { dg-do run { target aarch64_sve_hw } } */
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+#define N 0x1100
+
+#include "reduc_10.c"
+
+int
+main (void)
+{
+ unsigned short x[N];
+ for (int i = 0; i < N; ++i)
+ x[i] = (i + 1) * (i + 2);
+
+ if (add_loop (x, 0) != 0
+ || add_loop (x, 11) != 572
+ || add_loop (x, 0x100) != 22016
+ || add_loop (x, 0xfff) != 20480
+ || max_loop (x, 0) != 0
+ || max_loop (x, 11) != 132
+ || max_loop (x, 0x100) != 65280
+ || max_loop (x, 0xfff) != 65504
+ || or_loop (x, 0) != 0
+ || or_loop (x, 11) != 0xfe
+ || or_loop (x, 0x80) != 0x7ffe
+ || or_loop (x, 0xb4) != 0x7ffe
+ || or_loop (x, 0xb5) != 0xfffe
+ || eor_loop (x, 0) != 0
+ || eor_loop (x, 11) != 0xe8
+ || eor_loop (x, 0x100) != 0xcf00
+ || eor_loop (x, 0xfff) != 0xa000)
+ __builtin_abort ();
+
+ for (int i = 0; i < N; ++i)
+ x[i] = ~x[i];
+
+ if (min_loop (x, 0) != 65535
+ || min_loop (x, 11) != 65403
+ || min_loop (x, 0x100) != 255
+ || min_loop (x, 0xfff) != 31
+ || and_loop (x, 0) != 0xffff
+ || and_loop (x, 11) != 0xff01
+ || and_loop (x, 0x80) != 0x8001
+ || and_loop (x, 0xb4) != 0x8001
+ || and_loop (x, 0xb5) != 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_11.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_11.c
new file mode 100644
index 0000000..f99ef4a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_11.c
@@ -0,0 +1,71 @@
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+unsigned short __attribute__((noipa))
+add_loop (unsigned short *x, unsigned short res)
+{
+ for (int i = 0; i < 0xfff; ++i)
+ res += x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+min_loop (unsigned short *x, unsigned short res)
+{
+ for (int i = 0; i < 0xfff; ++i)
+ res = res < x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+max_loop (unsigned short *x, unsigned short res)
+{
+ for (int i = 0; i < 0xfff; ++i)
+ res = res > x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+and_loop (unsigned short *x, unsigned short res)
+{
+ for (int i = 0; i < 0xfff; ++i)
+ res &= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+or_loop (unsigned short *x, unsigned short res)
+{
+ for (int i = 0; i < 0xfff; ++i)
+ res |= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+eor_loop (unsigned short *x, unsigned short res)
+{
+ for (int i = 0; i < 0xfff; ++i)
+ res ^= x[i];
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tuaddv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumin\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tuminv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumax\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tumaxv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tandv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teorv\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_11_run.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_11_run.c
new file mode 100644
index 0000000..5b41560
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_11_run.c
@@ -0,0 +1,34 @@
+/* { dg-do run { target aarch64_sve256_hw } } */
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+#define N 0x1100
+
+#include "reduc_11.c"
+
+int
+main (void)
+{
+ unsigned short x[N];
+ for (int i = 0; i < N; ++i)
+ x[i] = (i + 1) * (i + 2);
+
+ if (add_loop (x, 42) != 20522
+ || max_loop (x, 65503) != 65504
+ || max_loop (x, 65505) != 65505
+ || or_loop (x, 0) != 0xfffe
+ || or_loop (x, 1) != 0xffff
+ || eor_loop (x, 0) != 0xa000
+ || eor_loop (x, 0xbfff) != 0x1fff)
+ __builtin_abort ();
+
+ for (int i = 0; i < N; ++i)
+ x[i] = ~x[i];
+
+ if (min_loop (x, 32) != 31
+ || min_loop (x, 30) != 30
+ || and_loop (x, 0xff) != 1
+ || and_loop (x, 0) != 0)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_12.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_12.c
new file mode 100644
index 0000000..d32b81a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_12.c
@@ -0,0 +1,71 @@
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+unsigned short __attribute__((noipa))
+add_loop (unsigned short *x, int n, unsigned short res)
+{
+ for (int i = 0; i < n; ++i)
+ res += x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+min_loop (unsigned short *x, int n, unsigned short res)
+{
+ for (int i = 0; i < n; ++i)
+ res = res < x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+max_loop (unsigned short *x, int n, unsigned short res)
+{
+ for (int i = 0; i < n; ++i)
+ res = res > x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+and_loop (unsigned short *x, int n, unsigned short res)
+{
+ for (int i = 0; i < n; ++i)
+ res &= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+or_loop (unsigned short *x, int n, unsigned short res)
+{
+ for (int i = 0; i < n; ++i)
+ res |= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+eor_loop (unsigned short *x, int n, unsigned short res)
+{
+ for (int i = 0; i < n; ++i)
+ res ^= x[i];
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tuaddv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumin\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tuminv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumax\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tumaxv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tandv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teorv\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_12_run.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_12_run.c
new file mode 100644
index 0000000..929b81a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_12_run.c
@@ -0,0 +1,66 @@
+/* { dg-do run { target aarch64_sve_hw } } */
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+#define N 0x1100
+
+#include "reduc_12.c"
+
+int
+main (void)
+{
+ unsigned short x[N];
+ for (int i = 0; i < N; ++i)
+ x[i] = (i + 1) * (i + 2);
+
+ if (add_loop (x, 0, 10) != 10
+ || add_loop (x, 11, 42) != 614
+ || add_loop (x, 0x100, 84) != 22100
+ || add_loop (x, 0xfff, 20) != 20500
+ || max_loop (x, 0, 10) != 10
+ || max_loop (x, 11, 131) != 132
+ || max_loop (x, 11, 133) != 133
+ || max_loop (x, 0x100, 65279) != 65280
+ || max_loop (x, 0x100, 65281) != 65281
+ || max_loop (x, 0xfff, 65503) != 65504
+ || max_loop (x, 0xfff, 65505) != 65505
+ || or_loop (x, 0, 0x71) != 0x71
+ || or_loop (x, 11, 0) != 0xfe
+ || or_loop (x, 11, 0xb3c) != 0xbfe
+ || or_loop (x, 0x80, 0) != 0x7ffe
+ || or_loop (x, 0x80, 1) != 0x7fff
+ || or_loop (x, 0xb4, 0) != 0x7ffe
+ || or_loop (x, 0xb4, 1) != 0x7fff
+ || or_loop (x, 0xb5, 0) != 0xfffe
+ || or_loop (x, 0xb5, 1) != 0xffff
+ || eor_loop (x, 0, 0x3e) != 0x3e
+ || eor_loop (x, 11, 0) != 0xe8
+ || eor_loop (x, 11, 0x1ff) != 0x117
+ || eor_loop (x, 0x100, 0) != 0xcf00
+ || eor_loop (x, 0x100, 0xeee) != 0xc1ee
+ || eor_loop (x, 0xfff, 0) != 0xa000
+ || eor_loop (x, 0xfff, 0x8888) != 0x2888)
+ __builtin_abort ();
+
+ for (int i = 0; i < N; ++i)
+ x[i] = ~x[i];
+
+ if (min_loop (x, 0, 10000) != 10000
+ || min_loop (x, 11, 65404) != 65403
+ || min_loop (x, 11, 65402) != 65402
+ || min_loop (x, 0x100, 256) != 255
+ || min_loop (x, 0x100, 254) != 254
+ || min_loop (x, 0xfff, 32) != 31
+ || min_loop (x, 0xfff, 30) != 30
+ || and_loop (x, 0, 0x1234) != 0x1234
+ || and_loop (x, 11, 0xffff) != 0xff01
+ || and_loop (x, 11, 0xcdef) != 0xcd01
+ || and_loop (x, 0x80, 0xffff) != 0x8001
+ || and_loop (x, 0x80, 0xfffe) != 0x8000
+ || and_loop (x, 0xb4, 0xffff) != 0x8001
+ || and_loop (x, 0xb4, 0xfffe) != 0x8000
+ || and_loop (x, 0xb5, 0xffff) != 1
+ || and_loop (x, 0xb5, 0xfffe) != 0)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_13.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_13.c
new file mode 100644
index 0000000..ce2b8f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_13.c
@@ -0,0 +1,101 @@
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+void __attribute__((noipa))
+add_loop (unsigned int *x, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < 0x7ff; ++i)
+ {
+ res0 += x[i * 2];
+ res1 += x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+min_loop (unsigned int *x, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < 0x7ff; ++i)
+ {
+ res0 = res0 < x[i * 2] ? res0 : x[i * 2];
+ res1 = res1 < x[i * 2 + 1] ? res1 : x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+max_loop (unsigned int *x, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < 0x7ff; ++i)
+ {
+ res0 = res0 > x[i * 2] ? res0 : x[i * 2];
+ res1 = res1 > x[i * 2 + 1] ? res1 : x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+and_loop (unsigned int *x, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < 0x7ff; ++i)
+ {
+ res0 &= x[i * 2];
+ res1 &= x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+or_loop (unsigned int *x, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < 0x7ff; ++i)
+ {
+ res0 |= x[i * 2];
+ res1 |= x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+eor_loop (unsigned int *x, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < 0x7ff; ++i)
+ {
+ res0 ^= x[i * 2];
+ res1 ^= x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumin\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
+
+/* { dg-final { scan-assembler-times {\tumax\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
+
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_13_run.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_13_run.c
new file mode 100644
index 0000000..5514d8d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_13_run.c
@@ -0,0 +1,61 @@
+/* { dg-do run { target aarch64_sve256_hw } } */
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+#define N 0x1100
+
+#include "reduc_13.c"
+
+int
+main (void)
+{
+ unsigned int x[N];
+ for (int i = 0; i < N; ++i)
+ x[i] = ((i + 1) * (i + 2)) & 0xfffff;
+
+ unsigned int add_res[2] = { 42, 1111 };
+ add_loop (x, add_res);
+ if (add_res[0] != 968538154
+ || add_res[1] != 964340823)
+ __builtin_abort ();
+
+ unsigned int max_res1[2] = { 0, 0 };
+ max_loop (x, max_res1);
+ if (max_res1[0] != 1048150
+ || max_res1[1] != 1045506)
+ __builtin_abort ();
+
+ unsigned int max_res2[2] = { 1048151, 1045507 };
+ max_loop (x, max_res2);
+ if (max_res2[0] != 1048151
+ || max_res2[1] != 1045507)
+ __builtin_abort ();
+
+ unsigned int or_res[2] = { 0x1000000, 0x2000000 };
+ or_loop (x, or_res);
+ if (or_res[0] != 0x10ffffe
+ || or_res[1] != 0x20ffffe)
+ __builtin_abort ();
+
+ unsigned int eor_res[2] = { 0x1000000, 0x2000000 };
+ eor_loop (x, eor_res);
+ if (eor_res[0] != 0x1010000
+ || eor_res[1] != 0x20b5000)
+ __builtin_abort ();
+
+ for (int i = 0; i < N; ++i)
+ x[i] = ~x[i] & 0xfffff;
+
+ unsigned int min_res1[2] = { 500, 4000 };
+ min_loop (x, min_res1);
+ if (min_res1[0] != 425
+ || min_res1[1] != 3069)
+ __builtin_abort ();
+
+ unsigned int min_res2[2] = { 424, 3068 };
+ min_loop (x, min_res2);
+ if (min_res2[0] != 424
+ || min_res2[1] != 3068)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_14.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_14.c
new file mode 100644
index 0000000..3be611e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_14.c
@@ -0,0 +1,107 @@
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+void __attribute__((noipa))
+add_loop (unsigned int *x, int n, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < n; ++i)
+ {
+ res0 += x[i * 2];
+ res1 += x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+min_loop (unsigned int *x, int n, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < n; ++i)
+ {
+ res0 = res0 < x[i * 2] ? res0 : x[i * 2];
+ res1 = res1 < x[i * 2 + 1] ? res1 : x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+max_loop (unsigned int *x, int n, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < n; ++i)
+ {
+ res0 = res0 > x[i * 2] ? res0 : x[i * 2];
+ res1 = res1 > x[i * 2 + 1] ? res1 : x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+and_loop (unsigned int *x, int n, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < n; ++i)
+ {
+ res0 &= x[i * 2];
+ res1 &= x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+or_loop (unsigned int *x, int n, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < n; ++i)
+ {
+ res0 |= x[i * 2];
+ res1 |= x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+void __attribute__((noipa))
+eor_loop (unsigned int *x, int n, unsigned int *res)
+{
+ unsigned int res0 = res[0];
+ unsigned int res1 = res[1];
+ for (int i = 0; i < n; ++i)
+ {
+ res0 ^= x[i * 2];
+ res1 ^= x[i * 2 + 1];
+ }
+ res[0] = res0;
+ res[1] = res1;
+}
+
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tuaddv\t} 2 } } */
+
+/* { dg-final { scan-assembler-times {\tumin\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tuminv\t} 2 } } */
+
+/* { dg-final { scan-assembler-times {\tumax\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tumaxv\t} 2 } } */
+
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tandv\t} 2 } } */
+
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torv\t} 2 } } */
+
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teorv\t} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_14_run.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_14_run.c
new file mode 100644
index 0000000..ccaa770
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_14_run.c
@@ -0,0 +1,187 @@
+/* { dg-do run { target aarch64_sve256_hw } } */
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+#define N 0x1100
+
+#include "reduc_14.c"
+
+int
+main (void)
+{
+ unsigned int x[N];
+ for (int i = 0; i < N; ++i)
+ x[i] = ((i + 1) * (i + 2)) & 0xfffff;
+
+ unsigned int add_res1[2] = { 11, 22 };
+ add_loop (x, 0, add_res1);
+ if (add_res1[0] != 11
+ || add_res1[1] != 22)
+ __builtin_abort ();
+
+ unsigned int add_res2[2] = { 10, 20 };
+ add_loop (x, 11, add_res2);
+ if (add_res2[0] != 1902
+ || add_res2[1] != 2176)
+ __builtin_abort ();
+
+ unsigned int add_res3[2] = { 15, 30 };
+ add_loop (x, 0x100, add_res3);
+ if (add_res3[0] != 22435087
+ || add_res3[1] != 22566686)
+ __builtin_abort ();
+
+ unsigned int add_res4[2] = { 100, 200 };
+ add_loop (x, 0x11f, add_res4);
+ if (add_res4[0] != 31602244
+ || add_res4[1] != 31767656)
+ __builtin_abort ();
+
+ unsigned int max_res1[2] = { 461, 500 };
+ max_loop (x, 11, max_res1);
+ if (max_res1[0] != 462
+ || max_res1[1] != 506)
+ __builtin_abort ();
+
+ unsigned int max_res2[2] = { 463, 507 };
+ max_loop (x, 11, max_res2);
+ if (max_res2[0] != 463
+ || max_res2[1] != 507)
+ __builtin_abort ();
+
+ unsigned int max_res3[2] = { 1000000, 1000000 };
+ max_loop (x, 0x200, max_res3);
+ if (max_res3[0] != 1047552
+ || max_res3[1] != 1045506)
+ __builtin_abort ();
+
+ unsigned int max_res4[2] = { 1047553, 1045507 };
+ max_loop (x, 0x200, max_res4);
+ if (max_res4[0] != 1047553
+ || max_res4[1] != 1045507)
+ __builtin_abort ();
+
+ unsigned int max_res5[2] = { 300000, 30000 };
+ max_loop (x, 0x11f, max_res5);
+ if (max_res5[0] != 328902
+ || max_res5[1] != 330050)
+ __builtin_abort ();
+
+ unsigned int max_res6[2] = { 328903, 330051 };
+ max_loop (x, 0x11f, max_res6);
+ if (max_res6[0] != 328903
+ || max_res6[1] != 330051)
+ __builtin_abort ();
+
+ unsigned int or_res1[2] = { 11, 22 };
+ or_loop (x, 0, or_res1);
+ if (or_res1[0] != 11
+ || or_res1[1] != 22)
+ __builtin_abort ();
+
+ unsigned int or_res2[2] = { 0x200000, 0xe00000 };
+ or_loop (x, 11, or_res2);
+ if (or_res2[0] != 0x2001fe
+ || or_res2[1] != 0xe001fe)
+ __builtin_abort ();
+
+ unsigned int or_res3[2] = { 0x800000, 0x700000 };
+ or_loop (x, 0x40, or_res3);
+ if (or_res3[0] != 0x803ffe
+ || or_res3[1] != 0x707ffe)
+ __builtin_abort ();
+
+ unsigned int or_res4[2] = { 0x100001, 0x300000 };
+ or_loop (x, 0x4f, or_res4);
+ if (or_res4[0] != 0x107fff
+ || or_res4[1] != 0x307ffe)
+ __builtin_abort ();
+
+ unsigned int eor_res1[2] = { 11, 22 };
+ eor_loop (x, 0, eor_res1);
+ if (eor_res1[0] != 11
+ || eor_res1[1] != 22)
+ __builtin_abort ();
+
+ unsigned int eor_res2[2] = { 0x2000ff, 0xe000ff };
+ eor_loop (x, 11, eor_res2);
+ if (eor_res2[0] != 0x2001cf
+ || eor_res2[1] != 0xe000b7)
+ __builtin_abort ();
+
+ unsigned int eor_res3[2] = { 0x805000, 0x70f000 };
+ eor_loop (x, 0x100, eor_res3);
+ if (eor_res3[0] != 0x824200
+ || eor_res3[1] != 0x77dc00)
+ __builtin_abort ();
+
+ unsigned int eor_res4[2] = { 0x101201, 0x300f00 };
+ eor_loop (x, 0x11f, eor_res4);
+ if (eor_res4[0] != 0x178801
+ || eor_res4[1] != 0x337240)
+ __builtin_abort ();
+
+ for (int i = 0; i < N; ++i)
+ x[i] = ~x[i] & 0xfffff;
+
+ unsigned int min_res1[2] = { 1048200, 1048100 };
+ min_loop (x, 11, min_res1);
+ if (min_res1[0] != 1048113
+ || min_res1[1] != 1048069)
+ __builtin_abort ();
+
+ unsigned int min_res2[2] = { 1048112, 1048068 };
+ min_loop (x, 11, min_res2);
+ if (min_res2[0] != 1048112
+ || min_res2[1] != 1048068)
+ __builtin_abort ();
+
+ unsigned int min_res3[2] = { 10000, 10000 };
+ min_loop (x, 0x200, min_res3);
+ if (min_res3[0] != 1023
+ || min_res3[1] != 3069)
+ __builtin_abort ();
+
+ unsigned int min_res4[2] = { 1022, 3068 };
+ min_loop (x, 0x200, min_res4);
+ if (min_res4[0] != 1022
+ || min_res4[1] != 3068)
+ __builtin_abort ();
+
+ unsigned int min_res5[2] = { 719680, 718530 };
+ min_loop (x, 0x11f, min_res5);
+ if (min_res5[0] != 719673
+ || min_res5[1] != 718525)
+ __builtin_abort ();
+
+ unsigned int min_res6[2] = { 719672, 718524 };
+ min_loop (x, 0x11f, min_res6);
+ if (min_res6[0] != 719672
+ || min_res6[1] != 718524)
+ __builtin_abort ();
+
+ unsigned int and_res1[2] = { 11, 22 };
+ and_loop (x, 0, and_res1);
+ if (and_res1[0] != 11
+ || and_res1[1] != 22)
+ __builtin_abort ();
+
+ unsigned int and_res2[2] = { 0xf5cff, 0xf78ff };
+ and_loop (x, 11, and_res2);
+ if (and_res2[0] != 0xf5c01
+ || and_res2[1] != 0xf7801)
+ __builtin_abort ();
+
+ unsigned int and_res3[2] = { 0x7efff, 0xecfff };
+ and_loop (x, 0x40, and_res3);
+ if (and_res3[0] != 0x7c001
+ || and_res3[1] != 0xe8001)
+ __builtin_abort ();
+
+ unsigned int and_res4[2] = { 0xffffff, 0xffffff };
+ and_loop (x, 0x4f, and_res4);
+ if (and_res4[0] != 0xf8001
+ || and_res4[1] != 0xf8001)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_15.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_15.c
new file mode 100644
index 0000000..15b1ade
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_15.c
@@ -0,0 +1,16 @@
+/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */
+
+int __attribute__((noipa))
+add_loop (int *x, int n, int res)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ res += x[i * 2];
+ res += x[i * 2 + 1];
+ }
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tuaddv\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_15_run.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_15_run.c
new file mode 100644
index 0000000..3207fce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_15_run.c
@@ -0,0 +1,22 @@
+/* { dg-do run { target aarch64_sve256_hw } } */
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+#define N 0x1100
+
+#include "reduc_15.c"
+
+int
+main (void)
+{
+ int x[N];
+ for (int i = 0; i < N; ++i)
+ x[i] = ((i + 1) * (i + 2)) & 0xfffff;
+
+ if (add_loop (x, 0, 33) != 33
+ || add_loop (x, 11, 30) != 4078
+ || add_loop (x, 0x100, 45) != 45001773
+ || add_loop (x, 0x11f, 300) != 63369900)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_9.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_9.c
new file mode 100644
index 0000000..b839821
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_9.c
@@ -0,0 +1,77 @@
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+unsigned short __attribute__((noipa))
+add_loop (unsigned short *x)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < 0xfff; ++i)
+ res += x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+min_loop (unsigned short *x)
+{
+ unsigned short res = ~0;
+ for (int i = 0; i < 0xfff; ++i)
+ res = res < x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+max_loop (unsigned short *x)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < 0xfff; ++i)
+ res = res > x[i] ? res : x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+and_loop (unsigned short *x)
+{
+ unsigned short res = ~0;
+ for (int i = 0; i < 0xfff; ++i)
+ res &= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+or_loop (unsigned short *x)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < 0xfff; ++i)
+ res |= x[i];
+ return res;
+}
+
+unsigned short __attribute__((noipa))
+eor_loop (unsigned short *x)
+{
+ unsigned short res = 0;
+ for (int i = 0; i < 0xfff; ++i)
+ res ^= x[i];
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tuaddv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumin\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tuminv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tumax\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tumaxv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tandv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\torv\t} 1 } } */
+
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
+/* { dg-final { scan-assembler-times {\teorv\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/reduc_9_run.c b/gcc/testsuite/gcc.target/aarch64/sve/reduc_9_run.c
new file mode 100644
index 0000000..aa248f5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/reduc_9_run.c
@@ -0,0 +1,29 @@
+/* { dg-do run { target aarch64_sve256_hw } } */
+/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
+
+#define N 0x1100
+
+#include "reduc_9.c"
+
+int
+main (void)
+{
+ unsigned short x[N];
+ for (int i = 0; i < N; ++i)
+ x[i] = (i + 1) * (i + 2);
+
+ if (add_loop (x) != 20480
+ || max_loop (x) != 65504
+ || or_loop (x) != 0xfffe
+ || eor_loop (x) != 0xa000)
+ __builtin_abort ();
+
+ for (int i = 0; i < N; ++i)
+ x[i] = ~x[i];
+
+ if (min_loop (x) != 31
+ || and_loop (x) != 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/vusdot-autovec.c b/gcc/testsuite/gcc.target/aarch64/sve/vusdot-autovec.c
new file mode 100644
index 0000000..094dd51
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/vusdot-autovec.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=armv8.2-a+i8mm+sve" } */
+
+#define N 480
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+f (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 char *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 short mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+g (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict b,
+ SIGNEDNESS_4 char *restrict a)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 short mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {\tusdot\t} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp b/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp
index fcff0d2..28d6155 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp
+++ b/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp
@@ -28,12 +28,6 @@ if {![istarget aarch64*-*-*] } then {
# Load support procs.
load_lib gcc-dg.exp
-# If a testcase doesn't have special options, use these.
-global DEFAULT_CFLAGS
-if ![info exists DEFAULT_CFLAGS] then {
- set DEFAULT_CFLAGS " -ansi -pedantic-errors"
-}
-
# Initialize `dg'.
dg-init
@@ -44,9 +38,11 @@ if { [check_effective_target_aarch64_sve2] } {
set sve2_flags "-march=armv8.5-a+sve2"
}
-# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
- $sve2_flags $DEFAULT_CFLAGS
+aarch64-with-arch-dg-options $sve2_flags {
+ # Main loop.
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+ "" $sve2_flags
+}
# All done.
dg-finish
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp b/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp
index 632d350..67f817d 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp
+++ b/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp
@@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve2] } {
set sve2_flags "-march=armv8.5-a+sve2"
}
+# Turn off any codegen tweaks by default that may affect expected assembly.
+# Tests relying on those should turn them on explicitly.
+set sve_flags "$sve_flags -mtune=generic -moverride=tune=none"
+
lappend extra_flags "-fno-ipa-icf"
global gcc_runtest_parallelize_limit_minor
diff --git a/gcc/testsuite/gcc.target/aarch64/vaddX_high_cost.c b/gcc/testsuite/gcc.target/aarch64/vaddX_high_cost.c
new file mode 100644
index 0000000..43f28d5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vaddX_high_cost.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <arm_neon.h>
+
+#define TEST_ADDL(rettype, intype, ts, rs) \
+ rettype test_vaddl_ ## ts (intype a, intype b, intype c) \
+ { \
+ rettype t0 = vaddl_ ## ts (vget_high_ ## ts (a), \
+ vget_high_ ## ts (c)); \
+ rettype t1 = vaddl_ ## ts (vget_high_ ## ts (b), \
+ vget_high_ ## ts (c)); \
+ return vaddq ## _ ## rs (t0, t1); \
+ }
+
+TEST_ADDL (int16x8_t, int8x16_t, s8, s16)
+TEST_ADDL (uint16x8_t, uint8x16_t, u8, u16)
+TEST_ADDL (int32x4_t, int16x8_t, s16, s32)
+TEST_ADDL (uint32x4_t, uint16x8_t, u16, u32)
+TEST_ADDL (int64x2_t, int32x4_t, s32, s64)
+TEST_ADDL (uint64x2_t, uint32x4_t, u32, u64)
+
+#define TEST_ADDW(rettype, intype, intypel, ts, rs) \
+ rettype test_vaddw_ ## ts (intype a, intype b, intypel c) \
+ { \
+ rettype t0 = vaddw_ ## ts (a, vget_high_ ## ts (c)); \
+ rettype t1 = vaddw_ ## ts (b, vget_high_ ## ts (c)); \
+ return vaddq ## _ ## rs (t0, t1); \
+ }
+
+TEST_ADDW (int16x8_t, int16x8_t, int8x16_t, s8, s16)
+TEST_ADDW (uint16x8_t, uint16x8_t, uint8x16_t, u8, u16)
+TEST_ADDW (int32x4_t, int32x4_t, int16x8_t, s16, s32)
+TEST_ADDW (uint32x4_t, uint32x4_t, uint16x8_t, u16, u32)
+TEST_ADDW (int64x2_t, int64x2_t, int32x4_t, s32, s64)
+TEST_ADDW (uint64x2_t, uint64x2_t, uint32x4_t, u32, u64)
+
+/* { dg-final { scan-assembler-not "dup\\t" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/vect-fmaxv-fminv.x b/gcc/testsuite/gcc.target/aarch64/vect-fmaxv-fminv.x
index 0bc6ba4..d3ba31c 100644
--- a/gcc/testsuite/gcc.target/aarch64/vect-fmaxv-fminv.x
+++ b/gcc/testsuite/gcc.target/aarch64/vect-fmaxv-fminv.x
@@ -5,8 +5,9 @@ typedef double *__restrict__ pRF64;
float maxv_f32 (pRF32 a)
{
int i;
- float s = a[0];
- for (i=1;i<8;i++)
+ float s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<8;i++)
s = (s > a[i] ? s : a[i]);
return s;
@@ -15,8 +16,9 @@ float maxv_f32 (pRF32 a)
float minv_f32 (pRF32 a)
{
int i;
- float s = a[0];
- for (i=1;i<16;i++)
+ float s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<16;i++)
s = (s < a[i] ? s : a[i]);
return s;
@@ -25,8 +27,9 @@ float minv_f32 (pRF32 a)
double maxv_f64 (pRF64 a)
{
int i;
- double s = a[0];
- for (i=1;i<8;i++)
+ double s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<8;i++)
s = (s > a[i] ? s : a[i]);
return s;
@@ -35,8 +38,9 @@ double maxv_f64 (pRF64 a)
double minv_f64 (pRF64 a)
{
int i;
- double s = a[0];
- for (i=1;i<16;i++)
+ double s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<16;i++)
s = (s < a[i] ? s : a[i]);
return s;
diff --git a/gcc/testsuite/gcc.target/aarch64/vect-shr-reg-run.c b/gcc/testsuite/gcc.target/aarch64/vect-shr-reg-run.c
new file mode 100644
index 0000000..3190448
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vect-shr-reg-run.c
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=armv8.2-a" } */
+
+#include "vect-shr-reg.c"
+
+int
+main(void)
+{
+ int64_t a[16];
+ int64_t b[16];
+ int64_t c[17];
+
+ uint64_t ua[16];
+ uint64_t ub[16];
+ uint64_t uc[17];
+
+ int64_t res_a[16];
+ uint64_t res_ua[16];
+
+ int i;
+
+ /* Set up inputs. */
+ for (i = 0; i < 16; i++)
+ {
+ b[i] = -2;
+ c[i] = 34;
+ ub[i] = 0xffffffffffffffff;
+ uc[i] = 52;
+ }
+
+ /* Set up reference values. */
+ for (i = 0; i < 16; i++)
+ {
+ res_a[i] = -1LL;
+ res_ua[i] = 0x0fffLL;
+ }
+
+ /* Do the shifts. */
+ f (ua, ub, uc);
+ g (a, b, c);
+
+ /* Compare outputs against reference values. */
+ for (i = 0; i < 16; i++)
+ {
+ if (a[i] != res_a[i])
+ __builtin_abort ();
+
+ if (ua[i] != res_ua[i])
+ __builtin_abort ();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/vect-shr-reg.c b/gcc/testsuite/gcc.target/aarch64/vect-shr-reg.c
new file mode 100644
index 0000000..5736daf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vect-shr-reg.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=armv8.2-a" } */
+
+#include <stdint.h>
+#include <stdio.h>
+
+#pragma GCC target "+nosve"
+
+int __attribute__((noinline))
+f(uint64_t *__restrict a, uint64_t *__restrict b, uint64_t *__restrict c)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ a[i] = b[i] >> c[i];
+}
+
+
+int __attribute__((noinline))
+g(int64_t *__restrict a, int64_t *__restrict b, int64_t *__restrict c)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ a[i] = b[i] >> c[i];
+}
+
+/* { dg-final { scan-assembler "neg\\tv" } } */
+/* { dg-final { scan-assembler "ushl\\tv" } } */
+/* { dg-final { scan-assembler "sshl\\tv" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/vect-vaddv.c b/gcc/testsuite/gcc.target/aarch64/vect-vaddv.c
index 41e9157..3a12ae9 100644
--- a/gcc/testsuite/gcc.target/aarch64/vect-vaddv.c
+++ b/gcc/testsuite/gcc.target/aarch64/vect-vaddv.c
@@ -57,8 +57,8 @@ test_vaddv##SUFFIX##_##TYPE##x##LANES##_t (void) \
/* Calculate linearly. */ \
for (i = 0; i < moves; i++) \
{ \
- out_l[i] = input_##TYPE[i]; \
- for (j = 1; j < LANES; j++) \
+ asm ("" : "=r" (out_l[i]) : "0" (0)); \
+ for (j = 0; j < LANES; j++) \
out_l[i] += input_##TYPE[i + j]; \
} \
\
diff --git a/gcc/testsuite/gcc.target/aarch64/vect-vmaxv.c b/gcc/testsuite/gcc.target/aarch64/vect-vmaxv.c
index 4280834..1bdea89 100644
--- a/gcc/testsuite/gcc.target/aarch64/vect-vmaxv.c
+++ b/gcc/testsuite/gcc.target/aarch64/vect-vmaxv.c
@@ -36,7 +36,7 @@ test_v##MAXMIN##v##SUFFIX##_##TYPE##x##LANES##_t (void) \
/* Calculate linearly. */ \
for (i = 0; i < moves; i++) \
{ \
- out_l[i] = input_##TYPE[i]; \
+ asm ("" : "=r" (out_l[i]) : "0" (input_##TYPE[i])); \
for (j = 0; j < LANES; j++) \
out_l[i] = input_##TYPE[i + j] CMP_OP out_l[i] ? \
input_##TYPE[i + j] : out_l[i]; \
diff --git a/gcc/testsuite/gcc.target/aarch64/vector_structure_intrinsics.c b/gcc/testsuite/gcc.target/aarch64/vector_structure_intrinsics.c
new file mode 100644
index 0000000..89e9de1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vector_structure_intrinsics.c
@@ -0,0 +1,273 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=armv8.2-a+bf16" } */
+
+#include <arm_neon.h>
+
+#define TEST_TBL(name, rettype, tbltype, idxtype, ts) \
+ rettype test_ ## name ## _ ## ts (tbltype a, idxtype b) \
+ { \
+ return name ## _ ## ts (a, b); \
+ }
+
+TEST_TBL (vqtbl2, int8x8_t, int8x16x2_t, uint8x8_t, s8)
+TEST_TBL (vqtbl2, uint8x8_t, uint8x16x2_t, uint8x8_t, u8)
+TEST_TBL (vqtbl2, poly8x8_t, poly8x16x2_t, uint8x8_t, p8)
+
+TEST_TBL (vqtbl2q, int8x16_t, int8x16x2_t, uint8x16_t, s8)
+TEST_TBL (vqtbl2q, uint8x16_t, uint8x16x2_t, uint8x16_t, u8)
+TEST_TBL (vqtbl2q, poly8x16_t, poly8x16x2_t, uint8x16_t, p8)
+
+TEST_TBL (vqtbl4, int8x8_t, int8x16x4_t, uint8x8_t, s8)
+TEST_TBL (vqtbl4, uint8x8_t, uint8x16x4_t, uint8x8_t, u8)
+TEST_TBL (vqtbl4, poly8x8_t, poly8x16x4_t, uint8x8_t, p8)
+
+TEST_TBL (vqtbl4q, int8x16_t, int8x16x4_t, uint8x16_t, s8)
+TEST_TBL (vqtbl4q, uint8x16_t, uint8x16x4_t, uint8x16_t, u8)
+TEST_TBL (vqtbl4q, poly8x16_t, poly8x16x4_t, uint8x16_t, p8)
+
+#define TEST_TBL3(name, rettype, tbltype, idxtype, ts) \
+ rettype test_ ## name ## _ ## ts (idxtype a, tbltype b) \
+ { \
+ return name ## _ ## ts (b, a); \
+ }
+
+TEST_TBL3 (vqtbl3, int8x8_t, int8x16x3_t, uint8x8_t, s8)
+TEST_TBL3 (vqtbl3, uint8x8_t, uint8x16x3_t, uint8x8_t, u8)
+TEST_TBL3 (vqtbl3, poly8x8_t, poly8x16x3_t, uint8x8_t, p8)
+
+TEST_TBL3 (vqtbl3q, int8x16_t, int8x16x3_t, uint8x16_t, s8)
+TEST_TBL3 (vqtbl3q, uint8x16_t, uint8x16x3_t, uint8x16_t, u8)
+TEST_TBL3 (vqtbl3q, poly8x16_t, poly8x16x3_t, uint8x16_t, p8)
+
+#define TEST_TBX2(name, rettype, tbltype, idxtype, ts) \
+ rettype test_ ## name ## _ ## ts (rettype a, idxtype b, tbltype c) \
+ { \
+ return name ## _ ## ts (a, c, b); \
+ }
+
+TEST_TBX2 (vqtbx2, int8x8_t, int8x16x2_t, uint8x8_t, s8)
+TEST_TBX2 (vqtbx2, uint8x8_t, uint8x16x2_t, uint8x8_t, u8)
+TEST_TBX2 (vqtbx2, poly8x8_t, poly8x16x2_t, uint8x8_t, p8)
+
+TEST_TBX2 (vqtbx2q, int8x16_t, int8x16x2_t, uint8x16_t, s8)
+TEST_TBX2 (vqtbx2q, uint8x16_t, uint8x16x2_t, uint8x16_t, u8)
+TEST_TBX2 (vqtbx2q, poly8x16_t, poly8x16x2_t, uint8x16_t, p8)
+
+#define TEST_TBX3(name, rettype, tbltype, idxtype, ts) \
+ rettype test_ ## name ## _ ## ts (rettype a, tbltype b, idxtype c) \
+ { \
+ return name ## _ ## ts (a, b, c); \
+ }
+
+TEST_TBX3 (vqtbx3, int8x8_t, int8x16x3_t, uint8x8_t, s8)
+TEST_TBX3 (vqtbx3, uint8x8_t, uint8x16x3_t, uint8x8_t, u8)
+TEST_TBX3 (vqtbx3, poly8x8_t, poly8x16x3_t, uint8x8_t, p8)
+
+TEST_TBX3 (vqtbx3q, int8x16_t, int8x16x3_t, uint8x16_t, s8)
+TEST_TBX3 (vqtbx3q, uint8x16_t, uint8x16x3_t, uint8x16_t, u8)
+TEST_TBX3 (vqtbx3q, poly8x16_t, poly8x16x3_t, uint8x16_t, p8)
+
+#define TEST_TBX4(name, rettype, tbltype, idxtype, ts) \
+ rettype test_ ## name ## _ ## ts (rettype a, idxtype b, idxtype dummy1, \
+ idxtype dummy2, tbltype c) \
+ { \
+ return name ## _ ## ts (a, c, b); \
+ }
+
+TEST_TBX4 (vqtbx4, int8x8_t, int8x16x4_t, uint8x8_t, s8)
+TEST_TBX4 (vqtbx4, uint8x8_t, uint8x16x4_t, uint8x8_t, u8)
+TEST_TBX4 (vqtbx4, poly8x8_t, poly8x16x4_t, uint8x8_t, p8)
+
+TEST_TBX4 (vqtbx4q, int8x16_t, int8x16x4_t, uint8x16_t, s8)
+TEST_TBX4 (vqtbx4q, uint8x16_t, uint8x16x4_t, uint8x16_t, u8)
+TEST_TBX4 (vqtbx4q, poly8x16_t, poly8x16x4_t, uint8x16_t, p8)
+
+#define TEST_STX(name, tbltype, ptrtype, ts) \
+ void test_ ## name ## _ ## ts (ptrtype a, tbltype b) \
+ { \
+ name ## _ ## ts (a, b); \
+ }
+
+TEST_STX (vst4q, int8x16x4_t, int8_t*, s8);
+TEST_STX (vst4q, uint8x16x4_t, uint8_t*, u8);
+TEST_STX (vst4q, poly8x16x4_t, poly8_t*, p8);
+TEST_STX (vst4q, int16x8x4_t, int16_t*, s16);
+TEST_STX (vst4q, uint16x8x4_t, uint16_t*, u16);
+TEST_STX (vst4q, poly16x8x4_t, poly16_t*, p16);
+TEST_STX (vst4q, float16x8x4_t, float16_t*, f16);
+TEST_STX (vst4q, bfloat16x8x4_t, bfloat16_t*, bf16);
+TEST_STX (vst4q, int32x4x4_t, int32_t*, s32);
+TEST_STX (vst4q, uint32x4x4_t, uint32_t*, u32);
+TEST_STX (vst4q, float32x4x4_t, float32_t*, f32);
+TEST_STX (vst4q, int64x2x4_t, int64_t*, s64);
+TEST_STX (vst4q, uint64x2x4_t, uint64_t*, u64);
+TEST_STX (vst4q, float64x2x4_t, float64_t*, f64);
+TEST_STX (vst4q, poly64x2x4_t, poly64_t*, p64);
+
+TEST_STX (vst2q, int8x16x2_t, int8_t*, s8);
+TEST_STX (vst2q, uint8x16x2_t, uint8_t*, u8);
+TEST_STX (vst2q, poly8x16x2_t, poly8_t*, p8);
+TEST_STX (vst2q, int16x8x2_t, int16_t*, s16);
+TEST_STX (vst2q, uint16x8x2_t, uint16_t*, u16);
+TEST_STX (vst2q, poly16x8x2_t, poly16_t*, p16);
+TEST_STX (vst2q, float16x8x2_t, float16_t*, f16);
+TEST_STX (vst2q, bfloat16x8x2_t, bfloat16_t*, bf16);
+TEST_STX (vst2q, int32x4x2_t, int32_t*, s32);
+TEST_STX (vst2q, uint32x4x2_t, uint32_t*, u32);
+TEST_STX (vst2q, float32x4x2_t, float32_t*, f32);
+TEST_STX (vst2q, int64x2x2_t, int64_t*, s64);
+TEST_STX (vst2q, uint64x2x2_t, uint64_t*, u64);
+TEST_STX (vst2q, float64x2x2_t, float64_t*, f64);
+TEST_STX (vst2q, poly64x2x2_t, poly64_t*, p64);
+
+#define TEST_ST3(name, tbltype, ptrtype, ts) \
+ void test_ ## name ## _ ## ts (ptrtype a, int8x8_t dummy, tbltype b) \
+ { \
+ name ## _ ## ts (a, b); \
+ }
+
+TEST_ST3 (vst3q, int8x16x3_t, int8_t*, s8);
+TEST_ST3 (vst3q, uint8x16x3_t, uint8_t*, u8);
+TEST_ST3 (vst3q, poly8x16x3_t, poly8_t*, p8);
+TEST_ST3 (vst3q, int16x8x3_t, int16_t*, s16);
+TEST_ST3 (vst3q, uint16x8x3_t, uint16_t*, u16);
+TEST_ST3 (vst3q, poly16x8x3_t, poly16_t*, p16);
+TEST_ST3 (vst3q, float16x8x3_t, float16_t*, f16);
+TEST_ST3 (vst3q, bfloat16x8x3_t, bfloat16_t*, bf16);
+TEST_ST3 (vst3q, int32x4x3_t, int32_t*, s32);
+TEST_ST3 (vst3q, uint32x4x3_t, uint32_t*, u32);
+TEST_ST3 (vst3q, float32x4x3_t, float32_t*, f32);
+TEST_ST3 (vst3q, int64x2x3_t, int64_t*, s64);
+TEST_ST3 (vst3q, uint64x2x3_t, uint64_t*, u64);
+TEST_ST3 (vst3q, float64x2x3_t, float64_t*, f64);
+TEST_ST3 (vst3q, poly64x2x3_t, poly64_t*, p64);
+
+#define TEST_STX_LANE(name, tbltype, ptrtype, ts) \
+ void test_ ## name ## _ ## ts (ptrtype a, tbltype b) \
+ { \
+ name ## _ ## ts (a, b, 1); \
+ }
+
+TEST_STX_LANE (vst4q_lane, int8x16x4_t, int8_t*, s8);
+TEST_STX_LANE (vst4q_lane, uint8x16x4_t, uint8_t*, u8);
+TEST_STX_LANE (vst4q_lane, poly8x16x4_t, poly8_t*, p8);
+TEST_STX_LANE (vst4q_lane, int16x8x4_t, int16_t*, s16);
+TEST_STX_LANE (vst4q_lane, uint16x8x4_t, uint16_t*, u16);
+TEST_STX_LANE (vst4q_lane, poly16x8x4_t, poly16_t*, p16);
+TEST_STX_LANE (vst4q_lane, float16x8x4_t, float16_t*, f16);
+TEST_STX_LANE (vst4q_lane, bfloat16x8x4_t, bfloat16_t*, bf16);
+TEST_STX_LANE (vst4q_lane, int32x4x4_t, int32_t*, s32);
+TEST_STX_LANE (vst4q_lane, uint32x4x4_t, uint32_t*, u32);
+TEST_STX_LANE (vst4q_lane, float32x4x4_t, float32_t*, f32);
+TEST_STX_LANE (vst4q_lane, int64x2x4_t, int64_t*, s64);
+TEST_STX_LANE (vst4q_lane, uint64x2x4_t, uint64_t*, u64);
+TEST_STX_LANE (vst4q_lane, float64x2x4_t, float64_t*, f64);
+TEST_STX_LANE (vst4q_lane, poly64x2x4_t, poly64_t*, p64);
+
+TEST_STX_LANE (vst2q_lane, int8x16x2_t, int8_t*, s8);
+TEST_STX_LANE (vst2q_lane, uint8x16x2_t, uint8_t*, u8);
+TEST_STX_LANE (vst2q_lane, poly8x16x2_t, poly8_t*, p8);
+TEST_STX_LANE (vst2q_lane, int16x8x2_t, int16_t*, s16);
+TEST_STX_LANE (vst2q_lane, uint16x8x2_t, uint16_t*, u16);
+TEST_STX_LANE (vst2q_lane, poly16x8x2_t, poly16_t*, p16);
+TEST_STX_LANE (vst2q_lane, float16x8x2_t, float16_t*, f16);
+TEST_STX_LANE (vst2q_lane, bfloat16x8x2_t, bfloat16_t*, bf16);
+TEST_STX_LANE (vst2q_lane, int32x4x2_t, int32_t*, s32);
+TEST_STX_LANE (vst2q_lane, uint32x4x2_t, uint32_t*, u32);
+TEST_STX_LANE (vst2q_lane, float32x4x2_t, float32_t*, f32);
+TEST_STX_LANE (vst2q_lane, int64x2x2_t, int64_t*, s64);
+TEST_STX_LANE (vst2q_lane, uint64x2x2_t, uint64_t*, u64);
+TEST_STX_LANE (vst2q_lane, float64x2x2_t, float64_t*, f64);
+TEST_STX_LANE (vst2q_lane, poly64x2x2_t, poly64_t*, p64);
+
+#define TEST_ST3_LANE(name, tbltype, ptrtype, ts) \
+ void test_ ## name ## _ ## ts (ptrtype a, int8x8_t dummy, tbltype b) \
+ { \
+ name ## _ ## ts (a, b, 1); \
+ }
+
+TEST_ST3_LANE (vst3q_lane, int8x16x3_t, int8_t*, s8);
+TEST_ST3_LANE (vst3q_lane, uint8x16x3_t, uint8_t*, u8);
+TEST_ST3_LANE (vst3q_lane, poly8x16x3_t, poly8_t*, p8);
+TEST_ST3_LANE (vst3q_lane, int16x8x3_t, int16_t*, s16);
+TEST_ST3_LANE (vst3q_lane, uint16x8x3_t, uint16_t*, u16);
+TEST_ST3_LANE (vst3q_lane, poly16x8x3_t, poly16_t*, p16);
+TEST_ST3_LANE (vst3q_lane, float16x8x3_t, float16_t*, f16);
+TEST_ST3_LANE (vst3q_lane, bfloat16x8x3_t, bfloat16_t*, bf16);
+TEST_ST3_LANE (vst3q_lane, int32x4x3_t, int32_t*, s32);
+TEST_ST3_LANE (vst3q_lane, uint32x4x3_t, uint32_t*, u32);
+TEST_ST3_LANE (vst3q_lane, float32x4x3_t, float32_t*, f32);
+TEST_ST3_LANE (vst3q_lane, int64x2x3_t, int64_t*, s64);
+TEST_ST3_LANE (vst3q_lane, uint64x2x3_t, uint64_t*, u64);
+TEST_ST3_LANE (vst3q_lane, float64x2x3_t, float64_t*, f64);
+TEST_ST3_LANE (vst3q_lane, poly64x2x3_t, poly64_t*, p64);
+
+#define TEST_ST1xN(name, tbltype, ptrtype, ts, xn) \
+ void test_ ## name ## _ ## ts ## _ ## xn (ptrtype a, tbltype b) \
+ { \
+ name ## _ ## ts ## _ ## xn (a, b); \
+ }
+
+TEST_ST1xN (vst1q, int8x16x4_t, int8_t*, s8, x4);
+TEST_ST1xN (vst1q, uint8x16x4_t, uint8_t*, u8, x4);
+TEST_ST1xN (vst1q, poly8x16x4_t, poly8_t*, p8, x4);
+TEST_ST1xN (vst1q, int16x8x4_t, int16_t*, s16, x4);
+TEST_ST1xN (vst1q, uint16x8x4_t, uint16_t*, u16, x4);
+TEST_ST1xN (vst1q, poly16x8x4_t, poly16_t*, p16, x4);
+TEST_ST1xN (vst1q, float16x8x4_t, float16_t*, f16, x4);
+TEST_ST1xN (vst1q, bfloat16x8x4_t, bfloat16_t*, bf16, x4);
+TEST_ST1xN (vst1q, int32x4x4_t, int32_t*, s32, x4);
+TEST_ST1xN (vst1q, uint32x4x4_t, uint32_t*, u32, x4);
+TEST_ST1xN (vst1q, float32x4x4_t, float32_t*, f32, x4);
+TEST_ST1xN (vst1q, int64x2x4_t, int64_t*, s64, x4);
+TEST_ST1xN (vst1q, uint64x2x4_t, uint64_t*, u64, x4);
+TEST_ST1xN (vst1q, poly64x2x4_t, poly64_t*, p64, x4);
+TEST_ST1xN (vst1q, float64x2x4_t, float64_t*, f64, x4);
+
+TEST_ST1xN (vst1q, int8x16x2_t, int8_t*, s8, x2);
+TEST_ST1xN (vst1q, uint8x16x2_t, uint8_t*, u8, x2);
+TEST_ST1xN (vst1q, poly8x16x2_t, poly8_t*, p8, x2);
+TEST_ST1xN (vst1q, int16x8x2_t, int16_t*, s16, x2);
+TEST_ST1xN (vst1q, uint16x8x2_t, uint16_t*, u16, x2);
+TEST_ST1xN (vst1q, poly16x8x2_t, poly16_t*, p16, x2);
+TEST_ST1xN (vst1q, float16x8x2_t, float16_t*, f16, x2);
+TEST_ST1xN (vst1q, bfloat16x8x2_t, bfloat16_t*, bf16, x2);
+TEST_ST1xN (vst1q, int32x4x2_t, int32_t*, s32, x2);
+TEST_ST1xN (vst1q, uint32x4x2_t, uint32_t*, u32, x2);
+TEST_ST1xN (vst1q, float32x4x2_t, float32_t*, f32, x2);
+TEST_ST1xN (vst1q, int64x2x2_t, int64_t*, s64, x2);
+TEST_ST1xN (vst1q, uint64x2x2_t, uint64_t*, u64, x2);
+TEST_ST1xN (vst1q, poly64x2x2_t, poly64_t*, p64, x2);
+TEST_ST1xN (vst1q, float64x2x2_t, float64_t*, f64, x2);
+
+#define TEST_ST1x3(name, tbltype, ptrtype, ts, xn) \
+ void test_ ## name ## _ ## ts ## _ ## xn (ptrtype a, int8x8_t dummy, \
+ tbltype b) \
+ { \
+ name ## _ ## ts ## _ ## xn (a, b); \
+ }
+
+TEST_ST1x3 (vst1q, int8x16x3_t, int8_t*, s8, x3);
+TEST_ST1x3 (vst1q, uint8x16x3_t, uint8_t*, u8, x3);
+TEST_ST1x3 (vst1q, poly8x16x3_t, poly8_t*, p8, x3);
+TEST_ST1x3 (vst1q, int16x8x3_t, int16_t*, s16, x3);
+TEST_ST1x3 (vst1q, uint16x8x3_t, uint16_t*, u16, x3);
+TEST_ST1x3 (vst1q, poly16x8x3_t, poly16_t*, p16, x3);
+TEST_ST1x3 (vst1q, float16x8x3_t, float16_t*, f16, x3);
+TEST_ST1x3 (vst1q, bfloat16x8x3_t, bfloat16_t*, bf16, x3);
+TEST_ST1x3 (vst1q, int32x4x3_t, int32_t*, s32, x3);
+TEST_ST1x3 (vst1q, uint32x4x3_t, uint32_t*, u32, x3);
+TEST_ST1x3 (vst1q, float32x4x3_t, float32_t*, f32, x3);
+TEST_ST1x3 (vst1q, int64x2x3_t, int64_t*, s64, x3);
+TEST_ST1x3 (vst1q, uint64x2x3_t, uint64_t*, u64, x3);
+TEST_ST1x3 (vst1q, poly64x2x3_t, poly64_t*, p64, x3);
+TEST_ST1x3 (vst1q, float64x2x3_t, float64_t*, f64, x3);
+
+/* { dg-final { scan-assembler-not "mov\\t" { target aarch64_little_endian } } } */
+
+/* { dg-final { scan-assembler-times "tbl\\t" 18} } */
+/* { dg-final { scan-assembler-times "tbx\\t" 18} } */
+/* { dg-final { scan-assembler-times "st4\\t" 30} } */
+/* { dg-final { scan-assembler-times "st3\\t" 30} } */
+/* { dg-final { scan-assembler-times "st2\\t" 30} } */
+/* { dg-final { scan-assembler-times "st1\\t" 45} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/vmul_element_cost.c b/gcc/testsuite/gcc.target/aarch64/vmul_element_cost.c
new file mode 100644
index 0000000..c153775
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vmul_element_cost.c
@@ -0,0 +1,94 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <arm_neon.h>
+
+#define TEST_MUL_UNIFORM(name, q, vectype, ts) \
+ vectype test_ ## name ## q ## _ ## ts (vectype a, vectype b, vectype c) \
+ { \
+ vectype t0 = name ## q ## _n_ ## ts (a, c[1]); \
+ vectype t1 = name ## q ## _n_ ## ts (b, c[1]); \
+ return vmul ## q ## _ ## ts (t0, t1); \
+ }
+
+TEST_MUL_UNIFORM (vmul, , int16x4_t, s16)
+TEST_MUL_UNIFORM (vmul, , uint16x4_t, u16)
+TEST_MUL_UNIFORM (vmul, , int32x2_t, s32)
+TEST_MUL_UNIFORM (vmul, , uint32x2_t, u32)
+TEST_MUL_UNIFORM (vmul, , float32x2_t, f32)
+TEST_MUL_UNIFORM (vmul, q, int16x8_t, s16)
+TEST_MUL_UNIFORM (vmul, q, uint16x8_t, u16)
+TEST_MUL_UNIFORM (vmul, q, int32x4_t, s32)
+TEST_MUL_UNIFORM (vmul, q, uint32x4_t, u32)
+TEST_MUL_UNIFORM (vmul, q, float32x4_t, f32)
+TEST_MUL_UNIFORM (vmul, q, float64x2_t, f64)
+
+#define TEST_MLX_UNIFORM(name, q, vectype, ts) \
+ vectype test_ ## name ## q ## _ ## ts (vectype acc, vectype a, vectype b) \
+ { \
+ acc = name ## q ## _n_ ## ts (acc, a, b[1]); \
+ return name ## q ## _n_ ## ts (acc, a, b[1]); \
+ }
+
+TEST_MLX_UNIFORM (vmla, , int16x4_t, s16)
+TEST_MLX_UNIFORM (vmla, , uint16x4_t, u16)
+TEST_MLX_UNIFORM (vmla, , int32x2_t, s32)
+TEST_MLX_UNIFORM (vmla, , uint32x2_t, u32)
+TEST_MLX_UNIFORM (vmla, , float32x2_t, f32)
+TEST_MLX_UNIFORM (vmla, q, int16x8_t, s16)
+TEST_MLX_UNIFORM (vmla, q, uint16x8_t, u16)
+TEST_MLX_UNIFORM (vmla, q, int32x4_t, s32)
+TEST_MLX_UNIFORM (vmla, q, uint32x4_t, u32)
+TEST_MLX_UNIFORM (vmla, q, float32x4_t, f32)
+
+TEST_MLX_UNIFORM (vmls, , int16x4_t, s16)
+TEST_MLX_UNIFORM (vmls, , uint16x4_t, u16)
+TEST_MLX_UNIFORM (vmls, , int32x2_t, s32)
+TEST_MLX_UNIFORM (vmls, , uint32x2_t, u32)
+TEST_MLX_UNIFORM (vmls, , float32x2_t, f32)
+TEST_MLX_UNIFORM (vmls, q, int16x8_t, s16)
+TEST_MLX_UNIFORM (vmls, q, uint16x8_t, u16)
+TEST_MLX_UNIFORM (vmls, q, int32x4_t, s32)
+TEST_MLX_UNIFORM (vmls, q, uint32x4_t, u32)
+TEST_MLX_UNIFORM (vmls, q, float32x4_t, f32)
+
+#define TEST_MUL_LONG(name, rettype, intype, ts, rs) \
+ rettype test_ ## name ## ts (intype a, intype b, intype c) \
+ { \
+ rettype t0 = name ## ts (a, c[1]); \
+ rettype t1 = name ## ts (b, c[1]); \
+ return vqaddq ## _ ## rs (t0, t1); \
+ }
+
+TEST_MUL_LONG (vmull_n_, int32x4_t, int16x4_t, s16, s32)
+TEST_MUL_LONG (vmull_n_, uint32x4_t, uint16x4_t, u16, u32)
+TEST_MUL_LONG (vmull_n_, int64x2_t, int32x2_t, s32, s64)
+TEST_MUL_LONG (vmull_n_, uint64x2_t, uint32x2_t, u32, u64)
+
+TEST_MUL_LONG (vqdmull_n_, int32x4_t, int16x4_t, s16, s32)
+TEST_MUL_LONG (vqdmull_n_, int64x2_t, int32x2_t, s32, s64)
+
+#define TEST_MLX_LONG(name, rettype, intype, ts, rs) \
+ rettype test_ ## name ## _ ## ts (rettype acc, intype a, intype b) \
+ { \
+ acc = name ## ts (acc, a, b[1]); \
+ return name ## ts (acc, a, b[1]); \
+ }
+
+TEST_MLX_LONG (vmlal_n_, int32x4_t, int16x4_t, s16, s32)
+TEST_MLX_LONG (vmlal_n_, uint32x4_t, uint16x4_t, u16, u32)
+TEST_MLX_LONG (vmlal_n_, int64x2_t, int32x2_t, s32, s64)
+TEST_MLX_LONG (vmlal_n_, uint64x2_t, uint32x2_t, u32, u64)
+
+TEST_MLX_LONG (vmlsl_n_, int32x4_t, int16x4_t, s16, s32)
+TEST_MLX_LONG (vmlsl_n_, uint32x4_t, uint16x4_t, u16, u32)
+TEST_MLX_LONG (vmlsl_n_, int64x2_t, int32x2_t, s32, s64)
+TEST_MLX_LONG (vmlsl_n_, uint64x2_t, uint32x2_t, u32, u64)
+
+TEST_MLX_LONG (vqdmlal_n_, int32x4_t, int16x4_t, s16, s32)
+TEST_MLX_LONG (vqdmlal_n_, int64x2_t, int32x2_t, s32, s64)
+
+TEST_MLX_LONG (vqdmlsl_n_, int32x4_t, int16x4_t, s16, s32)
+TEST_MLX_LONG (vqdmlsl_n_, int64x2_t, int32x2_t, s32, s64)
+
+/* { dg-final { scan-assembler-not "dup\\t" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/vmul_high_cost.c b/gcc/testsuite/gcc.target/aarch64/vmul_high_cost.c
new file mode 100644
index 0000000..ecc02e6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vmul_high_cost.c
@@ -0,0 +1,85 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <arm_neon.h>
+
+#define TEST_MULL_VEC(name, rettype, intype, ts, rs) \
+ rettype test_ ## name ## _ ## ts (intype a, intype b, intype c) \
+ { \
+ rettype t0 = name ## _ ## ts (vget_high_ ## ts (a), \
+ vget_high_ ## ts (c)); \
+ rettype t1 = name ## _ ## ts (vget_high_ ## ts (b), \
+ vget_high_ ## ts (c)); \
+ return vqaddq ## _ ## rs (t0, t1); \
+ }
+
+TEST_MULL_VEC (vmull, int16x8_t, int8x16_t, s8, s16)
+TEST_MULL_VEC (vmull, uint16x8_t, uint8x16_t, u8, u16)
+TEST_MULL_VEC (vmull, int32x4_t, int16x8_t, s16, s32)
+TEST_MULL_VEC (vmull, uint32x4_t, uint16x8_t, u16, u32)
+TEST_MULL_VEC (vmull, int64x2_t, int32x4_t, s32, s64)
+TEST_MULL_VEC (vmull, uint64x2_t, uint32x4_t, u32, u64)
+
+TEST_MULL_VEC (vqdmull, int32x4_t, int16x8_t, s16, s32)
+TEST_MULL_VEC (vqdmull, int64x2_t, int32x4_t, s32, s64)
+
+#define TEST_MULL_N(name, rettype, intype, ts, rs) \
+ rettype test_ ## name ## _ ## ts (intype a, intype b, intype c) \
+ { \
+ rettype t0 = name ## _ ## ts (vget_high_ ## ts (a), b[1]); \
+ rettype t1 = name ## _ ## ts (vget_high_ ## ts (a), c[1]); \
+ return vqaddq ## _ ## rs (t0, t1); \
+ }
+
+TEST_MULL_N (vmull_n, int32x4_t, int16x8_t, s16, s32)
+TEST_MULL_N (vmull_n, uint32x4_t, uint16x8_t, u16, u32)
+TEST_MULL_N (vmull_n, int64x2_t, int32x4_t, s32, s64)
+TEST_MULL_N (vmull_n, uint64x2_t, uint32x4_t, u32, u64)
+
+TEST_MULL_N (vqdmull_n, int32x4_t, int16x8_t, s16, s32)
+TEST_MULL_N (vqdmull_n, int64x2_t, int32x4_t, s32, s64)
+
+#define TEST_MLXL_VEC(name, rettype, intype, ts) \
+ rettype test_ ## name ## _ ## ts (rettype acc, intype a, intype b, \
+ intype c) \
+ { \
+ acc = name ## _ ## ts (acc, vget_high_ ## ts (a), \
+ vget_high_ ## ts (b)); \
+ return name ## _ ## ts (acc, vget_high_ ## ts (a), \
+ vget_high_ ## ts (c)); \
+ }
+
+TEST_MLXL_VEC (vmlal, int16x8_t, int8x16_t, s8)
+TEST_MLXL_VEC (vmlal, uint16x8_t, uint8x16_t, u8)
+TEST_MLXL_VEC (vmlal, int32x4_t, int16x8_t, s16)
+TEST_MLXL_VEC (vmlal, uint32x4_t, uint16x8_t, u16)
+
+TEST_MLXL_VEC (vmlsl, int16x8_t, int8x16_t, s8)
+TEST_MLXL_VEC (vmlsl, uint16x8_t, uint8x16_t, u8)
+TEST_MLXL_VEC (vmlsl, int32x4_t, int16x8_t, s16)
+TEST_MLXL_VEC (vmlsl, uint32x4_t, uint16x8_t, u16)
+
+#define TEST_MLXL_N(name, rettype, intype, ts) \
+ rettype test_ ## name ## _ ## ts (rettype acc, intype a, intype b) \
+ { \
+ acc = name ## _ ## ts (acc, vget_high_ ## ts (a), b[1]); \
+ return name ## _ ## ts (acc, vget_high_ ## ts (a), b[1]); \
+ }
+
+TEST_MLXL_N (vmlal_n, int32x4_t, int16x8_t, s16)
+TEST_MLXL_N (vmlal_n, uint32x4_t, uint16x8_t, u16)
+TEST_MLXL_N (vmlal_n, int64x2_t, int32x4_t, s32)
+TEST_MLXL_N (vmlal_n, uint64x2_t, uint32x4_t, u32)
+
+TEST_MLXL_N (vmlsl_n, int32x4_t, int16x8_t, s16)
+TEST_MLXL_N (vmlsl_n, uint32x4_t, uint16x8_t, u16)
+TEST_MLXL_N (vmlsl_n, int64x2_t, int32x4_t, s32)
+TEST_MLXL_N (vmlsl_n, uint64x2_t, uint32x4_t, u32)
+
+TEST_MLXL_N (vqdmlal_n, int32x4_t, int16x8_t, s16)
+TEST_MLXL_N (vqdmlal_n, int64x2_t, int32x4_t, s32)
+
+TEST_MLXL_N (vqdmlsl_n, int32x4_t, int16x8_t, s16)
+TEST_MLXL_N (vqdmlsl_n, int64x2_t, int32x4_t, s32)
+
+/* { dg-final { scan-assembler-not "dup\\t" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/vsubX_high_cost.c b/gcc/testsuite/gcc.target/aarch64/vsubX_high_cost.c
new file mode 100644
index 0000000..09bc7fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vsubX_high_cost.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <arm_neon.h>
+
+#define TEST_SUBL(rettype, intype, ts, rs) \
+ rettype test_vsubl_ ## ts (intype a, intype b, intype c) \
+ { \
+ rettype t0 = vsubl_ ## ts (vget_high_ ## ts (a), \
+ vget_high_ ## ts (c)); \
+ rettype t1 = vsubl_ ## ts (vget_high_ ## ts (b), \
+ vget_high_ ## ts (c)); \
+ return vaddq ## _ ## rs (t0, t1); \
+ }
+
+TEST_SUBL (int16x8_t, int8x16_t, s8, s16)
+TEST_SUBL (uint16x8_t, uint8x16_t, u8, u16)
+TEST_SUBL (int32x4_t, int16x8_t, s16, s32)
+TEST_SUBL (uint32x4_t, uint16x8_t, u16, u32)
+TEST_SUBL (int64x2_t, int32x4_t, s32, s64)
+TEST_SUBL (uint64x2_t, uint32x4_t, u32, u64)
+
+#define TEST_SUBW(rettype, intype, intypel, ts, rs) \
+ rettype test_vsubw_ ## ts (intype a, intype b, intypel c) \
+ { \
+ rettype t0 = vsubw_ ## ts (a, vget_high_ ## ts (c)); \
+ rettype t1 = vsubw_ ## ts (b, vget_high_ ## ts (c)); \
+ return vaddq ## _ ## rs (t0, t1); \
+ }
+
+TEST_SUBW (int16x8_t, int16x8_t, int8x16_t, s8, s16)
+TEST_SUBW (uint16x8_t, uint16x8_t, uint8x16_t, u8, u16)
+TEST_SUBW (int32x4_t, int32x4_t, int16x8_t, s16, s32)
+TEST_SUBW (uint32x4_t, uint32x4_t, uint16x8_t, u16, u32)
+TEST_SUBW (int64x2_t, int64x2_t, int32x4_t, s32, s64)
+TEST_SUBW (uint64x2_t, uint64x2_t, uint32x4_t, u32, u64)
+
+/* { dg-final { scan-assembler-not "dup\\t" } } */
diff --git a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
index 9ebd55a..7bf458e 100644
--- a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
+++ b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-require-effective-target arm_qbit_ok } */
-/* { dg-add-options arm_qbit } */
+/* { dg-require-effective-target arm_dsp_ok } */
+/* { dg-add-options arm_dsp } */
#include <arm_acle.h>
diff --git a/gcc/testsuite/gcc.target/arm/acle/pr100856.c b/gcc/testsuite/gcc.target/arm/acle/pr100856.c
new file mode 100644
index 0000000..adbe1ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/acle/pr100856.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_v8m_main_cde_multilib } */
+/* { dg-add-options arm_v8m_main_cde } */
+
+#include "arm_cde.h"
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/acle/saturation.c b/gcc/testsuite/gcc.target/arm/acle/saturation.c
index 0b3fe51..a9f99e5 100644
--- a/gcc/testsuite/gcc.target/arm/acle/saturation.c
+++ b/gcc/testsuite/gcc.target/arm/acle/saturation.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-require-effective-target arm_qbit_ok } */
-/* { dg-add-options arm_qbit } */
+/* { dg-require-effective-target arm_sat_ok } */
+/* { dg-add-options arm_sat } */
#include <arm_acle.h>
diff --git a/gcc/testsuite/gcc.target/arm/arm.exp b/gcc/testsuite/gcc.target/arm/arm.exp
index d306573..4d7c2ad 100644
--- a/gcc/testsuite/gcc.target/arm/arm.exp
+++ b/gcc/testsuite/gcc.target/arm/arm.exp
@@ -33,7 +33,7 @@ if ![info exists DEFAULT_CFLAGS] then {
# This variable should only apply to tests called in this exp file.
global dg_runtest_extra_prunes
set dg_runtest_extra_prunes ""
-lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch"
+lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'"
# Initialize `dg'.
dg-init
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c
index 67a9f41..f5ab6e7 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c
@@ -1,7 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-O -mfloat-abi=hard -mfp16-format=ieee" } */
+/* { dg-options "-O -mfp16-format=ieee" } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-mfloat-abi=hard" } *
/* { dg-final { check-function-bodies "**" "" } } */
/*
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c
index 1ecb839..2f62e839 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c
@@ -1,7 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-O -mfloat-abi=hard" } */
+/* { dg-options "-O" } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-mfloat-abi=hard" } *
/* { dg-final { check-function-bodies "**" "" } } */
/*
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c
index 3f81350..d236f08 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c
@@ -1,7 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-O -mfloat-abi=hard" } */
+/* { dg-options "-O" } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-mfloat-abi=hard" } *
/* { dg-final { check-function-bodies "**" "" } } */
/*
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c
index 883fbb09..84f13e2 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mfloat-abi=softfp -mlittle-endian" } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-options "-O2 -mlittle-endian" } */
/* { dg-add-options arm_v8_1m_mve } */
long long longval1;
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c
index e125ff8..8668b6b 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mfloat-abi=softfp -mlittle-endian" } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-options "-O2 -mlittle-endian" } */
/* { dg-add-options arm_v8_1m_mve } */
long long longval2;
diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c
index 921d26e..52b8737 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c
@@ -104,8 +104,20 @@ TEST_CMP (greaterthanqual, >=, int16x8_t, float16x8_t)
/* { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
/* { dg-final { scan-assembler-times {vdiv\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 13 } } */
-/* { dg-final { scan-assembler-times {vcmp\.f32\ts[0-9]+, s[0-9]+} 26 } } */
-/* { dg-final { scan-assembler-times {vcmpe\.f32\ts[0-9]+, s[0-9]+} 52 } } */
+
+/* For float16_t. */
+/* { dg-final { scan-assembler-times {vcmp\.f32\ts[0-9]+, s[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vcmpe\.f32\ts[0-9]+, s[0-9]+} 4 } } */
+
+/* For float16x4_t. */
+/* { dg-final { scan-assembler-times {vceq\.f16\td[0-9]+, d[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vcge\.f16\td[0-9]+, d[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vcgt\.f16\td[0-9]+, d[0-9]+} 2 } } */
+
+/* For float16x8_t. */
+/* { dg-final { scan-assembler-times {vceq\.f16\tq[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vcge\.f16\tq[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vcgt\.f16\tq[0-9]+, q[0-9]+} 2 } } */
/* { dg-final { scan-assembler-not {vadd\.f32} } } */
/* { dg-final { scan-assembler-not {vsub\.f32} } } */
diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-neon-2.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-neon-2.c
index 50f6893..6808576 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-neon-2.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-neon-2.c
@@ -327,13 +327,13 @@ BINOP_TEST (vminnm)
BINOP_TEST (vmul)
/* { dg-final { scan-assembler-times {vmul\.f16\td[0-9]+, d[0-9]+, d[0-9]+} 3 } }
- { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+ { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
BINOP_LANE_TEST (vmul, 2)
/* { dg-final { scan-assembler-times {vmul\.f16\td[0-9]+, d[0-9]+, d[0-9]+\[2\]} 1 } }
{ dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, d[0-9]+\[2\]} 1 } } */
BINOP_N_TEST (vmul)
-/* { dg-final { scan-assembler-times {vmul\.f16\td[0-9]+, d[0-9]+, d[0-9]+\[0\]} 1 } }
- { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, d[0-9]+\[0\]} 1 } }*/
+/* { dg-final { scan-assembler-times {vmul\.f16\td[0-9]+, d[0-9]+, d[0-9]+} 3 } }
+ { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } }*/
float16x4_t
test_vpadd_16x4 (float16x4_t a, float16x4_t b)
@@ -387,7 +387,7 @@ test_vdup_n_f16 (float16_t a)
{
return vdup_n_f16 (a);
}
-/* { dg-final { scan-assembler-times {vdup\.16\td[0-9]+, r[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vdup\.16\td[0-9]+, r[0-9]+} 3 } } */
float16x8_t
test_vmovq_n_f16 (float16_t a)
@@ -400,7 +400,7 @@ test_vdupq_n_f16 (float16_t a)
{
return vdupq_n_f16 (a);
}
-/* { dg-final { scan-assembler-times {vdup\.16\tq[0-9]+, r[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vdup\.16\tq[0-9]+, r[0-9]+} 3 } } */
float16x4_t
test_vdup_lane_f16 (float16x4_t a)
diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c
index fa4828d..de5adf3 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c
@@ -1,7 +1,9 @@
/* { dg-do compile } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */
/* { dg-options "-O2 -std=c11" } */
/* { dg-add-options arm_v8_2a_fp16_scalar } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
/* Test compiler use of FP16 instructions. */
#include <arm_fp16.h>
diff --git a/gcc/testsuite/gcc.target/arm/attr-neon.c b/gcc/testsuite/gcc.target/arm/attr-neon.c
index 225fb8d..e8e3086 100644
--- a/gcc/testsuite/gcc.target/arm/attr-neon.c
+++ b/gcc/testsuite/gcc.target/arm/attr-neon.c
@@ -1,7 +1,10 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_neon_ok } */
/* { dg-options "-O2 -ftree-vectorize" } */
-/* { dg-add-options arm_neon arm_v8_vfp } */ /* The arm_v8_vfp adds -mfpu=fp-armv8 to the command line, overriding any -mfpu= option set by arm_neon, thus ensuring that the attributes below really are checked for correct fpu selection. */
+/* { dg-add-options arm_neon arm_v8_vfp } */
+/* The arm_v8_vfp adds -mfpu=fp-armv8 to the command line, overriding any
+ -mfpu= option set by arm_neon, thus ensuring that the attributes below
+ really are checked for correct fpu selection. */
/* Verify that neon instructions are emitted once. */
void __attribute__ ((target("fpu=neon")))
@@ -18,6 +21,6 @@ f3(int n, int x[], int y[]) {
y[i] = x[i] << 3;
}
-/* { dg-final { scan-assembler-times "\.fpu vfp" 1 } } */
-/* { dg-final { scan-assembler-times "\.fpu neon" 1 } } */
+/* { dg-final { scan-assembler-times "\.fpu\\s+vfp\n" 1 } } */
+/* { dg-final { scan-assembler-times "\.fpu\\s+neon\n" 1 } } */
/* { dg-final { scan-assembler-times "vshl" 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/attr-neon2.c b/gcc/testsuite/gcc.target/arm/attr-neon2.c
index 2966825..a7a72da 100644
--- a/gcc/testsuite/gcc.target/arm/attr-neon2.c
+++ b/gcc/testsuite/gcc.target/arm/attr-neon2.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_neon_ok } */
/* { dg-require-effective-target arm_fp_ok } */
-/* { dg-options "-O2" } */
+/* { dg-options "-Ofast" } */
/* { dg-add-options arm_fp } */
/* Reset fpu to a value compatible with the next pragmas. */
@@ -12,23 +12,36 @@
#include <arm_neon.h>
/* Check that pragma target is used. */
-int8x8_t
-my (int8x8_t __a, int8x8_t __b)
+/*
+**my:
+** ...
+** vadd.f32 d[0-9]+, d[0-9]+, d[0-9]+
+** ...
+** bx lr
+*/
+float32x2_t
+my (float32x2_t __a, float32x2_t __b)
{
return __a + __b;
}
#pragma GCC pop_options
-/* Check that command line option is restored. */
-int8x8_t
-my1 (int8x8_t __a, int8x8_t __b)
+/* Check that fpu=vfp is restored. */
+/*
+**my1:
+** ...
+** vadd.f32 s[0-9]+, s[0-9]+, s[0-9]+
+** vadd.f32 s[0-9]+, s[0-9]+, s[0-9]+
+** ...
+** bx lr
+*/
+float32x2_t
+my1 (float32x2_t __a, float32x2_t __b)
{
return __a + __b;
}
-/* { dg-final { scan-assembler-times "\.fpu vfp" 1 } } */
-/* { dg-final { scan-assembler-times "\.fpu neon" 1 } } */
-/* { dg-final { scan-assembler "vadd" } } */
-
-
+/* { dg-final { scan-assembler "\.fpu\\s+vfp\n" } } */
+/* { dg-final { scan-assembler "\.fpu\\s+neon\n" } } */
+/* { dg-final { check-function-bodies "**" "" } } */
diff --git a/gcc/testsuite/gcc.target/arm/attr-neon3.c b/gcc/testsuite/gcc.target/arm/attr-neon3.c
index 17e429a..b6171e7 100644
--- a/gcc/testsuite/gcc.target/arm/attr-neon3.c
+++ b/gcc/testsuite/gcc.target/arm/attr-neon3.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_crypto_ok } */
/* { dg-require-effective-target arm_fp_ok } */
-/* { dg-options "-O2" } */
+/* { dg-options "-Ofast" } */
/* { dg-add-options arm_fp } */
/* Reset fpu to a value compatible with the next pragmas. */
@@ -11,28 +11,54 @@
#include <arm_neon.h>
/* Check that neon is used. */
-int8x8_t __attribute__ ((target("fpu=neon")))
-my (int8x8_t __a, int8x8_t __b)
+/*
+**my:
+** ...
+** vadd.f32 d[0-9]+, d[0-9]+, d[0-9]+
+** ...
+** bx lr
+*/
+float32x2_t __attribute__ ((target("fpu=neon")))
+my (float32x2_t __a, float32x2_t __b)
{
return __a + __b;
}
/* Check that crypto builtins are recognized. */
+/*
+**foo:
+** ...
+** (
+** vld1.64 {d[0-9]+-d[0-9]+}, \[r[0-9]+:64\]
+** |
+** vld1.64 {d[0-9]+}, \[r[0-9]+:64\]!
+** vld1.64 {d[0-9]+}, \[r[0-9]+:64\]
+** )
+** ...
+** bx lr
+*/
+
poly128_t __attribute__ ((target("fpu=crypto-neon-fp-armv8")))
foo (poly128_t* ptr)
{
return vldrq_p128 (ptr);
}
-/* Check that default mode is restored. */
-int8x8_t
-my1 (int8x8_t __a, int8x8_t __b)
+/* Check that fpu=vfp is restored. */
+/*
+**my1:
+** ...
+** vadd.f32 s[0-9]+, s[0-9]+, s[0-9]+
+** vadd.f32 s[0-9]+, s[0-9]+, s[0-9]+
+** ...
+** bx lr
+*/float32x2_t
+my1 (float32x2_t __a, float32x2_t __b)
{
return __a + __b;
}
-/* { dg-final { scan-assembler-times "\.fpu vfp" 1 } } */
-/* { dg-final { scan-assembler-times "\.fpu neon" 1 } } */
-/* { dg-final { scan-assembler-times "\.fpu crypto-neon-fp-armv8" 1 } } */
-/* { dg-final { scan-assembler-times "vld1" 1 } } */
-/* { dg-final { scan-assembler-times "vadd" 1} } */
+/* { dg-final { scan-assembler "\.fpu\\s+vfp\n" } } */
+/* { dg-final { scan-assembler "\.fpu\\s+neon\n" } } */
+/* { dg-final { scan-assembler "\.fpu\\s+crypto-neon-fp-armv8\n" } } */
+/* { dg-final { check-function-bodies "**" "" } } */
diff --git a/gcc/testsuite/gcc.target/arm/bf16_dup.c b/gcc/testsuite/gcc.target/arm/bf16_dup.c
index 94be99a..b62bce1 100644
--- a/gcc/testsuite/gcc.target/arm/bf16_dup.c
+++ b/gcc/testsuite/gcc.target/arm/bf16_dup.c
@@ -1,7 +1,7 @@
/* { dg-do assemble { target { arm*-*-* } } } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
-/* { dg-additional-options "-save-temps -march=armv8.2-a+bf16+fp16 -mfloat-abi=softfp" } */
+/* { dg-additional-options "-save-temps -march=armv8.2-a+bf16+fp16" } */
#include "arm_neon.h"
diff --git a/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c b/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c
index e7d30a9..9e36fc5 100644
--- a/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c
+++ b/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c
@@ -1,7 +1,7 @@
/* { dg-do assemble { target { arm*-*-* } } } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
-/* { dg-additional-options "-save-temps -march=armv8.2-a+fp16+bf16 -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8" } */
+/* { dg-additional-options "-save-temps -march=armv8.2-a+fp16+bf16 -mfpu=crypto-neon-fp-armv8" } */
#include <arm_neon.h>
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c
index efcc561..7a6c177 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c
@@ -1,7 +1,8 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
-/* { dg-additional-options "-O3 --save-temps -std=gnu90" } */
+/* { dg-additional-options "-O3 --save-temps -std=gnu90 -mfloat-abi=hard" } */
/* { dg-final { check-function-bodies "**" "" } } */
#include <arm_bf16.h>
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c
index 672641e..8c80c55 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c
@@ -2,6 +2,8 @@
/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
/* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_fp16_neon } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
/* { dg-additional-options "-march=armv8.6-a+bf16+fp16 -Wno-pedantic -O3 --save-temps" } */
#include <arm_neon.h>
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c
index cad7d54..72b4a1b 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c
@@ -1,7 +1,8 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
-/* { dg-additional-options "-O3 --save-temps -std=gnu90" } */
+/* { dg-additional-options "-O3 --save-temps -std=gnu90 -mfloat-abi=hard" } */
/* { dg-final { check-function-bodies "**" "" } } */
#include <arm_neon.h>
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c
index 4ffcc54..95eecec 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_softfp_ok } */
/* { dg-require-effective-target arm_v8_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-additional-options "-march=armv8.2-a+bf16 -mfloat-abi=softfp -mfpu=auto" } */
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c
index 05ee4d8..02b4c41 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-additional-options "-march=armv8.2-a -mfloat-abi=hard -mfpu=neon-fp-armv8" } */
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c
index 15fba31..175bfa5 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_softfp_ok } */
/* { dg-require-effective-target arm_v8_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-additional-options "-march=armv8.2-a -mfloat-abi=softfp -mfpu=neon-fp-armv8" } */
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c
index b9b7606..d2326c2 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-additional-options "-march=armv8.2-a -mfloat-abi=hard -mfpu=neon-fp-armv8" } */
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c
index ab1fe10..346253b 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c
@@ -1,4 +1,5 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_softfp_ok } */
/* { dg-require-effective-target arm_v8_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-additional-options "-march=armv8.2-a -mfloat-abi=softfp -mfpu=neon-fp-armv8" } */
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c
index ba39cb6..f3c350b 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c
@@ -2,6 +2,8 @@
/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
/* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_fp16_neon } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
/* { dg-additional-options "-march=armv8.6-a+bf16+fp16 -Wno-pedantic -O3 --save-temps" } */
#include <arm_neon.h>
diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c
index 16669dc..de0ade5 100644
--- a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c
+++ b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c
@@ -2,6 +2,8 @@
/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
/* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_fp16_neon } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
/* { dg-additional-options "-march=armv8.6-a+bf16+fp16 -Wno-pedantic -O3 --save-temps" } */
#include <arm_neon.h>
@@ -25,8 +27,8 @@ float is_a_float16;
double is_a_double;
bfloat16x8_t foo3 (void) { return (bfloat16x8_t) 0x12345678123456781234567812345678; }
- /* { dg-error {integer constant is too large for its type} "" {target *-*-*} 27 } */
- /* { dg-error {cannot convert a value of type 'long long int' to vector type '__simd128_bfloat16_t' which has different size} "" {target *-*-*} 27 } */
+ /* { dg-error {integer constant is too large for its type} "" {target *-*-*} .-1 } */
+ /* { dg-error {cannot convert a value of type 'long long int' to vector type '__simd128_bfloat16_t' which has different size} "" {target *-*-*} .-2 } */
bfloat16x8_t footest (bfloat16x8_t vector0)
{
diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c
index cae2f06..5685f74 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* This test is executed only if the execution engine supports CMSE instructions. */
/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */
typedef struct
diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c
index 21a53cd..7a794d4 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* This test is executed only if the execution engine supports CMSE instructions. */
/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */
typedef struct
diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c
index e8f973e..5875f8df 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* This test is executed only if the execution engine supports CMSE instructions. */
/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */
typedef struct
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c
index 3fb0380..6a243d5 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c
@@ -1,4 +1,8 @@
-/* { dg-do run } */
+/* This test is executed only if the execution engine supports CMSE instructions. */
+/* Note that it "passes" on qemu-arm while it shouldn't because that simulator
+ does not model secure memory: it's better to skip it in this case, and rely
+ on do-what-default as set in cmse.exp. (It works as expected with
+ qemu-system-mode). */
/* { dg-options "-Os -mcmse" } */
#include <arm_cmse.h>
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c
index e1ff092..db7d975 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c
@@ -8,4 +8,5 @@ void bar(f func, int a)
func(a);
}
-/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" } } */
+/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" { target { ! arm_v8_1m_mve_ok } } } } */
+/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r\[0-7\]:SI\\\]\\\]" "final" { target { arm_v8_1m_mve_ok } } } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c
new file mode 100644
index 0000000..08e89bf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c
@@ -0,0 +1,28 @@
+/* This test is executed only if the execution engine supports CMSE instructions. */
+/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */
+
+#include <arm_cmse.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+void __attribute__((cmse_nonsecure_entry))
+secure_fun (int a, int *p)
+{
+ void *b = cmse_check_address_range ((void *)p, a, 1);
+
+ if (b == NULL)
+ __builtin_abort ();
+ printf("%d", *((int *)b));
+}
+
+int
+main (void)
+{
+ int *ptr;
+ int size = 1;
+ ptr = (int *) calloc (1, sizeof(int *));
+ *ptr = 1315852292;
+ secure_fun (size, ptr);
+ free (ptr);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp
index 6ce99fe..4da1a46 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp
@@ -34,7 +34,12 @@ if ![info exists DEFAULT_CFLAGS] then {
dg-init
set saved-dg-do-what-default ${dg-do-what-default}
-set dg-do-what-default "assemble"
+
+if {[is-effective-target arm_cmse_hw]} then {
+ set dg-do-what-default run
+} else {
+ set dg-do-what-default assemble
+}
set saved-lto_torture_options ${LTO_TORTURE_OPTIONS}
set LTO_TORTURE_OPTIONS ""
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c
new file mode 100644
index 0000000..553cc78
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+
+#include "../../../cmse-13.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler-not "vmov" } } */
+/* { dg-final { scan-assembler-not "vmsr" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c
new file mode 100644
index 0000000..ce02fde
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+
+#include "../../../cmse-7.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler-not "vmov" } } */
+/* { dg-final { scan-assembler-not "vmsr" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c
new file mode 100644
index 0000000..75e1611
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+
+#include "../../../cmse-8.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler-not "vmov" } } */
+/* { dg-final { scan-assembler-not "vmsr" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c
new file mode 100644
index 0000000..dad7266
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */
+
+#include "../../../cmse-7.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c
new file mode 100644
index 0000000..faa0448
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */
+
+#include "../../../cmse-8.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c
new file mode 100644
index 0000000..bceba44
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
+
+#include "../../../cmse-13.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c
new file mode 100644
index 0000000..c74ebbd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
+
+#include "../../../cmse-7.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c
new file mode 100644
index 0000000..ffb67a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
+
+#include "../../../cmse-8.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/pr100333.c b/gcc/testsuite/gcc.target/arm/cmse/pr100333.c
new file mode 100644
index 0000000..d8e3d80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/pr100333.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mcmse" } */
+typedef void __attribute__((cmse_nonsecure_call)) t(void);
+t g;
+void f() {
+ g();
+}
diff --git a/gcc/testsuite/gcc.target/arm/cmse/pr99725.c b/gcc/testsuite/gcc.target/arm/cmse/pr99725.c
new file mode 100644
index 0000000..284da18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/pr99725.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mcmse -g" } */
+typedef int __attribute__((cmse_nonsecure_call)) (*t)();
+t f;
+void g() { f(); }
diff --git a/gcc/testsuite/gcc.target/arm/cmse/struct-1.c b/gcc/testsuite/gcc.target/arm/cmse/struct-1.c
index 7555643..75a99f4 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/struct-1.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/struct-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* This test is executed only if the execution engine supports CMSE instructions. */
/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */
typedef struct
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c
index 6a92ded..e0fb307 100644
--- a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c
@@ -1,12 +1,12 @@
/* { dg-do assemble } */
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-additional-options "-mcpu=cortex-m55+nofp -mthumb -mfloat-abi=hard -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler "\.fpu softvfp" } } */
/* { dg-final { scan-assembler "\.arch_extension mve" } } */
/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension fp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension fp.dp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
-/* { dg-final { scan-assembler-not "\.fpu" } } */
int
f ()
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c
index 25e80e9..50645e8 100644
--- a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c
@@ -1,12 +1,12 @@
/* { dg-do assemble } */
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-additional-options "-mcpu=cortex-m55+nofp -mthumb -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler "\.fpu softvfp" } } */
/* { dg-final { scan-assembler "\.arch_extension mve" } } */
/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension fp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension fp.dp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
-/* { dg-final { scan-assembler-not "\.fpu" } } */
int
f ()
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c
index 38042cc..948f622 100644
--- a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c
@@ -1,12 +1,12 @@
/* { dg-do assemble } */
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-additional-options "-mcpu=cortex-m55+nomve+nofp -mthumb -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler "\.fpu softvfp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension mve" } } */
/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension fp" } } */
/* { dg-final { scan-assembler-not "\.arch_extension fp.dp" } } */
/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
-/* { dg-final { scan-assembler-not "\.fpu" } } */
int
f ()
diff --git a/gcc/testsuite/gcc.target/arm/crypto-vsha1cq_u32.c b/gcc/testsuite/gcc.target/arm/crypto-vsha1cq_u32.c
index 41f97a7..0cadd19 100644
--- a/gcc/testsuite/gcc.target/arm/crypto-vsha1cq_u32.c
+++ b/gcc/testsuite/gcc.target/arm/crypto-vsha1cq_u32.c
@@ -31,5 +31,5 @@ uint32_t foo (void)
TEST_SHA1C_VEC_SELECT (GET_LANE)
/* { dg-final { scan-assembler-times {sha1c.32\tq[0-9]+, q[0-9]+} 5 } } */
-/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 3 } } */
-/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 4 } } */
+/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 4 } } */
+/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/crypto-vsha1h_u32.c b/gcc/testsuite/gcc.target/arm/crypto-vsha1h_u32.c
index b284667..33af705 100644
--- a/gcc/testsuite/gcc.target/arm/crypto-vsha1h_u32.c
+++ b/gcc/testsuite/gcc.target/arm/crypto-vsha1h_u32.c
@@ -27,5 +27,5 @@ uint32_t foo (void)
TEST_SHA1H_VEC_SELECT (GET_LANE)
/* { dg-final { scan-assembler-times {sha1h.32\tq[0-9]+, q[0-9]+} 5 } } */
-/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 3 } } */
-/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 8 } } */
+/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 4 } } */
+/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/crypto-vsha1mq_u32.c b/gcc/testsuite/gcc.target/arm/crypto-vsha1mq_u32.c
index 676e64c..bdd1c4f 100644
--- a/gcc/testsuite/gcc.target/arm/crypto-vsha1mq_u32.c
+++ b/gcc/testsuite/gcc.target/arm/crypto-vsha1mq_u32.c
@@ -31,5 +31,5 @@ uint32_t foo (void)
TEST_SHA1M_VEC_SELECT (GET_LANE)
/* { dg-final { scan-assembler-times {sha1m.32\tq[0-9]+, q[0-9]+} 5 } } */
-/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 3 } } */
-/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 4 } } */
+/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 4 } } */
+/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/crypto-vsha1pq_u32.c b/gcc/testsuite/gcc.target/arm/crypto-vsha1pq_u32.c
index ed10fe2..d48a07c 100644
--- a/gcc/testsuite/gcc.target/arm/crypto-vsha1pq_u32.c
+++ b/gcc/testsuite/gcc.target/arm/crypto-vsha1pq_u32.c
@@ -31,5 +31,5 @@ uint32_t foo (void)
TEST_SHA1P_VEC_SELECT (GET_LANE)
/* { dg-final { scan-assembler-times {sha1p.32\tq[0-9]+, q[0-9]+} 5 } } */
-/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 3 } } */
-/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 4 } } */
+/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 4 } } */
+/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp
index 46f2d86..4b30025 100644
--- a/gcc/testsuite/gcc.target/arm/multilib.exp
+++ b/gcc/testsuite/gcc.target/arm/multilib.exp
@@ -840,6 +840,119 @@ if {[multilib_config "rmprofile"] } {
{-mcpu=cortex-m55+nomve+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
{-mcpu=cortex-m55+nodsp+nofp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
{-mcpu=cortex-m55+nodsp+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+cdecp0 -mfpu=vfpv3xd -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+cdecp0 -mfpu=vfpv3xd -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8-m.main+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+cdecp0 -mfpu=vfpv3xd -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=vfpv3xd -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=vfpv3xd-fp16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv5-sp-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp.dp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp+dsp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8-m.main+fp.dp+dsp+cdecp0 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8.1-m.main+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+dsp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+dsp+fp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+dsp+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+dsp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+dsp+fp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8.1-m.main+dsp+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8.1-m.main+dsp+fp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8.1-m.main+dsp+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8.1-m.main+mve+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+mve.fp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+mve+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+mve.fp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8.1-m.main+mve+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+mve/hard"
+ {-march=armv8.1-m.main+mve+fp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8.1-m.main+mve+fp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+fp/softfp"
+ {-march=armv8.1-m.main+mve.fp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard"
+ {-march=armv8.1-m.main+mve+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+mve.fp+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-march=armv8.1-m.main+mve+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8.1-m.main+mve.fp+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-march=armv8.1-m.main+mve+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-march=armv8.1-m.main+mve.fp+fp.dp+cdecp0 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
} {
check_multi_dir $opts $dir
}
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu1.c
index 611097e..c5acdb5 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu1.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu1.c
@@ -1,3 +1,4 @@
+/* { dg-do assemble } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-require-effective-target arm_hard_ok } */
/* { dg-add-options arm_v8_1m_mve } */
@@ -8,8 +9,6 @@
int8x16_t
foo1 (int8x16_t value)
{
- int8x16_t b = value;
+ int8x16_t b = -value;
return b;
}
-
-/* { dg-final { scan-assembler-not "\.fpu softvfp" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu2.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu2.c
index b8e1051..907db5e 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu2.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fpu2.c
@@ -1,3 +1,4 @@
+/* { dg-do assemble } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-require-effective-target arm_softfp_ok } */
/* { dg-add-options arm_v8_1m_mve } */
@@ -8,8 +9,6 @@
int8x16_t
foo1 (int8x16_t value)
{
- int8x16_t b = value;
+ int8x16_t b = -value;
return b;
}
-
-/* { dg-final { scan-assembler-not "\.fpu softvfp" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c
index 35f83c6..6728776 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c
@@ -1,5 +1,7 @@
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c
index e70cbc1..029e02f 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c
@@ -1,5 +1,7 @@
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c
index 0c4e763..c158100 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c
@@ -1,5 +1,7 @@
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c
index fce69eb..d30fce0 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c
@@ -1,5 +1,7 @@
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c
index e0d6dcb..ae68914 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c
@@ -1,5 +1,7 @@
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr101016.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr101016.c
new file mode 100644
index 0000000..b12786d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr101016.c
@@ -0,0 +1,136 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+
+#include "arm_mve.h"
+
+void
+foo (void)
+{
+ mve_pred16_t p;
+ int8x16_t a;
+ int8_t a1[10];
+ int16x8_t b;
+ int16_t b1[10];
+ int32x4_t c;
+ int32_t c1[10];
+ uint8x16_t ua;
+ uint8_t ua1[10];
+ uint16x8_t ub;
+ uint16_t ub1[10];
+ uint32x4_t uc;
+ uint32_t uc1[10];
+ float16x8_t fb;
+ float16_t fb1[10];
+ float32x4_t fc;
+ float32_t fc1[10];
+
+ fb = vld1q (fb1);
+ fc = vld1q (fc1);
+ b = vld1q (b1);
+ c = vld1q (c1);
+ a = vld1q (a1);
+ ub = vld1q (ub1);
+ uc = vld1q (uc1);
+ ua = vld1q (ua1);
+ fb = vld1q_z (fb1, p);
+ fc = vld1q_z (fc1, p);
+ b = vld1q_z (b1, p);
+ c = vld1q_z (c1, p);
+ a = vld1q_z (a1, p);
+ ub = vld1q_z (ub1, p);
+ uc = vld1q_z (uc1, p);
+ ua = vld1q_z (ua1, p);
+}
+
+void
+foo1 (void)
+{
+ mve_pred16_t p;
+ int8x16x2_t a;
+ int8_t a1[10];
+ int16x8x2_t b;
+ int16_t b1[10];
+ int32x4x2_t c;
+ int32_t c1[10];
+ uint8x16x2_t ua;
+ uint8_t ua1[10];
+ uint16x8x2_t ub;
+ uint16_t ub1[10];
+ uint32x4x2_t uc;
+ uint32_t uc1[10];
+ float16x8x2_t fb;
+ float16_t fb1[10];
+ float32x4x2_t fc;
+ float32_t fc1[10];
+
+ fb = vld2q (fb1);
+ fc = vld2q (fc1);
+ b = vld2q (b1);
+ c = vld2q (c1);
+ a = vld2q (a1);
+ ub = vld2q (ub1);
+ uc = vld2q (uc1);
+ ua = vld2q (ua1);
+}
+
+void
+foo2 (void)
+{
+ mve_pred16_t p;
+ int8x16x4_t a;
+ int8_t a1[10];
+ int16x8x4_t b;
+ int16_t b1[10];
+ int32x4x4_t c;
+ int32_t c1[10];
+ uint8x16x4_t ua;
+ uint8_t ua1[10];
+ uint16x8x4_t ub;
+ uint16_t ub1[10];
+ uint32x4x4_t uc;
+ uint32_t uc1[10];
+ float16x8x4_t fb;
+ float16_t fb1[10];
+ float32x4x4_t fc;
+ float32_t fc1[10];
+
+ fb = vld4q (fb1);
+ fc = vld4q (fc1);
+ b = vld4q (b1);
+ c = vld4q (c1);
+ a = vld4q (a1);
+ ub = vld4q (ub1);
+ uc = vld4q (uc1);
+ ua = vld4q (ua1);
+}
+
+void
+foo3 (void)
+{
+ mve_pred16_t p;
+ int16x8_t a;
+ uint16x8_t ua;
+ int8_t a1[10];
+ uint8_t ua1[10];
+ uint16x8_t offset_a;
+ int8x16_t b;
+ uint8x16_t ub;
+ uint8x16_t offset_b;
+ int32x4_t c;
+ uint32x4_t uc;
+ uint32x4_t offset_c;
+
+ a = vldrbq_gather_offset (a1, offset_a);
+ ua = vldrbq_gather_offset (ua1, offset_a);
+ b = vldrbq_gather_offset (a1, offset_b);
+ ub = vldrbq_gather_offset (ua1, offset_b);
+ c = vldrbq_gather_offset (a1, offset_c);
+ uc = vldrbq_gather_offset (ua1, offset_c);
+ a = vldrbq_gather_offset_z (a1, offset_a, p);
+ ua = vldrbq_gather_offset_z (ua1, offset_a, p);
+ b = vldrbq_gather_offset_z (a1, offset_b, p);
+ ub = vldrbq_gather_offset_z (ua1, offset_b, p);
+ c = vldrbq_gather_offset_z (a1, offset_c, p);
+ uc = vldrbq_gather_offset_z (ua1, offset_c, p);
+}
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f16.c
index 2a5aa63..a92e1d4 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f16.c
@@ -8,7 +8,7 @@
float16_t
foo (float16x8_t a)
{
- return vgetq_lane_f16 (a, 0);
+ return vgetq_lane_f16 (a, 1);
}
/* { dg-final { scan-assembler "vmov.u16" } } */
@@ -16,7 +16,7 @@ foo (float16x8_t a)
float16_t
foo1 (float16x8_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.u16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f32.c
index f1839cc..98319ef 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_f32.c
@@ -8,7 +8,7 @@
float32_t
foo (float32x4_t a)
{
- return vgetq_lane_f32 (a, 0);
+ return vgetq_lane_f32 (a, 1);
}
/* { dg-final { scan-assembler "vmov.32" } } */
@@ -16,7 +16,7 @@ foo (float32x4_t a)
float32_t
foo1 (float32x4_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s16.c
index ed1c217..c9eefeb 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s16.c
@@ -8,7 +8,7 @@
int16_t
foo (int16x8_t a)
{
- return vgetq_lane_s16 (a, 0);
+ return vgetq_lane_s16 (a, 1);
}
/* { dg-final { scan-assembler "vmov.s16" } } */
@@ -16,7 +16,7 @@ foo (int16x8_t a)
int16_t
foo1 (int16x8_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.s16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s32.c
index c87ed93..0925a25 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s32.c
@@ -8,7 +8,7 @@
int32_t
foo (int32x4_t a)
{
- return vgetq_lane_s32 (a, 0);
+ return vgetq_lane_s32 (a, 1);
}
/* { dg-final { scan-assembler "vmov.32" } } */
@@ -16,7 +16,7 @@ foo (int32x4_t a)
int32_t
foo1 (int32x4_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c
index a7457f8..63b2508 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c
@@ -1,7 +1,8 @@
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-mfloat-abi=hard -O2" } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s8.c
index 11242ff..5b76e3d 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s8.c
@@ -8,7 +8,7 @@
int8_t
foo (int8x16_t a)
{
- return vgetq_lane_s8 (a, 0);
+ return vgetq_lane_s8 (a, 1);
}
/* { dg-final { scan-assembler "vmov.s8" } } */
@@ -16,7 +16,7 @@ foo (int8x16_t a)
int8_t
foo1 (int8x16_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.s8" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u16.c
index 2788b58..c4a3fb0 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u16.c
@@ -8,7 +8,7 @@
uint16_t
foo (uint16x8_t a)
{
- return vgetq_lane_u16 (a, 0);
+ return vgetq_lane_u16 (a, 1);
}
/* { dg-final { scan-assembler "vmov.u16" } } */
@@ -16,7 +16,7 @@ foo (uint16x8_t a)
uint16_t
foo1 (uint16x8_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.u16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u32.c
index 721c5a5..d798370 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u32.c
@@ -8,7 +8,7 @@
uint32_t
foo (uint32x4_t a)
{
- return vgetq_lane_u32 (a, 0);
+ return vgetq_lane_u32 (a, 1);
}
/* { dg-final { scan-assembler "vmov.32" } } */
@@ -16,7 +16,7 @@ foo (uint32x4_t a)
uint32_t
foo1 (uint32x4_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c
index 3cbbef5..a4b900f 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c
@@ -1,7 +1,8 @@
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-mfloat-abi=hard -O2" } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u8.c
index 2bcaeac..631d995 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u8.c
@@ -8,7 +8,7 @@
uint8_t
foo (uint8x16_t a)
{
- return vgetq_lane_u8 (a, 0);
+ return vgetq_lane_u8 (a, 1);
}
/* { dg-final { scan-assembler "vmov.u8" } } */
@@ -16,7 +16,7 @@ foo (uint8x16_t a)
uint8_t
foo1 (uint8x16_t a)
{
- return vgetq_lane (a, 0);
+ return vgetq_lane (a, 1);
}
/* { dg-final { scan-assembler "vmov.u8" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c
index 7420d01..a9b1f81 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c
@@ -11,6 +11,6 @@ foo (uint64x2_t * addr)
}
/* { dg-final { scan-assembler "vldrd.64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c
index ebe5b2f..e32a066 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c
@@ -11,6 +11,6 @@ foo (uint64x2_t * addr)
}
/* { dg-final { scan-assembler "vldrd.64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c
index 231a24a..bb06cf8 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c
@@ -10,6 +10,6 @@ int64x2_t foo (uint64x2_t * addr, mve_pred16_t p)
/* { dg-final { scan-assembler "vpst" } } */
/* { dg-final { scan-assembler "vldrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c
index b8d9b5c..558115d 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c
@@ -10,6 +10,6 @@ uint64x2_t foo (uint64x2_t * addr, mve_pred16_t p)
/* { dg-final { scan-assembler "vpst" } } */
/* { dg-final { scan-assembler "vldrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c
index e487b73..430df66 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c
@@ -1,7 +1,8 @@
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-mfloat-abi=hard -O2" } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c
index ae57b9c..0e04012 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c
@@ -1,7 +1,8 @@
/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-mfloat-abi=hard -O2" } */
#include "arm_mve.h"
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c
index bf6692f..cc5e635 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c
@@ -27,6 +27,5 @@ foo ()
/* { dg-final { scan-assembler-times "vstrb.8" 2 } } */
/* { dg-final { scan-assembler-times "vstrh.16" 2 } } */
-/* { dg-final { scan-assembler-times "vstrw.32" 2 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 2 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 4 } } */
/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c
index 4f66a07..bfeb52b 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c
@@ -28,6 +28,5 @@ foo ()
/* { dg-final { scan-assembler-times "vstrb.8" 2 } } */
/* { dg-final { scan-assembler-times "vstrh.16" 2 } } */
-/* { dg-final { scan-assembler-times "vstrw.32" 2 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 2 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 4 } } */
/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/mve.exp b/gcc/testsuite/gcc.target/arm/mve/mve.exp
index f8590bf..d09fc27 100644
--- a/gcc/testsuite/gcc.target/arm/mve/mve.exp
+++ b/gcc/testsuite/gcc.target/arm/mve/mve.exp
@@ -33,7 +33,7 @@ if ![info exists DEFAULT_CFLAGS] then {
# This variable should only apply to tests called in this exp file.
global dg_runtest_extra_prunes
set dg_runtest_extra_prunes ""
-lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch"
+lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'"
set dg-do-what-default "assemble"
diff --git a/gcc/testsuite/gcc.target/arm/pr51534.c b/gcc/testsuite/gcc.target/arm/pr51534.c
index f675a44..5e121f5 100644
--- a/gcc/testsuite/gcc.target/arm/pr51534.c
+++ b/gcc/testsuite/gcc.target/arm/pr51534.c
@@ -3,7 +3,7 @@
/* { dg-do assemble } */
/* { dg-require-effective-target arm_neon_ok } */
-/* { dg-options "-save-temps -mfloat-abi=hard -O3" } */
+/* { dg-options "-save-temps -O3" } */
/* { dg-add-options arm_neon } */
#include <arm_neon.h>
@@ -35,29 +35,17 @@ GEN_COND_TESTS(vceq)
/* Scan for expected outputs. */
/* { dg-final { scan-assembler "vcgt\.s8\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcgt\.u8\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcgt\.s16\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcgt\.u16\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcgt\.s32\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcgt\.u32\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcgt\.s8\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcgt\.u8\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcgt\.s16\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcgt\.u16\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcgt\.s32\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcgt\.u32\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcge\.s8\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcge\.u8\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcge\.s16\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcge\.u16\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcge\.s32\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcge\.u32\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcge\.s8\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcge\.u8\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcge\.s16\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcge\.u16\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vcge\.s32\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vcge\.u32\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+" 2 } } */
/* { dg-final { scan-assembler "vclt\.s8\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
/* { dg-final { scan-assembler "vclt\.s16\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
/* { dg-final { scan-assembler "vclt\.s32\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" } } */
@@ -70,12 +58,15 @@ GEN_COND_TESTS(vceq)
/* { dg-final { scan-assembler "vcle\.s8\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
/* { dg-final { scan-assembler "vcle\.s16\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
/* { dg-final { scan-assembler "vcle\.s32\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" } } */
-/* { dg-final { scan-assembler-times "vceq\.i8\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" 2 } } */
-/* { dg-final { scan-assembler-times "vceq\.i16\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" 2 } } */
-/* { dg-final { scan-assembler-times "vceq\.i32\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" 2 } } */
-/* { dg-final { scan-assembler-times "vceq\.i8\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" 2 } } */
-/* { dg-final { scan-assembler-times "vceq\.i16\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" 2 } } */
-/* { dg-final { scan-assembler-times "vceq\.i32\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" 2 } } */
+/* { dg-final { scan-assembler-times "vceq\.i8\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" 4 } } */
+/* { dg-final { scan-assembler-times "vceq\.i16\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" 4 } } */
+/* { dg-final { scan-assembler-times "vceq\.i32\[ \]+\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, #0" 4 } } */
+/* { dg-final { scan-assembler-times "vceq\.i8\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" 4 } } */
+/* { dg-final { scan-assembler-times "vceq\.i16\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" 4 } } */
+/* { dg-final { scan-assembler-times "vceq\.i32\[ \]+\[qQ\]\[0-9\]+, \[qQ\]\[0-9\]+, #0" 4 } } */
+/* { dg-final { scan-assembler-times "vmov\.i32\[ \]+\[dD\]\[0-9\]+, #0xffffffff" 3 { target { arm_hard_ok } } } } */
+/* { dg-final { scan-assembler-times "vmov\.i32\[ \]+\[qQ\]\[0-9\]+, #4294967295" 3 { target { arm_hard_ok } } } } */
+/* { dg-final { scan-assembler-times "mov\[ \]+r\[0-9\]+, #-1" 6 { target { arm_softfp_ok } } } } */
/* And ensure we don't have unexpected output too. */
/* { dg-final { scan-assembler-not "vc\[gl\]\[te\]\.u\[0-9\]+\[ \]+\[qQdD\]\[0-9\]+, \[qQdD\]\[0-9\]+, #0" } } */
diff --git a/gcc/testsuite/gcc.target/arm/pr51968.c b/gcc/testsuite/gcc.target/arm/pr51968.c
index 7814702..c06da48 100644
--- a/gcc/testsuite/gcc.target/arm/pr51968.c
+++ b/gcc/testsuite/gcc.target/arm/pr51968.c
@@ -1,7 +1,8 @@
/* PR target/51968 */
/* { dg-do compile } */
-/* { dg-options "-O2 -march=armv7-a -mfloat-abi=softfp -mfpu=neon" } */
+/* { dg-require-effective-target arm_softfp_ok } */
/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O2 -march=armv7-a -mfloat-abi=softfp -mfpu=neon" } */
#include <arm_neon.h>
struct T { int8x8x2_t val; };
diff --git a/gcc/testsuite/gcc.target/arm/pr69245.c b/gcc/testsuite/gcc.target/arm/pr69245.c
index bd50518..58a6104 100644
--- a/gcc/testsuite/gcc.target/arm/pr69245.c
+++ b/gcc/testsuite/gcc.target/arm/pr69245.c
@@ -12,7 +12,7 @@
#pragma GCC target "fpu=neon-vfpv4"
int a, c, d;
float b;
-static int fn1 ()
+ int fn1 ()
{
return 0;
}
@@ -23,4 +23,8 @@ void fn2 ()
d = b * c + a;
}
-/* { dg-final { scan-assembler-times "\.fpu vfp" 1 } } */
+/* Because we don't know the exact command-line options used to invoke the test
+ we cannot expect these tests to match exactly once. But they must appear at
+ least once. */
+/* { dg-final { scan-assembler "\.fpu\\s+vfp\n" } } */
+/* { dg-final { scan-assembler "\.fpu\\s+neon-vfpv4\n" } } */
diff --git a/gcc/testsuite/gcc.target/arm/pr98636.c b/gcc/testsuite/gcc.target/arm/pr98636.c
index c4d235c..559f9a2 100644
--- a/gcc/testsuite/gcc.target/arm/pr98636.c
+++ b/gcc/testsuite/gcc.target/arm/pr98636.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-mfp16-format=alternative" } */
+/* { dg-require-effective-target arm_softfp_ok } */
+/* { dg-options "-mfp16-format=alternative -mfloat-abi=softfp" } */
#pragma GCC push_options
# pragma GCC target ("arch=armv8.2-a+fp16") /* { dg-error "selected fp16 options are incompatible" } */
diff --git a/gcc/testsuite/gcc.target/arm/pr99596.c b/gcc/testsuite/gcc.target/arm/pr99596.c
new file mode 100644
index 0000000..2b8b4c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr99596.c
@@ -0,0 +1,18 @@
+/* { dg-options "-Os -mtune=xscale" } */
+
+register int a asm("sp");
+extern int b;
+typedef struct {
+ long c[16 * 8 / 32];
+} d;
+int e;
+int f;
+int g;
+d h;
+int j(int, int, int, d);
+int i(void) {
+ for (;;) {
+ b &&j(e, f, g, h);
+ j(e, f, g, h);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/arm/pr99724.c b/gcc/testsuite/gcc.target/arm/pr99724.c
new file mode 100644
index 0000000..5411078
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr99724.c
@@ -0,0 +1,31 @@
+/* PR target/99724 */
+/* { dg-do compile } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { "-mcpu=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { "-mabi=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { "-march=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" } } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-require-effective-target arm_iwmmxt_ok } */
+/* { dg-options "-O1 -mcpu=iwmmxt" } */
+
+typedef int V __attribute__((vector_size (8)));
+struct __attribute__((packed)) S { char a; V b; char c[7]; };
+
+void
+foo (V *x)
+{
+ *x = ~*x;
+}
+
+void
+bar (V *x)
+{
+ *x = -*x;
+}
+
+void
+baz (V *x, struct S *p)
+{
+ V y = p->b;
+ *x = y;
+}
diff --git a/gcc/testsuite/gcc.target/arm/pr99727.c b/gcc/testsuite/gcc.target/arm/pr99727.c
new file mode 100644
index 0000000..92585e2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr99727.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-options "-O3" } */
+/* { dg-add-options arm_v8_1m_mve } */
+
+char a[7][25][15][14];
+void b() {
+ for (int c;; ++c)
+ for (int d = 0; d < 25; ++d)
+ for (int e = 0; e < 15; ++e)
+ for (int f = 0; f < 14; ++f)
+ a[c][d][e][f] = 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/pr99786.c b/gcc/testsuite/gcc.target/arm/pr99786.c
new file mode 100644
index 0000000..11d86f0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr99786.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { "-mcpu=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { "-mabi=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { "-march=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" } } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-require-effective-target arm_iwmmxt_ok } */
+/* { dg-options "-O3 -mcpu=iwmmxt" } */
+
+typedef signed char V __attribute__((vector_size (8)));
+
+void
+foo (V *a)
+{
+ *a = *a * 3;
+}
+
+typedef signed short Vshort __attribute__((vector_size (8)));
+void
+foo_short (Vshort *a)
+{
+ *a = *a * 3;
+}
+
+typedef signed int Vint __attribute__((vector_size (8)));
+void
+foo_int (Vint *a)
+{
+ *a = *a * 3;
+}
diff --git a/gcc/testsuite/gcc.target/arm/pr99977.c b/gcc/testsuite/gcc.target/arm/pr99977.c
new file mode 100644
index 0000000..db330e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr99977.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v8m_base_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8m_base } */
+_Bool f1(int *p) { return __sync_bool_compare_and_swap (p, -1, 2); }
+_Bool f2(int *p) { return __sync_bool_compare_and_swap (p, -8, 2); }
+int g1(int *p) { return __sync_val_compare_and_swap (p, -1, 2); }
+int g2(int *p) { return __sync_val_compare_and_swap (p, -8, 3); }
diff --git a/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute.c b/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute.c
index 174be85..7e63cf5 100644
--- a/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute.c
+++ b/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute.c
@@ -22,5 +22,8 @@ uint32_t restored ()
return bar();
}
-/* { dg-final { scan-assembler-times {\.fpu\s+vfpv4} 1 } } */
-/* { dg-final { scan-assembler-times {\.fpu\s+vfpv3-d16} 1 } } */
+/* We can't tell exactly how many times the following tests will match because
+ command-line options may cause additional instances to be generated, but
+ each must be present at least once. */
+/* { dg-final { scan-assembler {\.fpu\s+vfpv4\n} } } */
+/* { dg-final { scan-assembler {\.fpu\s+vfpv3-d16\n} } } */
diff --git a/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute_2.c b/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute_2.c
index add40dd..398d8ff 100644
--- a/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute_2.c
+++ b/gcc/testsuite/gcc.target/arm/pragma_fpu_attribute_2.c
@@ -25,5 +25,8 @@ uint32_t restored ()
return bar();
}
-/* { dg-final { scan-assembler-times {\.fpu\s+vfpv4} 1 } } */
-/* { dg-final { scan-assembler-times {\.fpu\s+vfpv3-d16} 1 } } */
+/* We can't tell exactly how many times the following tests will match because
+ command-line options may cause additional instances to be generated, but
+ each must be present at least once. */
+/* { dg-final { scan-assembler {\.fpu\s+vfpv4\n} } } */
+/* { dg-final { scan-assembler {\.fpu\s+vfpv3-d16\n} } } */
diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
index a43d71f..3c69614 100644
--- a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
+++ b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
@@ -4,18 +4,20 @@
int arr[1000];
int *f4 (void) { return &arr[1]; }
-/* For cortex-m0 (thumb-1/v6m), we generate 4 movs with upper/lower:#arr+4. */
-/* { dg-final { scan-assembler-times "\\+4" 4 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
+/* For cortex-m0 (thumb-1/v6m), we generate 2 pairs of movs/adds with upper/lower:#arr+4. */
+/* { dg-final { scan-assembler-times "arr\\+4" 4 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
/* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we
- generate a movt/movw pair with upper/lower:#arr+4. */
-/* { dg-final { scan-assembler-times "\\+4" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+ generate a movt/movw pair with upper/lower:#arr+4 possibly via an anchor. */
+/* { dg-final { scan-assembler-times "upper16:\[^ \]+.\\+4" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+/* { dg-final { scan-assembler-times "lower16:\[^ \]+\\+4" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
int *f5 (void) { return &arr[80]; }
/* For cortex-m0 (thumb-1/v6m), we generate 1 ldr from rodata pointer to arr+320. */
-/* { dg-final { scan-assembler-times "\\+320" 1 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
+/* { dg-final { scan-assembler-times "arr\\+320" 1 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
/* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we
- generate a movt/movw pair with upper/lower:arr+320. */
-/* { dg-final { scan-assembler-times "\\+320" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+ generate a movt/movw pair with upper/lower:arr+320 possibly via an anchor. */
+/* { dg-final { scan-assembler-times "upper16:\[^ \]+\\+320" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+/* { dg-final { scan-assembler-times "lower16:\[^ \]+\\+320" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c
index 6729af7..c043049 100644
--- a/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c
@@ -1,7 +1,8 @@
/* { dg-do assemble } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
-/* { dg-additional-options "-save-temps -O2" } */
+/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
/* { dg-final { check-function-bodies "**" "" } } */
#include "arm_neon.h"
diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c
index 5f9c85b..cc64e23 100644
--- a/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c
@@ -1,7 +1,8 @@
/* { dg-do assemble } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
-/* { dg-additional-options "-save-temps -O2" } */
+/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
/* { dg-final { check-function-bodies "**" "" } } */
#include <arm_neon.h>
diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c
index 663e769..4d91614 100644
--- a/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c
@@ -1,4 +1,5 @@
/* { dg-do assemble } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c
index 2657b6f..5c6cdd5 100644
--- a/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c
@@ -1,4 +1,5 @@
/* { dg-do assemble } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
/* { dg-add-options arm_v8_2a_bf16_neon } */
/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c
new file mode 100644
index 0000000..029c931
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c
@@ -0,0 +1,80 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+/* Integer tests. */
+
+#define COMPARE_REG(NAME, OP, TYPE) \
+ TYPE \
+ cmp_##NAME##_##TYPE##_reg (TYPE a, TYPE b) \
+ { \
+ return a OP b; \
+ }
+
+#define COMPARE_REG_AND_ZERO(NAME, OP, TYPE) \
+ COMPARE_REG (NAME, OP, TYPE) \
+ \
+ TYPE \
+ cmp_##NAME##_##TYPE##_zero (TYPE a) \
+ { \
+ return a OP (TYPE) {}; \
+ }
+
+#define COMPARE_TYPE(TYPE, COMPARE_ORDERED) \
+ COMPARE_REG_AND_ZERO (eq, ==, TYPE) \
+ COMPARE_REG_AND_ZERO (ne, !=, TYPE) \
+ COMPARE_ORDERED (lt, <, TYPE) \
+ COMPARE_ORDERED (le, <=, TYPE) \
+ COMPARE_ORDERED (gt, >, TYPE) \
+ COMPARE_ORDERED (ge, >=, TYPE)
+
+#define TEST_TYPE(NAME, ELEM, COMPARE_ORDERED, SIZE) \
+ typedef ELEM NAME##SIZE __attribute__((vector_size(SIZE))); \
+ COMPARE_TYPE (NAME##SIZE, COMPARE_ORDERED)
+
+/* 64-bits vectors, not vectorized. */
+TEST_TYPE (vs8, __INT8_TYPE__, COMPARE_REG_AND_ZERO, 8)
+TEST_TYPE (vu8, __UINT8_TYPE__, COMPARE_REG, 8)
+TEST_TYPE (vs16, __INT16_TYPE__, COMPARE_REG_AND_ZERO, 8)
+TEST_TYPE (vu16, __UINT16_TYPE__, COMPARE_REG, 8)
+TEST_TYPE (vs32, __INT32_TYPE__, COMPARE_REG_AND_ZERO, 8)
+TEST_TYPE (vu32, __UINT32_TYPE__, COMPARE_REG, 8)
+
+/* 128-bits vectors. */
+TEST_TYPE (vs8, __INT8_TYPE__, COMPARE_REG_AND_ZERO, 16)
+TEST_TYPE (vu8, __UINT8_TYPE__, COMPARE_REG, 16)
+TEST_TYPE (vs16, __INT16_TYPE__, COMPARE_REG_AND_ZERO, 16)
+TEST_TYPE (vu16, __UINT16_TYPE__, COMPARE_REG, 16)
+TEST_TYPE (vs32, __INT32_TYPE__, COMPARE_REG_AND_ZERO, 16)
+TEST_TYPE (vu32, __UINT32_TYPE__, COMPARE_REG, 16)
+
+/* { 8 bits } x { eq, ne, lt, le, gt, ge, hi, cs }.
+/* { dg-final { scan-assembler-times {\tvcmp.i8 eq, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.i8 ne, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 lt, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 le, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 gt, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 ge, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u8 hi, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u8 cs, q[0-9]+, q[0-9]+\n} 2 } } */
+
+/* { 16 bits } x { eq, ne, lt, le, gt, ge, hi, cs }.
+/* { dg-final { scan-assembler-times {\tvcmp.i16 eq, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.i16 ne, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 lt, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 le, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 gt, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 ge, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u16 hi, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u16 cs, q[0-9]+, q[0-9]+\n} 2 } } */
+
+/* { 32 bits } x { eq, ne, lt, le, gt, ge, hi, cs }.
+/* { dg-final { scan-assembler-times {\tvcmp.i32 eq, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.i32 ne, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 lt, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 le, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 gt, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 ge, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u32 hi, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u32 cs, q[0-9]+, q[0-9]+\n} 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c
new file mode 100644
index 0000000..8515195
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c
@@ -0,0 +1,38 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */
+
+/* float 32 tests. */
+
+#ifndef ELEM_TYPE
+#define ELEM_TYPE float
+#endif
+#ifndef INT_ELEM_TYPE
+#define INT_ELEM_TYPE __INT32_TYPE__
+#endif
+
+#define COMPARE(NAME, OP) \
+ int_vec \
+ cmp_##NAME##_reg (vec a, vec b) \
+ { \
+ return a OP b; \
+ }
+
+typedef INT_ELEM_TYPE int_vec __attribute__((vector_size(16)));
+typedef ELEM_TYPE vec __attribute__((vector_size(16)));
+
+COMPARE (eq, ==)
+COMPARE (ne, !=)
+COMPARE (lt, <)
+COMPARE (le, <=)
+COMPARE (gt, >)
+COMPARE (ge, >=)
+
+/* eq, ne, lt, le, gt, ge.
+/* { dg-final { scan-assembler-times {\tvcmp.f32\teq, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tne, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tlt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tle, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tgt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tge, q[0-9]+, q[0-9]+\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c
new file mode 100644
index 0000000..76f81e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c
@@ -0,0 +1,38 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */
+
+/* float 16 tests. */
+
+#ifndef ELEM_TYPE
+#define ELEM_TYPE __fp16
+#endif
+#ifndef INT_ELEM_TYPE
+#define INT_ELEM_TYPE __INT16_TYPE__
+#endif
+
+#define COMPARE(NAME, OP) \
+ int_vec \
+ cmp_##NAME##_reg (vec a, vec b) \
+ { \
+ return a OP b; \
+ }
+
+typedef INT_ELEM_TYPE int_vec __attribute__((vector_size(16)));
+typedef ELEM_TYPE vec __attribute__((vector_size(16)));
+
+COMPARE (eq, ==)
+COMPARE (ne, !=)
+COMPARE (lt, <)
+COMPARE (le, <=)
+COMPARE (gt, >)
+COMPARE (ge, >=)
+
+/* eq, ne, lt, le, gt, ge.
+/* { dg-final { scan-assembler-times {\tvcmp.f16\teq, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tne, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tlt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tle, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tgt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tge, q[0-9]+, q[0-9]+\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c
new file mode 100644
index 0000000..7774972
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c
@@ -0,0 +1,69 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#define COMPARE_REG(NAME, OP, TYPE, SCALAR) \
+ TYPE \
+ cmp_##NAME##_##TYPE##_scalar (TYPE a, SCALAR b) \
+ { \
+ return a OP b; \
+ }
+
+#define COMPARE_TYPE(SCALAR, TYPE) \
+ COMPARE_REG (eq, ==, TYPE, SCALAR) \
+ COMPARE_REG (ne, !=, TYPE, SCALAR) \
+ COMPARE_REG (lt, <, TYPE, SCALAR) \
+ COMPARE_REG (le, <=, TYPE, SCALAR) \
+ COMPARE_REG (gt, >, TYPE, SCALAR) \
+ COMPARE_REG (ge, >=, TYPE, SCALAR)
+
+#define TEST_TYPE(NAME, ELEM, SIZE) \
+ typedef ELEM NAME##SIZE __attribute__((vector_size(SIZE))); \
+ COMPARE_TYPE (ELEM, NAME##SIZE)
+
+/* 64-bits vectors, not vectorized. */
+TEST_TYPE (vs8, __INT8_TYPE__, 8)
+TEST_TYPE (vu8, __UINT8_TYPE__, 8)
+TEST_TYPE (vs16, __INT16_TYPE__, 8)
+TEST_TYPE (vu16, __UINT16_TYPE__, 8)
+TEST_TYPE (vs32, __INT32_TYPE__, 8)
+TEST_TYPE (vu32, __UINT32_TYPE__, 8)
+
+/* 128-bits vectors. */
+TEST_TYPE (vs8, __INT8_TYPE__, 16)
+TEST_TYPE (vu8, __UINT8_TYPE__, 16)
+TEST_TYPE (vs16, __INT16_TYPE__, 16)
+TEST_TYPE (vu16, __UINT16_TYPE__, 16)
+TEST_TYPE (vs32, __INT32_TYPE__, 16)
+TEST_TYPE (vu32, __UINT32_TYPE__, 16)
+
+/* { 8 bits } x { eq, ne, lt, le, gt, ge, hi, cs }.
+/* { dg-final { scan-assembler-times {\tvcmp.i8 eq, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.i8 ne, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 lt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 le, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 gt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s8 ge, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u8 hi, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u8 cs, q[0-9]+, q[0-9]+\n} 2 } } */
+
+/* { 16 bits } x { eq, ne, lt, le, gt, ge, hi, cs }.
+/* { dg-final { scan-assembler-times {\tvcmp.i16 eq, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.i16 ne, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 lt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 le, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 gt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s16 ge, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u16 hi, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u16 cs, q[0-9]+, q[0-9]+\n} 2 } } */
+
+/* { 32 bits } x { eq, ne, lt, le, gt, ge, hi, cs }.
+/* { dg-final { scan-assembler-times {\tvcmp.i32 eq, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.i32 ne, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 lt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 le, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 gt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s32 ge, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u32 hi, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u32 cs, q[0-9]+, q[0-9]+\n} 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vabs.c b/gcc/testsuite/gcc.target/arm/simd/mve-vabs.c
new file mode 100644
index 0000000..64cd1c2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vabs.c
@@ -0,0 +1,44 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */
+
+#include <stdint.h>
+#include <arm_mve.h>
+
+#define ABS(a) ((a < 0) ? -a : a)
+
+#define FUNC(SIGN, TYPE, BITS, NB, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, TYPE##BITS##_t *a) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = ABS(a[i]); \
+ } \
+}
+
+#define FUNC_FLOAT(SIGN, TYPE, BITS, NB, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE * __restrict__ dest, TYPE *a) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = ABS(a[i]); \
+ } \
+}
+
+/* 128-bit vectors. */
+FUNC(s, int, 32, 4, vabs)
+FUNC(u, uint, 32, 4, vabs)
+FUNC(s, int, 16, 8, vabs)
+FUNC(u, uint, 16, 8, vabs)
+FUNC(s, int, 8, 16, vabs)
+FUNC(u, uint, 8, 16, vabs)
+FUNC_FLOAT(f, float, 32, 4, vabs)
+FUNC(f, float, 16, 8, vabs)
+
+/* Taking the absolute value of an unsigned value is a no-op, so half of the
+ integer optimizations actually generate a call to memmove, the other ones a
+ 'vabs'. */
+/* { dg-final { scan-assembler-times {vabs.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */
+/* { dg-final { scan-assembler-times {vabs.f[0-9]+ q[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vldr[bhw].[0-9]+\tq[0-9]+} 5 } } */
+/* { dg-final { scan-assembler-times {vstr[bhw].[0-9]+\tq[0-9]+} 5 } } */
+/* { dg-final { scan-assembler-times {memmove} 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c
new file mode 100644
index 0000000..15a9daa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP b[i]; \
+ } \
+}
+
+/* 128-bit vectors. */
+FUNC(s, int, 32, 4, +, vadd)
+FUNC(u, uint, 32, 4, +, vadd)
+FUNC(s, int, 16, 8, +, vadd)
+FUNC(u, uint, 16, 8, +, vadd)
+FUNC(s, int, 8, 16, +, vadd)
+FUNC(u, uint, 8, 16, +, vadd)
+
+/* { dg-final { scan-assembler-times {vadd\.i32 q[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vadd\.i16 q[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vadd\.i8 q[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+
+void test_vadd_f32 (float * dest, float * a, float * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] + b[i];
+ }
+}
+/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+void test_vadd_f16 (__fp16 * dest, __fp16 * a, __fp16 * b) {
+ int i;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] + b[i];
+ }
+}
+/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
new file mode 100644
index 0000000..bbf70e1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP 1; \
+ } \
+}
+
+/* 128-bit vectors. */
+FUNC_IMM(s, int, 32, 4, +, vaddimm)
+FUNC_IMM(u, uint, 32, 4, +, vaddimm)
+FUNC_IMM(s, int, 16, 8, +, vaddimm)
+FUNC_IMM(u, uint, 16, 8, +, vaddimm)
+FUNC_IMM(s, int, 8, 16, +, vaddimm)
+FUNC_IMM(u, uint, 8, 16, +, vaddimm)
+
+/* For the moment we do not select the T2 vadd variant operating on a scalar
+ final argument. */
+/* { dg-final { scan-assembler-times {vadd\.i32 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vadd\.i16 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vadd\.i8 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+
+void test_vaddimm_f32 (float * dest, float * a) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] + 5.0;
+ }
+}
+/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
+
+/* Note that dest[i] = a[i] + 5.0f16 is not vectorized. */
+void test_vaddimm_f16 (__fp16 * dest, __fp16 * a) {
+ int i;
+ __fp16 b = 5.0f16;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] + b;
+ }
+}
+/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vaddv-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vaddv-1.c
new file mode 100644
index 0000000..b6b0bc3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vaddv-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC(SIGN, TYPE, BITS, NB) \
+ TYPE##32_t test_ ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t *a) { \
+ int i; \
+ TYPE##BITS##_t result = 0; \
+ for (i=0; i<NB; i++) { \
+ result += a[i]; \
+ } \
+ return result; \
+}
+
+/* 128-bit vectors. */
+FUNC(s, int, 8, 16)
+FUNC(u, uint, 8, 16)
+FUNC(s, int, 16, 8)
+FUNC(u, uint, 16, 8)
+FUNC(s, int, 32, 4)
+FUNC(u, uint, 32, 4)
+
+/* { dg-final { scan-assembler-times {vaddv\.s} 6 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vclz.c b/gcc/testsuite/gcc.target/arm/simd/mve-vclz.c
new file mode 100644
index 0000000..5d6e991c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vclz.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC(SIGN, TYPE, BITS, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a) { \
+ int i; \
+ for (i=0; i < (128 / BITS); i++) { \
+ dest[i] = (TYPE##BITS##_t)__builtin_clz(a[i]); \
+ } \
+}
+
+FUNC(s, int, 32, clz)
+FUNC(u, uint, 32, clz)
+FUNC(s, int, 16, clz)
+FUNC(u, uint, 16, clz)
+FUNC(s, int, 8, clz)
+FUNC(u, uint, 8, clz)
+
+/* 16 and 8-bit versions still use 32-bit intermediate temporaries, so for
+ instance instead of using vclz.i8, we need 4 vclz.i32, leading to a total of
+ 14 vclz.i32 expected in this testcase. */
+/* { dg-final { scan-assembler-times {vclz\.i32 q[0-9]+, q[0-9]+} 14 } } */
+/* { dg-final { scan-assembler-times {vclz\.i16 q[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vclz\.i8 q[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c
new file mode 100644
index 0000000..dbae2d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */
+
+#include <stdint.h>
+
+#define NB 8
+
+#define FUNC(OP, NAME) \
+ void test_ ## NAME ##_f (__fp16 * __restrict__ dest, __fp16 *a, __fp16 *b) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP b[i]; \
+ } \
+ }
+
+FUNC(==, vcmpeq)
+FUNC(!=, vcmpne)
+FUNC(<, vcmplt)
+FUNC(<=, vcmple)
+FUNC(>, vcmpgt)
+FUNC(>=, vcmpge)
+
+/* { dg-final { scan-assembler-times {\tvcmp.f16\teq, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tne, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tlt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tle, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tgt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f16\tge, q[0-9]+, q[0-9]+\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c
new file mode 100644
index 0000000..4ed449e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */
+
+#include <stdint.h>
+
+#define NB 4
+
+#define FUNC(OP, NAME) \
+ void test_ ## NAME ##_f (float * __restrict__ dest, float *a, float *b) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP b[i]; \
+ } \
+ }
+
+FUNC(==, vcmpeq)
+FUNC(!=, vcmpne)
+FUNC(<, vcmplt)
+FUNC(<=, vcmple)
+FUNC(>, vcmpgt)
+FUNC(>=, vcmpge)
+
+/* { dg-final { scan-assembler-times {\tvcmp.f32\teq, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tne, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tlt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tle, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tgt, q[0-9]+, q[0-9]+\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.f32\tge, q[0-9]+, q[0-9]+\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c
new file mode 100644
index 0000000..8da15e7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c
@@ -0,0 +1,50 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP b[i]; \
+ } \
+}
+
+#define ALL_FUNCS(OP, NAME) \
+ FUNC(s, int, 32, 2, OP, NAME) \
+ FUNC(u, uint, 32, 2, OP, NAME) \
+ FUNC(s, int, 16, 4, OP, NAME) \
+ FUNC(u, uint, 16, 4, OP, NAME) \
+ FUNC(s, int, 8, 8, OP, NAME) \
+ FUNC(u, uint, 8, 8, OP, NAME) \
+ FUNC(s, int, 32, 4, OP, NAME) \
+ FUNC(u, uint, 32, 4, OP, NAME) \
+ FUNC(s, int, 16, 8, OP, NAME) \
+ FUNC(u, uint, 16, 8, OP, NAME) \
+ FUNC(s, int, 8, 16, OP, NAME) \
+ FUNC(u, uint, 8, 16, OP, NAME)
+
+ALL_FUNCS(==, vcmpeq)
+ALL_FUNCS(!=, vcmpne)
+ALL_FUNCS(<, vcmplt)
+ALL_FUNCS(<=, vcmple)
+ALL_FUNCS(>, vcmpgt)
+ALL_FUNCS(>=, vcmpge)
+
+/* MVE has only 128-bit vectors, so we can vectorize only half of the
+ functions above. */
+/* { dg-final { scan-assembler-times {\tvcmp.i[0-9]+ eq, q[0-9]+, q[0-9]+\n} 6 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.i[0-9]+ ne, q[0-9]+, q[0-9]+\n} 6 } } */
+
+/* lt, le, gt, ge apply to signed types, cs and hi to unsigned types. */
+/* lt and le with unsigned types are replaced with the opposite condition, hence
+ the double number of matches for cs and hi. */
+/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ lt, q[0-9]+, q[0-9]+\n} 3 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ le, q[0-9]+, q[0-9]+\n} 3 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ gt, q[0-9]+, q[0-9]+\n} 3 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ ge, q[0-9]+, q[0-9]+\n} 3 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u[0-9]+ cs, q[0-9]+, q[0-9]+\n} 6 } } */
+/* { dg-final { scan-assembler-times {\tvcmp.u[0-9]+ hi, q[0-9]+, q[0-9]+\n} 6 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vec-pack.c b/gcc/testsuite/gcc.target/arm/simd/mve-vec-pack.c
new file mode 100644
index 0000000..43642b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vec-pack.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC(SIGN, TYPE, DSTBITS, BITS, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##DSTBITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a) { \
+ int i; \
+ for (i=0; i < (256 / BITS); i++) { \
+ dest[i] = a[i]; \
+ } \
+ }
+
+FUNC(s, int, 16, 32, pack)
+FUNC(u, uint, 16, 32, pack)
+FUNC(s, int, 8, 16, pack)
+FUNC(u, uint, 8, 16, pack)
+
+/* { dg-final { scan-assembler-times {vmovnt\.i32\tq[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vmovnb\.i32\tq[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vmovnt\.i16\tq[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vmovnb\.i16\tq[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vldr\.64\td[0-9]+, \.L} } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vec-unpack.c b/gcc/testsuite/gcc.target/arm/simd/mve-vec-unpack.c
new file mode 100644
index 0000000..cdc62f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vec-unpack.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC(SIGN, TYPE, DSTBITS, BITS, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##DSTBITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a) { \
+ int i; \
+ for (i=0; i < (128 / BITS); i++) { \
+ dest[i] = a[i]; \
+ } \
+ }
+
+FUNC(s, int, 32, 16, unpack)
+FUNC(u, uint, 32, 16, unpack)
+FUNC(s, int, 16, 8, unpack)
+FUNC(u, uint, 16, 8, unpack)
+
+/* { dg-final { scan-assembler-times {vmovlt\.s16 q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmovlb\.s16 q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmovlt\.u16 q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmovlb\.u16 q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmovlt\.s8 q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmovlb\.s8 q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmovlt\.u8 q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmovlb\.u8 q[0-9]+, q[0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vhadd-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vhadd-1.c
new file mode 100644
index 0000000..19d5f5a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vhadd-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+/* We force a cast to int64_t to enable the vectorizer when dealing with 32-bit
+ inputs. */
+#define FUNC(SIGN, TYPE, BITS, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+ int i; \
+ for (i=0; i < (128 / BITS); i++) { \
+ dest[i] = ((int64_t)a[i] OP b[i]) >> 1; \
+ } \
+}
+
+FUNC(s, int, 32, +, vhadd)
+FUNC(u, uint, 32, +, vhadd)
+FUNC(s, int, 16, +, vhadd)
+FUNC(u, uint, 16, +, vhadd)
+FUNC(s, int, 8, +, vhadd)
+FUNC(u, uint, 8, +, vhadd)
+
+/* { dg-final { scan-assembler-times {vhadd\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vhadd-2.c b/gcc/testsuite/gcc.target/arm/simd/mve-vhadd-2.c
new file mode 100644
index 0000000..30029fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vhadd-2.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+/* We force a cast to int64_t to enable the vectorizer when dealing with 32-bit
+ inputs. */
+#define FUNC(SIGN, TYPE, BITS, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+ int i; \
+ for (i=0; i < (128 / BITS); i++) { \
+ dest[i] = ((int64_t)a[i] OP b[i] + 1) >> 1; \
+ } \
+}
+
+FUNC(s, int, 32, +, vrhadd)
+FUNC(u, uint, 32, +, vrhadd)
+FUNC(s, int, 16, +, vrhadd)
+FUNC(u, uint, 16, +, vrhadd)
+FUNC(s, int, 8, +, vrhadd)
+FUNC(u, uint, 8, +, vrhadd)
+
+/* { dg-final { scan-assembler-times {vrhadd\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vld2.c b/gcc/testsuite/gcc.target/arm/simd/mve-vld2.c
new file mode 100644
index 0000000..9c7c3f5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vld2.c
@@ -0,0 +1,96 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define M00 100
+#define M10 216
+#define M01 1322
+#define M11 13
+
+#define N 128
+
+
+/* Integer tests. */
+#define FUNC(SIGN, TYPE, BITS) \
+ void foo_##SIGN##BITS##x (TYPE##BITS##_t *__restrict__ pInput, \
+ TYPE##BITS##_t *__restrict__ pOutput) \
+ { \
+ unsigned int i; \
+ TYPE##BITS##_t a, b; \
+ \
+ for (i = 0; i < N / BITS; i++) \
+ { \
+ a = *pInput++; \
+ b = *pInput++; \
+ \
+ *pOutput++ = M00 * a + M01 * b; \
+ *pOutput++ = M10 * a + M11 * b; \
+ } \
+ }
+
+FUNC(s, int, 8)
+FUNC(u, uint, 8)
+FUNC(s, int, 16)
+FUNC(u, uint, 16)
+FUNC(s, int, 32)
+FUNC(u, uint, 32)
+
+/* float test, keep the macro because it's similar to the above, but does not
+ need the ##BITS##_t. */
+#define FUNC_FLOAT(SIGN, TYPE, BITS) \
+ void foo_##SIGN##BITS##x (TYPE *__restrict__ pInput, \
+ TYPE *__restrict__ pOutput) \
+ { \
+ unsigned int i; \
+ TYPE a, b; \
+ \
+ for (i = 0; i < N / BITS; i++) \
+ { \
+ a = *pInput++; \
+ b = *pInput++; \
+ \
+ *pOutput++ = M00 * a + M01 * b; \
+ *pOutput++ = M10 * a + M11 * b; \
+ } \
+ }
+
+FUNC_FLOAT(f, float, 32)
+
+/* __fp16 test, needs explicit casts to avoid conversions to floating-point and
+ failure to vectorize. */
+__fp16 M00_fp16 = 100.0f16;
+__fp16 M10_fp16 = 216.0f16;
+__fp16 M01_fp16 = 1322.0f16;
+__fp16 M11_fp16 = 13.0f16;
+
+#define FUNC_FLOAT_FP16(SIGN, TYPE, BITS) \
+ void foo_##SIGN##BITS##x (TYPE *__restrict__ pInput, \
+ TYPE *__restrict__ pOutput) \
+ { \
+ unsigned int i; \
+ TYPE a, b; \
+ \
+ for (i = 0; i < N / BITS; i++) \
+ { \
+ a = *pInput++; \
+ b = *pInput++; \
+ \
+ *pOutput++ = (__fp16)(M00_fp16 * a) + (__fp16)(M01_fp16 * b); \
+ *pOutput++ = (__fp16)(M10_fp16 * a) + (__fp16)(M11_fp16 * b); \
+ } \
+ }
+
+FUNC_FLOAT_FP16(f, __fp16, 16)
+
+/* vld2X.8 is used for signed and unsigned chars: 2 pairs. */
+/* vld2X.16 is used for signed and unsigned shorts and __fp16: 3 pairs. */
+/* vld2X.32 is used for signed and unsigned ints and float: 3 pairs. */
+/* { dg-final { scan-assembler-times {vld2[01].8\t.q[0-9]+, q[0-9]+., } 4 } } */
+/* { dg-final { scan-assembler-times {vld2[01].16\t.q[0-9]+, q[0-9]+., } 6 } } */
+/* { dg-final { scan-assembler-times {vld2[01].32\t.q[0-9]+, q[0-9]+., } 6 } } */
+/* { dg-final { scan-assembler-times {vst2[01].8\t.q[0-9]+, q[0-9]+., } 4 } } */
+/* { dg-final { scan-assembler-times {vst2[01].16\t.q[0-9]+, q[0-9]+., } 6 } } */
+/* { dg-final { scan-assembler-times {vst2[01].32\t.q[0-9]+, q[0-9]+., } 6 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vld4.c b/gcc/testsuite/gcc.target/arm/simd/mve-vld4.c
new file mode 100644
index 0000000..ce3e755
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vld4.c
@@ -0,0 +1,140 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define M00 100
+#define M10 216
+#define M20 23
+#define M30 237
+#define M01 1322
+#define M11 13
+#define M21 27271
+#define M31 2280
+#define M02 74
+#define M12 191
+#define M22 500
+#define M32 111
+#define M03 134
+#define M13 117
+#define M23 11
+#define M33 771
+
+#define N 128
+
+/* Integer tests. */
+#define FUNC(SIGN, TYPE, BITS) \
+ void foo_##SIGN##BITS##x (TYPE##BITS##_t *__restrict__ pInput, \
+ TYPE##BITS##_t *__restrict__ pOutput) \
+ { \
+ unsigned int i; \
+ TYPE##BITS##_t a, b, c, d; \
+ \
+ for (i = 0; i < N / BITS; i++) \
+ { \
+ a = *pInput++; \
+ b = *pInput++; \
+ c = *pInput++; \
+ d = *pInput++; \
+ \
+ *pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d; \
+ *pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d; \
+ *pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d; \
+ *pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d; \
+ } \
+ }
+
+FUNC(s, int, 8)
+FUNC(u, uint, 8)
+FUNC(s, int, 16)
+FUNC(u, uint, 16)
+FUNC(s, int, 32)
+FUNC(u, uint, 32)
+
+/* float test, keep the macro because it's similar to the above, but does not
+ need the ##BITS##_t. */
+#define FUNC_FLOAT(SIGN, TYPE, BITS) \
+ void foo_##SIGN##BITS##x (TYPE *__restrict__ pInput, \
+ TYPE *__restrict__ pOutput) \
+ { \
+ unsigned int i; \
+ TYPE a, b, c, d; \
+ \
+ for (i = 0; i < N / BITS; i++) \
+ { \
+ a = *pInput++; \
+ b = *pInput++; \
+ c = *pInput++; \
+ d = *pInput++; \
+ \
+ *pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d; \
+ *pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d; \
+ *pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d; \
+ *pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d; \
+ } \
+ }
+
+FUNC_FLOAT(f, float, 32)
+
+/* __fp16 test, needs explicit casts to avoid conversions to floating-point and
+ failure to vectorize. */
+__fp16 M00_fp16 = 100.0f16;
+__fp16 M10_fp16 = 216.0f16;
+__fp16 M20_fp16 = 23.0f16;
+__fp16 M30_fp16 = 237.0f16;
+__fp16 M01_fp16 = 1322.0f16;
+__fp16 M11_fp16 = 13.0f16;
+__fp16 M21_fp16 = 27271.0f16;
+__fp16 M31_fp16 = 2280.0f16;
+__fp16 M02_fp16 = 74.0f16;
+__fp16 M12_fp16 = 191.0f16;
+__fp16 M22_fp16 = 500.0f16;
+__fp16 M32_fp16 = 111.0f16;
+__fp16 M03_fp16 = 134.0f16;
+__fp16 M13_fp16 = 117.0f16;
+__fp16 M23_fp16 = 11.0f16;
+__fp16 M33_fp16 = 771.0f16;
+
+#define FUNC_FLOAT_FP16(SIGN, TYPE, BITS) \
+ void foo_##SIGN##BITS##x (TYPE *__restrict__ pInput, \
+ TYPE *__restrict__ pOutput) \
+ { \
+ unsigned int i; \
+ TYPE a, b, c, d; \
+ \
+ for (i = 0; i < N / BITS; i++) \
+ { \
+ a = *pInput++; \
+ b = *pInput++; \
+ c = *pInput++; \
+ d = *pInput++; \
+ \
+ TYPE ab, cd; \
+ ab = (__fp16)(M00_fp16 * a) + (__fp16)(M01_fp16 * b); \
+ cd = (__fp16)(M02_fp16 * c) + (__fp16)(M03_fp16 * d); \
+ *pOutput++ = ab + cd; \
+ ab = (__fp16)(M10_fp16 * a) + (__fp16)(M11_fp16 * b); \
+ cd = (__fp16)(M12_fp16 * c) + (__fp16)(M13_fp16 * d); \
+ *pOutput++ = ab + cd; \
+ ab = (__fp16)(M20_fp16 * a) + (__fp16)(M21_fp16 * b); \
+ cd = (__fp16)(M22_fp16 * c) + (__fp16)(M23_fp16 * d); \
+ *pOutput++ = ab + cd; \
+ ab = (__fp16)(M30_fp16 * a) + (__fp16)(M31_fp16 * b); \
+ cd = (__fp16)(M32_fp16 * c) + (__fp16)(M33_fp16 * d); \
+ *pOutput++ = ab + cd; \
+ } \
+ }
+
+FUNC_FLOAT_FP16(f, __fp16, 16)
+
+/* vld4X.8 is used for signed and unsigned chars: 2 * 4. */
+/* vld4X.16 is used for signed and unsigned shorts and __fp16: 3 * 4. */
+/* vld4X.32 is used for signed and unsigned ints and float: 3 * 4. */
+/* { dg-final { scan-assembler-times {vld4[0123].8\t.q[0-9]+, q[0-9]+, q[0-9]+, q[0-9]+., } 8 } } */
+/* { dg-final { scan-assembler-times {vld4[0123].16\t.q[0-9]+, q[0-9]+, q[0-9]+, q[0-9]+., } 12 } } */
+/* { dg-final { scan-assembler-times {vld4[0123].32\t.q[0-9]+, q[0-9]+, q[0-9]+, q[0-9]+., } 12 } } */
+/* { dg-final { scan-assembler-times {vst4[0123].8\t.q[0-9]+, q[0-9]+, q[0-9]+, q[0-9]+., } 8 } } */
+/* { dg-final { scan-assembler-times {vst4[0123].16\t.q[0-9]+, q[0-9]+, q[0-9]+, q[0-9]+., } 12 } } */
+/* { dg-final { scan-assembler-times {vst4[0123].32\t.q[0-9]+, q[0-9]+, q[0-9]+, q[0-9]+., } 12 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c
new file mode 100644
index 0000000..22be452
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c
@@ -0,0 +1,60 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP 5; \
+ } \
+}
+
+/* 128-bit vectors. */
+FUNC_IMM(s, int, 32, 4, *, vmulimm)
+FUNC_IMM(u, uint, 32, 4, *, vmulimm)
+FUNC_IMM(s, int, 16, 8, *, vmulimm)
+FUNC_IMM(u, uint, 16, 8, *, vmulimm)
+FUNC_IMM(s, int, 8, 16, *, vmulimm)
+FUNC_IMM(u, uint, 8, 16, *, vmulimm)
+
+/* For the moment we do not select the T2 vmul variant operating on a scalar
+ final argument. */
+/* { dg-final { scan-assembler-times {vmul\.i32\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vmul\.i16\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vmul\.i8\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+
+void test_vmul_f32 (float * dest, float * a, float * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] * b[1];
+ }
+}
+void test_vmulimm_f32 (float * dest, float * a) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] * 5.0;
+ }
+}
+/* { dg-final { scan-assembler-times {vmul\.f32\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+
+void test_vmul_f16 (__fp16 * dest, __fp16 * a, __fp16 * b) {
+ int i;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+/* Note that dest[i] = a[i] * 5.0f16 is not vectorized. */
+void test_vmulimm_f16 (__fp16 * dest, __fp16 * a) {
+ int i;
+ __fp16 b = 5.0f16;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] * b;
+ }
+}
+/* { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vshl.c b/gcc/testsuite/gcc.target/arm/simd/mve-vshl.c
index 7a06449..91dd942 100644
--- a/gcc/testsuite/gcc.target/arm/simd/mve-vshl.c
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vshl.c
@@ -56,7 +56,10 @@ FUNC_IMM(u, uint, 8, 16, <<, vshlimm)
/* MVE has only 128-bit vectors, so we can vectorize only half of the
functions above. */
/* We only emit vshl.u, which is equivalent to vshl.s anyway. */
-/* { dg-final { scan-assembler-times {vshl.u[0-9]+\tq[0-9]+, q[0-9]+} 2 } } */
+/* 16 and 8-bit versions still use 32-bit intermediate temporaries, so for
+ instance instead of using vshl.u8, we need 4 vshl.i32, leading to a total of
+ 14 vshl.i32 expected in this testcase. */
+/* { dg-final { scan-assembler-times {vshl.u[0-9]+\tq[0-9]+, q[0-9]+} 14 } } */
/* We emit vshl.i when the shift amount is an immediate. */
/* { dg-final { scan-assembler-times {vshl.i[0-9]+\tq[0-9]+, q[0-9]+} 6 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
index d4e658c..d4258e9 100644
--- a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
@@ -55,5 +55,12 @@ FUNC_IMM(u, uint, 8, 16, >>, vshrimm)
/* MVE has only 128-bit vectors, so we can vectorize only half of the
functions above. */
+/* Vector right shifts use vneg and left shifts. */
+/* { dg-final { scan-assembler-times {vshl.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */
+/* { dg-final { scan-assembler-times {vshl.u[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */
+/* { dg-final { scan-assembler-times {vneg.s[0-9]+ q[0-9]+, q[0-9]+} 6 } } */
+
+
+/* Shift by immediate. */
/* { dg-final { scan-assembler-times {vshr.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */
/* { dg-final { scan-assembler-times {vshr.u[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c
new file mode 100644
index 0000000..61a9a0e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP 1; \
+ } \
+}
+
+/* 128-bit vectors. */
+FUNC_IMM(s, int, 32, 4, -, vsubimm)
+FUNC_IMM(u, uint, 32, 4, -, vsubimm)
+FUNC_IMM(s, int, 16, 8, -, vsubimm)
+FUNC_IMM(u, uint, 16, 8, -, vsubimm)
+FUNC_IMM(s, int, 8, 16, -, vsubimm)
+FUNC_IMM(u, uint, 8, 16, -, vsubimm)
+
+/* For the moment we do not select the T2 vsub variant operating on a scalar
+ final argument, and we use vadd of the opposite. */
+/* { dg-final { scan-assembler-times {vadd\.i32 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vadd\.i16 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vadd\.i8 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+
+void test_vsubimm_f32 (float * dest, float * a) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] - 5.0;
+ }
+}
+/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
+
+/* Note that dest[i] = a[i] + 5.0f16 is not vectorized. */
+void test_vsubimm_f16 (__fp16 * dest, __fp16 * a) {
+ int i;
+ __fp16 b = 5.0f16;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] - b;
+ }
+}
+/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
index 842e5c6..5a6c345 100644
--- a/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
@@ -5,60 +5,42 @@
#include <stdint.h>
-void test_vsub_i32 (int32_t * dest, int32_t * a, int32_t * b) {
- int i;
- for (i=0; i<4; i++) {
- dest[i] = a[i] - b[i];
- }
+#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+ int i; \
+ for (i=0; i<NB; i++) { \
+ dest[i] = a[i] OP b[i]; \
+ } \
}
-void test_vsub_i32_u (uint32_t * dest, uint32_t * a, uint32_t * b) {
- int i;
- for (i=0; i<4; i++) {
- dest[i] = a[i] - b[i];
- }
-}
+/* 128-bit vectors. */
+FUNC(s, int, 32, 4, -, vsub)
+FUNC(u, uint, 32, 4, -, vsub)
+FUNC(s, int, 16, 8, -, vsub)
+FUNC(u, uint, 16, 8, -, vsub)
+FUNC(s, int, 8, 16, -, vsub)
+FUNC(u, uint, 8, 16, -, vsub)
/* { dg-final { scan-assembler-times {vsub\.i32\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
-
-void test_vsub_i16 (int16_t * dest, int16_t * a, int16_t * b) {
- int i;
- for (i=0; i<8; i++) {
- dest[i] = a[i] - b[i];
- }
-}
-
-void test_vsub_i16_u (uint16_t * dest, uint16_t * a, uint16_t * b) {
- int i;
- for (i=0; i<8; i++) {
- dest[i] = a[i] - b[i];
- }
-}
-
/* { dg-final { scan-assembler-times {vsub\.i16\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vsub\.i8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
-void test_vsub_i8 (int8_t * dest, int8_t * a, int8_t * b) {
- int i;
- for (i=0; i<16; i++) {
- dest[i] = a[i] - b[i];
- }
-}
-
-void test_vsub_i8_u (uint8_t * dest, uint8_t * a, uint8_t * b) {
+void test_vsub_f32 (float * dest, float * a, float * b) {
int i;
- for (i=0; i<16; i++) {
+ for (i=0; i<4; i++) {
dest[i] = a[i] - b[i];
}
}
+/* { dg-final { scan-assembler-times {vsub\.f32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
-/* { dg-final { scan-assembler-times {vsub\.i8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
-void test_vsub_f32 (float * dest, float * a, float * b) {
+void test_vsub_f16 (__fp16 * dest, __fp16 * a, __fp16 * b) {
int i;
- for (i=0; i<4; i++) {
+ for (i=0; i<8; i++) {
dest[i] = a[i] - b[i];
}
}
-/* { dg-final { scan-assembler-times {vsub\.f32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vsub\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/neon-vhadd-1.c b/gcc/testsuite/gcc.target/arm/simd/neon-vhadd-1.c
new file mode 100644
index 0000000..ce57784
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/neon-vhadd-1.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-add-options arm_neon } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+/* Since we have implemented the avg* optabs for 128-bit vectors only, use
+ enough iterations to check that vectorization works as expected. */
+
+/* We force a cast to int64_t to enable the vectorizer when dealing with 32-bit
+ inputs. */
+#define FUNC(SIGN, TYPE, BITS, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+ int i; \
+ for (i=0; i < (128 / BITS); i++) { \
+ dest[i] = ((int64_t)a[i] OP b[i]) >> 1; \
+ } \
+}
+
+FUNC(s, int, 32, +, vhadd)
+FUNC(u, uint, 32, +, vhadd)
+FUNC(s, int, 16, +, vhadd)
+FUNC(u, uint, 16, +, vhadd)
+FUNC(s, int, 8, +, vhadd)
+FUNC(u, uint, 8, +, vhadd)
+
+/* { dg-final { scan-assembler-times {vhadd\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vhadd\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/neon-vhadd-2.c b/gcc/testsuite/gcc.target/arm/simd/neon-vhadd-2.c
new file mode 100644
index 0000000..f269254
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/neon-vhadd-2.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-add-options arm_neon } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+/* Since we default to -mvectorize-with-neon-quad, use enough iterations so that
+ we can vectorize using 128-bit vectors. */
+/* We force a cast to int64_t to enable the vectorizer when dealing with 32-bit
+ inputs. */
+#define FUNC(SIGN, TYPE, BITS, OP, NAME) \
+ void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##BITS##_t * __restrict__ dest, \
+ TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+ int i; \
+ for (i=0; i < (128 / BITS); i++) { \
+ dest[i] = ((int64_t)a[i] OP b[i] + 1) >> 1; \
+ } \
+}
+
+FUNC(s, int, 32, +, vrhadd)
+FUNC(u, uint, 32, +, vrhadd)
+FUNC(s, int, 16, +, vrhadd)
+FUNC(u, uint, 16, +, vrhadd)
+FUNC(s, int, 8, +, vrhadd)
+FUNC(u, uint, 8, +, vrhadd)
+
+/* { dg-final { scan-assembler-times {vrhadd\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vrhadd\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/pr97906.c b/gcc/testsuite/gcc.target/arm/simd/pr97906.c
new file mode 100644
index 0000000..7c972e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/pr97906.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+/* { dg-add-options arm_neon } */
+
+#include <arm_neon.h>
+
+uint32x2_t f1(float32x2_t a, float32x2_t b)
+{
+ return vabs_f32 (a) >= vabs_f32 (b);
+}
+
+/* { dg-final { scan-assembler-times {\tvacle.f32\td[0-9]+, d[0-9]+, d[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-not "vabs" } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/pr98435.c b/gcc/testsuite/gcc.target/arm/simd/pr98435.c
new file mode 100644
index 0000000..a4c6a1c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/pr98435.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+/* { dg-require-effective-target arm_softfp_ok } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-mfloat-abi=softfp -march=armv8.2-a+bf16+fp16" } */
+
+#include <arm_neon.h>
+
+bfloat16x4_t f (bfloat16_t a)
+{
+ return (bfloat16x4_t) {a, a, a, a};
+}
+
+/* { dg-final { scan-assembler {\tvdup.16\td[0-9]+, r0} } } */
+/* { dg-final { scan-assembler {\tvmov\tr0, r1, d[0-9]+} } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c b/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c
index 4d5f07b..88b80cf 100644
--- a/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c
@@ -1,7 +1,8 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_i8mm_ok } */
/* { dg-add-options arm_v8_2a_i8mm } */
-/* { dg-additional-options "-O -save-temps" } */
+/* { dg-additional-options "-O -save-temps -mfloat-abi=hard" } */
/* { dg-final { check-function-bodies "**" "" } } */
#include <arm_neon.h>
diff --git a/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c b/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c
index b7b76e2..1c74718 100644
--- a/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c
+++ b/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c
@@ -1,7 +1,8 @@
/* { dg-do assemble { target { arm*-*-* } } } */
+/* { dg-require-effective-target arm_hard_ok } */
/* { dg-require-effective-target arm_v8_2a_i8mm_ok } */
/* { dg-add-options arm_v8_2a_i8mm } */
-/* { dg-additional-options "-O -save-temps -mbig-endian" } */
+/* { dg-additional-options "-O -save-temps -mbig-endian -mfloat-abi=hard" } */
/* { dg-final { check-function-bodies "**" "" } } */
#include <arm_neon.h>
diff --git a/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c b/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c
index d33ebf3..a88c4ea 100644
--- a/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c
@@ -1,6 +1,7 @@
/* { dg-do assemble } */
/* { dg-require-effective-target arm_v8_2a_i8mm_ok } */
-/* { dg-options "-save-temps -O2 -march=armv8.2-a+i8mm -mfpu=auto -mfloat-abi=hard" } */
+/* { dg-options "-save-temps -O2 -mfpu=auto" } */
+/* { dg-add-options arm_v8_2a_i8mm } */
#include "arm_neon.h"
diff --git a/gcc/testsuite/gcc.target/arm/simd/vusdot-autovec.c b/gcc/testsuite/gcc.target/arm/simd/vusdot-autovec.c
new file mode 100644
index 0000000..e7af895
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vusdot-autovec.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_2a_i8mm_ok } */
+/* { dg-options "-O3" } */
+/* { dg-add-options arm_v8_2a_i8mm } */
+
+#define N 480
+#define SIGNEDNESS_1 unsigned
+#define SIGNEDNESS_2 signed
+#define SIGNEDNESS_3 signed
+#define SIGNEDNESS_4 unsigned
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+f (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict a,
+ SIGNEDNESS_4 char *restrict b)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 short mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+SIGNEDNESS_1 int __attribute__ ((noipa))
+g (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict b,
+ SIGNEDNESS_4 char *restrict a)
+{
+ for (__INTPTR_TYPE__ i = 0; i < N; ++i)
+ {
+ int av = a[i];
+ int bv = b[i];
+ SIGNEDNESS_2 short mult = av * bv;
+ res += mult;
+ }
+ return res;
+}
+
+/* { dg-final { scan-assembler-times {vusdot.s8} 2 { target { arm-*-*-gnueabihf } } } } */
diff --git a/gcc/testsuite/gcc.target/arm/unsigned-float.c b/gcc/testsuite/gcc.target/arm/unsigned-float.c
index ad589d9..ea3abc7 100644
--- a/gcc/testsuite/gcc.target/arm/unsigned-float.c
+++ b/gcc/testsuite/gcc.target/arm/unsigned-float.c
@@ -1,8 +1,8 @@
/* { dg-do compile } */
-/* { dg-require-effective-target arm_fp_ok } */
-/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */
/* { dg-skip-if "-mpure-code supports M-profile only" { *-*-* } { "-mpure-code" } } */
-/* { dg-options "-march=armv7-a -O1" } */
+/* { dg-options "-march=armv7-a+fp -mfpu=auto -O1" } */
+/* Do not require arm_ok effective target to avoid skipping on arm-eabi with
+ default configure options. */
/* { dg-add-options arm_fp } */
diff --git a/gcc/testsuite/gcc.target/bpf/alu-1.c b/gcc/testsuite/gcc.target/bpf/alu-1.c
new file mode 100644
index 0000000..9814930
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/alu-1.c
@@ -0,0 +1,56 @@
+/* Ensure 32-bit ALU instructions are not generated if -malu32 is
+ not enabled. */
+
+/* { dg-do compile } */
+/* { dg-options "-mno-alu32" } */
+
+int foo (int a, int b)
+{
+ a += 1;
+ b += a;
+ b -= 5;
+ a -= a;
+
+ a *= 2;
+ b *= a;
+
+ a |= 0xfafa;
+ b |= a;
+ b &= 0x00ffff00;
+ b &= a;
+
+ a <<= 2;
+ b <<= a;
+ b >>= 5;
+ a >>= b;
+
+ int c = a;
+ int d = 5;
+
+ d ^= a;
+ c ^= 0xe5e5e5e5;
+ c = -c;
+
+ unsigned int x = a;
+ unsigned int y = b;
+ x /= 3;
+ y /= x;
+ x %= 4;
+ y %= x;
+
+ return a + b - c + d - x + y;
+}
+
+/* { dg-final { scan-assembler-times "mov32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "add32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "sub32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "mul32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "div32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "mod32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "neg32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "and32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "or32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "xor32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "rsh32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "lsh32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "arsh32\t0" 0 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-attr-1.c b/gcc/testsuite/gcc.target/bpf/core-attr-1.c
new file mode 100644
index 0000000..1af9dc5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-attr-1.c
@@ -0,0 +1,23 @@
+/* Basic test for struct __attribute__((preserve_access_index))
+ for BPF CO-RE support. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ int a;
+ int b;
+ int c;
+} __attribute__((preserve_access_index));
+
+void
+func (struct S * s)
+{
+ /* 0:2 */
+ int *x = &(s->c);
+
+ *x = 4;
+}
+
+/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "bpfcr_type" 1 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-attr-2.c b/gcc/testsuite/gcc.target/bpf/core-attr-2.c
new file mode 100644
index 0000000..25c819a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-attr-2.c
@@ -0,0 +1,21 @@
+/* Basic test for union __attribute__((preserve_access_index))
+ for BPF CO-RE support. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+union U {
+ int a;
+ char c;
+} __attribute__((preserve_access_index));
+
+void
+func (union U *u)
+{
+ /* 0:1 */
+ char *c = &(u->c);
+ *c = 'c';
+}
+
+/* { dg-final { scan-assembler-times "ascii \"0:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "bpfcr_type" 1 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-attr-3.c b/gcc/testsuite/gcc.target/bpf/core-attr-3.c
new file mode 100644
index 0000000..b46549f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-attr-3.c
@@ -0,0 +1,41 @@
+/* Test for __attribute__((preserve_access_index)) for BPF CO-RE support
+ for nested structure.
+
+ Note that even though struct O lacks the attribute, when accessed as a
+ member of another attributed type, CO-RE relocations should still be
+ generated. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct O {
+ int e;
+ int f;
+};
+
+struct S {
+ int a;
+ struct {
+ int b;
+ int c;
+ } inner;
+ struct O other;
+} __attribute__((preserve_access_index));
+
+void
+func (struct S *foo)
+{
+ /* 0:1:1 */
+ int *x = &(foo->inner.c);
+
+ /* 0:2:0 */
+ int *y = &(foo->other.e);
+
+ *x = 4;
+ *y = 5;
+}
+
+/* { dg-final { scan-assembler-times "ascii \"0:1:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:2:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "bpfcr_type" 2 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-attr-4.c b/gcc/testsuite/gcc.target/bpf/core-attr-4.c
new file mode 100644
index 0000000..9c0f966
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-attr-4.c
@@ -0,0 +1,35 @@
+/* Test for BPF CO-RE __attribute__((preserve_access_index)) with accesses on
+ LHS and both LHS and RHS of assignment. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct T {
+ int a;
+ int b;
+ struct U {
+ int c;
+ struct V {
+ int d;
+ int e[4];
+ int f;
+ } v;
+ } u;
+} __attribute__((preserve_access_index));
+
+
+void
+func (struct T *t)
+{
+ /* 0:2:1:1:3 */
+ t->u.v.e[3] = 0xa1;
+
+ /* 0:2:0, 0:0, 0:1 */
+ t->u.c = t->a + t->b;
+}
+
+/* { dg-final { scan-assembler-times "ascii \"0:2:1:1:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:2:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "bpfcr_type" 4 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-1.c b/gcc/testsuite/gcc.target/bpf/core-builtin-1.c
new file mode 100644
index 0000000..e994dc6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-1.c
@@ -0,0 +1,64 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ int a;
+ int b;
+ char c;
+};
+
+union U {
+ unsigned int u;
+ int i;
+ unsigned char uc[4];
+ signed char ic[4];
+};
+
+struct S my_s;
+union U my_u;
+
+unsigned long ula[8];
+
+#define _(x) (__builtin_preserve_access_index (x))
+
+void
+func (void)
+{
+ /* 1 */
+ int b = _(my_s.b);
+
+ /* 2 */
+ char c = _(my_s.c);
+
+ /* 2:3 */
+ unsigned char uc = _(my_u.uc[3]);
+
+ /* 6 */
+ unsigned long ul = _(ula[6]);
+}
+
+char
+s_ptr (struct S *ps)
+{
+ /* 0:2 */
+ char x = _(ps->c);
+ return x;
+}
+
+unsigned char
+u_ptr (union U *pu)
+{
+ /* 0:2:3 */
+ unsigned char x = _(pu->uc[3]);
+ return x;
+}
+
+/* { dg-final { scan-assembler-times "ascii \"1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"2:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"6.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:2:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "bpfcr_type" 6 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x6c\[\t \]+\[^\n\]*core_relo_len" 1 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-2.c b/gcc/testsuite/gcc.target/bpf/core-builtin-2.c
new file mode 100644
index 0000000..c9ec899
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-2.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ int a;
+ union {
+ int _unused;
+ int b;
+ char c;
+ } u[4];
+};
+
+struct S foo;
+
+#define _(x) (__builtin_preserve_access_index (x))
+
+void func (void)
+{
+ char *x = __builtin_preserve_access_index (&foo.u[3].c);
+
+ *x = 's';
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"1:3:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "bpfcr_type" 1 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-3.c b/gcc/testsuite/gcc.target/bpf/core-builtin-3.c
new file mode 100644
index 0000000..190ec26
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-3.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct T {
+ int a;
+ int b;
+ struct U {
+ int c;
+ struct V {
+ int d;
+ int e[4];
+ int f;
+ } v;
+ } u;
+};
+
+void func (struct T * foo)
+{
+ /* Access string: "0:2:1:1:3" */
+ int *x = __builtin_preserve_access_index (&(foo->u.v.e[3]));
+
+ *x = 17;
+}
+
+/* { dg-final { scan-assembler-times "ascii \"0:2:1:1:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "bpfcr_type" 1 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-lto-1.c b/gcc/testsuite/gcc.target/bpf/core-lto-1.c
new file mode 100644
index 0000000..927de23
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-lto-1.c
@@ -0,0 +1,9 @@
+/* Test -mco-re with -flto.
+
+ -mco-re is used to generate information for BPF CO-RE usecase. To support
+ the generataion of the .BTF and .BTF.ext sections in GCC, -flto is disabled
+ with -mco-re. */
+
+/* { dg-do compile } */
+/* { dg-message "sorry, unimplemented: BPF CO-RE does not support LTO" "" { target bpf-*-* } 0 } */
+/* { dg-options "-gbtf -mco-re -flto" } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-section-1.c b/gcc/testsuite/gcc.target/bpf/core-section-1.c
new file mode 100644
index 0000000..031acd5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-section-1.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA -mco-re" } */
+
+struct T {
+ int a;
+ int b;
+ struct U {
+ int c;
+ struct V {
+ int d;
+ int e[4];
+ int f;
+ } v;
+ } u;
+};
+
+__attribute__((section("foo_sec"), used))
+int foo_func (struct T *t)
+{
+ t->u.c = 5;
+ return __builtin_preserve_access_index (t->u.v.e[3]);
+}
+
+__attribute__((section("bar_sec"), used))
+int bar_func (struct T *t)
+{
+ int *x = __builtin_preserve_access_index (&(t->u.v.f));
+ int old = *x;
+ *x = 4;
+ return old;
+}
+
+/* { dg-final { scan-assembler-times "ascii \"0:2:1:1:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:2:1:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo_sec.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"bar_sec.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "bpfcr_type" 2 } } */
+/* { dg-final { scan-assembler-times "btfext_secinfo_rec_size" 2 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/jmp-1.c b/gcc/testsuite/gcc.target/bpf/jmp-1.c
new file mode 100644
index 0000000..eaf8253
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/jmp-1.c
@@ -0,0 +1,57 @@
+/* Ensure jlt, jslt, jle and jsle instructions are not generated if
+ -mjmpext is not enabled, and no 32-bit jump instructions are generated
+ if -mjmp32 is not enabled. */
+
+/* { dg-do compile } */
+/* { dg-options "-mno-jmpext -mno-jmp32" } */
+
+int foo (int a, int b)
+{
+ if (a == 1)
+ b += 1;
+ if (a != 3)
+ b += 2;
+ if (a > 5)
+ b += 3;
+ if (a >= 7)
+ b += 4;
+ if (a < 9)
+ b += 5;
+ if (a <= 10)
+ b += 6;
+
+ return a + b;
+}
+
+unsigned int bar (unsigned int a, unsigned int b)
+{
+ if (a == 1)
+ b += 1;
+ if (a != 3)
+ b += 2;
+ if (a > 5)
+ b += 3;
+ if (a >= 7)
+ b += 4;
+ if (a < 9)
+ b += 5;
+ if (a <= 10)
+ b += 6;
+
+ return a + b;
+}
+
+/* { dg-final { scan-assembler-times "jlt\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jslt\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jle\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jsle\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jeq32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jne32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jlt32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jgt32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jle32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jge32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jslt32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jsgt32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jsle32\t0" 0 } } */
+/* { dg-final { scan-assembler-times "jsge32\t0" 0 } } */
diff --git a/gcc/testsuite/gcc.target/csky/fldrd_fstrd.c b/gcc/testsuite/gcc.target/csky/fldrd_fstrd.c
new file mode 100644
index 0000000..024de18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fldrd_fstrd.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-csky-options "-mcpu=ck810f -O1 -mhard-float" } */
+
+double fldrd (double *pd, int index)
+{
+ return pd[index];
+}
+
+/* { dg-final { scan-assembler "fldrd" } } */
+
+void fstrd (double *pd, int index, double d)
+{
+ pd[index] = d;
+}
+
+/* { dg-final { scan-assembler "fstrd" } } */
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fldr64_fstr64.c b/gcc/testsuite/gcc.target/csky/fpuv3/fldr64_fstr64.c
new file mode 100644
index 0000000..cd367e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fldr64_fstr64.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O1 -mfpu=fpv3" } */
+
+double fldr64 (double *pd, int index)
+{
+ return pd[index];
+}
+
+/* { dg-final { scan-assembler "fldr.64" } } */
+
+void fstr64 (double *pd, int index, double d)
+{
+ pd[index] = d;
+}
+
+/* { dg-final { scan-assembler "fstr.64" } } */
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp b/gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp
new file mode 100644
index 0000000..68c166c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp
@@ -0,0 +1,51 @@
+# GCC testsuite for C-SKY targets FPUV3 instructions.
+# Copyright (C) 2012-2021 Free Software Foundation, Inc.
+# Contributed by C-SKY Microsystems and Mentor Graphics.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+
+# Exit immediately if this isn't a csky target.
+if { ![istarget csky*-*-*]} then {
+ return
+}
+
+set cflags [board_info target cflags]
+if { [string first "ck6" "${cflags}"] >= 0 } {
+ verbose "the test is not support "
+ return
+}
+if { [string first "ck5" "${cflags}"] >= 0 } {
+ verbose "the test is not support "
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS ""
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c
new file mode 100644
index 0000000..32a1551
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float div32(float a, float b){
+ return a/b;
+}
+
+
+float div64(double a, double b){
+ return a/b;
+}
+
+/* { dg-final { scan-assembler "fdiv\.32" } }*/
+/* { dg-final { scan-assembler "fdiv\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c
new file mode 100644
index 0000000..d54b529
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-mfpu=fpv3" } */
+
+__fp16 funch(__fp16 a, __fp16 b)
+{
+ return a + b;
+}
+
+float funcs(float a, float b)
+{
+ return a + b;
+}
+
+double funcd(double a, double b)
+{
+ return a + b;
+}
+
+/* { dg-final { scan-assembler "fadd\.16" } }*/
+/* { dg-final { scan-assembler "fadd\.32" } }*/
+/* { dg-final { scan-assembler "fadd\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c
new file mode 100644
index 0000000..034b15e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float func(double a)
+{
+ return (float)a;
+}
+
+/* { dg-final { scan-assembler "fdtos" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c
new file mode 100644
index 0000000..11c4f9d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c
@@ -0,0 +1,55 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-ffast-math" } */
+
+int lfloor_float32 (float x)
+{
+ return __builtin_lfloorf (x);
+}
+
+int lfloor_float64 (double x)
+{
+ return __builtin_lfloor (x);
+}
+
+
+float floor_float32 (float x)
+{
+ return __builtin_floorf (x);
+}
+
+double floor_float64 (double x)
+{
+ return __builtin_floor (x);
+}
+
+/* { dg-final { scan-assembler "fftoi\.f32\.s32\.rni" } }*/
+/* { dg-final { scan-assembler "fftoi\.f64\.s32\.rni" } }*/
+/* { dg-final { scan-assembler "fftofi\.f32\.rni" } }*/
+/* { dg-final { scan-assembler "fftofi\.f64\.rni" } }*/
+
+int lceil_float32 (float x)
+{
+ return __builtin_lceilf (x);
+}
+
+int lceil_float64 (double x)
+{
+ return __builtin_lceil (x);
+}
+
+
+float ceil_float32 (float x)
+{
+ return __builtin_ceilf (x);
+}
+
+double ceil_float64 (double x)
+{
+ return __builtin_ceil (x);
+}
+
+/* { dg-final { scan-assembler "fftoi\.f32\.s32\.rpi" } }*/
+/* { dg-final { scan-assembler "fftoi\.f64\.s32\.rpi" } }*/
+/* { dg-final { scan-assembler "fftofi\.f32\.rpi" } }*/
+/* { dg-final { scan-assembler "fftofi\.f64\.rpi" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c
new file mode 100644
index 0000000..4b2990b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options " -mfpu=fpv3" } */
+
+int funce(__fp16 a)
+{
+ return (int)a;
+}
+
+unsigned int funcf(__fp16 a)
+{
+ return (unsigned int)a;
+}
+
+int funca(float a)
+{
+ return (int)a;
+}
+
+unsigned int funcb(float a)
+{
+ return (unsigned int)a;
+}
+
+int funcc(double a)
+{
+ return (int)a;
+}
+
+unsigned int funcd(double a)
+{
+ return (unsigned int)a;
+}
+
+/* { dg-final { scan-assembler "fftoi\.f16\.s32\.rz" } }*/
+/* { dg-final { scan-assembler "fftoi\.f16\.u32\.rz" } }*/
+/* { dg-final { scan-assembler "fftoi\.f32\.s32\.rz" } }*/
+/* { dg-final { scan-assembler "fftoi\.f32\.u32\.rz" } }*/
+/* { dg-final { scan-assembler "fftoi\.f64\.s32\.rz" } }*/
+/* { dg-final { scan-assembler "fftoi\.f64\.u32\.rz" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c
new file mode 100644
index 0000000..25fc542
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-mfpu=fpv3" } */
+
+float func(__fp16 a)
+{
+ return (float)a;
+}
+
+/* { dg-final { scan-assembler "fhtos" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c
new file mode 100644
index 0000000..6a513dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c
@@ -0,0 +1,72 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-mfpu=fpv3" } */
+
+__fp16 funce(int a)
+{
+ return (__fp16)a;
+}
+
+__fp16 funcf(unsigned int a)
+{
+ return (__fp16)a;
+}
+
+float funca(int a)
+{
+ return (float)a;
+}
+
+float funcb(unsigned int a)
+{
+ return (float)a;
+}
+
+double funcc(int a)
+{
+ return (double)a;
+}
+
+double funcd(unsigned int a)
+{
+ return (double)a;
+}
+
+//double funch(short a)
+//{
+// return (double)a;
+//}
+//
+//double funci(unsigned short a)
+//{
+// return (double)a;
+//}
+//
+//float funcj(short a)
+//{
+// return (float)a;
+//}
+//
+//float funck(unsigned short a)
+//{
+// return (float)a;
+//}
+
+__fp16 funcm(short a)
+{
+ return (__fp16)a;
+}
+
+__fp16 funcn(unsigned short a)
+{
+ return (__fp16)a;
+}
+
+/* { dg-final { scan-assembler "fitof\.s32\.f16" } }*/
+/* { dg-final { scan-assembler "fitof\.u32\.f16" } }*/
+/* { dg-final { scan-assembler "fitof\.s32\.f32" } }*/
+/* { dg-final { scan-assembler "fitof\.u32\.f32" } }*/
+/* { dg-final { scan-assembler "fitof\.s32\.f64" } }*/
+/* { dg-final { scan-assembler "fitof\.u32\.f64" } }*/
+/* { dg-final { scan-assembler "fitof\.s16\.f16" } }*/
+/* { dg-final { scan-assembler "fitof\.u16\.f16" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c
new file mode 100644
index 0000000..1aa87b1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c
@@ -0,0 +1,96 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2 -mfpu=fpv3" } */
+
+#define FUNC(i) func_ ## i
+
+#define FTYPE __fp16
+FTYPE FUNC(ld16) (FTYPE *a, FTYPE *b)
+{
+ return *a = *b;
+}
+
+/* { dg-final { scan-assembler "fld\.16" } }*/
+/* { dg-final { scan-assembler "fst\.16" } }*/
+
+#undef FTYPE
+#define FTYPE float
+FTYPE FUNC(ld32) (FTYPE *a, FTYPE *b)
+{
+ return *a = *b;
+}
+
+/* { dg-final { scan-assembler "fld\.32" } }*/
+/* { dg-final { scan-assembler "fld\.32" } }*/
+
+#undef FTYPE
+#define FTYPE double
+FTYPE FUNC(ld64) (FTYPE *a, FTYPE *b)
+{
+ return *a = *b;
+}
+
+/* { dg-final { scan-assembler "fld\.64" } }*/
+/* { dg-final { scan-assembler "fst\.64" } }*/
+
+
+#undef FTYPE
+#define FTYPE __fp16
+FTYPE FUNC(ldr16) (FTYPE *a, int i, FTYPE *b)
+{
+ return a[i] = b[i];
+}
+
+/* { dg-final { scan-assembler "fldr\.16" } }*/
+/* { dg-final { scan-assembler "fstr\.16" } }*/
+
+#undef FTYPE
+#define FTYPE float
+FTYPE FUNC(ldr32) (FTYPE *a, int i, FTYPE *b)
+{
+ return a[i] = b[i];
+}
+
+/* { dg-final { scan-assembler "fldr\.32" } }*/
+/* { dg-final { scan-assembler "fstr\.32" } }*/
+
+#undef FTYPE
+#define FTYPE double
+FTYPE FUNC(ldr64) (FTYPE *a, int i, FTYPE *b)
+{
+ return a[i] = b[i];
+}
+
+/* { dg-final { scan-assembler "fldr\.64" } }*/
+/* { dg-final { scan-assembler "fstr\.64" } }*/
+
+
+#undef FTYPE
+#define FTYPE __fp16
+FTYPE FUNC(mov16) (FTYPE a, FTYPE b)
+{
+ a = b;
+ return a;
+}
+
+/* { dg-final { scan-assembler "fmov\.16" } }*/
+
+#undef FTYPE
+#define FTYPE float
+FTYPE FUNC(mov32) (FTYPE a, FTYPE b)
+{
+ a = b;
+ return a;
+}
+
+/* { dg-final { scan-assembler "fmov\.32" } }*/
+
+#undef FTYPE
+#define FTYPE double
+FTYPE FUNC(mov64) (FTYPE a, FTYPE b)
+{
+ a = b;
+ return a;
+}
+
+/* { dg-final { scan-assembler "fmov\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c
new file mode 100644
index 0000000..5fbc011
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2 -mfpu=fpv3" } */
+
+#define FUNC(i) func_ ## i
+
+#define FTYPE __fp16
+FTYPE FUNC(movi16) (void)
+{
+ return 1.0;
+}
+
+/* { dg-final { scan-assembler "fmovi\.16" } }*/
+
+#undef FTYPE
+#define FTYPE float
+FTYPE FUNC(movi32) (void)
+{
+ return 1.0;
+}
+
+/* { dg-final { scan-assembler "fmovi\.32" } }*/
+
+#undef FTYPE
+#define FTYPE double
+FTYPE FUNC(movi64) (void)
+{
+ return 1.0;
+}
+
+/* { dg-final { scan-assembler "fmovi\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c
new file mode 100644
index 0000000..078ebc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2 -mfpu=fpv3" } */
+
+__fp16 func16(__fp16 a, __fp16 b, __fp16 c){
+ a += b * c;
+ return a;
+}
+
+float func32(float a, float b, float c){
+ a += b * c;
+ return a;
+}
+
+
+double func64(double a, double b, double c){
+ a += b * c;
+ return a;
+}
+
+/* { dg-final { scan-assembler "ffmula\.16" } }*/
+/* { dg-final { scan-assembler "ffmula\.32" } }*/
+/* { dg-final { scan-assembler "ffmula\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c
new file mode 100644
index 0000000..efc80bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2 -mfpu=fpv3" } */
+
+__fp16 func16(__fp16 a, __fp16 b, __fp16 c){
+ a -= b * c;
+ return a;
+}
+
+float func32(float a, float b, float c){
+ a -= b * c;
+ return a;
+}
+
+
+double func64(double a, double b, double c){
+ a -= b * c;
+ return a;
+}
+
+/* { dg-final { scan-assembler "ffmuls\.16" } }*/
+/* { dg-final { scan-assembler "ffmuls\.32" } }*/
+/* { dg-final { scan-assembler "ffmuls\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c
new file mode 100644
index 0000000..9941cf8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-mfpu=fpv3" } */
+
+__fp16 func16(__fp16 a)
+{
+ return -a;
+}
+
+float func32(float a)
+{
+ return -a;
+}
+
+double func64(double a)
+{
+ return -a;
+}
+
+/* { dg-final { scan-assembler "fneg\.32" } }*/
+/* { dg-final { scan-assembler "fneg\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c
new file mode 100644
index 0000000..6770d29
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float fnmula32(float a, float b, float c){
+ return -(a + b * c);
+}
+
+double fnmula64(double a, double b, double c){
+ return -(a + b * c);
+}
+
+/* { dg-final { scan-assembler "ffnmula\.32" } }*/
+/* { dg-final { scan-assembler "ffnmula\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c
new file mode 100644
index 0000000..86ba96b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float fnmula32(float a, float b, float c){
+ return -a + b * c;
+}
+
+double fnmula64(double a, double b, double c){
+ return -a + b * c;
+}
+
+/* { dg-final { scan-assembler "ffnmuls\.32" } }*/
+/* { dg-final { scan-assembler "ffnmuls\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c
new file mode 100644
index 0000000..d4a615c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+double func(float a)
+{
+ return (double)a;
+}
+
+/* { dg-final { scan-assembler "fstod" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c
new file mode 100644
index 0000000..1333c41
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-mfpu=fpv3" } */
+
+__fp16 func(float a)
+{
+ return (__fp16)a;
+}
+
+/* { dg-final { scan-assembler "fstoh" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c
new file mode 100644
index 0000000..914b2e6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-mfpu=fpv3" } */
+
+__fp16 funch(__fp16 a, __fp16 b)
+{
+ return a - b;
+}
+
+float funcs(float a, float b)
+{
+ return a - b;
+}
+
+double funcd(double a, double b)
+{
+ return a - b;
+}
+
+/* { dg-final { scan-assembler "fsub\.16" } }*/
+/* { dg-final { scan-assembler "fsub\.32" } }*/
+/* { dg-final { scan-assembler "fsub\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c
new file mode 100644
index 0000000..d5182a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O1" } */
+
+//__fp16
+//fixed32_to_float16 (int i)
+//{
+// return ((__fp16) i / (1 << 15));
+//}
+//
+//__fp16
+//fixedu32_to_float16 (unsigned int i)
+//{
+// return ((__fp16) i / (1 << 15));
+//}
+//
+//float
+//fixed32_to_float32 (int i)
+//{
+// return ((float) i / (1 << 30));
+//}
+//
+//
+//float
+//fixedu32_to_float32 (unsigned int i)
+//{
+// return ((float) i / (1 << 30));
+//}
+//
+//double
+//fixed32_to_float64 (int i)
+//{
+// return ((double) i / (1 << 30));
+//}
+//
+//double
+//fixedu32_to_float64 (unsigned int i)
+//{
+// return ((double) i / (1 << 30));
+//}
+//
+//__fp16
+//fixed16_to_float16 (short i)
+//{
+// return ((__fp16) i / (1 << 15));
+//}
+//
+//__fp16
+//fixedu16_to_float16 (unsigned short i)
+//{
+// return ((__fp16) i / (1 << 15));
+//}
+//
+//float
+//fixed16_to_float32 (short i)
+//{
+// return ((float) i / (1 << 16));
+//}
+//
+//float
+//fixedu16_to_float32 (unsigned short i)
+//{
+// return ((float) i / (1 << 16));
+//}
+//
+//double
+//fixed16_to_float64 (short i)
+//{
+// return ((double) i / (1 << 16));
+//}
+//
+//double
+//fixedu16_to_float64 (unsigned short i)
+//{
+// return ((double) i / (1 << 16));
+//}
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c
new file mode 100644
index 0000000..c2e76d0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float fh32(float a, float b, float c, float d){
+ if(a > b)
+ return c;
+
+ return d;
+}
+
+double fh64(double a, double b, double c, double d){
+ if( a > b)
+ return c;
+ return d;
+}
+
+/* { dg-final { scan-assembler "fcmplt\.32" } }*/
+/* { dg-final { scan-assembler "fcmplt\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c
new file mode 100644
index 0000000..ecfaa63
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float fhs32(float a, float b, float c, float d){
+ if(a >= b)
+ return c;
+ return d;
+}
+
+double fhs64(double a, double b, double c, double d){
+ if( a >= b)
+ return c;
+ return d;
+}
+
+/* { dg-final { scan-assembler "fcmphs\.32" } }*/
+/* { dg-final { scan-assembler "fcmphs\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c
new file mode 100644
index 0000000..530a4be
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float fhsz32(float a, float b, float c){
+ if(a >= 0.0f)
+ return b;
+ else
+ return c;
+}
+
+double fhsz64(double a, double b, double c){
+ if( a >= 0.0)
+ return b;
+ else
+ return c;
+}
+
+/* { dg-final { scan-assembler "fcmphsz\.32" } }*/
+/* { dg-final { scan-assembler "fcmphsz\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c
new file mode 100644
index 0000000..a2a8d8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float fhz32(float a, float b, float c){
+ if(a > 0.0f)
+ return b;
+ else
+ return c;
+}
+
+double fhz64(double a, double b, double c){
+ if( a > 0.0)
+ return b;
+ else
+ return c;
+}
+
+/* { dg-final { scan-assembler "fcmphz\.32" } }*/
+/* { dg-final { scan-assembler "fcmphz\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c
new file mode 100644
index 0000000..3bb6ac6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float fls32(float a, float b, float c, float d){
+ if(a <= b)
+ return c;
+
+ return d;
+}
+
+double fhz64(double a, double b, double c, double d){
+ if( a <= b)
+ return c;
+ return d;
+}
+
+/* { dg-final { scan-assembler "fcmphs\.32" } }*/
+/* { dg-final { scan-assembler "fcmphs\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c
new file mode 100644
index 0000000..6e19efa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float flsz32(float a, float b, float c){
+ if(a <= 0.0f)
+ return b;
+ else
+ return c;
+}
+
+double fhz64(double a, double b, double c){
+ if( a <= 0.0)
+ return b;
+ else
+ return c;
+}
+
+/* { dg-final { scan-assembler "fcmplsz\.32" } }*/
+/* { dg-final { scan-assembler "fcmplsz\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c
new file mode 100644
index 0000000..e4a716f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float flt32(float a, float b, float c, float d){
+ if(a < b)
+ return c;
+ return d;
+}
+
+double flt64(double a, double b, double c, double d){
+ if( a < b)
+ return c;
+ return d;
+}
+
+/* { dg-final { scan-assembler "fcmplt\.32" } }*/
+/* { dg-final { scan-assembler "fcmplt\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c
new file mode 100644
index 0000000..984079c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float fltz32(float a, float b, float c){
+ if(a < 0.0f)
+ return b;
+ else
+ return c;
+}
+
+double fltz64(double a, double b, double c){
+ if( a < 0.0)
+ return b;
+ else
+ return c;
+}
+
+/* { dg-final { scan-assembler "fcmpltz\.32" } }*/
+/* { dg-final { scan-assembler "fcmpltz\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c
new file mode 100644
index 0000000..32fb74e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+extern float fmaxf( float x, float y );
+float fmax32(float a, float b){
+ return fmaxf(a, b);
+}
+
+extern double fmax( double x, double y );
+double fmax64(double a, double b){
+ return fmax(a, b);
+}
+
+/* { dg-final { scan-assembler "fmaxnm\.32" } }*/
+/* { dg-final { scan-assembler "fmaxnm\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c
new file mode 100644
index 0000000..95c0878
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+extern float fminf( float x, float y );
+float fmin32(float a, float b){
+ return fminf(a, b);
+}
+
+extern double fmin( double x, double y );
+double fmin64(double a, double b){
+ return fmin(a, b);
+}
+
+/* { dg-final { scan-assembler "fminnm\.32" } }*/
+/* { dg-final { scan-assembler "fminnm\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c
new file mode 100644
index 0000000..a168dc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float mul32(float a, float b){
+ return a*b;
+}
+
+double mul64(double a, double b){
+ return a*b;
+}
+
+/* { dg-final { scan-assembler "fmul\.32" } }*/
+/* { dg-final { scan-assembler "fmul\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c
new file mode 100644
index 0000000..f78534e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float func32(float a, float b, float c){
+ a += b * c;
+ return a;
+}
+
+double func64(double a, double b, double c){
+ a += b * c;
+ return a;
+}
+
+/* { dg-final { scan-assembler "fmula\.32" } }*/
+/* { dg-final { scan-assembler "fmula\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c
new file mode 100644
index 0000000..f144e45
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float muls32(float a, float b, float c){
+ a -= b * c;
+ return a;
+}
+
+double muls64(double a, double b, double c){
+ a -= b * c;
+ return a;
+}
+
+/* { dg-final { scan-assembler "fmuls\.32" } }*/
+/* { dg-final { scan-assembler "fmuls\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c
new file mode 100644
index 0000000..c24f0ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float fne32(float a, float b, float c, float d){
+ if(a != b)
+ return c;
+ return d;
+}
+
+double fne64(double a, double b, double c, double d){
+ if( a != b)
+ return c;
+ return d;
+}
+
+/* { dg-final { scan-assembler "fcmpne\.32" } }*/
+/* { dg-final { scan-assembler "fcmpne\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c
new file mode 100644
index 0000000..348211d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float fnez32(float a, float b, float c){
+ if(a != 0.0f)
+ return b;
+ else
+ return c;
+}
+
+double fnez64(double a, double b, double c){
+ if( a != 0.0)
+ return b;
+ else
+ return c;
+}
+
+/* { dg-final { scan-assembler "fcmpnez\.32" } }*/
+/* { dg-final { scan-assembler "fcmpnez\.64" } }*/
+
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c
new file mode 100644
index 0000000..cadd367
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "" } */
+
+float recip32(float a){
+ return 1.0f/a;
+}
+
+double recip64(double a){
+ return 1.0/a;
+}
+
+/* { dg-final { scan-assembler "frecip\.32" } }*/
+/* { dg-final { scan-assembler "frecip\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c
new file mode 100644
index 0000000..4d79900
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+float sqrtf(float);
+float sqrt32(float a){
+ return sqrtf(a);
+}
+
+double sqrt(double);
+double sqrt64(double a){
+ return sqrt(a);
+}
+
+/* { dg-final { scan-assembler "fsqrt\.32" } }*/
+/* { dg-final { scan-assembler "fsqrt\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c
new file mode 100644
index 0000000..3539eb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */
+/* { dg-options "-O2" } */
+
+int func32(float a, float b)
+{
+ return __builtin_isunordered(a, b);
+}
+
+int func64(double a, double b)
+{
+ return __builtin_isunordered(a, b);
+}
+
+/* { dg-final { scan-assembler "fcmpuo\.32" } }*/
+/* { dg-final { scan-assembler "fcmpuo\.64" } }*/
+
+int func32z(float a)
+{
+ return __builtin_isunordered(a, 0);
+}
+
+int func64z(double a)
+{
+ return __builtin_isunordered(a, 0);
+}
+
+/* { dg-final { scan-assembler "fcmpuoz\.32" } }*/
+/* { dg-final { scan-assembler "fcmpuoz\.64" } }*/
diff --git a/gcc/testsuite/gcc.target/csky/ldbs.c b/gcc/testsuite/gcc.target/csky/ldbs.c
new file mode 100644
index 0000000..27a0254
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/ldbs.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-mcpu=ck801" "-march=ck801" } { "*" } } */
+/* { dg-csky-options "-O1" } */
+
+int foo (signed char *pb)
+{
+ return *pb;
+}
+
+/* { dg-final { scan-assembler "ld.bs" } } */
+
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-1.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-1.c
new file mode 100644
index 0000000..d46c302
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-1.c
@@ -0,0 +1,17 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets without sram-ecc enabled (in which sub-dword loads do not
+ zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -msram-ecc=off" } */
+
+extern unsigned char c;
+
+unsigned int
+f ()
+{
+ return c;
+}
+
+/* { dg-final { scan-assembler "lshl.* 24" } } */
+/* { dg-final { scan-assembler "lshr.* 24" } } */
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-2.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-2.c
new file mode 100644
index 0000000..351d43c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-2.c
@@ -0,0 +1,17 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets without sram-ecc enabled (in which sub-dword loads do not
+ zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -msram-ecc=off" } */
+
+extern unsigned short s;
+
+unsigned short
+f ()
+{
+ return s;
+}
+
+/* { dg-final { scan-assembler "lshl.* 16" } } */
+/* { dg-final { scan-assembler "lshr.* 16" } } */
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-3.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-3.c
new file mode 100644
index 0000000..692d457
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-3.c
@@ -0,0 +1,21 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets without sram-ecc enabled (in which sub-dword loads do not
+ zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -dp -msram-ecc=off" } */
+
+typedef unsigned int v64si __attribute__ ((vector_size (64*4)));
+typedef unsigned char v64qi __attribute__ ((vector_size (64*1)));
+
+extern v64si a;
+extern v64qi b;
+
+void
+f ()
+{
+ for (int n = 0; n < 64; n++)
+ a[n] = b[n];
+}
+
+/* { dg-final { scan-assembler "zero_extendv64qiv64si2" } } */
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-4.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-4.c
new file mode 100644
index 0000000..61b8d55
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-4.c
@@ -0,0 +1,21 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets without sram-ecc enabled (in which sub-dword loads do not
+ zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -dp -msram-ecc=off" } */
+
+typedef unsigned int v64si __attribute__ ((vector_size (64*4)));
+typedef unsigned short v64hi __attribute__ ((vector_size (64*2)));
+
+extern v64si a;
+extern v64hi b;
+
+void
+f ()
+{
+ for (int n = 0; n < 64; n++)
+ a[n] = b[n];
+}
+
+/* { dg-final { scan-assembler "zero_extendv64hiv64si2" } } */
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-5.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-5.c
new file mode 100644
index 0000000..4f0543b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-5.c
@@ -0,0 +1,17 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets that may not have sram-ecc enabled (in which sub-dword loads do
+ not zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -msram-ecc=any" } */
+
+extern unsigned char c;
+
+unsigned int
+f ()
+{
+ return c;
+}
+
+/* { dg-final { scan-assembler "lshl.* 24" } } */
+/* { dg-final { scan-assembler "lshr.* 24" } } */
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-6.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-6.c
new file mode 100644
index 0000000..9dfceaf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-6.c
@@ -0,0 +1,17 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets that may not have sram-ecc enabled (in which sub-dword loads do
+ not zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -msram-ecc=any" } */
+
+extern unsigned short s;
+
+unsigned short
+f ()
+{
+ return s;
+}
+
+/* { dg-final { scan-assembler "lshl.* 16" } } */
+/* { dg-final { scan-assembler "lshr.* 16" } } */
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-7.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-7.c
new file mode 100644
index 0000000..9d0ce6f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-7.c
@@ -0,0 +1,21 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets that may not have sram-ecc enabled (in which sub-dword loads do
+ not zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -dp -msram-ecc=any" } */
+
+typedef unsigned int v64si __attribute__ ((vector_size (64*4)));
+typedef unsigned char v64qi __attribute__ ((vector_size (64*1)));
+
+extern v64si a;
+extern v64qi b;
+
+void
+f ()
+{
+ for (int n = 0; n < 64; n++)
+ a[n] = b[n];
+}
+
+/* { dg-final { scan-assembler "zero_extendv64qiv64si2" } } */
diff --git a/gcc/testsuite/gcc.target/gcn/sram-ecc-8.c b/gcc/testsuite/gcc.target/gcn/sram-ecc-8.c
new file mode 100644
index 0000000..76e0288
--- /dev/null
+++ b/gcc/testsuite/gcc.target/gcn/sram-ecc-8.c
@@ -0,0 +1,21 @@
+/* Ensure that explicit zero-entend instructions are present when compiling
+ for targets that may not have sram-ecc enabled (in which sub-dword loads do
+ not zero the high bits of the target register). */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -dp -msram-ecc=any" } */
+
+typedef unsigned int v64si __attribute__ ((vector_size (64*4)));
+typedef unsigned short v64hi __attribute__ ((vector_size (64*2)));
+
+extern v64si a;
+extern v64hi b;
+
+void
+f ()
+{
+ for (int n = 0; n < 64; n++)
+ a[n] = b[n];
+}
+
+/* { dg-final { scan-assembler "zero_extendv64hiv64si2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
index 349ec58..f7002ca 100644
--- a/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
+++ b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
@@ -57,7 +57,7 @@ void calc_matrix_dpbf16ps (__tile *dst, __tile *src1, __tile *src2)
(make_f32(src1_buf[i * 4 * N + 4 * j + t]) *
make_f32(src2_buf[j * 4 * K + 4 * k + t])) +
(make_f32(src1_buf[i * 4 * N + 4 * j + t + 1]) *
- make_f32(src1_buf[i * 4 * N + 4 * j + t + 1]));
+ make_f32(src2_buf[j * 4 * K + 4 * k + t + 1]));
}
}
@@ -72,8 +72,8 @@ void test_amx_bf16_dpbf16ps ()
init_tile_config (&cfg);
init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf);
- init_tile_reg_and_src_with_buffer (2, dst, tmp_dst_buf);
- init_tile_reg_and_src_with_buffer (3, dst, tmp_dst_buf);
+ init_tile_reg_and_src_with_buffer (2, src1, tmp_dst_buf);
+ init_tile_reg_and_src_with_buffer (3, src2, tmp_dst_buf);
calc_matrix_dpbf16ps (&dst, &src1, &src2);
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-1.c b/gcc/testsuite/gcc.target/i386/auto-init-1.c
new file mode 100644
index 0000000..b7690df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-1.c
@@ -0,0 +1,32 @@
+/* Verify zero initialization for integer and pointer type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+enum E {
+ N1 = 0,
+ N2,
+ N3
+};
+
+extern void bar (char, short, int, enum E, long, long long, int *, bool);
+
+void foo()
+{
+ char temp1;
+ short temp2;
+ int temp3;
+ enum E temp4;
+ long temp5;
+ long long temp6;
+ int *temp7;
+ bool temp8;
+
+ bar (temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8);
+ return;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_int 0" 10 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-2.c b/gcc/testsuite/gcc.target/i386/auto-init-2.c
new file mode 100644
index 0000000..e76fc25
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-2.c
@@ -0,0 +1,36 @@
+/* Verify pattern initialization for integer and pointer type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+enum E {
+ N1 = 0,
+ N2,
+ N3
+};
+
+extern void bar (char, short, int, enum E, long, long long, int *, bool);
+
+void foo()
+{
+ char temp1;
+ short temp2;
+ int temp3;
+ enum E temp4;
+ long temp5;
+ long long temp6;
+ int *temp7;
+ bool temp8;
+
+ bar (temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8);
+ return;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe" 2 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffefe" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 2 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfefefefefefefefe" 3 "expand" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-21.c b/gcc/testsuite/gcc.target/i386/auto-init-21.c
new file mode 100644
index 0000000..1192a90
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-21.c
@@ -0,0 +1,14 @@
+/* Verify zero initialization for VLA automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+extern void bar (int);
+
+void foo(int n)
+{
+ int arr[n];
+ bar (arr[2]);
+ return;
+}
+
+/* { dg-final { scan-rtl-dump "__builtin_memset" "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-22.c b/gcc/testsuite/gcc.target/i386/auto-init-22.c
new file mode 100644
index 0000000..431d966
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-22.c
@@ -0,0 +1,14 @@
+/* Verify zero initialization for VLA automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+extern void bar (int);
+
+void foo(int n)
+{
+ int arr[n];
+ bar (arr[2]);
+ return;
+}
+
+/* { dg-final { scan-rtl-dump "__builtin_memset" "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-23.c b/gcc/testsuite/gcc.target/i386/auto-init-23.c
new file mode 100644
index 0000000..72094f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-23.c
@@ -0,0 +1,13 @@
+/* Verify the auto initialization of nested VLA. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+void g(void *);
+
+void foo(int a)
+{
+ int x[a][a];
+ g(x);
+}
+
+/* { dg-final { scan-rtl-dump "__builtin_memset" "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-24.c b/gcc/testsuite/gcc.target/i386/auto-init-24.c
new file mode 100644
index 0000000..5cc3a75
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-24.c
@@ -0,0 +1,13 @@
+/* Verify the auto initialization of nested VLA. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+void g(void *);
+
+void foo(int a)
+{
+ int x[a][a];
+ g(x);
+}
+
+/* { dg-final { scan-rtl-dump "__builtin_memset" "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-3.c b/gcc/testsuite/gcc.target/i386/auto-init-3.c
new file mode 100644
index 0000000..300ddfb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-3.c
@@ -0,0 +1,17 @@
+/* Verify zero initialization for floating point type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+long double result;
+
+long double foo()
+{
+ float temp1;
+ double temp2;
+ long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-assembler-times "pxor\t\\\%xmm0, \\\%xmm0" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-4.c b/gcc/testsuite/gcc.target/i386/auto-init-4.c
new file mode 100644
index 0000000..abe0b7e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-4.c
@@ -0,0 +1,20 @@
+/* Verify pattern initialization for floating point type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+long double result;
+
+long double foo()
+{
+ float temp1;
+ double temp2;
+ long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "\\\[0xfefefefefefefefe\\\]" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-5.c b/gcc/testsuite/gcc.target/i386/auto-init-5.c
new file mode 100644
index 0000000..b2e708c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-5.c
@@ -0,0 +1,20 @@
+/* Verify zero initialization for complex type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+
+_Complex long double result;
+
+_Complex long double foo()
+{
+ _Complex float temp1;
+ _Complex double temp2;
+ _Complex long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-assembler-times "\\.long\t0" 14 } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-6.c b/gcc/testsuite/gcc.target/i386/auto-init-6.c
new file mode 100644
index 0000000..c79c039
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-6.c
@@ -0,0 +1,19 @@
+/* Verify pattern initialization for complex type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+
+_Complex long double result;
+
+_Complex long double foo()
+{
+ _Complex float temp1;
+ _Complex double temp2;
+ _Complex long double temp3;
+
+ result = temp1 + temp2 + temp3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "\\\[0xfefefefefefefefe\\\]" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 2 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-7.c b/gcc/testsuite/gcc.target/i386/auto-init-7.c
new file mode 100644
index 0000000..0114379
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-7.c
@@ -0,0 +1,33 @@
+/* Verify zero initialization for array, union, and structure type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+struct S
+{
+ int f1;
+ float f2;
+ char f3[20];
+};
+
+union U
+{
+ char u1[5];
+ int u2;
+ float u3;
+};
+
+double result;
+
+double foo()
+{
+ int temp1[3];
+ double temp2[3];
+ struct S temp3;
+ union U temp4;
+
+ result = temp1[2] + temp2[1] + temp3.f2 + temp4.u3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_int 0 \\\[0\\\]\\\)\\\)" 3 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "const_int 0 \\\[0\\\]\\\) repeated x16" 2 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-8.c b/gcc/testsuite/gcc.target/i386/auto-init-8.c
new file mode 100644
index 0000000..28fbeb7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-8.c
@@ -0,0 +1,35 @@
+/* Verify pattern initialization for array, union, and structure type automatic variables. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct S
+{
+ int f1;
+ float f2;
+ char f3[20];
+};
+
+union U
+{
+ char u1[5];
+ int u2;
+ float u3;
+};
+
+double result;
+
+double foo()
+{
+ int temp1[3];
+ double temp2[3];
+ struct S temp3;
+ union U temp4;
+
+ result = temp1[2] + temp2[1] + temp3.f2 + temp4.u3;
+ return result;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "\\\[0xfefefefefefefefe\\\]" 2 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 2 "expand" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-1.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-1.c
new file mode 100644
index 0000000..a238b8b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-1.c
@@ -0,0 +1,19 @@
+/* Verify zero initialization for structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+struct test_aligned {
+ int internal1;
+ long long internal2;
+} __attribute__ ((aligned(64)));
+
+int foo ()
+{
+ struct test_aligned var;
+ return var.internal1;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_int 0 \\\[0\\\]\\\) repeated x16" 1 "expand" } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-10.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-10.c
new file mode 100644
index 0000000..3fc6b07
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-10.c
@@ -0,0 +1,21 @@
+/* Verify pattern initialization for array type with structure element with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+
+int foo ()
+{
+ struct test_trailing_hole var[10];
+ return var[2].four;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-11.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-11.c
new file mode 100644
index 0000000..cc982b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-11.c
@@ -0,0 +1,26 @@
+/* Verify zero initialization for union type with structure field with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+union test_union_padding {
+ struct test_trailing_hole u1;
+ long long u2;
+};
+
+
+int foo ()
+{
+ union test_union_padding var;
+ return var.u1.four;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_int 0 \\\[0\\\]\\\) repeated x16" 1 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-12.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-12.c
new file mode 100644
index 0000000..0fbdb6c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-12.c
@@ -0,0 +1,26 @@
+/* Verify pattern initialization for union type with structure field with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+union test_union_padding {
+ struct test_trailing_hole u1;
+ long long u2;
+};
+
+
+int foo ()
+{
+ union test_union_padding var;
+ return var.u1.four;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-2.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-2.c
new file mode 100644
index 0000000..5739aa1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-2.c
@@ -0,0 +1,19 @@
+/* Verify pattern initialization for structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_aligned {
+ int internal1;
+ long long internal2;
+} __attribute__ ((aligned(64)));
+
+int foo ()
+{
+ struct test_aligned var;
+ return var.internal1;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-3.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-3.c
new file mode 100644
index 0000000..8a6d764
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-3.c
@@ -0,0 +1,30 @@
+/* Verify zero initialization for nested structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_aligned {
+ unsigned internal1;
+ unsigned long long internal2;
+} __attribute__ ((aligned(64)));
+
+struct test_big_hole {
+ char one;
+ char two;
+ char three;
+ /* 61 byte padding hole here. */
+ struct test_aligned four;
+} __attribute__ ((aligned(64)));
+
+
+int foo ()
+{
+ struct test_big_hole var;
+ return var.four.internal1;
+}
+
+/* { dg-final { scan-assembler "movl\t\\\$0," } } */
+/* { dg-final { scan-assembler "movl\t\\\$16," } } */
+/* { dg-final { scan-assembler "rep stosq" } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-4.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-4.c
new file mode 100644
index 0000000..d7be326
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-4.c
@@ -0,0 +1,28 @@
+/* Verify pattern initialization for nested structure type automatic variables with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_aligned {
+ unsigned internal1;
+ unsigned long long internal2;
+} __attribute__ ((aligned(64)));
+
+struct test_big_hole {
+ char one;
+ char two;
+ char three;
+ /* 61 byte padding hole here. */
+ struct test_aligned four;
+} __attribute__ ((aligned(64)));
+
+
+int foo ()
+{
+ struct test_big_hole var;
+ return var.four.internal1;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-5.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-5.c
new file mode 100644
index 0000000..569b09a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-5.c
@@ -0,0 +1,21 @@
+/* Verify zero initialization for structure type automatic variables with
+ tail padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ char *one;
+ char *two;
+ char *three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var;
+ return var.four;
+}
+
+/* { dg-final { scan-rtl-dump-times "const_int 0 \\\[0\\\]\\\) repeated x16" 1 "expand" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-6.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-6.c
new file mode 100644
index 0000000..4e0b614
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-6.c
@@ -0,0 +1,22 @@
+/* Verify pattern initialization for structure type automatic variables with
+ tail padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */
+
+struct test_trailing_hole {
+ char *one;
+ char *two;
+ char *three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var;
+ return var.four;
+}
+
+/* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 1 "expand" } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-7.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-7.c
new file mode 100644
index 0000000..b5abffb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-7.c
@@ -0,0 +1,22 @@
+/* Verify zero initialization for structure type automatic variables with
+ padding and has explicit initialization. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var = {.one = 1,.two = 2, .four = 'c'};
+ return var.four;
+}
+
+/* { dg-final { scan-assembler-times "movq\t\\\$0," 2 } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-8.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-8.c
new file mode 100644
index 0000000..66591cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-8.c
@@ -0,0 +1,22 @@
+/* Verify pattern initialization for structure type automatic variables with
+ padding and has explicit initialization. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=pattern" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+int foo ()
+{
+ struct test_trailing_hole var = {.one = 1,.two = 2, .four = 'c'};
+ return var.four;
+}
+
+/* { dg-final { scan-assembler-times "movq\t\\\$0," 2 } } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-padding-9.c b/gcc/testsuite/gcc.target/i386/auto-init-padding-9.c
new file mode 100644
index 0000000..1ff900f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/auto-init-padding-9.c
@@ -0,0 +1,22 @@
+/* Verify zero initialization for array type with structure element with
+ padding. */
+/* { dg-do compile } */
+/* { dg-options "-ftrivial-auto-var-init=zero" } */
+
+struct test_trailing_hole {
+ int one;
+ int two;
+ int three;
+ char four;
+ /* "sizeof(unsigned long) - 1" byte padding hole here. */
+};
+
+
+int foo ()
+{
+ struct test_trailing_hole var[10];
+ return var[2].four;
+}
+
+/* { dg-final { scan-assembler "movl\t\\\$0," } } */
+/* { dg-final { scan-assembler "rep stosq" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-1.c b/gcc/testsuite/gcc.target/i386/avx-1.c
index 6178e38..d9aa8a7 100644
--- a/gcc/testsuite/gcc.target/i386/avx-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -mavx2 -maes -mpclmul -mgfni -mavx512bw" } */
+/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -mavx2 -maes -mpclmul -mgfni -mavx512bw -mavx512fp16 -mavx512vl" } */
/* { dg-add-options bind_pic_locally } */
#include <mm_malloc.h>
@@ -685,6 +685,27 @@
#define __builtin_ia32_vpshld_v2di(A, B, C) __builtin_ia32_vpshld_v2di(A, B, 1)
#define __builtin_ia32_vpshld_v2di_mask(A, B, C, D, E) __builtin_ia32_vpshld_v2di_mask(A, B, 1, D, E)
+/* avx512fp16intrin.h */
+#define __builtin_ia32_vaddph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vaddph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vsubph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vsubph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmulph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vmulph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vdivph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vdivph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vaddsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vaddsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vsubsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vsubsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmulsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vmulsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vdivsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vdivsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmaxph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vmaxph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vminph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vminph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmaxsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vmaxsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vminsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vminsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vcmpph_v32hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v32hf_mask(A, B, 1, D)
+#define __builtin_ia32_vcmpph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vcmpph_v32hf_mask_round(A, B, 1, D, 8)
+#define __builtin_ia32_vcmpsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vcmpsh_v8hf_mask_round(A, B, 1, D, 8)
+
+/* avx512fp16vlintrin.h */
+#define __builtin_ia32_vcmpph_v8hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v8hf_mask(A, B, 1, D)
+#define __builtin_ia32_vcmpph_v16hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v16hf_mask(A, B, 1, D)
+
/* vpclmulqdqintrin.h */
#define __builtin_ia32_vpclmulqdq_v4di(A, B, C) __builtin_ia32_vpclmulqdq_v4di(A, B, 1)
#define __builtin_ia32_vpclmulqdq_v2di(A, B, C) __builtin_ia32_vpclmulqdq_v2di(A, B, 1)
diff --git a/gcc/testsuite/gcc.target/i386/avx-2.c b/gcc/testsuite/gcc.target/i386/avx-2.c
index 986fbd8..642ae4d 100644
--- a/gcc/testsuite/gcc.target/i386/avx-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -mavx2 -msse4a -maes -mpclmul -mavx512bw" } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -mavx2 -msse4a -maes -mpclmul -mavx512bw -mavx512fp16 -mavx512vl" } */
/* { dg-add-options bind_pic_locally } */
#include <mm_malloc.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx-pr102224.c b/gcc/testsuite/gcc.target/i386/avx-pr102224.c
new file mode 100644
index 0000000..7cb8b4c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-pr102224.c
@@ -0,0 +1,23 @@
+/* PR target/102224 */
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx" } */
+/* { dg-require-effective-target avx } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx-check.h"
+#endif
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#define main main1
+#include "../../gcc.dg/pr102224.c"
+#undef main
+
+#include CHECK_H
+
+static void
+TEST (void)
+{
+ main1 ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-pr82370.c b/gcc/testsuite/gcc.target/i386/avx-pr82370.c
index 4dc8a5b..dc12dbf 100644
--- a/gcc/testsuite/gcc.target/i386/avx-pr82370.c
+++ b/gcc/testsuite/gcc.target/i386/avx-pr82370.c
@@ -4,7 +4,7 @@
/* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */
/* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */
/* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */
-/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */
+/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 6 } } */
/* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */
/* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */
/* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-pr89984.c b/gcc/testsuite/gcc.target/i386/avx-pr89984.c
new file mode 100644
index 0000000..3409ade
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-pr89984.c
@@ -0,0 +1,23 @@
+/* PR target/89984 */
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx" } */
+/* { dg-require-effective-target avx } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx-check.h"
+#endif
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#define main main1
+#include "../../gcc.dg/pr89984.c"
+#undef main
+
+#include CHECK_H
+
+static void
+TEST (void)
+{
+ main1 ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-pr94680.c b/gcc/testsuite/gcc.target/i386/avx-pr94680.c
new file mode 100644
index 0000000..cb5041b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-pr94680.c
@@ -0,0 +1,107 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx -mno-avx512f -O2" } */
+/* { dg-final { scan-assembler-times {(?n)vmov[a-z0-9]*[ \t]*%xmm[0-9]} 12 } } */
+/* { dg-final { scan-assembler-not "pxor" } } */
+
+typedef float v8sf __attribute__((vector_size(32)));
+typedef double v4df __attribute__ ((vector_size (32)));
+typedef long long v4di __attribute__((vector_size(32)));
+typedef int v8si __attribute__((vector_size(32)));
+typedef short v16hi __attribute__ ((vector_size (32)));
+typedef char v32qi __attribute__ ((vector_size (32)));
+
+v4df
+foo_v4df (v4df x)
+{
+ return __builtin_shuffle (x, (v4df) { 0, 0, 0, 0 }, (v4di) { 0, 1, 4, 5 });
+}
+
+v4df
+foo_v4df_l (v4df x)
+{
+ return __builtin_shuffle ((v4df) { 0, 0, 0, 0 }, x, (v4di) { 4, 5, 1, 2 });
+}
+
+v4di
+foo_v4di (v4di x)
+{
+ return __builtin_shuffle (x, (v4di) { 0, 0, 0, 0 }, (v4di) { 0, 1, 4, 7 });
+}
+
+v4di
+foo_v4di_l (v4di x)
+{
+ return __builtin_shuffle ((v4di) { 0, 0, 0, 0 }, x, (v4di) { 4, 5, 3, 1 });
+}
+
+v8sf
+foo_v8sf (v8sf x)
+{
+ return __builtin_shuffle ((v8sf) { 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v8si) { 8, 9, 10, 11, 0, 1, 2, 3 });
+}
+
+v8sf
+foo_v8sf_l (v8sf x)
+{
+ return __builtin_shuffle (x, (v8sf) { 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v8si) { 0, 1, 2, 3, 8, 9, 10, 11 });
+}
+
+v8si
+foo_v8si (v8si x)
+{
+ return __builtin_shuffle (x, (v8si) { 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v8si) { 0, 1, 2, 3, 13, 12, 11, 15 });
+}
+
+v8si
+foo_v8si_l (v8si x)
+{
+ return __builtin_shuffle ((v8si) { 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v8si) { 8, 9, 10, 11, 7, 6, 5, 4 });
+}
+
+v16hi
+foo_v16hi (v16hi x)
+{
+ return __builtin_shuffle (x, (v16hi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v16hi) { 0, 1, 2, 3, 4, 5, 6, 7,
+ 24, 17, 26, 19, 28, 21, 30, 23 });
+}
+
+v16hi
+foo_v16hi_l (v16hi x)
+{
+ return __builtin_shuffle ((v16hi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v16hi) { 16, 17, 18, 19, 20, 21, 22, 23,
+ 15, 0, 13, 2, 11, 4, 9, 6 });
+}
+
+v32qi
+foo_v32qi (v32qi x)
+{
+ return __builtin_shuffle (x, (v32qi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v32qi) { 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 32, 49, 34, 58, 36, 53, 38, 39,
+ 40, 60, 42, 43, 63, 45, 46, 47 });
+}
+
+v32qi
+foo_v32qi_l (v32qi x)
+{
+ return __builtin_shuffle ((v32qi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v32qi) { 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 31, 0, 29, 2, 27, 4, 25, 6,
+ 23, 8, 21, 10, 19, 12, 17, 14 });
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-psraq-1.c b/gcc/testsuite/gcc.target/i386/avx-psraq-1.c
new file mode 100644
index 0000000..2722088
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-psraq-1.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx -mno-avx2" } */
+/* { dg-require-effective-target avx } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include "sse2-psraq-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-14.c b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-14.c
index a31b4a2..9590f25 100644
--- a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-14.c
+++ b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-14.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mavx -mtune=generic -dp" } */
+/* { dg-options "-O2 -mavx -mno-avx512f -mtune=generic -dp" } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-15.c b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-15.c
index 803936e..36dcf73 100644
--- a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-15.c
+++ b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-15.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mavx -mtune=generic -dp" } */
+/* { dg-options "-O2 -mavx -mno-avx512f -mtune=generic -dp" } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-28.c b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-28.c
new file mode 100644
index 0000000..381ee9a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-28.c
@@ -0,0 +1,17 @@
+/* PR target/101495 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -mtune=generic -dp" } */
+
+#include <immintrin.h>
+
+extern __m256 x, y;
+extern __m256 bar (void);
+
+__m256
+foo ()
+{
+ x = y;
+ return bar ();
+}
+
+/* { dg-final { scan-assembler-not "avx_vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx2-gather-2.c b/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
index 1a704af..ad5ef73 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -mavx2 -fdump-tree-vect-details -mtune=skylake" } */
+/* { dg-options "-O3 -fdump-tree-vect-details -march=skylake" } */
#include "avx2-gather-1.c"
/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 16 "vect" } } */
+/* { dg-final { scan-assembler "vpcmpeqd" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr101286.c b/gcc/testsuite/gcc.target/i386/avx2-pr101286.c
new file mode 100644
index 0000000..81917bf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr101286.c
@@ -0,0 +1,11 @@
+/* PR target/101286 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-mavx2" } */
+
+typedef __attribute__((__vector_size__ (2 * sizeof (__int128)))) __int128 V;
+
+V
+foo (void)
+{
+ return (V){(__int128) 1 << 64 | 1, (__int128) 1 << 64 | 1};
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr101611-1.c b/gcc/testsuite/gcc.target/i386/avx2-pr101611-1.c
new file mode 100644
index 0000000..9fc7802
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr101611-1.c
@@ -0,0 +1,12 @@
+/* PR target/101611 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -mno-avx512f" } */
+/* { dg-final { scan-assembler-times {\mvpsrlvq\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mvpxor\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvpsubq\M} 2 } } */
+
+typedef long long V __attribute__((vector_size(32)));
+typedef long long W __attribute__((vector_size(16)));
+
+V foo (V a, V b) { return a >> b; }
+W bar (W a, W b) { return a >> b; }
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr101611-2.c b/gcc/testsuite/gcc.target/i386/avx2-pr101611-2.c
new file mode 100644
index 0000000..14bc7cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr101611-2.c
@@ -0,0 +1,41 @@
+/* PR target/101611 */
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx2 -mno-avx512f" } */
+/* { dg-require-effective-target avx2 } */
+
+#include "avx2-check.h"
+
+typedef long long V __attribute__((vector_size(32)));
+typedef long long W __attribute__((vector_size(16)));
+
+__attribute__((noipa)) V
+foo (V a, V b)
+{
+ return a >> b;
+}
+
+__attribute__((noipa)) W
+bar (W a, W b)
+{
+ return a >> b;
+}
+
+static void
+avx2_test (void)
+{
+ V a = { 0x7f123456789abcdeLL, -0x30edcba987654322LL,
+ -0x30edcba987654322LL, 0x7f123456789abcdeLL };
+ V b = { 17, 11, 23, 0 };
+ V c = foo (a, b);
+ if (c[0] != 0x3f891a2b3c4dLL
+ || c[1] != -0x61db97530eca9LL
+ || c[2] != -0x61db97530fLL
+ || c[3] != 0x7f123456789abcdeLL)
+ abort ();
+ W d = { 0x7f123456789abcdeLL, -0x30edcba987654322LL };
+ W e = { 45, 27 };
+ W f = bar (d, e);
+ if (f[0] != 0x3f891LL
+ || f[1] != -0x61db97531LL)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr82370.c b/gcc/testsuite/gcc.target/i386/avx2-pr82370.c
index 6609ebb..df3dfd8 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-pr82370.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr82370.c
@@ -4,7 +4,7 @@
/* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
-/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 2 } } */
/* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */
/* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
@@ -13,7 +13,7 @@
/* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
-/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 2 } } */
/* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 0 } } */
/* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr99908.c b/gcc/testsuite/gcc.target/i386/avx2-pr99908.c
new file mode 100644
index 0000000..2775f3b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr99908.c
@@ -0,0 +1,25 @@
+/* PR target/99908 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -masm=att" } */
+/* { dg-final { scan-assembler-times "\tvpblendvb\t" 2 } } */
+/* { dg-final { scan-assembler-not "\tvpcmpeq" } } */
+/* { dg-final { scan-assembler-not "\tvpandn" } } */
+
+#include <x86intrin.h>
+
+__m256i
+f1 (__m256i a, __m256i b, __m256i mask)
+{
+ return _mm256_blendv_epi8(a, b,
+ _mm256_andnot_si256(mask, _mm256_set1_epi8(255)));
+}
+
+__m256i
+f2 (__v32qi x, __v32qi a, __v32qi b)
+{
+ x ^= (__v32qi) { -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 };
+ return _mm256_blendv_epi8 ((__m256i) a, (__m256i) b, (__m256i) x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-psraq-1.c b/gcc/testsuite/gcc.target/i386/avx2-psraq-1.c
new file mode 100644
index 0000000..e9051bf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-psraq-1.c
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx2 -mno-avx512f" } */
+/* { dg-require-effective-target avx2 } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx2-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx2_test
+#endif
+
+#include CHECK_H
+
+typedef long long V __attribute__((vector_size (32)));
+
+#define TESTN(N) \
+static V \
+__attribute__((noipa)) \
+test##N (V x) \
+{ \
+ return x >> N; \
+}
+
+#define TESTS TESTN (63) TESTN (49) TESTN (32) TESTN (31) TESTN (18)
+TESTS
+
+struct
+{
+ int n;
+ V (*fn) (V);
+} tests[] = {
+#undef TESTN
+#define TESTN(N) { N, test##N },
+ TESTS
+};
+
+static void
+TEST (void)
+{
+ V a = (V) { 0xdeadbeefcafebabeULL, 0x123456789abcdef0ULL,
+ 0x173a74be8a95134cULL, 0x817bae35ac0ebf12ULL };
+ int i;
+ for (i = 0; tests[i].n; i++)
+ {
+ V c = tests[i].fn (a);
+ if (c[0] != a[0] >> tests[i].n || c[1] != a[1] >> tests[i].n
+ || c[2] != a[2] >> tests[i].n || c[3] != a[3] >> tests[i].n)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-shiftqihi-constant-1.c b/gcc/testsuite/gcc.target/i386/avx2-shiftqihi-constant-1.c
index 7206503..801f570 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-shiftqihi-constant-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-shiftqihi-constant-1.c
@@ -1,6 +1,6 @@
/* PR target/95524 */
/* { dg-do compile } */
-/* { dg-options "-O2 -mavx2" } */
+/* { dg-options "-O2 -mavx2 -mno-avx512f" } */
/* { dg-final { scan-assembler-times "vpand\[^\n\]*%ymm" 3 } } */
typedef char v32qi __attribute__ ((vector_size (32)));
typedef unsigned char v32uqi __attribute__ ((vector_size (32)));
diff --git a/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c b/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c
index 1ea1117..5719279 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target avx2 } */
-/* { dg-options "-mavx2 -O3 -fopenmp-simd -fdump-tree-vect-details" } */
+/* { dg-options "-mavx2 -O3 -fopenmp-simd -fdump-tree-vect-details -fdisable-tree-thread1" } */
#include "avx2-check.h"
#define N 64
diff --git a/gcc/testsuite/gcc.target/i386/avx512-check.h b/gcc/testsuite/gcc.target/i386/avx512-check.h
index 0a377db..0ad9064 100644
--- a/gcc/testsuite/gcc.target/i386/avx512-check.h
+++ b/gcc/testsuite/gcc.target/i386/avx512-check.h
@@ -87,6 +87,9 @@ main ()
#ifdef AVX512VNNI
&& (ecx & bit_AVX512VNNI)
#endif
+#ifdef AVX512FP16
+ && (edx & bit_AVX512FP16)
+#endif
#ifdef VAES
&& (ecx & bit_VAES)
#endif
diff --git a/gcc/testsuite/gcc.target/i386/avx512bitalg-pr97770-1.c b/gcc/testsuite/gcc.target/i386/avx512bitalg-pr97770-1.c
index c83a477..d1beec4 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bitalg-pr97770-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bitalg-pr97770-1.c
@@ -1,19 +1,18 @@
/* PR target/97770 */
/* { dg-do compile } */
-/* { dg-options "-O2 -mavx512bitalg -mavx512vl -mprefer-vector-width=512" } */
-/* Add xfail since no IFN for QI/HImode popcount */
-/* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*xmm" 1 {xfail *-*-*} } } */
-/* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*xmm" 1 {xfail *-*-*} } } */
-/* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*ymm" 1 {xfail *-*-*} } } */
-/* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*ymm" 1 {xfail *-*-*} } } */
-/* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*zmm" 1 {xfail *-*-*} } } */
-/* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*zmm" 1 {xfail *-*-*} } } */
+/* { dg-options "-O2 -march=icelake-server -mprefer-vector-width=512" } */
+/* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */
+/* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */
#include <immintrin.h>
void
__attribute__ ((noipa, optimize("-O3")))
-popcountb_128 (char * __restrict dest, char* src)
+popcountb_128 (unsigned char * __restrict dest, unsigned char* src)
{
for (int i = 0; i != 16; i++)
dest[i] = __builtin_popcount (src[i]);
@@ -21,7 +20,7 @@ popcountb_128 (char * __restrict dest, char* src)
void
__attribute__ ((noipa, optimize("-O3")))
-popcountw_128 (short* __restrict dest, short* src)
+popcountw_128 (unsigned short* __restrict dest, unsigned short* src)
{
for (int i = 0; i != 8; i++)
dest[i] = __builtin_popcount (src[i]);
@@ -29,7 +28,7 @@ popcountw_128 (short* __restrict dest, short* src)
void
__attribute__ ((noipa, optimize("-O3")))
-popcountb_256 (char * __restrict dest, char* src)
+popcountb_256 (unsigned char * __restrict dest, unsigned char* src)
{
for (int i = 0; i != 32; i++)
dest[i] = __builtin_popcount (src[i]);
@@ -37,7 +36,7 @@ popcountb_256 (char * __restrict dest, char* src)
void
__attribute__ ((noipa, optimize("-O3")))
-popcountw_256 (short* __restrict dest, short* src)
+popcountw_256 (unsigned short* __restrict dest, unsigned short* src)
{
for (int i = 0; i != 16; i++)
dest[i] = __builtin_popcount (src[i]);
@@ -45,7 +44,7 @@ popcountw_256 (short* __restrict dest, short* src)
void
__attribute__ ((noipa, optimize("-O3")))
-popcountb_512 (char * __restrict dest, char* src)
+popcountb_512 (unsigned char * __restrict dest, unsigned char* src)
{
for (int i = 0; i != 64; i++)
dest[i] = __builtin_popcount (src[i]);
@@ -53,7 +52,7 @@ popcountb_512 (char * __restrict dest, char* src)
void
__attribute__ ((noipa, optimize("-O3")))
-popcountw_512 (short* __restrict dest, short* src)
+popcountw_512 (unsigned short* __restrict dest, unsigned short* src)
{
for (int i = 0; i != 32; i++)
dest[i] = __builtin_popcount (src[i]);
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-1.c
new file mode 100644
index 0000000..ce83d63
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-1.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vbmi2 -O2" } */
+/* { dg-final { scan-assembler-times "vpexpandb\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandb\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandw\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandw\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 2 } } */
+#include <immintrin.h>
+
+char *pi8;
+short *pi16;
+volatile __m512i xi16, xi8;
+
+void extern
+avx512f_test (void)
+{
+ xi8 = _mm512_mask_expand_epi8 (xi8, 0, xi8);
+ xi8 = _mm512_mask_expand_epi8 (xi8, -1, xi8);
+ xi8 = _mm512_mask_expand_epi8 (xi8, (1 << 8) - 1, xi8);
+ xi8 = _mm512_mask_expand_epi8 (xi8, (1 << 8) + 1, xi8);
+
+ xi8 = _mm512_mask_expandloadu_epi8 (xi8, 0, pi8);
+ xi8 = _mm512_mask_expandloadu_epi8 (xi8, -1, pi8);
+ xi8 = _mm512_mask_expandloadu_epi8 (xi8, (1 << 6) - 1, pi8);
+ xi8 = _mm512_mask_expandloadu_epi8 (xi8, (1 << 6) + 3, pi8);
+
+ xi16 = _mm512_mask_expand_epi16 (xi16, 0, xi16);
+ xi16 = _mm512_mask_expand_epi16 (xi16, -1, xi16);
+ xi16 = _mm512_mask_expand_epi16 (xi16, (1 << 3) - 1, xi16);
+ xi16 = _mm512_mask_expand_epi16 (xi16, (1 << 3) + 2, xi16);
+
+ xi16 = _mm512_mask_expandloadu_epi16 (xi16, 0, pi16);
+ xi16 = _mm512_mask_expandloadu_epi16 (xi16, -1, pi16);
+ xi16 = _mm512_mask_expandloadu_epi16 (xi16, (1 << 7) - 1, pi16);
+ xi16 = _mm512_mask_expandloadu_epi16 (xi16, (1 << 7) + 7, pi16);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-b-2.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-b-2.c
new file mode 100644
index 0000000..424b485
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-b-2.c
@@ -0,0 +1,74 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512f -mavx512vbmi2 -mavx512bw" } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-require-effective-target avx512vbmi2 } */
+
+#define AVX512F
+
+#define AVX512VBMI2
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 8)
+#include "avx512f-mask-type.h"
+
+static void
+CALC (char *s, char *r, MASK_TYPE mask)
+{
+ int i, k;
+
+ for (i = 0, k = 0; i < SIZE; i++)
+ {
+ if (mask & ((long long)1 << i))
+ r[i] = s[k++];
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN, i_b) s1, res1, res2, res3, res4, res5, res6, res7, res8;
+ MASK_TYPE mask = (1 << (SIZE >> 2) - 1) - 1;
+ char s2[SIZE];
+ char res_ref1[SIZE];
+ char res_ref2[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s1.a[i] = 12345 * (i + 200) * sign;
+ s2[i] = 67890 * (i + 300) * sign;
+ res1.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res2.x = INTRINSIC (_mask_expand_epi8) (res1.x, MASK_ALL_ONES, s1.x);
+ res3.x = INTRINSIC (_mask_expand_epi8) (res1.x, 0, s1.x);
+ res4.x = INTRINSIC (_mask_expand_epi8) (res1.x, mask, s1.x);
+ res6.x = INTRINSIC (_mask_expandloadu_epi8) (res5.x, MASK_ALL_ONES, s2);
+ res7.x = INTRINSIC (_mask_expandloadu_epi8) (res5.x, 0, s2);
+ res8.x = INTRINSIC (_mask_expandloadu_epi8) (res5.x, mask, s2);
+
+ CALC (s1.a, res_ref1, mask);
+ CALC (s2, res_ref2, mask);
+
+ if (UNION_CHECK (AVX512F_LEN, i_b) (res2, s1.a))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_b) (res3, res1.a))
+ abort ();
+
+ MASK_MERGE (i_b) (res_ref1, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_b) (res4, res_ref1))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_b) (res6, s2))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_b) (res7, res5.a))
+ abort ();
+
+ MASK_MERGE (i_b) (res_ref2, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_b) (res8, res_ref2))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-d-2.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-d-2.c
new file mode 100644
index 0000000..24790b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-d-2.c
@@ -0,0 +1,74 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512f -mavx512vbmi2 -mavx512bw" } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-require-effective-target avx512vbmi2 } */
+
+#define AVX512F
+
+#define AVX512VBMI2
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 32)
+#include "avx512f-mask-type.h"
+
+static void
+CALC (int *s, int *r, MASK_TYPE mask)
+{
+ int i, k;
+
+ for (i = 0, k = 0; i < SIZE; i++)
+ {
+ if (mask & ((long long)1 << i))
+ r[i] = s[k++];
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN, i_d) s1, res1, res2, res3, res4, res5, res6, res7, res8;
+ MASK_TYPE mask = (1 << SIZE - 1) - 1;
+ int s2[SIZE];
+ int res_ref1[SIZE];
+ int res_ref2[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s1.a[i] = 12345 * (i + 200) * sign;
+ s2[i] = 67890 * (i + 300) * sign;
+ res1.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res2.x = INTRINSIC (_mask_expand_epi32) (res1.x, MASK_ALL_ONES, s1.x);
+ res3.x = INTRINSIC (_mask_expand_epi32) (res1.x, 0, s1.x);
+ res4.x = INTRINSIC (_mask_expand_epi32) (res1.x, mask, s1.x);
+ res6.x = INTRINSIC (_mask_expandloadu_epi32) (res5.x, MASK_ALL_ONES, s2);
+ res7.x = INTRINSIC (_mask_expandloadu_epi32) (res5.x, 0, s2);
+ res8.x = INTRINSIC (_mask_expandloadu_epi32) (res5.x, mask, s2);
+
+ CALC (s1.a, res_ref1, mask);
+ CALC (s2, res_ref2, mask);
+
+ if (UNION_CHECK (AVX512F_LEN, i_d) (res2, s1.a))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res1.a))
+ abort ();
+
+ MASK_MERGE (i_d) (res_ref1, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_d) (res4, res_ref1))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_d) (res6, s2))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_d) (res7, res5.a))
+ abort ();
+
+ MASK_MERGE (i_d) (res_ref2, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_d) (res8, res_ref2))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-q-2.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-q-2.c
new file mode 100644
index 0000000..119b50e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-q-2.c
@@ -0,0 +1,74 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512f -mavx512vbmi2 -mavx512bw" } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-require-effective-target avx512vbmi2 } */
+
+#define AVX512F
+
+#define AVX512VBMI2
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 64)
+#include "avx512f-mask-type.h"
+
+static void
+CALC (long long *s, long long *r, MASK_TYPE mask)
+{
+ int i, k;
+
+ for (i = 0, k = 0; i < SIZE; i++)
+ {
+ if (mask & ((long long)1 << i))
+ r[i] = s[k++];
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN, i_q) s1, res1, res2, res3, res4, res5, res6, res7, res8;
+ MASK_TYPE mask = (1 << SIZE - 1) - 1;
+ long long s2[SIZE];
+ long long res_ref1[SIZE];
+ long long res_ref2[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s1.a[i] = 12345 * (i + 200) * sign;
+ s2[i] = 67890 * (i + 300) * sign;
+ res1.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res2.x = INTRINSIC (_mask_expand_epi64) (res1.x, MASK_ALL_ONES, s1.x);
+ res3.x = INTRINSIC (_mask_expand_epi64) (res1.x, 0, s1.x);
+ res4.x = INTRINSIC (_mask_expand_epi64) (res1.x, mask, s1.x);
+ res6.x = INTRINSIC (_mask_expandloadu_epi64) (res5.x, MASK_ALL_ONES, s2);
+ res7.x = INTRINSIC (_mask_expandloadu_epi64) (res5.x, 0, s2);
+ res8.x = INTRINSIC (_mask_expandloadu_epi64) (res5.x, mask, s2);
+
+ CALC (s1.a, res_ref1, mask);
+ CALC (s2, res_ref2, mask);
+
+ if (UNION_CHECK (AVX512F_LEN, i_q) (res2, s1.a))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res1.a))
+ abort ();
+
+ MASK_MERGE (i_q) (res_ref1, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_q) (res4, res_ref1))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_q) (res6, s2))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_q) (res7, res5.a))
+ abort ();
+
+ MASK_MERGE (i_q) (res_ref2, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_q) (res8, res_ref2))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-w-2.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-w-2.c
new file mode 100644
index 0000000..926e04d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr100267-w-2.c
@@ -0,0 +1,74 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512f -mavx512vbmi2 -mavx512bw" } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-require-effective-target avx512vbmi2 } */
+
+#define AVX512F
+
+#define AVX512VBMI2
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 16)
+#include "avx512f-mask-type.h"
+
+static void
+CALC (short *s, short *r, MASK_TYPE mask)
+{
+ int i, k;
+
+ for (i = 0, k = 0; i < SIZE; i++)
+ {
+ if (mask & ((long long)1 << i))
+ r[i] = s[k++];
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN, i_w) s1, res1, res2, res3, res4, res5, res6, res7, res8;
+ MASK_TYPE mask = (1 << (SIZE >> 2) - 1) - 1;
+ short s2[SIZE];
+ short res_ref1[SIZE];
+ short res_ref2[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s1.a[i] = 12345 * (i + 200) * sign;
+ s2[i] = 67890 * (i + 300) * sign;
+ res1.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res2.x = INTRINSIC (_mask_expand_epi16) (res1.x, MASK_ALL_ONES, s1.x);
+ res3.x = INTRINSIC (_mask_expand_epi16) (res1.x, 0, s1.x);
+ res4.x = INTRINSIC (_mask_expand_epi16) (res1.x, mask, s1.x);
+ res6.x = INTRINSIC (_mask_expandloadu_epi16) (res5.x, MASK_ALL_ONES, s2);
+ res7.x = INTRINSIC (_mask_expandloadu_epi16) (res5.x, 0, s2);
+ res8.x = INTRINSIC (_mask_expandloadu_epi16) (res5.x, mask, s2);
+
+ CALC (s1.a, res_ref1, mask);
+ CALC (s2, res_ref2, mask);
+
+ if (UNION_CHECK (AVX512F_LEN, i_w) (res2, s1.a))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res1.a))
+ abort ();
+
+ MASK_MERGE (i_w) (res_ref1, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_w) (res4, res_ref1))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_w) (res6, s2))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, i_w) (res7, res5.a))
+ abort ();
+
+ MASK_MERGE (i_w) (res_ref2, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, i_w) (res8, res_ref2))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c
index 174f499..12c3b27 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c
@@ -4,7 +4,7 @@
/* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
-/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 2 } } */
/* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */
/* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
@@ -13,7 +13,7 @@
/* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
-/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 2 } } */
/* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 0 } } */
/* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-shiftqihi-constant-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-shiftqihi-constant-1.c
index 78bf5d3..fbc3de0 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-shiftqihi-constant-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-shiftqihi-constant-1.c
@@ -1,7 +1,8 @@
/* PR target/95524 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512bw" } */
-/* { dg-final { scan-assembler-times "vpand\[^\n\]*%zmm" 3 } } */
+/* { dg-final { scan-assembler-times "vpand\[^\n\]*%zmm" 2 } } */
+/* { dg-final { scan-assembler-times "vpternlogd\[^\n\]*%zmm" 1 } } */
typedef char v64qi __attribute__ ((vector_size (64)));
typedef unsigned char v64uqi __attribute__ ((vector_size (64)));
@@ -11,7 +12,6 @@ foo_ashiftrt_512 (v64qi a)
return a >> 2;
}
/* { dg-final { scan-assembler-times "vpsraw\[^\n\]*%zmm" 1 } } */
-/* { dg-final { scan-assembler-times "vpxor\[^\n\]*%zmm" 1 } } */
/* { dg-final { scan-assembler-times "vpsubb\[^\n\]*%zmm" 1 } } */
__attribute__((noipa)) v64qi
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqb-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqb-1.c
index 506fcf9d..11a6007 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqb-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqb-1.c
@@ -1,11 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bw -mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpeqb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqw-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqw-1.c
index 1b2670b..5cf8198 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqw-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpeqw-1.c
@@ -1,11 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bw -mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpeqw\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqw\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqw\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqw\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqw\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqw\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtb-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtb-1.c
index e4014b3..bc7e8b1 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtb-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtb-1.c
@@ -1,11 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bw -mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpgtb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtb\[ \\t\]+|vpcmpb\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtw-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtw-1.c
index 37e8d32..02999e0 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtw-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpcmpgtw-1.c
@@ -1,11 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bw -mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpgtw\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtw\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtw\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtw\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtw\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtw\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtw\[ \\t\]+|vpcmpw\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-abs-copysign-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-abs-copysign-1.c
index cb542d0..0107df7 100644
--- a/gcc/testsuite/gcc.target/i386/avx512dq-abs-copysign-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-abs-copysign-1.c
@@ -64,8 +64,8 @@ f6 (double x)
}
/* { dg-final { scan-assembler "vandps\[^\n\r\]*xmm16" } } */
-/* { dg-final { scan-assembler "vorps\[^\n\r\]*xmm16" } } */
+/* { dg-final { scan-assembler "vpternlogd\[^\n\r\]*xmm16" } } */
/* { dg-final { scan-assembler "vxorps\[^\n\r\]*xmm16" } } */
/* { dg-final { scan-assembler "vandpd\[^\n\r\]*xmm18" } } */
-/* { dg-final { scan-assembler "vorpd\[^\n\r\]*xmm18" } } */
+/* { dg-final { scan-assembler "vpternlogq\[^\n\r\]*xmm18" } } */
/* { dg-final { scan-assembler "vxorpd\[^\n\r\]*xmm18" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c
index 0563e69..a2664d8 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c
@@ -2,8 +2,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512dq" } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 5 } } */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to16\\\}" 5 } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 5 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to16\\\}" 2 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %zmm\[0-9\]+" 3 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %zmm\[0-9\]+" 3 { target { ! ia32 } } } } */
typedef int v16si __attribute__ ((vector_size (64)));
typedef long long v8di __attribute__ ((vector_size (64)));
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c
index ffbe959..477f9ca 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c
@@ -2,8 +2,9 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f" } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^n\n\]*\\\{1to8\\\}" 4 } } */
-/* { dg-final { scan-assembler-times "\[^n\n\]*\\\{1to16\\\}" 4 } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 4 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %zmm\[0-9\]+" 4 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %zmm\[0-9\]+" 4 { target { ! ia32 } } } } */
typedef int v16si __attribute__ ((vector_size (64)));
typedef long long v8di __attribute__ ((vector_size (64)));
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr100267-1.c b/gcc/testsuite/gcc.target/i386/avx512f-pr100267-1.c
new file mode 100644
index 0000000..5eb6de5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr100267-1.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vpexpandd\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandd\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandq\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandq\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandpd\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandpd\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandps\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandps\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 4 } } */
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\(]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 4 } } */
+#include <immintrin.h>
+
+int *pi32;
+long long *pi64;
+double *pd;
+float *pf;
+volatile __m512i xi32, xi64;
+volatile __m512d xd;
+volatile __m512 xf;
+
+void extern
+avx512f_test (void)
+{
+ xi32 = _mm512_mask_expand_epi32 (xi32, 0, xi32);
+ xi32 = _mm512_mask_expand_epi32 (xi32, -1, xi32);
+ xi32 = _mm512_mask_expand_epi32 (xi32, (1 << 8) - 1, xi32);
+ xi32 = _mm512_mask_expand_epi32 (xi32, (1 << 8) + 1, xi32);
+
+ xi32 = _mm512_mask_expandloadu_epi32 (xi32, 0, pi32);
+ xi32 = _mm512_mask_expandloadu_epi32 (xi32, (1 << 16) - 1, pi32);
+ xi32 = _mm512_mask_expandloadu_epi32 (xi32, (1 << 6) - 1, pi32);
+ xi32 = _mm512_mask_expandloadu_epi32 (xi32, (1 << 6) + 3, pi32);
+
+ xi64 = _mm512_mask_expand_epi64 (xi64, 0, xi64);
+ xi64 = _mm512_mask_expand_epi64 (xi64, -1, xi64);
+ xi64 = _mm512_mask_expand_epi64 (xi64, (1 << 3) - 1, xi64);
+ xi64 = _mm512_mask_expand_epi64 (xi64, (1 << 3) + 2, xi64);
+
+ xi64 = _mm512_mask_expandloadu_epi64 (xi64, 0, pi64);
+ xi64 = _mm512_mask_expandloadu_epi64 (xi64, (1 << 8) - 1, pi64);
+ xi64 = _mm512_mask_expandloadu_epi64 (xi64, (1 << 7) - 1, pi64);
+ xi64 = _mm512_mask_expandloadu_epi64 (xi64, (1 << 7) + 7, pi64);
+
+ xf = _mm512_mask_expand_ps (xf, 0, xf);
+ xf = _mm512_mask_expand_ps (xf, (1 << 16) - 1, xf);
+ xf = _mm512_mask_expand_ps (xf, (1 << 15) - 1, xf);
+ xf = _mm512_mask_expand_ps (xf, (1 << 14) + 3, xf);
+
+ xf = _mm512_mask_expandloadu_ps (xf, 0, pf);
+ xf = _mm512_mask_expandloadu_ps (xf, -1, pf);
+ xf = _mm512_mask_expandloadu_ps (xf, (1 << 13) - 1, pf);
+ xf = _mm512_mask_expandloadu_ps (xf, (1 << 13) + 5, pf);
+
+ xd = _mm512_mask_expand_pd (xd, 0, xd);
+ xd = _mm512_mask_expand_pd (xd, (1 << 8) - 1, xd);
+ xd = _mm512_mask_expand_pd (xd, (1 << 4) - 1, xd);
+ xd = _mm512_mask_expand_pd (xd, (1 << 4) + 1, xd);
+
+ xd = _mm512_mask_expandloadu_pd (xd, 0, pd);
+ xd = _mm512_mask_expandloadu_pd (xd, -1, pd);
+ xd = _mm512_mask_expandloadu_pd (xd, (1 << 5) - 1, pd);
+ xd = _mm512_mask_expandloadu_pd (xd, (1 << 5), pd);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr100267-pd-2.c b/gcc/testsuite/gcc.target/i386/avx512f-pr100267-pd-2.c
new file mode 100644
index 0000000..7d653e8e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr100267-pd-2.c
@@ -0,0 +1,76 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512f" } */
+/* { dg-require-effective-target avx512f } */
+
+#define AVX512F
+
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 64)
+#include "avx512f-mask-type.h"
+
+static void
+CALC (double *s, double *r, MASK_TYPE mask)
+{
+ int i, k;
+
+ for (i = 0, k = 0; i < SIZE; i++)
+ {
+ if (mask & (1 << i))
+ r[i] = s[k++];
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN, d) s1, res2, res3, res4, res5, res6, res7, res8, res9;
+ MASK_TYPE mask = (1 << SIZE - 1) - 1;
+ double s2[SIZE];
+ double res_ref1[SIZE];
+ double res_ref2[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s1.a[i] = 123.456 * (i + 200) * sign;
+ s2[i] = 789.012 * (i + 300) * sign;
+ res2.a[i] = DEFAULT_VALUE;
+ res6.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res3.x = INTRINSIC (_mask_expand_pd) (res2.x, MASK_ALL_ONES, s1.x);
+ res4.x = INTRINSIC (_mask_expand_pd) (res2.x, 0, s1.x);
+ res5.x = INTRINSIC (_mask_expand_pd) (res2.x, mask, s1.x);
+
+ res7.x = INTRINSIC (_mask_expandloadu_pd) (res6.x, MASK_ALL_ONES, s2);
+ res8.x = INTRINSIC (_mask_expandloadu_pd) (res6.x, 0, s2);
+ res9.x = INTRINSIC (_mask_expandloadu_pd) (res6.x, mask, s2);
+
+
+ /* no mask is the same as all ones mask. */
+ CALC (s1.a, res_ref1, mask);
+ CALC (s2, res_ref2, mask);
+
+ if (UNION_CHECK (AVX512F_LEN, d) (res3, s1.a))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, d) (res4, res2.a))
+ abort ();
+
+ MASK_MERGE (d) (res_ref1, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, d) (res5, res_ref1))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, d) (res7, s2))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, d) (res8, res6.a))
+ abort ();
+
+ MASK_MERGE (d) (res_ref2, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, d) (res9, res_ref2))
+ abort ();
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr100267-ps-2.c b/gcc/testsuite/gcc.target/i386/avx512f-pr100267-ps-2.c
new file mode 100644
index 0000000..40f0dde
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr100267-ps-2.c
@@ -0,0 +1,72 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512f" } */
+/* { dg-require-effective-target avx512f } */
+
+#define AVX512F
+
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 32)
+#include "avx512f-mask-type.h"
+
+static void
+CALC (float *s, float *r, MASK_TYPE mask)
+{
+ int i, k;
+
+ for (i = 0, k = 0; i < SIZE; i++)
+ {
+ if (mask & (1 << i))
+ r[i] = s[k++];
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN, ) s1, res2, res3, res4, res5, res6, res7, res8, res9;
+ MASK_TYPE mask = (1 << SIZE - 1) - 1;
+ float s2[SIZE];
+ float res_ref1[SIZE];
+ float res_ref2[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s1.a[i] = 123.456 * (i + 200) * sign;
+ s2[i] = 789.012 * (i + 300) * sign;
+ res2.a[i] = DEFAULT_VALUE;
+ res6.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res3.x = INTRINSIC (_mask_expand_ps) (res2.x, MASK_ALL_ONES, s1.x);
+ res4.x = INTRINSIC (_mask_expand_ps) (res2.x, 0, s1.x);
+ res5.x = INTRINSIC (_mask_expand_ps) (res2.x, mask, s1.x);
+ res7.x = INTRINSIC (_mask_expandloadu_ps) (res6.x, MASK_ALL_ONES, s2);
+ res8.x = INTRINSIC (_mask_expandloadu_ps) (res6.x, 0, s2);
+ res9.x = INTRINSIC (_mask_expandloadu_ps) (res6.x, mask, s2);
+
+ CALC (s1.a, res_ref1, mask);
+ CALC (s2, res_ref2, mask);
+
+ if (UNION_CHECK (AVX512F_LEN, ) (res3, s1.a))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, ) (res4, res2.a))
+ abort ();
+
+ MASK_MERGE () (res_ref1, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, ) (res5, res_ref1))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, ) (res7, s2))
+ abort ();
+
+ if (UNION_CHECK (AVX512F_LEN, ) (res8, res6.a))
+ abort ();
+
+ MASK_MERGE () (res_ref2, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, ) (res9, res_ref2))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr101471.c b/gcc/testsuite/gcc.target/i386/avx512f-pr101471.c
new file mode 100644
index 0000000..4a0057b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr101471.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-mavx512dq -O0" } */
+/* { dg-require-effective-target avx512dq } */
+
+#include "avx512f-check.h"
+
+static void
+avx512f_test (void)
+{
+ __m512 x = {
+ 1, 1, 1, 1,
+ 1, 1, 1, 1,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0, };
+ int ret = _mm512_fpclass_ps_mask(x, 0x26);
+ if (ret != 65280)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr101472.c b/gcc/testsuite/gcc.target/i386/avx512f-pr101472.c
new file mode 100644
index 0000000..89c6603
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr101472.c
@@ -0,0 +1,49 @@
+/* PR target/101472 */
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vpscatterqd\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*zmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterdd\[ \\t\]+\[^\{\n\]*zmm\[0-9\]\[^\n\]*zmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterqq\[ \\t\]+\[^\{\n\]*zmm\[0-9\]\[^\n\]*zmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterdq\[ \\t\]+\[^\{\n\]*zmm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterqps\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*zmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterdps\[ \\t\]+\[^\{\n\]*zmm\[0-9\]\[^\n\]*zmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterqpd\[ \\t\]+\[^\{\n\]*zmm\[0-9\]\[^\n\]*zmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterdpd\[ \\t\]+\[^\{\n\]*zmm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void two_scatters_epi32(void* addr, __mmask8 k1, __mmask8 k2, __m512i vindex,
+ __m256i a, __m512i b)
+{
+ _mm512_mask_i64scatter_epi32(addr, k1, vindex, a, 1);
+ _mm512_mask_i64scatter_epi32(addr, k2, vindex, a, 1);
+ _mm512_mask_i32scatter_epi32(addr, k1, vindex, b, 1);
+ _mm512_mask_i32scatter_epi32(addr, k2, vindex, b, 1);
+}
+
+void two_scatters_epi64(void* addr, __mmask8 k1, __mmask8 k2, __m512i vindex,
+ __m256i idx, __m512i a)
+{
+ _mm512_mask_i64scatter_epi64(addr, k1, vindex, a, 1);
+ _mm512_mask_i64scatter_epi64(addr, k2, vindex, a, 1);
+ _mm512_mask_i32scatter_epi64(addr, k1, idx, a, 1);
+ _mm512_mask_i32scatter_epi64(addr, k2, idx, a, 1);
+}
+
+void two_scatters_ps(void* addr, __mmask8 k1, __mmask8 k2, __m512i vindex,
+ __m256 a, __m512 b)
+{
+ _mm512_mask_i64scatter_ps(addr, k1, vindex, a, 1);
+ _mm512_mask_i64scatter_ps(addr, k2, vindex, a, 1);
+ _mm512_mask_i32scatter_ps(addr, k1, vindex, b, 1);
+ _mm512_mask_i32scatter_ps(addr, k2, vindex, b, 1);
+}
+
+void two_scatters_pd(void* addr, __mmask8 k1, __mmask8 k2, __m512i vindex,
+ __m256i idx, __m512d a)
+{
+ _mm512_mask_i64scatter_pd(addr, k1, vindex, a, 1);
+ _mm512_mask_i64scatter_pd(addr, k2, vindex, a, 1);
+ _mm512_mask_i32scatter_pd(addr, k1, idx, a, 1);
+ _mm512_mask_i32scatter_pd(addr, k2, idx, a, 1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr101860.c b/gcc/testsuite/gcc.target/i386/avx512f-pr101860.c
new file mode 100644
index 0000000..1aadfa2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr101860.c
@@ -0,0 +1,5 @@
+/* PR target/101860 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mno-avx512bw" } */
+
+#include "../../gcc.dg/torture/vshuf-v32hi.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr101896.c b/gcc/testsuite/gcc.target/i386/avx512f-pr101896.c
new file mode 100644
index 0000000..c1805cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr101896.c
@@ -0,0 +1,5 @@
+/* PR target/101896 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mno-avx512bw" } */
+
+#include "../../gcc.dg/torture/vshuf-v64qi.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr80355-1.c b/gcc/testsuite/gcc.target/i386/avx512f-pr80355-1.c
new file mode 100644
index 0000000..b1ff010
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr80355-1.c
@@ -0,0 +1,19 @@
+/* PR target/80355 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mno-avx512vl -mno-avx512dq" } */
+/* { dg-final { scan-assembler "\tvshufi32x4\t" } } */
+/* { dg-final { scan-assembler "\tvshufi64x2\t" } } */
+
+typedef long long V __attribute__((vector_size (64)));
+typedef int W __attribute__((vector_size (64)));
+
+W
+f0 (W x)
+{
+ return __builtin_shuffle (x, (W) { 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7 });
+}
+V
+f1 (V x)
+{
+ return __builtin_shuffle (x, (V) { 4, 5, 6, 7, 0, 1, 2, 3 });
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr80355-2.c b/gcc/testsuite/gcc.target/i386/avx512f-pr80355-2.c
new file mode 100644
index 0000000..c510b2f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr80355-2.c
@@ -0,0 +1,23 @@
+/* PR target/80355 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mno-avx512vl -mno-avx512dq -mno-avx512bw" } */
+/* { dg-final { scan-assembler-times "\tvshufi(?:32x4|64x2)\t" 2 } } */
+
+typedef short V __attribute__((vector_size (64)));
+typedef char W __attribute__((vector_size (64)));
+
+W
+f0 (W x)
+{
+ return __builtin_shuffle (x, (W) { 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 });
+}
+
+V
+f1 (V x)
+{
+ return __builtin_shuffle (x, (V) { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 });
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c b/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c
index 20ad8dc..b179f9b 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c
@@ -4,7 +4,7 @@
/* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
-/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 2 } } */
/* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */
/* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */
@@ -13,7 +13,7 @@
/* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 3 } } */
-/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 2 } } */
/* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 0 } } */
/* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 3 } } */
/* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr94680.c b/gcc/testsuite/gcc.target/i386/avx512f-pr94680.c
new file mode 100644
index 0000000..c27431a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr94680.c
@@ -0,0 +1,144 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vbmi -O2" } */
+/* { dg-final { scan-assembler-times {(?n)vmov[a-z0-9]*[ \t]*%ymm[0-9]} 12} } */
+/* { dg-final { scan-assembler-not "pxor" } } */
+
+
+typedef float v16sf __attribute__((vector_size(64)));
+typedef double v8df __attribute__ ((vector_size (64)));
+typedef long long v8di __attribute__((vector_size(64)));
+typedef int v16si __attribute__((vector_size(64)));
+typedef short v32hi __attribute__ ((vector_size (64)));
+typedef char v64qi __attribute__ ((vector_size (64)));
+
+v8df
+foo_v8df (v8df x)
+{
+ return __builtin_shuffle (x, (v8df) { 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v8di) { 0, 1, 2, 3, 15, 14, 10, 11 });
+}
+
+v8df
+foo_v8df_l (v8df x)
+{
+ return __builtin_shuffle ((v8df) { 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v8di) { 8, 9, 10, 11, 0, 1, 2, 3 });
+}
+
+v8di
+foo_v8di (v8di x)
+{
+ return __builtin_shuffle (x, (v8di) { 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v8di) { 0, 1, 2, 3, 8, 9, 10, 11 });
+}
+
+v8di
+foo_v8di_l (v8di x)
+{
+ return __builtin_shuffle ((v8di) { 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v8di) { 8, 9, 10, 11, 7, 6, 5, 4 });
+}
+
+v16sf
+foo_v16sf (v16sf x)
+{
+ return __builtin_shuffle (x, (v16sf) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v16si) { 0, 1, 2, 3, 4, 5, 6, 7,
+ 16, 17, 18, 19, 20, 21, 22, 23 });
+}
+
+v16sf
+foo_v16sf_l (v16sf x)
+{
+ return __builtin_shuffle ((v16sf) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v16si) { 16, 17, 18, 19, 20, 21, 22, 23,
+ 0, 15, 2, 13, 4, 11, 6, 9 });
+}
+
+v16si
+foo_v16si (v16si x)
+{
+ return __builtin_shuffle (x, (v16si) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v16si) { 0, 1, 2, 3, 4, 5, 6, 7,
+ 31, 30, 29, 28, 20, 21, 22, 23 });
+}
+
+v16si
+foo_v16si_l (v16si x)
+{
+ return __builtin_shuffle ((v16si) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v16si) { 16, 17, 18, 19, 20, 21, 22, 23,
+ 15, 0, 13, 2, 11, 4, 9, 6 });
+}
+
+v32hi
+foo_v32hi (v32hi x)
+{
+ return __builtin_shuffle (x, (v32hi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v32hi) { 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 63, 33, 61, 35, 59, 37, 57, 39,
+ 55, 41, 53, 43, 51, 45, 49, 47 });
+}
+
+v32hi
+foo_v32hi_l (v32hi x)
+{
+ return __builtin_shuffle ((v32hi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v32hi) { 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 31, 0, 29, 2, 27, 4, 25, 6,
+ 23, 8, 21, 10, 19, 12, 17, 14 });
+}
+
+v64qi
+foo_v64qi (v64qi x)
+{
+ return __builtin_shuffle (x, (v64qi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v64qi) {0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 64, 127, 66, 125, 68, 123, 70, 121,
+ 72, 119, 74, 117, 76, 115, 78, 113,
+ 80, 111, 82, 109, 84, 107, 86, 105,
+ 88, 103, 90, 101, 92, 99, 94, 97 });
+}
+
+v64qi
+foo_v64qi_l (v64qi x)
+{
+ return __builtin_shuffle ((v64qi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v64qi) { 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95,
+ 0, 63, 2, 61, 4, 59, 6, 57,
+ 8, 55, 10, 53, 12, 51, 14, 49,
+ 16, 47, 18, 45, 20, 43, 22, 41,
+ 24, 39, 26, 37, 28, 35, 30, 33 });
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXpd.c b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXpd.c
new file mode 100644
index 0000000..734f9e0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXpd.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-options "-O3 -mfma -save-temps -mavx512f -mprefer-vector-width=512" } */
+
+#include "fma-check.h"
+void __attribute__((noipa))
+check_fmaddsub (double * __restrict a, double *b, double *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[8*i + 0] = b[8*i + 0] * c[8*i + 0] - a[8*i + 0];
+ a[8*i + 1] = b[8*i + 1] * c[8*i + 1] + a[8*i + 1];
+ a[8*i + 2] = b[8*i + 2] * c[8*i + 2] - a[8*i + 2];
+ a[8*i + 3] = b[8*i + 3] * c[8*i + 3] + a[8*i + 3];
+ a[8*i + 4] = b[8*i + 4] * c[8*i + 4] - a[8*i + 4];
+ a[8*i + 5] = b[8*i + 5] * c[8*i + 5] + a[8*i + 5];
+ a[8*i + 6] = b[8*i + 6] * c[8*i + 6] - a[8*i + 6];
+ a[8*i + 7] = b[8*i + 7] * c[8*i + 7] + a[8*i + 7];
+ }
+}
+
+static void
+fma_test (void)
+{
+ if (!__builtin_cpu_supports ("avx512f"))
+ return;
+ double a[8], b[8], c[8];
+ for (int i = 0; i < 8; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmaddsub (a, b, c, 1);
+ const double d[8] = { 0., 22., 82., 192., 332., 530., 750., 1036.};
+ for (int i = 0; i < 8; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler {(?n)fmaddsub...pd[ \t].*%zmm[0-9]} } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXps.c b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXps.c
new file mode 100644
index 0000000..ae196c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmaddsubXXXps.c
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -save-temps" } */
+
+#include "fma-check.h"
+void __attribute__((noipa))
+check_fmaddsub (float * __restrict a, float *b, float *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[16*i + 0] = b[16*i + 0] * c[16*i + 0] - a[16*i + 0];
+ a[16*i + 1] = b[16*i + 1] * c[16*i + 1] + a[16*i + 1];
+ a[16*i + 2] = b[16*i + 2] * c[16*i + 2] - a[16*i + 2];
+ a[16*i + 3] = b[16*i + 3] * c[16*i + 3] + a[16*i + 3];
+ a[16*i + 4] = b[16*i + 4] * c[16*i + 4] - a[16*i + 4];
+ a[16*i + 5] = b[16*i + 5] * c[16*i + 5] + a[16*i + 5];
+ a[16*i + 6] = b[16*i + 6] * c[16*i + 6] - a[16*i + 6];
+ a[16*i + 7] = b[16*i + 7] * c[16*i + 7] + a[16*i + 7];
+ a[16*i + 8] = b[16*i + 8] * c[16*i + 8] - a[16*i + 8];
+ a[16*i + 9] = b[16*i + 9] * c[16*i + 9] + a[16*i + 9];
+ a[16*i + 10] = b[16*i + 10] * c[16*i + 10] - a[16*i + 10];
+ a[16*i + 11] = b[16*i + 11] * c[16*i + 11] + a[16*i + 11];
+ a[16*i + 12] = b[16*i + 12] * c[16*i + 12] - a[16*i + 12];
+ a[16*i + 13] = b[16*i + 13] * c[16*i + 13] + a[16*i + 13];
+ a[16*i + 14] = b[16*i + 14] * c[16*i + 14] - a[16*i + 14];
+ a[16*i + 15] = b[16*i + 15] * c[16*i + 15] + a[16*i + 15];
+ }
+}
+
+static void
+fma_test (void)
+{
+ if (!__builtin_cpu_supports ("avx512f"))
+ return;
+ float a[16], b[16], c[16];
+ for (int i = 0; i < 16; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmaddsub (a, b, c, 1);
+ const float d[16] = { 0., 22., 82., 192., 332., 530., 750., 1036.,
+ 1336, 1710., 2090., 2552., 3012., 3562., 4102., 4740.};
+ for (int i = 0; i < 16; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler {(?n)fmaddsub...ps[ \t].*%zmm[0-9]} } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXpd.c b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXpd.c
new file mode 100644
index 0000000..cde76db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXpd.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -save-temps" } */
+
+#include "fma-check.h"
+void __attribute__((noipa))
+check_fmaddsub (double * __restrict a, double *b, double *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[8*i + 0] = b[8*i + 0] * c[8*i + 0] + a[8*i + 0];
+ a[8*i + 1] = b[8*i + 1] * c[8*i + 1] - a[8*i + 1];
+ a[8*i + 2] = b[8*i + 2] * c[8*i + 2] + a[8*i + 2];
+ a[8*i + 3] = b[8*i + 3] * c[8*i + 3] - a[8*i + 3];
+ a[8*i + 4] = b[8*i + 4] * c[8*i + 4] + a[8*i + 4];
+ a[8*i + 5] = b[8*i + 5] * c[8*i + 5] - a[8*i + 5];
+ a[8*i + 6] = b[8*i + 6] * c[8*i + 6] + a[8*i + 6];
+ a[8*i + 7] = b[8*i + 7] * c[8*i + 7] - a[8*i + 7];
+ }
+}
+
+static void
+fma_test (void)
+{
+ if (!__builtin_cpu_supports ("avx512f"))
+ return;
+ double a[8], b[8], c[8];
+ for (int i = 0; i < 8; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmaddsub (a, b, c, 1);
+ const double d[8] = { 0., 20., 86., 186., 340., 520., 762., 1022.};
+ for (int i = 0; i < 8; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler {(?n)fmsubadd...pd[ \t].*%zmm[0-9]} } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXps.c b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXps.c
new file mode 100644
index 0000000..59de39f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vect-fmsubaddXXXps.c
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512f } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -save-temps" } */
+
+#include "fma-check.h"
+void __attribute__((noipa))
+check_fmaddsub (float * __restrict a, float *b, float *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[16*i + 0] = b[16*i + 0] * c[16*i + 0] + a[16*i + 0];
+ a[16*i + 1] = b[16*i + 1] * c[16*i + 1] - a[16*i + 1];
+ a[16*i + 2] = b[16*i + 2] * c[16*i + 2] + a[16*i + 2];
+ a[16*i + 3] = b[16*i + 3] * c[16*i + 3] - a[16*i + 3];
+ a[16*i + 4] = b[16*i + 4] * c[16*i + 4] + a[16*i + 4];
+ a[16*i + 5] = b[16*i + 5] * c[16*i + 5] - a[16*i + 5];
+ a[16*i + 6] = b[16*i + 6] * c[16*i + 6] + a[16*i + 6];
+ a[16*i + 7] = b[16*i + 7] * c[16*i + 7] - a[16*i + 7];
+ a[16*i + 8] = b[16*i + 8] * c[16*i + 8] + a[16*i + 8];
+ a[16*i + 9] = b[16*i + 9] * c[16*i + 9] - a[16*i + 9];
+ a[16*i + 10] = b[16*i + 10] * c[16*i + 10] + a[16*i + 10];
+ a[16*i + 11] = b[16*i + 11] * c[16*i + 11] - a[16*i + 11];
+ a[16*i + 12] = b[16*i + 12] * c[16*i + 12] + a[16*i + 12];
+ a[16*i + 13] = b[16*i + 13] * c[16*i + 13] - a[16*i + 13];
+ a[16*i + 14] = b[16*i + 14] * c[16*i + 14] + a[16*i + 14];
+ a[16*i + 15] = b[16*i + 15] * c[16*i + 15] - a[16*i + 15];
+ }
+}
+
+static void
+fma_test (void)
+{
+ if (!__builtin_cpu_supports ("avx512f"))
+ return;
+ float a[16], b[16], c[16];
+ for (int i = 0; i < 16; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmaddsub (a, b, c, 1);
+ const float d[16] = { 0., 20., 86., 186., 340., 520., 762., 1022.,
+ 1352, 1692., 2110., 2530., 3036., 3536., 4130., 4710.};
+ for (int i = 0; i < 16; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler {(?n)fmsubadd...ps[ \t].*%zmm[0-9]} } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqd-1.c
index 4624442..33f4e73 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqd-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqq-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqq-1.c
index 4a6505d..595ba55 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqq-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpeqq-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpeqq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$0)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtd-1.c
index 6b4a7ff..d038cfb 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtd-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpgtd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtq-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtq-1.c
index d3647d4..ce2e41a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtq-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtq-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpgtq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$6)\[^\{\n\]*%zmm\[0-9\]+\[^\n^k\]*%k\[0-7\]\{%k\[0-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vshufpd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vshufpd-1.c
index d1ac01e..8df5b9d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vshufpd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vshufpd-1.c
@@ -7,11 +7,12 @@
#include <immintrin.h>
__m512d x;
+__m512d y;
void extern
avx512f_test (void)
{
- x = _mm512_shuffle_pd (x, x, 56);
+ x = _mm512_shuffle_pd (x, y, 56);
x = _mm512_mask_shuffle_pd (x, 2, x, x, 56);
x = _mm512_maskz_shuffle_pd (2, x, x, 56);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vshufps-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vshufps-1.c
index 07a63fc..378ae4b 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vshufps-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vshufps-1.c
@@ -7,11 +7,12 @@
#include <immintrin.h>
__m512 x;
+__m512 y;
void extern
avx512f_test (void)
{
- x = _mm512_shuffle_ps (x, x, 56);
+ x = _mm512_shuffle_ps (x, y, 56);
x = _mm512_mask_shuffle_ps (x, 2, x, x, 56);
x = _mm512_maskz_shuffle_ps (2, x, x, 56);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f_cond_move.c b/gcc/testsuite/gcc.target/i386/avx512f_cond_move.c
index 99a89f5..ca49a58 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f_cond_move.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f_cond_move.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -mavx512f" } */
-/* { dg-final { scan-assembler-times "(?:vpblendmd|vmovdqa32)\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 8 } } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512" } */
+/* { dg-final { scan-assembler-times "(?:vpbroadcastd|vmovdqa32)\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 8 } } */
unsigned int x[128];
int y[128];
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-10a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-10a.c
new file mode 100644
index 0000000..f06ffff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-10a.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <immintrin.h>
+
+__m128h
+__attribute__ ((noinline, noclone))
+set_128 (_Float16 x)
+{
+ return _mm_set_sh (x);
+}
+
+/* { dg-final { scan-assembler-times "vmovw\[ \t]\+\[^\n\r]*xmm0" 1 { target { ia32 } } } } */
+/* { dg-final { scan-assembler-times "vmovw\[ \t]\+\[^\n\r]*xmm0" 2 { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-10b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-10b.c
new file mode 100644
index 0000000..055edd7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-10b.c
@@ -0,0 +1,25 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-10a.c"
+
+union128h u128 = { ESP_FLOAT16, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+
+static void
+do_test (void)
+{
+ __m128h v128 = set_128 (ESP_FLOAT16);
+ union128h a128;
+
+ a128.x = v128;
+ if (check_union128h (a128, u128.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-11a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-11a.c
new file mode 100644
index 0000000..28492fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-11a.c
@@ -0,0 +1,36 @@
+/* { dg-do compile} */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <immintrin.h>
+__m512h
+__attribute__ ((noinline, noclone))
+vadd512 (__m512h a, __m512h b)
+{
+ return a + b;
+}
+
+__m512h
+__attribute__ ((noinline, noclone))
+vsub512 (__m512h a, __m512h b)
+{
+ return a - b;
+}
+
+__m512h
+__attribute__ ((noinline, noclone))
+vmul512 (__m512h a, __m512h b)
+{
+ return a * b;
+}
+
+__m512h
+__attribute__ ((noinline, noclone))
+vdiv512 (__m512h a, __m512h b)
+{
+ return a / b;
+}
+
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+\[^\n\r\]*%zmm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+\[^\n\r\]*%zmm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+\[^\n\r\]*%zmm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+\[^\n\r\]*%zmm\[01\]" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-11b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-11b.c
new file mode 100644
index 0000000..5f51a5b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-11b.c
@@ -0,0 +1,75 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mfpmath=sse" } */
+
+#include <string.h>
+#include <stdlib.h>
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-11a.c"
+
+/* Get random float16 between -50.x to 50.x. */
+_Float16
+get_float16_noround()
+{
+ return ((int) (100.0 * rand ()/ (RAND_MAX + 1.0)) - 50)
+ + 0.1f * (int) (10 * rand() / (RAND_MAX + 1.0));
+}
+
+static void
+do_test (void)
+{
+ _Float16 x[32];
+ _Float16 y[32];
+ _Float16 res_add[32];
+ _Float16 res_sub[32];
+ _Float16 res_mul[32];
+ _Float16 res_div[32];
+ for (int i = 0 ; i != 32; i++)
+ {
+ x[i] = get_float16_noround ();
+ y[i] = get_float16_noround ();
+ if (y[i] == 0)
+ y[i] = 1.0f;
+ res_add[i] = x[i] + y[i];
+ res_sub[i] = x[i] - y[i];
+ res_mul[i] = x[i] * y[i];
+ res_div[i] = x[i] / y[i];
+
+ }
+
+ union512h u512 = { x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15],
+ x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23],
+ x[24], x[25], x[26], x[27], x[28], x[29], x[30], x[31] };
+ union512h u512_1 = {y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7],
+ y[8], y[9], y[10], y[11], y[12], y[13], y[14], y[15],
+ y[16], y[17], y[18], y[19], y[20], y[21], y[22], y[23],
+ y[24], y[25], y[26], y[27], y[28], y[29], y[30], y[31] };
+
+ __m512h v512;
+ union512h a512;
+
+ memset (&v512, -1, sizeof (v512));
+ v512 = vadd512 (u512.x, u512_1.x);
+ a512.x = v512;
+ if (check_union512h (a512, res_add))
+ abort ();
+ memset (&v512, -1, sizeof (v512));
+ v512 = vsub512 (u512.x, u512_1.x);
+ a512.x = v512;
+ if (check_union512h (a512, res_sub))
+ abort ();
+ memset (&v512, -1, sizeof (v512));
+ v512 = vmul512 (u512.x, u512_1.x);
+ a512.x = v512;
+ if (check_union512h (a512, res_mul))
+ abort ();
+ memset (&v512, -1, sizeof (v512));
+ v512 = vdiv512 (u512.x, u512_1.x);
+ a512.x = v512;
+ if (check_union512h (a512, res_div))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-12a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-12a.c
new file mode 100644
index 0000000..8888755
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-12a.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+_Float16
+__attribute__ ((noinline, noclone))
+do_max (_Float16 __A, _Float16 __B)
+{
+ return __A > __B ? __A : __B;
+}
+
+_Float16
+__attribute__ ((noinline, noclone))
+do_min (_Float16 __A, _Float16 __B)
+{
+ return __A < __B ? __A : __B;
+}
+
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]" 1 } } */
+/* { dg-final { scan-assembler-times "vminsh\[ \\t\]" 1 } } */
+/* { dg-final { scan-assembler-not "vmovsh\[ \\t\]" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "vcomish\[ \\t\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-12b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-12b.c
new file mode 100644
index 0000000..c9e23bf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-12b.c
@@ -0,0 +1,27 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-12a.c"
+
+static void
+do_test (void)
+{
+ _Float16 x = 0.1f;
+ _Float16 y = -3.2f;
+ _Float16 z;
+
+ z = do_max (x, y);
+ if (z != x)
+ abort ();
+
+ z = do_min (x, y);
+ if (z != y)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-1a.c
new file mode 100644
index 0000000..45c7bdd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-1a.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+typedef _Float16 __v8hf __attribute__ ((__vector_size__ (16)));
+typedef _Float16 __m128h __attribute__ ((__vector_size__ (16), __may_alias__));
+
+__m128h
+__attribute__ ((noinline, noclone))
+foo1 (_Float16 x)
+{
+ return __extension__ (__m128h)(__v8hf) { x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m128h
+__attribute__ ((noinline, noclone))
+foo2 (_Float16 *x)
+{
+ return __extension__ (__m128h)(__v8hf) { *x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 3 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 2 { target { ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-1b.c
new file mode 100644
index 0000000..7560c62
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-1b.c
@@ -0,0 +1,32 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-1a.c"
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union128h u = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ __m128h v;
+ union128h a;
+ memset (&v, -1, sizeof (v));
+ v = foo1 (x);
+ a.x = v;
+ if (check_union128h (a, u.a))
+ abort ();
+ x = 33.3;
+ u.a[0] = x;
+ memset (&v, -1, sizeof (v));
+ v = foo2 (&x);
+ a.x = v;
+ if (check_union128h (a, u.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-1c.c b/gcc/testsuite/gcc.target/i386/avx512fp16-1c.c
new file mode 100644
index 0000000..49fc2aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-1c.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "(?:vmovsh|vmovw)" 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpinsrw" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpinsrw" 2 { target { ia32 } } } } */
+
+typedef _Float16 __v8hf __attribute__ ((__vector_size__ (16)));
+typedef _Float16 __m128h __attribute__ ((__vector_size__ (16), __may_alias__));
+
+__m128h
+__attribute__ ((noinline, noclone))
+foo1 (__m128h a, _Float16 f)
+{
+ __v8hf x = (__v8hf) a;
+ x[2] = f;
+ return (__m128h) x;
+}
+
+__m128h
+__attribute__ ((noinline, noclone))
+foo2 (__m128h a, _Float16 f)
+{
+ __v8hf x = (__v8hf) a;
+ x[0] = f;
+ return (__m128h) x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-1d.c b/gcc/testsuite/gcc.target/i386/avx512fp16-1d.c
new file mode 100644
index 0000000..cdaf656
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-1d.c
@@ -0,0 +1,33 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-1c.c"
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union128h u = { -1.2f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
+ __m128h v;
+ union128h a, b;
+ v = foo1 (u.x, x);
+ a.x = v;
+ b = u;
+ b.a[2] = x;
+ if (check_union128h (a, b.a))
+ abort ();
+ x = 33.3;
+ b = u;
+ b.a[0] = x;
+ v = foo2 (u.x, x);
+ a.x = v;
+ if (check_union128h (a, b.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-1e.c b/gcc/testsuite/gcc.target/i386/avx512fp16-1e.c
new file mode 100644
index 0000000..04d33cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-1e.c
@@ -0,0 +1,30 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-1a.c"
+
+__m128h
+__attribute__ ((noinline,noclone))
+foo3 (__m128h x)
+{
+ return foo1(x[0]);
+}
+
+static void
+do_test (void)
+{
+ union128h u = { -1.2f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
+ union128h a, b = { -1.2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
+ __m128h v;
+ v = foo3 (u.x);
+ a.x = v;
+ if (check_union128h (a, b.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-2a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-2a.c
new file mode 100644
index 0000000..c03138f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-2a.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+typedef _Float16 __v16hf __attribute__ ((__vector_size__ (32)));
+typedef _Float16 __m256h __attribute__ ((__vector_size__ (32), __may_alias__));
+
+__m256h
+__attribute__ ((noinline, noclone))
+foo1 (_Float16 x)
+{
+ return __extension__ (__m256h)(__v16hf) { x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+foo2 (_Float16 *x)
+{
+ return __extension__ (__m256h)(__v16hf) { *x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 3 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 2 { target { ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-2b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-2b.c
new file mode 100644
index 0000000..100afd0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-2b.c
@@ -0,0 +1,33 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-2a.c"
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union256h u = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ __m256h v;
+ union256h a;
+ memset (&v, -1, sizeof (v));
+ v = foo1 (x);
+ a.x = v;
+ if (check_union256h (a, u.a))
+ abort ();
+ x = 33.3;
+ u.a[0] = x;
+ memset (&v, -1, sizeof (v));
+ v = foo2 (&x);
+ a.x = v;
+ if (check_union256h (a, u.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-2c.c b/gcc/testsuite/gcc.target/i386/avx512fp16-2c.c
new file mode 100644
index 0000000..cf4b42a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-2c.c
@@ -0,0 +1,36 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-2a.c"
+
+__m256h
+__attribute__ ((noinline,noclone))
+foo3 (__m256h x)
+{
+ return foo1(x[0]);
+}
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union256h u = { x, 3.5f, -5.9f, 0.0f, 0.0f, 0.0f, 7.7f, 0.0f,
+ 4.0f, -4.20f, 0.0f, 0.0f, 0.0f, -8.7f, 0.0f, 0.0f };
+
+ union256h exp = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ __m256h v;
+ union256h a;
+ memset (&v, -1, sizeof (v));
+ v = foo3 (u.x);
+ a.x = v;
+ if (check_union256h (a, exp.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-3a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-3a.c
new file mode 100644
index 0000000..126e7d9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-3a.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+typedef _Float16 __v32hf __attribute__ ((__vector_size__ (64)));
+typedef _Float16 __m512h __attribute__ ((__vector_size__ (64), __may_alias__));
+
+__m512h
+__attribute__ ((noinline, noclone))
+foo1 (_Float16 x)
+{
+ return __extension__ (__m512h)(__v32hf) { x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m512h
+__attribute__ ((noinline, noclone))
+foo2 (_Float16 *x)
+{
+ return __extension__ (__m512h)(__v32hf) { *x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 3 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 2 { target { ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-3b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-3b.c
new file mode 100644
index 0000000..291db06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-3b.c
@@ -0,0 +1,35 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-3a.c"
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union512h u = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ __m512h v;
+ union512h a;
+ memset (&v, -1, sizeof (v));
+ v = foo1 (x);
+ a.x = v;
+ if (check_union512h (a, u.a))
+ abort ();
+ x = 33.3;
+ u.a[0] = x;
+ memset (&v, -1, sizeof (v));
+ v = foo2 (&x);
+ a.x = v;
+ if (check_union512h (a, u.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-3c.c b/gcc/testsuite/gcc.target/i386/avx512fp16-3c.c
new file mode 100644
index 0000000..21f9e16
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-3c.c
@@ -0,0 +1,40 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-3a.c"
+
+__m512h
+__attribute__ ((noinline,noclone))
+foo3 (__m512h x)
+{
+ return foo1(x[0]);
+}
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union512h u = { x, 3.5f, -5.9f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 2.0f, -2.3f, 0.0f, 0.0f, 10.4f, 0.0f, 0.0f, 0.0f,
+ 3.0f, -3.2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 4.0f, -4.20f, 0.0f, 0.0f, 0.0f, -8.7f, 0.0f, 0.0f };
+
+ union512h exp = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ __m512h v;
+ union512h a;
+ memset (&v, -1, sizeof (v));
+ v = foo3 (u.x);
+ a.x = v;
+ if (check_union512h (a, exp.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-4.c b/gcc/testsuite/gcc.target/i386/avx512fp16-4.c
new file mode 100644
index 0000000..1329a04
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-4.c
@@ -0,0 +1,31 @@
+/* { dg-do assemble { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+typedef _Float16 __m256h __attribute__ ((__vector_size__ (32), __may_alias__));
+typedef _Float16 __m512h __attribute__ ((__vector_size__ (64), __may_alias__));
+typedef _Float16 __m128h __attribute__ ((__vector_size__ (16), __may_alias__));
+
+extern __m128h x128, y128;
+extern __m256h x256, y256;
+extern __m512h x512, y512;
+
+__m128h
+foo1 (float f1, __m128h f2)
+{
+ x128 = y128;
+ return f2;
+}
+
+__m256h
+foo2 (float f1, __m256h f2)
+{
+ x256 = y256;
+ return f2;
+}
+
+__m512h
+foo3 (float f1, __m512h f2)
+{
+ x512 = y512;
+ return f2;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-5.c b/gcc/testsuite/gcc.target/i386/avx512fp16-5.c
new file mode 100644
index 0000000..d28b965
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-5.c
@@ -0,0 +1,133 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+__m128h
+__attribute__ ((noinline, noclone))
+foo1 (_Float16 x)
+{
+ return __extension__ (__m128h)(__v8hf) { x, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m128h
+__attribute__ ((noinline, noclone))
+foo2 (_Float16 x, _Float16 y)
+{
+ return __extension__ (__m128h)(__v8hf) { x, 0.0f, 0.0f, y,
+ 3.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+foo3 (_Float16 x)
+{
+ return __extension__ (__m256h)(__v16hf) { x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+foo4 (_Float16 x, _Float16 y)
+{
+ return __extension__ (__m256h)(__v16hf) { x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, y,
+ 3.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m512h
+__attribute__ ((noinline, noclone))
+foo5 (_Float16 x)
+{
+ return __extension__ (__m512h)(__v32hf) { x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+__m512h
+__attribute__ ((noinline, noclone))
+foo6 (_Float16 x, _Float16 y)
+{
+ return __extension__ (__m512h)(__v32hf) { x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, y,
+ 3.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+}
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ _Float16 y = -35.7;
+ union128h u128 = { x, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };
+ union256h u256 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ union512h u512 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ __m128h v128;
+ __m256h v256;
+ __m512h v512;
+ union128h a128;
+ union256h a256;
+ union512h a512;
+
+ memset (&v128, -1, sizeof (v128));
+ v128 = foo1 (x);
+ a128.x = v128;
+ if (check_union128h (a128, u128.a))
+ abort ();
+ memset (&v128, -1, sizeof (v128));
+ u128.a[3] = y;
+ u128.a[4] = 3.0f;
+ v128 = foo2 (x, y);
+ a128.x = v128;
+ if (check_union128h (a128, u128.a))
+ abort ();
+
+ memset (&v256, -1, sizeof (v256));
+ v256 = foo3 (x);
+ a256.x = v256;
+ if (check_union256h (a256, u256.a))
+ abort ();
+ memset (&v256, -1, sizeof (v256));
+ u256.a[7] = y;
+ u256.a[8] = 3.0f;
+ v256 = foo4 (x, y);
+ a256.x = v256;
+ if (check_union256h (a256, u256.a))
+ abort ();
+
+ memset (&v512, -1, sizeof (v512));
+ v512 = foo5 (x);
+ a512.x = v512;
+ if (check_union512h (a512, u512.a))
+ abort ();
+ memset (&v512, -1, sizeof (v512));
+ u512.a[15] = y;
+ u512.a[16] = 3.0f;
+ v512 = foo6 (x, y);
+ a512.x = v512;
+ if (check_union512h (a512, u512.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-6.c b/gcc/testsuite/gcc.target/i386/avx512fp16-6.c
new file mode 100644
index 0000000..d85a6c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-6.c
@@ -0,0 +1,57 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+void
+__attribute__ ((noinline, noclone))
+foo128 (_Float16 *p, __m128h x)
+{
+ *p = ((__v8hf)x)[0];
+}
+
+void
+__attribute__ ((noinline, noclone))
+foo256 (_Float16 *p, __m256h x)
+{
+ *p = ((__v16hf)x)[0];
+}
+
+void
+__attribute__ ((noinline, noclone))
+foo512 (_Float16 *p, __m512h x)
+{
+ *p = ((__v32hf)x)[0];
+}
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union128h u128 = { x, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };
+ union256h u256 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ union512h u512 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ _Float16 y;
+
+ foo128 (&y, u128.x);
+ if (x != y)
+ abort ();
+
+ foo256 (&y, u256.x);
+ if (x != y)
+ abort ();
+
+ foo512 (&y, u512.x);
+ if (x != y)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-7.c b/gcc/testsuite/gcc.target/i386/avx512fp16-7.c
new file mode 100644
index 0000000..26ae25f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-7.c
@@ -0,0 +1,86 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+void
+__attribute__ ((noinline, noclone))
+foo128 (_Float16 *p, __m128h x)
+{
+ *p = ((__v8hf)x)[4];
+}
+
+void
+__attribute__ ((noinline, noclone))
+foo256 (_Float16 *p, __m256h x)
+{
+ *p = ((__v16hf)x)[10];
+}
+
+void
+__attribute__ ((noinline, noclone))
+foo512 (_Float16 *p, __m512h x)
+{
+ *p = ((__v32hf)x)[30];
+}
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union128h u128 = { 0.0f, x, 0.0f, 0.0f, x, 0.0f, 0.0f, x };
+ union256h u256 = { x, 0.0f, 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, x, 0.0f, 0.0f, x, 0.0f, 0.0f };
+ union512h u512 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, x, 0.0f, 0.0f, x, 0.0f };
+ __m128h v128 = _mm_setr_ph (0.0f, x, 0.0f, 0.0f,
+ x, 0.0f, 0.0f, x);
+ __m256h v256 = _mm256_setr_ph (x, 0.0f, 0.0f, 0.0f,
+ x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, x, 0.0f,
+ 0.0f, x, 0.0f, 0.0f);
+ __m512h v512 = _mm512_setr_ph (x, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, x, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, x, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, x,
+ 0.0f, 0.0f, x, 0.0f);
+ union128h a128;
+ union256h a256;
+ union512h a512;
+ _Float16 y;
+
+ a128.x = v128;
+ if (check_union128h (a128, u128.a))
+ abort ();
+
+ a256.x = v256;
+ if (check_union256h (a256, u256.a))
+ abort ();
+
+ a512.x = v512;
+ if (check_union512h (a512, u512.a))
+ abort ();
+
+ foo128 (&y, u128.x);
+ if (x != y)
+ abort ();
+
+ foo256 (&y, u256.x);
+ if (x != y)
+ abort ();
+
+ foo512 (&y, u512.x);
+ if (x != y)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-8.c b/gcc/testsuite/gcc.target/i386/avx512fp16-8.c
new file mode 100644
index 0000000..8f10375
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-8.c
@@ -0,0 +1,53 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+_Float16
+__attribute__ ((noinline, noclone))
+foo128 (__m128h x)
+{
+ return ((__v8hf)x)[4];
+}
+
+_Float16
+__attribute__ ((noinline, noclone))
+foo256 (__m256h x)
+{
+ return ((__v16hf)x)[10];
+}
+
+_Float16
+__attribute__ ((noinline, noclone))
+foo512 (__m512h x)
+{
+ return ((__v32hf)x)[30];
+}
+
+static void
+do_test (void)
+{
+ _Float16 x = 25.3;
+ union128h u128 = { 0.0f, 0.0f, 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f };
+ union256h u256 = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ union512h u512 = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, x, 0.0f };
+
+ if (foo128 (u128.x) != x)
+ abort ();
+
+ if (foo256 (u256.x) != x)
+ abort ();
+
+ if (foo512 (u512.x) != x)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-9a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-9a.c
new file mode 100644
index 0000000..580ffb5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-9a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <immintrin.h>
+
+__m128h
+__attribute__ ((noinline, noclone))
+set1_128 (_Float16 x)
+{
+ return _mm_set1_ph (x);
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+set1_256 (_Float16 x)
+{
+ return _mm256_set1_ph (x);
+}
+
+__m512h
+__attribute__ ((noinline, noclone))
+set1_512 (_Float16 x)
+{
+ return _mm512_set1_ph (x);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastw\[ \t]\+\[^\n\r]*\[xyz\]mm0" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-9b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-9b.c
new file mode 100644
index 0000000..198b23e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-9b.c
@@ -0,0 +1,49 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+#include <string.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512fp16-9a.c"
+
+union128h u128 = { ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16 };
+union256h u256 = { ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16 };
+union512h u512 = { ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
+ ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16 };
+
+static void
+do_test (void)
+{
+ __m128h v128 = set1_128 (ESP_FLOAT16);
+ __m256h v256 = set1_256 (ESP_FLOAT16);
+ __m512h v512 = set1_512 (ESP_FLOAT16);
+ union128h a128;
+ union256h a256;
+ union512h a512;
+
+ a128.x = v128;
+ if (check_union128h (a128, u128.a))
+ abort ();
+
+ a256.x = v256;
+ if (check_union256h (a256, u256.a))
+ abort ();
+
+ a512.x = v512;
+ if (check_union512h (a512, u512.a))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-helper.h b/gcc/testsuite/gcc.target/i386/avx512fp16-helper.h
new file mode 100644
index 0000000..5d3539b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-helper.h
@@ -0,0 +1,244 @@
+/* This file is used for emulation of avx512fp16 runtime tests. To
+ verify the correctness of _Float16 type calculation, the idea is
+ convert _Float16 to float and do emulation using float instructions.
+ _Float16 type should not be emulate or check by itself. */
+
+#include "avx512f-helper.h"
+#ifndef AVX512FP16_HELPER_INCLUDED
+#define AVX512FP16_HELPER_INCLUDED
+
+#ifdef DEBUG
+#include <string.h>
+#endif
+#include <math.h>
+#include <limits.h>
+#include <float.h>
+
+/* Useful macros. */
+#define NOINLINE __attribute__((noinline,noclone))
+#define _ROUND_NINT (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)
+#define AVX512F_MAX_ELEM 512 / 32
+
+/* Structure for _Float16 emulation */
+typedef union
+{
+ __m512 zmm;
+ __m512h zmmh;
+ __m256 ymm[2];
+ __m256h ymmh[2];
+ __m256i ymmi[2];
+ __m128h xmmh[4];
+ unsigned short u16[32];
+ unsigned int u32[16];
+ float f32[16];
+ _Float16 f16[32];
+} V512;
+
+/* Global variables. */
+V512 src1, src2, src3;
+int n_errs = 0;
+
+/* Helper function for packing/unpacking ph operands. */
+void NOINLINE
+unpack_ph_2twops(V512 src, V512 *op1, V512 *op2)
+{
+ V512 v1;
+
+ op1->zmm = _mm512_cvtph_ps(src.ymmi[0]);
+ v1.ymm[0] = _mm512_extractf32x8_ps(src.zmm, 1);
+ op2->zmm = _mm512_cvtph_ps(v1.ymmi[0]);
+}
+
+V512 NOINLINE
+pack_twops_2ph(V512 op1, V512 op2)
+{
+ V512 v1, v2, v3;
+
+ v1.ymmi[0] = _mm512_cvtps_ph(op1.zmm, _MM_FROUND_TO_NEAREST_INT);
+ v2.ymmi[0] = _mm512_cvtps_ph(op2.zmm, _MM_FROUND_TO_NEAREST_INT);
+
+ v3.zmm = _mm512_insertf32x8(v1.zmm, v2.ymm[0], 1);
+
+ return v3;
+}
+
+/* Helper function used for result debugging */
+#ifdef DEBUG
+void NOINLINE
+display_ps(const void *p, const char *banner, int n_elems)
+{
+ int i;
+ V512 *v = (V512*)p;
+
+ if (banner) {
+ printf("%s", banner);
+ }
+
+ for (i = 15; i >= n_elems; i--) {
+ printf(" --------");
+ if (i == 8) {
+ printf("\n");
+ if (banner) {
+ printf("%*s", (int)strlen(banner), "");
+ }
+ }
+ }
+
+ for (; i >= 0; i--) {
+ printf(" %x", v->u32[i]);
+ if (i == 8) {
+ printf("\n");
+ if (banner) {
+ printf("%*s", (int)strlen(banner), "");
+ }
+ }
+ }
+ printf("\n");
+}
+#endif
+
+/* Functions/macros used for init/result checking.
+ Only check components within AVX512F_LEN. */
+#define TO_STRING(x) #x
+#define STRINGIFY(x) TO_STRING(x)
+#define NAME_OF(NAME) STRINGIFY(INTRINSIC (NAME))
+
+#define CHECK_RESULT(res, exp, size, intrin) \
+ check_results ((void*)res, (void*)exp, size,\
+ NAME_OF(intrin))
+
+#define CHECK_RESULT_MASK(res, exp, size, intrin) \
+ check_results_mask ((__mmask32)res, (__mmask32)exp, size,\
+ NAME_OF(intrin))
+
+/* To evaluate whether result match _Float16 precision,
+ only the last bit of real/emulate result could be
+ different. */
+void NOINLINE
+check_results(void *got, void *exp, int n_elems, char *banner)
+{
+ int i;
+ V512 *v1 = (V512*)got;
+ V512 *v2 = (V512*)exp;
+
+ for (i = 0; i < n_elems; i++) {
+ if (v1->u16[i] != v2->u16[i] &&
+ ((v1->u16[i] > (v2->u16[i] + 1)) ||
+ (v1->u16[i] < (v2->u16[i] - 1)))) {
+
+#ifdef DEBUG
+ printf("ERROR: %s failed at %d'th element: %x(%f) != %x(%f)\n",
+ banner ? banner : "", i,
+ v1->u16[i], *(float *)(&v1->u16[i]),
+ v2->u16[i], *(float *)(&v2->u16[i]));
+ display_ps(got, "got:", n_elems);
+ display_ps(exp, "exp:", n_elems);
+#endif
+ n_errs++;
+ break;
+ }
+ }
+}
+
+void NOINLINE
+check_results_mask(__mmask32 got, __mmask32 exp, int n_elems, char *banner)
+{
+ if (got != exp) {
+#ifdef DEBUG
+ printf("ERROR: %s failed : got mask %x != exp mask %x\n",
+ banner ? banner : "", got, exp);
+#endif
+ n_errs++;
+ }
+}
+
+/* Functions for src/dest initialization */
+void NOINLINE
+init_src()
+{
+ V512 v1, v2, v3, v4;
+ int i;
+
+ for (i = 0; i < AVX512F_MAX_ELEM; i++) {
+ v1.f32[i] = -i + 1;
+ v2.f32[i] = i * 0.5f;
+ v3.f32[i] = i * 2.5f;
+ v4.f32[i] = i - 0.5f;
+
+ src3.u32[i] = (i + 1) * 10;
+ }
+
+ src1 = pack_twops_2ph(v1, v2);
+ src2 = pack_twops_2ph(v3, v4);
+}
+
+void NOINLINE
+init_src_nanf()
+{
+ V512 v1, v2, v3, v4;
+ int i;
+
+ for (i = 0; i < 16; i++) {
+ v1.f32[i] = i + 1 + 0.5;
+ v2.f32[i] = i + 17 + 0.5;
+ v3.f32[i] = i * 2 + 2 + 0.5;
+ v4.f32[i] = i * 2 + 34 + 0.5;
+
+ src3.u32[i] = (i + 1) * 10;
+ }
+
+ v1.f32[0] = __builtin_nanf("");
+ src1 = pack_twops_2ph(v1, v2);
+ src2 = pack_twops_2ph(v3, v4);
+}
+
+
+void NOINLINE
+init_dest(V512 * res, V512 * exp)
+{
+ int i;
+ V512 v1;
+
+ for (i = 0; i < AVX512F_MAX_ELEM; i++) {
+ v1.f32[i] = 12 + 0.5f * i;
+ }
+ *res = *exp = pack_twops_2ph(v1, v1);
+}
+
+#define EMULATE(NAME) EVAL(emulate_, NAME, AVX512F_LEN)
+
+#endif /* AVX512FP16_HELPER_INCLUDED */
+
+/* Macros for AVX512VL Testing. Include V512 component usage
+ and mask type for emulation. */
+
+#if AVX512F_LEN == 256
+#undef HF
+#undef SF
+#undef NET_MASK
+#undef MASK_VALUE
+#undef ZMASK_VALUE
+#define NET_MASK 0xffff
+#define MASK_VALUE 0xcccc
+#define ZMASK_VALUE 0xfcc1
+#define HF(x) x.ymmh[0]
+#define SF(x) x.ymm[0]
+#elif AVX512F_LEN == 128
+#undef HF
+#undef SF
+#undef NET_MASK
+#undef MASK_VALUE
+#undef ZMASK_VALUE
+#define NET_MASK 0xff
+#define MASK_VALUE 0xcc
+#define ZMASK_VALUE 0xc1
+#define HF(x) x.xmmh[0]
+#define SF(x) x.xmm[0]
+#else
+#define NET_MASK 0xffffffff
+#define MASK_VALUE 0xcccccccc
+#define ZMASK_VALUE 0xfcc1fcc1
+#define HF(x) x.zmmh
+#define SF(x) x.zmm
+#endif
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1a.c
new file mode 100644
index 0000000..0590c34
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1a.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+\{rz-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m512h res, res1, res2;
+volatile __m512h x1, x2;
+volatile __mmask32 m32;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm512_add_ph (x1, x2);
+ res1 = _mm512_mask_add_ph (res1, m32, x1, x2);
+ res2 = _mm512_maskz_add_ph (m32, x1, x2);
+
+ res = _mm512_add_round_ph (x1, x2, 8);
+ res1 = _mm512_mask_add_round_ph (res1, m32, x1, x2, 8);
+ res2 = _mm512_maskz_add_round_ph (m32, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1b.c
new file mode 100644
index 0000000..1c412b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddph-1b.c
@@ -0,0 +1,92 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS (AVX512F_LEN / 16)
+
+void NOINLINE
+EMULATE(add_ph) (V512 * dest, V512 op1, V512 op2,
+ __mmask32 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+ __mmask16 m1, m2;
+
+ m1 = k & 0xffff;
+ m2 = (k >> 16) & 0xffff;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ for (i = 0; i < 16; i++) {
+ if (((1 << i) & m1) == 0) {
+ if (zero_mask) {
+ v5.f32[i] = 0;
+ }
+ else {
+ v5.u32[i] = v7.u32[i];
+ }
+ }
+ else {
+ v5.f32[i] = v1.f32[i] + v3.f32[i];
+ }
+
+ if (((1 << i) & m2) == 0) {
+ if (zero_mask) {
+ v6.f32[i] = 0;
+ }
+ else {
+ v6.u32[i] = v8.u32[i];
+ }
+ }
+ else {
+ v6.f32[i] = v2.f32[i] + v4.f32[i];
+ }
+
+ }
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+TEST (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ EMULATE(add_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_add_ph) (HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _add_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(add_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_add_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_add_ph);
+
+ EMULATE(add_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_add_ph) (ZMASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_add_ph);
+
+#if AVX512F_LEN == 512
+ EMULATE(add_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_add_round_ph) (HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _add_round_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(add_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_add_round_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_add_round_ph);
+
+ EMULATE(add_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_add_round_ph) (ZMASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_add_round_ph);
+#endif
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1a.c
new file mode 100644
index 0000000..97aac3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vaddsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddsh\[ \\t\]+\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res;
+volatile __m128h x1, x2;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_add_sh (x1, x2);
+ res = _mm_mask_add_sh (res, m8, x1, x2);
+ res = _mm_maskz_add_sh (m8, x1, x2);
+
+ res = _mm_add_round_sh (x1, x2, 8);
+ res = _mm_mask_add_round_sh (res, m8, x1, x2, 8);
+ res = _mm_maskz_add_round_sh (m8, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1b.c
new file mode 100644
index 0000000..724112c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vaddsh-1b.c
@@ -0,0 +1,104 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_add_sh(V512 * dest, V512 op1, V512 op2,
+ __mmask8 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ if ((k&1) || !k)
+ v5.f32[0] = v1.f32[0] + v3.f32[0];
+ else if (zero_mask)
+ v5.f32[0] = 0;
+ else
+ v5.f32[0] = v7.f32[0];
+
+ for (i = 1; i < 8; i++)
+ v5.f32[i] = v1.f32[i];
+
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ emulate_add_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_add_sh(src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_add_sh");
+
+ //DEST.fp16[0] := SRC1.fp16[0] + SRC2.fp16[0]
+ emulate_add_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_add_sh(res.xmmh[0], 0x1,
+ src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_add_sh");
+
+ //dest.fp16[0] remains unchanged
+ init_dest(&res, &exp);
+ emulate_add_sh(&exp, src1, src2, 0x2, 0);
+ res.xmmh[0] = _mm_mask_add_sh(res.xmmh[0], 0x2,
+ src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_add_sh");
+
+ //dest.fp16[0] = 0
+ emulate_add_sh(&exp, src1, src2, 0x2, 1);
+ res.xmmh[0] = _mm_maskz_add_sh(0x2, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_add_sh");
+
+ //DEST.fp16[0] := SRC1.fp16[0] + SRC2.fp16[0]
+ emulate_add_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_add_sh(0x3, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_add_sh");
+
+ //DEST.fp16[0] := SRC1.fp16[0] + SRC2.fp16[0]
+ emulate_add_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_add_round_sh(src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_add_round_sh");
+
+ //DEST.fp16[0] := SRC1.fp16[0] + SRC2.fp16[0]
+ emulate_add_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_add_round_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_add_round_sh");
+
+ //dest.fp16[0] remains unchanged
+ init_dest(&res, &exp);
+ emulate_add_sh(&exp, src1, src2, 0x2, 0);
+ res.xmmh[0] = _mm_mask_add_round_sh(res.xmmh[0], 0x2, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_add_round_sh");
+
+ //dest.fp16[0] = 0
+ emulate_add_sh(&exp, src1, src2, 0x2, 1);
+ res.xmmh[0] = _mm_maskz_add_round_sh(0x2, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_add_round_sh");
+
+ //DEST.fp16[0] := SRC1.fp16[0] + SRC2.fp16[0]
+ emulate_add_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_add_round_sh(0x3, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_add_round_sh");
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-1.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-1.c
new file mode 100644
index 0000000..9bd3668
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-1.c
@@ -0,0 +1,122 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512fp16 } */
+/* { dg-options "-mavx512fp16" } */
+
+#include <stdarg.h>
+#include <assert.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+struct m256h
+{
+ __m256h v;
+};
+
+__m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
+struct m256h n2 = { { -93.83f16, 893.318f16, 3994.3f16, -39484.0f16, 213.4f16, 323.4f16, 42.5f16, -43.4f16,
+ 234.4f16, 93.9f16, 34.5f16, -14.5f16, -34.9f16, -421.0f16, 234.5f16, 214.5f16 } };
+__m128h n3 = { 11.5f16, -31.80f16, 242.3f16, 136.4f16, 42.8f16, -22.8f16, 343.8f16, 215.4f16 } ;
+_Float16 n4 = 32.4f16;
+double n5 = 103.3;
+__m128h n6 = { -12.3f16, 2.0f16, 245.9f16, -432.1f16, 53.5f16, -13.4f16, 432.5f16, 482.4f16 };
+__m128d n7 = { -91.387, -8193.518 };
+struct m256h n8 = { { -93.83f16, 893.318f16, 3994.3f16, -39484.0f16, 213.4f16, 323.4f16, 42.5f16, -43.4f16,
+ 234.4f16, 93.9f16, 34.5f16, -14.5f16, -34.9f16, -421.0f16, 234.5f16, 214.5f16 } };
+__m128 n9 = { -123.3, 2.3, 3.4, -10.03 };
+__m128h n10 = { 123.3f16, -100.0f16, 246.9f16, 13.4f16, -134.4f16, 35.4f16, 156.5f16, 953.1f16 };
+_Float16 n11 = 40.7f16;
+double n12 = 304.9;
+__m128h n13 = { 23.3f16, -11.0f16, 24.5f16, -24.5f16, 535.4f16, 35.4f16, -13.4f16, 14.5f16 };
+__m256h n14 = { -123.3f16, 23.9f16, 34.4f16, -100.3f16, 284.4f16, 352.5f16, 131.5f16, -13.2f16,
+ 131.4f16, 382.5f16, 38.5f16, 99.6f16, 423.2f16, -12.44f16, 43.2f16, -34.45f16 };
+__m512h n15 = { -39.3f16, -180.9f16, 13.4f16, 35.4f16, -41.1f16, -14.4f16, 24.5f16, 53.54f16,
+ 238.4f16, -134.8f16, 24.5f16, 35.6f16, -346.7f16, -43.4f16, -535.3f16, 324.7f16,
+ 82.5f16, 21.4f16, 24.4f16, 53.4f16, 23.5f16, -24.4f16, -34.5f16, -32.5f16,
+ 23.6f16, -13.4f16, 24.5f16, 35.5f16, -34.4f16, -24.5f16, -34.5f16, 13.5f16 };
+__m128d n16 = { 73.0, 63.18 };
+__m256 n17 = { -183.3, -22.3, 13.9, -119.3, 483.1, 122.3, -33.4, -9.37 };
+__m128 n18 = { -183.3, 22.3, 13.4, -19.03 };
+
+__m128 e1;
+struct m256h e2;
+__m128h e3;
+_Float16 e4;
+double e5;
+__m128h e6;
+__m128d e7;
+struct m256h e8;
+__m128 e9;
+__m128h e10;
+_Float16 e11;
+double e12;
+__m128h e13;
+__m256h e14;
+__m512h e15;
+__m128d e16;
+__m256 e17;
+__m128 e18;
+
+static void
+__attribute__((noinline))
+foo (va_list va_arglist)
+{
+ e4 = va_arg (va_arglist, _Float16);
+ e5 = va_arg (va_arglist, double);
+ e6 = va_arg (va_arglist, __m128h);
+ e7 = va_arg (va_arglist, __m128d);
+ e8 = va_arg (va_arglist, struct m256h);
+ e9 = va_arg (va_arglist, __m128);
+ e10 = va_arg (va_arglist, __m128h);
+ e11 = va_arg (va_arglist, _Float16);
+ e12 = va_arg (va_arglist, double);
+ e13 = va_arg (va_arglist, __m128h);
+ e14 = va_arg (va_arglist, __m256h);
+ e15 = va_arg (va_arglist, __m512h);
+ e16 = va_arg (va_arglist, __m128d);
+ e17 = va_arg (va_arglist, __m256);
+ e18 = va_arg (va_arglist, __m128);
+ va_end (va_arglist);
+}
+
+static void
+__attribute__((noinline))
+test (__m128 a1, struct m256h a2, __m128h a3, ...)
+{
+ va_list va_arglist;
+
+ e1 = a1;
+ e2 = a2;
+ e3 = a3;
+ va_start (va_arglist, a3);
+ foo (va_arglist);
+ va_end (va_arglist);
+}
+
+static void
+do_test (void)
+{
+ test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12,
+ n13, n14, n15, n16, n17, n18);
+ assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
+ assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
+ assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
+ assert (n4 == e4);
+ assert (n5 == e5);
+ assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
+ assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
+ assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
+ assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
+ assert (__builtin_memcmp (&e10, &n10, sizeof (e10)) == 0);
+ assert (n11 == e11);
+ assert (n12 == e12);
+ assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
+ assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
+ assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);
+ assert (__builtin_memcmp (&e16, &n16, sizeof (e16)) == 0);
+ assert (__builtin_memcmp (&e17, &n17, sizeof (e17)) == 0);
+ assert (__builtin_memcmp (&e18, &n18, sizeof (e18)) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-2.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-2.c
new file mode 100644
index 0000000..043f1c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-2.c
@@ -0,0 +1,107 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512fp16 } */
+/* { dg-options "-mavx512fp16" } */
+
+#include <stdarg.h>
+#include <assert.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+__m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
+__m256d n2 = { -93.83, 893.318, 3994.3, -39484.0 };
+__m128h n3 = { 11.5f16, -31.80f16, 242.3f16, 136.4f16, 42.8f16, -22.8f16, 343.8f16, 215.4f16 } ;
+_Float16 n4 = 32.4f16;
+double n5 = 103.3;
+__m128h n6 = { -12.3f16, 2.0f16, 245.9f16, -432.1f16, 53.5f16, -13.4f16, 432.5f16, 482.4f16 };
+__m128d n7 = { -91.387, -8193.518 };
+__m256d n8 = { -123.3, 2.3, 3.4, -10.03 };
+__m128 n9 = { -123.3, 2.3, 3.4, -10.03 };
+__m128h n10 = { 123.3f16, -100.0f16, 246.9f16, 13.4f16, -134.4f16, 35.4f16, 156.5f16, 953.1f16 };
+_Float16 n11 = 40.7f16;
+double n12 = 304.9;
+__m128h n13 = { 23.3f16, -11.0f16, 24.5f16, -24.5f16, 535.4f16, 35.4f16, -13.4f16, 14.5f16 };
+__m256h n14 = { -123.3f16, 23.9f16, 34.4f16, -100.3f16, 284.4f16, 352.5f16, 131.5f16, -13.2f16,
+ 131.4f16, 382.5f16, 38.5f16, 99.6f16, 423.2f16, -12.44f16, 43.2f16, -34.45f16 };
+__m512h n15 = { -39.3f16, -180.9f16, 13.4f16, 35.4f16, -41.1f16, -14.4f16, 24.5f16, 53.54f16,
+ 238.4f16, -134.8f16, 24.5f16, 35.6f16, -346.7f16, -43.4f16, -535.3f16, 324.7f16,
+ 82.5f16, 21.4f16, 24.4f16, 53.4f16, 23.5f16, -24.4f16, -34.5f16, -32.5f16,
+ 23.6f16, -13.4f16, 24.5f16, 35.5f16, -34.4f16, -24.5f16, -34.5f16, 13.5f16 };
+__m128d n16 = { 73.0, 63.18 };
+__m256 n17 = { -183.3, -22.3, 13.9, -119.3, 483.1, 122.3, -33.4, -9.37 };
+__m128 n18 = { -183.3, 22.3, 13.4, -19.03 };
+
+__m128 e1;
+__m256d e2;
+__m128h e3;
+_Float16 e4;
+double e5;
+__m128h e6;
+__m128d e7;
+__m256d e8;
+__m128 e9;
+__m128h e10;
+_Float16 e11;
+double e12;
+__m128h e13;
+__m256h e14;
+__m512h e15;
+__m128d e16;
+__m256 e17;
+__m128 e18;
+
+static void
+__attribute__((noinline))
+test (__m128 a1, __m256d a2, __m128h a3, ...)
+{
+ va_list va_arglist;
+
+ e1 = a1;
+ e2 = a2;
+ e3 = a3;
+ va_start (va_arglist, a3);
+ e4 = va_arg (va_arglist, _Float16);
+ e5 = va_arg (va_arglist, double);
+ e6 = va_arg (va_arglist, __m128h);
+ e7 = va_arg (va_arglist, __m128d);
+ e8 = va_arg (va_arglist, __m256d);
+ e9 = va_arg (va_arglist, __m128);
+ e10 = va_arg (va_arglist, __m128h);
+ e11 = va_arg (va_arglist, _Float16);
+ e12 = va_arg (va_arglist, double);
+ e13 = va_arg (va_arglist, __m128h);
+ e14 = va_arg (va_arglist, __m256h);
+ e15 = va_arg (va_arglist, __m512h);
+ e16 = va_arg (va_arglist, __m128d);
+ e17 = va_arg (va_arglist, __m256);
+ e18 = va_arg (va_arglist, __m128);
+ va_end (va_arglist);
+}
+
+static void
+do_test (void)
+{
+ test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12,
+ n13, n14, n15, n16, n17, n18);
+ assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
+ assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
+ assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
+ assert (n4 == e4);
+ assert (n5 == e5);
+ assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
+ assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
+ assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
+ assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
+ assert (__builtin_memcmp (&e10, &n10, sizeof (e10)) == 0);
+ assert (n11 == e11);
+ assert (n12 == e12);
+ assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
+ assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
+ assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);
+ assert (__builtin_memcmp (&e16, &n16, sizeof (e16)) == 0);
+ assert (__builtin_memcmp (&e17, &n17, sizeof (e17)) == 0);
+ assert (__builtin_memcmp (&e18, &n18, sizeof (e18)) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-3.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-3.c
new file mode 100644
index 0000000..cb414a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-3.c
@@ -0,0 +1,114 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512fp16 } */
+/* { dg-options "-mavx512fp16" } */
+
+#include <stdarg.h>
+#include <assert.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+struct m256h
+{
+ __m256h v;
+};
+
+__m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
+struct m256h n2 = { { -93.83f16, 893.318f16, 3994.3f16, -39484.0f16, 213.4f16, 323.4f16, 42.5f16, -43.4f16,
+ 234.4f16, 93.9f16, 34.5f16, -14.5f16, -34.9f16, -421.0f16, 234.5f16, 214.5f16 } };
+__m128h n3 = { 11.5f16, -31.80f16, 242.3f16, 136.4f16, 42.8f16, -22.8f16, 343.8f16, 215.4f16 } ;
+_Float16 n4 = 32.4f16;
+double n5 = 103.3;
+__m128h n6 = { -12.3f16, 2.0f16, 245.9f16, -432.1f16, 53.5f16, -13.4f16, 432.5f16, 482.4f16 };
+__m128d n7 = { -91.387, -8193.518 };
+struct m256h n8 = { { -93.83f16, 893.318f16, 3994.3f16, -39484.0f16, 213.4f16, 323.4f16, 42.5f16, -43.4f16,
+ 234.4f16, 93.9f16, 34.5f16, -14.5f16, -34.9f16, -421.0f16, 234.5f16, 214.5f16 } };
+__m128 n9 = { -123.3, 2.3, 3.4, -10.03 };
+__m128h n10 = { 123.3f16, -100.0f16, 246.9f16, 13.4f16, -134.4f16, 35.4f16, 156.5f16, 953.1f16 };
+_Float16 n11 = 40.7f16;
+double n12 = 304.9;
+__m128h n13 = { 23.3f16, -11.0f16, 24.5f16, -24.5f16, 535.4f16, 35.4f16, -13.4f16, 14.5f16 };
+__m256h n14 = { -123.3f16, 23.9f16, 34.4f16, -100.3f16, 284.4f16, 352.5f16, 131.5f16, -13.2f16,
+ 131.4f16, 382.5f16, 38.5f16, 99.6f16, 423.2f16, -12.44f16, 43.2f16, -34.45f16 };
+__m512h n15 = { -39.3f16, -180.9f16, 13.4f16, 35.4f16, -41.1f16, -14.4f16, 24.5f16, 53.54f16,
+ 238.4f16, -134.8f16, 24.5f16, 35.6f16, -346.7f16, -43.4f16, -535.3f16, 324.7f16,
+ 82.5f16, 21.4f16, 24.4f16, 53.4f16, 23.5f16, -24.4f16, -34.5f16, -32.5f16,
+ 23.6f16, -13.4f16, 24.5f16, 35.5f16, -34.4f16, -24.5f16, -34.5f16, 13.5f16 };
+__m128d n16 = { 73.0, 63.18 };
+__m256 n17 = { -183.3, -22.3, 13.9, -119.3, 483.1, 122.3, -33.4, -9.37 };
+__m128 n18 = { -183.3, 22.3, 13.4, -19.03 };
+
+__m128 e1;
+struct m256h e2;
+__m128h e3;
+_Float16 e4;
+double e5;
+__m128h e6;
+__m128d e7;
+struct m256h e8;
+__m128 e9;
+__m128h e10;
+_Float16 e11;
+double e12;
+__m128h e13;
+__m256h e14;
+__m512h e15;
+__m128d e16;
+__m256 e17;
+__m128 e18;
+
+static void
+__attribute__((noinline))
+test (__m128 a1, struct m256h a2, __m128h a3, ...)
+{
+ va_list va_arglist;
+
+ e1 = a1;
+ e2 = a2;
+ e3 = a3;
+ va_start (va_arglist, a3);
+ e4 = va_arg (va_arglist, _Float16);
+ e5 = va_arg (va_arglist, double);
+ e6 = va_arg (va_arglist, __m128h);
+ e7 = va_arg (va_arglist, __m128d);
+ e8 = va_arg (va_arglist, struct m256h);
+ e9 = va_arg (va_arglist, __m128);
+ e10 = va_arg (va_arglist, __m128h);
+ e11 = va_arg (va_arglist, _Float16);
+ e12 = va_arg (va_arglist, double);
+ e13 = va_arg (va_arglist, __m128h);
+ e14 = va_arg (va_arglist, __m256h);
+ e15 = va_arg (va_arglist, __m512h);
+ e16 = va_arg (va_arglist, __m128d);
+ e17 = va_arg (va_arglist, __m256);
+ e18 = va_arg (va_arglist, __m128);
+ va_end (va_arglist);
+}
+
+static void
+do_test (void)
+{
+ test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12,
+ n13, n14, n15, n16, n17, n18);
+ assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
+ assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
+ assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
+ assert (n4 == e4);
+ assert (n5 == e5);
+ assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
+ assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
+ assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
+ assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
+ assert (__builtin_memcmp (&e10, &n10, sizeof (e10)) == 0);
+ assert (n11 == e11);
+ assert (n12 == e12);
+ assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
+ assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
+ assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);
+ assert (__builtin_memcmp (&e16, &n16, sizeof (e16)) == 0);
+ assert (__builtin_memcmp (&e17, &n17, sizeof (e17)) == 0);
+ assert (__builtin_memcmp (&e18, &n18, sizeof (e18)) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-4.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-4.c
new file mode 100644
index 0000000..962c2bf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vararg-4.c
@@ -0,0 +1,115 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx512fp16 } */
+/* { dg-options "-mavx512fp16" } */
+
+#include <stdarg.h>
+#include <assert.h>
+
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+
+__m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
+__m256d n2 = { -93.83, 893.318, 3994.3, -39484.0 };
+__m128h n3 = { 11.5f16, -31.80f16, 242.3f16, 136.4f16, 42.8f16, -22.8f16, 343.8f16, 215.4f16 } ;
+_Float16 n4 = 32.4f16;
+double n5 = 103.3;
+__m128h n6 = { -12.3f16, 2.0f16, 245.9f16, -432.1f16, 53.5f16, -13.4f16, 432.5f16, 482.4f16 };
+__m128d n7 = { -91.387, -8193.518 };
+__m256d n8 = { -123.3, 2.3, 3.4, -10.03 };
+__m128 n9 = { -123.3, 2.3, 3.4, -10.03 };
+__m128h n10 = { 123.3f16, -100.0f16, 246.9f16, 13.4f16, -134.4f16, 35.4f16, 156.5f16, 953.1f16 };
+_Float16 n11 = 40.7f16;
+double n12 = 304.9;
+__m128h n13 = { 23.3f16, -11.0f16, 24.5f16, -24.5f16, 535.4f16, 35.4f16, -13.4f16, 14.5f16 };
+__m256h n14 = { -123.3f16, 23.9f16, 34.4f16, -100.3f16, 284.4f16, 352.5f16, 131.5f16, -13.2f16,
+ 131.4f16, 382.5f16, 38.5f16, 99.6f16, 423.2f16, -12.44f16, 43.2f16, -34.45f16 };
+__m512h n15 = { -39.3f16, -180.9f16, 13.4f16, 35.4f16, -41.1f16, -14.4f16, 24.5f16, 53.54f16,
+ 238.4f16, -134.8f16, 24.5f16, 35.6f16, -346.7f16, -43.4f16, -535.3f16, 324.7f16,
+ 82.5f16, 21.4f16, 24.4f16, 53.4f16, 23.5f16, -24.4f16, -34.5f16, -32.5f16,
+ 23.6f16, -13.4f16, 24.5f16, 35.5f16, -34.4f16, -24.5f16, -34.5f16, 13.5f16 };
+__m128d n16 = { 73.0, 63.18 };
+__m256 n17 = { -183.3, -22.3, 13.9, -119.3, 483.1, 122.3, -33.4, -9.37 };
+__m128 n18 = { -183.3, 22.3, 13.4, -19.03 };
+
+__m128 e1;
+__m256d e2;
+__m128h e3;
+_Float16 e4;
+double e5;
+__m128h e6;
+__m128d e7;
+__m256d e8;
+__m128 e9;
+__m128h e10;
+_Float16 e11;
+double e12;
+__m128h e13;
+__m256h e14;
+__m512h e15;
+__m128d e16;
+__m256 e17;
+__m128 e18;
+
+static void
+__attribute__((noinline))
+foo (va_list va_arglist)
+{
+ e4 = va_arg (va_arglist, _Float16);
+ e5 = va_arg (va_arglist, double);
+ e6 = va_arg (va_arglist, __m128h);
+ e7 = va_arg (va_arglist, __m128d);
+ e8 = va_arg (va_arglist, __m256d);
+ e9 = va_arg (va_arglist, __m128);
+ e10 = va_arg (va_arglist, __m128h);
+ e11 = va_arg (va_arglist, _Float16);
+ e12 = va_arg (va_arglist, double);
+ e13 = va_arg (va_arglist, __m128h);
+ e14 = va_arg (va_arglist, __m256h);
+ e15 = va_arg (va_arglist, __m512h);
+ e16 = va_arg (va_arglist, __m128d);
+ e17 = va_arg (va_arglist, __m256);
+ e18 = va_arg (va_arglist, __m128);
+ va_end (va_arglist);
+}
+
+static void
+__attribute__((noinline))
+test (__m128 a1, __m256d a2, __m128h a3, ...)
+{
+ va_list va_arglist;
+
+ e1 = a1;
+ e2 = a2;
+ e3 = a3;
+ va_start (va_arglist, a3);
+ foo (va_arglist);
+ va_end (va_arglist);
+}
+
+static void
+do_test (void)
+{
+ test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12,
+ n13, n14, n15, n16, n17, n18);
+ assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
+ assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
+ assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
+ assert (n4 == e4);
+ assert (n5 == e5);
+ assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
+ assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
+ assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
+ assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
+ assert (__builtin_memcmp (&e10, &n10, sizeof (e10)) == 0);
+ assert (n11 == e11);
+ assert (n12 == e12);
+ assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
+ assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
+ assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);
+ assert (__builtin_memcmp (&e16, &n16, sizeof (e16)) == 0);
+ assert (__builtin_memcmp (&e17, &n17, sizeof (e17)) == 0);
+ assert (__builtin_memcmp (&e18, &n18, sizeof (e18)) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1a.c
new file mode 100644
index 0000000..6425c46
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1a.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\\\$1\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%k\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\\\$2\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%k\[0-9\]\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\\\$3\[^\n\r]*\{sae\}\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\[^\{\n\]*\\\$4\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%k\[0-9\]\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __mmask32 res, res1, res2;
+volatile __m512h x1, x2;
+volatile __mmask32 m32;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm512_cmp_ph_mask (x1, x2, 1);
+ res1 = _mm512_mask_cmp_ph_mask (m32, x1, x2, 2);
+ res = _mm512_cmp_round_ph_mask (x1, x2, 3, 8);
+ res1 = _mm512_mask_cmp_round_ph_mask (m32, x1, x2, 4, 4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1b.c
new file mode 100644
index 0000000..ec5eccf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpph-1b.c
@@ -0,0 +1,70 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS (AVX512F_LEN / 16)
+
+__mmask32 NOINLINE
+EMULATE(cmp_ph) (V512 op1, V512 op2,
+ __mmask32 k, int predicate)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i, j;
+ __mmask16 mr1 = 0, mr2 = 0;
+ __mmask16 m1, m2;
+ __mmask32 mr = 0;
+
+ m1 = k & 0xffff;
+ m2 = (k >> 16) & 0xffff;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+
+ for (i = 0; i < 16; i++) {
+ if (((1 << i) & m1) != 0) {
+ j = v1.f32[i] == v3.f32[i] ? 1 : 0;
+ mr1 = mr1 | (j << i);
+ }
+
+ if (((1 << i) & m2) != 0) {
+ j = v2.f32[i] == v4.f32[i] ? 1 : 0;
+ mr2 = mr2 | (j << i);
+ }
+ }
+
+ mr = mr1 | (mr2 << 16);
+ return mr;
+}
+
+void
+TEST (void)
+{
+ __mmask32 res, exp;
+
+ init_src();
+
+ exp = EMULATE(cmp_ph) (src1, src2, NET_MASK, 0);
+ res = INTRINSIC (_cmp_ph_mask) (HF(src1), HF(src2), 0);
+ CHECK_RESULT_MASK (res, exp, N_ELEMS, _cmp_ph_mask);
+
+ exp = EMULATE(cmp_ph) (src1, src2, MASK_VALUE, 0);
+ res = INTRINSIC (_mask_cmp_ph_mask) (MASK_VALUE, HF(src1), HF(src2), 0);
+ CHECK_RESULT_MASK (res, exp, N_ELEMS, _mask_cmp_ph_mask);
+
+#if AVX512F_LEN == 512
+ exp = EMULATE(cmp_ph) (src1, src2, NET_MASK, 0);
+ res = INTRINSIC (_cmp_round_ph_mask) (HF(src1), HF(src2), 0, 8);
+ CHECK_RESULT_MASK (res, exp, N_ELEMS, _cmp_round_ph_mask);
+
+ exp = EMULATE(cmp_ph) (src1, src2, MASK_VALUE, 0);
+ res = INTRINSIC (_mask_cmp_round_ph_mask) (MASK_VALUE, HF(src1), HF(src2), 0, 8);
+ CHECK_RESULT_MASK (res, exp, N_ELEMS, _mask_cmp_round_ph_mask);
+#endif
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1a.c
new file mode 100644
index 0000000..5cce097
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1a.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$3\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\[^\{\n\]*\\\$4\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$3\[^\n\r]*\{sae\}\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\[^\{\n\]*\\\$4\[^\n\r]*\{sae\}\[^\n\r\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __mmask8 res, res1, res2;
+volatile __m128h x1, x2;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_cmp_sh_mask (x1, x2, 3);
+ res = _mm_mask_cmp_sh_mask (m8, x1, x2, 4);
+ res = _mm_cmp_round_sh_mask (x1, x2, 3, 8);
+ res1 = _mm_mask_cmp_round_sh_mask (m8, x1, x2, 4, 8);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1b.c
new file mode 100644
index 0000000..9deae52
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcmpsh-1b.c
@@ -0,0 +1,45 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+__mmask8 NOINLINE
+emulate_cmp_sh(V512 op1, V512 op2,
+ __mmask8 k, int predicate)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ __mmask8 mr = 0;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+
+ if ((k&1) || !k)
+ mr = v1.f32[0] == v3.f32[0] ? 1 : 0;
+
+ return mr;
+}
+
+void
+test_512 (void)
+{
+ __mmask8 res, exp;
+
+ init_src();
+
+ exp = emulate_cmp_sh(src1, src2, 0x1, 0);
+ res = _mm_cmp_round_sh_mask(src1.xmmh[0], src2.xmmh[0], 0, 8);
+ check_results_mask(res, exp, 1, "_mm_cmp_round_sh_mask");
+
+ exp = emulate_cmp_sh(src1, src2, 0x1, 0);
+ res = _mm_mask_cmp_round_sh_mask(0x1, src1.xmmh[0], src2.xmmh[0], 0, 8);
+ check_results_mask(res, exp, 1, "_mm_mask_cmp_round_sh_mask");
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1a.c
new file mode 100644
index 0000000..b87ffd9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1a.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$3\[^\n\r]*\{sae\}\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$7\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$16\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$1\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$2\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$14\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$13\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$20\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$0\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$17\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$18\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$30\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$29\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpsh\[ \\t\]+\\\$4\[^\n\r0-9]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h x, y;
+volatile int res;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_comi_round_sh (x, y, 3, 8);
+ res = _mm_comi_sh (x, y, 7);
+ res = _mm_comieq_sh (x, y);
+ res = _mm_comilt_sh (x, y);
+ res = _mm_comile_sh (x, y);
+ res = _mm_comigt_sh (x, y);
+ res = _mm_comige_sh (x, y);
+ res = _mm_comineq_sh (x, y);
+ res = _mm_ucomieq_sh (x, y);
+ res = _mm_ucomilt_sh (x, y);
+ res = _mm_ucomile_sh (x, y);
+ res = _mm_ucomigt_sh (x, y);
+ res = _mm_ucomige_sh (x, y);
+ res = _mm_ucomineq_sh (x, y);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1b.c
new file mode 100644
index 0000000..8c39800
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1b.c
@@ -0,0 +1,66 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+
+#define CMP(imm, rel) \
+ dst_ref = 0; \
+ dst_ref = ((int) rel) | dst_ref; \
+ dst = _mm_comi_round_sh(src1.xmmh[0], src2.xmmh[0], imm, \
+ _MM_FROUND_NO_EXC); \
+ if (dst_ref != dst) abort(); \
+
+void
+test_512 (void)
+{
+ V512 v1,v2,v3,v4;
+ float s1,s2;
+ int res,exp,dst;
+ __mmask8 dst_ref;
+
+ init_src();
+ unpack_ph_2twops(src1, &v1, &v2);
+ unpack_ph_2twops(src2, &v3, &v4);
+ s1 = v1.f32[0];
+ s2 = v3.f32[0];
+
+ CMP(_CMP_EQ_OQ, !isunordered(s1, s2) && s1 == s2);
+ CMP(_CMP_LT_OS, !isunordered(s1, s2) && s1 < s2);
+ CMP(_CMP_LE_OS, !isunordered(s1, s2) && s1 <= s2);
+ CMP(_CMP_UNORD_Q, isunordered(s1, s2));
+ CMP(_CMP_NEQ_UQ, isunordered(s1, s2) || s1 != s2);
+ CMP(_CMP_NLT_US, isunordered(s1, s2) || s1 >= s2);
+ CMP(_CMP_NLE_US, isunordered(s1, s2) || s1 > s2);
+ CMP(_CMP_ORD_Q, !isunordered(s1, s2));
+
+ CMP(_CMP_EQ_UQ, isunordered(s1, s2) || s1 == s2);
+ CMP(_CMP_NGE_US, isunordered(s1, s2) || s1 < s2);
+ CMP(_CMP_NGT_US, isunordered(s1, s2) || s1 <= s2);
+
+ CMP(_CMP_FALSE_OQ, 0);
+ CMP(_CMP_NEQ_OQ, !isunordered(s1, s2) && s1 != s2);
+ CMP(_CMP_GE_OS, !isunordered(s1, s2) && s1 >= s2);
+ CMP(_CMP_GT_OS, !isunordered(s1, s2) && s1 > s2);
+ CMP(_CMP_TRUE_UQ, 1);
+
+ CMP(_CMP_EQ_OS, !isunordered(s1, s2) && s1 == s2);
+ CMP(_CMP_LT_OQ, !isunordered(s1, s2) && s1 < s2);
+ CMP(_CMP_LE_OQ, !isunordered(s1, s2) && s1 <= s2);
+ CMP(_CMP_UNORD_S, isunordered(s1, s2));
+ CMP(_CMP_NEQ_US, isunordered(s1, s2) || s1 != s2);
+ CMP(_CMP_NLT_UQ, isunordered(s1, s2) || s1 >= s2);
+ CMP(_CMP_NLE_UQ, isunordered(s1, s2) || s1 > s2);
+ CMP(_CMP_ORD_S, !isunordered(s1, s2));
+ CMP(_CMP_EQ_US, isunordered(s1, s2) || s1 == s2);
+ CMP(_CMP_NGE_UQ, isunordered(s1, s2) || s1 < s2);
+ CMP(_CMP_NGT_UQ, isunordered(s1, s2) || s1 <= s2);
+ CMP(_CMP_FALSE_OS, 0);
+ CMP(_CMP_NEQ_OS, !isunordered(s1, s2) && s1 != s2);
+ CMP(_CMP_GE_OQ, !isunordered(s1, s2) && s1 >= s2);
+ CMP(_CMP_GT_OQ, !isunordered(s1, s2) && s1 > s2);
+ CMP(_CMP_TRUE_US, 1);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1c.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1c.c
new file mode 100644
index 0000000..77366a8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcomish-1c.c
@@ -0,0 +1,66 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+
+#define CMP(imm, rel) \
+ dst_ref = 0; \
+ dst_ref = ((int) rel) | dst_ref; \
+ dst = _mm_comi_round_sh(src1.xmmh[0], src2.xmmh[0], imm, \
+ _MM_FROUND_NO_EXC); \
+ if (dst_ref != dst) abort(); \
+
+void
+test_512 (void)
+{
+ V512 v1,v2,v3,v4;
+ float s1,s2;
+ int res,exp,dst;
+ __mmask8 dst_ref;
+
+ init_src_nanf();
+ unpack_ph_2twops(src1, &v1, &v2);
+ unpack_ph_2twops(src2, &v3, &v4);
+ s1 = v1.f32[0];
+ s2 = v3.f32[0];
+
+ CMP(_CMP_EQ_OQ, !isunordered(s1, s2) && s1 == s2);
+ CMP(_CMP_LT_OS, !isunordered(s1, s2) && s1 < s2);
+ CMP(_CMP_LE_OS, !isunordered(s1, s2) && s1 <= s2);
+ CMP(_CMP_UNORD_Q, isunordered(s1, s2));
+ CMP(_CMP_NEQ_UQ, isunordered(s1, s2) || s1 != s2);
+ CMP(_CMP_NLT_US, isunordered(s1, s2) || s1 >= s2);
+ CMP(_CMP_NLE_US, isunordered(s1, s2) || s1 > s2);
+ CMP(_CMP_ORD_Q, !isunordered(s1, s2));
+
+ CMP(_CMP_EQ_UQ, isunordered(s1, s2) || s1 == s2);
+ CMP(_CMP_NGE_US, isunordered(s1, s2) || s1 < s2);
+ CMP(_CMP_NGT_US, isunordered(s1, s2) || s1 <= s2);
+
+ CMP(_CMP_FALSE_OQ, 0);
+ CMP(_CMP_NEQ_OQ, !isunordered(s1, s2) && s1 != s2);
+ CMP(_CMP_GE_OS, !isunordered(s1, s2) && s1 >= s2);
+ CMP(_CMP_GT_OS, !isunordered(s1, s2) && s1 > s2);
+ CMP(_CMP_TRUE_UQ, 1);
+
+ CMP(_CMP_EQ_OS, !isunordered(s1, s2) && s1 == s2);
+ CMP(_CMP_LT_OQ, !isunordered(s1, s2) && s1 < s2);
+ CMP(_CMP_LE_OQ, !isunordered(s1, s2) && s1 <= s2);
+ CMP(_CMP_UNORD_S, isunordered(s1, s2));
+ CMP(_CMP_NEQ_US, isunordered(s1, s2) || s1 != s2);
+ CMP(_CMP_NLT_UQ, isunordered(s1, s2) || s1 >= s2);
+ CMP(_CMP_NLE_UQ, isunordered(s1, s2) || s1 > s2);
+ CMP(_CMP_ORD_S, !isunordered(s1, s2));
+ CMP(_CMP_EQ_US, isunordered(s1, s2) || s1 == s2);
+ CMP(_CMP_NGE_UQ, isunordered(s1, s2) || s1 < s2);
+ CMP(_CMP_NGT_UQ, isunordered(s1, s2) || s1 <= s2);
+ CMP(_CMP_FALSE_OS, 0);
+ CMP(_CMP_NEQ_OS, !isunordered(s1, s2) && s1 != s2);
+ CMP(_CMP_GE_OQ, !isunordered(s1, s2) && s1 >= s2);
+ CMP(_CMP_GT_OQ, !isunordered(s1, s2) && s1 > s2);
+ CMP(_CMP_TRUE_US, 1);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1a.c
new file mode 100644
index 0000000..63f111f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1a.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+\{rz-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m512h res, res1, res2;
+volatile __m512h x1, x2;
+volatile __mmask32 m32;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm512_div_ph (x1, x2);
+ res1 = _mm512_mask_div_ph (res1, m32, x1, x2);
+ res2 = _mm512_maskz_div_ph (m32, x1, x2);
+
+ res = _mm512_div_round_ph (x1, x2, 8);
+ res1 = _mm512_mask_div_round_ph (res1, m32, x1, x2, 8);
+ res2 = _mm512_maskz_div_round_ph (m32, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1b.c
new file mode 100644
index 0000000..c8b3821
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivph-1b.c
@@ -0,0 +1,97 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS (AVX512F_LEN / 16)
+
+void NOINLINE
+EMULATE(div_ph) (V512 * dest, V512 op1, V512 op2,
+ __mmask32 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+ __mmask16 m1, m2;
+
+ m1 = k & 0xffff;
+ m2 = (k >> 16) & 0xffff;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ for (i = 0; i < 16; i++) {
+ if (((1 << i) & m1) == 0) {
+ if (zero_mask) {
+ v5.f32[i] = 0;
+ }
+ else {
+ v5.u32[i] = v7.u32[i];
+ }
+ }
+ else {
+ v5.f32[i] = v1.f32[i] / v3.f32[i];
+ }
+
+ if (((1 << i) & m2) == 0) {
+ if (zero_mask) {
+ v6.f32[i] = 0;
+ }
+ else {
+ v6.u32[i] = v8.u32[i];
+ }
+ }
+ else {
+ v6.f32[i] = v2.f32[i] / v4.f32[i];
+ }
+
+ }
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+TEST (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ EMULATE(div_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_div_ph) (HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _div_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(div_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_div_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_div_ph);
+
+ EMULATE(div_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_div_ph) (ZMASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_div_ph);
+
+#if AVX512F_LEN == 512
+#if AVX512F_LEN == 512
+ EMULATE(div_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_div_round_ph) (HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _div_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(div_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_div_round_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_div_ph);
+
+ EMULATE(div_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_div_round_ph) (ZMASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_div_ph);
+#endif
+#endif
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1a.c
new file mode 100644
index 0000000..39f26f5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vdivsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivsh\[ \\t\]+\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res;
+volatile __m128h x1, x2;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_div_sh (x1, x2);
+ res = _mm_mask_div_sh (res, m8, x1, x2);
+ res = _mm_maskz_div_sh (m8, x1, x2);
+
+ res = _mm_div_round_sh (x1, x2, 8);
+ res = _mm_mask_div_round_sh (res, m8, x1, x2, 8);
+ res = _mm_maskz_div_round_sh (m8, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1b.c
new file mode 100644
index 0000000..467f5d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vdivsh-1b.c
@@ -0,0 +1,76 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_div_sh(V512 * dest, V512 op1, V512 op2,
+ __mmask8 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ if ((k&1) || !k)
+ v5.f32[0] = v1.f32[0] / v3.f32[0];
+ else if (zero_mask)
+ v5.f32[0] = 0;
+ else
+ v5.f32[0] = v7.f32[0];
+
+ for (i = 1; i < 8; i++)
+ v5.f32[i] = v1.f32[i];
+
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ emulate_div_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_div_sh(src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_div_sh");
+
+ init_dest(&res, &exp);
+ emulate_div_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_div_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+ src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_div_sh");
+
+ emulate_div_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_div_sh(0x3, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_div_sh");
+
+ emulate_div_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_div_round_sh(src1.xmmh[0], src2.xmmh[0],
+ _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_div_sh");
+
+ init_dest(&res, &exp);
+ emulate_div_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_div_round_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_div_sh");
+
+ emulate_div_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_div_round_sh(0x3, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_div_sh");
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vec_set_var.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vec_set_var.c
new file mode 100644
index 0000000..6a2e820
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vec_set_var.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mno-avx512vl -O2" } */
+/* { dg-final { scan-assembler-times {(?n)vpblendvb[ \t]+%xmm[0-9]} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)vpblendvb[ \t]+%ymm[0-9]} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)(?:vpbroadcastw|vmovdq[ua]16)[ \t].*%zmm[0-9].*%k[0-7]} 1 } } */
+
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef _Float16 v16hf __attribute__((vector_size(32)));
+typedef _Float16 v8hf __attribute__((vector_size(16)));
+
+v8hf
+foo1 (v8hf a, _Float16 b, int c)
+{
+ a[c] = b;
+ return a;
+}
+
+v16hf
+foo2 (v16hf a, _Float16 b, int c)
+{
+ a[c] = b;
+ return a;
+}
+
+v32hf
+foo3 (v32hf a, _Float16 b, int c)
+{
+ a[c] = b;
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1a.c
new file mode 100644
index 0000000..b91f4bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1a.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+\{sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+\{sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+\{sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m512h res, res1, res2;
+volatile __m512h x1, x2;
+volatile __mmask32 m32;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm512_max_ph (x1, x2);
+ res1 = _mm512_mask_max_ph (res1, m32, x1, x2);
+ res2 = _mm512_maskz_max_ph (m32, x1, x2);
+
+ res = _mm512_max_round_ph (x1, x2, 8);
+ res1 = _mm512_mask_max_round_ph (res1, m32, x1, x2, 8);
+ res2 = _mm512_maskz_max_round_ph (m32, x1, x2, 8);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1b.c
new file mode 100644
index 0000000..0dd4c11
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxph-1b.c
@@ -0,0 +1,94 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS (AVX512F_LEN / 16)
+
+void NOINLINE
+EMULATE(max_ph) (V512 * dest, V512 op1, V512 op2,
+ __mmask32 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+ __mmask16 m1, m2;
+
+ m1 = k & 0xffff;
+ m2 = (k >> 16) & 0xffff;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ for (i = 0; i < 16; i++) {
+ if (((1 << i) & m1) == 0) {
+ if (zero_mask) {
+ v5.f32[i] = 0;
+ }
+ else {
+ v5.u32[i] = v7.u32[i];
+ }
+ }
+ else {
+ v5.f32[i] = v1.f32[i] > v3.f32[i] ? v1.f32[i] : v3.f32[i];
+ }
+
+ if (((1 << i) & m2) == 0) {
+ if (zero_mask) {
+ v6.f32[i] = 0;
+ }
+ else {
+ v6.u32[i] = v8.u32[i];
+ }
+ }
+ else {
+ v6.f32[i] = v2.f32[i] > v4.f32[i] ? v2.f32[i] : v4.f32[i];
+ }
+ }
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+TEST (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ EMULATE(max_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_max_ph) (HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _max_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(max_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_max_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_max_ph);
+
+ EMULATE(max_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_max_ph) (ZMASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_max_ph);
+
+#if AVX512F_LEN == 512
+ EMULATE(max_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_max_round_ph) (HF(src1), HF(src2), 8);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _max_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(max_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_max_round_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2), 8);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_max_ph);
+
+ EMULATE(max_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_max_round_ph) (ZMASK_VALUE, HF(src1), HF(src2), 8);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_max_ph);
+
+#endif
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1.c
new file mode 100644
index 0000000..d5198dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res;
+volatile __m128h x1, x2;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_max_sh (x1, x2);
+ res = _mm_mask_max_sh (res, m8, x1, x2);
+ res = _mm_maskz_max_sh (m8, x1, x2);
+
+ res = _mm_max_round_sh (x1, x2, 8);
+ res = _mm_mask_max_round_sh (res, m8, x1, x2, 8);
+ res = _mm_maskz_max_round_sh (m8, x1, x2, 8);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1b.c
new file mode 100644
index 0000000..fe49de3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmaxsh-1b.c
@@ -0,0 +1,72 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_max_sh(V512 * dest, V512 op1, V512 op2,
+ __mmask8 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ if ((k&1) || !k)
+ v5.f32[i] = v1.f32[i] > v3.f32[i] ? v1.f32[i] : v3.f32[i];
+ else if (zero_mask)
+ v5.f32[0] = 0;
+ else
+ v5.f32[0] = v7.f32[0];
+
+ for (i = 1; i < 8; i++)
+ v5.f32[i] = v1.f32[i];
+
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ emulate_max_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_max_sh(src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_max_sh");
+
+ init_dest(&res, &exp);
+ emulate_max_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_max_sh(res.xmmh[0], 0x1, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_max_sh");
+
+ emulate_max_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_max_sh(0x3, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_max_sh");
+
+ emulate_max_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_max_round_sh(src1.xmmh[0], src2.xmmh[0], 8);
+ check_results(&res, &exp, N_ELEMS, "_mm_max_round_sh");
+
+ init_dest(&res, &exp);
+ emulate_max_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_max_round_sh(res.xmmh[0], 0x1, src1.xmmh[0], src2.xmmh[0], 8);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_max_round_sh");
+
+ emulate_max_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_max_round_sh(0x3, src1.xmmh[0], src2.xmmh[0], 8);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_max_round_sh");
+
+ if (n_errs != 0)
+ abort ();
+}
+
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1a.c
new file mode 100644
index 0000000..810a93e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1a.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+\{sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+\{sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+\{sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m512h res, res1, res2;
+volatile __m512h x1, x2;
+volatile __mmask32 m32;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm512_min_ph (x1, x2);
+ res1 = _mm512_mask_min_ph (res1, m32, x1, x2);
+ res2 = _mm512_maskz_min_ph (m32, x1, x2);
+
+ res = _mm512_min_round_ph (x1, x2, 8);
+ res1 = _mm512_mask_min_round_ph (res1, m32, x1, x2, 8);
+ res2 = _mm512_maskz_min_round_ph (m32, x1, x2, 8);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1b.c
new file mode 100644
index 0000000..3315ce1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vminph-1b.c
@@ -0,0 +1,93 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS (AVX512F_LEN / 16)
+
+void NOINLINE
+EMULATE(min_ph) (V512 * dest, V512 op1, V512 op2,
+ __mmask32 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+ __mmask16 m1, m2;
+
+ m1 = k & 0xffff;
+ m2 = (k >> 16) & 0xffff;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ for (i = 0; i < 16; i++) {
+ if (((1 << i) & m1) == 0) {
+ if (zero_mask) {
+ v5.f32[i] = 0;
+ }
+ else {
+ v5.u32[i] = v7.u32[i];
+ }
+ }
+ else {
+ v5.f32[i] = v1.f32[i] < v3.f32[i] ? v1.f32[i] : v3.f32[i];
+ }
+
+ if (((1 << i) & m2) == 0) {
+ if (zero_mask) {
+ v6.f32[i] = 0;
+ }
+ else {
+ v6.u32[i] = v8.u32[i];
+ }
+ }
+ else {
+ v6.f32[i] = v2.f32[i] < v4.f32[i] ? v2.f32[i] : v4.f32[i];
+ }
+ }
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+TEST (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ EMULATE(min_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_min_ph) (HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _min_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(min_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_min_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_min_ph);
+
+ EMULATE(min_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_min_ph) (ZMASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_min_ph);
+
+#if AVX512F_LEN == 512
+ EMULATE(min_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_min_round_ph) (HF(src1), HF(src2), 8);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _min_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(min_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_min_round_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2), 8);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_min_ph);
+
+ EMULATE(min_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_min_round_ph) (ZMASK_VALUE, HF(src1), HF(src2), 8);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_min_ph);
+#endif
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1.c
new file mode 100644
index 0000000..9f1d6e7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vminsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminsh\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminsh\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminsh\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res;
+volatile __m128h x1, x2;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_min_sh (x1, x2);
+ res = _mm_mask_min_sh (res, m8, x1, x2);
+ res = _mm_maskz_min_sh (m8, x1, x2);
+
+ res = _mm_min_round_sh (x1, x2, 8);
+ res = _mm_mask_min_round_sh (res, m8, x1, x2, 8);
+ res = _mm_maskz_min_round_sh (m8, x1, x2, 8);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1b.c
new file mode 100644
index 0000000..13b8d86
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vminsh-1b.c
@@ -0,0 +1,72 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_min_sh(V512 * dest, V512 op1, V512 op2,
+ __mmask8 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ if ((k&1) || !k)
+ v5.f32[i] = v1.f32[i] < v3.f32[i] ? v1.f32[i] : v3.f32[i];
+ else if (zero_mask)
+ v5.f32[0] = 0;
+ else
+ v5.f32[0] = v7.f32[0];
+
+ for (i = 1; i < 8; i++)
+ v5.f32[i] = v1.f32[i];
+
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ emulate_min_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_min_sh(src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_min_sh");
+
+ init_dest(&res, &exp);
+ emulate_min_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_min_sh(res.xmmh[0], 0x1, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_min_sh");
+
+ emulate_min_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_min_sh(0x3, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_min_sh");
+
+ emulate_min_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_min_round_sh(src1.xmmh[0], src2.xmmh[0], 8);
+ check_results(&res, &exp, N_ELEMS, "_mm_min_round_sh");
+
+ init_dest(&res, &exp);
+ emulate_min_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_min_round_sh(res.xmmh[0], 0x1, src1.xmmh[0], src2.xmmh[0], 8);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_min_round_sh");
+
+ emulate_min_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_min_round_sh(0x3, src1.xmmh[0], src2.xmmh[0], 8);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_min_round_sh");
+
+ if (n_errs != 0)
+ abort ();
+}
+
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1a.c
new file mode 100644
index 0000000..1088e25
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1a.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+\{rz-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m512h res, res1, res2;
+volatile __m512h x1, x2;
+volatile __mmask32 m32;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm512_mul_ph (x1, x2);
+ res1 = _mm512_mask_mul_ph (res1, m32, x1, x2);
+ res2 = _mm512_maskz_mul_ph (m32, x1, x2);
+
+ res = _mm512_mul_round_ph (x1, x2, 8);
+ res1 = _mm512_mask_mul_round_ph (res1, m32, x1, x2, 8);
+ res2 = _mm512_maskz_mul_round_ph (m32, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1b.c
new file mode 100644
index 0000000..0d67e87
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulph-1b.c
@@ -0,0 +1,92 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS (AVX512F_LEN / 16)
+
+void NOINLINE
+EMULATE(mul_ph) (V512 * dest, V512 op1, V512 op2,
+ __mmask32 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+ __mmask16 m1, m2;
+
+ m1 = k & 0xffff;
+ m2 = (k >> 16) & 0xffff;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ for (i = 0; i < 16; i++) {
+ if (((1 << i) & m1) == 0) {
+ if (zero_mask) {
+ v5.f32[i] = 0;
+ }
+ else {
+ v5.u32[i] = v7.u32[i];
+ }
+ }
+ else {
+ v5.f32[i] = v1.f32[i] * v3.f32[i];
+ }
+
+ if (((1 << i) & m2) == 0) {
+ if (zero_mask) {
+ v6.f32[i] = 0;
+ }
+ else {
+ v6.u32[i] = v8.u32[i];
+ }
+ }
+ else {
+ v6.f32[i] = v2.f32[i] * v4.f32[i];
+ }
+
+ }
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+TEST (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ EMULATE(mul_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_mul_ph) (HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mul_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(mul_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_mul_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_mul_ph);
+
+ EMULATE(mul_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_mul_ph) (ZMASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_mul_ph);
+
+#if AVX512F_LEN == 512
+ EMULATE(mul_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_mul_round_ph) (HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mul_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(mul_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_mul_round_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_mul_ph);
+
+ EMULATE(mul_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_mul_round_ph) (ZMASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_mul_ph);
+#endif
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1a.c
new file mode 100644
index 0000000..85707b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vmulsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulsh\[ \\t\]+\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res;
+volatile __m128h x1, x2;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_mul_sh (x1, x2);
+ res = _mm_mask_mul_sh (res, m8, x1, x2);
+ res = _mm_maskz_mul_sh (m8, x1, x2);
+
+ res = _mm_mul_round_sh (x1, x2, 8);
+ res = _mm_mask_mul_round_sh (res, m8, x1, x2, 8);
+ res = _mm_maskz_mul_round_sh (m8, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1b.c
new file mode 100644
index 0000000..36b6930
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmulsh-1b.c
@@ -0,0 +1,77 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_mul_sh(V512 * dest, V512 op1, V512 op2,
+ __mmask8 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ if ((k&1) || !k)
+ v5.f32[0] = v1.f32[0] * v3.f32[0];
+ else if (zero_mask)
+ v5.f32[0] = 0;
+ else
+ v5.f32[0] = v7.f32[0];
+
+ for (i = 1; i < 8; i++)
+ v5.f32[i] = v1.f32[i];
+
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ emulate_mul_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mul_sh(src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mul_sh");
+
+ init_dest(&res, &exp);
+ emulate_mul_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_mul_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+ src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_mul_sh");
+
+ emulate_mul_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_mul_sh(0x3, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_mul_sh");
+
+ emulate_mul_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mul_round_sh(src1.xmmh[0], src2.xmmh[0],
+ _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_mul_sh");
+
+ init_dest(&res, &exp);
+ emulate_mul_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_mul_round_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_mul_sh");
+
+ emulate_mul_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_mul_round_sh(0x3, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_mul_sh");
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1a.c
new file mode 100644
index 0000000..bb5eda6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1a.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+\{rn-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+\{rz-sae\}\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m512h res, res1, res2;
+volatile __m512h x1, x2;
+volatile __mmask32 m32;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm512_sub_ph (x1, x2);
+ res1 = _mm512_mask_sub_ph (res1, m32, x1, x2);
+ res2 = _mm512_maskz_sub_ph (m32, x1, x2);
+
+ res = _mm512_sub_round_ph (x1, x2, 8);
+ res1 = _mm512_mask_sub_round_ph (res1, m32, x1, x2, 8);
+ res2 = _mm512_maskz_sub_round_ph (m32, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1b.c
new file mode 100644
index 0000000..bd31d98
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubph-1b.c
@@ -0,0 +1,93 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS (AVX512F_LEN / 16)
+
+void NOINLINE
+EMULATE(sub_ph) (V512 * dest, V512 op1, V512 op2,
+ __mmask32 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+ __mmask16 m1, m2;
+
+ m1 = k & 0xffff;
+ m2 = (k >> 16) & 0xffff;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ for (i = 0; i < 16; i++) {
+ if (((1 << i) & m1) == 0) {
+ if (zero_mask) {
+ v5.f32[i] = 0;
+ }
+ else {
+ v5.u32[i] = v7.u32[i];
+ }
+ }
+ else {
+ v5.f32[i] = v1.f32[i] - v3.f32[i];
+ }
+
+ if (((1 << i) & m2) == 0) {
+ if (zero_mask) {
+ v6.f32[i] = 0;
+ }
+ else {
+ v6.u32[i] = v8.u32[i];
+ }
+ }
+ else {
+ v6.f32[i] = v2.f32[i] - v4.f32[i];
+ }
+
+ }
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+
+void
+TEST (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ EMULATE(sub_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_sub_ph) (HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _sub_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(sub_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_sub_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_sub_ph);
+
+ EMULATE(sub_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_sub_ph) (ZMASK_VALUE, HF(src1), HF(src2));
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_sub_ph);
+
+#if AVX512F_LEN == 512
+ EMULATE(sub_ph) (&exp, src1, src2, NET_MASK, 0);
+ HF(res) = INTRINSIC (_sub_round_ph) (HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _sub_ph);
+
+ init_dest(&res, &exp);
+ EMULATE(sub_ph) (&exp, src1, src2, MASK_VALUE, 0);
+ HF(res) = INTRINSIC (_mask_sub_round_ph) (HF(res), MASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _mask_sub_ph);
+
+ EMULATE(sub_ph) (&exp, src1, src2, ZMASK_VALUE, 1);
+ HF(res) = INTRINSIC (_maskz_sub_round_ph) (ZMASK_VALUE, HF(src1), HF(src2), _ROUND_NINT);
+ CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_sub_ph);
+#endif
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1a.c
new file mode 100644
index 0000000..8ea1eea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vsubsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubsh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubsh\[ \\t\]+\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res;
+volatile __m128h x1, x2;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm_sub_sh (x1, x2);
+ res = _mm_mask_sub_sh (res, m8, x1, x2);
+ res = _mm_maskz_sub_sh (m8, x1, x2);
+
+ res = _mm_sub_round_sh (x1, x2, 8);
+ res = _mm_mask_sub_round_sh (res, m8, x1, x2, 8);
+ res = _mm_maskz_sub_round_sh (m8, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1b.c
new file mode 100644
index 0000000..df3680e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vsubsh-1b.c
@@ -0,0 +1,76 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_sub_sh(V512 * dest, V512 op1, V512 op2,
+ __mmask8 k, int zero_mask)
+{
+ V512 v1, v2, v3, v4, v5, v6, v7, v8;
+ int i;
+
+ unpack_ph_2twops(op1, &v1, &v2);
+ unpack_ph_2twops(op2, &v3, &v4);
+ unpack_ph_2twops(*dest, &v7, &v8);
+
+ if ((k&1) || !k)
+ v5.f32[0] = v1.f32[0] - v3.f32[0];
+ else if (zero_mask)
+ v5.f32[0] = 0;
+ else
+ v5.f32[0] = v7.f32[0];
+
+ for (i = 1; i < 8; i++)
+ v5.f32[i] = v1.f32[i];
+
+ *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+ V512 res;
+ V512 exp;
+
+ init_src();
+
+ emulate_sub_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_sub_sh(src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_sub_sh");
+
+ init_dest(&res, &exp);
+ emulate_sub_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_sub_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+ src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_sub_sh");
+
+ emulate_sub_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_sub_sh(0x3, src1.xmmh[0], src2.xmmh[0]);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_sub_sh");
+
+ emulate_sub_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_sub_round_sh(src1.xmmh[0], src2.xmmh[0],
+ _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_sub_sh");
+
+ init_dest(&res, &exp);
+ emulate_sub_sh(&exp, src1, src2, 0x1, 0);
+ res.xmmh[0] = _mm_mask_sub_round_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_mask_sub_sh");
+
+ emulate_sub_sh(&exp, src1, src2, 0x3, 1);
+ res.xmmh[0] = _mm_maskz_sub_round_sh(0x3, src1.xmmh[0],
+ src2.xmmh[0], _ROUND_NINT);
+ check_results(&res, &exp, N_ELEMS, "_mm_maskz_sub_sh");
+
+ if (n_errs != 0) {
+ abort ();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1a.c
new file mode 100644
index 0000000..354d897
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m256h res1;
+volatile __m128h res2;
+volatile __m256h x1,x2;
+volatile __m128h x3, x4;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res1 = _mm256_add_ph (x1, x2);
+ res1 = _mm256_mask_add_ph (res1, m16, x1, x2);
+ res1 = _mm256_maskz_add_ph (m16, x1, x2);
+
+ res2 = _mm_add_ph (x3, x4);
+ res2 = _mm_mask_add_ph (res2, m8, x3, x4);
+ res2 = _mm_maskz_add_ph (m8, x3, x4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c
new file mode 100644
index 0000000..fcf6a90
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+
+#define DEBUG
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vaddph-1b.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vaddph-1b.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1a.c
new file mode 100644
index 0000000..31da2b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1a.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\\\$1\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%k\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\\\$2\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%k\[0-9\]\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\\\$3\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpph\[ \\t\]+\\\$4\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%k\[0-9\]\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __mmask16 res;
+volatile __mmask8 res1;
+volatile __m256h x1, x2;
+volatile __m128h x3, x4;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res = _mm256_cmp_ph_mask (x1, x2, 1);
+ res = _mm256_mask_cmp_ph_mask (m16, x1, x2, 2);
+ res1 = _mm_cmp_ph_mask (x3, x4, 3);
+ res1 = _mm_mask_cmp_ph_mask (m8, x3, x4, 4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c
new file mode 100644
index 0000000..c201a92
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+
+#define DEBUG
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vcmpph-1b.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vcmpph-1b.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1a.c
new file mode 100644
index 0000000..038d9e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m256h res1;
+volatile __m128h res2;
+volatile __m256h x1,x2;
+volatile __m128h x3, x4;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res1 = _mm256_div_ph (x1, x2);
+ res1 = _mm256_mask_div_ph (res1, m16, x1, x2);
+ res1 = _mm256_maskz_div_ph (m16, x1, x2);
+
+ res2 = _mm_div_ph (x3, x4);
+ res2 = _mm_mask_div_ph (res2, m8, x3, x4);
+ res2 = _mm_maskz_div_ph (m8, x3, x4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c
new file mode 100644
index 0000000..48965c6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+
+#define DEBUG
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vdivph-1b.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vdivph-1b.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1a.c
new file mode 100644
index 0000000..adadc4e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmaxph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m256h res1;
+volatile __m128h res2;
+volatile __m256h x1,x2;
+volatile __m128h x3, x4;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res1 = _mm256_max_ph (x1, x2);
+ res1 = _mm256_mask_max_ph (res1, m16, x1, x2);
+ res1 = _mm256_maskz_max_ph (m16, x1, x2);
+
+ res2 = _mm_max_ph (x3, x4);
+ res2 = _mm_mask_max_ph (res2, m8, x3, x4);
+ res2 = _mm_maskz_max_ph (m8, x3, x4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c
new file mode 100644
index 0000000..f9a3b70
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+
+#define DEBUG
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vmaxph-1b.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vmaxph-1b.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1a.c
new file mode 100644
index 0000000..7909541
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vminph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m256h res1;
+volatile __m128h res2;
+volatile __m256h x1,x2;
+volatile __m128h x3, x4;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res1 = _mm256_min_ph (x1, x2);
+ res1 = _mm256_mask_min_ph (res1, m16, x1, x2);
+ res1 = _mm256_maskz_min_ph (m16, x1, x2);
+
+ res2 = _mm_min_ph (x3, x4);
+ res2 = _mm_mask_min_ph (res2, m8, x3, x4);
+ res2 = _mm_maskz_min_ph (m8, x3, x4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c
new file mode 100644
index 0000000..98808b0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+
+#define DEBUG
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vminph-1b.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vminph-1b.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1a.c
new file mode 100644
index 0000000..26663c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m256h res1;
+volatile __m128h res2;
+volatile __m256h x1,x2;
+volatile __m128h x3, x4;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res1 = _mm256_mul_ph (x1, x2);
+ res1 = _mm256_mask_mul_ph (res1, m16, x1, x2);
+ res1 = _mm256_maskz_mul_ph (m16, x1, x2);
+
+ res2 = _mm_mul_ph (x3, x4);
+ res2 = _mm_mask_mul_ph (res2, m8, x3, x4);
+ res2 = _mm_maskz_mul_ph (m8, x3, x4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c
new file mode 100644
index 0000000..2b3ba050
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+
+#define DEBUG
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vmulph-1b.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vmulph-1b.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1a.c
new file mode 100644
index 0000000..10e5cbf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1a.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\[^\n\r]*%ymm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m256h res1;
+volatile __m128h res2;
+volatile __m256h x1,x2;
+volatile __m128h x3, x4;
+volatile __mmask16 m16;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+ res1 = _mm256_sub_ph (x1, x2);
+ res1 = _mm256_mask_sub_ph (res1, m16, x1, x2);
+ res1 = _mm256_maskz_sub_ph (m16, x1, x2);
+
+ res2 = _mm_sub_ph (x3, x4);
+ res2 = _mm_mask_sub_ph (res2, m8, x3, x4);
+ res2 = _mm_maskz_sub_ph (m8, x3, x4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c
new file mode 100644
index 0000000..fa16218
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+
+#define DEBUG
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vsubph-1b.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512fp16-vsubph-1b.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-abs-copysign-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-abs-copysign-1.c
index b375c5f..b27335b 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-abs-copysign-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-abs-copysign-1.c
@@ -64,8 +64,8 @@ f6 (double x)
}
/* { dg-final { scan-assembler "vpandd\[^\n\r\]*xmm16" } } */
-/* { dg-final { scan-assembler "vpord\[^\n\r\]*xmm16" } } */
+/* { dg-final { scan-assembler "vpternlogd\[^\n\r\]*xmm16" } } */
/* { dg-final { scan-assembler "vpxord\[^\n\r\]*xmm16" } } */
/* { dg-final { scan-assembler "vpandq\[^\n\r\]*xmm18" } } */
-/* { dg-final { scan-assembler "vporq\[^\n\r\]*xmm18" } } */
+/* { dg-final { scan-assembler "vpternlogq\[^\n\r\]*xmm18" } } */
/* { dg-final { scan-assembler "vpxorq\[^\n\r\]*xmm18" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-blendv-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-blendv-1.c
new file mode 100644
index 0000000..6aa004b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-blendv-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-final { scan-assembler-times {pblendvb[\t ]*%xmm} 1 } } */
+/* { dg-final { scan-assembler-times {pblendvb[\t ]*%ymm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvps[\t ]*%xmm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvps[\t ]*%ymm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvpd[\t ]*%xmm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvpd[\t ]*%ymm} 1 } } */
+
+typedef float v4sf __attribute__ ((vector_size (16)));
+typedef float v8sf __attribute__ ((vector_size (32)));
+typedef double v2df __attribute__ ((vector_size (16)));
+typedef double v4df __attribute__ ((vector_size (32)));
+typedef char v16qi __attribute__ ((vector_size (16)));
+typedef char v32qi __attribute__ ((vector_size (32)));
+
+v4sf
+foo (v4sf a, v4sf b, v4sf c)
+{
+ return __builtin_ia32_blendvps (a, b, c);
+}
+
+v8sf
+foo2 (v8sf a, v8sf b, v8sf c)
+{
+ return __builtin_ia32_blendvps256 (a, b, c);
+}
+
+v2df
+foo3 (v2df a, v2df b, v2df c)
+{
+ return __builtin_ia32_blendvpd (a, b, c);
+}
+
+v4df
+foo4 (v4df a, v4df b, v4df c)
+{
+ return __builtin_ia32_blendvpd256 (a, b, c);
+}
+
+v16qi
+foo5 (v16qi a, v16qi b, v16qi c)
+{
+ return __builtin_ia32_pblendvb128 (a, b, c);
+}
+
+v32qi
+foo6 (v32qi a, v32qi b, v32qi c)
+{
+ return __builtin_ia32_pblendvb256 (a, b, c);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-blendv-2.c b/gcc/testsuite/gcc.target/i386/avx512vl-blendv-2.c
new file mode 100644
index 0000000..daddcd5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-blendv-2.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-final { scan-assembler-not {pblendv} } } */
+/* { dg-final { scan-assembler-not {blendvp} } } */
+
+#include <x86intrin.h>
+__m128
+foo (__m128 a, __m128 b)
+{
+ return _mm_blendv_ps (a, b, _mm_setzero_ps ());
+}
+
+__m256
+foo2 (__m256 a, __m256 b)
+{
+ return _mm256_blendv_ps (a, b, _mm256_set1_ps (-1.0));
+}
+
+__m128d
+foo3 (__m128d a, __m128d b, __m128d c)
+{
+ return _mm_blendv_pd (a, b, _mm_set1_pd (1.0));
+}
+
+__m256d
+foo4 (__m256d a, __m256d b, __m256d c)
+{
+ return _mm256_blendv_pd (a, b, _mm256_set1_pd (-134.3));
+}
+
+__m128i
+foo5 (__m128i a, __m128i b, __m128i c)
+{
+ return _mm_blendv_epi8 (a, b, _mm_set1_epi8 (3));
+}
+
+__m256i
+foo6 (__m256i a, __m256i b, __m256i c)
+{
+ return _mm256_blendv_epi8 (a, b, _mm256_set1_epi8 (-22));
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c
index c06369d..f8eb99f 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c
@@ -2,9 +2,15 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512vl -mavx512dq" } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 5 } } */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 10 } } */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 5 } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 4 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 5 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 7 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 2 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 3 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 3 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %xmm\[0-9\]+" 3 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %ymm\[0-9\]+" 3 { target { ! ia32 } } } } */
typedef int v4si __attribute__ ((vector_size (16)));
typedef int v8si __attribute__ ((vector_size (32)));
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c
index 4998a9b..32f6ac8 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c
@@ -2,9 +2,12 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512vl" } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 4 } } */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 8 } } */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 4 } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 4 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 4 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 4 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 4 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %xmm\[0-9\]+" 4 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %ymm\[0-9\]+" 4 { target { ! ia32 } } } } */
typedef int v4si __attribute__ ((vector_size (16)));
typedef int v8si __attribute__ ((vector_size (32)));
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-1.c
new file mode 100644
index 0000000..9ffd381
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-1.c
@@ -0,0 +1,122 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vpexpandd\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandd\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandq\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandq\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandpd\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandpd\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandps\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandps\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 4 } } */
+/* { dg-final { scan-assembler-times "(?:vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}|blend\[a-z]+\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+)(?:\n|\[ \\t\]+#)" 4 } } */
+/* { dg-final { scan-assembler-times "vpexpandd\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandd\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandq\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandq\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandpd\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandpd\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandps\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vexpandps\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 4 } } */
+/* { dg-final { scan-assembler-times "(?:vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}|(?:blend\[a-z]+|movsd)\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+)(?:\n|\[ \\t\]+#)" 4 } } */
+
+#include <immintrin.h>
+
+int *pi32;
+long long *pi64;
+double *pd;
+float *pf;
+volatile __m256i xi32, xi64;
+volatile __m256d xd;
+volatile __m256 xf;
+
+volatile __m128i xi32_128, xi64_128;
+volatile __m128d xd_128;
+volatile __m128 xf_128;
+
+void extern
+avx512vl_test (void)
+{
+ xi32 = _mm256_mask_expand_epi32 (xi32, 0, xi32);
+ xi32 = _mm256_mask_expand_epi32 (xi32, -1, xi32);
+ xi32 = _mm256_mask_expand_epi32 (xi32, (1 << 4) - 1, xi32);
+ xi32 = _mm256_mask_expand_epi32 (xi32, (1 << 4) + 1, xi32);
+
+ xi32 = _mm256_mask_expandloadu_epi32 (xi32, 0, pi32);
+ xi32 = _mm256_mask_expandloadu_epi32 (xi32, (1 << 8) - 1, pi32);
+ xi32 = _mm256_mask_expandloadu_epi32 (xi32, (1 << 6) - 1, pi32);
+ xi32 = _mm256_mask_expandloadu_epi32 (xi32, (1 << 6) + 3, pi32);
+
+ xi64 = _mm256_mask_expand_epi64 (xi64, 0, xi64);
+ xi64 = _mm256_mask_expand_epi64 (xi64, -1, xi64);
+ xi64 = _mm256_mask_expand_epi64 (xi64, (1 << 3) - 1, xi64);
+ xi64 = _mm256_mask_expand_epi64 (xi64, (1 << 3) + 2, xi64);
+
+ xi64 = _mm256_mask_expandloadu_epi64 (xi64, 0, pi64);
+ xi64 = _mm256_mask_expandloadu_epi64 (xi64, (1 << 4) - 1, pi64);
+ xi64 = _mm256_mask_expandloadu_epi64 (xi64, (1 << 2) - 1, pi64);
+ xi64 = _mm256_mask_expandloadu_epi64 (xi64, (1 << 2), pi64);
+
+ xf = _mm256_mask_expand_ps (xf, 0, xf);
+ xf = _mm256_mask_expand_ps (xf, (1 << 8) - 1, xf);
+ xf = _mm256_mask_expand_ps (xf, (1 << 6) - 1, xf);
+ xf = _mm256_mask_expand_ps (xf, (1 << 6) + 3, xf);
+
+ xf = _mm256_mask_expandloadu_ps (xf, 0, pf);
+ xf = _mm256_mask_expandloadu_ps (xf, -1, pf);
+ xf = _mm256_mask_expandloadu_ps (xf, (1 << 7) - 1, pf);
+ xf = _mm256_mask_expandloadu_ps (xf, (1 << 7) + 5, pf);
+
+ xd = _mm256_mask_expand_pd (xd, 0, xd);
+ xd = _mm256_mask_expand_pd (xd, (1 << 4) - 1, xd);
+ xd = _mm256_mask_expand_pd (xd, (1 << 2) - 1, xd);
+ xd = _mm256_mask_expand_pd (xd, (1 << 2), xd);
+
+ xd = _mm256_mask_expandloadu_pd (xd, 0, pd);
+ xd = _mm256_mask_expandloadu_pd (xd, -1, pd);
+ xd = _mm256_mask_expandloadu_pd (xd, (1 << 2) - 1, pd);
+ xd = _mm256_mask_expandloadu_pd (xd, (1 << 2), pd);
+
+ xi32_128 = _mm_mask_expand_epi32 (xi32_128, 0, xi32_128);
+ xi32_128 = _mm_mask_expand_epi32 (xi32_128, -1, xi32_128);
+ xi32_128 = _mm_mask_expand_epi32 (xi32_128, (1 << 3) - 1, xi32_128);
+ xi32_128 = _mm_mask_expand_epi32 (xi32_128, (1 << 3) + 1, xi32_128);
+
+ xi32_128 = _mm_mask_expandloadu_epi32 (xi32_128, 0, pi32);
+ xi32_128 = _mm_mask_expandloadu_epi32 (xi32_128, (1 << 4) - 1, pi32);
+ xi32_128 = _mm_mask_expandloadu_epi32 (xi32_128, (1 << 2) - 1, pi32);
+ xi32_128 = _mm_mask_expandloadu_epi32 (xi32_128, (1 << 1) + 3, pi32);
+
+ xi64_128 = _mm_mask_expand_epi64 (xi64_128, 0, xi64_128);
+ xi64_128 = _mm_mask_expand_epi64 (xi64_128, -1, xi64_128);
+ xi64_128 = _mm_mask_expand_epi64 (xi64_128, (1 << 1) - 1, xi64_128);
+ xi64_128 = _mm_mask_expand_epi64 (xi64_128, 2, xi64_128);
+
+ xi64_128 = _mm_mask_expandloadu_epi64 (xi64_128, 0, pi64);
+ xi64_128 = _mm_mask_expandloadu_epi64 (xi64_128, 3, pi64);
+ xi64_128 = _mm_mask_expandloadu_epi64 (xi64_128, 1, pi64);
+ xi64_128 = _mm_mask_expandloadu_epi64 (xi64_128, 2, pi64);
+
+ xf_128 = _mm_mask_expand_ps (xf_128, 0, xf_128);
+ xf_128 = _mm_mask_expand_ps (xf_128, (1 << 4) - 1, xf_128);
+ xf_128 = _mm_mask_expand_ps (xf_128, (1 << 3) - 1, xf_128);
+ xf_128 = _mm_mask_expand_ps (xf_128, (1 << 2), xf_128);
+
+ xf_128 = _mm_mask_expandloadu_ps (xf_128, 0, pf);
+ xf_128 = _mm_mask_expandloadu_ps (xf_128, -1, pf);
+ xf_128 = _mm_mask_expandloadu_ps (xf_128, (1 << 3) - 1, pf);
+ xf_128 = _mm_mask_expandloadu_ps (xf_128, (1 << 1), pf);
+
+ xd_128 = _mm_mask_expand_pd (xd_128, 0, xd_128);
+ xd_128 = _mm_mask_expand_pd (xd_128, (1 << 2) - 1, xd_128);
+ xd_128 = _mm_mask_expand_pd (xd_128, 1, xd_128);
+ xd_128 = _mm_mask_expand_pd (xd_128, 2, xd_128);
+
+ xd_128 = _mm_mask_expandloadu_pd (xd_128, 0, pd);
+ xd_128 = _mm_mask_expandloadu_pd (xd_128, -1, pd);
+ xd_128 = _mm_mask_expandloadu_pd (xd_128, 1, pd);
+ xd_128 = _mm_mask_expandloadu_pd (xd_128, 2, pd);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-pd-2.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-pd-2.c
new file mode 100644
index 0000000..e5f3037
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-pd-2.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512f-pr100267-pd-2.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512f-pr100267-pd-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-ps-2.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-ps-2.c
new file mode 100644
index 0000000..0149a8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr100267-ps-2.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512f-pr100267-ps-2.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512f-pr100267-ps-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr100648.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr100648.c
new file mode 100644
index 0000000..2ef7c7b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr100648.c
@@ -0,0 +1,21 @@
+/* PR target/100648. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw -masm=att" } */
+/* { dg-final { scan-assembler-times "\tvpblendvb\t" 2 } } */
+/* { dg-final { scan-assembler-not "\tvpcmpeq" } } */
+/* { dg-final { scan-assembler-not "\tvpandn" } } */
+#include <x86intrin.h>
+
+__m256i
+f1 (__m256i a, __m256i b, __m256i mask)
+{
+ return _mm256_blendv_epi8(a, b,
+ _mm256_andnot_si256(mask, _mm256_set1_epi8(255)));
+}
+
+__m128i
+f2 (__m128i a, __m128i b, __m128i mask)
+{
+ return _mm_blendv_epi8(a, b,
+ _mm_andnot_si128(mask, _mm_set1_epi8(255)));
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr101472.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr101472.c
new file mode 100644
index 0000000..6df59a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr101472.c
@@ -0,0 +1,79 @@
+/* PR target/101472 */
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vpscatterqd\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterqd\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterdd\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterdd\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterqq\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterqq\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterdq\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpscatterdq\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterqps\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterqps\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterdps\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterdps\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterqpd\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterqpd\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*ymm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterdpd\[ \\t\]+\[^\{\n\]*xmm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vscatterdpd\[ \\t\]+\[^\{\n\]*ymm\[0-9\]\[^\n\]*xmm\[0-9\]\[^\n\]*{%k\[1-7\]}(?:\n|\[ \\t\]+#)" 2 } } */
+
+
+#include <immintrin.h>
+
+void two_scatters_epi32(void* addr, __mmask8 k1, __mmask8 k2, __m128i vindex1,
+ __m256i vindex2, __m128i src_epi32,
+ __m256i src_i32_epi32)
+{
+ _mm_mask_i64scatter_epi32(addr, k1, vindex1, src_epi32, 1);
+ _mm_mask_i64scatter_epi32(addr, k2, vindex1, src_epi32, 1);
+ _mm256_mask_i64scatter_epi32(addr, k1, vindex2, src_epi32, 1);
+ _mm256_mask_i64scatter_epi32(addr, k2, vindex2, src_epi32, 1);
+
+ _mm_mask_i32scatter_epi32(addr, k1, vindex1, src_epi32, 1);
+ _mm_mask_i32scatter_epi32(addr, k2, vindex1, src_epi32, 1);
+ _mm256_mask_i32scatter_epi32(addr, k1, vindex2, src_i32_epi32, 1);
+ _mm256_mask_i32scatter_epi32(addr, k2, vindex2, src_i32_epi32, 1);
+}
+
+void two_scatters_epi64(void* addr, __mmask8 k1, __mmask8 k2, __m128i vindex1,
+ __m256i vindex2, __m128i src_epi64_mm,
+ __m256i src_epi64)
+{
+ _mm_mask_i64scatter_epi64(addr, k1, vindex1, src_epi64_mm, 1);
+ _mm_mask_i64scatter_epi64(addr, k2, vindex1, src_epi64_mm, 1);
+ _mm256_mask_i64scatter_epi64(addr, k1, vindex2, src_epi64, 1);
+ _mm256_mask_i64scatter_epi64(addr, k2, vindex2, src_epi64, 1);
+
+ _mm_mask_i32scatter_epi64(addr, k1, vindex1, src_epi64_mm, 8);
+ _mm_mask_i32scatter_epi64(addr, k2, vindex1, src_epi64_mm, 8);
+ _mm256_mask_i32scatter_epi64(addr, k1, vindex1, src_epi64, 1);
+ _mm256_mask_i32scatter_epi64(addr, k2, vindex1, src_epi64, 1);
+}
+void two_scatters_ps(void* addr, __mmask8 k1, __mmask8 k2, __m128i vindex1,
+ __m256i vindex2, __m128 src_ps, __m256 src_i32_ps)
+{
+ _mm_mask_i64scatter_ps(addr, k1, vindex1, src_ps, 1);
+ _mm_mask_i64scatter_ps(addr, k2, vindex1, src_ps, 1);
+ _mm256_mask_i64scatter_ps(addr, k1, vindex2, src_ps, 1);
+ _mm256_mask_i64scatter_ps(addr, k2, vindex2, src_ps, 1);
+
+ _mm_mask_i32scatter_ps(addr, k1, vindex1, src_ps, 8);
+ _mm_mask_i32scatter_ps(addr, k2, vindex1, src_ps, 8);
+ _mm256_mask_i32scatter_ps(addr, k1, vindex2, src_i32_ps, 1);
+ _mm256_mask_i32scatter_ps(addr, k2, vindex2, src_i32_ps, 1);
+}
+
+void two_scatters_pd(void* addr, __mmask8 k1, __mmask8 k2, __m128i vindex1,
+ __m256i vindex2, __m128d src_pd_mm, __m256d src_pd)
+{
+ _mm_mask_i64scatter_pd(addr, k1, vindex1, src_pd_mm, 1);
+ _mm_mask_i64scatter_pd(addr, k2, vindex1, src_pd_mm, 1);
+ _mm256_mask_i64scatter_pd(addr, k1, vindex2, src_pd, 1);
+ _mm256_mask_i64scatter_pd(addr, k2, vindex2, src_pd, 1);
+
+ _mm_mask_i32scatter_pd(addr, k1, vindex1, src_pd_mm, 8);
+ _mm_mask_i32scatter_pd(addr, k2, vindex1, src_pd_mm, 8);
+ _mm256_mask_i32scatter_pd(addr, k1, vindex1, src_pd, 1);
+ _mm256_mask_i32scatter_pd(addr, k2, vindex1, src_pd, 1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr95488-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr95488-1.c
index b3674fb..dc684a1 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-pr95488-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr95488-1.c
@@ -1,10 +1,10 @@
/* PR target/pr95488 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512bw -mavx512vl" } */
-/* { dg-final { scan-assembler-times "vpmovzxbw" 8 } } */
+/* { dg-final { scan-assembler-times "vpmovzxbw" 8 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "vpmullw\[^\n\]*ymm" 2 } } */
-/* { dg-final { scan-assembler-times "vpmullw\[^\n\]*xmm" 2 } } */
-/* { dg-final { scan-assembler-times "vpmovwb" 4 } } */
+/* { dg-final { scan-assembler-times "vpmullw\[^\n\]*xmm" 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpmovwb" 4 { target { ! ia32 } } } } */
typedef char v16qi __attribute__ ((vector_size (16)));
typedef char v8qi __attribute__ ((vector_size (8)));
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqd-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqd-1.c
index 863bad9..4322c5d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqd-1.c
@@ -1,9 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n^k\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c
index 35ddeeb..69b200a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c
@@ -1,9 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpeqq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpeqq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$0)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpeqq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$0)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtd-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtd-1.c
index 95ec53d..2278a27 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtd-1.c
@@ -1,9 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpgtd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtd\[ \\t\]+|vpcmpd\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c
index a83a901..26cac3a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c
@@ -1,9 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vpcmpgtq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vpcmpgtq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$6)\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpcmpgtq\[ \\t\]+|vpcmpq\[ \\t\]+\\\$6)\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%k\[0-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-1.c b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-1.c
new file mode 100644
index 0000000..135dbd7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-1.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vbmi2 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vpexpandb\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandb\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandw\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandw\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\(]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "vpexpandb\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandb\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandw\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vpexpandw\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+/* { dg-final { scan-assembler-times "vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\]*\\(\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 2 } } */
+/* { dg-final { scan-assembler-times "(?:vmov\[a-z0-9\]*\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+\{%k\[1-7\]\}|blend\[a-z]*\[ \\t\]+\[^\{\n\(]*%xmm\[0-9\]+)(?:\n|\[ \\t\]+#)" 2 } } */
+#include <immintrin.h>
+
+char *pi8;
+short *pi16;
+volatile __m256i xi16, xi8;
+volatile __m128i xi16_xmm, xi8_xmm;
+
+void extern
+avx512f_test (void)
+{
+ xi8 = _mm256_mask_expand_epi8 (xi8, 0, xi8);
+ xi8 = _mm256_mask_expand_epi8 (xi8, -1, xi8);
+ xi8 = _mm256_mask_expand_epi8 (xi8, (1 << 30) - 1, xi8);
+ xi8 = _mm256_mask_expand_epi8 (xi8, (1 << 16) + 1, xi8);
+
+ xi8 = _mm256_mask_expandloadu_epi8 (xi8, 0, pi8);
+ xi8 = _mm256_mask_expandloadu_epi8 (xi8, -1, pi8);
+ xi8 = _mm256_mask_expandloadu_epi8 (xi8, (1 << 28) - 1, pi8);
+ xi8 = _mm256_mask_expandloadu_epi8 (xi8, (1 << 15) + 3, pi8);
+
+ xi16 = _mm256_mask_expand_epi16 (xi16, 0, xi16);
+ xi16 = _mm256_mask_expand_epi16 (xi16, -1, xi16);
+ xi16 = _mm256_mask_expand_epi16 (xi16, (1 << 15) - 1, xi16);
+ xi16 = _mm256_mask_expand_epi16 (xi16, (1 << 14) + 2, xi16);
+
+ xi16 = _mm256_mask_expandloadu_epi16 (xi16, 0, pi16);
+ xi16 = _mm256_mask_expandloadu_epi16 (xi16, (1 << 16) - 1, pi16);
+ xi16 = _mm256_mask_expandloadu_epi16 (xi16, (1 << 14) - 1, pi16);
+ xi16 = _mm256_mask_expandloadu_epi16 (xi16, (1 << 13) + 7, pi16);
+
+ xi8_xmm = _mm_mask_expand_epi8 (xi8_xmm, 0, xi8_xmm);
+ xi8_xmm = _mm_mask_expand_epi8 (xi8_xmm, -1, xi8_xmm);
+ xi8_xmm = _mm_mask_expand_epi8 (xi8_xmm, (1 << 13) - 1, xi8_xmm);
+ xi8_xmm = _mm_mask_expand_epi8 (xi8_xmm, (1 << 12) + 1, xi8_xmm);
+
+ xi8_xmm = _mm_mask_expandloadu_epi8 (xi8_xmm, 0, pi8);
+ xi8_xmm = _mm_mask_expandloadu_epi8 (xi8_xmm, (1 << 16) - 1, pi8);
+ xi8_xmm = _mm_mask_expandloadu_epi8 (xi8_xmm, (1 << 12) - 1, pi8);
+ xi8_xmm = _mm_mask_expandloadu_epi8 (xi8_xmm, (1 << 11) + 3, pi8);
+
+ xi16_xmm = _mm_mask_expand_epi16 (xi16_xmm, 0, xi16_xmm);
+ xi16_xmm = _mm_mask_expand_epi16 (xi16_xmm, -1, xi16_xmm);
+ xi16_xmm = _mm_mask_expand_epi16 (xi16_xmm, (1 << 7) - 1, xi16_xmm);
+ xi16_xmm = _mm_mask_expand_epi16 (xi16_xmm, (1 << 4) + 2, xi16_xmm);
+
+ xi16_xmm = _mm_mask_expandloadu_epi16 (xi16_xmm, 0, pi16);
+ xi16_xmm = _mm_mask_expandloadu_epi16 (xi16_xmm, (1 << 8) - 1, pi16);
+ xi16_xmm = _mm_mask_expandloadu_epi16 (xi16_xmm, (1 << 3) - 1, pi16);
+ xi16_xmm = _mm_mask_expandloadu_epi16 (xi16_xmm, (1 << 6) + 7, pi16);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-b-2.c b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-b-2.c
new file mode 100644
index 0000000..d54e803
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-b-2.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512vbmi2 -mavx512bw" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512vbmi2 } */
+
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-b-2.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-b-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-d-2.c b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-d-2.c
new file mode 100644
index 0000000..1e604cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-d-2.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-d-2.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-q-2.c b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-q-2.c
new file mode 100644
index 0000000..1f9fe65
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-q-2.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-q-2.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-q-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-w-2.c b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-w-2.c
new file mode 100644
index 0000000..a46ca78
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr100267-w-2.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512vbmi2 -mavx512bw" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512vbmi2 } */
+
+#define AVX512VL
+#define AVX512F_LEN 256
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-w-2.c"
+
+#undef AVX512F_LEN
+#undef AVX512F_LEN_HALF
+
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+#include "avx512bw-pr100267-w-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlfp16-11a.c b/gcc/testsuite/gcc.target/i386/avx512vlfp16-11a.c
new file mode 100644
index 0000000..a8c6296
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlfp16-11a.c
@@ -0,0 +1,68 @@
+/* { dg-do compile} */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl" } */
+
+#include <immintrin.h>
+__m128h
+__attribute__ ((noinline, noclone))
+vadd128 (__m128h a, __m128h b)
+{
+ return a + b;
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+vadd256 (__m256h a, __m256h b)
+{
+ return a + b;
+}
+
+__m128h
+__attribute__ ((noinline, noclone))
+vsub128 (__m128h a, __m128h b)
+{
+ return a - b;
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+vsub256 (__m256h a, __m256h b)
+{
+ return a - b;
+}
+
+__m128h
+__attribute__ ((noinline, noclone))
+vmul128 (__m128h a, __m128h b)
+{
+ return a * b;
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+vmul256 (__m256h a, __m256h b)
+{
+ return a * b;
+}
+
+__m128h
+__attribute__ ((noinline, noclone))
+vdiv128 (__m128h a, __m128h b)
+{
+ return a / b;
+}
+
+__m256h
+__attribute__ ((noinline, noclone))
+vdiv256 (__m256h a, __m256h b)
+{
+ return a / b;
+}
+
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+\[^\n\r\]*%xmm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vaddph\[ \\t\]+\[^\n\r\]*%ymm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+\[^\n\r\]*%xmm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vsubph\[ \\t\]+\[^\n\r\]*%ymm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+\[^\n\r\]*%xmm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vmulph\[ \\t\]+\[^\n\r\]*%ymm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+\[^\n\r\]*%xmm\[01\]" 1 } } */
+/* { dg-final { scan-assembler-times "vdivph\[ \\t\]+\[^\n\r\]*%ymm\[01\]" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlfp16-11b.c b/gcc/testsuite/gcc.target/i386/avx512vlfp16-11b.c
new file mode 100644
index 0000000..b8d3e8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlfp16-11b.c
@@ -0,0 +1,96 @@
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512vl" } */
+
+#include <string.h>
+#include <stdlib.h>
+static void do_test (void);
+
+#define DO_TEST do_test
+#define AVX512FP16
+#include "avx512-check.h"
+#include "avx512vlfp16-11a.c"
+
+/* Get random float16 between -50.x to 50.x. */
+_Float16
+get_float16_noround()
+{
+ return ((int) (100.0 * rand ()/ (RAND_MAX + 1.0)) - 50)
+ + 0.1f * (int) (10 * rand() / (RAND_MAX + 1.0));
+}
+
+static void
+do_test (void)
+{
+ _Float16 x[16];
+ _Float16 y[16];
+ _Float16 res_add[16];
+ _Float16 res_sub[16];
+ _Float16 res_mul[16];
+ _Float16 res_div[16];
+ for (int i = 0 ; i != 16; i++)
+ {
+ x[i] = get_float16_noround ();
+ y[i] = get_float16_noround ();
+ if (y[i] == 0)
+ y[i] = 1.0f;
+ res_add[i] = x[i] + y[i];
+ res_sub[i] = x[i] - y[i];
+ res_mul[i] = x[i] * y[i];
+ res_div[i] = x[i] / y[i];
+
+ }
+
+ union128h u128 = { x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7] };
+ union128h u128_1 = { y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7] };
+ union256h u256 = { x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15] };
+ union256h u256_1 = { y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7],
+ y[8], y[9], y[10], y[11], y[12], y[13], y[14], y[15]};
+
+ __m128h v128;
+ __m256h v256;
+ union128h a128;
+ union256h a256;
+
+ memset (&v128, -1, sizeof (v128));
+ v128 = vadd128 (u128.x, u128_1.x);
+ a128.x = v128;
+ if (check_union128h (a128, res_add))
+ abort ();
+ memset (&v128, -1, sizeof (v128));
+ v128 = vsub128 (u128.x, u128_1.x);
+ a128.x = v128;
+ if (check_union128h (a128, res_sub))
+ abort ();
+ memset (&v128, -1, sizeof (v128));
+ v128 = vmul128 (u128.x, u128_1.x);
+ a128.x = v128;
+ if (check_union128h (a128, res_mul))
+ abort ();
+ memset (&v128, -1, sizeof (v128));
+ v128 = vdiv128 (u128.x, u128_1.x);
+ a128.x = v128;
+ if (check_union128h (a128, res_div))
+ abort ();
+
+ memset (&v256, -1, sizeof (v256));
+ v256 = vadd256 (u256.x, u256_1.x);
+ a256.x = v256;
+ if (check_union256h (a256, res_add))
+ abort ();
+ memset (&v256, -1, sizeof (v256));
+ v256 = vsub256 (u256.x, u256_1.x);
+ a256.x = v256;
+ if (check_union256h (a256, res_sub))
+ abort ();
+ memset (&v256, -1, sizeof (v256));
+ v256 = vmul256 (u256.x, u256_1.x);
+ a256.x = v256;
+ if (check_union256h (a256, res_mul))
+ abort ();
+ memset (&v256, -1, sizeof (v256));
+ v256 = vdiv256 (u256.x, u256_1.x);
+ a256.x = v256;
+ if (check_union256h (a256, res_div))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vpopcntdq-pr97770-1.c b/gcc/testsuite/gcc.target/i386/avx512vpopcntdq-pr97770-1.c
index 63bb00d..dedd2e4 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vpopcntdq-pr97770-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vpopcntdq-pr97770-1.c
@@ -1,13 +1,12 @@
/* PR target/97770 */
/* { dg-do compile } */
-/* { dg-options "-O2 -mavx512vpopcntdq -mavx512vl -mprefer-vector-width=512" } */
+/* { dg-options "-O2 -march=icelake-server -mprefer-vector-width=512" } */
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */
-/* Add xfail since current vectorizor cannot generate expected code for DImode popcount */
-/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*xmm" 1 { xfail *-*-* } } } */
-/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*ymm" 1 { xfail *-*-* } } } */
-/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*zmm" 1 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */
#ifndef AVX512VPOPCNTQ_H_INCLUDED
#define AVX512VPOPCNTQ_H_INCLUDED
diff --git a/gcc/testsuite/gcc.target/i386/bitwise_mask_op-1.c b/gcc/testsuite/gcc.target/i386/bitwise_mask_op-1.c
index 61f71ab..826ed69 100644
--- a/gcc/testsuite/gcc.target/i386/bitwise_mask_op-1.c
+++ b/gcc/testsuite/gcc.target/i386/bitwise_mask_op-1.c
@@ -150,8 +150,6 @@ foo_notq (__m512i a, __m512i b, __m512i c, __m512i d)
return _mm512_mask_add_epi8 (c, ~m1, a, d);
}
-/* { dg-final { scan-assembler-times "knotq" "2" { target { ! ia32 } } } } */
-
__m512i
foo_notd (__m512i a, __m512i b, __m512i c, __m512i d)
{
@@ -159,8 +157,6 @@ foo_notd (__m512i a, __m512i b, __m512i c, __m512i d)
return _mm512_mask_add_epi16 (c, ~m1, a, d);
}
-/* { dg-final { scan-assembler-times "knotd" "2" { target { ! ia32 } } } } */
-
__m512i
foo_notw (__m512i a, __m512i b, __m512i c, __m512i d)
{
@@ -174,5 +170,3 @@ foo_notb (__m512i a, __m512i b, __m512i c, __m512i d)
__mmask8 m1 = _mm512_cmpeq_epi64_mask (a, b);
return _mm512_mask_add_epi64 (c, ~m1, a, d);
}
-
-/* { dg-final { scan-assembler-times "knotw" "4" } } */
diff --git a/gcc/testsuite/gcc.target/i386/bitwise_mask_op-2.c b/gcc/testsuite/gcc.target/i386/bitwise_mask_op-2.c
index 850f0b4..e93269b 100644
--- a/gcc/testsuite/gcc.target/i386/bitwise_mask_op-2.c
+++ b/gcc/testsuite/gcc.target/i386/bitwise_mask_op-2.c
@@ -1,7 +1,6 @@
/* PR target/88808 */
/* { dg-do compile } */
/* { dg-options "-mavx512bw -mavx512dq -O2" } */
-/* { dg-final { scan-assembler-times "knotb" "2" } } */
/* { dg-final { scan-assembler-times "korb" "1" } } */
/* { dg-final { scan-assembler-times "kxorb" "1" } } */
#include "bitwise_mask_op-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/bitwise_mask_op-3.c b/gcc/testsuite/gcc.target/i386/bitwise_mask_op-3.c
index 4a90786..352c49d 100644
--- a/gcc/testsuite/gcc.target/i386/bitwise_mask_op-3.c
+++ b/gcc/testsuite/gcc.target/i386/bitwise_mask_op-3.c
@@ -12,7 +12,7 @@ foo_orb (__m512i a, __m512i b)
foo = m1 | m2;
}
-/* { dg-final { scan-assembler-times "korb\[\t \]" "1" } } */
+/* { dg-final { scan-assembler-times "korb\[\t \]" "1" { xfail *-*-* } } } */
void
foo_xorb (__m512i a, __m512i b)
@@ -22,7 +22,7 @@ foo_xorb (__m512i a, __m512i b)
foo = m1 ^ m2;
}
-/* { dg-final { scan-assembler-times "kxorb\[\t \]" "1" } } */
+/* { dg-final { scan-assembler-times "kxorb\[\t \]" "1" { xfail *-*-* } } } */
void
foo_andb (__m512i a, __m512i b)
@@ -40,4 +40,4 @@ foo_andnb (__m512i a, __m512i b)
foo = m1 & ~m2;
}
-/* { dg-final { scan-assembler-times "kmovb\[\t \]" "4"} } */
+/* { dg-final { scan-assembler-times "kmovb\[\t \]" "4" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/i386/blendv-1.c b/gcc/testsuite/gcc.target/i386/blendv-1.c
new file mode 100644
index 0000000..fcbbfb9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/blendv-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx2 -O2 -mno-avx512f" } */
+/* { dg-final { scan-assembler-times {pblendvb[\t ]*%xmm} 1 } } */
+/* { dg-final { scan-assembler-times {pblendvb[\t ]*%ymm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvps[\t ]*%xmm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvps[\t ]*%ymm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvpd[\t ]*%xmm} 1 } } */
+/* { dg-final { scan-assembler-times {blendvpd[\t ]*%ymm} 1 } } */
+
+typedef float v4sf __attribute__ ((vector_size (16)));
+typedef float v8sf __attribute__ ((vector_size (32)));
+typedef double v2df __attribute__ ((vector_size (16)));
+typedef double v4df __attribute__ ((vector_size (32)));
+typedef char v16qi __attribute__ ((vector_size (16)));
+typedef char v32qi __attribute__ ((vector_size (32)));
+
+v4sf
+foo (v4sf a, v4sf b, v4sf c)
+{
+ return __builtin_ia32_blendvps (a, b, c);
+}
+
+v8sf
+foo2 (v8sf a, v8sf b, v8sf c)
+{
+ return __builtin_ia32_blendvps256 (a, b, c);
+}
+
+v2df
+foo3 (v2df a, v2df b, v2df c)
+{
+ return __builtin_ia32_blendvpd (a, b, c);
+}
+
+v4df
+foo4 (v4df a, v4df b, v4df c)
+{
+ return __builtin_ia32_blendvpd256 (a, b, c);
+}
+
+v16qi
+foo5 (v16qi a, v16qi b, v16qi c)
+{
+ return __builtin_ia32_pblendvb128 (a, b, c);
+}
+
+v32qi
+foo6 (v32qi a, v32qi b, v32qi c)
+{
+ return __builtin_ia32_pblendvb256 (a, b, c);
+}
diff --git a/gcc/testsuite/gcc.target/i386/blendv-2.c b/gcc/testsuite/gcc.target/i386/blendv-2.c
new file mode 100644
index 0000000..e61e023
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/blendv-2.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx2 -O2 -mno-avx512f" } */
+/* { dg-final { scan-assembler-not {pblendv} } } */
+/* { dg-final { scan-assembler-not {blendvp} } } */
+
+#include <x86intrin.h>
+__m128
+foo (__m128 a, __m128 b)
+{
+ return _mm_blendv_ps (a, b, _mm_setzero_ps ());
+}
+
+__m256
+foo2 (__m256 a, __m256 b)
+{
+ return _mm256_blendv_ps (a, b, _mm256_set1_ps (-1.0));
+}
+
+__m128d
+foo3 (__m128d a, __m128d b, __m128d c)
+{
+ return _mm_blendv_pd (a, b, _mm_set1_pd (1.0));
+}
+
+__m256d
+foo4 (__m256d a, __m256d b, __m256d c)
+{
+ return _mm256_blendv_pd (a, b, _mm256_set1_pd (-134.3));
+}
+
+__m128i
+foo5 (__m128i a, __m128i b, __m128i c)
+{
+ return _mm_blendv_epi8 (a, b, _mm_set1_epi8 (3));
+}
+
+__m256i
+foo6 (__m256i a, __m256i b, __m256i c)
+{
+ return _mm256_blendv_epi8 (a, b, _mm256_set1_epi8 (-22));
+}
diff --git a/gcc/testsuite/gcc.target/i386/bt-5.c b/gcc/testsuite/gcc.target/i386/bt-5.c
new file mode 100644
index 0000000..73e7ed2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/bt-5.c
@@ -0,0 +1,44 @@
+/* PR rtl-optimization/46235 */
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O2 -mtune=core2" } */
+
+int foo (int a, int x, int y)
+{
+ if (a & (1<<x))
+ return a;
+ return 1;
+}
+
+int bar_ww (int a, int x, int y, int z)
+{
+ return (a & (1<<x)) ? y : z;
+}
+
+int bar_lw (long long a, int x, int y, int z)
+{
+ return (a & (1LL<<x)) ? y : z;
+}
+
+long long bar_wl (int a, int x, long long y, long long z)
+{
+ return (a & (1<<x)) ? y : z;
+}
+
+long long bar_ll (long long a, int x, long long y, long long z)
+{
+ return (a & (1LL<<x)) ? y : z;
+}
+
+short bar_ws (int a, int x, short y, short z)
+{
+ return (a & (1<<x)) ? y : z;
+}
+
+short bar_ls (long long a, int x, short y, short z)
+{
+ return (a & (1LL<<x)) ? y : z;
+}
+
+/* { dg-final { scan-assembler-times "bt\[lq\]\[ \t\]" 7 } } */
+/* { dg-final { scan-assembler-not "sar\[lq\]\[ \t\]" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/bt-6.c b/gcc/testsuite/gcc.target/i386/bt-6.c
new file mode 100644
index 0000000..d4ef805
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/bt-6.c
@@ -0,0 +1,69 @@
+/* PR rtl-optimization/46235 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=core2" } */
+
+unsigned char set1_bb (unsigned char x, int y)
+{
+ return (x & (1<<y)) != 0;
+}
+
+unsigned char set2_bb (unsigned char x, int y)
+{
+ return (x >> y) & 1;
+}
+
+unsigned char set1_wb (int x, int y)
+{
+ return (x & (1<<y)) != 0;
+}
+
+unsigned char set2_wb (int x, int y)
+{
+ return (x >> y) & 1;
+}
+
+unsigned char clr1_bb (unsigned char x, int y)
+{
+ return (x & (1<<y)) == 0;
+}
+
+unsigned char clr2_bb (unsigned char x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+unsigned char clr1_wb (int x, int y)
+{
+ return (x & (1<<y)) == 0;
+}
+
+unsigned char clr2_wb (int x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+int clr1_bw (unsigned char x, int y)
+{
+ return (x & (1<<y)) == 0;
+}
+
+int clr2_bw (unsigned char x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+int clr1_ww (int x, int y)
+{
+ return (x & (1<<y)) == 0;
+}
+
+int clr2_ww (int x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+/* { dg-final { scan-assembler-times "bt\[lq\]\[ \t\]" 12 } } */
+/* { dg-final { scan-assembler-not "sar\[lq\]\[ \t\]" } } */
+/* { dg-final { scan-assembler-not "and\[lq\]\[ \t\]" } } */
+/* { dg-final { scan-assembler-not "not\[lq\]\[ \t\]" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/bt-7.c b/gcc/testsuite/gcc.target/i386/bt-7.c
new file mode 100644
index 0000000..292d741
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/bt-7.c
@@ -0,0 +1,69 @@
+/* PR rtl-optimization/46235 */
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O2 -mtune=core2" } */
+
+unsigned char set1_lb (long long x, int y)
+{
+ return (x & (1LL<<y)) != 0;
+}
+
+unsigned char set2_lb (long long x, int y)
+{
+ return (x >> y) & 1;
+}
+
+unsigned char clr1_lb (long long x, int y)
+{
+ return (x & (1LL<<y)) == 0;
+}
+
+unsigned char clr2_lb (long long x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+int clr1_lw (long long x, int y)
+{
+ return (x & (1LL<<y)) == 0;
+}
+
+int clr2_lw (long long x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+long long clr1_bl (unsigned char x, int y)
+{
+ return (x & (1<<y)) == 0;
+}
+
+long long clr2_bl (unsigned char x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+long long clr1_wl (int x, int y)
+{
+ return (x & (1<<y)) == 0;
+}
+
+long long clr2_wl (int x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+long long clr1_ll (long long x, int y)
+{
+ return (x & (1LL<<y)) == 0;
+}
+
+long long clr2_ll (long long x, int y)
+{
+ return !((x >> y) & 1);
+}
+
+/* { dg-final { scan-assembler-times "bt\[lq\]\[ \t\]" 12 } } */
+/* { dg-final { scan-assembler-not "sar\[lq\]\[ \t\]" } } */
+/* { dg-final { scan-assembler-not "and\[lq\]\[ \t\]" } } */
+/* { dg-final { scan-assembler-not "not\[lq\]\[ \t\]" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/builtin_target.c b/gcc/testsuite/gcc.target/i386/builtin_target.c
index aa96805..3e7505a 100644
--- a/gcc/testsuite/gcc.target/i386/builtin_target.c
+++ b/gcc/testsuite/gcc.target/i386/builtin_target.c
@@ -10,6 +10,8 @@
#include <stdlib.h>
#include "cpuid.h"
#define CHECK___builtin_cpu_is(cpu) assert (__builtin_cpu_is (cpu))
+#define CHECK___builtin_cpu_supports(isa) \
+ assert (__builtin_cpu_supports (isa))
#define gcc_assert(a) assert (a)
#define gcc_unreachable() abort ()
#define inline
diff --git a/gcc/testsuite/gcc.target/i386/cold-attribute-1.c b/gcc/testsuite/gcc.target/i386/cold-attribute-1.c
index 57666ac..658eb3e 100644
--- a/gcc/testsuite/gcc.target/i386/cold-attribute-1.c
+++ b/gcc/testsuite/gcc.target/i386/cold-attribute-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mno-avx" } */
#include <string.h>
static inline
__attribute__ ((cold)) void
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-1.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-1.c
new file mode 100644
index 0000000..c506fa5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-1.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_ADD" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_SUB" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MUL" "optimized" } } */
+#ifndef NUM
+#define NUM 800
+#endif
+#ifndef TYPE
+#define TYPE int
+#endif
+
+TYPE a[NUM], b[NUM], c[NUM], d[NUM], e[NUM], j[NUM];
+#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
+
+#define BIN(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = d[i] OP e[i]; \
+ else \
+ a[i] = MAX(d[i], e[i]); \
+ }
+
+
+BIN (add, +);
+BIN (sub, -);
+BIN (mul, *);
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-2.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-2.c
new file mode 100644
index 0000000..046804b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_d-2.c
@@ -0,0 +1,78 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "cond_op_addsubmul_d-1.c"
+#define BINO2(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = d[i] OP e[i]; \
+ else \
+ j[i] = MAX(d[i], e[i]); \
+ }
+
+BINO2 (add, +);
+BINO2 (sub, -);
+BINO2 (mul, *);
+
+static void
+test_256 (void)
+{
+ int sign = -1;
+ for (int i = 0; i != NUM; i++)
+ {
+ a[i] = 0;
+ d[i] = i * 2;
+ e[i] = i * i * 3 - i * 9 + 153;
+ b[i] = i * 83;
+ c[i] = b[i] + sign;
+ sign *= -1;
+ j[i] = 1;
+ }
+ foo_add ();
+ foo_o2_add ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo_sub ();
+ foo_o2_sub ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo_mul ();
+ foo_o2_mul ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+}
+
+static void
+test_128 ()
+{
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-1.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-1.c
new file mode 100644
index 0000000..5e25350
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-1.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=long -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_ADD" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_SUB" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MUL" "optimized" } } */
+#define AVX512DQ
+#include "cond_op_addsubmul_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-2.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-2.c
new file mode 100644
index 0000000..56245b1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_q-2.c
@@ -0,0 +1,6 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -mavx512dq -DTYPE=long" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512dq } */
+
+#include "cond_op_addsubmul_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-1.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-1.c
new file mode 100644
index 0000000..80d78d9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=short -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_ADD" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_SUB" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MUL" "optimized" } } */
+#include "cond_op_addsubmul_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-2.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-2.c
new file mode 100644
index 0000000..bdcd2ef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmul_w-2.c
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -mavx512bw -DTYPE=short" } */
+/* { dg-require-effective-target avx512bw } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512BW
+#include "cond_op_addsubmul_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-1.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-1.c
new file mode 100644
index 0000000..1092cba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-vect" } */
+/* { dg-final { scan-tree-dump ".COND_ADD" "vect" } } */
+/* { dg-final { scan-tree-dump ".COND_SUB" "vect" } } */
+/* { dg-final { scan-tree-dump ".COND_MUL" "vect" } } */
+/* { dg-final { scan-tree-dump ".COND_RDIV" "vect" } } */
+
+#ifndef NUM
+#define NUM 800
+#endif
+#ifndef TYPE
+#define TYPE double
+#endif
+
+TYPE a[NUM], b[NUM], c[NUM], d[NUM], e[NUM], j[NUM];
+
+#define BIN(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = d[i] OP e[i]; \
+ }
+
+
+BIN (add, +);
+BIN (sub, -);
+BIN (mul, *);
+BIN (div, /);
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-2.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-2.c
new file mode 100644
index 0000000..5ec38df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-2.c
@@ -0,0 +1,86 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "cond_op_addsubmuldiv_double-1.c"
+#define BINO2(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = d[i] OP e[i]; \
+ }
+
+
+BINO2 (add, +);
+BINO2 (sub, -);
+BINO2 (mul, *);
+BINO2 (div, /);
+
+static void
+test_256 (void)
+{
+ int sign = -1;
+ for (int i = 0; i != NUM; i++)
+ {
+ a[i] = 0.0;
+ d[i] = i * 0.5;
+ e[i] = i * i * 0.3 - i * 0.9 + 15.3;
+ b[i] = i * 0.83;
+ c[i] = b[i] + sign;
+ sign *= -1;
+ j[i] = b[i] < c[i] ? 1.0 : 0.0;
+ }
+ foo_add ();
+ foo_o2_add ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0.0;
+ j[i] = b[i] < c[i] ? 1.0 : 0.0;
+ }
+
+ foo_sub ();
+ foo_o2_sub ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0.0;
+ j[i] = b[i] < c[i] ? 1.0 : 0.0;
+ }
+
+ foo_mul ();
+ foo_o2_mul ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0.0;
+ j[i] = b[i] < c[i] ? 1.0 : 0.0;
+ }
+
+ foo_div ();
+ foo_o2_div ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ }
+}
+
+static void
+test_128 ()
+{
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-1.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-1.c
new file mode 100644
index 0000000..d497527
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=float -fdump-tree-vect" } */
+/* { dg-final { scan-tree-dump ".COND_ADD" "vect" } } */
+/* { dg-final { scan-tree-dump ".COND_SUB" "vect" } } */
+/* { dg-final { scan-tree-dump ".COND_MUL" "vect" } } */
+/* { dg-final { scan-tree-dump ".COND_RDIV" "vect" } } */
+
+#include "cond_op_addsubmuldiv_double-1.c"
+
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-2.c b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-2.c
new file mode 100644
index 0000000..c99c04c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_float-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=float" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_addsubmuldiv_double-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-1.c b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-1.c
new file mode 100644
index 0000000..8951f4a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-1.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_AND" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_XOR" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_IOR" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpxord" 1 } } */
+/* { dg-final { scan-assembler-times "vpord" 1 } } */
+/* { dg-final { scan-assembler-times "vpandd" 1 } } */
+
+typedef int int32;
+typedef unsigned int uint32;
+typedef long long int64;
+typedef unsigned long long uint64;
+
+#ifndef NUM
+#define NUM 800
+#endif
+#ifndef TYPE
+#define TYPE int
+#endif
+
+TYPE a[NUM], b[NUM], c[NUM], d[NUM], e[NUM], j[NUM];
+
+#define BIN(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = d[i] OP e[i]; \
+ else \
+ a[i] = d[i] - e[i]; \
+ }
+
+BIN (and, &);
+BIN (ior, |);
+BIN (xor, ^);
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-2.c b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-2.c
new file mode 100644
index 0000000..23ca412
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_d-2.c
@@ -0,0 +1,78 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "cond_op_anylogic_d-1.c"
+#define BINO2(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = d[i] OP e[i]; \
+ else \
+ j[i] = d[i] - e[i]; \
+ }
+
+BINO2 (and, &);
+BINO2 (ior, |);
+BINO2 (xor, ^);
+
+static void
+test_256 (void)
+{
+ int sign = -1;
+ for (int i = 0; i != NUM; i++)
+ {
+ a[i] = 0;
+ d[i] = i * 2;
+ e[i] = i * i * 3 - i * 9 + 153;
+ b[i] = i * 83;
+ c[i] = b[i] + sign;
+ sign *= -1;
+ j[i] = 1;
+ }
+ foo_and ();
+ foo_o2_and ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo_xor ();
+ foo_o2_xor ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo_ior ();
+ foo_o2_ior ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+}
+
+static void
+test_128 ()
+{
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-1.c b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-1.c
new file mode 100644
index 0000000..cb47701
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=int64 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_AND" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_XOR" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_IOR" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpxorq" 1 } } */
+/* { dg-final { scan-assembler-times "vporq" 1 } } */
+/* { dg-final { scan-assembler-times "vpandq" 1 } } */
+
+#include "cond_op_anylogic_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-2.c b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-2.c
new file mode 100644
index 0000000..709babf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_anylogic_q-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=int64" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_anylogic_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_fma_double-1.c b/gcc/testsuite/gcc.target/i386/cond_op_fma_double-1.c
new file mode 100644
index 0000000..4e14b75
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_fma_double-1.c
@@ -0,0 +1,87 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times ".COND_FMA" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_FNMA" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_FMS" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_FNMS" 3 "optimized" } } */
+/* { dg-final { scan-assembler-times "vfmadd132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd231pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmadd231pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmsub231pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmsub231pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+#ifndef NUM
+#define NUM 800
+#endif
+#ifndef TYPE
+#define TYPE double
+#endif
+#ifndef __BUILTIN_FMA
+#define __BUILTIN_FMA __builtin_fma
+#endif
+
+TYPE a[NUM], b[NUM], c[NUM], d[NUM], e[NUM], j[NUM];
+#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
+
+#define FMA3(OPNAME, OP1, OP2) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo3_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ { \
+ TYPE tmp = MAX(d[i], e[i]); \
+ if (b[i] < c[i]) \
+ a[i] = __BUILTIN_FMA (OP1 d[i], e[i], OP2 tmp); \
+ else \
+ a[i] = tmp; \
+ } \
+ }
+
+#define FMAZ(OPNAME, OP1, OP2) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ fooz_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = __BUILTIN_FMA (OP1 d[i], e[i], OP2 a[i]); \
+ else \
+ a[i] = .0; \
+ }
+
+#define FMA1(OPNAME, OP1, OP2) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo1_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = __BUILTIN_FMA (OP1 d[i], e[i], OP2 a[i]); \
+ else \
+ a[i] = d[i]; \
+ }
+
+
+FMAZ (fma,, +);
+FMAZ (fms,, -);
+FMAZ (fnma, -, +);
+FMAZ (fnms, -, -);
+
+FMA1 (fma,, +);
+FMA1 (fms,, -);
+FMA1 (fnma, -, +);
+FMA1 (fnms, -, -);
+
+FMA3 (fma,, +);
+FMA3 (fms,, -);
+FMA3 (fnma, -, +);
+FMA3 (fnms, -, -);
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_fma_double-2.c b/gcc/testsuite/gcc.target/i386/cond_op_fma_double-2.c
new file mode 100644
index 0000000..4c6514e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_fma_double-2.c
@@ -0,0 +1,208 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "cond_op_fma_double-1.c"
+#define FMA3_O2(OPNAME, OP1, OP2) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo3_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ { \
+ TYPE tmp = MAX(d[i], e[i]); \
+ if (b[i] < c[i]) \
+ j[i] = __BUILTIN_FMA (OP1 d[i], e[i], OP2 tmp); \
+ else \
+ j[i] = tmp; \
+ } \
+ }
+
+#define FMAZ_O2(OPNAME, OP1, OP2) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ fooz_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = __BUILTIN_FMA (OP1 d[i], e[i], OP2 a[i]); \
+ else \
+ j[i] = .0; \
+ }
+
+#define FMA1_O2(OPNAME, OP1, OP2) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo1_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = __BUILTIN_FMA (OP1 d[i], e[i], OP2 a[i]); \
+ else \
+ j[i] = d[i]; \
+ }
+
+FMAZ_O2 (fma,, +);
+FMAZ_O2 (fms,, -);
+FMAZ_O2 (fnma, -, +);
+FMAZ_O2 (fnms, -, -);
+
+FMA1_O2 (fma,, +);
+FMA1_O2 (fms,, -);
+FMA1_O2 (fnma, -, +);
+FMA1_O2 (fnms, -, -);
+
+FMA3_O2 (fma,, +);
+FMA3_O2 (fms,, -);
+FMA3_O2 (fnma, -, +);
+FMA3_O2 (fnms, -, -);
+
+static void
+test_256 (void)
+{
+ int sign = -1;
+ for (int i = 0; i != NUM; i++)
+ {
+ a[i] = 0;
+ d[i] = i * 2;
+ e[i] = i * i * 3 - i * 9 + 153;
+ b[i] = i * 83;
+ c[i] = b[i] + sign;
+ sign *= -1;
+ j[i] = 1;
+ }
+ foo1_o2_fma ();
+ /* foo1_fma need to be after foo1_o2_fma since
+ it changes a[i] which is used by foo1_o2_fma. */
+ foo1_fma ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo1_o2_fms ();
+ foo1_fms ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo1_o2_fnma ();
+ foo1_fnma ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo1_o2_fnms ();
+ foo1_fnms ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ fooz_o2_fma ();
+ fooz_fma ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ fooz_o2_fms ();
+ fooz_fms ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ fooz_o2_fnma ();
+ fooz_fnma ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ fooz_o2_fnms ();
+ fooz_fnms ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo3_o2_fma ();
+ foo3_fma ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo3_o2_fms ();
+ foo3_fms ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo3_o2_fnma ();
+ foo3_fnma ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo3_o2_fnms ();
+ foo3_fnms ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+}
+
+static void
+test_128 ()
+{
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_fma_float-1.c b/gcc/testsuite/gcc.target/i386/cond_op_fma_float-1.c
new file mode 100644
index 0000000..a5752e7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_fma_float-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=float -fdump-tree-optimized -D__BUILTIN_FMA=__builtin_fmaf" } */
+/* { dg-final { scan-tree-dump-times ".COND_FMA" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_FNMA" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_FMS" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_FNMS" 3 "optimized" } } */
+/* { dg-final { scan-assembler-times "vfmadd132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd231ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmadd231ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmsub231ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmsub231ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include "cond_op_fma_double-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_fma_float-2.c b/gcc/testsuite/gcc.target/i386/cond_op_fma_float-2.c
new file mode 100644
index 0000000..e13d377
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_fma_float-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=float -D__BUILTIN_FMA=__builtin_fmaf" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_fma_double-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-1.c
new file mode 100644
index 0000000..78c6600
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=int8 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxsb" 1 } } */
+/* { dg-final { scan-assembler-times "vpminsb" 1 } } */
+
+#include "cond_op_maxmin_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-2.c
new file mode 100644
index 0000000..8ba7a3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_b-2.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw -mprefer-vector-width=256 -DTYPE=int8" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "cond_op_maxmin_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-1.c
new file mode 100644
index 0000000..2543d36
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-1.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxsd" 1 } } */
+/* { dg-final { scan-assembler-times "vpminsd" 1 } } */
+
+typedef char int8;
+typedef unsigned char uint8;
+typedef short int16;
+typedef unsigned short uint16;
+typedef int int32;
+typedef unsigned int uint32;
+typedef long long int64;
+typedef unsigned long long uint64;
+
+#ifndef NUM
+#define NUM 800
+#endif
+#ifndef TYPE
+#define TYPE int
+#endif
+
+TYPE a[NUM], b[NUM], c[NUM], d[NUM], e[NUM], j[NUM];
+#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
+
+#define BIN(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = OP(d[i], e[i]); \
+ else \
+ a[i] = d[i] - e[i]; \
+ }
+
+BIN (max, MAX);
+BIN (min, MIN);
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-2.c
new file mode 100644
index 0000000..f715f54
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_d-2.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "cond_op_maxmin_d-1.c"
+#define BINO2(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = OP(d[i], e[i]); \
+ else \
+ j[i] = d[i] - e[i]; \
+ }
+
+BINO2 (max, MAX);
+BINO2 (min, MIN);
+
+static void
+test_256 (void)
+{
+ int sign = -1;
+ for (int i = 0; i != NUM; i++)
+ {
+ a[i] = 0;
+ d[i] = i * 2;
+ e[i] = i * i * 3 - i * 9 + 153;
+ b[i] = i * 83;
+ c[i] = b[i] + sign;
+ sign *= -1;
+ j[i] = 1;
+ }
+ foo_max ();
+ foo_o2_max ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo_min ();
+ foo_o2_min ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+}
+
+static void
+test_128 ()
+{
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-1.c
new file mode 100644
index 0000000..eda8e19
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-1.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vmaxpd" 1 } } */
+/* { dg-final { scan-assembler-times "vminpd" 1 } } */
+
+#include<math.h>
+#ifndef NUM
+#define NUM 800
+#endif
+#ifndef TYPE
+#define TYPE double
+#endif
+#ifndef FN_MAX
+#define FN_MAX fmax
+#endif
+#ifndef FN_MIN
+#define FN_MIN fmin
+#endif
+
+TYPE a[NUM], b[NUM], c[NUM], d[NUM], e[NUM], j[NUM];
+#define MAX FN_MAX
+#define MIN FN_MIN
+
+#define BIN(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("Ofast"))) \
+ foo_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = (OP (d[i], e[i])); \
+ else \
+ a[i] = d[i] - e[i]; \
+ }
+
+BIN (max, MAX);
+BIN (min, MIN);
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-2.c
new file mode 100644
index 0000000..c50a831
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_double-2.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -ffast-math" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "cond_op_maxmin_double-1.c"
+#define BINO2(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa)) \
+ foo_o2_##OPNAME () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = OP(d[i], e[i]); \
+ else \
+ j[i] = d[i] - e[i]; \
+ }
+
+BINO2 (max, MAX);
+BINO2 (min, MIN);
+
+static void
+test_256 (void)
+{
+ int sign = -1;
+ for (int i = 0; i != NUM; i++)
+ {
+ a[i] = 0;
+ d[i] = i * 2;
+ e[i] = i * i * 3 - i * 9 + 153;
+ b[i] = i * 83;
+ c[i] = b[i] + sign;
+ sign *= -1;
+ j[i] = 1;
+ }
+ foo_max ();
+ foo_o2_max ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo_min ();
+ foo_o2_min ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+}
+
+static void
+test_128 ()
+{
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-1.c
new file mode 100644
index 0000000..2d2157d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=float -fdump-tree-optimized -DFN_MAX=fmaxf -DFN_MIN=fminf" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vmaxps" 1 } } */
+/* { dg-final { scan-assembler-times "vminps" 1 } } */
+
+#include "cond_op_maxmin_double-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-2.c
new file mode 100644
index 0000000..fec784e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_float-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=float -DFN_MAX=fmaxf -DFN_MIN=fminf" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_maxmin_double-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-1.c
new file mode 100644
index 0000000..a1925c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=int64 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxsq" 1 } } */
+/* { dg-final { scan-assembler-times "vpminsq" 1 } } */
+
+#include "cond_op_maxmin_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-2.c
new file mode 100644
index 0000000..205a65a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_q-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=int64" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_maxmin_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-1.c
new file mode 100644
index 0000000..117179f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=uint8 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxub" 1 } } */
+/* { dg-final { scan-assembler-times "vpminub" 1 } } */
+
+#include "cond_op_maxmin_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-2.c
new file mode 100644
index 0000000..ac4a206
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ub-2.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw -mprefer-vector-width=256 -DTYPE=uint8" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "cond_op_maxmin_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-1.c
new file mode 100644
index 0000000..1ce0f82
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=uint32 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxud" 1 } } */
+/* { dg-final { scan-assembler-times "vpminud" 1 } } */
+
+#include "cond_op_maxmin_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-2.c
new file mode 100644
index 0000000..d609ef0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_ud-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=uint32" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_maxmin_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-1.c
new file mode 100644
index 0000000..82209f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=uint64 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxuq" 1 } } */
+/* { dg-final { scan-assembler-times "vpminuq" 1 } } */
+
+#include "cond_op_maxmin_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-2.c
new file mode 100644
index 0000000..c2053c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uq-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=uint64" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_maxmin_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-1.c
new file mode 100644
index 0000000..43d560d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=uint16 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxuw" 1 } } */
+/* { dg-final { scan-assembler-times "vpminuw" 1 } } */
+
+#include "cond_op_maxmin_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-2.c
new file mode 100644
index 0000000..463fc52
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_uw-2.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw -mprefer-vector-width=256 -DTYPE=uint16" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "cond_op_maxmin_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-1.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-1.c
new file mode 100644
index 0000000..d4d388e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -DTYPE=int16 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump ".COND_MAX" "optimized" } } */
+/* { dg-final { scan-tree-dump ".COND_MIN" "optimized" } } */
+/* { dg-final { scan-assembler-times "vpmaxsw" 1 } } */
+/* { dg-final { scan-assembler-times "vpminsw" 1 } } */
+
+#include "cond_op_maxmin_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-2.c b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-2.c
new file mode 100644
index 0000000..d6e45e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_maxmin_w-2.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw -mprefer-vector-width=256 -DTYPE=int16" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "cond_op_maxmin_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_d-1.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_d-1.c
new file mode 100644
index 0000000..af047b6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_d-1.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times ".COND_SHR" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_SHL" 2 "optimized" } } */
+/* { dg-final { scan-assembler-times "vpsrad" 1 } } */
+/* { dg-final { scan-assembler-times "vpslld" 1 } } */
+/* { dg-final { scan-assembler-times "vpsravd" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllvd" 1 } } */
+
+
+typedef short int16;
+typedef unsigned short uint16;
+typedef int int32;
+typedef unsigned int uint32;
+typedef long long int64;
+typedef unsigned long long uint64;
+
+#ifndef NUM
+#define NUM 800
+#endif
+#ifndef TYPE
+#define TYPE int
+#endif
+
+TYPE a[NUM], b[NUM], c[NUM], d[NUM], e[NUM], j[NUM];
+#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X,Y) ((X) < (Y) ? (Y) : (X))
+
+#define BINC(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo_##OPNAME##_const () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = d[i] OP 3; \
+ else \
+ a[i] = MAX(d[i], e[i]); \
+ }
+
+#define BINV(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O3"))) \
+ foo_##OPNAME##_variable () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ a[i] = d[i] OP e[i]; \
+ else \
+ a[i] = MAX(d[i], e[i]); \
+ }
+
+BINC (shl, <<);
+BINC (shr, >>);
+BINV (shl, <<);
+BINV (shr, >>);
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_d-2.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_d-2.c
new file mode 100644
index 0000000..449e5b4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_d-2.c
@@ -0,0 +1,102 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "cond_op_shift_d-1.c"
+
+#define BINO2C(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo_o2_##OPNAME##_const () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = d[i] OP 3; \
+ else \
+ j[i] = MAX(d[i], e[i]); \
+ }
+
+#define BINO2V(OPNAME, OP) \
+ void \
+ __attribute__ ((noipa,optimize ("O2"))) \
+ foo_o2_##OPNAME##_variable () \
+ { \
+ for (int i = 0; i != NUM; i++) \
+ if (b[i] < c[i]) \
+ j[i] = d[i] OP e[i]; \
+ else \
+ j[i] = MAX(d[i], e[i]); \
+ }
+
+BINO2C (shl, <<);
+BINO2C (shr, >>);
+BINO2V (shl, <<);
+BINO2V (shr, >>);
+
+static void
+test_256 (void)
+{
+ int sign = -1;
+ for (int i = 0; i != NUM; i++)
+ {
+ a[i] = 0;
+ d[i] = i * 2;
+ e[i] = (i * i * 3 - i * 9 + 6)%8;
+ b[i] = i * 83;
+ c[i] = b[i] + sign;
+ sign *= -1;
+ j[i] = 1;
+ }
+ foo_shl_const ();
+ foo_o2_shl_const ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo_shr_const ();
+ foo_o2_shr_const ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+
+ foo_shl_variable ();
+ foo_o2_shl_variable ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ b[i] = 1;
+ }
+
+ foo_shr_variable ();
+ foo_o2_shr_variable ();
+ for (int i = 0; i != NUM; i++)
+ {
+ if (a[i] != j[i])
+ abort ();
+ a[i] = 0;
+ j[i] = 1;
+ }
+}
+
+static void
+test_128 ()
+{
+
+}
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_q-1.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_q-1.c
new file mode 100644
index 0000000..1b981b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_q-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized -DTYPE=int64" } */
+/* { dg-final { scan-tree-dump-times ".COND_SHR" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_SHL" 2 "optimized" } } */
+/* { dg-final { scan-assembler-times "vpsravq" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllvq" 1 } } */
+/* { dg-final { scan-assembler-times "vpsravq" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllvq" 1 } } */
+
+
+#include "cond_op_shift_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_q-2.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_q-2.c
new file mode 100644
index 0000000..94f1d71
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_q-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=int64" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_shift_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_ud-1.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_ud-1.c
new file mode 100644
index 0000000..eea0f67
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_ud-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized -DTYPE=uint32" } */
+/* { dg-final { scan-tree-dump-times ".COND_SHR" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_SHL" 2 "optimized" } } */
+/* { dg-final { scan-assembler-times "vpsrlvd" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllvd" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrlvd" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllvd" 1 } } */
+
+#include "cond_op_shift_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_ud-2.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_ud-2.c
new file mode 100644
index 0000000..b18c568
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_ud-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=uint32" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_shift_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_uq-1.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_uq-1.c
new file mode 100644
index 0000000..77a0388
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_uq-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized -DTYPE=uint64" } */
+/* { dg-final { scan-tree-dump-times ".COND_SHR" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_SHL" 2 "optimized" } } */
+/* { dg-final { scan-assembler-times "vpsrlq" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllq" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrlq" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllq" 1 } } */
+
+#include "cond_op_shift_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_uq-2.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_uq-2.c
new file mode 100644
index 0000000..a9e0acf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_uq-2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256 -DTYPE=uint64" } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "cond_op_shift_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_uw-1.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_uw-1.c
new file mode 100644
index 0000000..b84cdd89
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_uw-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized -DTYPE=uint16" } */
+/* { dg-final { scan-tree-dump-times ".COND_SHR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_SHL" 1 "optimized" } } */
+/* { dg-final { scan-assembler-times "vpsrlw" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllw" 1 } } */
+
+#include "cond_op_shift_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_uw-2.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_uw-2.c
new file mode 100644
index 0000000..cfdece9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_uw-2.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw -mprefer-vector-width=256 -DTYPE=uint16" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "cond_op_shift_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_w-1.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_w-1.c
new file mode 100644
index 0000000..54c854f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_w-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -fdump-tree-optimized -DTYPE=int16" } */
+/* { dg-final { scan-tree-dump-times ".COND_SHR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times ".COND_SHL" 1 "optimized" } } */
+/* { dg-final { scan-assembler-times "vpsraw" 1 } } */
+/* { dg-final { scan-assembler-times "vpsllw" 1 } } */
+
+#include "cond_op_shift_d-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/cond_op_shift_w-2.c b/gcc/testsuite/gcc.target/i386/cond_op_shift_w-2.c
new file mode 100644
index 0000000..5776826
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cond_op_shift_w-2.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw -mprefer-vector-width=256 -DTYPE=int16" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "cond_op_shift_d-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/crc32-6.c b/gcc/testsuite/gcc.target/i386/crc32-6.c
new file mode 100644
index 0000000..464e344
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/crc32-6.c
@@ -0,0 +1,13 @@
+/* PR target/101549 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4 -mno-crc32" } */
+
+#include <immintrin.h>
+
+unsigned int
+test_mm_crc32_u8 (unsigned int CRC, unsigned char V)
+{
+ return _mm_crc32_u8 (CRC, V);
+}
+
+/* { dg-error "needs isa option -mcrc32" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/i386/dec-cmov-1.c b/gcc/testsuite/gcc.target/i386/dec-cmov-1.c
new file mode 100644
index 0000000..0eae63f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/dec-cmov-1.c
@@ -0,0 +1,105 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-march=pentiumpro -mregparm=3" { target ia32 } } */
+
+int foo_m1(int x)
+{
+ x--;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+int foo_m2(int x)
+{
+ x -= 2;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+int foo_p1(int x)
+{
+ x++;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+int foo_p2(int x)
+{
+ x += 2;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+
+#ifdef __x86_64__
+long long fool_m1(long long x)
+{
+ x--;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+long long fool_m2(long long x)
+{
+ x -= 2;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+long long fool_p1(long long x)
+{
+ x++;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+long long fool_p2(long long x)
+{
+ x += 2;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+#endif /* __X86_64__ */
+
+short foos_m1(short x)
+{
+ x--;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+short foos_m2(short x)
+{
+ x -= 2;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+short foos_p1(short x)
+{
+ x++;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+short foos_p2(short x)
+{
+ x += 2;
+ if (x == 0)
+ x = 16;
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "mov(l|q)\[ \\t\]*%(e|r)(cx|di), %(e|r)ax" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/dec-cmov-2.c b/gcc/testsuite/gcc.target/i386/dec-cmov-2.c
new file mode 100644
index 0000000..9fbccc3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/dec-cmov-2.c
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-march=core2 -mregparm=3" { target ia32 } } */
+
+int foo(int x)
+{
+ x--;
+ if (x == -1)
+ x = 16;
+ return x;
+}
+
+int bar(int x)
+{
+ if (x == 0)
+ x = 16;
+ else x--;
+ return x;
+}
+
+#ifdef __x86_64__
+long long fool(long long x)
+{
+ x--;
+ if (x == -1)
+ x = 16;
+ return x;
+}
+
+long long barl(long long x)
+{
+ if (x == 0)
+ x = 16;
+ else x--;
+ return x;
+}
+#endif
+
+short foos(short x)
+{
+ x--;
+ if (x == -1)
+ x = 16;
+ return x;
+}
+
+short bars(short x)
+{
+ if (x == 0)
+ x = 16;
+ else x--;
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "lea(l|q)" } } */
+/* { dg-final { scan-assembler-not "test(l|q|w)" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/divmod-9.c b/gcc/testsuite/gcc.target/i386/divmod-9.c
new file mode 100644
index 0000000..1515e69
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/divmod-9.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int foo (int x)
+{
+ return 100/x;
+}
+
+int bar(int x)
+{
+ return -100/x;
+}
+/* { dg-final { scan-assembler-not "(cltd|cdq)" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/eh_return-1.c b/gcc/testsuite/gcc.target/i386/eh_return-1.c
new file mode 100644
index 0000000..b21fd75
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/eh_return-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=haswell -mno-avx512f -mtune-ctrl=avx256_move_by_pieces" } */
+
+struct _Unwind_Context
+{
+ void *ra;
+ char array[48];
+};
+
+extern long uw_install_context_1 (struct _Unwind_Context *);
+
+void
+_Unwind_RaiseException (void)
+{
+ struct _Unwind_Context this_context, cur_context;
+ long offset = uw_install_context_1 (&this_context);
+ __builtin_memcpy (&this_context, &cur_context,
+ sizeof (struct _Unwind_Context));
+ void *handler = __builtin_frob_return_addr ((&cur_context)->ra);
+ uw_install_context_1 (&cur_context);
+ __builtin_eh_return (offset, handler);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/eh_return-2.c b/gcc/testsuite/gcc.target/i386/eh_return-2.c
new file mode 100644
index 0000000..f23f449
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/eh_return-2.c
@@ -0,0 +1,16 @@
+/* PR target/101772 */
+/* { dg-do compile } */
+/* { dg-additional-options "-O0 -march=x86-64 -mstackrealign" } */
+
+struct _Unwind_Context _Unwind_Resume_or_Rethrow_this_context;
+
+void offset (int);
+
+struct _Unwind_Context {
+ void *reg[7];
+} _Unwind_Resume_or_Rethrow() {
+ struct _Unwind_Context cur_contextcur_context =
+ _Unwind_Resume_or_Rethrow_this_context;
+ offset(0);
+ __builtin_eh_return ((long) offset, 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/float16-3a.c b/gcc/testsuite/gcc.target/i386/float16-3a.c
new file mode 100644
index 0000000..3846c8e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/float16-3a.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+_Float16
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times "vcvtsi2shl\[ \t\]+\[^\n\r]*%xmm0" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/float16-3b.c b/gcc/testsuite/gcc.target/i386/float16-3b.c
new file mode 100644
index 0000000..247dd6e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/float16-3b.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+_Float16
+foo (unsigned int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times "vcvtusi2shl\[ \t\]+\[^\n\r]*%xmm0" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/float16-4a.c b/gcc/testsuite/gcc.target/i386/float16-4a.c
new file mode 100644
index 0000000..6310825
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/float16-4a.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+_Float16
+foo (long long x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times "vcvtsi2shq\[ \t\]+\[^\n\r]*%xmm0" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/float16-4b.c b/gcc/testsuite/gcc.target/i386/float16-4b.c
new file mode 100644
index 0000000..828d853
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/float16-4b.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512fp16" } */
+
+_Float16
+foo (unsigned long long x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times "vcvtusi2shq\[ \t\]+\[^\n\r]*%xmm0" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/float16-5.c b/gcc/testsuite/gcc.target/i386/float16-5.c
new file mode 100644
index 0000000..ebc0af1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/float16-5.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -O2" } */
+_Float16
+foo (int a)
+{
+ union {
+ int a;
+ _Float16 b;
+ }c;
+ c.a = a;
+ return c.b;
+}
diff --git a/gcc/testsuite/gcc.target/i386/float16-6.c b/gcc/testsuite/gcc.target/i386/float16-6.c
new file mode 100644
index 0000000..3d2503c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/float16-6.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -O2 -mfpmath=sse -fdump-tree-gimple -fexcess-precision=16" } */
+/* { dg-final { scan-tree-dump-not "\\(float\\)" "gimple" } } */
+_Float16
+foo (_Float16 a, _Float16 b, _Float16 c)
+{
+ return a + b + c;
+}
diff --git a/gcc/testsuite/gcc.target/i386/float16-7.c b/gcc/testsuite/gcc.target/i386/float16-7.c
new file mode 100644
index 0000000..86641af
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/float16-7.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfpmath=387 -fexcess-precision=16" } */
+/* { dg-excess-errors "'-fexcess-precision=16' is not compatible with '-mfpmath=387'" } */
+_Float16
+foo (_Float16 a, _Float16 b)
+{
+ return a + b;/* { dg-error "'-fexcess-precision=16' is not compatible with '-mfpmath=387'" } */
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-2.c b/gcc/testsuite/gcc.target/i386/funcspec-2.c
index d607fbc..147f623 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-2.c
+++ b/gcc/testsuite/gcc.target/i386/funcspec-2.c
@@ -89,11 +89,11 @@ int main ()
/* { dg-final { scan-assembler "vfnmaddsd" } } */
/* { dg-final { scan-assembler "vfnmsubss" } } */
/* { dg-final { scan-assembler "vfnmsubsd" } } */
-/* { dg-final { scan-assembler "call\t(.*)flt_mul_add" } } */
-/* { dg-final { scan-assembler "call\t(.*)flt_mul_sub" } } */
-/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_add" } } */
-/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_sub" } } */
-/* { dg-final { scan-assembler "call\t(.*)dbl_mul_add" } } */
-/* { dg-final { scan-assembler "call\t(.*)dbl_mul_sub" } } */
-/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_add" } } */
-/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_sub" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_mul_sub" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_neg_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_neg_mul_sub" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_mul_sub" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_neg_mul_add" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_neg_mul_sub" } } */
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-3.c b/gcc/testsuite/gcc.target/i386/funcspec-3.c
index 613a1a0..8fb425b 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-3.c
+++ b/gcc/testsuite/gcc.target/i386/funcspec-3.c
@@ -63,6 +63,6 @@ int main ()
/* { dg-final { scan-assembler "popcntl" { target { ! *-*-darwin* } } } } */
/* { dg-final { scan-assembler "popcntq" { target { ! *-*-darwin* } } } } */
/* { dg-final { scan-assembler-times "popcnt" 2 { target *-*-darwin* } } } */
-/* { dg-final { scan-assembler "call\t(.*)sse4a_pop_i" } } */
-/* { dg-final { scan-assembler "call\t(.*)sse42_pop_l" } } */
-/* { dg-final { scan-assembler "call\t(.*)popcountdi2" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)sse4a_pop_i" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)sse42_pop_l" } } */
+/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)popcountdi2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
index 5d4800f..8499fdf 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc
+++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
@@ -79,6 +79,7 @@ extern void test_hreset (void) __attribute__((__target__("hreset")));
extern void test_keylocker (void) __attribute__((__target__("kl")));
extern void test_widekl (void) __attribute__((__target__("widekl")));
extern void test_avxvnni (void) __attribute__((__target__("avxvnni")));
+extern void test_avx512fp16 (void) __attribute__((__target__("avx512fp16")));
extern void test_no_sgx (void) __attribute__((__target__("no-sgx")));
extern void test_no_avx5124fmaps(void) __attribute__((__target__("no-avx5124fmaps")));
@@ -159,6 +160,7 @@ extern void test_no_hreset (void) __attribute__((__target__("no-hreset")));
extern void test_no_keylocker (void) __attribute__((__target__("no-kl")));
extern void test_no_widekl (void) __attribute__((__target__("no-widekl")));
extern void test_no_avxvnni (void) __attribute__((__target__("no-avxvnni")));
+extern void test_no_avx512fp16 (void) __attribute__((__target__("no-avx512fp16")));
extern void test_arch_nocona (void) __attribute__((__target__("arch=nocona")));
extern void test_arch_core2 (void) __attribute__((__target__("arch=core2")));
@@ -181,6 +183,7 @@ extern void test_arch_tigerlake (void) __attribute__((__target__("arch=
extern void test_arch_cooperlake (void) __attribute__((__target__("arch=cooperlake")));
extern void test_arch_sapphirerapids (void) __attribute__((__target__("arch=sapphirerapids")));
extern void test_arch_alderlake (void) __attribute__((__target__("arch=alderlake")));
+extern void test_arch_rocketlake (void) __attribute__((__target__("arch=rocketlake")));
extern void test_arch_k8 (void) __attribute__((__target__("arch=k8")));
extern void test_arch_k8_sse3 (void) __attribute__((__target__("arch=k8-sse3")));
extern void test_arch_opteron (void) __attribute__((__target__("arch=opteron")));
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-8.c b/gcc/testsuite/gcc.target/i386/funcspec-8.c
index 8bd95fc..f155411 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-8.c
+++ b/gcc/testsuite/gcc.target/i386/funcspec-8.c
@@ -8,6 +8,7 @@ typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
typedef int __m128w __attribute__ ((__vector_size__ (16), __may_alias__));
typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef char __m128qi __attribute__ ((__vector_size__ (16), __may_alias__));
#ifdef __SSE3__
#error "-msse3 should not be set for this test"
@@ -51,38 +52,38 @@ generic_psignd128 (__m128w a, __m128w b)
#error "-msse4.1 should not be set for this test"
#endif
-__m128d sse4_1_blendvpd (__m128d a, __m128d b, __m128d c) __attribute__((__target__("sse4.1")));
-__m128d generic_blendvpd (__m128d a, __m128d b, __m128d c);
+__m128 sse4_1_roundv4sf2 (__m128 a) __attribute__((__target__("sse4.1")));
+__m128 generic_roundv4sf2 (__m128 a);
-__m128d
-sse4_1_blendvpd (__m128d a, __m128d b, __m128d c)
+__m128
+sse4_1_roundv4sf2 (__m128 a)
{
- return __builtin_ia32_blendvpd (a, b, c);
+ return __builtin_ia32_roundps_az (a);
}
-__m128d
-generic_blendvpd (__m128d a, __m128d b, __m128d c)
+__m128
+generic_blendvpd (__m128 a)
{
- return __builtin_ia32_blendvpd (a, b, c); /* { dg-error "needs isa option" } */
+ return __builtin_ia32_roundps_az (a); /* { dg-error "needs isa option" } */
}
#ifdef __SSE4_2__
#error "-msse4.2 should not be set for this test"
#endif
-__m128i sse4_2_pcmpgtq (__m128i a, __m128i b) __attribute__((__target__("sse4.2")));
-__m128i generic_pcmpgtq (__m128i ab, __m128i b);
+__m128qi sse4_2_cmpistrm (__m128qi a, __m128qi b) __attribute__((__target__("sse4.2")));
+__m128qi generic_cmpistrm (__m128qi a, __m128qi b);
-__m128i
-sse4_2_pcmpgtq (__m128i a, __m128i b)
+__m128qi
+sse4_2_cmpistrm (__m128qi a, __m128qi b)
{
- return __builtin_ia32_pcmpgtq (a, b);
+ return __builtin_ia32_pcmpistrm128 (a, b, 0);
}
-__m128i
-generic_pcmpgtq (__m128i a, __m128i b)
+__m128qi
+generic_comistrm (__m128qi a, __m128qi b)
{
- return __builtin_ia32_pcmpgtq (a, b); /* { dg-error "needs isa option" } */
+ return __builtin_ia32_pcmpistrm128 (a, b, 0); /* { dg-error "needs isa option" } */
}
#ifdef __SSE4A__
diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
index 4deff93..b0d3dc3 100644
--- a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
+++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
@@ -6,7 +6,7 @@ typedef double v2df __attribute__((vector_size (16)));
static v2df __attribute__((noinline))
bar (v2df a)
{
- return a + (v2df){ 3.0, 3.0 };
+ return a + (v2df){ 3.0, 4.0 };
}
v2df __attribute__((noinline))
diff --git a/gcc/testsuite/gcc.target/i386/incoming-11.c b/gcc/testsuite/gcc.target/i386/incoming-11.c
index a830c96..4b82268 100644
--- a/gcc/testsuite/gcc.target/i386/incoming-11.c
+++ b/gcc/testsuite/gcc.target/i386/incoming-11.c
@@ -15,4 +15,4 @@ void f()
for (i = 0; i < 100; i++) q[i] = 1;
}
-/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
+/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c
index d134612..71111c3 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c
@@ -2,8 +2,10 @@
/* { dg-options "-mkl -O2" } */
/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
/* { dg-final { scan-assembler "aesdec128kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c
index 34736d2..30189d6 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c
@@ -2,8 +2,10 @@
/* { dg-options "-mkl -O2" } */
/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
/* { dg-final { scan-assembler "aesdec256kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c
index d23cf4b..93806e5 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c
@@ -9,6 +9,7 @@
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
/* { dg-final { scan-assembler "aesdecwide128kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
@@ -18,6 +19,14 @@
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm1, %xmm1" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm2, %xmm2" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm3, %xmm3" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm4, %xmm4" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm5, %xmm5" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm6, %xmm6" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm7, %xmm7" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c
index 44c3252..f9ccc82 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c
@@ -9,6 +9,7 @@
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
/* { dg-final { scan-assembler "aesdecwide256kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
@@ -18,6 +19,14 @@
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm1, %xmm1" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm2, %xmm2" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm3, %xmm3" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm4, %xmm4" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm5, %xmm5" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm6, %xmm6" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm7, %xmm7" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c
index 9ff4836..61a9cc2 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c
@@ -2,8 +2,10 @@
/* { dg-options "-mkl -O2" } */
/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
/* { dg-final { scan-assembler "aesenc128kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c
index 1c5e076..f8e6bb7 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c
@@ -2,8 +2,10 @@
/* { dg-options "-mkl -O2" } */
/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
/* { dg-final { scan-assembler "aesenc256kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c
index 9fb9c49..c0fcd28 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c
@@ -9,6 +9,7 @@
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
/* { dg-final { scan-assembler "aesencwide128kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
@@ -18,6 +19,14 @@
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm1, %xmm1" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm2, %xmm2" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm3, %xmm3" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm4, %xmm4" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm5, %xmm5" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm6, %xmm6" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm7, %xmm7" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c
index 125a787..31463a8 100644
--- a/gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c
@@ -9,6 +9,7 @@
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
/* { dg-final { scan-assembler "aesencwide256kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "j\[ez\]" } } */
/* { dg-final { scan-assembler "sete" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
@@ -18,6 +19,14 @@
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm1, %xmm1" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm2, %xmm2" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm3, %xmm3" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm4, %xmm4" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm5, %xmm5" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm6, %xmm6" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm7, %xmm7" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/m512-check.h b/gcc/testsuite/gcc.target/i386/m512-check.h
index 6befaf0..68e74fc 100644
--- a/gcc/testsuite/gcc.target/i386/m512-check.h
+++ b/gcc/testsuite/gcc.target/i386/m512-check.h
@@ -60,7 +60,24 @@ typedef union
__m512i x;
unsigned long long a[8];
} union512i_uq;
-
+
+typedef union
+{
+ __m128h x;
+ _Float16 a[8];
+} union128h;
+
+typedef union
+{
+ __m256h x;
+ _Float16 a[16];
+} union256h;
+
+typedef union
+{
+ __m512h x;
+ _Float16 a[32];
+} union512h;
CHECK_EXP (union512i_b, char, "%d")
CHECK_EXP (union512i_w, short, "%d")
@@ -115,3 +132,22 @@ CHECK_ROUGH_EXP (union256, float, "%f")
CHECK_ROUGH_EXP (union256d, double, "%f")
CHECK_ROUGH_EXP (union128, float, "%f")
CHECK_ROUGH_EXP (union128d, double, "%f")
+
+#ifdef AVX512FP16
+
+CHECK_EXP (union128h, _Float16, "%f")
+CHECK_EXP (union256h, _Float16, "%f")
+CHECK_EXP (union512h, _Float16, "%f")
+
+#ifndef ESP_FLOAT16
+#define ESP_FLOAT16 0.27
+#endif
+
+CHECK_FP_EXP (union128h, _Float16, ESP_FLOAT16, "%f")
+CHECK_FP_EXP (union256h, _Float16, ESP_FLOAT16, "%f")
+CHECK_FP_EXP (union512h, _Float16, ESP_FLOAT16, "%f")
+
+CHECK_ROUGH_EXP (union128h, _Float16, "%f")
+CHECK_ROUGH_EXP (union256h, _Float16, "%f")
+CHECK_ROUGH_EXP (union512h, _Float16, "%f")
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/mask-shift.c b/gcc/testsuite/gcc.target/i386/mask-shift.c
new file mode 100644
index 0000000..4cb6ef3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mask-shift.c
@@ -0,0 +1,83 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512dq -O2" } */
+
+#include<immintrin.h>
+void
+fooq (__m512i a, __m512i b, void* p)
+{
+ __mmask8 m1 = _mm512_cmpeq_epi64_mask (a, b);
+ m1 >>= 4;
+ _mm512_mask_storeu_epi64 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftrb} "1" } } */
+
+void
+food (__m512i a, __m512i b, void* p)
+{
+ __mmask16 m1 = _mm512_cmpeq_epi32_mask (a, b);
+ m1 >>= 8;
+ _mm512_mask_storeu_epi32 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftrw} "1" } } */
+
+void
+foow (__m512i a, __m512i b, void* p)
+{
+ __mmask32 m1 = _mm512_cmpeq_epi16_mask (a, b);
+ m1 >>= 16;
+ _mm512_mask_storeu_epi16 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftrd} "1" } } */
+
+void
+foob (__m512i a, __m512i b, void* p)
+{
+ __mmask64 m1 = _mm512_cmpeq_epi8_mask (a, b);
+ m1 >>= 32;
+ _mm512_mask_storeu_epi8 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftrq} "1" { target { ! ia32 } } } } */
+
+void
+fooq1 (__m512i a, __m512i b, void* p)
+{
+ __mmask8 m1 = _mm512_cmpeq_epi64_mask (a, b);
+ m1 <<= 4;
+ _mm512_mask_storeu_epi64 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftlb} "1" } } */
+
+void
+food1 (__m512i a, __m512i b, void* p)
+{
+ __mmask16 m1 = _mm512_cmpeq_epi32_mask (a, b);
+ m1 <<= 8;
+ _mm512_mask_storeu_epi32 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftlw} "1" } } */
+
+void
+foow1 (__m512i a, __m512i b, void* p)
+{
+ __mmask32 m1 = _mm512_cmpeq_epi16_mask (a, b);
+ m1 <<= 16;
+ _mm512_mask_storeu_epi16 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftld} "1" } } */
+
+void
+foob1 (__m512i a, __m512i b, void* p)
+{
+ __mmask64 m1 = _mm512_cmpeq_epi8_mask (a, b);
+ m1 <<= 32;
+ _mm512_mask_storeu_epi8 (p, m1, a);
+}
+
+/* { dg-final { scan-assembler-times {(?n)kshiftlq} "1" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c
new file mode 100644
index 0000000..970aa74
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mno-sse" } */
+/* { dg-final { scan-assembler "jmp\tmemcpy" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "call\tmemcpy" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep movsb" } } */
+
+void
+foo (char *dest, char *src)
+{
+ __builtin_memcpy (dest, src, 257);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c
new file mode 100644
index 0000000..b604194
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake" } */
+/* { dg-final { scan-assembler-not "jmp\tmemcpy" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "call\tmemcpy" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep movsb" } } */
+
+typedef unsigned char e_u8;
+
+#define MAXBC 8
+
+void MixColumn(e_u8 a[4][MAXBC], e_u8 BC)
+{
+ e_u8 b[4][MAXBC];
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < BC; j++) a[i][j] = b[i][j];
+}
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c
new file mode 100644
index 0000000..83c333b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=tigerlake -mno-sse" } */
+/* { dg-final { scan-assembler "jmp\tmemcpy" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "call\tmemcpy" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep movsb" } } */
+
+void
+foo (char *dest, char *src)
+{
+ __builtin_memcpy (dest, src, 257);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c
new file mode 100644
index 0000000..ed963de
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "jmp\tmemcpy" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "call\tmemcpy" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep movsb" } } */
+
+typedef unsigned char e_u8;
+
+#define MAXBC 8
+
+void MixColumn(e_u8 a[4][MAXBC], e_u8 BC)
+{
+ e_u8 b[4][MAXBC];
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < BC; j++) a[i][j] = b[i][j];
+}
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c
new file mode 100644
index 0000000..be66d6b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=tigerlake -mno-sse" } */
+/* { dg-final { scan-assembler "rep movsb" } } */
+
+void
+foo (char *dest, char *src)
+{
+ __builtin_memcpy (dest, src, 256);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c
new file mode 100644
index 0000000..e8fe0a6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=tigerlake" } */
+/* { dg-final { scan-assembler-not "jmp\tmemcpy" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "call\tmemcpy" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep movsb" } } */
+
+typedef unsigned char e_u8;
+
+#define MAXBC 8
+
+void MixColumn(e_u8 a[4][MAXBC], e_u8 BC)
+{
+ e_u8 b[4][MAXBC];
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < BC; j++) a[i][j] = b[i][j];
+}
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c
new file mode 100644
index 0000000..b0dc748
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mno-sse" } */
+/* { dg-final { scan-assembler "rep movsb" } } */
+
+void
+foo (char *dest, char *src)
+{
+ __builtin_memcpy (dest, src, 256);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-3.c b/gcc/testsuite/gcc.target/i386/memset-strategy-3.c
new file mode 100644
index 0000000..9ea1e1a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-3.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "jmp\tmemset" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "call\tmemset" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep stosb" } } */
+
+typedef unsigned char e_u8;
+
+#define MAXBC 8
+
+void MixColumn(e_u8 a[4][MAXBC], e_u8 BC)
+{
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < BC; j++) a[i][j] = 1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-4.c b/gcc/testsuite/gcc.target/i386/memset-strategy-4.c
new file mode 100644
index 0000000..00d82f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-4.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=tigerlake" } */
+/* { dg-final { scan-assembler-not "jmp\tmemset" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "call\tmemset" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep stosb" } } */
+
+typedef unsigned char e_u8;
+
+#define MAXBC 8
+
+void MixColumn(e_u8 a[4][MAXBC], e_u8 BC)
+{
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < BC; j++) a[i][j] = 1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-5.c b/gcc/testsuite/gcc.target/i386/memset-strategy-5.c
new file mode 100644
index 0000000..dc1de8e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-5.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=tigerlake -mno-sse" } */
+/* { dg-final { scan-assembler "jmp\tmemset" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "call\tmemset" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep stosb" } } */
+
+void
+foo (char *dest)
+{
+ __builtin_memset (dest, 0, 257);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-6.c b/gcc/testsuite/gcc.target/i386/memset-strategy-6.c
new file mode 100644
index 0000000..e51af3b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-6.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=tigerlake -mno-sse" } */
+/* { dg-final { scan-assembler "rep stosb" } } */
+
+void
+foo (char *dest)
+{
+ __builtin_memset (dest, 0, 256);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-7.c b/gcc/testsuite/gcc.target/i386/memset-strategy-7.c
new file mode 100644
index 0000000..07c2816
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-7.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mno-sse" } */
+/* { dg-final { scan-assembler "jmp\tmemset" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "call\tmemset" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep stosb" } } */
+
+void
+foo (char *dest)
+{
+ __builtin_memset (dest, 0, 257);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-8.c b/gcc/testsuite/gcc.target/i386/memset-strategy-8.c
new file mode 100644
index 0000000..52ea882
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-8.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mno-sse" } */
+/* { dg-final { scan-assembler "rep stosb" } } */
+
+void
+foo (char *dest)
+{
+ __builtin_memset (dest, 0, 256);
+}
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-9.c b/gcc/testsuite/gcc.target/i386/memset-strategy-9.c
new file mode 100644
index 0000000..d4db031
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-9.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake" } */
+/* { dg-final { scan-assembler-not "jmp\tmemset" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "call\tmemset" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "rep stosb" } } */
+
+typedef unsigned char e_u8;
+
+#define MAXBC 8
+
+void MixColumn(e_u8 a[4][MAXBC], e_u8 BC)
+{
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < BC; j++) a[i][j] = 1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/monitor-2.c b/gcc/testsuite/gcc.target/i386/monitor-2.c
new file mode 100644
index 0000000..96eeec0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/monitor-2.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mmwait -mgeneral-regs-only" } */
+
+/* Verify that they work in both 32bit and 64bit. */
+
+#include <x86gprintrin.h>
+
+void
+foo (char *p, int x, int y, int z)
+{
+ _mm_monitor (p, y, x);
+ _mm_mwait (z, y);
+}
+
+void
+bar (char *p, long x, long y, long z)
+{
+ _mm_monitor (p, y, x);
+ _mm_mwait (z, y);
+}
+
+void
+foo1 (char *p)
+{
+ _mm_monitor (p, 0, 0);
+ _mm_mwait (0, 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/mvc16.c b/gcc/testsuite/gcc.target/i386/mvc16.c
new file mode 100644
index 0000000..def6581
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mvc16.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-require-ifunc "" } */
+
+__attribute__((target_clones("arch=x86-64", "arch=x86-64-v2", "arch=x86-64-v3", "arch=x86-64-v4", "default")))
+int
+foo ()
+{
+ return 0;
+}
+
+int
+main ()
+{
+ return foo ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/mvc5.c b/gcc/testsuite/gcc.target/i386/mvc5.c
index 677f79f..0e02bf6 100644
--- a/gcc/testsuite/gcc.target/i386/mvc5.c
+++ b/gcc/testsuite/gcc.target/i386/mvc5.c
@@ -3,6 +3,10 @@
/* { dg-options "-fno-inline" } */
/* { dg-final { scan-assembler "foo,foo.resolver" } } */
+/* Verify that foo clones are not numbered. */
+/* { dg-final { scan-assembler "foo.default:" } } */
+/* { dg-final { scan-assembler "foo.avx:" } } */
+
__attribute__((target_clones("default","avx","avx2")))
int
foo ()
diff --git a/gcc/testsuite/gcc.target/i386/mvc7.c b/gcc/testsuite/gcc.target/i386/mvc7.c
index a3697ba..7fb9dde 100644
--- a/gcc/testsuite/gcc.target/i386/mvc7.c
+++ b/gcc/testsuite/gcc.target/i386/mvc7.c
@@ -1,7 +1,11 @@
/* { dg-do compile } */
/* { dg-require-ifunc "" } */
-/* { dg-final { scan-assembler "foo.resolver" } } */
-/* { dg-final { scan-assembler "avx" } } */
+
+/* Verify that foo clones are not numbered. */
+/* { dg-final { scan-assembler "foo.resolver," } } */
+/* { dg-final { scan-assembler "foo.default," } } */
+/* { dg-final { scan-assembler "foo.avx," } } */
+
/* { dg-final { scan-assembler "slm" } } */
/* { dg-final { scan-assembler "foo,foo.resolver" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-10.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-10.c
new file mode 100644
index 0000000..5faee21
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-10.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=sandybridge" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-11.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-11.c
new file mode 100644
index 0000000..b8917a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-11.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 64);
+}
+
+/* { dg-final { scan-assembler-times "movdqu\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-12.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-12.c
new file mode 100644
index 0000000..8a82baf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-12.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_move_by_pieces" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 64);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-13.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-13.c
new file mode 100644
index 0000000..97e6067
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-13.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mtune=generic" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 66);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu64\[ \\t\]+\[^\n\]*%zmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-14.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-14.c
new file mode 100644
index 0000000..7addc4c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-14.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 33);
+}
+
+/* { dg-final { scan-assembler-times "movdqu\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-15.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-15.c
new file mode 100644
index 0000000..4fb94ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-15.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_move_by_pieces" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-16.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-16.c
new file mode 100644
index 0000000..728eba5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-16.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 34);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c
new file mode 100644
index 0000000..3d248d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-7.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+void
+foo (int a1, int a2, int a3, int a4, int a5, int a6, char *dst, char *src)
+{
+ __builtin_memcpy (dst, src, 17);
+}
+
+/* { dg-final { scan-assembler-times "movdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c
new file mode 100644
index 0000000..c13a2be
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-8.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=generic" } */
+
+void
+foo (int a1, int a2, int a3, int a4, int a5, int a6, char *dst, char *src)
+{
+ __builtin_memcpy (dst, src, 18);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c b/gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c
new file mode 100644
index 0000000..238f88b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memcpy-9.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mtune=generic" } */
+
+void
+foo (int a1, int a2, int a3, int a4, int a5, int a6, char *dst, char *src)
+{
+ __builtin_memcpy (dst, src, 19);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-1.c b/gcc/testsuite/gcc.target/i386/pieces-memset-1.c
new file mode 100644
index 0000000..2b80326
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 64);
+}
+
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-10.c b/gcc/testsuite/gcc.target/i386/pieces-memset-10.c
new file mode 100644
index 0000000..a6390d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-10.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 64);
+}
+
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-11.c b/gcc/testsuite/gcc.target/i386/pieces-memset-11.c
new file mode 100644
index 0000000..3802eb7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-11.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 64);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-12.c b/gcc/testsuite/gcc.target/i386/pieces-memset-12.c
new file mode 100644
index 0000000..d9a10bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-12.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 66);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu64\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-13.c b/gcc/testsuite/gcc.target/i386/pieces-memset-13.c
new file mode 100644
index 0000000..7f2cd3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-13.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 33);
+}
+
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-14.c b/gcc/testsuite/gcc.target/i386/pieces-memset-14.c
new file mode 100644
index 0000000..10bc085
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-14.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-15.c b/gcc/testsuite/gcc.target/i386/pieces-memset-15.c
new file mode 100644
index 0000000..2123958
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-15.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-16.c b/gcc/testsuite/gcc.target/i386/pieces-memset-16.c
new file mode 100644
index 0000000..1c5d124
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-16.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 17);
+}
+
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-17.c b/gcc/testsuite/gcc.target/i386/pieces-memset-17.c
new file mode 100644
index 0000000..6cdb335
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-17.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 17);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-18.c b/gcc/testsuite/gcc.target/i386/pieces-memset-18.c
new file mode 100644
index 0000000..02f8898
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-18.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 18);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-19.c b/gcc/testsuite/gcc.target/i386/pieces-memset-19.c
new file mode 100644
index 0000000..7e9cf2e2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-19.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 64);
+}
+
+/* { dg-final { scan-assembler-times "pxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-2.c b/gcc/testsuite/gcc.target/i386/pieces-memset-2.c
new file mode 100644
index 0000000..4ebfc4d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 64);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-20.c b/gcc/testsuite/gcc.target/i386/pieces-memset-20.c
new file mode 100644
index 0000000..1dc4db1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-20.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 64);
+}
+
+/* { dg-final { scan-assembler-times "vpxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-21.c b/gcc/testsuite/gcc.target/i386/pieces-memset-21.c
new file mode 100644
index 0000000..d87d084
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-21.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 66);
+}
+
+/* { dg-final { scan-assembler-times "vpxor(?:d|)\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu(?:64|8)\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-22.c b/gcc/testsuite/gcc.target/i386/pieces-memset-22.c
new file mode 100644
index 0000000..5f3c454
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-22.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 33);
+}
+
+/* { dg-final { scan-assembler-times "pxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-23.c b/gcc/testsuite/gcc.target/i386/pieces-memset-23.c
new file mode 100644
index 0000000..9232864
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-23.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 33);
+}
+
+/* { dg-final { scan-assembler-times "vpxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-24.c b/gcc/testsuite/gcc.target/i386/pieces-memset-24.c
new file mode 100644
index 0000000..5243f27
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-24.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 33);
+}
+
+/* { dg-final { scan-assembler-times "vpxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-25.c b/gcc/testsuite/gcc.target/i386/pieces-memset-25.c
new file mode 100644
index 0000000..195ddb6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-25.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 17);
+}
+
+/* { dg-final { scan-assembler-times "pxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-26.c b/gcc/testsuite/gcc.target/i386/pieces-memset-26.c
new file mode 100644
index 0000000..13606b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-26.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 17);
+}
+
+/* { dg-final { scan-assembler-times "pxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-27.c b/gcc/testsuite/gcc.target/i386/pieces-memset-27.c
new file mode 100644
index 0000000..c764f6f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-27.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 17);
+}
+
+/* { dg-final { scan-assembler-times "vpxor(?:d|)\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu(?:64|8|)\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-28.c b/gcc/testsuite/gcc.target/i386/pieces-memset-28.c
new file mode 100644
index 0000000..83c2d3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-28.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 64);
+}
+
+/* { dg-final { scan-assembler-times "pcmpeqd\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-29.c b/gcc/testsuite/gcc.target/i386/pieces-memset-29.c
new file mode 100644
index 0000000..3b07a64
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-29.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 64);
+}
+
+/* { dg-final { scan-assembler-not "vpcmpeqd\[ \\t\]+\[^\n\]*%ymm" } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-3.c b/gcc/testsuite/gcc.target/i386/pieces-memset-3.c
new file mode 100644
index 0000000..2aed6db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512bw -mno-avx512vl -mavx512f -mtune=intel" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 66);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vinserti64x4\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu64\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-30.c b/gcc/testsuite/gcc.target/i386/pieces-memset-30.c
new file mode 100644
index 0000000..59595e6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-30.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mavx2 -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 64);
+}
+
+/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-31.c b/gcc/testsuite/gcc.target/i386/pieces-memset-31.c
new file mode 100644
index 0000000..f7b5d5b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-31.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 66);
+}
+
+/* { dg-final { scan-assembler-times "vpternlogd\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu64\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-32.c b/gcc/testsuite/gcc.target/i386/pieces-memset-32.c
new file mode 100644
index 0000000..c5ca0bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-32.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 33);
+}
+
+/* { dg-final { scan-assembler-times "pcmpeqd\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-33.c b/gcc/testsuite/gcc.target/i386/pieces-memset-33.c
new file mode 100644
index 0000000..6864622
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-33.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 33);
+}
+
+/* { dg-final { scan-assembler-not "vpcmpeqd\[ \\t\]+\[^\n\]*%ymm" } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-34.c b/gcc/testsuite/gcc.target/i386/pieces-memset-34.c
new file mode 100644
index 0000000..52a16a0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-34.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mavx2 -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 33);
+}
+
+/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-35.c b/gcc/testsuite/gcc.target/i386/pieces-memset-35.c
new file mode 100644
index 0000000..2b9a4da
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-35.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 34);
+}
+
+/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-36.c b/gcc/testsuite/gcc.target/i386/pieces-memset-36.c
new file mode 100644
index 0000000..d1f1263
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-36.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mavx2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 17);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-37.c b/gcc/testsuite/gcc.target/i386/pieces-memset-37.c
new file mode 100644
index 0000000..fd09bd1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-37.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mavx2 -mtune-ctrl=avx256_store_by_pieces" } */
+
+void
+foo (int a1, int a2, int a3, int a4, int a5, int a6, int x, char *dst)
+{
+ __builtin_memset (dst, x, 66);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-38.c b/gcc/testsuite/gcc.target/i386/pieces-memset-38.c
new file mode 100644
index 0000000..ed4a24a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-38.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mavx2 -mtune=sandybridge" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 33);
+}
+
+/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-39.c b/gcc/testsuite/gcc.target/i386/pieces-memset-39.c
new file mode 100644
index 0000000..0ed88b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-39.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512bw -mtune=generic" } */
+
+void
+foo (int a1, int a2, int a3, int a4, int a5, int a6, int x, char *dst)
+{
+ __builtin_memset (dst, x, 66);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* { dg-final { scan-assembler-not "vinserti64x4" } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\n\]*%zmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-4.c b/gcc/testsuite/gcc.target/i386/pieces-memset-4.c
new file mode 100644
index 0000000..9256919
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-4.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 33);
+}
+
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-40.c b/gcc/testsuite/gcc.target/i386/pieces-memset-40.c
new file mode 100644
index 0000000..4eda73e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-40.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mavx2 -mtune=sandybridge" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 66);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 4 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-41.c b/gcc/testsuite/gcc.target/i386/pieces-memset-41.c
new file mode 100644
index 0000000..f86b698
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-41.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=sandybridge" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-42.c b/gcc/testsuite/gcc.target/i386/pieces-memset-42.c
new file mode 100644
index 0000000..df0c122
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-42.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=sandybridge" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 33);
+}
+
+/* { dg-final { scan-assembler-times "vpxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-43.c b/gcc/testsuite/gcc.target/i386/pieces-memset-43.c
new file mode 100644
index 0000000..2f2179c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-43.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=sandybridge" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 33);
+}
+
+/* { dg-final { scan-assembler-times "vpcmpeqd\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 2 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-44.c b/gcc/testsuite/gcc.target/i386/pieces-memset-44.c
new file mode 100644
index 0000000..5986f8e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-44.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 48);
+}
+
+/* { dg-final { scan-assembler-times "vpxor\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-5.c b/gcc/testsuite/gcc.target/i386/pieces-memset-5.c
new file mode 100644
index 0000000..e2379df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-5.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-6.c b/gcc/testsuite/gcc.target/i386/pieces-memset-6.c
new file mode 100644
index 0000000..d795663
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-6.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=intel" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-7.c b/gcc/testsuite/gcc.target/i386/pieces-memset-7.c
new file mode 100644
index 0000000..fd15986
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-7.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 17);
+}
+
+/* { dg-final { scan-assembler-times "movups\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-8.c b/gcc/testsuite/gcc.target/i386/pieces-memset-8.c
new file mode 100644
index 0000000..7df0019
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-8.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx2 -mavx -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 17);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-9.c b/gcc/testsuite/gcc.target/i386/pieces-memset-9.c
new file mode 100644
index 0000000..1ead154
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pieces-memset-9.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64 -mavx512f -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int x)
+{
+ __builtin_memset (dst, x, 17);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* No need to dynamically realign the stack here. */
+/* { dg-final { scan-assembler-not "and\[^\n\r]*%\[re\]sp" } } */
+/* Nor use a frame pointer. */
+/* { dg-final { scan-assembler-not "%\[re\]bp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100066.c b/gcc/testsuite/gcc.target/i386/pr100066.c
new file mode 100644
index 0000000..a795864
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100066.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { int128 } } } */
+/* { dg-options "-O1 -w" } */
+int pm;
+
+void
+w3 (int, int, int);
+
+void
+e6 (__int128 rt, long int mo)
+{
+ mo += rt / 0;
+ w3 (pm / mo, pm, 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100093.c b/gcc/testsuite/gcc.target/i386/pr100093.c
new file mode 100644
index 0000000..f32a4bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100093.c
@@ -0,0 +1,12 @@
+/* PR target/100093 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=znver1" } */
+/* { dg-final { scan-assembler-not "vextractf128" } } */
+
+__attribute__((target("tune=skylake-avx512")))
+void fill_avx2(double *__restrict__ data, int n, double value)
+{
+ for (int i = 0; i < n * 16; i++) {
+ data[i] = value;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100119.c b/gcc/testsuite/gcc.target/i386/pr100119.c
new file mode 100644
index 0000000..be9472e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100119.c
@@ -0,0 +1,28 @@
+/* PR target/100119 */
+/* { dg-do run { target sse2_runtime } } */
+/* { dg-require-effective-target fenv } */
+/* { dg-options "-O2 -frounding-math -msse2 -mno-avx512f -mfpmath=sse" } */
+
+#include <fenv.h>
+
+double
+__attribute__((noinline))
+test (unsigned int x)
+{
+ return x;
+}
+
+int
+main ()
+{
+ double result;
+
+ fesetround (FE_DOWNWARD);
+
+ result = test (0);
+
+ if (__builtin_signbit (result) != 0)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100182.c b/gcc/testsuite/gcc.target/i386/pr100182.c
new file mode 100644
index 0000000..2f92a04
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100182.c
@@ -0,0 +1,30 @@
+/* { dg-do run { target ia32 } } */
+/* { dg-options "-O2 -march=i686" } */
+
+struct S { double _M_fp; };
+union U { double d; unsigned long long int l; };
+
+void
+__attribute__((noipa))
+foo (void)
+{
+ struct S a0, a1;
+ union U u;
+ double d0, d1;
+ a0._M_fp = 0.0;
+ a1._M_fp = 1.0;
+ __atomic_store_8 (&a0._M_fp, __atomic_load_8 (&a1._M_fp, __ATOMIC_SEQ_CST), __ATOMIC_SEQ_CST);
+ u.l = __atomic_load_8 (&a0._M_fp, __ATOMIC_SEQ_CST);
+ d0 = u.d;
+ u.l = __atomic_load_8 (&a1._M_fp, __ATOMIC_SEQ_CST);
+ d1 = u.d;
+ if (d0 != d1)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100310.c b/gcc/testsuite/gcc.target/i386/pr100310.c
new file mode 100644
index 0000000..54ace18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100310.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+#include <immintrin.h>
+
+double *p;
+volatile __m512d x;
+volatile __mmask8 m;
+
+void foo()
+{
+ x = _mm512_mask_expandloadu_pd (x, 255, p);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100342.c b/gcc/testsuite/gcc.target/i386/pr100342.c
new file mode 100644
index 0000000..8e2ec82
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100342.c
@@ -0,0 +1,70 @@
+/* PR rtl-optimization/100342 */
+/* { dg-do run { target int128 } } */
+/* { dg-options "-O2 -fno-dse -fno-forward-propagate -Wno-psabi -mno-sse2" } */
+
+#define SHL(x, y) ((x) << ((y) & (sizeof(x) * 8 - 1)))
+#define SHR(x, y) ((x) >> ((y) & (sizeof(x) * 8 - 1)))
+#define ROR(x, y) (SHR(x, y)) | (SHL(x, (sizeof(x) * 8 - (y))))
+#define SHLV(x, y) ((x) << ((y) & (sizeof((x)[0]) * 8 - 1)))
+#define SHLSV(x, y) ((x) << ((y) & (sizeof((y)[0]) * 8 - 1)))
+typedef unsigned char A;
+typedef unsigned char __attribute__((__vector_size__ (8))) B;
+typedef unsigned char __attribute__((__vector_size__ (16))) C;
+typedef unsigned char __attribute__((__vector_size__ (32))) D;
+typedef unsigned char __attribute__((__vector_size__ (64))) E;
+typedef unsigned short F;
+typedef unsigned short __attribute__((__vector_size__ (16))) G;
+typedef unsigned int H;
+typedef unsigned int __attribute__((__vector_size__ (32))) I;
+typedef unsigned long long J;
+typedef unsigned long long __attribute__((__vector_size__ (8))) K;
+typedef unsigned long long __attribute__((__vector_size__ (32))) L;
+typedef unsigned long long __attribute__((__vector_size__ (64))) M;
+typedef unsigned __int128 N;
+typedef unsigned __int128 __attribute__((__vector_size__ (16))) O;
+typedef unsigned __int128 __attribute__((__vector_size__ (32))) P;
+typedef unsigned __int128 __attribute__((__vector_size__ (64))) Q;
+B v1;
+D v2;
+L v3;
+K v4;
+I v5;
+O v6;
+
+B
+foo (A a, C b, E c, F d, G e, H f, J g, M h, N i, P j, Q k)
+{
+ b &= (A) f;
+ k += a;
+ G l = e;
+ D m = v2 >= (A) (J) v1;
+ J r = a + g;
+ L n = v3 <= f;
+ k -= i / f;
+ l -= (A) g;
+ c |= (A) d;
+ b -= (A) i;
+ J o = ROR (__builtin_clz (r), a);
+ K p = v4 | f, q = v4 <= f;
+ P s = SHLV (SHLSV (__builtin_bswap64 (i), (P) (0 < j)) <= 0, j);
+ n += a <= r;
+ M t = (M) (a / SHLV (c, 0)) != __builtin_bswap64 (i);
+ I u = f - v5;
+ E v = (E) h + (E) t + (E) k;
+ D w = (union { D b[2]; }) { }.b[0] + ((union { E b; }) v).b[1] + m + (D) u + (D) n + (D) s;
+ C x = ((union { D b; }) w).b[1] + b + (C) l + (C) v6;
+ B y = ((union { C a; B b; }) x).b + ((union { C a; B b[2]; }) x).b[1] + (B) p + (B) q;
+ J z = i + o;
+ F z2 = z;
+ A z3 = z2;
+ return y + z3;
+}
+
+int
+main ()
+{
+ B x = foo (0, (C) { }, (E) { }, 10, (G) { }, 4, 2, (M) { }, 123842323652213865LL, (P) { 1 }, (Q) { });
+ if ((J) x != 0x2e2c2e2c2e2c2e30ULL)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100445-1.c b/gcc/testsuite/gcc.target/i386/pr100445-1.c
new file mode 100644
index 0000000..a1c18af
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100445-1.c
@@ -0,0 +1,5 @@
+/* PR target/100445 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512vl" } */
+
+#include "pr96827.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr100445.c b/gcc/testsuite/gcc.target/i386/pr100445.c
new file mode 100644
index 0000000..2f54fec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100445.c
@@ -0,0 +1,12 @@
+/* PR target/100445 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mxop" } */
+
+int a, b[3];
+
+void
+foo (void)
+{
+ for (; a < 3; a++)
+ b[a] = (a - 1) / 2;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100504.c b/gcc/testsuite/gcc.target/i386/pr100504.c
new file mode 100644
index 0000000..2910dfb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100504.c
@@ -0,0 +1,7 @@
+/* PR middle-end/100504 */
+/* { dg-do compile } */
+
+__attribute__((target_clones(0)))
+foo()
+{ /* { dg-error ".target_clones. attribute argument not a string constant" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100549.c b/gcc/testsuite/gcc.target/i386/pr100549.c
new file mode 100644
index 0000000..83bba3c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100549.c
@@ -0,0 +1,108 @@
+/* PR target/100549 */
+/* { dg-do compile } */
+/* { dg-options "-O -mavx2" } */
+
+typedef char v16qi __attribute__ ((vector_size (16)));
+typedef char v32qi __attribute__ ((vector_size (32)));
+typedef short v8hi __attribute__ ((vector_size (16)));
+typedef short v16hi __attribute__ ((vector_size (32)));
+typedef int v4si __attribute__ ((vector_size (16)));
+typedef int v8si __attribute__ ((vector_size (32)));
+typedef long long v2di __attribute__ ((vector_size (16)));
+typedef long long v4di __attribute__ ((vector_size (32)));
+
+v16qi
+f1 (v16qi a)
+{
+ return __builtin_ia32_pcmpeqb128 (a, a);
+}
+
+v8hi
+f2 (v8hi a)
+{
+ return __builtin_ia32_pcmpeqw128 (a, a);
+}
+
+v4si
+f3 (v4si a)
+{
+ return __builtin_ia32_pcmpeqd128 (a, a);
+}
+
+v2di
+f4 (v2di a)
+{
+ return __builtin_ia32_pcmpeqq (a, a);
+}
+
+v16qi
+f5 (v16qi a)
+{
+ return __builtin_ia32_pcmpgtb128 (a, a);
+}
+
+v8hi
+f6 (v8hi a)
+{
+ return __builtin_ia32_pcmpgtw128 (a, a);
+}
+
+v4si
+f7 (v4si a)
+{
+ return __builtin_ia32_pcmpgtd128 (a, a);
+}
+
+v2di
+f8 (v2di a)
+{
+ return __builtin_ia32_pcmpgtq (a, a);
+}
+
+v32qi
+f9 (v32qi a)
+{
+ return __builtin_ia32_pcmpeqb256 (a, a);
+}
+
+v16hi
+f10 (v16hi a)
+{
+ return __builtin_ia32_pcmpeqw256 (a, a);
+}
+
+v8si
+f11 (v8si a)
+{
+ return __builtin_ia32_pcmpeqd256 (a, a);
+}
+
+v4di
+f12 (v4di a)
+{
+ return __builtin_ia32_pcmpeqq256 (a, a);
+}
+
+v32qi
+f13 (v32qi a)
+{
+ return __builtin_ia32_pcmpgtb256 (a, a);
+}
+
+v16hi
+f14 (v16hi a)
+{
+ return __builtin_ia32_pcmpgtw256 (a, a);
+}
+
+v8si
+f15 (v8si a)
+{
+ return __builtin_ia32_pcmpgtd256 (a, a);
+}
+
+v4di
+f16 (v4di a)
+{
+ return __builtin_ia32_pcmpgtq256 (a, a);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100582.c b/gcc/testsuite/gcc.target/i386/pr100582.c
new file mode 100644
index 0000000..1a8e9eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100582.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2" } */
+
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+
+v32qi
+f2 (v32qi x, v32qi a, v32qi b)
+{
+ v32qi e;
+ for (int i = 0; i != 32; i++)
+ e[i] = x[i] ? a[i] : b[i];
+
+ return e;
+}
+
+/* { dg-final { scan-assembler-times "pblend" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1b.c b/gcc/testsuite/gcc.target/i386/pr100637-1b.c
new file mode 100644
index 0000000..3e7445a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-1b.c
@@ -0,0 +1,25 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -dp" } */
+
+typedef char __v4qi __attribute__ ((__vector_size__ (4)));
+
+__v4qi and (__v4qi a, __v4qi b) { return a & b; };
+/* { dg-final { scan-assembler "andv4qi3" } } */
+
+__v4qi andn (__v4qi a, __v4qi b) { return a & ~b; };
+/* { dg-final { scan-assembler "andnotv4qi3" } } */
+
+__v4qi or (__v4qi a, __v4qi b) { return a | b; };
+/* { dg-final { scan-assembler "iorv4qi3" } } */
+
+__v4qi xor (__v4qi a, __v4qi b) { return a ^ b; };
+__v4qi not (__v4qi a) { return ~a; };
+/* { dg-final { scan-assembler-times "xorv4qi3" 2 } } */
+
+__v4qi plus (__v4qi a, __v4qi b) { return a + b; };
+/* { dg-final { scan-assembler "addv4qi3" } } */
+
+__v4qi minus (__v4qi a, __v4qi b) { return a - b; };
+__v4qi neg (__v4qi a) { return -a; };
+/* { dg-final { scan-assembler-times "subv4qi3" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1w.c b/gcc/testsuite/gcc.target/i386/pr100637-1w.c
new file mode 100644
index 0000000..fe69640
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-1w.c
@@ -0,0 +1,38 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -dp" } */
+
+typedef short __v2hi __attribute__ ((__vector_size__ (4)));
+typedef unsigned short __v2hu __attribute__ ((__vector_size__ (4)));
+
+__v2hi and (__v2hi a, __v2hi b) { return a & b; };
+/* { dg-final { scan-assembler "andv2hi3" } } */
+
+__v2hi andn (__v2hi a, __v2hi b) { return a & ~b; };
+/* { dg-final { scan-assembler "andnotv2hi3" } } */
+
+__v2hi or (__v2hi a, __v2hi b) { return a | b; };
+/* { dg-final { scan-assembler "iorv2hi3" } } */
+
+__v2hi xor (__v2hi a, __v2hi b) { return a ^ b; };
+__v2hi not (__v2hi a) { return ~a; };
+/* { dg-final { scan-assembler-times "xorv2hi3" 2 } } */
+
+__v2hi plus (__v2hi a, __v2hi b) { return a + b; };
+/* { dg-final { scan-assembler "addv2hi3" } } */
+
+__v2hi minus (__v2hi a, __v2hi b) { return a - b; };
+__v2hi neg (__v2hi a) { return -a; };
+/* { dg-final { scan-assembler-times "subv2hi3" 2 } } */
+
+__v2hi mul (__v2hi a, __v2hi b) { return a * b; };
+/* { dg-final { scan-assembler "mulv2hi3" } } */
+
+__v2hi shl (__v2hi a, int b) { return a << b; };
+/* { dg-final { scan-assembler "ashlv2hi3" } } */
+
+__v2hi ashr (__v2hi a, int b) { return a >> b; };
+/* { dg-final { scan-assembler "ashrv2hi3" } } */
+
+__v2hu lshr (__v2hu a, int b) { return a >> b; };
+/* { dg-final { scan-assembler "lshrv2hi3" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-2b.c b/gcc/testsuite/gcc.target/i386/pr100637-2b.c
new file mode 100644
index 0000000..04480bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-2b.c
@@ -0,0 +1,21 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef char vec __attribute__((vector_size(4)));
+
+vec lt (vec a, vec b) { return a < b; }
+vec le (vec a, vec b) { return a <= b; }
+vec eq (vec a, vec b) { return a == b; }
+vec ne (vec a, vec b) { return a != b; }
+vec ge (vec a, vec b) { return a >= b; }
+vec gt (vec a, vec b) { return a > b; }
+
+typedef unsigned char uvec __attribute__((vector_size(4)));
+
+vec ltu (uvec a, uvec b) { return a < b; }
+vec leu (uvec a, uvec b) { return a <= b; }
+vec geu (uvec a, uvec b) { return a >= b; }
+vec gtu (uvec a, uvec b) { return a > b; }
+
+/* { dg-final { scan-assembler-not "cmpb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-2w.c b/gcc/testsuite/gcc.target/i386/pr100637-2w.c
new file mode 100644
index 0000000..fbbaac9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-2w.c
@@ -0,0 +1,21 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef short vec __attribute__((vector_size(4)));
+
+vec lt (vec a, vec b) { return a < b; }
+vec le (vec a, vec b) { return a <= b; }
+vec eq (vec a, vec b) { return a == b; }
+vec ne (vec a, vec b) { return a != b; }
+vec ge (vec a, vec b) { return a >= b; }
+vec gt (vec a, vec b) { return a > b; }
+
+typedef unsigned short uvec __attribute__((vector_size(4)));
+
+vec ltu (uvec a, uvec b) { return a < b; }
+vec leu (uvec a, uvec b) { return a <= b; }
+vec geu (uvec a, uvec b) { return a >= b; }
+vec gtu (uvec a, uvec b) { return a > b; }
+
+/* { dg-final { scan-assembler-not "cmpw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-3b.c b/gcc/testsuite/gcc.target/i386/pr100637-3b.c
new file mode 100644
index 0000000..b17f8b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-3b.c
@@ -0,0 +1,66 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -msse4" } */
+
+char r[4], a[4], b[4];
+unsigned char ur[4], ua[4], ub[4];
+
+void maxs (void)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ r[i] = a[i] > b[i] ? a[i] : b[i];
+}
+
+/* { dg-final { scan-assembler "pmaxsb" } } */
+
+void maxu (void)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ ur[i] = ua[i] > ub[i] ? ua[i] : ub[i];
+}
+
+/* { dg-final { scan-assembler "pmaxub" } } */
+
+void mins (void)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ r[i] = a[i] < b[i] ? a[i] : b[i];
+}
+
+/* { dg-final { scan-assembler "pminsb" } } */
+
+void minu (void)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ ur[i] = ua[i] < ub[i] ? ua[i] : ub[i];
+}
+
+/* { dg-final { scan-assembler "pminub" } } */
+
+void _abs (void)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ r[i] = a[i] < 0 ? -a[i] : a[i];
+}
+
+/* { dg-final { scan-assembler "pabsb" } } */
+
+void avgu (void)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ ur[i] = (ua[i] + ub[i] + 1) >> 1;
+}
+
+/* { dg-final { scan-assembler "pavgb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-3w.c b/gcc/testsuite/gcc.target/i386/pr100637-3w.c
new file mode 100644
index 0000000..4ea467b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-3w.c
@@ -0,0 +1,96 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -msse4 -fno-vect-cost-model" } */
+
+short r[2], a[2], b[2];
+unsigned short ur[2], ua[2], ub[2];
+
+void mulh (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ r[i] = ((int) a[i] * b[i]) >> 16;
+}
+
+/* { dg-final { scan-assembler "pmulhw" } } */
+
+void mulhu (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ ur[i] = ((unsigned int) ua[i] * ub[i]) >> 16;
+}
+
+/* { dg-final { scan-assembler "pmulhuw" } } */
+
+void mulhrs (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ r[i] = ((((int) a[i] * b[i]) >> 14) + 1) >> 1;
+}
+
+/* { dg-final { scan-assembler "pmulhrsw" } } */
+
+void maxs (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ r[i] = a[i] > b[i] ? a[i] : b[i];
+}
+
+/* { dg-final { scan-assembler "pmaxsw" } } */
+
+void maxu (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ ur[i] = ua[i] > ub[i] ? ua[i] : ub[i];
+}
+
+/* { dg-final { scan-assembler "pmaxuw" } } */
+
+void mins (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ r[i] = a[i] < b[i] ? a[i] : b[i];
+}
+
+/* { dg-final { scan-assembler "pminsw" } } */
+
+void minu (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ ur[i] = ua[i] < ub[i] ? ua[i] : ub[i];
+}
+
+/* { dg-final { scan-assembler "pminuw" } } */
+
+void _abs (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ r[i] = a[i] < 0 ? -a[i] : a[i];
+}
+
+/* { dg-final { scan-assembler "pabsw" } } */
+
+void avgu (void)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ ur[i] = (ua[i] + ub[i] + 1) >> 1;
+}
+
+/* { dg-final { scan-assembler "pavgw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-4b.c b/gcc/testsuite/gcc.target/i386/pr100637-4b.c
new file mode 100644
index 0000000..198e3dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-4b.c
@@ -0,0 +1,19 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -msse2" } */
+
+typedef char T;
+
+#define M 4
+
+extern T a[M], b[M], s1[M], s2[M], r[M];
+
+void foo (void)
+{
+ int j;
+
+ for (j = 0; j < M; j++)
+ r[j] = (a[j] < b[j]) ? s1[j] : s2[j];
+}
+
+/* { dg-final { scan-assembler "pcmpgtb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-4w.c b/gcc/testsuite/gcc.target/i386/pr100637-4w.c
new file mode 100644
index 0000000..0f5dacc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-4w.c
@@ -0,0 +1,19 @@
+/* PR target/100637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -msse2" } */
+
+typedef short T;
+
+#define M 2
+
+extern T a[M], b[M], s1[M], s2[M], r[M];
+
+void foo (void)
+{
+ int j;
+
+ for (j = 0; j < M; j++)
+ r[j] = (a[j] < b[j]) ? s1[j] : s2[j];
+}
+
+/* { dg-final { scan-assembler "pcmpgtw" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-5b.c b/gcc/testsuite/gcc.target/i386/pr100637-5b.c
new file mode 100644
index 0000000..3e6cc8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-5b.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef char S;
+typedef S V __attribute__((vector_size(4 * sizeof(S))));
+
+V duplicate (S a)
+{
+ return (V) { a, a, a, a };
+}
+
+V one_nonzero (S a)
+{
+ return (V) { 0, a };
+}
+
+V one_var (S a)
+{
+ return (V) { 1, a };
+}
+
+V general (S a, S b, S c, S d)
+{
+ return (V) { a, b, c, d };
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100637-5w.c b/gcc/testsuite/gcc.target/i386/pr100637-5w.c
new file mode 100644
index 0000000..3f67738
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100637-5w.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef short S;
+typedef S V __attribute__((vector_size(2 * sizeof(S))));
+
+V duplicate (S a)
+{
+ return (V) { a, a };
+}
+
+V one_nonzero (S a)
+{
+ return (V) { 0, a };
+}
+
+V one_var (S a)
+{
+ return (V) { 1, a };
+}
+
+V general (S a, S b)
+{
+ return (V) { a, b };
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100660.c b/gcc/testsuite/gcc.target/i386/pr100660.c
new file mode 100644
index 0000000..1112b74
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100660.c
@@ -0,0 +1,10 @@
+/* PR target/pr100660. */
+/* { dg-do compile } */
+/* { dg-options "-mavx2 -O" } */
+
+typedef char v16qi __attribute__ ((vector_size (16)));
+v16qi
+f5 (v16qi a, v16qi b)
+{
+ __builtin_ia32_pcmpgtb128 (a, b);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100701.c b/gcc/testsuite/gcc.target/i386/pr100701.c
new file mode 100644
index 0000000..3132d66
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100701.c
@@ -0,0 +1,28 @@
+/* PR target/100701 */
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-options "-O0 -fschedule-insns2 -msse2" } */
+
+typedef unsigned char __attribute__((__vector_size__ (8))) V;
+typedef unsigned int __attribute__((__vector_size__ (8))) U;
+
+U u;
+unsigned x;
+unsigned char y;
+
+V
+foo (V a, __int128 i)
+{
+ V b = a;
+ a &= y;
+ if (i == 0)
+ __builtin_abort ();
+ U c = (x != y / i) <= u;
+ return (V) c + a + b;
+}
+
+int
+main (void)
+{
+ (void)foo ((V) { }, 4);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100704-1.c b/gcc/testsuite/gcc.target/i386/pr100704-1.c
new file mode 100644
index 0000000..02461db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100704-1.c
@@ -0,0 +1,24 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -march=x86-64" } */
+
+struct S
+{
+ long long s1 __attribute__ ((aligned (8)));
+ unsigned s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
+};
+
+extern struct S a[];
+
+void bar (struct S);
+
+void
+foo (void)
+{
+ bar (a[0]);
+}
+
+/* { dg-final { scan-assembler-not "pushq" } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 32\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 48\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100704-2.c b/gcc/testsuite/gcc.target/i386/pr100704-2.c
new file mode 100644
index 0000000..07b9bd1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100704-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -march=x86-64" } */
+
+struct S
+{
+ char array[64];
+};
+
+extern struct S a[];
+
+void bar (struct S);
+
+void
+foo (void)
+{
+ bar (a[0]);
+}
+
+/* { dg-final { scan-assembler-not "pushq" } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 32\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 48\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100704-3.c b/gcc/testsuite/gcc.target/i386/pr100704-3.c
new file mode 100644
index 0000000..65f9745
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100704-3.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-sse" } */
+
+struct S
+{
+ long long s1 __attribute__ ((aligned (8)));
+ unsigned s2, s3;
+};
+
+extern struct S foooo[];
+
+void bar (int, int, int, int, int, int, struct S);
+
+void
+foo (void)
+{
+ bar (1, 2, 3, 4, 5, 6, foooo[0]);
+}
+
+/* { dg-final { scan-assembler "push\[lq\]\tfoooo\+" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100722.c b/gcc/testsuite/gcc.target/i386/pr100722.c
new file mode 100644
index 0000000..f784039
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100722.c
@@ -0,0 +1,17 @@
+/* PR target/100722 */
+/* { dg-do compile } */
+/* { dg-options "-O -msse2" } */
+
+typedef char int8x4_t __attribute__((vector_size(4)));
+
+void stack_callee (int8x4_t, int8x4_t, int8x4_t, int8x4_t,
+ int8x4_t, int8x4_t, int8x4_t);
+
+int8x4_t stack_caller_x1;
+
+void stack_caller (void)
+{
+ stack_callee (stack_caller_x1, stack_caller_x1, stack_caller_x1,
+ stack_caller_x1, stack_caller_x1, stack_caller_x1,
+ stack_caller_x1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-1.c b/gcc/testsuite/gcc.target/i386/pr100865-1.c
new file mode 100644
index 0000000..949dd5c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 16);
+}
+
+/* { dg-final { scan-assembler-times "movdqa\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-10a.c b/gcc/testsuite/gcc.target/i386/pr100865-10a.c
new file mode 100644
index 0000000..1d849a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-10a.c
@@ -0,0 +1,33 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern __int128 array[16];
+
+#define MK_CONST128_BROADCAST(A) \
+ ((((unsigned __int128) (unsigned char) A) << 120) \
+ | (((unsigned __int128) (unsigned char) A) << 112) \
+ | (((unsigned __int128) (unsigned char) A) << 104) \
+ | (((unsigned __int128) (unsigned char) A) << 96) \
+ | (((unsigned __int128) (unsigned char) A) << 88) \
+ | (((unsigned __int128) (unsigned char) A) << 80) \
+ | (((unsigned __int128) (unsigned char) A) << 72) \
+ | (((unsigned __int128) (unsigned char) A) << 64) \
+ | (((unsigned __int128) (unsigned char) A) << 56) \
+ | (((unsigned __int128) (unsigned char) A) << 48) \
+ | (((unsigned __int128) (unsigned char) A) << 40) \
+ | (((unsigned __int128) (unsigned char) A) << 32) \
+ | (((unsigned __int128) (unsigned char) A) << 24) \
+ | (((unsigned __int128) (unsigned char) A) << 16) \
+ | (((unsigned __int128) (unsigned char) A) << 8) \
+ | ((unsigned __int128) (unsigned char) A) )
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = MK_CONST128_BROADCAST (0x1f);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 8 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-10b.c b/gcc/testsuite/gcc.target/i386/pr100865-10b.c
new file mode 100644
index 0000000..e5616d8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-10b.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-10a.c"
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]%ymm\[0-9\]+, " 8 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-11a.c b/gcc/testsuite/gcc.target/i386/pr100865-11a.c
new file mode 100644
index 0000000..04ce166
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-11a.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake" } */
+
+extern __int128 array[16];
+
+#define MK_CONST128_BROADCAST(A) \
+ ((((unsigned __int128) (unsigned long long) A) << 64) \
+ | ((unsigned __int128) (unsigned long long) A) )
+
+#define MK_CONST128_BROADCAST_SIGNED(A) \
+ ((__int128) MK_CONST128_BROADCAST (A))
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = MK_CONST128_BROADCAST_SIGNED (-0x1ffffffffLL);
+}
+
+/* { dg-final { scan-assembler-times "movabsq" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpbroadcastq|vpunpcklqdq)\[\\t \]+\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-11b.c b/gcc/testsuite/gcc.target/i386/pr100865-11b.c
new file mode 100644
index 0000000..7e458e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-11b.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-11a.c"
+
+/* { dg-final { scan-assembler-times "movabsq" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa64\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-11c.c b/gcc/testsuite/gcc.target/i386/pr100865-11c.c
new file mode 100644
index 0000000..de56c84
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-11c.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake -mno-avx2" } */
+
+#include "pr100865-11a.c"
+
+/* { dg-final { scan-assembler-times "movabsq" 1 } } */
+/* { dg-final { scan-assembler-times "vpunpcklqdq\[\\t \]+\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-12a.c b/gcc/testsuite/gcc.target/i386/pr100865-12a.c
new file mode 100644
index 0000000..d4833d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-12a.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake" } */
+
+extern __int128 array[16];
+
+#define MK_CONST128_BROADCAST(A) \
+ ((((unsigned __int128) (unsigned long long) A) << 64) \
+ | ((unsigned __int128) (unsigned long long) A) )
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = MK_CONST128_BROADCAST (0x1ffffffffLL);
+}
+
+/* { dg-final { scan-assembler-times "movabsq" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vpbroadcastq|vpunpcklqdq)\[\\t \]+\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-12b.c b/gcc/testsuite/gcc.target/i386/pr100865-12b.c
new file mode 100644
index 0000000..dee0cfb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-12b.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-12a.c"
+
+/* { dg-final { scan-assembler-times "movabsq" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa64\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-12c.c b/gcc/testsuite/gcc.target/i386/pr100865-12c.c
new file mode 100644
index 0000000..77415f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-12c.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake -mno-avx2" } */
+
+#include "pr100865-12a.c"
+
+/* { dg-final { scan-assembler-times "movabsq" 1 } } */
+/* { dg-final { scan-assembler-times "vpunpcklqdq\[\\t \]+\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-2.c b/gcc/testsuite/gcc.target/i386/pr100865-2.c
new file mode 100644
index 0000000..f3ea775
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 16);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-3.c b/gcc/testsuite/gcc.target/i386/pr100865-3.c
new file mode 100644
index 0000000..714c43e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-3.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 3, 16);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-not "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-4a.c b/gcc/testsuite/gcc.target/i386/pr100865-4a.c
new file mode 100644
index 0000000..8609d11
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-4a.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char array[64];
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = -45;
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 2 } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-4b.c b/gcc/testsuite/gcc.target/i386/pr100865-4b.c
new file mode 100644
index 0000000..6d9cb91
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-4b.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+#include "pr100865-4a.c"
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]%ymm\[0-9\]+, " 2 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-not "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-5a.c b/gcc/testsuite/gcc.target/i386/pr100865-5a.c
new file mode 100644
index 0000000..4149797
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-5a.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake" } */
+
+extern short array[64];
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = -45;
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 4 } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-5b.c b/gcc/testsuite/gcc.target/i386/pr100865-5b.c
new file mode 100644
index 0000000..ded41b68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-5b.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-5a.c"
+
+/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu16\[\\t \]%ymm\[0-9\]+, " 4 } } */
+/* { dg-final { scan-assembler-not "vpbroadcastw\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-6a.c b/gcc/testsuite/gcc.target/i386/pr100865-6a.c
new file mode 100644
index 0000000..3fde549
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-6a.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake" } */
+
+extern int array[64];
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = -45;
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 8 } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-6b.c b/gcc/testsuite/gcc.target/i386/pr100865-6b.c
new file mode 100644
index 0000000..9588249
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-6b.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-6a.c"
+
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 8 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-not "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-6c.c b/gcc/testsuite/gcc.target/i386/pr100865-6c.c
new file mode 100644
index 0000000..46d3103
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-6c.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake -mno-avx2" } */
+
+extern int array[64];
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = -45;
+}
+
+/* { dg-final { scan-assembler-times "vbroadcastss" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 8 } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-7a.c b/gcc/testsuite/gcc.target/i386/pr100865-7a.c
new file mode 100644
index 0000000..f6f2be9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-7a.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake" } */
+
+extern long long int array[64];
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = -45;
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 16 } } */
+/* { dg-final { scan-assembler-not "vpbroadcastq" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vmovdqa" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-7b.c b/gcc/testsuite/gcc.target/i386/pr100865-7b.c
new file mode 100644
index 0000000..3b20c68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-7b.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-7a.c"
+
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %ymm\[0-9\]+" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 16 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-7c.c b/gcc/testsuite/gcc.target/i386/pr100865-7c.c
new file mode 100644
index 0000000..4d50bb7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-7c.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake -mno-avx2" } */
+
+extern long long int array[64];
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = -45;
+}
+
+/* { dg-final { scan-assembler-times "vbroadcastsd" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 16 } } */
+/* { dg-final { scan-assembler-not "vbroadcastsd" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vmovdqa" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-8a.c b/gcc/testsuite/gcc.target/i386/pr100865-8a.c
new file mode 100644
index 0000000..544a14d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-8a.c
@@ -0,0 +1,24 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake" } */
+
+extern __int128 array[16];
+
+#define MK_CONST128_BROADCAST(A) \
+ ((((unsigned __int128) (unsigned int) A) << 96) \
+ | (((unsigned __int128) (unsigned int) A) << 64) \
+ | (((unsigned __int128) (unsigned int) A) << 32) \
+ | ((unsigned __int128) (unsigned int) A) )
+
+#define MK_CONST128_BROADCAST_SIGNED(A) \
+ ((__int128) MK_CONST128_BROADCAST (A))
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = MK_CONST128_BROADCAST_SIGNED (-45);
+}
+
+/* { dg-final { scan-assembler-times "(?:vpbroadcastd|vpshufd)\[\\t \]+\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-8b.c b/gcc/testsuite/gcc.target/i386/pr100865-8b.c
new file mode 100644
index 0000000..4b7dd7c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-8b.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-8a.c"
+
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa64\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-8c.c b/gcc/testsuite/gcc.target/i386/pr100865-8c.c
new file mode 100644
index 0000000..efee048
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-8c.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake -mno-avx2" } */
+
+#include "pr100865-8a.c"
+
+/* { dg-final { scan-assembler-times "vpshufd\[\\t \]+\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-9a.c b/gcc/testsuite/gcc.target/i386/pr100865-9a.c
new file mode 100644
index 0000000..45d0e0d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-9a.c
@@ -0,0 +1,25 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake" } */
+
+extern __int128 array[16];
+
+#define MK_CONST128_BROADCAST(A) \
+ ((((unsigned __int128) (unsigned short) A) << 112) \
+ | (((unsigned __int128) (unsigned short) A) << 96) \
+ | (((unsigned __int128) (unsigned short) A) << 80) \
+ | (((unsigned __int128) (unsigned short) A) << 64) \
+ | (((unsigned __int128) (unsigned short) A) << 48) \
+ | (((unsigned __int128) (unsigned short) A) << 32) \
+ | (((unsigned __int128) (unsigned short) A) << 16) \
+ | ((unsigned __int128) (unsigned short) A) )
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; i < sizeof (array) / sizeof (array[0]); i++)
+ array[i] = MK_CONST128_BROADCAST (0x1fff);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-9b.c b/gcc/testsuite/gcc.target/i386/pr100865-9b.c
new file mode 100644
index 0000000..a315dde
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-9b.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include "pr100865-9a.c"
+
+/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa64\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-9c.c b/gcc/testsuite/gcc.target/i386/pr100865-9c.c
new file mode 100644
index 0000000..e6f2590
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100865-9c.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -march=skylake -mno-avx2" } */
+
+#include "pr100865-9a.c"
+
+/* { dg-final { scan-assembler-times "vpshufd\[\\t \]+\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100887.c b/gcc/testsuite/gcc.target/i386/pr100887.c
new file mode 100644
index 0000000..1bc6d38
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100887.c
@@ -0,0 +1,13 @@
+/* PR target/100887 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-mavx512f" } */
+
+typedef unsigned __int128 U __attribute__((__vector_size__ (64)));
+typedef unsigned __int128 V __attribute__((__vector_size__ (32)));
+typedef unsigned __int128 W __attribute__((__vector_size__ (16)));
+
+W
+foo (U u, V v)
+{
+ return __builtin_shufflevector (u, v, 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100936.c b/gcc/testsuite/gcc.target/i386/pr100936.c
new file mode 100644
index 0000000..c076cbb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100936.c
@@ -0,0 +1,34 @@
+/* PR target/100936 */
+/* { dg-do assemble } */
+/* { dg-options "-O2" } */
+
+__seg_gs int var;
+
+static int
+*foo (void)
+{
+ int *addr;
+
+ asm ("lea %p1, %0" : "=r"(addr) : "m"(var));
+
+ return addr;
+}
+
+static int
+bar (int *addr)
+{
+ int val;
+
+ asm ("mov %%gs:%1, %0" : "=r"(val) : "m"(*addr));
+
+ return val;
+}
+
+int
+baz (void)
+{
+ int *addr = foo();
+ int val = bar (addr);
+
+ return val;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr100951.c b/gcc/testsuite/gcc.target/i386/pr100951.c
new file mode 100644
index 0000000..16d8baf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100951.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -march=x86-64" } */
+
+typedef short __attribute__((__vector_size__ (8 * sizeof (short)))) V;
+V v, w;
+
+void
+foo (void)
+{
+ w = __builtin_shuffle (v != v, 0 < (V) {}, (V) {192} >> 5);
+}
+
+/* { dg-final { scan-assembler-not "punpcklwd" } } */
+/* { dg-final { scan-assembler-not "pshufd" } } */
+/* { dg-final { scan-assembler-times "pxor\[\\t \]%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101021-1.c b/gcc/testsuite/gcc.target/i386/pr101021-1.c
new file mode 100644
index 0000000..f4649c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101021-1.c
@@ -0,0 +1,35 @@
+/* PR target/101021 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+/* { dg-final { scan-assembler-not "vpshufb" } } */
+
+typedef char S;
+typedef S V __attribute__((vector_size(16 * sizeof(S))));
+
+V t1 (V x)
+{
+ return __builtin_shuffle (x, (V) { 8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7 });
+}
+
+/* { dg-final { scan-assembler "vpalignr" } } */
+
+V t2 (V x)
+{
+ return __builtin_shuffle (x, (V) { 0,1,2,3, 4,5,6,7, 4,5,6,7, 12,13,14,15 });
+}
+
+/* { dg-final { scan-assembler "vpshufd" } } */
+
+V t3 (V x)
+{
+ return __builtin_shuffle (x, (V) { 0,1, 2,3, 2,3, 6,7, 8,9,10,11,12,13,14,15 });
+}
+
+/* { dg-final { scan-assembler "vpshuflw" } } */
+
+V t4 (V x)
+{
+ return __builtin_shuffle (x, (V) { 0,1,2,3,4,5,6,7, 8,9, 10,11, 10,11, 14,15 });
+}
+
+/* { dg-final { scan-assembler "vpshufhw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101021-2.c b/gcc/testsuite/gcc.target/i386/pr101021-2.c
new file mode 100644
index 0000000..1e046f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101021-2.c
@@ -0,0 +1,21 @@
+/* PR target/101021 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx" } */
+/* { dg-final { scan-assembler-not "vpshufb" } } */
+
+typedef char S;
+typedef S V __attribute__((vector_size(8 * sizeof(S))));
+
+V t1 (V x)
+{
+ return __builtin_shuffle (x, (V) { 4,5,6,7, 0,1,2,3 });
+}
+
+/* { dg-final { scan-assembler "vpshufd" } } */
+
+V t2 (V x)
+{
+ return __builtin_shuffle (x, (V) { 0,1, 2,3, 2,3, 6,7 });
+}
+
+/* { dg-final { scan-assembler "vpshuflw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101044.c b/gcc/testsuite/gcc.target/i386/pr101044.c
new file mode 100644
index 0000000..03df86d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101044.c
@@ -0,0 +1,9 @@
+/* PR target/101044 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-sse3 -mtune=generic" } */
+/* { dg-final { scan-assembler-times "neg" 1 } } */
+
+int foo (int x)
+{
+ return (x < 0) ? x : -x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101046.c b/gcc/testsuite/gcc.target/i386/pr101046.c
new file mode 100644
index 0000000..6ce4695
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101046.c
@@ -0,0 +1,15 @@
+/* PR target/101046 */
+/* { dg-do compile } */
+/* { dg-options "-ftree-ter -mavx512bw -mavx512vl" } */
+
+typedef unsigned short __attribute__((__vector_size__(16))) U;
+typedef unsigned int __attribute__((__vector_size__(16))) V;
+typedef unsigned int __attribute__((__vector_size__(32))) W;
+
+U
+foo (void)
+{
+ return __builtin_convertvector (__builtin_shufflevector ((V){}, (W){},
+ 0, 0, 1, 0,
+ 5, 5, 0, 2), U);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101058.c b/gcc/testsuite/gcc.target/i386/pr101058.c
new file mode 100644
index 0000000..a2b251c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101058.c
@@ -0,0 +1,12 @@
+/* PR target/101058 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -msse2 -mno-mmx" } */
+
+short add90Hybrid_a_1;
+short *add90Hybrid_b, *add90Hybrid_c, *add90Hybrid_d;
+void add90Hybrid() {
+ for (int i; i < 200; i += 2) {
+ add90Hybrid_c[i] = add90Hybrid_b[i];
+ add90Hybrid_d[i] = add90Hybrid_a_1 - add90Hybrid_b[i + 1];
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101175.c b/gcc/testsuite/gcc.target/i386/pr101175.c
new file mode 100644
index 0000000..ed7a081
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101175.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mlzcnt" } */
+/* { dg-require-effective-target lzcnt } */
+
+#include "lzcnt-check.h"
+
+static int
+foo (unsigned int v)
+{
+ return v ? __builtin_clz (v) : 32;
+}
+
+/* returns -1 if x == 0 */
+int
+__attribute__ ((noinline, noclone))
+bar (unsigned int x)
+{
+ return 31 - foo (x);
+}
+
+static void
+lzcnt_test ()
+{
+ int r = bar (0);
+
+ if (r != -1)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101248.c b/gcc/testsuite/gcc.target/i386/pr101248.c
new file mode 100644
index 0000000..f5ac94f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101248.c
@@ -0,0 +1,123 @@
+/* PR target/101248 */
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl -std=gnu99" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target c99_runtime } */
+
+#define AVX512VL
+#define AVX512F_LEN 128
+#define AVX512F_LEN_HALF 128
+
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 64)
+#include "avx512f-mask-type.h"
+#include "math_m_pi.h"
+#include "float.h"
+
+
+static void
+CALC (double *r, double dest, double src, long long tbl)
+{
+ switch (tbl & 0xf)
+ {
+ case 0:
+ *r = dest;
+ break;
+ case 1:
+ *r = src;
+ break;
+ case 2:
+ *r = signbit (src) ? -NAN : NAN;
+ break;
+ case 3:
+ *r = -NAN;
+ break;
+ case 4:
+ *r = -INFINITY;
+ break;
+ case 5:
+ *r = INFINITY;
+ break;
+ case 6:
+ *r = signbit (src) ? -INFINITY : INFINITY;
+ break;
+ case 7:
+ *r = 1.0 / -INFINITY;
+ break;
+ case 8:
+ *r = 0.0;
+ break;
+ case 9:
+ *r = -1.0;
+ break;
+ case 10:
+ *r = 1.0;
+ break;
+ case 11:
+ *r = 1.0 / 2.0;
+ break;
+ case 12:
+ *r = 90.0;
+ break;
+ case 13:
+ *r = M_PI_2;
+ break;
+ case 14:
+ *r = DBL_MAX;
+ break;
+ case 15:
+ *r = -DBL_MAX;
+ break;
+ default:
+ abort ();
+ }
+}
+
+void
+TEST (void)
+{
+ int i, j;
+ UNION_TYPE (AVX512F_LEN, d) res1, res2, res3, s1;
+ UNION_TYPE (AVX512F_LEN, i_q) s2;
+ double res_ref[SIZE];
+
+
+ float vals[2] = { -10, 10 };
+ int controls[8] = {0, 0x11111111, 0x77777777, 0x88888888,
+ 0x99999999, 0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc};
+
+ MASK_TYPE mask = 1;
+
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < SIZE; j++)
+ {
+ s1.a[j] = vals[i];
+ s2.a[j] = controls[j];
+ res1.a[j] = DEFAULT_VALUE;
+ res2.a[j] = DEFAULT_VALUE;
+ res3.a[j] = DEFAULT_VALUE;
+
+ CALC (&res_ref[j], res1.a[j], s1.a[j], s2.a[j]);
+ }
+
+ res1.x = INTRINSIC (_fixupimm_pd) (res1.x, s1.x, s2.x, 0);
+ res2.x = INTRINSIC (_mask_fixupimm_pd) (res2.x, mask, s1.x, s2.x, 0);
+ res3.x = INTRINSIC (_maskz_fixupimm_pd) (mask, res3.x, s1.x, s2.x, 0);
+
+ if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
+ abort ();
+
+ MASK_MERGE(d) (res_ref, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
+ abort ();
+ MASK_ZERO(d) (res_ref, mask, SIZE);
+ if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
+ abort ();
+ }
+}
+
+void
+test_256 (void)
+{}
diff --git a/gcc/testsuite/gcc.target/i386/pr101261.c b/gcc/testsuite/gcc.target/i386/pr101261.c
new file mode 100644
index 0000000..d25d1a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101261.c
@@ -0,0 +1,11 @@
+/* PR middle-end/101261 */
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-fno-semantic-interposition -fPIC" } */
+/* { dg-require-ifunc "" } */
+
+void
+__attribute__((target_clones("default", "avx2")))
+dt_ioppr_transform_image_colorspace()
+{
+ dt_ioppr_transform_image_colorspace();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101282.c b/gcc/testsuite/gcc.target/i386/pr101282.c
new file mode 100644
index 0000000..2148b92
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101282.c
@@ -0,0 +1,18 @@
+/* { dg-do run { target { ia32 } } } */
+/* { dg-options "-Os -march=i686 -mfpmath=sse -msse2" } */
+
+#include<stdlib.h>
+int
+main (void)
+{
+ static volatile unsigned int ivin, ivout;
+ static volatile _Float16 fv1, fv2;
+ ivin = ((unsigned int)1);
+ fv1 = ((unsigned int)1);
+ fv2 = ivin;
+ ivout = fv2;
+ if (ivout != ((unsigned int)1))
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101346.c b/gcc/testsuite/gcc.target/i386/pr101346.c
new file mode 100644
index 0000000..fefabaf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101346.c
@@ -0,0 +1,10 @@
+/* PR target/101346 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -fprofile-generate -msse" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+_Decimal128
+foo (_Decimal128 x)
+{
+ return - __builtin_fabsd128 (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101395-1.c b/gcc/testsuite/gcc.target/i386/pr101395-1.c
new file mode 100644
index 0000000..74c8bfe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101395-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=sapphirerapids" } */
+
+#ifdef __x86_64__
+# ifndef __UINTR__
+# error UINTR is not enabled for Sapphirerapids
+# endif
+#else
+# ifdef __UINTR__
+# error UINTR is not usable in 32-bit mode
+# endif
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr101395-2.c b/gcc/testsuite/gcc.target/i386/pr101395-2.c
new file mode 100644
index 0000000..f2b677f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101395-2.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -march=native" } */
+
+int
+main ()
+{
+ if (__builtin_cpu_supports ("uintr"))
+ {
+#ifdef __x86_64__
+# ifndef __UINTR__
+ __builtin_abort ();
+# endif
+#else
+# ifdef __UINTR__
+ __builtin_abort ();
+# endif
+#endif
+ return 0;
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101395-3.c b/gcc/testsuite/gcc.target/i386/pr101395-3.c
new file mode 100644
index 0000000..bc6ab42
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101395-3.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=native -mno-uintr" } */
+
+#ifdef __UINTR__
+# error UINTR should be disabled
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr101424.c b/gcc/testsuite/gcc.target/i386/pr101424.c
new file mode 100644
index 0000000..28bb723
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101424.c
@@ -0,0 +1,15 @@
+/* PR target/101424 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+
+typedef int v4df __attribute__((vector_size(32)));
+
+int foo_v4df_b, foo_v4df_c;
+
+v4df
+__attribute__foo_v4df ()
+{
+ v4df a;
+ a[foo_v4df_c] = foo_v4df_b;
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101456-1.c b/gcc/testsuite/gcc.target/i386/pr101456-1.c
new file mode 100644
index 0000000..803fc6e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101456-1.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake" } */
+
+#include <x86intrin.h>
+
+extern __m256 x1;
+extern __m256d x2;
+extern __m256i x3;
+
+extern void bar (void);
+
+void
+foo1 (void)
+{
+ x1 = _mm256_setzero_ps ();
+ bar ();
+}
+
+void
+foo2 (void)
+{
+ x2 = _mm256_setzero_pd ();
+ bar ();
+}
+
+void
+foo3 (void)
+{
+ x3 = _mm256_setzero_si256 ();
+ bar ();
+}
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101456-2.c b/gcc/testsuite/gcc.target/i386/pr101456-2.c
new file mode 100644
index 0000000..554a0f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101456-2.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake" } */
+
+#include <x86intrin.h>
+
+extern __m256 x1;
+extern __m256d x2;
+extern __m256i x3;
+
+extern __m256 bar (void);
+
+void
+foo1 (void)
+{
+ bar ();
+ x1 = _mm256_setzero_ps ();
+}
+
+void
+foo2 (void)
+{
+ bar ();
+ x2 = _mm256_setzero_pd ();
+}
+
+void
+foo3 (void)
+{
+ bar ();
+ x3 = _mm256_setzero_si256 ();
+}
+
+/* { dg-final { scan-assembler-times "vzeroupper" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101492-1.c b/gcc/testsuite/gcc.target/i386/pr101492-1.c
new file mode 100644
index 0000000..4100257
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101492-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4.2 -mgeneral-regs-only" } */
+
+#include <x86intrin.h>
+
+unsigned int
+foo1 (unsigned int x, unsigned int y)
+{
+ return __crc32d (x, y);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101492-2.c b/gcc/testsuite/gcc.target/i386/pr101492-2.c
new file mode 100644
index 0000000..c7d24f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101492-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4.2 -mgeneral-regs-only" } */
+
+#include <x86intrin.h>
+
+unsigned int
+foo1 (unsigned int x)
+{
+ return _mm_popcnt_u32 (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101492-3.c b/gcc/testsuite/gcc.target/i386/pr101492-3.c
new file mode 100644
index 0000000..37e2071
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101492-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse3 -mgeneral-regs-only" } */
+
+#include <x86intrin.h>
+
+void
+foo1 (unsigned int x, unsigned int y)
+{
+ _mm_mwait (x, y);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101492-4.c b/gcc/testsuite/gcc.target/i386/pr101492-4.c
new file mode 100644
index 0000000..c5a4f0a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101492-4.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-mwait -msse3 -mgeneral-regs-only" } */
+
+#include <x86intrin.h>
+
+void
+foo1 (unsigned int x, unsigned int y)
+{
+ _mm_mwait (x, y);
+}
+
+/* { dg-error "target specific option mismatch" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101504.c b/gcc/testsuite/gcc.target/i386/pr101504.c
new file mode 100644
index 0000000..2ad0405
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101504.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake" } */
+
+typedef unsigned int __attribute__((__vector_size__ (32))) U;
+typedef unsigned char __attribute__((__vector_size__ (64))) V;
+
+V g;
+
+U
+foo (void)
+{
+ V v = __builtin_shufflevector (g, g,
+ 0, 1, 2, 0, 5, 1, 0, 1, 3, 2, 3, 0, 4, 3, 1, 2,
+ 2, 0, 4, 2, 3, 1, 1, 2, 3, 4, 1, 1, 0, 0, 5, 2,
+ 0, 3, 3, 3, 3, 4, 5, 0, 1, 5, 2, 1, 0, 1, 1, 2,
+ 3, 2, 0, 5, 4, 5, 1, 0, 1, 4, 4, 3, 4, 5, 2, 0);
+ v ^= 255;
+ V w = v + g;
+ U u = ((union { V a; U b; }) w).b + ((union { V a; U b; }) w).b[1];
+ return u;
+}
+
+/* { dg-final { scan-assembler-not "\.byte\[ \t\]+-1\n" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101685.c b/gcc/testsuite/gcc.target/i386/pr101685.c
new file mode 100644
index 0000000..0c743ec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101685.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=amdfam10 -mno-lzcnt -mno-popcnt" } */
+
+#ifdef __LZCNT__
+# error LZCNT should be disabled
+#endif
+
+#ifdef __POPCNT__
+# error POPCNT should be disabled
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr101716.c b/gcc/testsuite/gcc.target/i386/pr101716.c
new file mode 100644
index 0000000..5e3ea64
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101716.c
@@ -0,0 +1,11 @@
+/* PR target/101716 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler "leal\[\\t \]\[^\\n\]*eax" } } */
+/* { dg-final { scan-assembler-not "movl\[\\t \]\[^\\n\]*eax" } } */
+
+unsigned long long sample1(unsigned long long m) {
+ unsigned int t = -1;
+ return (m << 1) & t;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101742a.c b/gcc/testsuite/gcc.target/i386/pr101742a.c
new file mode 100644
index 0000000..67ea405
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101742a.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3 -mtune=nano-x2" } */
+
+int n2;
+
+__attribute__ ((simd)) char
+w7 (void)
+{
+ short int xb = n2;
+ int qp;
+
+ for (qp = 0; qp < 2; ++qp)
+ xb = xb < 1;
+
+ return xb;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101742b.c b/gcc/testsuite/gcc.target/i386/pr101742b.c
new file mode 100644
index 0000000..ba19064
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101742b.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3 -mtune=nano-x2 -mtune-ctrl=sse_unaligned_store_optimal" } */
+
+#include "pr101742a.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr101797.c b/gcc/testsuite/gcc.target/i386/pr101797.c
new file mode 100644
index 0000000..d5cc34e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101797.c
@@ -0,0 +1,15 @@
+/* PR target/101797 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a;
+int main() {
+ int b, c, d, e = 0;
+ if (a) {
+ c += a;
+ e = ~(a % c);
+ e || c || (b & d);
+ }
+ a = e;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101812.c b/gcc/testsuite/gcc.target/i386/pr101812.c
new file mode 100644
index 0000000..07e84a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101812.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-loop-vectorize -fvect-cost-model=unlimited" } */
+
+#define LTGT(a, b) (__builtin_islessgreater (a, b) ? a : b)
+void foo (int ilast,float* w, float* w2)
+{
+ int i;
+ for (i = 0; i < ilast; ++i)
+ {
+ w[i] = LTGT (0.0f, w2[i]);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101846-1.c b/gcc/testsuite/gcc.target/i386/pr101846-1.c
new file mode 100644
index 0000000..40d95bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101846-1.c
@@ -0,0 +1,95 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vl -mavx512dq -O2" } */
+/* { dg-final { scan-assembler-not "vmov" } } */
+/* { dg-final { scan-assembler-times "vpmovzxbw" "3" } } */
+/* { dg-final { scan-assembler-times "vpmovzxwd" "3" } } */
+/* { dg-final { scan-assembler-times "vpmovzxdq" "3" } } */
+
+typedef short v4hi __attribute__((vector_size (8)));
+typedef short v8hi __attribute__((vector_size (16)));
+typedef short v16hi __attribute__((vector_size (32)));
+typedef short v32hi __attribute__((vector_size (64)));
+typedef char v8qi __attribute__((vector_size (8)));
+typedef char v16qi __attribute__((vector_size (16)));
+typedef char v32qi __attribute__((vector_size (32)));
+typedef char v64qi __attribute__((vector_size (64)));
+typedef int v2si __attribute__((vector_size (8)));
+typedef int v4si __attribute__((vector_size (16)));
+typedef int v8si __attribute__((vector_size (32)));
+typedef int v16si __attribute__((vector_size (64)));
+
+v32hi
+foo_zxwd_512 (v16hi x)
+{
+ return __builtin_shufflevector (x, (v16hi) {},
+ 0, 16, 1, 17, 2, 18, 3, 19,
+ 4, 20, 5, 21, 6, 22, 7, 23,
+ 8, 24, 9, 25, 10, 26, 11, 27,
+ 12, 28, 13, 29, 14, 30, 15, 31);
+}
+
+v16hi
+foo_zxwd_256 (v8hi x)
+{
+ return __builtin_shufflevector (x, (v8hi) {},
+ 0, 8, 1, 9, 2, 10, 3, 11,
+ 4, 12, 5, 13, 6, 14, 7, 15);
+}
+
+v8hi
+foo_zxwd_128 (v4hi x)
+{
+ return __builtin_shufflevector (x, (v4hi) {}, 0, 4, 1, 5, 2, 6, 3, 7);
+}
+
+v16si
+foo_zxdq_512 (v8si x)
+{
+ return __builtin_shufflevector (x, (v8si) {},
+ 0, 8, 1, 9, 2, 10, 3, 11,
+ 4, 12, 5, 13, 6, 14, 7, 15);
+}
+
+v8si
+foo_zxdq_256 (v4si x)
+{
+ return __builtin_shufflevector (x, (v4si) {}, 0, 4, 1, 5, 2, 6, 3, 7);
+}
+
+v4si
+foo_zxdq_128 (v2si x)
+{
+ return __builtin_shufflevector (x, (v2si) {}, 0, 2, 1, 3);
+}
+
+v64qi
+foo_zxbw_512 (v32qi x)
+{
+ return __builtin_shufflevector (x, (v32qi) {},
+ 0, 32, 1, 33, 2, 34, 3, 35,
+ 4, 36, 5, 37, 6, 38, 7, 39,
+ 8, 40, 9, 41, 10, 42, 11, 43,
+ 12, 44, 13, 45, 14, 46, 15, 47,
+ 16, 48, 17, 49, 18, 50, 19, 51,
+ 20, 52, 21, 53, 22, 54, 23, 55,
+ 24, 56, 25, 57, 26, 58, 27, 59,
+ 28, 60, 29, 61, 30, 62, 31, 63);
+}
+
+v32qi
+foo_zxbw_256 (v16qi x)
+{
+ return __builtin_shufflevector (x, (v16qi) {},
+ 0, 16, 1, 17, 2, 18, 3, 19,
+ 4, 20, 5, 21, 6, 22, 7, 23,
+ 8, 24, 9, 25, 10, 26, 11, 27,
+ 12, 28, 13, 29, 14, 30, 15, 31);
+}
+
+v16qi
+foo_zxbw_128 (v8qi x)
+{
+ return __builtin_shufflevector (x, (v8qi) {},
+ 0, 8, 1, 9, 2, 10, 3, 11,
+ 4, 12, 5, 13, 6, 14, 7, 15);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101846-2.c b/gcc/testsuite/gcc.target/i386/pr101846-2.c
new file mode 100644
index 0000000..26c9ed5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101846-2.c
@@ -0,0 +1,81 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -mavx512vbmi -O2" } */
+/* { dg-final { scan-assembler-times "vpmovwb" "3" } } */
+/* { dg-final { scan-assembler-times "vpmovdw" "3" } } */
+/* { dg-final { scan-assembler-times "vpmovqd" "3" } } */
+
+typedef short v4hi __attribute__((vector_size (8)));
+typedef short v8hi __attribute__((vector_size (16)));
+typedef short v16hi __attribute__((vector_size (32)));
+typedef short v32hi __attribute__((vector_size (64)));
+typedef char v8qi __attribute__((vector_size (8)));
+typedef char v16qi __attribute__((vector_size (16)));
+typedef char v32qi __attribute__((vector_size (32)));
+typedef char v64qi __attribute__((vector_size (64)));
+typedef int v2si __attribute__((vector_size (8)));
+typedef int v4si __attribute__((vector_size (16)));
+typedef int v8si __attribute__((vector_size (32)));
+typedef int v16si __attribute__((vector_size (64)));
+
+v16hi
+foo_dw_512 (v32hi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30);
+}
+
+v8hi
+foo_dw_256 (v16hi x)
+{
+ return __builtin_shufflevector (x, x, 0, 2, 4, 6, 8, 10, 12, 14);
+}
+
+v4hi
+foo_dw_128 (v8hi x)
+{
+ return __builtin_shufflevector (x, x, 0, 2, 4, 6);
+}
+
+v8si
+foo_qd_512 (v16si x)
+{
+ return __builtin_shufflevector (x, x, 0, 2, 4, 6, 8, 10, 12, 14);
+}
+
+v4si
+foo_qd_256 (v8si x)
+{
+ return __builtin_shufflevector (x, x, 0, 2, 4, 6);
+}
+
+v2si
+foo_qd_128 (v4si x)
+{
+ return __builtin_shufflevector (x, x, 0, 2);
+}
+
+v32qi
+foo_wb_512 (v64qi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30,
+ 32, 34, 36, 38, 40, 42, 44, 46,
+ 48, 50, 52, 54, 56, 58, 60, 62);
+}
+
+v16qi
+foo_wb_256 (v32qi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30);
+}
+
+v8qi
+foo_wb_128 (v16qi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101846-3.c b/gcc/testsuite/gcc.target/i386/pr101846-3.c
new file mode 100644
index 0000000..f774018
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101846-3.c
@@ -0,0 +1,73 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -mavx512vbmi -O2" } */
+/* { dg-final { scan-assembler-times "vpermb" "2" } } */
+/* { dg-final { scan-assembler-times "vpermw" "2" } } */
+/* { dg-final { scan-assembler-times "vpermd" "2" } } */
+
+typedef short v4hi __attribute__((vector_size (8)));
+typedef short v8hi __attribute__((vector_size (16)));
+typedef short v16hi __attribute__((vector_size (32)));
+typedef short v32hi __attribute__((vector_size (64)));
+typedef char v8qi __attribute__((vector_size (8)));
+typedef char v16qi __attribute__((vector_size (16)));
+typedef char v32qi __attribute__((vector_size (32)));
+typedef char v64qi __attribute__((vector_size (64)));
+typedef int v2si __attribute__((vector_size (8)));
+typedef int v4si __attribute__((vector_size (16)));
+typedef int v8si __attribute__((vector_size (32)));
+typedef int v16si __attribute__((vector_size (64)));
+
+v32hi
+foow_512 (v32hi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31);
+}
+
+v16hi
+foow_256 (v16hi x)
+{
+ return __builtin_shufflevector (x, x, 0, 2, 4, 6, 8, 10, 12, 14,
+ 8, 9, 10, 11, 12, 13, 14, 15);
+}
+
+
+v16si
+food_512 (v16si x)
+{
+ return __builtin_shufflevector (x, x, 0, 2, 4, 6, 8, 10, 12, 14,
+ 8, 9, 10, 11, 12, 13, 14, 15);
+}
+
+v8si
+food_256 (v8si x)
+{
+ return __builtin_shufflevector (x, x, 0, 2, 4, 6, 4, 5, 6, 7);
+}
+
+v64qi
+foob_512 (v64qi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30,
+ 32, 34, 36, 38, 40, 42, 44, 46,
+ 48, 50, 52, 54, 56, 58, 60, 62,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63);
+}
+
+v32qi
+foob_256 (v32qi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101846-4.c b/gcc/testsuite/gcc.target/i386/pr101846-4.c
new file mode 100644
index 0000000..2a6163c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101846-4.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -mavx512vbmi -O2" } */
+/* { dg-final { scan-assembler-times "vpermi2b" "3" } } */
+
+typedef char v16qi __attribute__((vector_size (16)));
+typedef char v32qi __attribute__((vector_size (32)));
+typedef char v64qi __attribute__((vector_size (64)));
+
+
+v64qi
+foob_512 (v64qi x, v64qi y)
+{
+ return __builtin_shufflevector (x, y,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30,
+ 32, 34, 36, 38, 40, 42, 44, 46,
+ 48, 50, 52, 54, 56, 58, 60, 62,
+ 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 77, 79, 74, 72, 70,
+ 89, 88, 78, 86, 85, 75, 83, 82,
+ 112, 108, 101, 100, 86, 96, 97, 95);
+}
+
+v32qi
+foob_256 (v32qi x, v32qi y)
+{
+ return __builtin_shufflevector (x, y,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30,
+ 32, 34, 36, 38, 40, 42, 44, 46,
+ 48, 50, 52, 54, 56, 58, 60, 62);
+}
+
+v16qi
+foob_128 (v16qi x, v16qi y)
+{
+ return __builtin_shufflevector (x, y,
+ 0, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101930.c b/gcc/testsuite/gcc.target/i386/pr101930.c
new file mode 100644
index 0000000..7207dd1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101930.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2 -mfpmath=sse -ffast-math" } */
+double a;
+double
+__attribute__((noipa))
+foo (int b)
+{
+ return __builtin_ldexp (a, b);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101950-1.c b/gcc/testsuite/gcc.target/i386/pr101950-1.c
new file mode 100644
index 0000000..cc98064
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101950-1.c
@@ -0,0 +1,20 @@
+/* PR middle-end/101950 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-lzcnt" } */
+/* { dg-final { scan-assembler-not "call\[^\n\r]*__clrsb.i2" } } */
+/* { dg-final { scan-assembler-times "\tbsr\[ql]\t" 2 } } */
+/* { dg-final { scan-assembler-times "\txor\[ql]\t" 4 } } */
+/* { dg-final { scan-assembler-times "\tor\[ql]\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tsar\[ql]\t|\tcltd" 2 } } */
+
+int
+foo (long x)
+{
+ return __builtin_clrsbl (x);
+}
+
+int
+bar (int x)
+{
+ return __builtin_clrsb (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101950-2.c b/gcc/testsuite/gcc.target/i386/pr101950-2.c
new file mode 100644
index 0000000..896f1b4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101950-2.c
@@ -0,0 +1,19 @@
+/* PR middle-end/101950 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlzcnt" } */
+/* { dg-final { scan-assembler-not "call\[^\n\r]*__clrsb.i2" } } */
+/* { dg-final { scan-assembler-times "\tlzcnt\[ql]\t" 2 } } */
+/* { dg-final { scan-assembler-times "\txor\[ql]\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tsar\[ql]\t|\tcltd" 2 } } */
+
+int
+foo (long x)
+{
+ return __builtin_clrsbl (x);
+}
+
+int
+bar (int x)
+{
+ return __builtin_clrsb (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101989-1.c b/gcc/testsuite/gcc.target/i386/pr101989-1.c
new file mode 100644
index 0000000..594093e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101989-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "vpternlog" 6 } } */
+/* { dg-final { scan-assembler-not "vpxor" } } */
+/* { dg-final { scan-assembler-not "vpor" } } */
+/* { dg-final { scan-assembler-not "vpand" } } */
+
+#include<immintrin.h>
+__m256d
+__attribute__((noipa, target("avx512vl")))
+copysign2_pd(__m256d from, __m256d to) {
+ __m256i a = _mm256_castpd_si256(from);
+ __m256d avx_signbit = _mm256_castsi256_pd(_mm256_slli_epi64(_mm256_cmpeq_epi64(a, a), 63));
+ /* (avx_signbit & from) | (~avx_signbit & to) */
+ return _mm256_or_pd(_mm256_and_pd(avx_signbit, from), _mm256_andnot_pd(avx_signbit, to));
+}
+
+__m256i
+__attribute__((noipa, target("avx512vl")))
+foo (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (src2 & ~src1) | (src3 & src1);
+}
+
+__m256i
+__attribute__ ((noipa, target("avx512vl")))
+foo1 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (src2 & src1) | (src3 & ~src1);
+}
+
+__m256i
+__attribute__ ((noipa, target("avx512vl")))
+foo2 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (src2 & src1) | (~src3 & src1);
+}
+
+__m256i
+__attribute__ ((noipa, target("avx512vl")))
+foo3 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (~src2 & src1) | (src3 & src1);
+}
+
+__m256i
+__attribute__ ((noipa, target("avx512vl")))
+foo4 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return src3 & src2 ^ src1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr101989-2.c b/gcc/testsuite/gcc.target/i386/pr101989-2.c
new file mode 100644
index 0000000..9d9759a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101989-2.c
@@ -0,0 +1,102 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx2 -mno-avx512f" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+
+#include "avx512f-helper.h"
+
+#include "pr101989-1.c"
+__m256d
+avx2_copysign2_pd (__m256d from, __m256d to) {
+ __m256i a = _mm256_castpd_si256(from);
+ __m256d avx_signbit = _mm256_castsi256_pd(_mm256_slli_epi64(_mm256_cmpeq_epi64(a, a), 63));
+ /* (avx_signbit & from) | (~avx_signbit & to) */
+ return _mm256_or_pd(_mm256_and_pd(avx_signbit, from), _mm256_andnot_pd(avx_signbit, to));
+}
+
+__m256i
+avx2_foo (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (src2 & ~src1) | (src3 & src1);
+}
+
+__m256i
+avx2_foo1 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (src2 & src1) | (src3 & ~src1);
+}
+
+__m256i
+avx2_foo2 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (src2 & src1) | (~src3 & src1);
+}
+
+__m256i
+avx2_foo3 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return (~src2 & src1) | (src3 & src1);
+}
+
+__m256i
+avx2_foo4 (__m256i src1, __m256i src2, __m256i src3)
+{
+ return src3 & src2 ^ src1;
+}
+
+
+void
+test_256 (void)
+{
+ union256i_q q1, q2, q3, res2, exp2;
+ union256d d1, d2, res1, exp1;
+ int i, sign = 1;
+
+ for (i = 0; i < 4; i++)
+ {
+ d1.a[i] = 12.34 * (i + 2000) * sign;
+ d2.a[i] = 56.78 * (i - 30) * sign;
+ q1.a[i] = 12 * (i + 2000) * sign;
+ q2.a[i] = 56 * (i - 30) * sign;
+ q3.a[i] = 90 * (i + 40) * sign;
+ res1.a[i] = DEFAULT_VALUE;
+ exp1.a[i] = DEFAULT_VALUE;
+ res2.a[i] = exp2.a[i] = -1;
+ sign = -sign;
+ }
+
+ exp1.x = avx2_copysign2_pd (d1.x, d2.x);
+ res1.x = copysign2_pd (d1.x, d2.x);
+ if (UNION_CHECK (256, d) (res1, exp1.a))
+ abort ();
+
+ exp2.x = avx2_foo1 (q1.x, q2.x, q3.x);
+ res2.x = foo1 (q1.x, q2.x, q3.x);
+ if (UNION_CHECK (256, i_q) (res2, exp2.a))
+ abort ();
+
+ exp2.x = avx2_foo2 (q1.x, q2.x, q3.x);
+ res2.x = foo2 (q1.x, q2.x, q3.x);
+ if (UNION_CHECK (256, i_q) (res2, exp2.a))
+ abort ();
+
+ exp2.x = avx2_foo3 (q1.x, q2.x, q3.x);
+ res2.x = foo3 (q1.x, q2.x, q3.x);
+ if (UNION_CHECK (256, i_q) (res2, exp2.a))
+ abort ();
+
+ exp2.x = avx2_foo4 (q1.x, q2.x, q3.x);
+ res2.x = foo4 (q1.x, q2.x, q3.x);
+ if (UNION_CHECK (256, i_q) (res2, exp2.a))
+ abort ();
+
+ exp2.x = avx2_foo (q1.x, q2.x, q3.x);
+ res2.x = foo (q1.x, q2.x, q3.x);
+ if (UNION_CHECK (256, i_q) (res2, exp2.a))
+ abort ();
+}
+
+static void
+test_128 ()
+{}
diff --git a/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c b/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c
new file mode 100644
index 0000000..d03d192
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-final { scan-assembler-times "vpternlog" 4 } } */
+/* { dg-final { scan-assembler-times "\\\{1to4\\\}" 4 } } */
+#include<immintrin.h>
+extern long long C;
+__m256d
+copysign2_pd(__m256d from, __m256d to) {
+ __m256i a = _mm256_castpd_si256(from);
+ __m256d avx_signbit = _mm256_castsi256_pd(_mm256_slli_epi64(_mm256_cmpeq_epi64(a, a), 63));
+ /* (avx_signbit & from) | (~avx_signbit & to) */
+ return _mm256_or_pd(_mm256_and_pd(avx_signbit, from), _mm256_andnot_pd(avx_signbit, to));
+}
+
+__m256i
+mask_pternlog (__m256i A, __m256i B, __mmask8 U)
+{
+ return _mm256_mask_ternarylogic_epi64 (A, U, B, _mm256_set1_epi64x (C) ,202);
+}
+
+__m256i
+maskz_pternlog (__m256i A, __m256i B, __mmask8 U)
+{
+ return _mm256_maskz_ternarylogic_epi64 (U, A, B, _mm256_set1_epi64x (C) ,202);
+}
+
+__m256i
+none_pternlog (__m256i A, __m256i B)
+{
+ return _mm256_ternarylogic_epi64 (A, B, _mm256_set1_epi64x (C) ,202);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr102016.c b/gcc/testsuite/gcc.target/i386/pr102016.c
new file mode 100644
index 0000000..2ff75cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102016.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -O2" } */
+typedef char v8qi __attribute__((vector_size (8)));
+typedef char v16qi __attribute__((vector_size (16)));
+v8qi
+foo_wb_128 (v16qi x)
+{
+ return __builtin_shufflevector (x, x,
+ 0, 2, 4, 6, 8, 10, 12, 14);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr102021.c b/gcc/testsuite/gcc.target/i386/pr102021.c
new file mode 100644
index 0000000..6db3f57
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr102021.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512" } */
+
+#include<immintrin.h>
+
+__m256i
+foo ()
+{
+ return _mm256_set1_epi16 (12);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %ymm\[0-9\]+" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vmovdqa" } } */
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr11877-2.c b/gcc/testsuite/gcc.target/i386/pr11877-2.c
new file mode 100644
index 0000000..4782dd2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr11877-2.c
@@ -0,0 +1,26 @@
+/* PR target/11877 */
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+
+void
+foo (int *p)
+{
+ p[0] = 0;
+ p[7] = 0;
+ p[23] = 0;
+ p[41] = 0;
+ p[48] = 0;
+ p[59] = 0;
+ p[69] = 0;
+ p[78] = 0;
+ p[83] = 0;
+ p[89] = 0;
+ p[98] = 0;
+ p[121] = 0;
+ p[132] = 0;
+ p[143] = 0;
+ p[154] = 0;
+}
+
+/* { dg-final { scan-assembler-times "xorl\[ \t\]" 1 } } */
+/* { dg-final { scan-assembler-not "\\\$0," } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr11877.c b/gcc/testsuite/gcc.target/i386/pr11877.c
new file mode 100644
index 0000000..5a488cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr11877.c
@@ -0,0 +1,16 @@
+/* PR target/11877 */
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+
+void foo (long long *p)
+{
+ *p = 0;
+}
+
+void bar (int *p)
+{
+ *p = 0;
+}
+
+/* { dg-final { scan-assembler-times "xorl\[ \t\]" 2 } } */
+/* { dg-final { scan-assembler-not "\\\$0," } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr43147.c b/gcc/testsuite/gcc.target/i386/pr43147.c
new file mode 100644
index 0000000..3c30f91
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr43147.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+/* { dg-final { scan-assembler "movaps" } } */
+/* { dg-final { scan-assembler-not "shufps" } } */
+
+#include <x86intrin.h>
+
+__m128
+foo (void)
+{
+ __m128 m = _mm_set_ps(1.0f, 2.0f, 3.0f, 4.0f);
+ m = _mm_shuffle_ps(m, m, 0xC9);
+ m = _mm_shuffle_ps(m, m, 0x2D);
+ return m;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr54400.c b/gcc/testsuite/gcc.target/i386/pr54400.c
index 5ed5ba0..3a45037 100644
--- a/gcc/testsuite/gcc.target/i386/pr54400.c
+++ b/gcc/testsuite/gcc.target/i386/pr54400.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -msse3 -mfpmath=sse" } */
+/* { dg-options "-O2 -msse3 -mfpmath=sse -mtune-ctrl=v2df_reduction_prefer_haddpd" } */
#include <x86intrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr54855-11.c b/gcc/testsuite/gcc.target/i386/pr54855-11.c
new file mode 100644
index 0000000..0d7d739
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr54855-11.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+/* { dg-final { scan-assembler-times "vaddsh\[ \\t\]" 1 } } */
+/* { dg-final { scan-assembler-not "vpextrw\[ \\t\]" } } */
+/* { dg-final { scan-assembler-not "vmovd\[ \\t\]" } } */
+/* { dg-final { scan-assembler-not "vpunpckldq\[ \\t\]" } } */
+/* { dg-final { scan-assembler-not "vpunpcklqdq\[ \\t\]" } } */
+
+#include <immintrin.h>
+
+__m128h
+foo (__m128h x, __m128h y)
+{
+ return _mm_add_sh (x, y);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr54855-12.c b/gcc/testsuite/gcc.target/i386/pr54855-12.c
new file mode 100644
index 0000000..2f8af39
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr54855-12.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]" 1 } } */
+/* { dg-final { scan-assembler-not "vcomish\[ \\t\]" } } */
+/* { dg-final { scan-assembler-not "vmovsh\[ \\t\]" { target { ! ia32 } } } } */
+
+#include <immintrin.h>
+
+_Float16
+foo (_Float16 x, _Float16 y)
+{
+ x = x > y ? x : y;
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr54855-13.c b/gcc/testsuite/gcc.target/i386/pr54855-13.c
new file mode 100644
index 0000000..87b4f45
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr54855-13.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512fp16" } */
+/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]" 1 } } */
+/* { dg-final { scan-assembler-not "vcomish\[ \\t\]" } } */
+/* { dg-final { scan-assembler-not "vmovsh\[ \\t\]" { target { ! ia32 } } } } */
+
+#include <immintrin.h>
+
+__m128h
+foo (__m128h x, __m128h y)
+{
+ x[0] = x[0] > y[0] ? x[0] : y[0];
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr57655.c b/gcc/testsuite/gcc.target/i386/pr57655.c
index 33a59d3..649cdef 100644
--- a/gcc/testsuite/gcc.target/i386/pr57655.c
+++ b/gcc/testsuite/gcc.target/i386/pr57655.c
@@ -2,7 +2,7 @@
/* { dg-options "-mavx -mvzeroupper -mno-fp-ret-in-387" } */
long double
-foo (long double x)
-{ /* { dg-error "x87 register return with x87 disabled" "" { target { ! ia32 } } } */
+foo (long double x) /* { dg-error "x87 register return with x87 disabled" "" { target { ! ia32 } } } */
+{
return __builtin_ilogbl (x);
}
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-6.c b/gcc/testsuite/gcc.target/i386/pr59794-6.c
index c809f95..babcf76 100644
--- a/gcc/testsuite/gcc.target/i386/pr59794-6.c
+++ b/gcc/testsuite/gcc.target/i386/pr59794-6.c
@@ -8,7 +8,7 @@ typedef int __v4si __attribute__ ((__vector_size__ (16)));
extern __v4si x;
__v4si
-foo (void)
-{ /* { dg-error "SSE register return with SSE disabled" } */
+foo (void) /* { dg-error "SSE register return with SSE disabled" } */
+{
return x;
}
diff --git a/gcc/testsuite/gcc.target/i386/pr70738-1.c b/gcc/testsuite/gcc.target/i386/pr70738-1.c
index 19381c2..62d609c 100644
--- a/gcc/testsuite/gcc.target/i386/pr70738-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr70738-1.c
@@ -3,7 +3,7 @@
typedef int int32x2_t __attribute__ ((__vector_size__ ((8))));
-int32x2_t test (int32x2_t a, int32x2_t b)
-{ /* { dg-error "SSE register return with SSE disabled" } */
+int32x2_t test (int32x2_t a, int32x2_t b) /* { dg-error "SSE register return with SSE disabled" } */
+{
return a + b;
}
diff --git a/gcc/testsuite/gcc.target/i386/pr71245-1.c b/gcc/testsuite/gcc.target/i386/pr71245-1.c
deleted file mode 100644
index be0b760..0000000
--- a/gcc/testsuite/gcc.target/i386/pr71245-1.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* PR target/71245 */
-/* { dg-do compile { target ia32 } } */
-/* { dg-options "-O2 -march=pentium -mno-sse -mfpmath=387" } */
-
-typedef union
-{
- unsigned long long ll;
- double d;
-} u_t;
-
-u_t d = { .d = 5.0 };
-
-void foo_d (void)
-{
- u_t tmp;
-
- tmp.ll = __atomic_load_n (&d.ll, __ATOMIC_SEQ_CST);
- tmp.d += 1.0;
- __atomic_store_n (&d.ll, tmp.ll, __ATOMIC_SEQ_CST);
-}
-
-/* { dg-final { scan-assembler-not "(fistp|fild)" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr71245-2.c b/gcc/testsuite/gcc.target/i386/pr71245-2.c
deleted file mode 100644
index 65c1398..0000000
--- a/gcc/testsuite/gcc.target/i386/pr71245-2.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* PR target/71245 */
-/* { dg-do compile { target ia32 } } */
-/* { dg-options "-O2 -march=pentium -msse -mno-sse2 -mfpmath=387" } */
-
-typedef union
-{
- unsigned long long ll;
- double d;
-} u_t;
-
-u_t d = { .d = 5.0 };
-
-void foo_d (void)
-{
- u_t tmp;
-
- tmp.ll = __atomic_load_n (&d.ll, __ATOMIC_SEQ_CST);
- tmp.d += 1.0;
- __atomic_store_n (&d.ll, tmp.ll, __ATOMIC_SEQ_CST);
-}
-
-/* { dg-final { scan-assembler-not "movlps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr72839.c b/gcc/testsuite/gcc.target/i386/pr72839.c
index ea724f7..6888d9d 100644
--- a/gcc/testsuite/gcc.target/i386/pr72839.c
+++ b/gcc/testsuite/gcc.target/i386/pr72839.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target ia32 } */
-/* { dg-options "-O2 -mtune=lakemont" } */
+/* { dg-options "-O2 -mtune=lakemont -mno-avx" } */
extern char *strcpy (char *, const char *);
diff --git a/gcc/testsuite/gcc.target/i386/pr78103-1.c b/gcc/testsuite/gcc.target/i386/pr78103-1.c
new file mode 100644
index 0000000..95aea69
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr78103-1.c
@@ -0,0 +1,28 @@
+/* PR target/78103 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-lzcnt" } */
+/* { dg-final { scan-assembler-not {\mcltq\M} } } */
+
+long long
+foo (long long x)
+{
+ return __builtin_clzll (x);
+}
+
+long long
+bar (long long x)
+{
+ return (unsigned int) __builtin_clzll (x);
+}
+
+long long
+baz (int x)
+{
+ return __builtin_clz (x);
+}
+
+long long
+qux (int x)
+{
+ return (unsigned int) __builtin_clz (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr78103-2.c b/gcc/testsuite/gcc.target/i386/pr78103-2.c
new file mode 100644
index 0000000..30f7f98
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr78103-2.c
@@ -0,0 +1,33 @@
+/* PR target/78103 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-lzcnt" } */
+/* { dg-final { scan-assembler-not {\mmovl\M} } } */
+/* { dg-final { scan-assembler-not {\mxor[lq]\M} } } */
+/* { dg-final { scan-assembler-not {\msubl\M} } } */
+/* { dg-final { scan-assembler {\m(leal|addl|incl)\M} } } */
+
+unsigned int
+foo (unsigned int x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned int) - __builtin_clz (x);
+}
+
+unsigned int
+bar (unsigned int x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned int) - 1 - __builtin_clz (x);
+}
+
+#ifdef __x86_64__
+unsigned int
+baz (unsigned long long x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned long long) - __builtin_clzll (x);
+}
+
+unsigned int
+qux (unsigned long long x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned long long) - 1 - __builtin_clzll (x);
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr78103-3.c b/gcc/testsuite/gcc.target/i386/pr78103-3.c
new file mode 100644
index 0000000..b8d8231
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr78103-3.c
@@ -0,0 +1,33 @@
+/* PR target/78103 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-lzcnt" } */
+/* { dg-final { scan-assembler-not {\mmovl\M} } } */
+/* { dg-final { scan-assembler-not {\mmovslq\M} } } */
+/* { dg-final { scan-assembler-not {\mxor[lq]\M} } } */
+/* { dg-final { scan-assembler-not {\msubq\M} } } */
+/* { dg-final { scan-assembler {\m(leaq|addq|incq)\M} { target { ! x32 } } } } */
+/* { dg-final { scan-assembler {\m(leal|addl|incl)\M} { target x32 } } } */
+
+unsigned long long
+foo (unsigned int x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned int) - __builtin_clz (x);
+}
+
+unsigned long long
+bar (unsigned int x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned int) - 1 - __builtin_clz (x);
+}
+
+unsigned long long
+baz (unsigned long long x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned long long) - __builtin_clzll (x);
+}
+
+unsigned long long
+qux (unsigned long long x)
+{
+ return __CHAR_BIT__ * sizeof (unsigned long long) - 1 - __builtin_clzll (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr79514.c b/gcc/testsuite/gcc.target/i386/pr79514.c
index c5b7bf8..8235da6 100644
--- a/gcc/testsuite/gcc.target/i386/pr79514.c
+++ b/gcc/testsuite/gcc.target/i386/pr79514.c
@@ -1,6 +1,7 @@
/* PR target/79514 */
/* { dg-do compile } */
/* { dg-options "-m96bit-long-double" } */
+/* { dg-error "'-m96bit-long-double' is not compatible" "" { target { ! ia32 } } 0 } */
extern void bar (long double);
diff --git a/gcc/testsuite/gcc.target/i386/pr82460-2.c b/gcc/testsuite/gcc.target/i386/pr82460-2.c
index 4a45bee..8cdfb54 100644
--- a/gcc/testsuite/gcc.target/i386/pr82460-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr82460-2.c
@@ -1,6 +1,6 @@
/* PR target/82460 */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -mavx512vbmi -mprefer-vector-width=none" } */
+/* { dg-options "-O2 -ftree-vectorize -mavx512vbmi -mprefer-vector-width=none --param=vect-epilogues-nomask=0" } */
/* We want to reuse the permutation mask in the loop, so use vpermt2b rather
than vpermi2b. */
/* { dg-final { scan-assembler-not {\mvpermi2b\M} } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82735-1.c b/gcc/testsuite/gcc.target/i386/pr82735-1.c
new file mode 100644
index 0000000..1a63b9a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82735-1.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx" } */
+/* { dg-require-effective-target avx } */
+
+#include "avx-check.h"
+
+void
+__attribute__ ((noipa))
+mtest(char *dest)
+{
+ __m256i ymm1 = _mm256_set1_epi8((char)0x1);
+ _mm256_storeu_si256((__m256i *)(dest + 32), ymm1);
+ _mm256_zeroupper();
+ __m256i ymm2 = _mm256_set1_epi8((char)0x1);
+ _mm256_storeu_si256((__m256i *)dest, ymm2);
+}
+
+void
+avx_test ()
+{
+ char buf[64];
+ for (int i = 0; i != 64; i++)
+ buf[i] = 2;
+ mtest (buf);
+
+ for (int i = 0; i < 32; ++i)
+ if (buf[i] != 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82735-2.c b/gcc/testsuite/gcc.target/i386/pr82735-2.c
new file mode 100644
index 0000000..ac9d006
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82735-2.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx -O2" } */
+
+#include <immintrin.h>
+
+void test(char *dest)
+{
+ /* xmm1 can be propagated to xmm2 by CSE. */
+ __m128i xmm1 = _mm_set_epi8(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
+ 0x9, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16);
+ _mm_storeu_si128((__m128i *)(dest + 32), xmm1);
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ __m128i xmm2 = xmm1;
+ _mm_storeu_si128((__m128i *)dest, xmm2);
+}
+
+/* Darwin local constant symbol is "lC0", ELF targets ".LC0" */
+/* { dg-final { scan-assembler-times {(?n)vmovdqa\t\.?[Ll]C0[^,]*, %xmm[0-9]} 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82735-3.c b/gcc/testsuite/gcc.target/i386/pr82735-3.c
new file mode 100644
index 0000000..854087d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82735-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-mavx -O2 -mabi=ms" } */
+/* { dg-final { scan-assembler-not {(?n)xmm([6-9]|1[0-5])} } } */
+
+#include "pr82735-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr82735-4.c b/gcc/testsuite/gcc.target/i386/pr82735-4.c
new file mode 100644
index 0000000..2218ffc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82735-4.c
@@ -0,0 +1,48 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-mavx -O2 -mabi=ms -mno-avx512f -masm=att" } */
+/* { dg-final { scan-assembler-times {(?n)(?:vmovdqa[1-9]*|vmovap[sd])[\t ]*%xmm[0-9]+, [0-9]*\(%rsp\)} 10 } } */
+/* { dg-final { scan-assembler-times {(?n)(?:vmovdqa[1-9]*|vmovap[sd])[\t ]*[0-9]*\(%rsp\), %xmm[0-9]+} 10 } } */
+
+#include <immintrin.h>
+
+void test(char *dest)
+{
+ __m256i ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, ymm8, ymm9, ymm10, ymm11, ymm12, ymm13, ymm14, ymm15;
+ asm volatile ("vmovdqa\t%%ymm0, %0\n\t"
+ "vmovdqa\t%%ymm0, %1\n\t"
+ "vmovdqa\t%%ymm0, %2\n\t"
+ "vmovdqa\t%%ymm0, %3\n\t"
+ "vmovdqa\t%%ymm0, %4\n\t"
+ "vmovdqa\t%%ymm0, %5\n\t"
+ "vmovdqa\t%%ymm0, %6\n\t"
+ "vmovdqa\t%%ymm0, %7\n\t"
+ "vmovdqa\t%%ymm0, %8\n\t"
+ "vmovdqa\t%%ymm0, %9\n\t"
+ "vmovdqa\t%%ymm0, %10\n\t"
+ "vmovdqa\t%%ymm0, %11\n\t"
+ "vmovdqa\t%%ymm0, %12\n\t"
+ "vmovdqa\t%%ymm0, %13\n\t"
+ "vmovdqa\t%%ymm0, %14\n\t"
+ "vmovdqa\t%%ymm0, %15\n\t"
+ : "=v" (ymm1), "=v" (ymm2), "=v"(ymm3), "=v" (ymm4), "=v" (ymm5),
+ "=v" (ymm6), "=v" (ymm7), "=v"(ymm8), "=v" (ymm9), "=v" (ymm10),
+ "=v" (ymm11), "=v" (ymm12), "=v"(ymm13), "=v" (ymm14), "=v" (ymm15),
+ "=v"(ymm0)
+ ::);
+ _mm256_zeroupper();
+ _mm256_storeu_si256((__m256i *)dest, ymm1);
+ _mm256_storeu_si256((__m256i *)(dest + 32), ymm2);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 2), ymm3);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 3), ymm4);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 4), ymm5);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 5), ymm6);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 6), ymm7);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 7), ymm8);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 8), ymm9);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 9), ymm10);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 10), ymm11);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 11), ymm12);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 12), ymm13);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 13), ymm14);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 14), ymm15);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82735-5.c b/gcc/testsuite/gcc.target/i386/pr82735-5.c
new file mode 100644
index 0000000..a9ef05f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82735-5.c
@@ -0,0 +1,54 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-mavx -O2 -mabi=ms -mno-avx512f -masm=att" } */
+/* { dg-final { scan-assembler-times {(?n)(?:vmovdqa[1-9]*|vmovap[sd])[\t ]*%xmm[0-9]+, [0-9]*\(%rsp\)} 10 } } */
+/* { dg-final { scan-assembler-times {(?n)(?:vmovdqa[1-9]*|vmovap[sd])[\t ]*[0-9]*\(%rsp\), %xmm[0-9]+} 10 } } */
+
+#include <immintrin.h>
+
+void test(char *dest)
+{
+ __m256i ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, ymm8, ymm9, ymm10, ymm11, ymm12, ymm13, ymm14, ymm15;
+ asm volatile ("vmovdqa\t%%ymm0, %0\n\t"
+ "vmovdqa\t%%ymm0, %1\n\t"
+ "vmovdqa\t%%ymm0, %2\n\t"
+ "vmovdqa\t%%ymm0, %3\n\t"
+ "vmovdqa\t%%ymm0, %4\n\t"
+ "vmovdqa\t%%ymm0, %5\n\t"
+ "vmovdqa\t%%ymm0, %6\n\t"
+ "vmovdqa\t%%ymm0, %7\n\t"
+ "vmovdqa\t%%ymm0, %8\n\t"
+ "vmovdqa\t%%ymm0, %9\n\t"
+ "vmovdqa\t%%ymm0, %10\n\t"
+ "vmovdqa\t%%ymm0, %11\n\t"
+ "vmovdqa\t%%ymm0, %12\n\t"
+ "vmovdqa\t%%ymm0, %13\n\t"
+ "vmovdqa\t%%ymm0, %14\n\t"
+ "vmovdqa\t%%ymm0, %15\n\t"
+ : "=v" (ymm1), "=v" (ymm2), "=v"(ymm3), "=v" (ymm4), "=v" (ymm5),
+ "=v" (ymm6), "=v" (ymm7), "=v"(ymm8), "=v" (ymm9), "=v" (ymm10),
+ "=v" (ymm11), "=v" (ymm12), "=v"(ymm13), "=v" (ymm14), "=v" (ymm15),
+ "=v"(ymm0)
+ ::);
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_zeroupper();
+ _mm256_storeu_si256((__m256i *)dest, ymm1);
+ _mm256_storeu_si256((__m256i *)(dest + 32), ymm2);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 2), ymm3);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 3), ymm4);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 4), ymm5);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 5), ymm6);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 6), ymm7);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 7), ymm8);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 8), ymm9);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 9), ymm10);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 10), ymm11);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 11), ymm12);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 12), ymm13);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 13), ymm14);
+ _mm256_storeu_si256((__m256i *)(dest + 32 * 14), ymm15);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82941-1.c b/gcc/testsuite/gcc.target/i386/pr82941-1.c
index d7e530d..c3be2f5 100644
--- a/gcc/testsuite/gcc.target/i386/pr82941-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr82941-1.c
@@ -11,4 +11,5 @@ pr82941 ()
z = y;
}
-/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vzeroupper" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82942-1.c b/gcc/testsuite/gcc.target/i386/pr82942-1.c
index 9cdf81a..29ead04 100644
--- a/gcc/testsuite/gcc.target/i386/pr82942-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr82942-1.c
@@ -3,4 +3,5 @@
#include "pr82941-1.c"
-/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vzeroupper" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-1.c b/gcc/testsuite/gcc.target/i386/pr82990-1.c
index ff1d6d4..bbf580f 100644
--- a/gcc/testsuite/gcc.target/i386/pr82990-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr82990-1.c
@@ -11,4 +11,5 @@ pr82941 ()
z = y;
}
-/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vzeroupper" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-3.c b/gcc/testsuite/gcc.target/i386/pr82990-3.c
index 201fa98..89ddb20 100644
--- a/gcc/testsuite/gcc.target/i386/pr82990-3.c
+++ b/gcc/testsuite/gcc.target/i386/pr82990-3.c
@@ -3,4 +3,5 @@
#include "pr82941-1.c"
-/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vzeroupper" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-5.c b/gcc/testsuite/gcc.target/i386/pr82990-5.c
index 9932bdc..b9da0e7 100644
--- a/gcc/testsuite/gcc.target/i386/pr82990-5.c
+++ b/gcc/testsuite/gcc.target/i386/pr82990-5.c
@@ -11,4 +11,5 @@ pr82941 ()
z = y;
}
-/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
+/* { dg-final { scan-assembler-times "vzeroupper" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "vzeroupper" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85819-1a.c b/gcc/testsuite/gcc.target/i386/pr85819-1a.c
new file mode 100644
index 0000000..db02282
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85819-1a.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mfma -mfpmath=sse" } */
+
+float
+foo (unsigned int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler "vfmadd132ss" { target ia32 } } } */
+/* { dg-final { scan-assembler "vcvtsi2ssq" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85819-1b.c b/gcc/testsuite/gcc.target/i386/pr85819-1b.c
new file mode 100644
index 0000000..f1408c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85819-1b.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mfpmath=sse" } */
+
+#include "pr85819-1a.c"
+
+/* { dg-final { scan-assembler "vcvtusi2ss" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85819-2a.c b/gcc/testsuite/gcc.target/i386/pr85819-2a.c
new file mode 100644
index 0000000..cea599f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85819-2a.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx512f -mavx2 -mfma -mfpmath=sse" } */
+
+typedef float To __attribute__ ((__vector_size__ (32)));
+typedef unsigned int From __attribute__ ((__vector_size__ (32)));
+
+#define A2(I) (float)a[I], (float)a[1+I]
+#define A4(I) A2(I), A2(2+I)
+#define A8(I) A4(I), A4(4+I)
+
+To
+f(From a)
+{
+ return __extension__ (To) {A8(0)};
+}
+
+/* { dg-final { scan-assembler "vfmadd132ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85819-2b.c b/gcc/testsuite/gcc.target/i386/pr85819-2b.c
new file mode 100644
index 0000000..0750e56
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85819-2b.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl -mfpmath=sse" } */
+
+#include "pr85819-2a.c"
+
+/* { dg-final { scan-assembler "vcvtudq2ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85819-2c.c b/gcc/testsuite/gcc.target/i386/pr85819-2c.c
new file mode 100644
index 0000000..8211669
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85819-2c.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-fma -mno-avx2 -mno-avx512vl -mavx512f -mfpmath=sse" } */
+
+#include "pr85819-2a.c"
+
+/* { dg-final { scan-assembler-not "vcvtudq2ps" } } */
+/* { dg-final { scan-assembler-not "vfmadd132ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85819-3.c b/gcc/testsuite/gcc.target/i386/pr85819-3.c
new file mode 100644
index 0000000..cd3bf9b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85819-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mfpmath=sse" } */
+
+typedef float To __attribute__ ((__vector_size__ (64)));
+typedef unsigned int From __attribute__ ((__vector_size__ (64)));
+
+#define A2(I) (float)a[I], (float)a[1+I]
+#define A4(I) A2(I), A2(2+I)
+#define A8(I) A4(I), A4(4+I)
+#define A16(I) A8(I), A8(8+I)
+
+To
+f(From a)
+{
+ return __extension__ (To) {A16(0)};
+}
+
+/* { dg-final { scan-assembler "vcvtudq2ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr86723.c b/gcc/testsuite/gcc.target/i386/pr86723.c
new file mode 100644
index 0000000..b61d750c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr86723.c
@@ -0,0 +1,52 @@
+/* PR tree-optimization/86723 */
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "\tbswap\t" 5 } } */
+
+int
+foo (unsigned long long value)
+{
+ return (((value & 0x00000000000000ffull) << 56)
+ | ((value & 0x000000000000ff00ull) << 40)
+ | ((value & 0x0000000000ff0000ull) << 24)
+ | ((value & 0x00000000ff000000ull) << 8)
+ | ((value & 0x000000ff00000000ull) >> 8)
+ | ((value & 0x0000ff0000000000ull) >> 24)
+ | ((value & 0x00ff000000000000ull) >> 40)
+ | ((value & 0xff00000000000000ull) >> 56));
+}
+
+int
+bar (unsigned long long value)
+{
+ return (((value & 0x000000ff00000000ull) >> 8)
+ | ((value & 0x0000ff0000000000ull) >> 24)
+ | ((value & 0x00ff000000000000ull) >> 40)
+ | ((value & 0xff00000000000000ull) >> 56));
+}
+
+unsigned long long
+baz (unsigned long long value)
+{
+ return (((value & 0x00000000000000ffull) << 56)
+ | ((value & 0x000000000000ff00ull) << 40)
+ | ((value & 0x00000000ff000000ull) << 8)
+ | ((value & 0x000000ff00000000ull) >> 8)
+ | ((value & 0x0000ff0000000000ull) >> 24)
+ | ((value & 0xff00000000000000ull) >> 56));
+}
+
+unsigned int
+qux (unsigned int value)
+{
+ return (((value & 0x000000ff) << 24)
+ | ((value & 0x00ff0000) >> 8)
+ | ((value & 0xff000000) >> 24));
+}
+
+unsigned int
+corge (unsigned int value)
+{
+ return (((value & 0x000000ff) << 24)
+ | ((value & 0xff000000) >> 24));
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-1a.c b/gcc/testsuite/gcc.target/i386/pr88531-1a.c
new file mode 100644
index 0000000..5e4f28e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-1a.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=x86-64 -mfpmath=sse" } */
+
+#include <stdint.h>
+
+#define loop_t uint32_t
+#define idx_t uint32_t
+
+void loop(double * const __restrict__ dst,
+ double const * const __restrict__ src,
+ idx_t const * const __restrict__ idx,
+ loop_t const begin,
+ loop_t const end)
+{
+ for (loop_t i = begin; i < end; ++i)
+ dst[i] = 42.0 * src[idx[i]];
+}
+
+/* { dg-final { scan-assembler-times "mulpd" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-1b.c b/gcc/testsuite/gcc.target/i386/pr88531-1b.c
new file mode 100644
index 0000000..812c8a1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-1b.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake -mfpmath=sse" } */
+
+#include "pr88531-1a.c"
+
+/* { dg-final { scan-assembler-times "vgatherdpd" 4 { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler-times "vgatherqpd" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "vmulpd" 4 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-1c.c b/gcc/testsuite/gcc.target/i386/pr88531-1c.c
new file mode 100644
index 0000000..43fc591
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-1c.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512 -mfpmath=sse" } */
+
+#include "pr88531-1a.c"
+
+/* { dg-final { scan-assembler-times "vgatherdpd" 4 { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler-times "vgatherqpd" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "vmulpd" 4 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-2a.c b/gcc/testsuite/gcc.target/i386/pr88531-2a.c
new file mode 100644
index 0000000..8ab2b13
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-2a.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=x86-64 -mfpmath=sse" } */
+
+#include <stdint.h>
+
+#define loop_t uint32_t
+#define idx_t uint32_t
+
+void loop(float * const __restrict__ dst,
+ float const * const __restrict__ src,
+ idx_t const * const __restrict__ idx,
+ loop_t const begin,
+ loop_t const end)
+{
+ for (loop_t i = begin; i < end; ++i)
+ dst[i] = 42.0 * src[idx[i]];
+}
+
+/* { dg-final { scan-assembler-times "mulps" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-2b.c b/gcc/testsuite/gcc.target/i386/pr88531-2b.c
new file mode 100644
index 0000000..011607c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-2b.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake -mfpmath=sse" } */
+
+#include "pr88531-2a.c"
+
+/* { dg-final { scan-assembler-times "vmulps" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-2c.c b/gcc/testsuite/gcc.target/i386/pr88531-2c.c
new file mode 100644
index 0000000..0f7ec38
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-2c.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512 -mfpmath=sse" } */
+
+#include "pr88531-2a.c"
+
+/* { dg-final { scan-assembler-times "vmulps" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr89676.c b/gcc/testsuite/gcc.target/i386/pr89676.c
index 164a9da..7afa1a1 100644
--- a/gcc/testsuite/gcc.target/i386/pr89676.c
+++ b/gcc/testsuite/gcc.target/i386/pr89676.c
@@ -1,6 +1,6 @@
/* PR rtl-optimization/89676 */
/* { dg-do compile { target ia32 } } */
-/* { dg-options "-O2 -mno-stv" } */
+/* { dg-options "-O2 -mno-stv -fomit-frame-pointer" } */
unsigned long long
foo (unsigned long long i)
diff --git a/gcc/testsuite/gcc.target/i386/pr89984-1.c b/gcc/testsuite/gcc.target/i386/pr89984-1.c
new file mode 100644
index 0000000..d77691c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr89984-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-avx -msse2" } */
+
+float
+check_f_pos (float x, float y)
+{
+ return x * __builtin_copysignf (1.0f, y);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr89984-2.c b/gcc/testsuite/gcc.target/i386/pr89984-2.c
new file mode 100644
index 0000000..ff6a8e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr89984-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx" } */
+
+float
+check_f_pos (float x, float y)
+{
+ return x * __builtin_copysignf (1.0f, y);
+}
+
+/* { dg-final { scan-assembler-not "vmovaps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-1.c b/gcc/testsuite/gcc.target/i386/pr90773-1.c
new file mode 100644
index 0000000..4fd5a40
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mtune=generic" } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 15);
+}
+
+/* { dg-final { scan-assembler-times "movq\[\\t \]+\\(%\[\^,\]+\\)," 1 } } */
+/* { dg-final { scan-assembler-times "movq\[\\t \]+7\\(%\[\^,\]+\\)," 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-10.c b/gcc/testsuite/gcc.target/i386/pr90773-10.c
new file mode 100644
index 0000000..9ad725e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-10.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int c)
+{
+ __builtin_memset (dst, c, 5);
+}
+
+/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movb\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-11.c b/gcc/testsuite/gcc.target/i386/pr90773-11.c
new file mode 100644
index 0000000..1734c03
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-11.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (int c)
+{
+ __builtin_memset (dst, c, 6);
+}
+
+/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movw\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-12.c b/gcc/testsuite/gcc.target/i386/pr90773-12.c
new file mode 100644
index 0000000..e45840a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-12.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=skylake" } */
+
+void
+foo (char *dst, char *src)
+{
+ __builtin_memcpy (dst, src, 255);
+}
+
+/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\[0-9\]*\\(%\[\^,\]+\\)," 16 } } */
+/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-13.c b/gcc/testsuite/gcc.target/i386/pr90773-13.c
new file mode 100644
index 0000000..4d5ae8d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-13.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=skylake" } */
+
+void
+foo (char *dst)
+{
+ __builtin_memset (dst, 0, 255);
+}
+
+/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \[0-9\]*\\(%\[\^,\]+\\)" 16 } } */
+/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-14.c b/gcc/testsuite/gcc.target/i386/pr90773-14.c
new file mode 100644
index 0000000..96ee5cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-14.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 1, 20);
+}
+
+/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movd\[\\t \]+%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-15.c b/gcc/testsuite/gcc.target/i386/pr90773-15.c
new file mode 100644
index 0000000..403cdb2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-15.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+extern char *dst;
+
+void
+foo (int c)
+{
+ __builtin_memset (dst, c, 17);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%.*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movb\[\\t \]+%.*, 16\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-16.c b/gcc/testsuite/gcc.target/i386/pr90773-16.c
new file mode 100644
index 0000000..bb0aadb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-16.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, -1, 17);
+}
+
+/* { dg-final { scan-assembler-times "(?:vpcmpeqd|vpternlogd)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movb\[\\t \]+\\\$-1, 16\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-17.c b/gcc/testsuite/gcc.target/i386/pr90773-17.c
new file mode 100644
index 0000000..73d5d5ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-17.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 12, 19);
+}
+
+/* { dg-final { scan-assembler-times "vpbroadcastb" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovd\[\\t \]+%xmm\[0-9\]+, 15\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-18.c b/gcc/testsuite/gcc.target/i386/pr90773-18.c
new file mode 100644
index 0000000..b0687ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-18.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 12, 9);
+}
+
+/* { dg-final { scan-assembler-times "movabsq\[\\t \]+\\\$868082074056920076, %r" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\\$202116108, \\(%\[\^,\]+\\)" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\\$202116108, 4\\(%\[\^,\]+\\)" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movb\[\\t \]+\\\$12, 8\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-19.c b/gcc/testsuite/gcc.target/i386/pr90773-19.c
new file mode 100644
index 0000000..8aa5540
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-19.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 12, 9);
+}
+
+/* { dg-final { scan-assembler-times "movabsq\[\\t \]+\\\$868082074056920076, %r" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\\$202116108, \\(%\[\^,\]+\\)" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\\$202116108, 4\\(%\[\^,\]+\\)" 1 { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-2.c b/gcc/testsuite/gcc.target/i386/pr90773-2.c
new file mode 100644
index 0000000..6449575
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+/* { dg-additional-options "-mno-avx -msse2" { target { ! ia32 } } } */
+/* { dg-additional-options "-mno-sse" { target ia32 } } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 19);
+}
+
+/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+4\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+8\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+12\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-20.c b/gcc/testsuite/gcc.target/i386/pr90773-20.c
new file mode 100644
index 0000000..884a550
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-20.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (int c)
+{
+ __builtin_memset (dst, c, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movb\[\\t \]+.+, 32\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-21.c b/gcc/testsuite/gcc.target/i386/pr90773-21.c
new file mode 100644
index 0000000..5bbb387
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-21.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (int c)
+{
+ __builtin_memset (dst, c, 34);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movw\[\\t \]%.*, 32\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-22.c b/gcc/testsuite/gcc.target/i386/pr90773-22.c
new file mode 100644
index 0000000..245a436
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-22.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 33);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movb\[\\t \]+.+, 32\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-23.c b/gcc/testsuite/gcc.target/i386/pr90773-23.c
new file mode 100644
index 0000000..ca4a86f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-23.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mtune-ctrl=avx256_store_by_pieces" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 34);
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movw\[\\t \]+.+, 32\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-24.c b/gcc/testsuite/gcc.target/i386/pr90773-24.c
new file mode 100644
index 0000000..71f1fd8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-24.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64" } */
+
+struct S
+{
+ long long s1 __attribute__ ((aligned (8)));
+ unsigned s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
+};
+
+const struct S array[] = {
+ { 0, 60, 640, 2112543726, 39682, 48, 16, 33, 10, 96, 2, 0, 0, 4 }
+};
+
+void
+foo (struct S *x)
+{
+ x[0] = array[0];
+}
+
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 32\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 48\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-25.c b/gcc/testsuite/gcc.target/i386/pr90773-25.c
new file mode 100644
index 0000000..ad19a88
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-25.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=x86-64" } */
+
+struct S
+{
+ long long s1 __attribute__ ((aligned (8)));
+ unsigned s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
+};
+
+const struct S array[] = {
+ { 0, }
+};
+
+void
+foo (struct S *x)
+{
+ x[0] = array[0];
+}
+
+/* { dg-final { scan-assembler-not "movdqa" } } */
+/* { dg-final { scan-assembler-times "pxor\[\\t \]%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 32\\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 48\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-26.c b/gcc/testsuite/gcc.target/i386/pr90773-26.c
new file mode 100644
index 0000000..76fb79f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-26.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake -mtune-ctrl=avx256_move_by_pieces" } */
+
+struct S
+{
+ long long s1 __attribute__ ((aligned (8)));
+ unsigned s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
+};
+
+const struct S array[] = {
+ { 0, 60, 640, 2112543726, 39682, 48, 16, 33, 10, 96, 2, 0, 0, 4 }
+};
+
+void
+foo (struct S *x)
+{
+ x[0] = array[0];
+}
+
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, 32\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-3.c b/gcc/testsuite/gcc.target/i386/pr90773-3.c
new file mode 100644
index 0000000..84747c9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-3.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+/* { dg-additional-options "-mno-avx -msse2" { target { ! ia32 } } } */
+/* { dg-additional-options "-mno-sse" { target ia32 } } */
+
+extern char *dst, *src;
+
+void
+foo (void)
+{
+ __builtin_memcpy (dst, src, 31);
+}
+
+/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "movdqu\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+4\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+8\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+12\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+16\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+20\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+24\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+27\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-4.c b/gcc/testsuite/gcc.target/i386/pr90773-4.c
new file mode 100644
index 0000000..ee4c046
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-4.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 31);
+}
+
+/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, 15\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-5.c b/gcc/testsuite/gcc.target/i386/pr90773-5.c
new file mode 100644
index 0000000..27185a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-5.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 21);
+}
+
+/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movq\[\\t \]+%xmm\[0-9\]+, 13\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-6.c b/gcc/testsuite/gcc.target/i386/pr90773-6.c
new file mode 100644
index 0000000..46498f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-6.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */
+
+void
+foo (char *dst, char *src)
+{
+ __builtin_memcpy (dst, src, 255);
+}
+
+/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\[0-9\]*\\(%\[\^,\]+\\)," 16 } } */
+/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-7.c b/gcc/testsuite/gcc.target/i386/pr90773-7.c
new file mode 100644
index 0000000..4d5ae8d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-7.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-avx -msse2 -mtune=skylake" } */
+
+void
+foo (char *dst)
+{
+ __builtin_memset (dst, 0, 255);
+}
+
+/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \[0-9\]*\\(%\[\^,\]+\\)" 16 } } */
+/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-8.c b/gcc/testsuite/gcc.target/i386/pr90773-8.c
new file mode 100644
index 0000000..0d47845
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-8.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 5);
+}
+
+/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movb\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-9.c b/gcc/testsuite/gcc.target/i386/pr90773-9.c
new file mode 100644
index 0000000..ab5ea45
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90773-9.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+extern char *dst;
+
+void
+foo (void)
+{
+ __builtin_memset (dst, 0, 6);
+}
+
+/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */
+/* { dg-final { scan-assembler-times "movw\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr91103-1.c b/gcc/testsuite/gcc.target/i386/pr91103-1.c
new file mode 100644
index 0000000..11caaa8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr91103-1.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "valign\[dq\]" 16 } } */
+
+typedef float v8sf __attribute__((vector_size(32)));
+typedef float v16sf __attribute__((vector_size(64)));
+typedef int v8si __attribute__((vector_size(32)));
+typedef int v16si __attribute__((vector_size(64)));
+typedef double v4df __attribute__((vector_size(32)));
+typedef double v8df __attribute__((vector_size(64)));
+typedef long long v4di __attribute__((vector_size(32)));
+typedef long long v8di __attribute__((vector_size(64)));
+
+#define EXTRACT(V,S,IDX) \
+ S \
+ __attribute__((noipa)) \
+ foo_##V##_##IDX (V v) \
+ { \
+ return v[IDX]; \
+ } \
+
+EXTRACT (v8sf, float, 4);
+EXTRACT (v8sf, float, 7);
+EXTRACT (v8si, int, 4);
+EXTRACT (v8si, int, 7);
+EXTRACT (v16sf, float, 8);
+EXTRACT (v16sf, float, 15);
+EXTRACT (v16si, int, 8);
+EXTRACT (v16si, int, 15);
+EXTRACT (v4df, double, 2);
+EXTRACT (v4df, double, 3);
+EXTRACT (v4di, long long, 2);
+EXTRACT (v4di, long long, 3);
+EXTRACT (v8df, double, 4);
+EXTRACT (v8df, double, 7);
+EXTRACT (v8di, long long, 4);
+EXTRACT (v8di, long long, 7);
diff --git a/gcc/testsuite/gcc.target/i386/pr91103-2.c b/gcc/testsuite/gcc.target/i386/pr91103-2.c
new file mode 100644
index 0000000..010e477
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr91103-2.c
@@ -0,0 +1,81 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-require-effective-target avx512vl } */
+
+#define AVX512VL
+
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+#include "pr91103-1.c"
+
+#define RUNCHECK(U,V,S,IDX) \
+ do \
+ { \
+ S tmp = foo_##V##_##IDX ((V)U.x); \
+ if (tmp != U.a[IDX]) \
+ abort(); \
+ } \
+ while (0)
+
+void
+test_256 (void)
+{
+ union512i_d di1;
+ union256i_d di2;
+ union512i_q q1;
+ union256i_q q2;
+ union512 f1;
+ union256 f2;
+ union512d d1;
+ union256d d2;
+ int sign = 1;
+
+ int i = 0;
+ for (i = 0; i < 16; i++)
+ {
+ di1.a[i] = 30 * (i - 30) * sign;
+ f1.a[i] = 56.78 * (i - 30) * sign;
+ sign = -sign;
+ }
+
+ for (i = 0; i != 8; i++)
+ {
+ di2.a[i] = 15 * (i + 40) * sign;
+ f2.a[i] = 90.12 * (i + 40) * sign;
+ q1.a[i] = 15 * (i + 40) * sign;
+ d1.a[i] = 90.12 * (i + 40) * sign;
+ sign = -sign;
+ }
+
+ for (i = 0; i != 4; i++)
+ {
+ q2.a[i] = 15 * (i + 40) * sign;
+ d2.a[i] = 90.12 * (i + 40) * sign;
+ sign = -sign;
+ }
+
+RUNCHECK (f2, v8sf, float, 4);
+RUNCHECK (f2, v8sf, float, 7);
+RUNCHECK (di2, v8si, int, 4);
+RUNCHECK (di2, v8si, int, 7);
+RUNCHECK (f1, v16sf, float, 8);
+RUNCHECK (f1, v16sf, float, 15);
+RUNCHECK (di1, v16si, int, 8);
+RUNCHECK (di1, v16si, int, 15);
+RUNCHECK (d2, v4df, double, 2);
+RUNCHECK (d2, v4df, double, 3);
+RUNCHECK (q2, v4di, long long, 2);
+RUNCHECK (q2, v4di, long long, 3);
+RUNCHECK (d1, v8df, double, 4);
+RUNCHECK (d1, v8df, double, 7);
+RUNCHECK (q1, v8di, long long, 4);
+RUNCHECK (q1, v8di, long long, 7);
+}
+
+void
+test_128()
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr91400-1.c b/gcc/testsuite/gcc.target/i386/pr91400-1.c
new file mode 100644
index 0000000..6124058
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr91400-1.c
@@ -0,0 +1,14 @@
+/* PR target/91400 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "andl" 1 } } */
+/* { dg-final { scan-assembler-times "cmpl" 1 } } */
+/* { dg-final { scan-assembler-times "sete" 1 } } */
+/* { dg-final { scan-assembler-not "cmove" } } */
+
+_Bool
+f (void)
+{
+ return __builtin_cpu_supports("popcnt")
+ && __builtin_cpu_supports("ssse3");
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr91400-2.c b/gcc/testsuite/gcc.target/i386/pr91400-2.c
new file mode 100644
index 0000000..1af5a2f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr91400-2.c
@@ -0,0 +1,14 @@
+/* PR target/91400 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "andl" 1 } } */
+/* { dg-final { scan-assembler-times "cmpl" 1 } } */
+/* { dg-final { scan-assembler-times "sete" 1 } } */
+/* { dg-final { scan-assembler-not "cmove" } } */
+
+_Bool
+f (void)
+{
+ return __builtin_cpu_supports("avx512vnni")
+ && __builtin_cpu_supports("3dnow");
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr91446.c b/gcc/testsuite/gcc.target/i386/pr91446.c
index f7c4bea..0243ca3 100644
--- a/gcc/testsuite/gcc.target/i386/pr91446.c
+++ b/gcc/testsuite/gcc.target/i386/pr91446.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -march=skylake -ftree-slp-vectorize -mtune-ctrl=^sse_typeless_stores" } */
+/* { dg-options "-O2 -march=icelake-server -ftree-slp-vectorize -mtune-ctrl=^sse_typeless_stores" } */
typedef struct
{
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c
index 7aad858..6c30702 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c
@@ -109,7 +109,7 @@ bar_s8_s64 (v4di * dst, v32qi src)
dst[0] = *(v4di *) tem;
}
-/* { dg-final { scan-assembler-times "pmovsxbq" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "pmovsxbq" 2 } } */
void
foo_s16_s32 (v8si * dst, v16hi * __restrict src)
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c
index 21fa3e5..70b5bdb 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c
@@ -109,7 +109,7 @@ bar_u8_u64 (v4di * dst, v32qi src)
dst[0] = *(v4di *) tem;
}
-/* { dg-final { scan-assembler-times "pmovzxbq" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "pmovzxbq" 2 } } */
void
foo_u16_u32 (v8si * dst, v16hi * __restrict src)
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-2.c
index 33eecbf..3176f85 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-2.c
@@ -1,6 +1,6 @@
/* PR target/92658 */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -mavx512bw -mprefer-vector-width=512" } */
+/* { dg-options "-O2 -mtune=icelake-server -ftree-vectorize -mavx512bw -mprefer-vector-width=512" } */
typedef char v64qi __attribute__((vector_size (64)));
typedef short v32hi __attribute__((vector_size (64)));
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-trunc.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-trunc.c
index c1982f9..fa6d36d 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-trunc.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512bw-trunc.c
@@ -13,7 +13,7 @@ typedef unsigned short v32hi __attribute__((vector_size (64)));
void
truncwb_512 (v32qi * dst, v32hi * __restrict src)
{
- unsigned char tem[8];
+ unsigned char tem[32];
tem[0] = (*src)[0];
tem[1] = (*src)[1];
tem[2] = (*src)[2];
@@ -52,7 +52,7 @@ truncwb_512 (v32qi * dst, v32hi * __restrict src)
void
truncwb_256 (v16qi * dst, v16hi * __restrict src)
{
- unsigned char tem[8];
+ unsigned char tem[16];
tem[0] = (*src)[0];
tem[1] = (*src)[1];
tem[2] = (*src)[2];
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c
index e9ee3d2..e26b06e 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c
@@ -54,7 +54,7 @@ truncqb (v8qi * dst, v8di * __restrict src)
void
truncdw (v16hi * dst, v16si * __restrict src)
{
- unsigned short tem[8];
+ unsigned short tem[16];
tem[0] = (*src)[0];
tem[1] = (*src)[1];
tem[2] = (*src)[2];
@@ -78,7 +78,7 @@ truncdw (v16hi * dst, v16si * __restrict src)
void
truncdb (v16qi * dst, v16si * __restrict src)
{
- unsigned char tem[8];
+ unsigned char tem[16];
tem[0] = (*src)[0];
tem[1] = (*src)[1];
tem[2] = (*src)[2];
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c
index dc50084..7ff9c19 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c
@@ -122,8 +122,7 @@ truncdb_128 (v16qi * dst, v4si * __restrict src)
}
/* { dg-final { scan-assembler-times "vpmovqd" 2 } } */
-/* { dg-final { scan-assembler-times "vpmovqw" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "vpmovqw" 2 } } */
/* { dg-final { scan-assembler-times "vpmovqb" 2 { xfail *-*-* } } } */
-/* { dg-final { scan-assembler-times "vpmovdw" 1 } } */
-/* { dg-final { scan-assembler-times "vpmovdw" 2 { xfail *-*-* } } } */
-/* { dg-final { scan-assembler-times "vpmovdb" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "vpmovdw" 2 } } */
+/* { dg-final { scan-assembler-times "vpmovdb" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c
index ca174ce..a1cf9e7 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c
@@ -1,6 +1,6 @@
/* PR target/92658 */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -msse4.1" } */
+/* { dg-options "-O2 -mtune=icelake-server -ftree-vectorize -msse4.1" } */
typedef char v16qi __attribute__((vector_size (16)));
typedef short v8hi __attribute__((vector_size (16)));
@@ -61,7 +61,7 @@ bar_s8_s32 (v4si * dst, v16qi src)
dst[0] = *(v4si *) tem;
}
-/* { dg-final { scan-assembler-times "pmovsxbd" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "pmovsxbd" 2 } } */
void
foo_s8_s64 (v2di * dst, v16qi * __restrict src)
@@ -125,7 +125,7 @@ bar_s16_s64 (v2di * dst, v8hi src)
dst[0] = *(v2di *) tem;
}
-/* { dg-final { scan-assembler-times "pmovsxwq" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "pmovsxwq" 2 } } */
void
foo_s32_s64 (v2di * dst, v4si * __restrict src)
diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c
index e462629..9fd2eee 100644
--- a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c
+++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c
@@ -1,6 +1,6 @@
/* PR target/92658 */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -msse4.1" } */
+/* { dg-options "-O2 -mtune=icelake-server -ftree-vectorize -msse4.1" } */
typedef unsigned char v16qi __attribute__((vector_size (16)));
typedef unsigned short v8hi __attribute__((vector_size (16)));
@@ -61,7 +61,7 @@ bar_u8_u32 (v4si * dst, v16qi src)
dst[0] = *(v4si *) tem;
}
-/* { dg-final { scan-assembler-times "pmovzxbd" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "pmovzxbd" 2 } } */
void
foo_u8_u64 (v2di * dst, v16qi * __restrict src)
@@ -125,7 +125,7 @@ bar_u16_u64 (v2di * dst, v8hi src)
dst[0] = *(v2di *) tem;
}
-/* { dg-final { scan-assembler-times "pmovzxwq" 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "pmovzxwq" 2 } } */
void
foo_u32_u64 (v2di * dst, v4si * __restrict src)
diff --git a/gcc/testsuite/gcc.target/i386/pr94147.c b/gcc/testsuite/gcc.target/i386/pr94147.c
new file mode 100644
index 0000000..8ff5c34
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr94147.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse3 -mfpmath=sse" } */
+
+#include <x86intrin.h>
+
+double f (__m128d p)
+{
+ return p[0] - p[1];
+}
+
+double g1 (__m128d p)
+{
+ return p[0] + p[1];
+}
+
+double g2 (__m128d p)
+{
+ return p[1] + p[0];
+}
+
+/* { dg-final { scan-assembler-not "hsubpd" } } */
+/* { dg-final { scan-assembler-not "haddpd" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr94467-3.c b/gcc/testsuite/gcc.target/i386/pr94467-3.c
new file mode 100644
index 0000000..b415847
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr94467-3.c
@@ -0,0 +1,4 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O -mavx -mcmodel=large" } */
+
+#include "pr94467-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr95046-9.c b/gcc/testsuite/gcc.target/i386/pr95046-9.c
new file mode 100644
index 0000000..54e948c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95046-9.c
@@ -0,0 +1,14 @@
+/* PR target/95046 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O3 -msse3" } */
+
+float r[2], a[2], b[2];
+
+void
+test (void)
+{
+ r[0] = a[0] - b[0];
+ r[1] = a[1] + b[1];
+}
+
+/* { dg-final { scan-assembler "\tv?addsubps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95443-1.c b/gcc/testsuite/gcc.target/i386/pr95443-1.c
index 698dfa0..d846fcb 100644
--- a/gcc/testsuite/gcc.target/i386/pr95443-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr95443-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
/* { dg-options "-O2 -minline-all-stringops" } */
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr95443-2.c b/gcc/testsuite/gcc.target/i386/pr95443-2.c
index 23bb13a..2ab2606 100644
--- a/gcc/testsuite/gcc.target/i386/pr95443-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr95443-2.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
/* { dg-options "-O2 -minline-all-stringops" } */
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr95778-1.c b/gcc/testsuite/gcc.target/i386/pr95778-1.c
index 3238303..18f8383 100644
--- a/gcc/testsuite/gcc.target/i386/pr95778-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr95778-1.c
@@ -17,5 +17,5 @@ g2(int *p)
return f2(p);
}
-/* { dg-final { scan-assembler "g2.default.1:\n\tjmp\tf2.default.1\n" } } */
-/* { dg-final { scan-assembler "g2.avx2.0:\n\tjmp\tf2.avx2.0\n" } } */
+/* { dg-final { scan-assembler "g2.default:\n\tjmp\tf2.default\n" } } */
+/* { dg-final { scan-assembler "g2.avx2:\n\tjmp\tf2.avx2\n" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95778-2.c b/gcc/testsuite/gcc.target/i386/pr95778-2.c
index e88702d..9ef513a 100644
--- a/gcc/testsuite/gcc.target/i386/pr95778-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr95778-2.c
@@ -17,5 +17,5 @@ g2(int *p)
return f2(p);
}
-/* { dg-final { scan-assembler "g2.default.1:\n\tjmp\tf2.default.1\n" } } */
-/* { dg-final { scan-assembler "g2.avx2.0:\n\tjmp\tf2.avx2.0\n" } } */
+/* { dg-final { scan-assembler "g2.default:\n\tjmp\tf2.default\n" } } */
+/* { dg-final { scan-assembler "g2.avx2:\n\tjmp\tf2.avx2\n" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr96696.c b/gcc/testsuite/gcc.target/i386/pr96696.c
new file mode 100644
index 0000000..b874e6d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr96696.c
@@ -0,0 +1,30 @@
+/* PR tree-optimization/96696 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -masm=att" } */
+/* { dg-final { scan-assembler-times "\tidivl\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tdivl\t" 2 } } */
+/* { dg-final { scan-assembler-not "\ti?mull\t" } } */
+
+int
+foo (int x, int y)
+{
+ return (x / y) * y;
+}
+
+int
+bar (int x, int y)
+{
+ return x - (x % y);
+}
+
+unsigned
+baz (unsigned x, unsigned y)
+{
+ return (x / y) * y;
+}
+
+unsigned
+qux (unsigned x, unsigned y)
+{
+ return x - (x % y);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr96744-1.c b/gcc/testsuite/gcc.target/i386/pr96744-1.c
index 46f3ce6..da5557d 100644
--- a/gcc/testsuite/gcc.target/i386/pr96744-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr96744-1.c
@@ -4,7 +4,7 @@
typedef int int32x2_t __attribute__ ((__vector_size__ ((8))));
__attribute__((__target__("general-regs-only")))
-int32x2_t test (int32x2_t a, int32x2_t b)
-{ /* { dg-error "SSE register return with SSE disabled" } */
+int32x2_t test (int32x2_t a, int32x2_t b) /* { dg-error "SSE register return with SSE disabled" } */
+{
return a + b;
}
diff --git a/gcc/testsuite/gcc.target/i386/pr97249-1.c b/gcc/testsuite/gcc.target/i386/pr97249-1.c
index 4478a34..e7d1d74 100644
--- a/gcc/testsuite/gcc.target/i386/pr97249-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr97249-1.c
@@ -8,23 +8,26 @@
void
foo (unsigned char* p1, unsigned char* p2, short* __restrict p3)
{
- for (int i = 0 ; i != 8; i++)
- p3[i] = p1[i] + p2[i];
- return;
+ /* Avoid loop vectorization. */
+#pragma GCC unroll 8
+ for (int i = 0 ; i != 8; i++)
+ p3[i] = p1[i] + p2[i];
}
void
foo1 (unsigned short* p1, unsigned short* p2, int* __restrict p3)
{
- for (int i = 0 ; i != 4; i++)
- p3[i] = p1[i] + p2[i];
- return;
+ /* Avoid loop vectorization. */
+#pragma GCC unroll 4
+ for (int i = 0 ; i != 4; i++)
+ p3[i] = p1[i] + p2[i];
}
void
foo2 (unsigned int* p1, unsigned int* p2, long long* __restrict p3)
{
- for (int i = 0 ; i != 2; i++)
- p3[i] = (long long)p1[i] + (long long)p2[i];
- return;
+ /* Avoid loop vectorization. */
+#pragma GCC unroll 2
+ for (int i = 0 ; i != 2; i++)
+ p3[i] = (long long)p1[i] + (long long)p2[i];
}
diff --git a/gcc/testsuite/gcc.target/i386/pr97313.c b/gcc/testsuite/gcc.target/i386/pr97313.c
index ef93cf1..711766b 100644
--- a/gcc/testsuite/gcc.target/i386/pr97313.c
+++ b/gcc/testsuite/gcc.target/i386/pr97313.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fPIE" } */
+/* { dg-require-effective-target pie } */
typedef struct {
int unspecified : 1;
diff --git a/gcc/testsuite/gcc.target/i386/pr97950.c b/gcc/testsuite/gcc.target/i386/pr97950.c
index 277311d..185d733 100644
--- a/gcc/testsuite/gcc.target/i386/pr97950.c
+++ b/gcc/testsuite/gcc.target/i386/pr97950.c
@@ -1,10 +1,10 @@
/* PR target/95950 */
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=generic" } */
-/* { dg-final { scan-assembler-times "\tseta\t" 4 } } */
+/* { dg-final { scan-assembler-times "\tset\[ab]\t" 4 } } */
/* { dg-final { scan-assembler-times "\tseto\t" 16 } } */
/* { dg-final { scan-assembler-times "\tsetc\t" 4 } } */
-/* { dg-final { scan-assembler-not "\tjn?a\t" } } */
+/* { dg-final { scan-assembler-not "\tjn?\[ab]\t" } } */
/* { dg-final { scan-assembler-not "\tjn?o\t" } } */
/* { dg-final { scan-assembler-not "\tjn?c\t" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98060.c b/gcc/testsuite/gcc.target/i386/pr98060.c
new file mode 100644
index 0000000..f82620c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98060.c
@@ -0,0 +1,47 @@
+/* PR target/98060 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler-not "set" } } */
+/* { dg-final { scan-assembler-times "adc" 4 } } */
+/* { dg-final { scan-assembler-times "sbb" 4 } } */
+
+int r1 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 + (v0 >= v1);
+}
+
+int r2 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 + (v0 <= v1);
+}
+
+int r3 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 + (v0 > v1);
+}
+
+int r4 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 + (v0 < v1);
+}
+
+int r5 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 - (v0 >= v1);
+}
+
+int r6 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 - (v0 <= v1);
+}
+
+int r7 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 - (v0 > v1);
+}
+
+int r8 (unsigned v0, unsigned v1, int v2)
+{
+ return v2 - (v0 < v1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr98218-1.c b/gcc/testsuite/gcc.target/i386/pr98218-1.c
new file mode 100644
index 0000000..9d6602c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98218-1.c
@@ -0,0 +1,21 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef char vec __attribute__((vector_size(8)));
+
+vec lt (vec a, vec b) { return a < b; }
+vec le (vec a, vec b) { return a <= b; }
+vec eq (vec a, vec b) { return a == b; }
+vec ne (vec a, vec b) { return a != b; }
+vec ge (vec a, vec b) { return a >= b; }
+vec gt (vec a, vec b) { return a > b; }
+
+typedef unsigned char uvec __attribute__((vector_size(8)));
+
+vec ltu (uvec a, uvec b) { return a < b; }
+vec leu (uvec a, uvec b) { return a <= b; }
+vec geu (uvec a, uvec b) { return a >= b; }
+vec gtu (uvec a, uvec b) { return a > b; }
+
+/* { dg-final { scan-assembler-not "cmpb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98218-1a.c b/gcc/testsuite/gcc.target/i386/pr98218-1a.c
new file mode 100644
index 0000000..2610438
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98218-1a.c
@@ -0,0 +1,19 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -ftree-vectorize -msse2" } */
+
+typedef char T;
+
+#define M 8
+
+extern T a[M], b[M], s1[M], s2[M], r[M];
+
+void foo (void)
+{
+ int j;
+
+ for (j = 0; j < M; j++)
+ r[j] = (a[j] < b[j]) ? s1[j] : s2[j];
+}
+
+/* { dg-final { scan-assembler "pcmpgtb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98218-2.c b/gcc/testsuite/gcc.target/i386/pr98218-2.c
new file mode 100644
index 0000000..948bf4f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98218-2.c
@@ -0,0 +1,21 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef short vec __attribute__((vector_size(8)));
+
+vec lt (vec a, vec b) { return a < b; }
+vec le (vec a, vec b) { return a <= b; }
+vec eq (vec a, vec b) { return a == b; }
+vec ne (vec a, vec b) { return a != b; }
+vec ge (vec a, vec b) { return a >= b; }
+vec gt (vec a, vec b) { return a > b; }
+
+typedef unsigned short uvec __attribute__((vector_size(8)));
+
+vec ltu (uvec a, uvec b) { return a < b; }
+vec leu (uvec a, uvec b) { return a <= b; }
+vec geu (uvec a, uvec b) { return a >= b; }
+vec gtu (uvec a, uvec b) { return a > b; }
+
+/* { dg-final { scan-assembler-not "cmpw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98218-2a.c b/gcc/testsuite/gcc.target/i386/pr98218-2a.c
new file mode 100644
index 0000000..73c7226
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98218-2a.c
@@ -0,0 +1,19 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -ftree-vectorize -msse2" } */
+
+typedef short T;
+
+#define M 4
+
+extern T a[M], b[M], s1[M], s2[M], r[M];
+
+void foo (void)
+{
+ int j;
+
+ for (j = 0; j < M; j++)
+ r[j] = (a[j] < b[j]) ? s1[j] : s2[j];
+}
+
+/* { dg-final { scan-assembler "pcmpgtw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98218-3.c b/gcc/testsuite/gcc.target/i386/pr98218-3.c
new file mode 100644
index 0000000..1b40d0ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98218-3.c
@@ -0,0 +1,21 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef int vec __attribute__((vector_size(8)));
+
+vec lt (vec a, vec b) { return a < b; }
+vec le (vec a, vec b) { return a <= b; }
+vec eq (vec a, vec b) { return a == b; }
+vec ne (vec a, vec b) { return a != b; }
+vec ge (vec a, vec b) { return a >= b; }
+vec gt (vec a, vec b) { return a > b; }
+
+typedef unsigned int uvec __attribute__((vector_size(8)));
+
+vec ltu (uvec a, uvec b) { return a < b; }
+vec leu (uvec a, uvec b) { return a <= b; }
+vec geu (uvec a, uvec b) { return a >= b; }
+vec gtu (uvec a, uvec b) { return a > b; }
+
+/* { dg-final { scan-assembler-not "cmpl" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98218-3a.c b/gcc/testsuite/gcc.target/i386/pr98218-3a.c
new file mode 100644
index 0000000..cf1d497
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98218-3a.c
@@ -0,0 +1,19 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -ftree-vectorize -msse2" } */
+
+typedef int T;
+
+#define M 2
+
+extern T a[M], b[M], s1[M], s2[M], r[M];
+
+void foo (void)
+{
+ int j;
+
+ for (j = 0; j < M; j++)
+ r[j] = (a[j] < b[j]) ? s1[j] : s2[j];
+}
+
+/* { dg-final { scan-assembler "pcmpgtd" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98218-4.c b/gcc/testsuite/gcc.target/i386/pr98218-4.c
new file mode 100644
index 0000000..647bdb1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98218-4.c
@@ -0,0 +1,16 @@
+/* PR target/98218 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef unsigned int __attribute__((__vector_size__ (8))) v64u32;
+typedef int __attribute__((__vector_size__ (8))) v64s32;
+typedef float __attribute__((__vector_size__ (8))) v64f32;
+
+v64u32 tu (v64f32 a, v64f32 b) { return a > b; }
+v64s32 ts (v64f32 a, v64f32 b) { return a > b; }
+v64f32 fu (v64u32 a, v64u32 b) { return a > b; }
+v64f32 fs (v64s32 a, v64s32 b) { return a > b; }
+v64f32 ff (v64f32 a, v64f32 b) { return a > b; }
+
+/* { dg-final { scan-assembler-times "cmpltps" 3 } } */
+/* { dg-final { scan-assembler-times "pcmpgtd" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr98309-1.c b/gcc/testsuite/gcc.target/i386/pr98309-1.c
new file mode 100644
index 0000000..3a7afb5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98309-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2 -mfpmath=sse -ffast-math" } */
+/* { dg-final { scan-assembler-times "vcvtsi2s\[sd\]" "2" } } */
+/* { dg-final { scan-assembler-times "vscalefs\[sd\]" "2" } } */
+
+double
+__attribute__((noipa))
+foo (double a, int b)
+{
+ return __builtin_ldexp (a, b);
+}
+
+float
+__attribute__((noipa))
+foo2 (float a, int b)
+{
+ return __builtin_ldexpf (a, b);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr98309-2.c b/gcc/testsuite/gcc.target/i386/pr98309-2.c
new file mode 100644
index 0000000..ecfb916
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98309-2.c
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-mavx512f -O2 -mfpmath=sse -ffast-math" } */
+/* { dg-require-effective-target avx512f } */
+
+#define AVX512F
+#ifndef CHECK
+#define CHECK "avx512f-helper.h"
+#endif
+
+#include CHECK
+
+#include "pr98309-1.c"
+
+double
+__attribute__((noipa, target("fpmath=387")))
+foo_i387 (double a, int b)
+{
+ return __builtin_ldexp (a, b);
+}
+
+float
+__attribute__((noipa, target("fpmath=387")))
+foo2_i387 (float a, int b)
+{
+ return __builtin_ldexpf (a, b);
+}
+
+static void
+test_512 (void)
+{
+ float fa = 14.5;
+ double da = 44.5;
+ int fb = 12;
+ int db = 8;
+ if (foo_i387 (da, db) != foo (da, db))
+ abort ();
+ if (foo2_i387 (fa, fb) != foo2 (fa, fb))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr98365.c b/gcc/testsuite/gcc.target/i386/pr98365.c
new file mode 100644
index 0000000..652210d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98365.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -ftree-vectorize -fdump-tree-vect-details" } */
+/* { dg-final { scan-tree-dump-times "vectorized \[1-3] loops" 2 "vect" } } */
+short foo1 (short* a, short* c, int n)
+{
+ int i;
+ short cnt=0;
+ for (int i = 0;i != n; i++)
+ if (a[i] == c[i])
+ cnt++;
+ return cnt;
+}
+
+char foo2 (char* a, char* c, int n)
+{
+ int i;
+ char cnt=0;
+ for (int i = 0;i != n; i++)
+ if (a[i] == c[i])
+ cnt++;
+ return cnt;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr98434-1.c b/gcc/testsuite/gcc.target/i386/pr98434-1.c
new file mode 100644
index 0000000..773d3b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98434-1.c
@@ -0,0 +1,64 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vl -O2 -mprefer-vector-width=512" } */
+/* { dg-final { scan-assembler-times {vpsravw[\t ]*%xmm} 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times {vpsrlvw[\t ]*%ymm} 2 } } */
+/* { dg-final { scan-assembler-times {vpsllvw[\t ]*%zmm} 2 } } */
+/* { dg-final { scan-assembler-times {vpsllvq[\t ]*%xmm} 1 } } */
+/* { dg-final { scan-assembler-times {vpsravq[\t ]*%ymm} 1 } } */
+/* { dg-final { scan-assembler-times {vpsrlvq[\t ]*%zmm} 1 } } */
+
+int n;
+
+typedef char v8qi __attribute__((vector_size (8)));
+typedef char v16qi __attribute__((vector_size (16)));
+typedef char v32qi __attribute__((vector_size (32)));
+typedef short v8hi __attribute__((vector_size (16)));
+typedef short v16hi __attribute__((vector_size (32)));
+typedef short v32hi __attribute__((vector_size (64)));
+typedef long long v2di __attribute__((vector_size (16)));
+typedef long long v4di __attribute__((vector_size (32)));
+typedef long long v8di __attribute__((vector_size (64)));
+typedef unsigned char v8uqi __attribute__((vector_size (8)));
+typedef unsigned char v16uqi __attribute__((vector_size (16)));
+typedef unsigned char v32uqi __attribute__((vector_size (32)));
+typedef unsigned short v8uhi __attribute__((vector_size (16)));
+typedef unsigned short v16uhi __attribute__((vector_size (32)));
+typedef unsigned short v32uhi __attribute__((vector_size (64)));
+typedef unsigned long long v2udi __attribute__((vector_size (16)));
+typedef unsigned long long v4udi __attribute__((vector_size (32)));
+typedef unsigned long long v8udi __attribute__((vector_size (64)));
+
+#define FOO(TYPE, OP, NAME) \
+ __attribute__((noipa)) TYPE \
+ foo_##TYPE##_##NAME (TYPE a, TYPE b) \
+ { \
+ return a OP b; \
+ } \
+
+FOO (v8qi, <<, vashl);
+FOO (v8qi, >>, vashr);
+FOO (v8uqi, >>, vlshr);
+FOO (v16qi, <<, vashl);
+FOO (v16qi, >>, vashr);
+FOO (v16uqi, >>, vlshr);
+FOO (v32qi, <<, vashl);
+FOO (v32qi, >>, vashr);
+FOO (v32uqi, >>, vlshr);
+FOO (v8hi, <<, vashl);
+FOO (v8hi, >>, vashr);
+FOO (v8uhi, >>, vlshr);
+FOO (v16hi, <<, vashl);
+FOO (v16hi, >>, vashr);
+FOO (v16uhi, >>, vlshr);
+FOO (v32hi, <<, vashl);
+FOO (v32hi, >>, vashr);
+FOO (v32uhi, >>, vlshr);
+FOO (v2di, <<, vashl);
+FOO (v2di, >>, vashr);
+FOO (v2udi, >>, vlshr);
+FOO (v4di, <<, vashl);
+FOO (v4di, >>, vashr);
+FOO (v4udi, >>, vlshr);
+FOO (v8di, <<, vashl);
+FOO (v8di, >>, vashr);
+FOO (v8udi, >>, vlshr);
diff --git a/gcc/testsuite/gcc.target/i386/pr98434-2.c b/gcc/testsuite/gcc.target/i386/pr98434-2.c
new file mode 100644
index 0000000..4878e70
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98434-2.c
@@ -0,0 +1,129 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mprefer-vector-width=512 -mavx512vl -mavx512bw" } */
+/* { dg-require-effective-target avx512bw } */
+/* { dg-require-effective-target avx512vl } */
+
+#include "pr98434-1.c"
+void test (void);
+#define DO_TEST test
+#define AVX512VL
+#define AVX512BW
+#include "avx512-check.h"
+
+
+typedef char int8;
+typedef unsigned char uint8;
+typedef short int16;
+typedef unsigned short uint16;
+typedef long long int64;
+typedef unsigned long long uint64;
+
+#define F_EMULATE(TYPE, SIZE, OP, NAME) \
+ __attribute__((noipa, optimize("-fno-tree-vectorize"))) void \
+ emulate_##SIZE##_##TYPE##_##NAME (TYPE *a, \
+ TYPE *b, \
+ TYPE *c) \
+ { \
+ int i; \
+ for (i = 0; i < SIZE; i++) \
+ { \
+ a[i] = b[i] OP c[i]; \
+ } \
+ }
+
+F_EMULATE (int8, 8, <<, vashl);
+F_EMULATE (int8, 8, >>, vashr);
+F_EMULATE (uint8, 8, >>, vlshr);
+F_EMULATE (int8, 16, <<, vashl);
+F_EMULATE (int8, 16, >>, vashr);
+F_EMULATE (uint8, 16, >>, vlshr);
+F_EMULATE (int8, 32, <<, vashl);
+F_EMULATE (int8, 32, >>, vashr);
+F_EMULATE (uint8, 32, >>, vlshr);
+F_EMULATE (int16, 8, <<, vashl);
+F_EMULATE (int16, 8, >>, vashr);
+F_EMULATE (uint16, 8, >>, vlshr);
+F_EMULATE (int16, 16, <<, vashl);
+F_EMULATE (int16, 16, >>, vashr);
+F_EMULATE (uint16, 16, >>, vlshr);
+F_EMULATE (int16, 32, <<, vashl);
+F_EMULATE (int16, 32, >>, vashr);
+F_EMULATE (uint16, 32, >>, vlshr);
+F_EMULATE (int64, 2, <<, vashl);
+F_EMULATE (int64, 2, >>, vashr);
+F_EMULATE (uint64, 2, >>, vlshr);
+F_EMULATE (int64, 4, <<, vashl);
+F_EMULATE (int64, 4, >>, vashr);
+F_EMULATE (uint64, 4, >>, vlshr);
+F_EMULATE (int64, 8, <<, vashl);
+F_EMULATE (int64, 8, >>, vashr);
+F_EMULATE (uint64, 8, >>, vlshr);
+
+#define VSHIFT(VTYPE, NAME, src1, src2) \
+ foo_##VTYPE##_##NAME (src1, src2)
+
+#define EMULATE(SIZE, TYPE, NAME, dst, src1, src2) \
+ emulate_##SIZE##_##TYPE##_##NAME (dst, src1, src2)
+
+#define F_TEST_SHIFT(VTYPE, VTYPEU, TYPE, TYPEU, SIZE) \
+ __attribute__((noipa, optimize("-fno-tree-vectorize"))) void \
+ test_##VTYPE ()\
+ {\
+ TYPE src1[SIZE], src2[SIZE], ref[SIZE]; \
+ TYPEU usrc1[SIZE], usrc2[SIZE], uref[SIZE]; \
+ VTYPE dst; \
+ VTYPEU udst; \
+ int i;\
+ for (i = 0; i < SIZE; i++)\
+ {\
+ dst[i] = ref[i] = -i; \
+ src1[i] = -(i + SIZE); \
+ src2[i] = i % 8; \
+ udst[i] = uref[i] = i; \
+ usrc1[i] = (i + SIZE); \
+ usrc2[i] = (i % 8); \
+ }\
+ EMULATE(SIZE, TYPE, vashl, ref, src1, src2); \
+ dst = VSHIFT(VTYPE, vashl, *((VTYPE* )&src1[0]), *((VTYPE*) &src2[0])); \
+ for (i = 0; i < SIZE; i++)\
+ {\
+ if(dst[i] != ref[i]) __builtin_abort();\
+ }\
+ EMULATE(SIZE, TYPE, vashr, ref, src1, src2); \
+ dst = VSHIFT(VTYPE, vashr, *((VTYPE* )&src1[0]), *((VTYPE*) &src2[0])); \
+ for (i = 0; i < SIZE; i++)\
+ {\
+ if(dst[i] != ref[i]) __builtin_abort();\
+ }\
+ EMULATE(SIZE, TYPEU, vlshr, uref, usrc1, usrc2); \
+ udst = VSHIFT(VTYPEU, vlshr, *((VTYPEU* )&usrc1[0]), *((VTYPEU*) &usrc2[0])); \
+ for (i = 0; i < SIZE; i++)\
+ {\
+ if(udst[i] != uref[i]) __builtin_abort();\
+ }\
+ }
+
+F_TEST_SHIFT (v8qi, v8uqi, int8, uint8, 8);
+F_TEST_SHIFT (v16qi, v16uqi, int8, uint8, 16);
+F_TEST_SHIFT (v32qi, v32uqi, int8, uint8, 32);
+F_TEST_SHIFT (v8hi, v8uhi, int16, uint16, 8);
+F_TEST_SHIFT (v16hi, v16uhi, int16, uint16, 16);
+F_TEST_SHIFT (v32hi, v32uhi, int16, uint16, 32);
+F_TEST_SHIFT (v2di, v2udi, int64, uint64, 2);
+F_TEST_SHIFT (v4di, v4udi, int64, uint64, 4);
+F_TEST_SHIFT (v8di, v8udi, int64, uint64, 8);
+
+
+void
+test (void)
+{
+ test_v8qi ();
+ test_v16qi ();
+ test_v32qi ();
+ test_v8hi ();
+ test_v16hi ();
+ test_v32hi ();
+ test_v2di ();
+ test_v4di ();
+ test_v8di ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr98911.c b/gcc/testsuite/gcc.target/i386/pr98911.c
new file mode 100644
index 0000000..f08cea0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98911.c
@@ -0,0 +1,116 @@
+/* PR target/98911 */
+/* { dg-do compile } */
+/* { dg-options "-O -mavx2" } */
+/* { dg-final { scan-assembler-times "pcmpeqb" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpeqw" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpeqd" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpeqq" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpgtb" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpgtw" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpgtd" 2 } } */
+/* { dg-final { scan-assembler-times "pcmpgtq" 2 } } */
+
+typedef char v16qi __attribute__ ((vector_size (16)));
+typedef char v32qi __attribute__ ((vector_size (32)));
+typedef short v8hi __attribute__ ((vector_size (16)));
+typedef short v16hi __attribute__ ((vector_size (32)));
+typedef int v4si __attribute__ ((vector_size (16)));
+typedef int v8si __attribute__ ((vector_size (32)));
+typedef long long v2di __attribute__ ((vector_size (16)));
+typedef long long v4di __attribute__ ((vector_size (32)));
+
+v16qi
+f1 (v16qi a, v16qi b)
+{
+ return __builtin_ia32_pcmpeqb128 (a, b);
+}
+
+v8hi
+f2 (v8hi a, v8hi b)
+{
+ return __builtin_ia32_pcmpeqw128 (a, b);
+}
+
+v4si
+f3 (v4si a, v4si b)
+{
+ return __builtin_ia32_pcmpeqd128 (a, b);
+}
+
+v2di
+f4 (v2di a, v2di b)
+{
+ return __builtin_ia32_pcmpeqq (a, b);
+}
+
+v16qi
+f5 (v16qi a, v16qi b)
+{
+ return __builtin_ia32_pcmpgtb128 (a, b);
+}
+
+v8hi
+f6 (v8hi a, v8hi b)
+{
+ return __builtin_ia32_pcmpgtw128 (a, b);
+}
+
+v4si
+f7 (v4si a, v4si b)
+{
+ return __builtin_ia32_pcmpgtd128 (a, b);
+}
+
+v2di
+f8 (v2di a, v2di b)
+{
+ return __builtin_ia32_pcmpgtq (a, b);
+}
+
+v32qi
+f9 (v32qi a, v32qi b)
+{
+ return __builtin_ia32_pcmpeqb256 (a, b);
+}
+
+v16hi
+f10 (v16hi a, v16hi b)
+{
+ return __builtin_ia32_pcmpeqw256 (a, b);
+}
+
+v8si
+f11 (v8si a, v8si b)
+{
+ return __builtin_ia32_pcmpeqd256 (a, b);
+}
+
+v4di
+f12 (v4di a, v4di b)
+{
+ return __builtin_ia32_pcmpeqq256 (a, b);
+}
+
+v32qi
+f13 (v32qi a, v32qi b)
+{
+ return __builtin_ia32_pcmpgtb256 (a, b);
+}
+
+v16hi
+f14 (v16hi a, v16hi b)
+{
+ return __builtin_ia32_pcmpgtw256 (a, b);
+}
+
+v8si
+f15 (v8si a, v8si b)
+{
+ return __builtin_ia32_pcmpgtd256 (a, b);
+}
+
+v4di
+f16 (v4di a, v4di b)
+{
+ return __builtin_ia32_pcmpgtq256 (a, b);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99405.c b/gcc/testsuite/gcc.target/i386/pr99405.c
new file mode 100644
index 0000000..f3f49e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99405.c
@@ -0,0 +1,23 @@
+/* PR target/99405 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic -fomit-frame-pointer" } */
+/* { dg-final { scan-assembler-not "\tand\[bl]\t\\\$" } } */
+
+unsigned char f1 (unsigned char x, unsigned y) { return (x << (y & 7)) | (x >> (-y & 7)); }
+unsigned short f2 (unsigned short x, unsigned y) { return (x << (y & 15)) | (x >> (-y & 15)); }
+unsigned int f3 (unsigned int x, unsigned y) { return (x << (y & 31)) | (x >> (-y & 31)); }
+unsigned char f4 (unsigned char x, unsigned y) { return (x >> (y & 7)) | (x << (-y & 7)); }
+unsigned short f5 (unsigned short x, unsigned y) { return (x >> (y & 15)) | (x << (-y & 15)); }
+unsigned int f6 (unsigned int x, unsigned y) { return (x >> (y & 31)) | (x << (-y & 31)); }
+unsigned char f7 (unsigned char x, unsigned char y) { unsigned char v = y & 7; unsigned char w = -y & 7; return (x << v) | (x >> w); }
+unsigned short f8 (unsigned short x, unsigned char y) { unsigned char v = y & 15; unsigned char w = -y & 15; return (x << v) | (x >> w); }
+unsigned int f9 (unsigned int x, unsigned char y) { unsigned char v = y & 31; unsigned char w = -y & 31; return (x << v) | (x >> w); }
+unsigned char f10 (unsigned char x, unsigned char y) { unsigned char v = y & 7; unsigned char w = -y & 7; return (x >> v) | (x << w); }
+unsigned short f11 (unsigned short x, unsigned char y) { unsigned char v = y & 15; unsigned char w = -y & 15; return (x >> v) | (x << w); }
+unsigned int f12 (unsigned int x, unsigned char y) { unsigned char v = y & 31; unsigned char w = -y & 31; return (x >> v) | (x << w); }
+#ifdef __x86_64__
+unsigned long long f13 (unsigned long long x, unsigned y) { return (x << (y & 63)) | (x >> (-y & 63)); }
+unsigned long long f14 (unsigned long long x, unsigned y) { return (x >> (y & 63)) | (x << (-y & 63)); }
+unsigned long long f15 (unsigned long long x, unsigned char y) { unsigned char v = y & 63; unsigned char w = -y & 63; return (x << v) | (x >> w); }
+unsigned long long f16 (unsigned long long x, unsigned char y) { unsigned char v = y & 63; unsigned char w = -y & 63; return (x >> v) | (x << w); }
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr99591.c b/gcc/testsuite/gcc.target/i386/pr99591.c
new file mode 100644
index 0000000..01d8485
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99591.c
@@ -0,0 +1,32 @@
+/* PR tree-optimization/99591 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tmovs\[bw]l\t" } } */
+
+int
+foo (signed char a, signed char b)
+{
+ signed char r;
+ return __builtin_add_overflow (a, b, &r);
+}
+
+int
+bar (short a, short b)
+{
+ short r;
+ return __builtin_add_overflow (a, b, &r);
+}
+
+int
+baz (signed char a, signed char b)
+{
+ signed char r;
+ return __builtin_add_overflow ((int) a, (int) b, &r);
+}
+
+int
+qux (short a, short b)
+{
+ short r;
+ return __builtin_add_overflow ((int) a, (int) b, &r);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99726.c b/gcc/testsuite/gcc.target/i386/pr99726.c
new file mode 100644
index 0000000..98ccce6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99726.c
@@ -0,0 +1,16 @@
+/* { dg-options "-flive-patching=inline-clone -mavx512f -O2 -ftree-loop-vectorize -ftrapv" } */
+/* { dg-additional-options "-floop-nest-optimize" { target fgraphite } } */
+
+extern int a[256][1024];
+int b;
+long c, d;
+unsigned int e;
+
+int
+main ()
+{
+ for (; e < d; e++)
+ for (unsigned j = 1; j < c; j++)
+ a[e][j] = b * a[e - 1][j + 1];
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-1.c b/gcc/testsuite/gcc.target/i386/pr99744-1.c
new file mode 100644
index 0000000..a5a905c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-1.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+#include <x86intrin.h>
+
+extern unsigned long long int curr_deadline;
+extern void bar (void);
+
+__attribute__ ((target("general-regs-only")))
+void
+foo1 (void)
+{
+ if (__rdtsc () < curr_deadline)
+ return;
+ bar ();
+}
+
+__attribute__ ((target("general-regs-only")))
+void
+foo2 (unsigned int *p)
+{
+ if (__rdtscp (p) < curr_deadline)
+ return;
+ bar ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-2.c b/gcc/testsuite/gcc.target/i386/pr99744-2.c
new file mode 100644
index 0000000..9cbefb0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mserialize" } */
+
+#include <x86intrin.h>
+
+__attribute__ ((target("general-regs-only")))
+void
+foo1 (void)
+{
+ _serialize ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-3.c b/gcc/testsuite/gcc.target/i386/pr99744-3.c
new file mode 100644
index 0000000..6c50581
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-serialize" } */
+
+#include <x86intrin.h>
+
+__attribute__ ((target("general-regs-only")))
+void
+foo1 (void)
+{
+ _serialize ();
+}
+
+/* { dg-error "target specific option mismatch" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-4.c b/gcc/testsuite/gcc.target/i386/pr99744-4.c
new file mode 100644
index 0000000..9196e62
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-4.c
@@ -0,0 +1,357 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mbmi -mbmi2 -mcldemote -mclflushopt -mclwb -mclzero -mcrc32 -menqcmd -mfsgsbase -mfxsr -mhreset -mlzcnt -mlwp -mmovdir64b -mmovdiri -mmwaitx -mpconfig -mpku -mpopcnt -mptwrite -mrdpid -mrdrnd -mrdseed -mrtm -msgx -mshstk -mtbm -mtsxldtrk -mxsave -mxsavec -mxsaveopt -mxsaves -mwaitpkg -mwbnoinvd" } */
+/* { dg-additional-options "-muintr" { target { ! ia32 } } } */
+
+/* Test calling GPR intrinsics from functions with general-regs-only
+ target attribute. */
+
+#include <x86gprintrin.h>
+
+#define _CONCAT(x,y) x ## y
+
+#define test_0(func, type) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (void) \
+ { return func (); }
+
+#define test_0_i1(func, type, imm) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (void) \
+ { return func (imm); }
+
+#define test_1(func, type, op1_type) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A) \
+ { return func (A); }
+
+#define test_1_i1(func, type, op1_type, imm) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A) \
+ { return func (A, imm); }
+
+#define test_2(func, type, op1_type, op2_type) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A, op2_type B) \
+ { return func (A, B); }
+
+#define test_2_i1(func, type, op1_type, op2_type, imm) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A, op2_type B) \
+ { return func (A, B, imm); }
+
+#define test_3(func, type, op1_type, op2_type, op3_type) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A, op2_type B, op3_type C) \
+ { return func (A, B, C); }
+
+#define test_4(func, type, op1_type, op2_type, op3_type, op4_type) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A, op2_type B, op3_type C, \
+ op4_type D) \
+ { return func (A, B, C, D); }
+
+/* ia32intrin.h */
+test_1 (__bsfd, int, int)
+test_1 (__bsrd, int, int)
+test_1 (__bswapd, int, int)
+test_1 (__popcntd, int, unsigned int)
+test_2 (__rolb, unsigned char, unsigned char, int)
+test_2 (__rolw, unsigned short, unsigned short, int)
+test_2 (__rold, unsigned int, unsigned int, int)
+test_2 (__rorb, unsigned char, unsigned char, int)
+test_2 (__rorw, unsigned short, unsigned short, int)
+test_2 (__rord, unsigned int, unsigned int, int)
+
+#ifndef __iamcu__
+/* adxintrin.h */
+test_4 (_subborrow_u32, unsigned char, unsigned char, unsigned int,
+ unsigned int, unsigned int *)
+test_4 (_addcarry_u32, unsigned char, unsigned char, unsigned int,
+ unsigned int, unsigned int *)
+test_4 (_addcarryx_u32, unsigned char, unsigned char, unsigned int,
+ unsigned int, unsigned int *)
+
+/* bmiintrin.h */
+test_1 (__tzcnt_u16, unsigned short, unsigned short)
+test_2 (__andn_u32, unsigned int, unsigned int, unsigned int)
+test_2 (__bextr_u32, unsigned int, unsigned int, unsigned int)
+test_3 (_bextr_u32, unsigned int, unsigned int, unsigned int,
+ unsigned int)
+test_1 (__blsi_u32, unsigned int, unsigned int)
+test_1 (_blsi_u32, unsigned int, unsigned int)
+test_1 (__blsmsk_u32, unsigned int, unsigned int)
+test_1 (_blsmsk_u32, unsigned int, unsigned int)
+test_1 (__blsr_u32, unsigned int, unsigned int)
+test_1 (_blsr_u32, unsigned int, unsigned int)
+test_1 (__tzcnt_u32, unsigned int, unsigned int)
+test_1 (_tzcnt_u32, unsigned int, unsigned int)
+
+/* bmi2intrin.h */
+test_2 (_bzhi_u32, unsigned int, unsigned int, unsigned int)
+test_2 (_pdep_u32, unsigned int, unsigned int, unsigned int)
+test_2 (_pext_u32, unsigned int, unsigned int, unsigned int)
+
+/* cetintrin.h */
+test_1 (_inc_ssp, void, unsigned int)
+test_0 (_saveprevssp, void)
+test_1 (_rstorssp, void, void *)
+test_2 (_wrssd, void, unsigned int, void *)
+test_2 (_wrussd, void, unsigned int, void *)
+test_0 (_setssbsy, void)
+test_1 (_clrssbsy, void, void *)
+
+/* cldemoteintrin.h */
+test_1 (_cldemote, void, void *)
+
+/* clflushoptintrin.h */
+test_1 (_mm_clflushopt, void, void *)
+
+/* clwbintrin.h */
+test_1 (_mm_clwb, void, void *)
+
+/* clzerointrin.h */
+test_1 (_mm_clzero, void, void *)
+
+/* enqcmdintrin.h */
+test_2 (_enqcmd, int, void *, const void *)
+test_2 (_enqcmds, int, void *, const void *)
+
+/* fxsrintrin.h */
+test_1 (_fxsave, void, void *)
+test_1 (_fxrstor, void, void *)
+
+/* hresetintrin.h */
+test_1 (_hreset, void, unsigned int)
+
+/* ia32intrin.h */
+test_2 (__crc32b, unsigned int, unsigned char, unsigned char)
+test_2 (__crc32w, unsigned int, unsigned short, unsigned short)
+test_2 (__crc32d, unsigned int, unsigned int, unsigned int)
+test_1 (__rdpmc, unsigned long long, int)
+test_0 (__rdtsc, unsigned long long)
+test_1 (__rdtscp, unsigned long long, unsigned int *)
+test_0 (__pause, void)
+
+/* lzcntintrin.h */
+test_1 (__lzcnt16, unsigned short, unsigned short)
+test_1 (__lzcnt32, unsigned int, unsigned int)
+test_1 (_lzcnt_u32, unsigned int, unsigned int)
+
+/* lwpintrin.h */
+test_1 (__llwpcb, void, void *)
+test_0 (__slwpcb, void *)
+test_2_i1 (__lwpval32, void, unsigned int, unsigned int, 1)
+test_2_i1 (__lwpins32, unsigned char, unsigned int, unsigned int, 1)
+
+/* movdirintrin.h */
+test_2 (_directstoreu_u32, void, void *, unsigned int)
+test_2 (_movdir64b, void, void *, const void *)
+
+/* mwaitxintrin.h */
+test_3 (_mm_monitorx, void, void const *, unsigned int, unsigned int)
+test_3 (_mm_mwaitx, void, unsigned int, unsigned int, unsigned int)
+
+/* pconfigintrin.h */
+test_2 (_pconfig_u32, unsigned int, const unsigned int, size_t *)
+
+/* pkuintrin.h */
+test_0 (_rdpkru_u32, unsigned int)
+test_1 (_wrpkru, void, unsigned int)
+
+/* popcntintrin.h */
+test_1 (_mm_popcnt_u32, int, unsigned int)
+
+/* rdseedintrin.h */
+test_1 (_rdseed16_step, int, unsigned short *)
+test_1 (_rdseed32_step, int, unsigned int *)
+
+/* rtmintrin.h */
+test_0 (_xbegin, unsigned int)
+test_0 (_xend, void)
+test_0_i1 (_xabort, void, 1)
+
+/* sgxintrin.h */
+test_2 (_encls_u32, unsigned int, const unsigned int, size_t *)
+test_2 (_enclu_u32, unsigned int, const unsigned int, size_t *)
+test_2 (_enclv_u32, unsigned int, const unsigned int, size_t *)
+
+/* tbmintrin.h */
+test_1_i1 (__bextri_u32, unsigned int, unsigned int, 1)
+test_1 (__blcfill_u32, unsigned int, unsigned int)
+test_1 (__blci_u32, unsigned int, unsigned int)
+test_1 (__blcic_u32, unsigned int, unsigned int)
+test_1 (__blcmsk_u32, unsigned int, unsigned int)
+test_1 (__blcs_u32, unsigned int, unsigned int)
+test_1 (__blsfill_u32, unsigned int, unsigned int)
+test_1 (__blsic_u32, unsigned int, unsigned int)
+test_1 (__t1mskc_u32, unsigned int, unsigned int)
+test_1 (__tzmsk_u32, unsigned int, unsigned int)
+
+/* tsxldtrkintrin.h */
+test_0 (_xsusldtrk, void)
+test_0 (_xresldtrk, void)
+
+/* x86gprintrin.h */
+test_1 (_ptwrite32, void, unsigned int)
+test_1 (_rdrand16_step, int, unsigned short *)
+test_1 (_rdrand32_step, int, unsigned int *)
+test_0 (_wbinvd, void)
+
+/* xtestintrin.h */
+test_0 (_xtest, int)
+
+/* xsaveintrin.h */
+test_2 (_xsave, void, void *, long long)
+test_2 (_xrstor, void, void *, long long)
+test_2 (_xsetbv, void, unsigned int, long long)
+test_1 (_xgetbv, long long, unsigned int)
+
+/* xsavecintrin.h */
+test_2 (_xsavec, void, void *, long long)
+
+/* xsaveoptintrin.h */
+test_2 (_xsaveopt, void, void *, long long)
+
+/* xsavesintrin.h */
+test_2 (_xsaves, void, void *, long long)
+test_2 (_xrstors, void, void *, long long)
+
+/* wbnoinvdintrin.h */
+test_0 (_wbnoinvd, void)
+
+#ifdef __x86_64__
+/* adxintrin.h */
+test_4 (_subborrow_u64, unsigned char, unsigned char,
+ unsigned long long, unsigned long long,
+ unsigned long long *)
+test_4 (_addcarry_u64, unsigned char, unsigned char,
+ unsigned long long, unsigned long long,
+ unsigned long long *)
+test_4 (_addcarryx_u64, unsigned char, unsigned char,
+ unsigned long long, unsigned long long,
+ unsigned long long *)
+
+/* bmiintrin.h */
+test_2 (__andn_u64, unsigned long long, unsigned long long,
+ unsigned long long)
+test_2 (__bextr_u64, unsigned long long, unsigned long long,
+ unsigned long long)
+test_3 (_bextr_u64, unsigned long long, unsigned long long,
+ unsigned long long, unsigned long long)
+test_1 (__blsi_u64, unsigned long long, unsigned long long)
+test_1 (_blsi_u64, unsigned long long, unsigned long long)
+test_1 (__blsmsk_u64, unsigned long long, unsigned long long)
+test_1 (_blsmsk_u64, unsigned long long, unsigned long long)
+test_1 (__blsr_u64, unsigned long long, unsigned long long)
+test_1 (_blsr_u64, unsigned long long, unsigned long long)
+test_1 (__tzcnt_u64, unsigned long long, unsigned long long)
+test_1 (_tzcnt_u64, unsigned long long, unsigned long long)
+
+/* bmi2intrin.h */
+test_2 (_bzhi_u64, unsigned long long, unsigned long long,
+ unsigned long long)
+test_2 (_pdep_u64, unsigned long long, unsigned long long,
+ unsigned long long)
+test_2 (_pext_u64, unsigned long long, unsigned long long,
+ unsigned long long)
+test_3 (_mulx_u64, unsigned long long, unsigned long long,
+ unsigned long long, unsigned long long *)
+
+/* cetintrin.h */
+test_0 (_get_ssp, unsigned long long)
+test_2 (_wrssq, void, unsigned long long, void *)
+test_2 (_wrussq, void, unsigned long long, void *)
+
+/* fxsrintrin.h */
+test_1 (_fxsave64, void, void *)
+test_1 (_fxrstor64, void, void *)
+
+/* ia32intrin.h */
+test_1 (__bsfq, int, long long)
+test_1 (__bsrq, int, long long)
+test_1 (__bswapq, long long, long long)
+test_2 (__crc32q, unsigned long long, unsigned long long,
+ unsigned long long)
+test_1 (__popcntq, long long, unsigned long long)
+test_2 (__rolq, unsigned long long, unsigned long long, int)
+test_2 (__rorq, unsigned long long, unsigned long long, int)
+test_0 (__readeflags, unsigned long long)
+test_1 (__writeeflags, void, unsigned int)
+
+/* lzcntintrin.h */
+test_1 (__lzcnt64, unsigned long long, unsigned long long)
+test_1 (_lzcnt_u64, unsigned long long, unsigned long long)
+
+/* lwpintrin.h */
+test_2_i1 (__lwpval64, void, unsigned long long, unsigned int, 1)
+test_2_i1 (__lwpins64, unsigned char, unsigned long long,
+ unsigned int, 1)
+
+/* movdirintrin.h */
+test_2 (_directstoreu_u64, void, void *, unsigned long long)
+
+/* popcntintrin.h */
+test_1 (_mm_popcnt_u64, long long, unsigned long long)
+
+/* rdseedintrin.h */
+test_1 (_rdseed64_step, int, unsigned long long *)
+
+/* tbmintrin.h */
+test_1_i1 (__bextri_u64, unsigned long long, unsigned long long, 1)
+test_1 (__blcfill_u64, unsigned long long, unsigned long long)
+test_1 (__blci_u64, unsigned long long, unsigned long long)
+test_1 (__blcic_u64, unsigned long long, unsigned long long)
+test_1 (__blcmsk_u64, unsigned long long, unsigned long long)
+test_1 (__blcs_u64, unsigned long long, unsigned long long)
+test_1 (__blsfill_u64, unsigned long long, unsigned long long)
+test_1 (__blsic_u64, unsigned long long, unsigned long long)
+test_1 (__t1mskc_u64, unsigned long long, unsigned long long)
+test_1 (__tzmsk_u64, unsigned long long, unsigned long long)
+
+/* uintrintrin.h */
+test_0 (_clui, void)
+test_1 (_senduipi, void, unsigned long long)
+test_0 (_stui, void)
+test_0 (_testui, unsigned char)
+
+/* x86gprintrin.h */
+test_1 (_ptwrite64, void, unsigned long long)
+test_0 (_readfsbase_u32, unsigned int)
+test_0 (_readfsbase_u64, unsigned long long)
+test_0 (_readgsbase_u32, unsigned int)
+test_0 (_readgsbase_u64, unsigned long long)
+test_1 (_rdrand64_step, int, unsigned long long *)
+test_1 (_writefsbase_u32, void, unsigned int)
+test_1 (_writefsbase_u64, void, unsigned long long)
+test_1 (_writegsbase_u32, void, unsigned int)
+test_1 (_writegsbase_u64, void, unsigned long long)
+
+/* xsaveintrin.h */
+test_2 (_xsave64, void, void *, long long)
+test_2 (_xrstor64, void, void *, long long)
+
+/* xsavecintrin.h */
+test_2 (_xsavec64, void, void *, long long)
+
+/* xsaveoptintrin.h */
+test_2 (_xsaveopt64, void, void *, long long)
+
+/* xsavesintrin.h */
+test_2 (_xsaves64, void, void *, long long)
+test_2 (_xrstors64, void, void *, long long)
+
+/* waitpkgintrin.h */
+test_1 (_umonitor, void, void *)
+test_2 (_umwait, unsigned char, unsigned int, unsigned long long)
+test_2 (_tpause, unsigned char, unsigned int, unsigned long long)
+
+#else /* !__x86_64__ */
+/* bmi2intrin.h */
+test_3 (_mulx_u32, unsigned int, unsigned int, unsigned int,
+ unsigned int *)
+
+/* cetintrin.h */
+test_0 (_get_ssp, unsigned int)
+#endif /* __x86_64__ */
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-5.c b/gcc/testsuite/gcc.target/i386/pr99744-5.c
new file mode 100644
index 0000000..9e40e5e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-5.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mmwait" } */
+
+/* Test calling MWAIT intrinsics from functions with general-regs-only
+ target attribute. */
+
+#include <x86gprintrin.h>
+
+#define _CONCAT(x,y) x ## y
+
+#define test_2(func, type, op1_type, op2_type) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A, op2_type B) \
+ { return func (A, B); }
+
+#define test_3(func, type, op1_type, op2_type, op3_type) \
+ __attribute__ ((target("general-regs-only"))) \
+ type _CONCAT(do_,func) (op1_type A, op2_type B, op3_type C) \
+ { return func (A, B, C); }
+
+#ifndef __iamcu__
+/* mwaitintrin.h */
+test_3 (_mm_monitor, void, void const *, unsigned int, unsigned int)
+test_2 (_mm_mwait, void, unsigned int, unsigned int)
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-6.c b/gcc/testsuite/gcc.target/i386/pr99744-6.c
new file mode 100644
index 0000000..4025918
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-6.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <x86intrin.h>
+
+extern unsigned long long int curr_deadline;
+extern void bar (void);
+
+void
+foo1 (void)
+{
+ if (__rdtsc () < curr_deadline)
+ return;
+ bar ();
+}
+
+void
+foo2 (unsigned int *p)
+{
+ if (__rdtscp (p) < curr_deadline)
+ return;
+ bar ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-7.c b/gcc/testsuite/gcc.target/i386/pr99744-7.c
new file mode 100644
index 0000000..30b7ca0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-7.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mno-avx -Wno-psabi" } */
+
+#include <x86intrin.h>
+
+void
+foo (__m256 *x)
+{
+ x[0] = _mm256_sub_ps (x[1], x[2]);
+}
+
+/* { dg-error "target specific option mismatch" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/i386/pr99744-8.c b/gcc/testsuite/gcc.target/i386/pr99744-8.c
new file mode 100644
index 0000000..115183e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99744-8.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wno-psabi" } */
+
+#include <x86intrin.h>
+
+__attribute__((target ("no-avx")))
+void
+foo (__m256 *x)
+{
+ x[0] = _mm256_sub_ps (x[1], x[2]);
+}
+
+/* { dg-error "target specific option mismatch" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/i386/pr99753.c b/gcc/testsuite/gcc.target/i386/pr99753.c
new file mode 100644
index 0000000..3def1fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99753.c
@@ -0,0 +1,5 @@
+/* PR target/99753 */
+
+/* { dg-do compile } */
+/* { dg-options "-march=amd -m32" } */
+/* { dg-error "bad value .'amd'. for '-march=' switch" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/i386/pr99863.c b/gcc/testsuite/gcc.target/i386/pr99863.c
new file mode 100644
index 0000000..3d9d405
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99863.c
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/99863 */
+/* { dg-do run } */
+/* { dg-options "-O -fno-tree-forwprop -mno-sse2 -Wno-psabi" } */
+
+typedef unsigned char __attribute__((__vector_size__ (8))) A;
+typedef unsigned char __attribute__((__vector_size__ (32))) B;
+typedef unsigned char __attribute__((__vector_size__ (64))) C;
+typedef unsigned int __attribute__((__vector_size__ (32))) D;
+typedef unsigned int __attribute__((__vector_size__ (64))) E;
+typedef unsigned long long F;
+
+D a;
+A b;
+
+A
+foo (E x, F y)
+{
+ D c = (y <= 0) * a;
+ x *= (0 < y);
+ C d = (C) x;
+ B e = ((union { C a; B b[2];}) d).b[0] + (B) c;
+ A f = ((union { B a; A b[4];}) e).b[0] + (A) b;
+ return f;
+}
+
+int
+main ()
+{
+ F x = (F) foo ((E) { 3 }, 5);
+ if (x != 3)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99881.c b/gcc/testsuite/gcc.target/i386/pr99881.c
new file mode 100644
index 0000000..3e087eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99881.c
@@ -0,0 +1,49 @@
+/* PR target/99881. */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-Ofast -march=skylake" } */
+/* { dg-final { scan-assembler-not "xmm\[0-9\]" { xfail *-*-* } } } */
+
+void
+foo (int* __restrict a, int n, int c)
+{
+ a[0] = n;
+ a[1] = c;
+}
+
+void
+foo1 (int* __restrict a, int n, int b, int c, int d)
+{
+ a[0] = n;
+ a[1] = b;
+ a[2] = c;
+ a[3] = d;
+}
+
+void
+foo2 (int* __restrict a, int n, int b, int c, int d, int e, int f, int g, int h)
+{
+ a[0] = n;
+ a[1] = b;
+ a[2] = c;
+ a[3] = d;
+ a[4] = e;
+ a[5] = f;
+ a[6] = g;
+ a[7] = h;
+}
+
+void
+foo3 (long long* __restrict a, long long n, long long c)
+{
+ a[0] = n;
+ a[1] = c;
+}
+
+void
+foo4 (long long* __restrict a, long long n, long long b, long long c, long long d)
+{
+ a[0] = n;
+ a[1] = b;
+ a[2] = c;
+ a[3] = d;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr99905.c b/gcc/testsuite/gcc.target/i386/pr99905.c
new file mode 100644
index 0000000..6d1b230
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99905.c
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/99905 */
+/* { dg-do run { target int128 } } */
+/* { dg-options "-Os -mno-mmx -mno-sse" } */
+
+typedef unsigned char U;
+typedef unsigned char __attribute__((__vector_size__ (8))) A;
+typedef unsigned char __attribute__((__vector_size__ (16))) B;
+typedef unsigned char __attribute__((__vector_size__ (32))) C;
+typedef unsigned int __attribute__((__vector_size__ (8))) D;
+typedef unsigned long long __attribute__((__vector_size__ (8))) E;
+typedef unsigned __int128 I;
+typedef unsigned long long L;
+
+D gv;
+I gi;
+
+L __attribute__((__noipa__))
+foo (int ua, int ub, int uc, int ud, E ue, I i)
+{
+ D d = (U) __builtin_bswap16 (i >> 63) + gv;
+ B y = ((union { C a; B b[2];}) (C){ }).b[0] + (B) gi;
+ A z = ((union { B a; A b[2];}) y).b[0] + (A) d;
+ return (L)z;
+}
+
+int
+main ()
+{
+ L x = foo (0, 0, 0, 0, (E) { }, (I) 0x100 << 63);
+ if (x != 0x100000001)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c b/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c
index c5043e2..94d6764 100644
--- a/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c
+++ b/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c
@@ -1,15 +1,31 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -march=skylake-avx512" } */
-
-#ifndef DTYPE
-#define DTYPE u32
-#endif
+/* { dg-options "-O2 -march=skylake-avx512 -DDTYPE32" } */
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
+#ifdef DTYPE32
+typedef u32 DTYPE;
+#define byteswap byteswapu32
+#endif
+
+#ifdef DTYPE16
+typedef u16 DTYPE;
+#define byteswap byteswapu16
+#endif
+
+#ifdef DTYPE8
+typedef u16 DTYPE;
+#define byteswap byteswapu8
+#endif
+
+#ifdef DTYPE64
+typedef u16 DTYPE;
+#define byteswap byteswapu64
+#endif
+
#define R(x,n) ( (x >> n) | (x << (32 - n)))
#define S0(x) (R(x, 2) ^ R(x,13) ^ R(x,22))
@@ -23,36 +39,51 @@ typedef unsigned char u8;
d += tmp1; \
}
-static inline DTYPE byteswap(DTYPE x)
+static inline u32 byteswapu32(u32 x)
{
- x = (x & 0x0000FFFF) << 16 | (x & 0xFFFF0000) >> 16;
- x = (x & 0x00FF00FF) << 8 | (x & 0xFF00FF00) >> 8;
- return x;
+ x = (x & 0x0000FFFF) << 16 | (x & 0xFFFF0000) >> 16;
+ x = (x & 0x00FF00FF) << 8 | (x & 0xFF00FF00) >> 8;
+ return x;
}
-#define BE_LOAD32(n,b,i) (n) = byteswap(*(DTYPE *)(b + i))
+static inline u16 byteswapu16(u16 x)
+{
+ x = (x & 0x00FF) << 8 | (x & 0xFF00) >> 8;
+ return x;
+}
+
+static inline u8 byteswapu8(u8 x)
+{
+ return x;
+}
+
+static inline u64 byteswapu64(u64 x)
+{
+ x = ((u64)(byteswapu32 (x & 0x00000000FFFFFFFF))) << 32 | byteswapu32((x & 0xFFFFFFFF00000000) >> 32);
+ return x;
+}
-void foo (u8 *in, DTYPE out[8], const DTYPE C[16])
+void foo (DTYPE in[16], DTYPE out[8], const DTYPE C[16])
{
DTYPE tmp1 = 0, tmp2 = 0, a, b, c, d, e, f, g, h;
DTYPE w0, w1, w2, w3, w4, w5, w6, w7,
w8, w9, w10, w11, w12, w13, w14, w15;
- w0 = byteswap(*(DTYPE *)(in + 0));
- w1 = byteswap(*(DTYPE *)(in + 4));
- w2 = byteswap(*(DTYPE *)(in + 8));
- w3 = byteswap(*(DTYPE *)(in + 12));
- w4 = byteswap(*(DTYPE *)(in + 16));
- w5 = byteswap(*(DTYPE *)(in + 20));
- w6 = byteswap(*(DTYPE *)(in + 24));
- w7 = byteswap(*(DTYPE *)(in + 28));
- w8 = byteswap(*(DTYPE *)(in + 32));
- w9 = byteswap(*(DTYPE *)(in + 36));
- w10 = byteswap(*(DTYPE *)(in + 40));
- w11 = byteswap(*(DTYPE *)(in + 44));
- w12 = byteswap(*(DTYPE *)(in + 48));
- w13 = byteswap(*(DTYPE *)(in + 52));
- w14 = byteswap(*(DTYPE *)(in + 56));
- w15 = byteswap(*(DTYPE *)(in + 60));
+ w0 = byteswap(in[0]);
+ w1 = byteswap(in[1]);
+ w2 = byteswap(in[2]);
+ w3 = byteswap(in[3]);
+ w4 = byteswap(in[4]);
+ w5 = byteswap(in[5]);
+ w6 = byteswap(in[6]);
+ w7 = byteswap(in[7]);
+ w8 = byteswap(in[8]);
+ w9 = byteswap(in[9]);
+ w10 = byteswap(in[10]);
+ w11 = byteswap(in[11]);
+ w12 = byteswap(in[12]);
+ w13 = byteswap(in[13]);
+ w14 = byteswap(in[14]);
+ w15 = byteswap(in[15]);
a = out[0];
b = out[1];
c = out[2];
@@ -90,3 +121,7 @@ void foo (u8 *in, DTYPE out[8], const DTYPE C[16])
}
/* { dg-final { scan-assembler "kmovd" } } */
+/* { dg-final { scan-assembler-not "knot" } } */
+/* { dg-final { scan-assembler-not "kxor" } } */
+/* { dg-final { scan-assembler-not "kor" } } */
+/* { dg-final { scan-assembler-not "kandn" } } */
diff --git a/gcc/testsuite/gcc.target/i386/spill_to_mask-2.c b/gcc/testsuite/gcc.target/i386/spill_to_mask-2.c
index 1f0c6b4..c7d0976 100644
--- a/gcc/testsuite/gcc.target/i386/spill_to_mask-2.c
+++ b/gcc/testsuite/gcc.target/i386/spill_to_mask-2.c
@@ -1,10 +1,9 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -march=skylake-avx512" } */
-
-#ifndef DTYPE
-#define DTYPE u16
-#endif
+/* { dg-options "-O2 -march=skylake-avx512 -DDTYPE16" } */
#include "spill_to_mask-1.c"
-/* { dg-final { scan-assembler "kmovw" } } */
+/* { dg-final { scan-assembler-not "knot" } } */
+/* { dg-final { scan-assembler-not "kxor" } } */
+/* { dg-final { scan-assembler-not "kor" } } */
+/* { dg-final { scan-assembler-not "kandn" } } */
diff --git a/gcc/testsuite/gcc.target/i386/spill_to_mask-3.c b/gcc/testsuite/gcc.target/i386/spill_to_mask-3.c
index 5b59090..b7a383f 100644
--- a/gcc/testsuite/gcc.target/i386/spill_to_mask-3.c
+++ b/gcc/testsuite/gcc.target/i386/spill_to_mask-3.c
@@ -1,10 +1,9 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -march=skylake-avx512" } */
-
-#ifndef DTYPE
-#define DTYPE u8
-#endif
+/* { dg-options "-O2 -march=skylake-avx512 -DDTYPE8" } */
#include "spill_to_mask-1.c"
-/* { dg-final { scan-assembler "kmovb" } } */
+/* { dg-final { scan-assembler-not "knot" } } */
+/* { dg-final { scan-assembler-not "kxor" } } */
+/* { dg-final { scan-assembler-not "kor" } } */
+/* { dg-final { scan-assembler-not "kandn" } } */
diff --git a/gcc/testsuite/gcc.target/i386/spill_to_mask-4.c b/gcc/testsuite/gcc.target/i386/spill_to_mask-4.c
index f111cf4..d67038d 100644
--- a/gcc/testsuite/gcc.target/i386/spill_to_mask-4.c
+++ b/gcc/testsuite/gcc.target/i386/spill_to_mask-4.c
@@ -1,10 +1,9 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -march=skylake-avx512" } */
-
-#ifndef DTYPE
-#define DTYPE u64
-#endif
+/* { dg-options "-O2 -march=skylake-avx512 -DDTYPE64" } */
#include "spill_to_mask-1.c"
-/* { dg-final { scan-assembler "kmovq" } } */
+/* { dg-final { scan-assembler-not "knot" } } */
+/* { dg-final { scan-assembler-not "kxor" } } */
+/* { dg-final { scan-assembler-not "kor" } } */
+/* { dg-final { scan-assembler-not "kandn" } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc/testsuite/gcc.target/i386/sse-13.c
index 7029771..9a2833d 100644
--- a/gcc/testsuite/gcc.target/i386/sse-13.c
+++ b/gcc/testsuite/gcc.target/i386/sse-13.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512vbmi2 -mavx512ifma -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mavx512vp2intersect -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni" } */
+/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512vbmi2 -mavx512ifma -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mavx512vp2intersect -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni -mavx512fp16" } */
/* { dg-add-options bind_pic_locally } */
#include <mm_malloc.h>
@@ -702,6 +702,27 @@
#define __builtin_ia32_vpshld_v2di(A, B, C) __builtin_ia32_vpshld_v2di(A, B, 1)
#define __builtin_ia32_vpshld_v2di_mask(A, B, C, D, E) __builtin_ia32_vpshld_v2di_mask(A, B, 1, D, E)
+/* avx512fp16intrin.h */
+#define __builtin_ia32_vaddph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vaddph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vsubph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vsubph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmulph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vmulph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vdivph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vdivph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vaddsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vaddsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vsubsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vsubsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmulsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vmulsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vdivsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vdivsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmaxph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vmaxph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vminph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vminph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmaxsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vmaxsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vminsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vminsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vcmpph_v32hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v32hf_mask(A, B, 1, D)
+#define __builtin_ia32_vcmpph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vcmpph_v32hf_mask_round(A, B, 1, D, 8)
+#define __builtin_ia32_vcmpsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vcmpsh_v8hf_mask_round(A, B, 1, D, 8)
+
+/* avx512fp16vlintrin.h */
+#define __builtin_ia32_vcmpph_v8hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v8hf_mask(A, B, 1, D)
+#define __builtin_ia32_vcmpph_v16hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v16hf_mask(A, B, 1, D)
+
/* vpclmulqdqintrin.h */
#define __builtin_ia32_vpclmulqdq_v4di(A, B, C) __builtin_ia32_vpclmulqdq_v4di(A, B, 1)
#define __builtin_ia32_vpclmulqdq_v2di(A, B, C) __builtin_ia32_vpclmulqdq_v2di(A, B, 1)
diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c
index 4ce0fff..ce0ad71 100644
--- a/gcc/testsuite/gcc.target/i386/sse-14.c
+++ b/gcc/testsuite/gcc.target/i386/sse-14.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mpconfig -mwbnoinvd -mavx512vl -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni" } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mpconfig -mwbnoinvd -mavx512vl -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni -mavx512fp16" } */
/* { dg-add-options bind_pic_locally } */
#include <mm_malloc.h>
@@ -286,6 +286,7 @@ test_2 (_mm_add_round_sd, __m128d, __m128d, __m128d, 9)
test_2 (_mm_add_round_ss, __m128, __m128, __m128, 9)
test_2 (_mm_cmp_sd_mask, __mmask8, __m128d, __m128d, 1)
test_2 (_mm_cmp_ss_mask, __mmask8, __m128, __m128, 1)
+test_2 (_mm_cmp_sh_mask, __mmask8, __m128h, __m128h, 1)
#ifdef __x86_64__
test_2 (_mm_cvt_roundi64_sd, __m128d, __m128d, long long, 9)
test_2 (_mm_cvt_roundi64_ss, __m128, __m128, long long, 9)
@@ -470,6 +471,7 @@ test_3 (_mm256_maskz_shldi_epi64, __m256i, __mmask8, __m256i, __m256i, 1)
test_3 (_mm_maskz_shldi_epi16, __m128i, __mmask8, __m128i, __m128i, 1)
test_3 (_mm_maskz_shldi_epi32, __m128i, __mmask8, __m128i, __m128i, 1)
test_3 (_mm_maskz_shldi_epi64, __m128i, __mmask8, __m128i, __m128i, 1)
+test_3 (_mm_mask_cmp_sh_mask, __mmask8, __mmask8, __m128h, __m128h, 1)
test_3v (_mm512_i32scatter_epi32, void *, __m512i, __m512i, 1)
test_3v (_mm512_i32scatter_epi64, void *, __m256i, __m512i, 1)
test_3v (_mm512_i32scatter_pd, void *, __m256i, __m512d, 1)
@@ -667,6 +669,58 @@ test_3 (_mm512_mask_rcp28_round_ps, __m512, __m512, __mmask16, __m512, 8)
test_3 (_mm512_mask_rsqrt28_round_pd, __m512d, __m512d, __mmask8, __m512d, 8)
test_3 (_mm512_mask_rsqrt28_round_ps, __m512, __m512, __mmask16, __m512, 8)
+/* avx512fp16intrin.h */
+test_2 (_mm512_add_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_sub_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_mul_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_div_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm_add_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_sub_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_mul_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_div_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm512_max_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_min_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm_max_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_min_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm512_cmp_ph_mask, __mmask32, __m512h, __m512h, 1)
+test_2 (_mm_comi_sh, int, __m128h, __m128h, 1)
+test_2x (_mm512_cmp_round_ph_mask, __mmask32, __m512h, __m512h, 1, 8)
+test_2x (_mm_cmp_round_sh_mask, __mmask8, __m128h, __m128h, 1, 8)
+test_2x (_mm_comi_round_sh, int, __m128h, __m128h, 1, 8)
+test_3 (_mm512_maskz_add_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_sub_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_mul_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_div_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm_maskz_add_round_sh, __m128h, __mmask32, __m128h, __m128h, 8)
+test_3 (_mm_maskz_sub_round_sh, __m128h, __mmask32, __m128h, __m128h, 8)
+test_3 (_mm_maskz_mul_round_sh, __m128h, __mmask32, __m128h, __m128h, 8)
+test_3 (_mm_maskz_div_round_sh, __m128h, __mmask32, __m128h, __m128h, 8)
+test_3 (_mm512_maskz_max_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_min_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm_maskz_max_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm_maskz_min_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm512_mask_cmp_ph_mask, __mmask32, __mmask32, __m512h, __m512h, 1)
+test_3x (_mm512_mask_cmp_round_ph_mask, __mmask32, __mmask32, __m512h, __m512h, 1, 8)
+test_3x (_mm_mask_cmp_round_sh_mask, __mmask8, __mmask8, __m128h, __m128h, 1, 8)
+test_4 (_mm512_mask_add_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_sub_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_mul_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_div_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm_mask_add_round_sh, __m128h, __m128h, __mmask32, __m128h, __m128h, 8)
+test_4 (_mm_mask_sub_round_sh, __m128h, __m128h, __mmask32, __m128h, __m128h, 8)
+test_4 (_mm_mask_mul_round_sh, __m128h, __m128h, __mmask32, __m128h, __m128h, 8)
+test_4 (_mm_mask_div_round_sh, __m128h, __m128h, __mmask32, __m128h, __m128h, 8)
+test_4 (_mm512_mask_max_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_min_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm_mask_max_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+test_4 (_mm_mask_min_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+
+/* avx512fp16vlintrin.h */
+test_2 (_mm_cmp_ph_mask, __mmask8, __m128h, __m128h, 1)
+test_2 (_mm256_cmp_ph_mask, __mmask16, __m256h, __m256h, 1)
+test_3 (_mm_mask_cmp_ph_mask, __mmask8, __mmask8, __m128h, __m128h, 1)
+test_3 (_mm256_mask_cmp_ph_mask, __mmask16, __mmask16, __m256h, __m256h, 1)
+
/* shaintrin.h */
test_2 (_mm_sha1rnds4_epu32, __m128i, __m128i, __m128i, 1)
diff --git a/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc/testsuite/gcc.target/i386/sse-22.c
index 6e8b6f3..4393464 100644
--- a/gcc/testsuite/gcc.target/i386/sse-22.c
+++ b/gcc/testsuite/gcc.target/i386/sse-22.c
@@ -103,7 +103,7 @@
#ifndef DIFFERENT_PRAGMAS
-#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,avx512vl,avx512bw,avx512dq,avx512vbmi,avx512vbmi2,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni")
+#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,avx512vl,avx512bw,avx512dq,avx512vbmi,avx512vbmi2,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni,avx512fp16")
#endif
/* Following intrinsics require immediate arguments. They
@@ -220,7 +220,7 @@ test_4 (_mm_cmpestrz, int, __m128i, int, __m128i, int, 1)
/* immintrin.h (AVX/AVX2/RDRND/FSGSBASE/F16C/RTM/AVX512F/SHA) */
#ifdef DIFFERENT_PRAGMAS
-#pragma GCC target ("avx,avx2,rdrnd,fsgsbase,f16c,rtm,avx512f,avx512er,avx512cd,avx512pf,sha,avx512vl,avx512bw,avx512dq,avx512ifma,avx512vbmi,avx512vbmi2,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni")
+#pragma GCC target ("avx,avx2,rdrnd,fsgsbase,f16c,rtm,avx512f,avx512er,avx512cd,avx512pf,sha,avx512vl,avx512bw,avx512dq,avx512ifma,avx512vbmi,avx512vbmi2,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni,avx512fp16")
#endif
#include <immintrin.h>
test_1 (_cvtss_sh, unsigned short, float, 1)
@@ -457,6 +457,7 @@ test_2 (_mm256_shldi_epi64, __m256i, __m256i, __m256i, 1)
test_2 (_mm_shldi_epi16, __m128i, __m128i, __m128i, 1)
test_2 (_mm_shldi_epi32, __m128i, __m128i, __m128i, 1)
test_2 (_mm_shldi_epi64, __m128i, __m128i, __m128i, 1)
+test_2 (_mm_cmp_sh_mask, __mmask8, __m128h, __m128h, 1)
#ifdef __x86_64__
test_2 (_mm_cvt_roundi64_sd, __m128d, __m128d, long long, 9)
test_2 (_mm_cvt_roundi64_ss, __m128, __m128, long long, 9)
@@ -581,6 +582,7 @@ test_3 (_mm256_maskz_shldi_epi64, __m256i, __mmask8, __m256i, __m256i, 1)
test_3 (_mm_maskz_shldi_epi16, __m128i, __mmask8, __m128i, __m128i, 1)
test_3 (_mm_maskz_shldi_epi32, __m128i, __mmask8, __m128i, __m128i, 1)
test_3 (_mm_maskz_shldi_epi64, __m128i, __mmask8, __m128i, __m128i, 1)
+test_3 (_mm_mask_cmp_sh_mask, __mmask8, __mmask8, __m128h, __m128h, 1)
test_3v (_mm512_i32scatter_epi32, void *, __m512i, __m512i, 1)
test_3v (_mm512_i32scatter_epi64, void *, __m256i, __m512i, 1)
test_3v (_mm512_i32scatter_pd, void *, __m256i, __m512d, 1)
@@ -772,6 +774,58 @@ test_2 (_mm_rcp28_round_ss, __m128, __m128, __m128, 8)
test_2 (_mm_rsqrt28_round_sd, __m128d, __m128d, __m128d, 8)
test_2 (_mm_rsqrt28_round_ss, __m128, __m128, __m128, 8)
+/* avx512fp16intrin.h */
+test_2 (_mm512_add_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_sub_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_mul_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_div_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm_add_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_sub_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_mul_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_div_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm512_max_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm512_min_round_ph, __m512h, __m512h, __m512h, 8)
+test_2 (_mm_max_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm_min_round_sh, __m128h, __m128h, __m128h, 8)
+test_2 (_mm512_cmp_ph_mask, __mmask32, __m512h, __m512h, 1)
+test_2 (_mm_comi_sh, int, __m128h, __m128h, 1)
+test_2x (_mm512_cmp_round_ph_mask, __mmask32, __m512h, __m512h, 1, 8)
+test_2x (_mm_cmp_round_sh_mask, __mmask8, __m128h, __m128h, 1, 8)
+test_2x (_mm_comi_round_sh, int, __m128h, __m128h, 1, 8)
+test_3 (_mm512_maskz_add_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_sub_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_mul_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_div_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm_maskz_add_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm_maskz_sub_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm_maskz_mul_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm_maskz_div_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm512_maskz_max_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm512_maskz_min_round_ph, __m512h, __mmask32, __m512h, __m512h, 8)
+test_3 (_mm_maskz_max_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm_maskz_min_round_sh, __m128h, __mmask8, __m128h, __m128h, 8)
+test_3 (_mm512_mask_cmp_ph_mask, __mmask32, __mmask32, __m512h, __m512h, 1)
+test_3x (_mm512_mask_cmp_round_ph_mask, __mmask32, __mmask32, __m512h, __m512h, 1, 8)
+test_3x (_mm_mask_cmp_round_sh_mask, __mmask8, __mmask8, __m128h, __m128h, 1, 8)
+test_4 (_mm512_mask_add_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_sub_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_mul_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_div_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm_mask_add_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+test_4 (_mm_mask_sub_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+test_4 (_mm_mask_mul_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+test_4 (_mm_mask_div_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+test_4 (_mm512_mask_max_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm512_mask_min_round_ph, __m512h, __m512h, __mmask32, __m512h, __m512h, 8)
+test_4 (_mm_mask_max_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+test_4 (_mm_mask_min_round_sh, __m128h, __m128h, __mmask8, __m128h, __m128h, 8)
+
+/* avx512fp16vlintrin.h */
+test_2 (_mm_cmp_ph_mask, __mmask8, __m128h, __m128h, 1)
+test_2 (_mm256_cmp_ph_mask, __mmask16, __m256h, __m256h, 1)
+test_3 (_mm_mask_cmp_ph_mask, __mmask8, __mmask8, __m128h, __m128h, 1)
+test_3 (_mm256_mask_cmp_ph_mask, __mmask16, __mmask16, __m256h, __m256h, 1)
+
/* shaintrin.h */
test_2 (_mm_sha1rnds4_epu32, __m128i, __m128i, __m128i, 1)
diff --git a/gcc/testsuite/gcc.target/i386/sse-23.c b/gcc/testsuite/gcc.target/i386/sse-23.c
index 7faa053..f6768ba 100644
--- a/gcc/testsuite/gcc.target/i386/sse-23.c
+++ b/gcc/testsuite/gcc.target/i386/sse-23.c
@@ -703,11 +703,32 @@
#define __builtin_ia32_vpshld_v2di(A, B, C) __builtin_ia32_vpshld_v2di(A, B, 1)
#define __builtin_ia32_vpshld_v2di_mask(A, B, C, D, E) __builtin_ia32_vpshld_v2di_mask(A, B, 1, D, E)
+/* avx512fp16intrin.h */
+#define __builtin_ia32_vaddph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vaddph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vsubph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vsubph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmulph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vmulph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vdivph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vdivph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vaddsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vaddsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vsubsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vsubsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmulsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vmulsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vdivsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vdivsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmaxph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vmaxph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vminph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vminph_v32hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vmaxsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vmaxsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vminsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vminsh_v8hf_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_vcmpph_v32hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v32hf_mask(A, B, 1, D)
+#define __builtin_ia32_vcmpph_v32hf_mask_round(A, B, C, D, E) __builtin_ia32_vcmpph_v32hf_mask_round(A, B, 1, D, 8)
+#define __builtin_ia32_vcmpsh_v8hf_mask_round(A, B, C, D, E) __builtin_ia32_vcmpsh_v8hf_mask_round(A, B, 1, D, 8)
+
+/* avx512fp16vlintrin.h */
+#define __builtin_ia32_vcmpph_v8hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v8hf_mask(A, B, 1, D)
+#define __builtin_ia32_vcmpph_v16hf_mask(A, B, C, D) __builtin_ia32_vcmpph_v16hf_mask(A, B, 1, D)
+
/* vpclmulqdqintrin.h */
#define __builtin_ia32_vpclmulqdq_v4di(A, B, C) __builtin_ia32_vpclmulqdq_v4di(A, B, 1)
#define __builtin_ia32_vpclmulqdq_v2di(A, B, C) __builtin_ia32_vpclmulqdq_v2di(A, B, 1)
#define __builtin_ia32_vpclmulqdq_v8di(A, B, C) __builtin_ia32_vpclmulqdq_v8di(A, B, 1)
-#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,fma,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,xsavec,xsaves,clflushopt,avx512bw,avx512dq,avx512vl,avx512vbmi,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,clwb,mwaitx,clzero,pku,sgx,rdpid,gfni,avx512vbmi2,vpclmulqdq,avx512bitalg,pconfig,wbnoinvd,avx512bf16,enqcmd,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni")
+#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,fma,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,xsavec,xsaves,clflushopt,avx512bw,avx512dq,avx512vl,avx512vbmi,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,clwb,mwaitx,clzero,pku,sgx,rdpid,gfni,avx512vbmi2,vpclmulqdq,avx512bitalg,pconfig,wbnoinvd,avx512bf16,enqcmd,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni,avx512fp16")
#include <x86intrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse-pr101007.c b/gcc/testsuite/gcc.target/i386/sse-pr101007.c
new file mode 100644
index 0000000..65261d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse-pr101007.c
@@ -0,0 +1,14 @@
+/* PR target/101007 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse -mno-sse2" } */
+
+typedef unsigned __attribute__((__vector_size__ (8))) U;
+typedef unsigned __attribute__((__vector_size__ (16))) V;
+V v;
+U *p;
+
+void
+foo (void)
+{
+ *p = (U) __builtin_shufflevector ((V)(0 == (V){} >= 0), v, 4, 2);
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-float16-1.c b/gcc/testsuite/gcc.target/i386/sse2-float16-1.c
new file mode 100644
index 0000000..1b645eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-float16-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-sse2" } */
+
+_Float16/* { dg-error "is not supported on this target" } */
+foo (_Float16 x) /* { dg-error "is not supported on this target" } */
+{
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-float16-2.c b/gcc/testsuite/gcc.target/i386/sse2-float16-2.c
new file mode 100644
index 0000000..3da7683
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-float16-2.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-avx512f" } */
+
+union flt
+{
+ _Float16 flt;
+ short s;
+};
+
+_Float16
+foo (union flt x)
+{
+ return x.flt;
+}
+
+/* { dg-final { scan-assembler {(?n)pinsrw[\t ].*%xmm0} } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse2-float16-3.c b/gcc/testsuite/gcc.target/i386/sse2-float16-3.c
new file mode 100644
index 0000000..60ff9d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-float16-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-avx512f" } */
+
+#include<complex.h>
+
+_Complex _Float16
+foo (_Complex _Float16 x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler {(?n)movd[\t ].*%xmm0} } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
index 037f665..87705be 100644
--- a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
+++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
/* { dg-options "-O2 -fno-strict-aliasing -msse2" } */
/* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse2-pr101059.c b/gcc/testsuite/gcc.target/i386/sse2-pr101059.c
new file mode 100644
index 0000000..d155bf5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-pr101059.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math -msse2" } */
+/* { dg-require-effective-target sse2 } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse2-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse2_test
+#endif
+
+#include CHECK_H
+
+float
+__attribute__((noipa, optimize("tree-vectorize")))
+foo (float* p)
+{
+ float sum = 0.f;
+ for (int i = 0; i != 4; i++)
+ sum += p[i];
+ return sum;
+}
+
+static void
+TEST (void)
+{
+ float p[4] = {1.0f, 2.0f, 3.0f, 4.0f};
+ float res = foo (p);
+ if (res != 10.0f)
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-pr39821.c b/gcc/testsuite/gcc.target/i386/sse2-pr39821.c
new file mode 100644
index 0000000..bcd4b77
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-pr39821.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -mno-sse4.1 -O3 -fdump-tree-vect-details" } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 5 "vect" } } */
+#include<stdint.h>
+void
+vec_widen_smul8 (int16_t* __restrict v3, int8_t *v1, int8_t *v2, int order)
+{
+ while (order--)
+ *v3++ = (int16_t) *v1++ * *v2++;
+}
+
+void
+vec_widen_umul8(uint16_t* __restrict v3, uint8_t *v1, uint8_t *v2, int order)
+{
+ while (order--)
+ *v3++ = (uint16_t) *v1++ * *v2++;
+}
+
+void
+vec_widen_smul16(int32_t* __restrict v3, int16_t *v1, int16_t *v2, int order)
+{
+ while (order--)
+ *v3++ = (int32_t) *v1++ * *v2++;
+}
+
+void
+vec_widen_umul16(uint32_t* __restrict v3, uint16_t *v1, uint16_t *v2, int order)
+{
+ while (order--)
+ *v3++ = (uint32_t) *v1++ * *v2++;
+}
+
+void
+vec_widen_smul32(int64_t* __restrict v3, int32_t *v1, int32_t *v2, int order)
+{
+ while (order--)
+ *v3++ = (int64_t) *v1++ * *v2++;
+}
+
+void
+vec_widen_umul32(uint64_t* __restrict v3, uint32_t *v1, uint32_t *v2, int order)
+{
+ while (order--)
+ *v3++ = (uint64_t) *v1++ * *v2++;
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-pr94680.c b/gcc/testsuite/gcc.target/i386/sse2-pr94680.c
new file mode 100644
index 0000000..7e0ff9f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-pr94680.c
@@ -0,0 +1,91 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -mno-sse4.1 -O2" } */
+/* { dg-final { scan-assembler-times {(?n)(?:mov|psrldq).*%xmm[0-9]} 12 } } */
+/* { dg-final { scan-assembler-not "pxor" } } */
+
+typedef float v4sf __attribute__((vector_size(16)));
+typedef double v2df __attribute__ ((vector_size (16)));
+typedef long long v2di __attribute__((vector_size(16)));
+typedef int v4si __attribute__((vector_size(16)));
+typedef short v8hi __attribute__ ((vector_size (16)));
+typedef char v16qi __attribute__ ((vector_size (16)));
+
+v2df
+foo_v2df (v2df x)
+{
+ return __builtin_shuffle (x, (v2df) { 0, 0 }, (v2di) {0, 2});
+}
+
+v2df
+foo_v2df_l (v2df x)
+{
+ return __builtin_shuffle ((v2df) { 0, 0 }, x, (v2di) {3, 1});
+}
+
+v2di
+foo_v2di (v2di x)
+{
+ return __builtin_shuffle (x, (v2di) { 0, 0 }, (v2di) {0, 3});
+}
+
+v2di
+foo_v2di_l (v2di x)
+{
+ return __builtin_shuffle ((v2di) { 0, 0 }, x, (v2di) {3, 0});
+}
+
+v4sf
+foo_v4sf (v4sf x)
+{
+ return __builtin_shuffle (x, (v4sf) { 0, 0, 0, 0 }, (v4si) {0, 1, 4, 5});
+}
+
+v4sf
+foo_v4sf_l (v4sf x)
+{
+ return __builtin_shuffle ((v4sf) { 0, 0, 0, 0 }, x, (v4si) {4, 5, 3, 1});
+}
+
+v4si
+foo_v4si (v4si x)
+{
+ return __builtin_shuffle (x, (v4si) { 0, 0, 0, 0 }, (v4si) {0, 1, 6, 7});
+}
+
+v4si
+foo_v4si_l (v4si x)
+{
+ return __builtin_shuffle ((v4si) { 0, 0, 0, 0 }, x, (v4si) {4, 5, 1, 2});
+}
+
+v8hi
+foo_v8hi (v8hi x)
+{
+ return __builtin_shuffle (x, (v8hi) { 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v8hi) { 0, 1, 2, 3, 8, 12, 10, 13 });
+}
+
+v8hi
+foo_v8hi_l (v8hi x)
+{
+ return __builtin_shuffle ((v8hi) { 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v8hi) { 8, 9, 10, 11, 7, 6, 5, 4 });
+}
+
+v16qi
+foo_v16qi (v16qi x)
+{
+ return __builtin_shuffle (x, (v16qi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 },
+ (v16qi) {0, 1, 2, 3, 4, 5, 6, 7,
+ 16, 24, 18, 26, 20, 28, 22, 30 });
+}
+
+v16qi
+foo_v16qi_l (v16qi x)
+{
+ return __builtin_shuffle ((v16qi) { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }, x,
+ (v16qi) { 16, 17, 18, 19, 20, 21, 22, 23,
+ 15, 0, 13, 2, 11, 4, 9, 6 });
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-psraq-1.c b/gcc/testsuite/gcc.target/i386/sse2-psraq-1.c
new file mode 100644
index 0000000..9a08ee4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-psraq-1.c
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msse2 -mno-sse3" } */
+/* { dg-require-effective-target sse2 } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse2-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse2_test
+#endif
+
+#include CHECK_H
+
+typedef long long V __attribute__((vector_size (16)));
+
+#define TESTN(N) \
+static V \
+__attribute__((noipa)) \
+test##N (V x) \
+{ \
+ return x >> N; \
+}
+
+#define TESTS TESTN (63) TESTN (49) TESTN (32) TESTN (31) TESTN (18)
+TESTS
+
+struct
+{
+ int n;
+ V (*fn) (V);
+} tests[] = {
+#undef TESTN
+#define TESTN(N) { N, test##N },
+ TESTS
+};
+
+static void
+TEST (void)
+{
+ V a = (V) { 0xdeadbeefcafebabeULL, 0x123456789abcdef0ULL };
+ V b = (V) { 0x173a74be8a95134cULL, 0x817bae35ac0ebf12ULL };
+ int i;
+ for (i = 0; tests[i].n; i++)
+ {
+ V c = tests[i].fn (a);
+ if (c[0] != a[0] >> tests[i].n || c[1] != a[1] >> tests[i].n)
+ abort ();
+ c = tests[i].fn (b);
+ if (c[0] != b[0] >> tests[i].n || c[1] != b[1] >> tests[i].n)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-shiftqihi-constant-1.c b/gcc/testsuite/gcc.target/i386/sse2-shiftqihi-constant-1.c
index f1c68cb..015450f 100644
--- a/gcc/testsuite/gcc.target/i386/sse2-shiftqihi-constant-1.c
+++ b/gcc/testsuite/gcc.target/i386/sse2-shiftqihi-constant-1.c
@@ -1,6 +1,6 @@
/* PR target/95524 */
/* { dg-do compile } */
-/* { dg-options "-O2 -msse2" } */
+/* { dg-options "-O2 -msse2 -mno-avx" } */
/* { dg-final { scan-assembler-times "pand\[^\n\]*%xmm" 3 { xfail *-*-* } } } */
typedef char v16qi __attribute__ ((vector_size (16)));
typedef unsigned char v16uqi __attribute__ ((vector_size (16)));
diff --git a/gcc/testsuite/gcc.target/i386/sse3-pr101059.c b/gcc/testsuite/gcc.target/i386/sse3-pr101059.c
new file mode 100644
index 0000000..4795e89
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse3-pr101059.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math -msse3" } */
+/* { dg-require-effective-target sse3 } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse3-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse3_test
+#endif
+
+#include "sse2-pr101059.c"
diff --git a/gcc/testsuite/gcc.target/i386/sse4-pr39821.c b/gcc/testsuite/gcc.target/i386/sse4-pr39821.c
new file mode 100644
index 0000000..4456c31
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4-pr39821.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-msse4.1 -O3 -fdump-tree-vect-details" } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 6 "vect"} } */
+#include "sse2-pr39821.c"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c b/gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c
new file mode 100644
index 0000000..c13e730
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c
@@ -0,0 +1,23 @@
+/* PR target/99908 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4.1 -mno-avx -masm=att" } */
+/* { dg-final { scan-assembler-times "\tpblendvb\t" 2 } } */
+/* { dg-final { scan-assembler-not "\tpcmpeq" } } */
+/* { dg-final { scan-assembler-not "\tpandn" } } */
+
+#include <x86intrin.h>
+
+__m128i
+f1 (__m128i a, __m128i b, __m128i mask)
+{
+ return _mm_blendv_epi8(a, b,
+ _mm_andnot_si128(mask, _mm_set1_epi8(255)));
+}
+
+__m128i
+f2 (__v16qi x, __v16qi a, __v16qi b)
+{
+ x ^= (__v16qi) { -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 };
+ return _mm_blendv_epi8 ((__m128i) a, (__m128i) b, (__m128i) x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1.c
new file mode 100644
index 0000000..7c7fd34
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-msse4.1 -O2" } */
+/* { dg-final { scan-assembler-times {(?n)v?pcmpeq[bwd]} 4 } } */
+/* { dg-final { scan-assembler-times {(?n)v?p?blendv} 4 } } */
+
+typedef char v8qi __attribute__ ((vector_size (8)));
+typedef short v4hi __attribute__ ((vector_size (8)));
+typedef int v2si __attribute__ ((vector_size (8)));
+typedef float v2sf __attribute__ ((vector_size (8)));
+
+#define FOO(VTYPE, TYPE) \
+ VTYPE \
+ __attribute__ ((noipa)) \
+ foo_##VTYPE (VTYPE a, TYPE b, unsigned int c) \
+ { \
+ a[c] = b; \
+ return a; \
+ } \
+
+FOO (v8qi, char);
+
+FOO (v4hi, short);
+
+FOO (v2si, int);
+
+FOO (v2sf, float);
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1a.c b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1a.c
new file mode 100644
index 0000000..e2a67a6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-1a.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-msse4.1 -O2" } */
+/* { dg-final { scan-assembler-times {(?n)v?pcmpeq[bwd]} 2 } } */
+/* { dg-final { scan-assembler-times {(?n)v?p?blendv} 2 } } */
+
+typedef char v4qi __attribute__ ((vector_size (4)));
+typedef short v2hi __attribute__ ((vector_size (4)));
+
+#define FOO(VTYPE, TYPE) \
+ VTYPE \
+ __attribute__ ((noipa)) \
+ foo_##VTYPE (VTYPE a, TYPE b, unsigned int c) \
+ { \
+ a[c] = b; \
+ return a; \
+ } \
+
+FOO (v4qi, char);
+
+FOO (v2hi, short);
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2.c
new file mode 100644
index 0000000..24f8041
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2.c
@@ -0,0 +1,45 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target sse4 } */
+/* { dg-options "-O2 -msse4.1" } */
+
+
+#ifndef CHECK
+#define CHECK "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK
+
+#include "sse4_1-vec-set-1.c"
+
+#define CALC_TEST(vtype, type, N, idx) \
+do \
+ { \
+ int i,val = idx * idx - idx * 3 + 16; \
+ type res[N],exp[N]; \
+ vtype resv; \
+ for (i = 0; i < N; i++) \
+ { \
+ res[i] = i * i - i * 3 + 15; \
+ exp[i] = res[i]; \
+ } \
+ exp[idx] = val; \
+ resv = foo_##vtype (*(vtype *)&res[0], val, idx); \
+ for (i = 0; i < N; i++) \
+ { \
+ if (resv[i] != exp[i]) \
+ abort (); \
+ } \
+ } \
+while (0)
+
+static void
+TEST (void)
+{
+ CALC_TEST (v8qi, char, 8, 5);
+ CALC_TEST (v4hi, short, 4, 2);
+ CALC_TEST (v2si, int, 2, 1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2a.c b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2a.c
new file mode 100644
index 0000000..5a945be
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-vec-set-2a.c
@@ -0,0 +1,44 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target sse4 } */
+/* { dg-options "-O2 -msse4.1" } */
+
+
+#ifndef CHECK
+#define CHECK "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK
+
+#include "sse4_1-vec-set-1a.c"
+
+#define CALC_TEST(vtype, type, N, idx) \
+do \
+ { \
+ int i,val = idx * idx - idx * 3 + 16; \
+ type res[N],exp[N]; \
+ vtype resv; \
+ for (i = 0; i < N; i++) \
+ { \
+ res[i] = i * i - i * 3 + 15; \
+ exp[i] = res[i]; \
+ } \
+ exp[idx] = val; \
+ resv = foo_##vtype (*(vtype *)&res[0], val, idx); \
+ for (i = 0; i < N; i++) \
+ { \
+ if (resv[i] != exp[i]) \
+ abort (); \
+ } \
+ } \
+while (0)
+
+static void
+TEST (void)
+{
+ CALC_TEST (v4qi, char, 4, 2);
+ CALC_TEST (v2hi, short, 2, 1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c b/gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c
new file mode 100644
index 0000000..947b623
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msse4.2 -mno-avx" } */
+/* { dg-require-effective-target sse4 } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_2-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_2_test
+#endif
+
+#include "sse2-psraq-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/strncmp-1.c b/gcc/testsuite/gcc.target/i386/strncmp-1.c
index 044fc5c..1ea3e0a 100644
--- a/gcc/testsuite/gcc.target/i386/strncmp-1.c
+++ b/gcc/testsuite/gcc.target/i386/strncmp-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
/* { dg-options "-O2" } */
#include <stdio.h>
diff --git a/gcc/testsuite/gcc.target/i386/sw-1.c b/gcc/testsuite/gcc.target/i386/sw-1.c
index aec095e..a9c89fc 100644
--- a/gcc/testsuite/gcc.target/i386/sw-1.c
+++ b/gcc/testsuite/gcc.target/i386/sw-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=generic -fshrink-wrap -fdump-rtl-pro_and_epilogue" } */
+/* { dg-additional-options "-mno-avx" { target ia32 } } */
/* { dg-skip-if "No shrink-wrapping preformed" { x86_64-*-mingw* } } */
#include <string.h>
diff --git a/gcc/testsuite/gcc.target/i386/vect-addsub-2.c b/gcc/testsuite/gcc.target/i386/vect-addsub-2.c
new file mode 100644
index 0000000..a6b9414
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-addsub-2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target sse3 } */
+/* { dg-options "-O3 -msse3" } */
+
+float a[1024], b[1024];
+
+void foo()
+{
+ for (int i = 0; i < 256; i++)
+ {
+ a[4*i+0] = a[4*i+0] - b[4*i+0];
+ a[4*i+1] = a[4*i+1] + b[4*i+1];
+ a[4*i+2] = a[4*i+2] - b[4*i+2];
+ a[4*i+3] = a[4*i+3] + b[4*i+3];
+ }
+}
+
+/* We should be able to vectorize this with SLP using the addsub
+ SLP pattern. */
+/* { dg-final { scan-assembler "addsubps" } } */
+/* { dg-final { scan-assembler-not "shuf" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-addsub-3.c b/gcc/testsuite/gcc.target/i386/vect-addsub-3.c
new file mode 100644
index 0000000..b27ee56
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-addsub-3.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-require-effective-target sse3 } */
+/* { dg-options "-O3 -msse3" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse3-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse3_test
+#endif
+
+#include CHECK_H
+
+double a[2], b[2], c[2];
+
+void __attribute__((noipa))
+foo ()
+{
+ /* When we want to use addsubpd we have to keep permuting both
+ loads, if instead we blend the result of an add and a sub we
+ can combine the blend with the permute. Both are similar in cost,
+ verify we did not wrongly apply both. */
+ double tem0 = a[1] - b[1];
+ double tem1 = a[0] + b[0];
+ c[0] = tem0;
+ c[1] = tem1;
+}
+
+static void
+TEST (void)
+{
+ a[0] = 1.; a[1] = 2.;
+ b[0] = 2.; b[1] = 4.;
+ foo ();
+ if (c[0] != -2. || c[1] != 3.)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/vect-addsubv2df.c b/gcc/testsuite/gcc.target/i386/vect-addsubv2df.c
new file mode 100644
index 0000000..547485d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-addsubv2df.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-require-effective-target sse3 } */
+/* { dg-options "-O3 -msse3 -fdump-tree-slp2" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse3-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse3_test
+#endif
+
+#include CHECK_H
+
+double x[2], y[2], z[2];
+void __attribute__((noipa)) foo ()
+{
+ x[0] = y[0] - z[0];
+ x[1] = y[1] + z[1];
+}
+void __attribute__((noipa)) bar ()
+{
+ x[0] = y[0] + z[0];
+ x[1] = y[1] - z[1];
+}
+static void
+TEST (void)
+{
+ for (int i = 0; i < 2; ++i)
+ {
+ y[i] = i + 1;
+ z[i] = 2 * i + 1;
+ }
+ foo ();
+ if (x[0] != 0 || x[1] != 5)
+ __builtin_abort ();
+ bar ();
+ if (x[0] != 2 || x[1] != -1)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-times "ADDSUB" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-addsubv4df.c b/gcc/testsuite/gcc.target/i386/vect-addsubv4df.c
new file mode 100644
index 0000000..e0a1b3d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-addsubv4df.c
@@ -0,0 +1,36 @@
+/* { dg-do run { target avx_runtime } } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O3 -mavx -fdump-tree-slp2" } */
+
+double x[4], y[4], z[4];
+void __attribute__((noipa)) foo ()
+{
+ x[0] = y[0] - z[0];
+ x[1] = y[1] + z[1];
+ x[2] = y[2] - z[2];
+ x[3] = y[3] + z[3];
+}
+void __attribute__((noipa)) bar ()
+{
+ x[0] = y[0] + z[0];
+ x[1] = y[1] - z[1];
+ x[2] = y[2] + z[2];
+ x[3] = y[3] - z[3];
+}
+int main()
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ y[i] = i + 1;
+ z[i] = 2 * i + 1;
+ }
+ foo ();
+ if (x[0] != 0 || x[1] != 5 || x[2] != -2 || x[3] != 11)
+ __builtin_abort ();
+ bar ();
+ if (x[0] != 2 || x[1] != -1 || x[2] != 8 || x[3] != -3)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "ADDSUB" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-addsubv4sf.c b/gcc/testsuite/gcc.target/i386/vect-addsubv4sf.c
new file mode 100644
index 0000000..b524f0c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-addsubv4sf.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-require-effective-target sse3 } */
+/* { dg-options "-O3 -msse3 -fdump-tree-slp2" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse3-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse3_test
+#endif
+
+#include CHECK_H
+
+float x[4], y[4], z[4];
+void __attribute__((noipa)) foo ()
+{
+ x[0] = y[0] - z[0];
+ x[1] = y[1] + z[1];
+ x[2] = y[2] - z[2];
+ x[3] = y[3] + z[3];
+}
+void __attribute__((noipa)) bar ()
+{
+ x[0] = y[0] + z[0];
+ x[1] = y[1] - z[1];
+ x[2] = y[2] + z[2];
+ x[3] = y[3] - z[3];
+}
+static void
+TEST (void)
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ y[i] = i + 1;
+ z[i] = 2 * i + 1;
+ }
+ foo ();
+ if (x[0] != 0 || x[1] != 5 || x[2] != -2 || x[3] != 11)
+ __builtin_abort ();
+ bar ();
+ if (x[0] != 2 || x[1] != -1 || x[2] != 8 || x[3] != -3)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-times "ADDSUB" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-addsubv8sf.c b/gcc/testsuite/gcc.target/i386/vect-addsubv8sf.c
new file mode 100644
index 0000000..0eed33b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-addsubv8sf.c
@@ -0,0 +1,46 @@
+/* { dg-do run { target avx_runtime } } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O3 -mavx -fdump-tree-slp2" } */
+
+float x[8], y[8], z[8];
+void __attribute__((noipa)) foo ()
+{
+ x[0] = y[0] - z[0];
+ x[1] = y[1] + z[1];
+ x[2] = y[2] - z[2];
+ x[3] = y[3] + z[3];
+ x[4] = y[4] - z[4];
+ x[5] = y[5] + z[5];
+ x[6] = y[6] - z[6];
+ x[7] = y[7] + z[7];
+}
+void __attribute__((noipa)) bar ()
+{
+ x[0] = y[0] + z[0];
+ x[1] = y[1] - z[1];
+ x[2] = y[2] + z[2];
+ x[3] = y[3] - z[3];
+ x[4] = y[4] + z[4];
+ x[5] = y[5] - z[5];
+ x[6] = y[6] + z[6];
+ x[7] = y[7] - z[7];
+}
+int main()
+{
+ for (int i = 0; i < 8; ++i)
+ {
+ y[i] = i + 1;
+ z[i] = 2 * i + 1;
+ }
+ foo ();
+ if (x[0] != 0 || x[1] != 5 || x[2] != -2 || x[3] != 11
+ || x[4] != -4 || x[5] != 17 || x[6] != -6 || x[7] != 23)
+ __builtin_abort ();
+ bar ();
+ if (x[0] != 2 || x[1] != -1 || x[2] != 8 || x[3] != -3
+ || x[4] != 14 || x[5] != -5 || x[6] != 20 || x[7] != -7)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "ADDSUB" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-1.c b/gcc/testsuite/gcc.target/i386/vect-float16-1.c
new file mode 100644
index 0000000..0f82cf9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mno-avx512vl" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] + c[i];
+}
+
+/* { dg-final { scan-assembler-times "vaddph" 8 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-10.c b/gcc/testsuite/gcc.target/i386/vect-float16-10.c
new file mode 100644
index 0000000..2176456
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-10.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mno-avx512vl" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] / c[i];
+}
+
+/* { dg-final { scan-assembler-times "vdivph" 8 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-11.c b/gcc/testsuite/gcc.target/i386/vect-float16-11.c
new file mode 100644
index 0000000..e0409ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-11.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=128" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 128; i++)
+ a[i] = b[i] / c[i];
+}
+
+/* { dg-final { scan-assembler-times "vdivph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-12.c b/gcc/testsuite/gcc.target/i386/vect-float16-12.c
new file mode 100644
index 0000000..d92a25d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-12.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=256" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] / c[i];
+}
+
+/* { dg-final { scan-assembler-times "vdivph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-2.c b/gcc/testsuite/gcc.target/i386/vect-float16-2.c
new file mode 100644
index 0000000..974fca4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=128" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 128; i++)
+ a[i] = b[i] + c[i];
+}
+
+/* { dg-final { scan-assembler-times "vaddph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-3.c b/gcc/testsuite/gcc.target/i386/vect-float16-3.c
new file mode 100644
index 0000000..9bca914
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=256" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] + c[i];
+}
+
+/* { dg-final { scan-assembler-times "vaddph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-4.c b/gcc/testsuite/gcc.target/i386/vect-float16-4.c
new file mode 100644
index 0000000..e6f26f0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mno-avx512vl" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] - c[i];
+}
+
+/* { dg-final { scan-assembler-times "vsubph" 8 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-5.c b/gcc/testsuite/gcc.target/i386/vect-float16-5.c
new file mode 100644
index 0000000..38f287b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=128" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 128; i++)
+ a[i] = b[i] - c[i];
+}
+
+/* { dg-final { scan-assembler-times "vsubph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-6.c b/gcc/testsuite/gcc.target/i386/vect-float16-6.c
new file mode 100644
index 0000000..bc9f787
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-6.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=256" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] - c[i];
+}
+
+/* { dg-final { scan-assembler-times "vsubph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-7.c b/gcc/testsuite/gcc.target/i386/vect-float16-7.c
new file mode 100644
index 0000000..b4849cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-7.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mno-avx512vl" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] * c[i];
+}
+
+/* { dg-final { scan-assembler-times "vmulph" 8 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-8.c b/gcc/testsuite/gcc.target/i386/vect-float16-8.c
new file mode 100644
index 0000000..71631b1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-8.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=128" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 128; i++)
+ a[i] = b[i] * c[i];
+}
+
+/* { dg-final { scan-assembler-times "vmulph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-float16-9.c b/gcc/testsuite/gcc.target/i386/vect-float16-9.c
new file mode 100644
index 0000000..1be5c7f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-float16-9.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512fp16 -mavx512vl -mprefer-vector-width=256" } */
+
+/* Check that we vectorize to a full 128-bit vector for _Float16 types. */
+
+void
+foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
+ _Float16 *__restrict__ c)
+{
+ for (int i = 0; i < 256; i++)
+ a[i] = b[i] * c[i];
+}
+
+/* { dg-final { scan-assembler-times "vmulph" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXpd.c b/gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXpd.c
new file mode 100644
index 0000000..b30d107
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXpd.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma -save-temps" } */
+
+#include "fma-check.h"
+
+void __attribute__((noipa))
+check_fmaddsub (double * __restrict a, double *b, double *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[2*i + 0] = b[2*i + 0] * c[2*i + 0] - a[2*i + 0];
+ a[2*i + 1] = b[2*i + 1] * c[2*i + 1] + a[2*i + 1];
+ }
+}
+
+static void
+fma_test (void)
+{
+ double a[4], b[4], c[4];
+ for (int i = 0; i < 4; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmaddsub (a, b, c, 2);
+ const double d[4] = { 0., 22., 82., 192. };
+ for (int i = 0; i < 4; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler "fmaddsub...pd" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXps.c b/gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXps.c
new file mode 100644
index 0000000..cd2af87
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXps.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma -save-temps" } */
+
+#include "fma-check.h"
+
+void __attribute__((noipa))
+check_fmaddsub (float * __restrict a, float *b, float *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[2*i + 0] = b[2*i + 0] * c[2*i + 0] - a[2*i + 0];
+ a[2*i + 1] = b[2*i + 1] * c[2*i + 1] + a[2*i + 1];
+ }
+}
+
+static void
+fma_test (void)
+{
+ float a[4], b[4], c[4];
+ for (int i = 0; i < 4; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmaddsub (a, b, c, 2);
+ const float d[4] = { 0., 22., 82., 192. };
+ for (int i = 0; i < 4; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler "fmaddsub...ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXpd.c b/gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXpd.c
new file mode 100644
index 0000000..7ca2a27
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXpd.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma -save-temps" } */
+
+#include "fma-check.h"
+
+void __attribute__((noipa))
+check_fmsubadd (double * __restrict a, double *b, double *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[2*i + 0] = b[2*i + 0] * c[2*i + 0] + a[2*i + 0];
+ a[2*i + 1] = b[2*i + 1] * c[2*i + 1] - a[2*i + 1];
+ }
+}
+
+static void
+fma_test (void)
+{
+ double a[4], b[4], c[4];
+ for (int i = 0; i < 4; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmsubadd (a, b, c, 2);
+ const double d[4] = { 0., 20., 86., 186. };
+ for (int i = 0; i < 4; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler "fmsubadd...pd" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXps.c b/gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXps.c
new file mode 100644
index 0000000..9ddd0e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-fmsubaddXXXps.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma -save-temps" } */
+
+#include "fma-check.h"
+
+void __attribute__((noipa))
+check_fmsubadd (float * __restrict a, float *b, float *c, int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ a[2*i + 0] = b[2*i + 0] * c[2*i + 0] + a[2*i + 0];
+ a[2*i + 1] = b[2*i + 1] * c[2*i + 1] - a[2*i + 1];
+ }
+}
+
+static void
+fma_test (void)
+{
+ float a[4], b[4], c[4];
+ for (int i = 0; i < 4; ++i)
+ {
+ a[i] = i;
+ b[i] = 3*i;
+ c[i] = 7*i;
+ }
+ check_fmsubadd (a, b, c, 2);
+ const float d[4] = { 0., 20., 86., 186. };
+ for (int i = 0; i < 4; ++i)
+ if (a[i] != d[i])
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-assembler "fmsubadd...ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-gather-1.c b/gcc/testsuite/gcc.target/i386/vect-gather-1.c
new file mode 100644
index 0000000..261b66b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-gather-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast -msse2 -fdump-tree-vect-details -fdump-tree-forwprop4" } */
+
+#ifndef INDEXTYPE
+#define INDEXTYPE int
+#endif
+double vmul(INDEXTYPE *rowstart, INDEXTYPE *rowend,
+ double *luval, double *dst)
+{
+ double res = 0;
+ for (const INDEXTYPE * col = rowstart; col != rowend; ++col, ++luval)
+ res += *luval * dst[*col];
+ return res;
+}
+
+/* With gather emulation this should be profitable to vectorize
+ even with plain SSE2. */
+/* { dg-final { scan-tree-dump "loop vectorized" "vect" } } */
+/* The index vector loads and promotions should be scalar after forwprop. */
+/* { dg-final { scan-tree-dump-not "vec_unpack" "forwprop4" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-reduc-1.c b/gcc/testsuite/gcc.target/i386/vect-reduc-1.c
new file mode 100644
index 0000000..9ee9ba4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-reduc-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2 -mno-avx512f -fdump-tree-vect-details" } */
+
+#define N 32
+int foo (int *a, int n)
+{
+ int sum = 1;
+ for (int i = 0; i < 8*N + 4; ++i)
+ sum += a[i];
+ return sum;
+}
+
+/* The reduction epilog should be vectorized and the accumulator
+ re-used. */
+/* { dg-final { scan-tree-dump "LOOP EPILOGUE VECTORIZED" "vect" } } */
+/* { dg-final { scan-assembler-times "psrl" 2 } } */
+/* { dg-final { scan-assembler-times "padd" 5 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect8-ret.c b/gcc/testsuite/gcc.target/i386/vect8-ret.c
index 2b2b81e..6ace07e 100644
--- a/gcc/testsuite/gcc.target/i386/vect8-ret.c
+++ b/gcc/testsuite/gcc.target/i386/vect8-ret.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ia32 && { ! *-*-vxworks* } } } } */
-/* { dg-options "-mmmx -mvect8-ret-in-mem" } */
+/* { dg-options "-mmmx -mno-sse -mvect8-ret-in-mem" } */
#include <mmintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/vperm-v2hi.c b/gcc/testsuite/gcc.target/i386/vperm-v2hi.c
new file mode 100644
index 0000000..0af94f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vperm-v2hi.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O -msse2" } */
+/* { dg-require-effective-target sse2 } */
+
+#include "isa-check.h"
+#include "sse-os-support.h"
+
+typedef short S;
+typedef short V __attribute__((vector_size(4)));
+typedef short IV __attribute__((vector_size(4)));
+typedef union { S s[2]; V v; } U;
+
+static U i[2], b, c;
+
+extern int memcmp (const void *, const void *, __SIZE_TYPE__);
+#define assert(T) ((T) || (__builtin_trap (), 0))
+
+#define TEST(E0, E1) \
+ b.v = __builtin_shuffle (i[0].v, i[1].v, (IV){E0, E1}); \
+ c.s[0] = i[0].s[E0]; \
+ c.s[1] = i[0].s[E1]; \
+ __asm__("" : : : "memory"); \
+ assert (memcmp (&b, &c, sizeof(c)) == 0);
+
+#include "vperm-2-2.inc"
+
+int main()
+{
+ check_isa ();
+
+ if (!sse_os_support ())
+ exit (0);
+
+ i[0].s[0] = 0;
+ i[0].s[1] = 1;
+ i[0].s[2] = 2;
+ i[0].s[3] = 3;
+
+ check();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/vperm-v4qi.c b/gcc/testsuite/gcc.target/i386/vperm-v4qi.c
new file mode 100644
index 0000000..57fa547
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vperm-v4qi.c
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+/* { dg-options "-O -msse2" } */
+/* { dg-require-effective-target sse2 } */
+
+#include "isa-check.h"
+#include "sse-os-support.h"
+
+typedef char S;
+typedef char V __attribute__((vector_size(4)));
+typedef char IV __attribute__((vector_size(4)));
+typedef union { S s[4]; V v; } U;
+
+static U i[2], b, c;
+
+extern int memcmp (const void *, const void *, __SIZE_TYPE__);
+#define assert(T) ((T) || (__builtin_trap (), 0))
+
+#define TEST(E0, E1, E2, E3) \
+ b.v = __builtin_shuffle (i[0].v, i[1].v, (IV){E0, E1, E2, E3}); \
+ c.s[0] = i[0].s[E0]; \
+ c.s[1] = i[0].s[E1]; \
+ c.s[2] = i[0].s[E2]; \
+ c.s[3] = i[0].s[E3]; \
+ __asm__("" : : : "memory"); \
+ assert (memcmp (&b, &c, sizeof(c)) == 0);
+
+#include "vperm-4-2.inc"
+
+int main()
+{
+ check_isa ();
+
+ if (!sse_os_support ())
+ exit (0);
+
+ i[0].s[0] = 0;
+ i[0].s[1] = 1;
+ i[0].s[2] = 2;
+ i[0].s[3] = 3;
+ i[0].s[4] = 4;
+ i[0].s[5] = 5;
+ i[0].s[6] = 6;
+ i[0].s[7] = 7;
+
+ check();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/xorsign-avx.c b/gcc/testsuite/gcc.target/i386/xorsign-avx.c
new file mode 100644
index 0000000..f2e2054
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/xorsign-avx.c
@@ -0,0 +1,4 @@
+/* { dg-do run { target avx_runtime } } */
+/* { dg-options "-O2 -mavx -mfpmath=sse -ftree-vectorize" } */
+
+#include "xorsign.c"
diff --git a/gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c b/gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c
index 1936f5b..26a622a 100644
--- a/gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c
+++ b/gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mips16 -mcode-readable=yes" } */
+/* { dg-options "-mips16 -mcode-readable=yes -fno-tree-vrp" } */
/* { dg-skip-if "per-function expected output" { *-*-* } { "-flto" } { "" } } */
/* This testcase generates multiple constant pools within a function body. */
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index 0129231..d4d4b90 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -325,6 +325,7 @@ foreach option {
finite-math-only
fixed-hi
fixed-lo
+ inline
lax-vector-conversions
omit-frame-pointer
optimize-sibling-calls
@@ -332,6 +333,7 @@ foreach option {
schedule-insns2
split-wide-types
tree-vectorize
+ tree-vrp
unroll-all-loops
unroll-loops
ipa-ra
diff --git a/gcc/testsuite/gcc.target/mips/pr100760.c b/gcc/testsuite/gcc.target/mips/pr100760.c
new file mode 100644
index 0000000..d715b85
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/pr100760.c
@@ -0,0 +1,10 @@
+/* PR target/100760
+ This was triggering an ICE with "maximum number of generated reload
+ insns per insn achieved (90)" when compiled with -mmsa -mloongson-mmi. */
+
+/* { dg-do compile } */
+/* { dg-options "-mmsa -mloongson-mmi" } */
+
+typedef __INT32_TYPE__ int32_t;
+typedef int32_t a __attribute__((__vector_size__(8)));
+void b() { a x = (a){1, 1}; }
diff --git a/gcc/testsuite/gcc.target/mips/pr100761.c b/gcc/testsuite/gcc.target/mips/pr100761.c
new file mode 100644
index 0000000..cc2598e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/pr100761.c
@@ -0,0 +1,17 @@
+/* PR target/100761
+ This was triggering an ICE in mips_expand_vec_unpack when compiled with
+ -mmsa -mloongson-mmi. */
+
+/* { dg-do compile } */
+/* { dg-options "-mmsa -mloongson-mmi" } */
+
+typedef __INT8_TYPE__ int8_t;
+typedef __INT16_TYPE__ int16_t;
+typedef int8_t i8x8 __attribute__((__vector_size__(8)));
+typedef int16_t i16x8 __attribute__((__vector_size__(16)));
+
+i8x8 a;
+
+void f() {
+ i16x8 b = __builtin_convertvector (a, i16x8);
+}
diff --git a/gcc/testsuite/gcc.target/mips/pr100762.c b/gcc/testsuite/gcc.target/mips/pr100762.c
new file mode 100644
index 0000000..89c1185
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/pr100762.c
@@ -0,0 +1,25 @@
+/* PR target/100762
+ This was triggering an ICE in mips_expand_vector_init when compiled with
+ -mmsa -mloongson-mmi. */
+
+/* { dg-do compile } */
+/* { dg-options "-mmsa -mloongson-mmi" } */
+
+typedef __INT32_TYPE__ int32_t;
+typedef int32_t i32x2 __attribute__((__vector_size__(8)));
+
+i32x2 cmp(i32x2 a, i32x2 b) {
+ return a >= b;
+}
+
+i32x2 shift(i32x2 a, i32x2 b) {
+ return a >> b;
+}
+
+i32x2 mul(i32x2 a, i32x2 b) {
+ return a * b;
+}
+
+i32x2 div(i32x2 a, i32x2 b) {
+ return a / b;
+}
diff --git a/gcc/testsuite/gcc.target/mips/pr101132.c b/gcc/testsuite/gcc.target/mips/pr101132.c
new file mode 100644
index 0000000..d490b5d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/pr101132.c
@@ -0,0 +1,14 @@
+/* PR target/101132
+ This was triggering an ICE in do_store_flag when compiled with -mmsa -O3. */
+
+/* { dg-do compile } */
+/* { dg-options "-mmsa" } */
+
+int r_0, q_0;
+void bar() {
+ int i;
+ for (i = 0; i < 96; i++) {
+ r_0 = i << i ? 2 + i : -i;
+ q_0 = r_0 > 2 ?: i;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/mips/pr101922.c b/gcc/testsuite/gcc.target/mips/pr101922.c
new file mode 100644
index 0000000..00a6e49
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/pr101922.c
@@ -0,0 +1,19 @@
+/* PR target/101922
+ This was triggering an assembler error with -O3 -mmsa -mloongson-mmi. */
+
+/* { dg-do assemble } */
+/* { dg-options "-mmsa -mloongson-mmi" } */
+
+typedef __INT8_TYPE__ i8;
+typedef __INT32_TYPE__ i32;
+
+i8 d[16];
+
+i32 f(i32 x) {
+ int i;
+ for (i = 0; i < 16; i++) {
+ i32 t = (i32) d[i] >> 31;
+ x &= t;
+ }
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c b/gcc/testsuite/gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c
new file mode 100644
index 0000000..55935ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c
@@ -0,0 +1,231 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p9vector_hw } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9 -save-temps" } */
+
+/* Verify the vec_rlm and vec_rlmi builtins works correctly. */
+/* { dg-final { scan-assembler-times {\mvrldmi\M} 1 } } */
+
+#include <altivec.h>
+
+#ifdef DEBUG
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+void abort (void);
+
+int main ()
+{
+ int i;
+
+ vector unsigned int vec_arg1_int, vec_arg2_int, vec_arg3_int;
+ vector unsigned int vec_result_int, vec_expected_result_int;
+
+ vector unsigned long long int vec_arg1_di, vec_arg2_di, vec_arg3_di;
+ vector unsigned long long int vec_result_di, vec_expected_result_di;
+
+ unsigned int mask_begin, mask_end, shift;
+ unsigned long long int mask;
+
+/* Check vec int version of vec_rlmi builtin */
+ mask = 0;
+ mask_begin = 0;
+ mask_end = 4;
+ shift = 16;
+
+ for (i = 0; i < 31; i++)
+ if ((i >= mask_begin) && (i <= mask_end))
+ mask |= 0x80000000ULL >> i;
+
+ for (i = 0; i < 4; i++) {
+ vec_arg1_int[i] = 0x12345678 + i*0x11111111;
+ vec_arg2_int[i] = 0xA1B1CDEF;
+ vec_arg3_int[i] = mask_begin << 16 | mask_end << 8 | shift;
+
+ /* do rotate */
+ vec_expected_result_int[i] = ( vec_arg2_int[i] & ~mask)
+ | ((vec_arg1_int[i] << shift) | (vec_arg1_int[i] >> (32-shift))) & mask;
+
+ }
+
+ /* vec_rlmi(arg1, arg2, arg3)
+ result - rotate each element of arg2 left and inserts it into arg1
+ element based on the mask specified in arg3. The shift, mask
+ start and end is specified in arg3. */
+ vec_result_int = vec_rlmi (vec_arg1_int, vec_arg2_int, vec_arg3_int);
+
+ for (i = 0; i < 4; i++) {
+ if (vec_result_int[i] != vec_expected_result_int[i])
+#ifdef DEBUG
+ printf("ERROR: i = %d, vec_rlmi int result 0x%x, does not match "
+ "expected result 0x%x\n", i, vec_result_int[i],
+ vec_expected_result_int[i]);
+#else
+ abort();
+#endif
+ }
+
+/* Check vec long long int version of vec_rlmi builtin */
+ mask = 0;
+ mask_begin = 0;
+ mask_end = 4;
+ shift = 16;
+
+ for (i = 0; i < 31; i++)
+ if ((i >= mask_begin) && (i <= mask_end))
+ mask |= 0x8000000000000000ULL >> i;
+
+ for (i = 0; i < 2; i++) {
+ vec_arg1_di[i] = 0x1234567800000000 + i*0x11111111;
+ vec_arg2_di[i] = 0xA1B1C1D1E1F12345;
+ vec_arg3_di[i] = mask_begin << 16 | mask_end << 8 | shift;
+
+ /* do rotate */
+ vec_expected_result_di[i] = ( vec_arg2_di[i] & ~mask)
+ | ((vec_arg1_di[i] << shift) | (vec_arg1_di[i] >> (64-shift))) & mask;
+ }
+
+ /* vec_rlmi(arg1, arg2, arg3)
+ result - rotate each element of arg1 left and inserts it into arg2
+ element based on the mask specified in arg3. The shift, mask, start
+ and end is specified in arg3. */
+ vec_result_di = vec_rlmi (vec_arg1_di, vec_arg2_di, vec_arg3_di);
+
+ for (i = 0; i < 2; i++) {
+ if (vec_result_di[i] != vec_expected_result_di[i])
+#ifdef DEBUG
+ printf("ERROR: i = %d, vec_rlmi int long long result 0x%llx, does not match "
+ "expected result 0x%llx\n", i, vec_result_di[i],
+ vec_expected_result_di[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* Check vec int version of vec_rlnm builtin */
+ mask = 0;
+ mask_begin = 0;
+ mask_end = 4;
+ shift = 16;
+
+ for (i = 0; i < 31; i++)
+ if ((i >= mask_begin) && (i <= mask_end))
+ mask |= 0x80000000ULL >> i;
+
+ for (i = 0; i < 4; i++) {
+ vec_arg1_int[i] = 0x12345678 + i*0x11111111;
+ vec_arg2_int[i] = shift;
+ vec_arg3_int[i] = mask_begin << 8 | mask_end;
+ vec_expected_result_int[i] = (vec_arg1_int[i] << shift) & mask;
+ }
+
+ /* vec_rlnm(arg1, arg2, arg3)
+ result - rotate each element of arg1 left by shift in element of arg2.
+ Then AND with mask whose start/stop bits are specified in element of
+ arg3. */
+ vec_result_int = vec_rlnm (vec_arg1_int, vec_arg2_int, vec_arg3_int);
+ for (i = 0; i < 4; i++) {
+ if (vec_result_int[i] != vec_expected_result_int[i])
+#ifdef DEBUG
+ printf("ERROR: vec_rlnm, i = %d, int result 0x%x does not match "
+ "expected result 0x%x\n", i, vec_result_int[i],
+ vec_expected_result_int[i]);
+#else
+ abort();
+#endif
+ }
+
+/* Check vec long int version of builtin */
+ mask = 0;
+ mask_begin = 0;
+ mask_end = 4;
+ shift = 20;
+
+ for (i = 0; i < 63; i++)
+ if ((i >= mask_begin) && (i <= mask_end))
+ mask |= 0x8000000000000000ULL >> i;
+
+ for (i = 0; i < 2; i++) {
+ vec_arg1_di[i] = 0x123456789ABCDE00ULL + i*0x1111111111111111ULL;
+ vec_arg2_di[i] = shift;
+ vec_arg3_di[i] = mask_begin << 8 | mask_end;
+ vec_expected_result_di[i] = (vec_arg1_di[i] << shift) & mask;
+ }
+
+ vec_result_di = vec_rlnm (vec_arg1_di, vec_arg2_di, vec_arg3_di);
+
+ for (i = 0; i < 2; i++) {
+ if (vec_result_di[i] != vec_expected_result_di[i])
+#ifdef DEBUG
+ printf("ERROR: vec_rlnm, i = %d, long long int result 0x%llx does not "
+ "match expected result 0x%llx\n", i, vec_result_di[i],
+ vec_expected_result_di[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* Check vec int version of vec_vrlnm builtin */
+ mask = 0;
+ mask_begin = 0;
+ mask_end = 4;
+ shift = 16;
+
+ for (i = 0; i < 31; i++)
+ if ((i >= mask_begin) && (i <= mask_end))
+ mask |= 0x80000000ULL >> i;
+
+ for (i = 0; i < 4; i++) {
+ vec_arg1_int[i] = 0x12345678 + i*0x11111111;
+ vec_arg2_int[i] = mask_begin << 16 | mask_end << 8 | shift;
+ vec_expected_result_int[i] = (vec_arg1_int[i] << shift) & mask;
+ }
+
+ /* vec_vrlnm(arg1, arg2, arg3)
+ result - rotate each element of arg1 left then AND with mask. The mask
+ start, stop bits is specified in the second argument. The shift amount
+ is also specified in the second argument. */
+ vec_result_int = vec_vrlnm (vec_arg1_int, vec_arg2_int);
+
+ for (i = 0; i < 4; i++) {
+ if (vec_result_int[i] != vec_expected_result_int[i])
+#ifdef DEBUG
+ printf("ERROR: vec_vrlnm, i = %d, int result 0x%x does not match "
+ "expected result 0x%x\n", i, vec_result_int[i],
+ vec_expected_result_int[i]);
+#else
+ abort();
+#endif
+ }
+
+/* Check vec long int version of vec_vrlnm builtin */
+ mask = 0;
+ mask_begin = 0;
+ mask_end = 4;
+ shift = 20;
+
+ for (i = 0; i < 63; i++)
+ if ((i >= mask_begin) && (i <= mask_end))
+ mask |= 0x8000000000000000ULL >> i;
+
+ for (i = 0; i < 2; i++) {
+ vec_arg1_di[i] = 0x123456789ABCDE00ULL + i*0x1111111111111111ULL;
+ vec_arg2_di[i] = mask_begin << 16 | mask_end << 8 | shift;
+ vec_expected_result_di[i] = (vec_arg1_di[i] << shift) & mask;
+ }
+
+ vec_result_di = vec_vrlnm (vec_arg1_di, vec_arg2_di);
+
+ for (i = 0; i < 2; i++) {
+ if (vec_result_di[i] != vec_expected_result_di[i])
+#ifdef DEBUG
+ printf("ERROR: vec_vrlnm, i = %d, long long int result 0x%llx does not "
+ "match expected result 0x%llx\n", i, vec_result_di[i],
+ vec_expected_result_di[i]);
+#else
+ abort();
+#endif
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/div-vectorize-1.c b/gcc/testsuite/gcc.target/powerpc/div-vectorize-1.c
new file mode 100644
index 0000000..6208b2d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/div-vectorize-1.c
@@ -0,0 +1,46 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test vectorizer can exploit ISA 3.1 instructions Vector Divide
+ Signed/Unsigned Word/Doubleword for word/doubleword division. */
+
+#define N 128
+
+extern signed int si_a[N], si_b[N], si_c[N];
+extern unsigned int ui_a[N], ui_b[N], ui_c[N];
+extern signed long long sd_a[N], sd_b[N], sd_c[N];
+extern unsigned long long ud_a[N], ud_b[N], ud_c[N];
+
+__attribute__ ((noipa)) void
+test_si ()
+{
+ for (int i = 0; i < N; i++)
+ si_c[i] = si_a[i] / si_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_ui ()
+{
+ for (int i = 0; i < N; i++)
+ ui_c[i] = ui_a[i] / ui_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_sd ()
+{
+ for (int i = 0; i < N; i++)
+ sd_c[i] = sd_a[i] / sd_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_ud ()
+{
+ for (int i = 0; i < N; i++)
+ ud_c[i] = ud_a[i] / ud_b[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvdivsw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdivuw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdivsd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdivud\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.c b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.c
new file mode 100644
index 0000000..84f1b0a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test if signed/unsigned int extended divisions get vectorized. */
+
+#include "dive-vectorize-1.h"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvdivesw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdiveuw\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.h b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.h
new file mode 100644
index 0000000..119f637
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-1.h
@@ -0,0 +1,22 @@
+#define N 128
+
+typedef signed int si;
+typedef unsigned int ui;
+
+si si_a[N], si_b[N], si_c[N];
+ui ui_a[N], ui_b[N], ui_c[N];
+
+__attribute__ ((noipa)) void
+test_divwe ()
+{
+ for (int i = 0; i < N; i++)
+ si_c[i] = __builtin_divwe (si_a[i], si_b[i]);
+}
+
+__attribute__ ((noipa)) void
+test_divweu ()
+{
+ for (int i = 0; i < N; i++)
+ ui_c[i] = __builtin_divweu (ui_a[i], ui_b[i]);
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.c b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.c
new file mode 100644
index 0000000..13d768d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* We scan for vdive*d which are only supported on 64-bit env. */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test if signed/unsigned long long extended divisions get vectorized. */
+
+#include "dive-vectorize-2.h"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvdivesd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdiveud\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.h b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.h
new file mode 100644
index 0000000..1cab56b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-2.h
@@ -0,0 +1,22 @@
+#define N 128
+
+typedef signed long long sLL;
+typedef unsigned long long uLL;
+
+sLL sll_a[N], sll_b[N], sll_c[N];
+uLL ull_a[N], ull_b[N], ull_c[N];
+
+__attribute__ ((noipa)) void
+test_divde ()
+{
+ for (int i = 0; i < N; i++)
+ sll_c[i] = __builtin_divde (sll_a[i], sll_b[i]);
+}
+
+__attribute__ ((noipa)) void
+test_divdeu ()
+{
+ for (int i = 0; i < N; i++)
+ ull_c[i] = __builtin_divdeu (ull_a[i], ull_b[i]);
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-1.c b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-1.c
new file mode 100644
index 0000000..dab112c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-1.c
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+/* { dg-require-effective-target power10_hw } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model" } */
+
+#include "dive-vectorize-1.h"
+
+/* Check if test cases with signed/unsigned int extended division
+ vectorization run successfully. */
+
+/* Make optimize (1) to avoid vectorization applied on check func. */
+
+__attribute__ ((optimize (1))) void
+check_divwe ()
+{
+ test_divwe ();
+ for (int i = 0; i < N; i++)
+ {
+ si exp = __builtin_divwe (si_a[i], si_b[i]);
+ if (exp != si_c[i])
+ __builtin_abort ();
+ }
+}
+
+__attribute__ ((optimize (1))) void
+check_divweu ()
+{
+ test_divweu ();
+ for (int i = 0; i < N; i++)
+ {
+ ui exp = __builtin_divweu (ui_a[i], ui_b[i]);
+ if (exp != ui_c[i])
+ __builtin_abort ();
+ }
+}
+
+int
+main ()
+{
+ for (int i = 0; i < N; i++)
+ {
+ si_a[i] = 0x10 * (i * 3 + 2);
+ si_b[i] = 0x7890 * (i * 3 + 1);
+ ui_a[i] = 0x234 * (i * 11 + 3) - 0xcd * (i * 5 - 7);
+ ui_b[i] = 0x6078 * (i * 7 + 3) + 0xef * (i * 7 - 11);
+ if (si_b[i] == 0 || ui_b[i] == 0)
+ __builtin_abort ();
+ }
+
+ check_divwe ();
+ check_divweu ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-2.c b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-2.c
new file mode 100644
index 0000000..eb76149
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dive-vectorize-run-2.c
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+/* The checked bifs are only supported on 64-bit env. */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target power10_hw } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model" } */
+
+#include "dive-vectorize-2.h"
+
+/* Check if test cases with signed/unsigned int extended division
+ vectorization run successfully. */
+
+/* Make optimize (1) to avoid vectorization applied on check func. */
+
+__attribute__ ((optimize (1))) void
+check_divde ()
+{
+ test_divde ();
+ for (int i = 0; i < N; i++)
+ {
+ sLL exp = __builtin_divde (sll_a[i], sll_b[i]);
+ if (exp != sll_c[i])
+ __builtin_abort ();
+ }
+}
+
+__attribute__ ((optimize (1))) void
+check_divdeu ()
+{
+ test_divdeu ();
+ for (int i = 0; i < N; i++)
+ {
+ uLL exp = __builtin_divdeu (ull_a[i], ull_b[i]);
+ if (exp != ull_c[i])
+ __builtin_abort ();
+ }
+}
+
+int
+main ()
+{
+ for (int i = 0; i < N; i++)
+ {
+ sll_a[i] = 0x102 * (i * 3 + 2);
+ sll_b[i] = 0x789ab * (i * 3 + 1);
+ ull_a[i] = 0x2345 * (i * 11 + 3) - 0xcd1 * (i * 5 - 7);
+ ull_b[i] = 0x6078e * (i * 7 + 3) + 0xefa * (i * 7 - 11);
+ if (sll_b[i] == 0 || ull_b[i] == 0)
+ __builtin_abort ();
+ }
+
+ check_divde ();
+ check_divdeu ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-call.c b/gcc/testsuite/gcc.target/powerpc/float128-call.c
index 5895416..cf7ec08 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-call.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-call.c
@@ -6,20 +6,35 @@
#error "-mfloat128 is not supported."
#endif
+/* Pick a constant to load that cannot be generated by the power10 lxvkq
+ instruction. */
#ifdef __LONG_DOUBLE_IEEE128__
#define TYPE long double
-#define ONE 1.0L
+#define TEN 10.0L
#else
#define TYPE __float128
-#define ONE 1.0Q
+#define TEN 10.0Q
#endif
/* Test to make sure vector registers are used for passing IEEE 128-bit
floating point values and returning them. Also make sure the 'q' suffix is
- handled. */
-TYPE one (void) { return ONE; }
+ handled for __float128. */
+TYPE one (void) { return TEN; }
void store (TYPE a, TYPE *p) { *p = a; }
-/* { dg-final { scan-assembler "lxvd2x 34" } } */
-/* { dg-final { scan-assembler "stxvd2x 34" } } */
+/* This regexp captures the different vector load/stores that can be generated:
+
+ lxvd2x -- big endian power7/power8, little endian power8
+ lvx -- Altivec
+ lxv -- D-form power9
+ lxvx -- X-form power9
+ plxv -- prefixed power10
+ stxvd2x -- big endian power7/power8, little endian power8
+ stvx -- Altivec
+ stxvx -- X-form vector store (power9/power10).
+ stv -- D-form vector store (power9 and above).
+ pstv -- prefixed vector store (power10 and above). */
+
+/* { dg-final { scan-assembler {\mlxvd2x 34\M|\mlvx 2\M|\mp?lxvx? 34\M} } } */
+/* { dg-final { scan-assembler {\mstxvd2x 34\M|\mstvx 2\M|\mp?stxvx? 34\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-cmove.c b/gcc/testsuite/gcc.target/powerpc/float128-cmove.c
new file mode 100644
index 0000000..2fae8dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-cmove.c
@@ -0,0 +1,58 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ppc_float128_hw } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
+
+#ifndef TYPE
+#ifdef __LONG_DOUBLE_IEEE128__
+#define TYPE long double
+
+#else
+#define TYPE _Float128
+#endif
+#endif
+
+/* Verify that the ISA 3.1 (power10) IEEE 128-bit conditional move instructions
+ are generated. */
+
+TYPE
+eq (TYPE a, TYPE b, TYPE c, TYPE d)
+{
+ return (a == b) ? c : d;
+}
+
+TYPE
+ne (TYPE a, TYPE b, TYPE c, TYPE d)
+{
+ return (a != b) ? c : d;
+}
+
+TYPE
+lt (TYPE a, TYPE b, TYPE c, TYPE d)
+{
+ return (a < b) ? c : d;
+}
+
+TYPE
+le (TYPE a, TYPE b, TYPE c, TYPE d)
+{
+ return (a <= b) ? c : d;
+}
+
+TYPE
+gt (TYPE a, TYPE b, TYPE c, TYPE d)
+{
+ return (a > b) ? c : d;
+}
+
+TYPE
+ge (TYPE a, TYPE b, TYPE c, TYPE d)
+{
+ return (a >= b) ? c : d;
+}
+
+/* { dg-final { scan-assembler-times {\mxscmpeqqp\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mxscmpgeqp\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mxscmpgtqp\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mxxsel\M} 6 } } */
+/* { dg-final { scan-assembler-not {\mxscmpuqp\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c b/gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c
new file mode 100644
index 0000000..c71ba08
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c
@@ -0,0 +1,15 @@
+/* { dg-require-effective-target ppc_float128_hw } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ffast-math" } */
+
+#ifndef TYPE
+#define TYPE _Float128
+#endif
+
+/* Test that the fminf128/fmaxf128 functions generate if/then/else and not a
+ call. */
+TYPE f128_min (TYPE a, TYPE b) { return __builtin_fminf128 (a, b); }
+TYPE f128_max (TYPE a, TYPE b) { return __builtin_fmaxf128 (a, b); }
+
+/* { dg-final { scan-assembler {\mxsmaxcqp\M} } } */
+/* { dg-final { scan-assembler {\mxsmincqp\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-minmax-3.c b/gcc/testsuite/gcc.target/powerpc/float128-minmax-3.c
new file mode 100644
index 0000000..6f7627c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-minmax-3.c
@@ -0,0 +1,15 @@
+/* { dg-require-effective-target ppc_float128_hw } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
+
+#ifndef TYPE
+#define TYPE _Float128
+#endif
+
+/* Test that the fminf128/fmaxf128 functions generate if/then/else and not a
+ call. */
+TYPE f128_min (TYPE a, TYPE b) { return (a < b) ? a : b; }
+TYPE f128_max (TYPE a, TYPE b) { return (b > a) ? b : a; }
+
+/* { dg-final { scan-assembler {\mxsmaxcqp\M} } } */
+/* { dg-final { scan-assembler {\mxsmincqp\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-minmax.c b/gcc/testsuite/gcc.target/powerpc/float128-minmax.c
index fe39751..ef8f729 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-minmax.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-minmax.c
@@ -1,6 +1,4 @@
-/* { dg-do compile { target lp64 } } */
-/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-require-effective-target float128 } */
+/* { dg-require-effective-target ppc_float128_hw } */
/* { dg-options "-mpower9-vector -O2 -ffast-math" } */
#ifndef TYPE
@@ -12,5 +10,8 @@
TYPE f128_min (TYPE a, TYPE b) { return __builtin_fminf128 (a, b); }
TYPE f128_max (TYPE a, TYPE b) { return __builtin_fmaxf128 (a, b); }
-/* { dg-final { scan-assembler {\mxscmpuqp\M} } } */
-/* { dg-final { scan-assembler-not {\mbl\M} } } */
+/* Adjust code power10 which has native min/max instructions. */
+/* { dg-final { scan-assembler-times {\mxscmpuqp\M} 2 { target { ! has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\mxsmincqp\M} 1 { target has_arch_pwr10 } } } */
+/* { dg-final { scan-assembler-times {\mxsmaxcqp\M} 1 { target has_arch_pwr10 } } } */
+/* { dg-final { scan-assembler-not {\mbl\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-div-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-div-longlong.c
index 312e984..f6a9b29 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-div-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-div-longlong.c
@@ -19,5 +19,8 @@ test6 (vector unsigned long long x, vector unsigned long long y)
{
return vec_div (x, y);
}
-/* { dg-final { scan-assembler-times {\mdivd\M} 2 } } */
-/* { dg-final { scan-assembler-times {\mdivdu\M} 2 } } */
+
+/* { dg-final { scan-assembler-times {\mdivd\M} 2 { target { ! has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\mdivdu\M} 2 { target { ! has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\mvdivsd\M} 1 { target { has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\mvdivud\M} 1 { target { has_arch_pwr10 } } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c
index 4149d52..e0c7ee1 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c
@@ -58,8 +58,8 @@ vector unsigned char testuu_cst (unsigned char x, vector unsigned char v)
/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target lp64 } } } */
/* -m32 codegen. */
-/* { dg-final { scan-assembler-times {\mstvx\M|\mstxvw4x\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstb\M} 8 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 8 { target { be && ilp32 } } } } */
-/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstvx\M|\mstxvw4x\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstb\M} 4 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 4 { target { be && ilp32 } } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c
index b8e751f..c18444d 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c
@@ -54,8 +54,8 @@ vector unsigned char testuu_cst (unsigned char x, vector unsigned char v)
/* -m32 codegen. */
/* { dg-final { scan-assembler-times {\mrlwinm\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstb\M} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstb\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlxv\M} 8 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlvebx\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mxxperm\M} 8 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c
index 1286010..afd7f7e 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c
@@ -24,15 +24,15 @@ testd_cst (double d, vector double vd)
/* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 1 } } */
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 1 { target { ! has_arch_pwr8 } } } } */
-/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 1 { target { ! has_arch_pwr8 } } } } */
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 1 { target { ! has_arch_pwr8 } } } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 1 { target { ! has_arch_pwr7 } } } } */
+/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 1 { target { ! has_arch_pwr7 } } } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 1 { target { ! has_arch_pwr7 } } } } */
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 0 { target { has_arch_pwr8 && lp64 } } } } */
-/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 0 { target { has_arch_pwr8 && lp64 } } } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 0 { target { has_arch_pwr7 && lp64 } } } } */
+/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 0 { target { has_arch_pwr7 && lp64 } } } } */
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target { has_arch_pwr8 && lp64 } } } } */
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 1 { target { has_arch_pwr8 && ilp32 } } } } */
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 1 { target { has_arch_pwr8 && ilp32 } } } } */
-/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 1 { target { has_arch_pwr8 && ilp32 } } } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target { has_arch_pwr7 && lp64 } } } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target { has_arch_pwr7 && ilp32 } } } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 0 { target { has_arch_pwr7 && ilp32 } } } } */
+/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 0 { target { has_arch_pwr7 && ilp32 } } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c
index e458d8f..1866ce2 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c
@@ -29,8 +29,8 @@ testf_cst (float f, vector float vf)
/* { dg-final { scan-assembler-times {\mvperm\M} 3 { target lp64 } } } */
/* -m32 codegen. */
-/* { dg-final { scan-assembler-times {\mstvx\M|\mstxv\M|\mstxvd2x\M} 1 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstvx\M|\mstxv\M|\mstxvd2x\M} 0 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mstfs\M|\mstfsx\M} 2 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mvperm\M} 1 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 3 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c
index 9684c9f..4541768 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c
@@ -31,5 +31,5 @@ testf_cst (float f, vector float vf)
/* { dg-final { scan-assembler-times {\mstfs\M} 2 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlxv\M} 2 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlvewx\M} 1 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mvperm\M} 1 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mxxperm\M} 1 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c
index d5fa422c..bcee9b2 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c
@@ -57,7 +57,7 @@ testui2_cst(unsigned int x, vector unsigned int v)
/* { dg-final { scan-assembler-times {\mlvewx\M} 4 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target lp64 } } } */
-/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstvx\M|\mstwx\M|\mstw\M|\mstxvw4x\M} 12 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 8 { target { be && ilp32 } } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstvx\M|\mstwx\M|\mstw\M|\mstxvw4x\M} 4 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 4 { target { be && ilp32 } } } } */
/* { dg-final { scan-assembler-times {\mlvewx\M} 4 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c
index 5cd6b3e..5512810 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c
@@ -57,9 +57,9 @@ testui2_cst(unsigned int x, vector unsigned int v)
/* { dg-final { scan-assembler-times {\mmtvsrwz\M} 8 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mxxinsertw\M} 8 { target lp64 } } } */
-/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstw\M} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstw\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlxv\M} 8 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlvewx\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mxxperm\M} 8 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c
index 0a0ee31..8ca4ac7 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c
@@ -65,6 +65,6 @@ testul2_cst(unsigned long long x, vector unsigned long long v)
/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target lp64 } } } */
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstvx\M|\mstxv\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mvperm\M} 0 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 4 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstvx\M|\mstxv\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c
index a479d98..0d9d4e7 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c
@@ -56,7 +56,7 @@ testus2_cst(unsigned short x, vector unsigned short v)
/* { dg-final { scan-assembler-times {\mlvehx\M} 4 } } */
/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target lp64 } } } */
-/* { dg-final { scan-assembler-times {\mlhz\M|\mlvx\M|\mlxv\M|\mlxvw4x\M} 8 { target { be && ilp32 } } } } */
-/* { dg-final { scan-assembler-times {\msthx\M|\mstvx\M|\msth\M|\mstxvw4x\M} 12 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlhz\M|\mlvx\M|\mlxv\M|\mlxvw4x\M} 4 { target { be && ilp32 } } } } */
+/* { dg-final { scan-assembler-times {\msthx\M|\mstvx\M|\msth\M|\mstxvw4x\M} 4 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c
index cea7488b..050adb2 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c
@@ -55,10 +55,10 @@ testus2_cst(unsigned short x, vector unsigned short v)
/* { dg-final { scan-assembler-times {\mlxv\M|\mlvx\M} 0 { target lp64 }} } */
/* -m32 uses sth/lvehx as part of the sequence. */
-/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\msth\M} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\msth\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlvehx\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mxxperm\M} 8 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlxv\M|\mlvx\M} 8 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c
index 9b199c2..9fc24f9 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned char, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned char, signed int, vector unsigned char);
BUILD_CST_TEST( test12, vector unsigned char, 8, vector unsigned char);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mp?lxv\M|\mlvx\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c
index c49dfe8..770bf36 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c
@@ -28,4 +28,4 @@ BUILD_VAR_TEST( test4, vector double, signed long long, vector double);
BUILD_VAR_TEST( test5, vector double, signed int, vector double);
BUILD_CST_TEST( test6, vector double, 12, vector double);
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mp?lxv\M|\mlvx\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c
index cdded36..9b35a44 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c
@@ -28,4 +28,4 @@ BUILD_VAR_TEST( test4, vector float, signed long long, vector float);
BUILD_VAR_TEST( test5, vector float, signed int, vector float);
BUILD_CST_TEST( test6, vector float, 12, vector float);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mp?lxv\M|\mlvx\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c
index bc18beb..75903a9 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned int, signed long long, vector unsigned i
BUILD_VAR_TEST( test11, vector unsigned int, signed int, vector unsigned int);
BUILD_CST_TEST( test12, vector unsigned int, 12, vector unsigned int);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mp?lxv\M|\mlvx\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c
index 66e953a..204f738 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned long long, signed long long, vector uns
BUILD_VAR_TEST( test11, vector unsigned long long, signed int, vector unsigned long long);
BUILD_CST_TEST( test12, vector unsigned long long, 12, vector unsigned long long);
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mp?lxv\M|\mlvx\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c
index 0ef1c59..1be7765 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned short, signed long long, vector unsigne
BUILD_VAR_TEST( test11, vector unsigned short, signed int, vector unsigned short);
BUILD_CST_TEST( test12, vector unsigned short, 12, vector unsigned short);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mp?lxv\M|\mlvx\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-char.c
index 0b76341..6aae435 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-char.c
@@ -35,5 +35,5 @@ BUILD_VAR_TEST( test10, vector unsigned char, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned char, signed int, vector unsigned char);
BUILD_CST_TEST( test12, vector unsigned char, 12, vector unsigned char);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-double.c
index beb6d03..b3f3b7f 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-double.c
@@ -27,4 +27,4 @@ BUILD_VAR_TEST( test4, vector double, int, vector double);
BUILD_VAR_TEST( test5, vector double, long long, vector double);
BUILD_CST_TEST( test6, vector double, 12, vector double);
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-float.c
index 5f9b6d3..56cbe9a 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-float.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-float.c
@@ -27,4 +27,4 @@ BUILD_VAR_TEST( test5, vector float, signed long long, vector float);
BUILD_VAR_TEST( test7, vector float, signed int, vector float);
BUILD_CST_TEST( test8, vector float, 12, vector float);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-int.c
index a59f52f..2cde9f5 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-int.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned int, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned int, signed int, vector unsigned int);
BUILD_CST_TEST( test12, vector unsigned int, 12, vector unsigned int);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-longlong.c
index 5c121fa..cf2b7f9 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-longlong.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned long long, signed long long, vector uns
BUILD_VAR_TEST( test11, vector unsigned long long, signed int, vector unsigned long long);
BUILD_CST_TEST( test12, vector unsigned long long, 12, vector unsigned long long);
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-short.c
index 07154d8..cfc0e30 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-short.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned short, signed long long, vector unsigne
BUILD_VAR_TEST( test11, vector unsigned short, signed int, vector unsigned short);
BUILD_CST_TEST( test12, vector unsigned short, 12, vector unsigned short);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-char.c
index 04c4f31..7281b3c 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-char.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned char, signed long long, unsigned char);
BUILD_VAR_TEST( test11, vector unsigned char, signed int, unsigned char);
BUILD_CST_TEST( test12, vector unsigned char, 12, unsigned char);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-double.c
index 1958d65..3f3d985 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-double.c
@@ -28,4 +28,4 @@ BUILD_VAR_TEST( test4, vector double, signed long long, double);
BUILD_VAR_TEST( test5, vector double, signed int, double);
BUILD_CST_TEST( test6, vector double, 12, double);
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-float.c
index 5578138..eafe305 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-float.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-float.c
@@ -27,4 +27,4 @@ BUILD_VAR_TEST( test4, vector float, signed long long, vector float);
BUILD_VAR_TEST( test5, vector float, signed int, vector float);
BUILD_CST_TEST( test6, vector float, 12, vector float);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-int.c
index 8ba880e..a226721 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-int.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned int, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned int, signed int, vector unsigned int);
BUILD_CST_TEST( test12, vector unsigned int, 12, vector unsigned int);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-longlong.c
index 6df3c79..f2e5469 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-longlong.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned long long, signed long long, vector uns
BUILD_VAR_TEST( test11, vector unsigned long long, signed int, vector unsigned long long);
BUILD_CST_TEST( test12, vector unsigned long long, 12, vector unsigned long long);
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-short.c
index c5088ab..2d64b4f 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_xl-short.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned short, signed long long, vector unsigne
BUILD_VAR_TEST( test11, vector unsigned short, signed int, vector unsigned short);
BUILD_CST_TEST( test12, vector unsigned short, 12, vector unsigned short);
-/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M|\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-longlong.c
index 38dba9f..dff073d 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-longlong.c
@@ -20,5 +20,8 @@ test6 (vector unsigned long long x, vector unsigned long long y)
return vec_mul (x, y);
}
-/* { dg-final { scan-assembler-times "\[ \t\]mulld " 4 { target lp64 } } } */
-
+/* Power10 can generate the vmulld instruction even in 32-bit. Before power10,
+ we limit the code to lp64, since 32-bit cannot generate the mulld
+ instruction. */
+/* { dg-final { scan-assembler-times {\mmulld\M} 4 { target { lp64 && { ! has_arch_pwr10 } } } } } */
+/* { dg-final { scan-assembler-times {\mvmulld\M} 2 { target { has_arch_pwr10 } } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-floatdouble.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-floatdouble.c
index ab39696..7661917 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-floatdouble.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-floatdouble.c
@@ -20,11 +20,12 @@ vector double testd_01 (vector double x) { return vec_splat (x, 0b00001); }
vector double test_dc ()
{ const vector double y = { 3.0, 5.0 }; return vec_splat (y, 0b00010); }
-/* If the source vector is a known constant, we will generate a load. */
-/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvd2x\M|\mlxv\M} 2 } } */
+/* If the source vector is a known constant, we will generate a load or possibly
+ XXSPLTIW. */
+/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvd2x\M|\mlxv\M|\mplxv\M|\mxxspltiw\M} 2 } } */
/* For float types, we generate a splat. */
-/* { dg-final { scan-assembler-times "vspltw|xxspltw" 3 } } */
+/* { dg-final { scan-assembler-times {\mvspltw\M|\mxxspltw\M} 3 } } */
/* For double types, we will generate xxpermdi instructions. */
/* { dg-final { scan-assembler-times "xxpermdi" 3 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-longlong.c
index 4fa06c8..b95b987 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splat-longlong.c
@@ -25,7 +25,7 @@ vector signed long long test_sll () { const vector signed long long y = {34, 45}
vector unsigned long long test_ull () { const vector unsigned long long y = {56, 67}; return vec_splat (y, 0b00010); }
/* Assorted load instructions for the initialization with known constants. */
-/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvd2x\M|\mlxv\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvd2x\M|\mlxv\M|\mplxv\M} 3 } } */
/* xxpermdi for vec_splat of long long vectors.
At the time of this writing, the number of xxpermdi instructions
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-char.c
index d1100d0..162563c 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-char.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned char, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned char, signed int, vector unsigned char );
BUILD_CST_TEST( test12, vector unsigned char, 12, vector unsigned char );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-double.c
index 74e34c3..c42a720 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-double.c
@@ -28,4 +28,4 @@ BUILD_VAR_TEST( test4, vector double, signed long long, double );
BUILD_VAR_TEST( test5, vector double, signed int, double );
BUILD_CST_TEST( test6, vector double, 12, double );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-float.c
index db6bd33..b200c47 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-float.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-float.c
@@ -28,4 +28,4 @@ BUILD_VAR_TEST( test4, vector float, signed long long, vector float );
BUILD_VAR_TEST( test5, vector float, signed int, vector float );
BUILD_CST_TEST( test6, vector float, 12, vector float );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-int.c
index 2a32889..d984882 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-int.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned int, signed long long, vector unsigned i
BUILD_VAR_TEST( test11, vector unsigned int, signed int, vector unsigned int );
BUILD_CST_TEST( test12, vector unsigned int, 12, vector unsigned int );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-longlong.c
index a62ca51..bb72d9b 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-longlong.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned long long, signed long long, vector uns
BUILD_VAR_TEST( test11, vector unsigned long long, signed int, vector unsigned long long );
BUILD_CST_TEST( test12, vector unsigned long long, 12, vector unsigned long long );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-short.c
index 2b1e1c0..f4dbb70 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-builtin_vec_xst-short.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned short, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned short, signed int, vector unsigned short );
BUILD_CST_TEST( test12, vector unsigned short, 12, vector unsigned short );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-char.c
index 82bb891..ae5cf8e 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-char.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned char, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned char, signed int, vector unsigned char );
BUILD_CST_TEST( test12, vector unsigned char, 12, vector unsigned char );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-double.c
index 34772cf..1360f4d 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-double.c
@@ -28,4 +28,4 @@ BUILD_VAR_TEST( test7, vector double, signed long long, vector double );
BUILD_VAR_TEST( test8, vector double, signed int, vector double );
BUILD_CST_TEST( test9, vector double, 12, vector double );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-float.c
index cf13f2a..1b70f2a 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-float.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-float.c
@@ -28,4 +28,4 @@ BUILD_VAR_TEST( test7, vector float, signed long long, vector float );
BUILD_VAR_TEST( test8, vector float, signed int, vector float );
BUILD_CST_TEST( test9, vector float, 12, vector float );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-int.c
index a9e189d..4e4a499 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-int.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned int, signed long long, vector unsigned i
BUILD_VAR_TEST( test11, vector unsigned int, signed int, vector unsigned int );
BUILD_CST_TEST( test12, vector unsigned int, 12, vector unsigned int );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-longlong.c
index f50e2b9..b57c126 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-longlong.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned long long, signed long long, vector unsi
BUILD_VAR_TEST( test11, vector unsigned long long, signed int, vector unsigned long long );
BUILD_CST_TEST( test12, vector unsigned long long, 12, vector unsigned long long );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-short.c
index 0f8a93a..7593f42 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_vsx_st-short.c
@@ -36,4 +36,4 @@ BUILD_VAR_TEST( test10, vector unsigned short, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned short, signed int, vector unsigned short );
BUILD_CST_TEST( test12, vector unsigned short, 12, vector unsigned short );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-char.c
index 4f5930a..fdd2ed5 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-char.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned char, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned char, signed int, vector unsigned char );
BUILD_CST_TEST( test12, vector unsigned char, 12, vector unsigned char );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-double.c
index 511d5fe..62f8552 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-double.c
@@ -27,4 +27,4 @@ BUILD_VAR_TEST( test7, vector double, signed long long, vector double );
BUILD_VAR_TEST( test8, vector double, signed int, vector double );
BUILD_CST_TEST( test9, vector double, 12, vector double );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-float.c
index 13e6cb6..ad15a5a 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-float.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-float.c
@@ -27,4 +27,4 @@ BUILD_VAR_TEST( test7, vector float, signed long long, vector float );
BUILD_VAR_TEST( test8, vector float, signed int, vector float );
BUILD_CST_TEST( test9, vector float, 12, vector float );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 6 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-int.c
index fd6ff78..abe93df 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-int.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned int, signed long long, vector unsigned i
BUILD_VAR_TEST( test11, vector unsigned int, signed int, vector unsigned int );
BUILD_CST_TEST( test12, vector unsigned int, 12, vector unsigned int );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-longlong.c
index a669481..6859593 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-longlong.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned long long, signed long long, vector unsi
BUILD_VAR_TEST( test11, vector unsigned long long, signed int, vector unsigned long long );
BUILD_CST_TEST( test12, vector unsigned long long, 12, vector unsigned long long );
-/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-short.c
index 78eae57..6c54873 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-store-vec_xst-short.c
@@ -35,4 +35,4 @@ BUILD_VAR_TEST( test10, vector unsigned short, signed long long, vector unsigned
BUILD_VAR_TEST( test11, vector unsigned short, signed int, vector unsigned short );
BUILD_CST_TEST( test12, vector unsigned short, 12, vector unsigned short );
-/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M} 12 } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M|\mstxvd2x\M|\mstxvx\M|\mstvx\M|\mpstxv\M} 12 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fp128_conversions.c b/gcc/testsuite/gcc.target/powerpc/fp128_conversions.c
new file mode 100644
index 0000000..c20282f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fp128_conversions.c
@@ -0,0 +1,294 @@
+/* { dg-do run } */
+/* { dg-require-effective-target power10_hw } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
+
+/* Check that the expected 128-bit instructions are generated if the processor
+ supports the 128-bit integer instructions. */
+/* { dg-final { scan-assembler-times {\mxscvsqqp\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mxscvuqqp\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mxscvqpsqz\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mxscvqpuqz\M} 1 } } */
+
+#include <stdio.h>
+#include <math.h>
+#include <fenv.h>
+#include <stdlib.h>
+#include <wchar.h>
+
+#define DEBUG 0
+
+void
+abort (void);
+
+float
+conv_i_2_fp( long long int a)
+{
+ return (float) a;
+}
+
+double
+conv_i_2_fpd( long long int a)
+{
+ return (double) a;
+}
+
+double
+conv_ui_2_fpd( unsigned long long int a)
+{
+ return (double) a;
+}
+
+__float128
+conv_i128_2_fp128 (__int128_t a)
+{
+ // default, gen inst KF mode
+ // -mabi=ibmlongdouble, gen inst floattiieee KF mode
+ // -mabi=ieeelongdouble gen inst floattiieee TF mode
+ return (__float128) a;
+}
+
+__float128
+conv_ui128_2_fp128 (__uint128_t a)
+{
+ // default, gen inst KF mode
+ // -mabi=ibmlongdouble, gen inst floattiieee KF mode
+ // -mabi=ieeelongdouble gen inst floattiieee TF mode
+ return (__float128) a;
+}
+
+__int128_t
+conv_fp128_2_i128 (__float128 a)
+{
+ // default, gen inst KF mode
+ // -mabi=ibmlongdouble, gen inst floattiieee KF mode
+ // -mabi=ieeelongdouble gen inst floattiieee TF mode
+ return (__int128_t) a;
+}
+
+__uint128_t
+conv_fp128_2_ui128 (__float128 a)
+{
+ // default, gen inst KF mode
+ // -mabi=ibmlongdouble, gen inst floattiieee KF mode
+ // -mabi=ieeelongdouble gen inst floattiieee TF mode
+ return (__uint128_t) a;
+}
+
+long double
+conv_i128_2_ld (__int128_t a)
+{
+ // default, gen call __floattitf
+ // -mabi=ibmlongdouble, gen call __floattitf
+ // -mabi=ieeelongdouble gen inst floattiieee TF mode
+ return (long double) a;
+}
+
+__ibm128
+conv_i128_2_ibm128 (__int128_t a)
+{
+ // default, gen call __floattitf
+ // -mabi=ibmlongdouble, gen call __floattitf
+ // -mabi=ieeelongdouble, message uses IBM long double, no binary output
+ return (__ibm128) a;
+}
+
+int
+main()
+{
+ float a, expected_result_float;
+ double b, expected_result_double;
+ long long int c, expected_result_llint;
+ unsigned long long int u;
+ __int128_t d;
+ __uint128_t u128;
+ unsigned long long expected_result_uint128[2] ;
+ __float128 e;
+ long double ld; // another 128-bit float version
+
+ union conv_t {
+ float a;
+ double b;
+ long long int c;
+ long long int128[2] ;
+ unsigned long long uint128[2] ;
+ unsigned long long int u;
+ __int128_t d;
+ __uint128_t u128;
+ __float128 e;
+ long double ld; // another 128-bit float version
+ } conv, conv_result;
+
+ c = 20;
+ expected_result_llint = 20.00000;
+ a = conv_i_2_fp (c);
+
+ if (a != expected_result_llint) {
+#if DEBUG
+ printf("ERROR: conv_i_2_fp(%lld) = %10.5f\n", c, a);
+ printf("\n does not match expected_result = %10.5f\n\n",
+ expected_result_llint);
+#else
+ abort();
+#endif
+ }
+
+ c = 20;
+ expected_result_double = 20.00000;
+ b = conv_i_2_fpd (c);
+
+ if (b != expected_result_double) {
+#if DEBUG
+ printf("ERROR: conv_i_2_fpd(%lld) = %10.5f\n", d, b);
+ printf("\n does not match expected_result = %10.5f\n\n",
+ expected_result_double);
+ #else
+ abort();
+#endif
+ }
+
+ u = 20;
+ expected_result_double = 20.00000;
+ b = conv_ui_2_fpd (u);
+
+ if (b != expected_result_double) {
+#if DEBUG
+ printf("ERROR: conv_ui_2_fpd(%llu) = %10.5f\n", u, b);
+ printf("\n does not match expected_result = %10.5f\n\n",
+ expected_result_double);
+ #else
+ abort();
+#endif
+ }
+
+ d = -3210;
+ d = (d * 10000000000) + 9876543210;
+ conv_result.e = conv_i128_2_fp128 (d);
+ expected_result_uint128[1] = 0xc02bd2f9068d1160;
+ expected_result_uint128[0] = 0x0;
+
+ if ((conv_result.uint128[1] != expected_result_uint128[1])
+ && (conv_result.uint128[0] != expected_result_uint128[0])) {
+#if DEBUG
+ printf("ERROR: conv_i128_2_fp128(-32109876543210) = (result in hex) 0x%llx %llx\n",
+ conv.uint128[1], conv.uint128[0]);
+ printf("\n does not match expected_result = (result in hex) 0x%llx %llx\n\n",
+ expected_result_uint128[1], expected_result_uint128[0]);
+ #else
+ abort();
+#endif
+ }
+
+ d = 123;
+ d = (d * 10000000000) + 1234567890;
+ conv_result.ld = conv_i128_2_fp128 (d);
+ expected_result_uint128[1] = 0x0;
+ expected_result_uint128[0] = 0x4271eab4c8ed2000;
+
+ if ((conv_result.uint128[1] != expected_result_uint128[1])
+ && (conv_result.uint128[0] != expected_result_uint128[0])) {
+#if DEBUG
+ printf("ERROR: conv_i128_2_fp128(1231234567890) = (result in hex) 0x%llx %llx\n",
+ conv.uint128[1], conv.uint128[0]);
+ printf("\n does not match expected_result = (result in hex) 0x%llx %llx\n\n",
+ expected_result_uint128[1], expected_result_uint128[0]);
+ #else
+ abort();
+#endif
+ }
+
+ u128 = 8760;
+ u128 = (u128 * 10000000000) + 1234567890;
+ conv_result.e = conv_ui128_2_fp128 (u128);
+ expected_result_uint128[1] = 0x402d3eb101df8b48;
+ expected_result_uint128[0] = 0x0;
+
+ if ((conv_result.uint128[1] != expected_result_uint128[1])
+ && (conv_result.uint128[0] != expected_result_uint128[0])) {
+#if DEBUG
+ printf("ERROR: conv_ui128_2_fp128(87601234567890) = (result in hex) 0x%llx %llx\n",
+ conv.uint128[1], conv.uint128[0]);
+ printf("\n does not match expected_result = (result in hex) 0x%llx %llx\n\n",
+ expected_result_uint128[1], expected_result_uint128[0]);
+ #else
+ abort();
+#endif
+ }
+
+ u128 = 3210;
+ u128 = (u128 * 10000000000) + 9876543210;
+ expected_result_uint128[1] = 0x402bd3429c8feea0;
+ expected_result_uint128[0] = 0x0;
+ conv_result.e = conv_ui128_2_fp128 (u128);
+
+ if ((conv_result.uint128[1] != expected_result_uint128[1])
+ && (conv_result.uint128[0] != expected_result_uint128[0])) {
+#if DEBUG
+ printf("ERROR: conv_ui128_2_fp128(32109876543210) = (result in hex) 0x%llx %llx\n",
+ conv.uint128[1], conv.uint128[0]);
+ printf("\n does not match expected_result = (result in hex) 0x%llx %llx\n\n",
+ expected_result_uint128[1], expected_result_uint128[0]);
+ #else
+ abort();
+#endif
+ }
+
+ conv.e = 12345.6789;
+ expected_result_uint128[1] = 0x1407374883526960;
+ expected_result_uint128[0] = 0x3039;
+
+ conv_result.d = conv_fp128_2_i128 (conv.e);
+
+ if ((conv_result.uint128[1] != expected_result_uint128[1])
+ && (conv_result.uint128[0] != expected_result_uint128[0])) {
+#if DEBUG
+ printf("ERROR: conv_fp128_2_i128(0x%llx %llx) = ",
+ conv.uint128[1], conv.uint128[0]);
+ printf("0x%llx %llx\n", conv_result.uint128[1], conv_result.uint128[0]);
+
+ printf("\n does not match expected_result = (result in hex) 0x%llx %llx\n\n",
+ expected_result_uint128[1], expected_result_uint128[0]);
+ #else
+ abort();
+#endif
+ }
+
+ conv.e = -6789.12345;
+ expected_result_uint128[1] = 0x0;
+ expected_result_uint128[0] = 0xffffffffffffe57b;
+ conv_result.d = conv_fp128_2_i128 (conv.e);
+
+ if ((conv_result.uint128[1] != expected_result_uint128[1])
+ && (conv_result.uint128[0] != expected_result_uint128[0])) {
+#if DEBUG
+ printf("ERROR: conv_fp128_2_i128(0x%llx %llx) = ",
+ conv.uint128[1], conv.uint128[0]);
+ printf("0x%llx %llx\n", conv_result.uint128[1], conv_result.uint128[0]);
+
+ printf("\n does not match expected_result = (result in hex) 0x%llx %llx\n\n",
+ expected_result_uint128[1], expected_result_uint128[0]);
+ #else
+ abort();
+#endif
+ }
+
+ conv.e = 6789.12345;
+ expected_result_uint128[1] = 0x0;
+ expected_result_uint128[0] = 0x1a85;
+ conv_result.d = conv_fp128_2_ui128 (conv.e);
+
+ if ((conv_result.uint128[1] != expected_result_uint128[1])
+ && (conv_result.uint128[0] != expected_result_uint128[0])) {
+#if DEBUG
+ printf("ERROR: conv_fp128_2_ui128(0x%llx %llx) = ",
+ conv.uint128[1], conv.uint128[0]);
+ printf("0x%llx %llx\n", conv_result.uint128[1], conv_result.uint128[0]);
+
+ printf("\n does not match expected_result = (result in hex) 0x%llx %llx\n\n",
+ expected_result_uint128[1], expected_result_uint128[0]);
+ #else
+ abort();
+#endif
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
new file mode 100644
index 0000000..009a5f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
@@ -0,0 +1,214 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
+
+#include <altivec.h>
+#include <stdint.h>
+
+/* and/andc/eqv/nand/nor/or/orc/xor */
+#define AND(a,b) ((a)&(b))
+#define ANDC1(a,b) ((a)&((~b)))
+#define ANDC2(a,b) ((~(a))&(b))
+#define EQV(a,b) (~((a)^(b)))
+#define NAND(a,b) (~((a)&(b)))
+#define NOR(a,b) (~((a)|(b)))
+#define OR(a,b) ((a)|(b))
+#define ORC1(a,b) ((a)|((~b)))
+#define ORC2(a,b) ((~(a))|(b))
+#define XOR(a,b) ((a)^(b))
+#define TEST1(type, func) \
+ type func ## _and_T_ ## type (type a, type b, type c) { return AND(func(a,b),c); } \
+ type func ## _andc1_T_ ## type (type a, type b, type c) { return ANDC1(func(a,b),c); } \
+ type func ## _andc2_T_ ## type (type a, type b, type c) { return ANDC2(func(a,b),c); } \
+ type func ## _eqv_T_ ## type (type a, type b, type c) { return EQV(func(a,b),c); } \
+ type func ## _nand_T_ ## type (type a, type b, type c) { return NAND(func(a,b),c); } \
+ type func ## _nor_T_ ## type (type a, type b, type c) { return NOR(func(a,b),c); } \
+ type func ## _or_T_ ## type (type a, type b, type c) { return OR(func(a,b),c); } \
+ type func ## _orc1_T_ ## type (type a, type b, type c) { return ORC1(func(a,b),c); } \
+ type func ## _orc2_T_ ## type (type a, type b, type c) { return ORC2(func(a,b),c); } \
+ type func ## _xor_T_ ## type (type a, type b, type c) { return XOR(func(a,b),c); } \
+ type func ## _rev_and_T_ ## type (type a, type b, type c) { return AND(c,func(a,b)); } \
+ type func ## _rev_andc1_T_ ## type (type a, type b, type c) { return ANDC1(c,func(a,b)); } \
+ type func ## _rev_andc2_T_ ## type (type a, type b, type c) { return ANDC2(c,func(a,b)); } \
+ type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return EQV(c,func(a,b)); } \
+ type func ## _rev_nand_T_ ## type (type a, type b, type c) { return NAND(c,func(a,b)); } \
+ type func ## _rev_nor_T_ ## type (type a, type b, type c) { return NOR(c,func(a,b)); } \
+ type func ## _rev_or_T_ ## type (type a, type b, type c) { return OR(c,func(a,b)); } \
+ type func ## _rev_orc1_T_ ## type (type a, type b, type c) { return ORC1(c,func(a,b)); } \
+ type func ## _rev_orc2_T_ ## type (type a, type b, type c) { return ORC2(c,func(a,b)); } \
+ type func ## _rev_xor_T_ ## type (type a, type b, type c) { return XOR(c,func(a,b)); }
+#define TEST(type) \
+ TEST1(type,AND) \
+ TEST1(type,ANDC1) \
+ TEST1(type,ANDC2) \
+ TEST1(type,EQV) \
+ TEST1(type,NAND) \
+ TEST1(type,NOR) \
+ TEST1(type,OR) \
+ TEST1(type,ORC1) \
+ TEST1(type,ORC2) \
+ TEST1(type,XOR)
+
+typedef vector bool char vboolchar_t;
+typedef vector unsigned int vuint_t;
+
+TEST(uint8_t);
+TEST(int8_t);
+TEST(uint16_t);
+TEST(int16_t);
+TEST(uint32_t);
+TEST(int32_t);
+TEST(uint64_t);
+TEST(int64_t);
+TEST(vboolchar_t);
+TEST(vuint_t);
+
+/* Recreate with:
+ grep ' \*fuse_' fusion-p10-2logical.s|sed -e 's,^.*\*,,' -e 's,/[0-9],/,' |sort -k 7,7 |uniq -c|awk '{l=30-length($2); printf("/%s* { %s { scan-assembler-times {\\m%s\\M}%-*s %4d { target lp64 } } } *%s/\n","","dg-final",$2,l,"",$1,"");}'
+ */
+
+/* { dg-final { scan-assembler-times {\mfuse_and_and\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_and\M/} 96 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_or\M/} 64 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_orc\M/} 64 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_xor\M/} 64 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_eqv\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_or\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_orc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_xor\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_eqv_and\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_eqv_andc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_eqv_or\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_and\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_andc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_or\M/} 96 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_orc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_and\M/} 96 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_andc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_or\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_orc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_and\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_andc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_and\M/} 64 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_andc\M/} 64 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_or\M/} 96 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_xor\M/} 64 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_eqv\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_or\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_xor\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vand\M/} 24 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vor\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vorc\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vxor\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vand\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_veqv\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vorc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vxor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_veqv_vand\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_veqv_vandc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_veqv_vor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vand\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vandc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vor\M/} 24 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vorc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vand\M/} 24 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vandc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vorc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vand\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vandc\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vor\M/} 24 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vxor\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vand\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vandc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_veqv\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vxor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vand\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vandc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_veqv\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vnand\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vorc\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vxor\M/} 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_and\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_andc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_eqv\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_nand\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_or\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_orc\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_xor\M/} 32 { target lp64 } } } */
+
+/* { dg-final { scan-assembler-times {\mfuse_and_and\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_and\M/} 120 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_or\M/} 80 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_orc\M/} 80 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_andc_xor\M/} 80 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_eqv\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_or\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_orc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_xor\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_eqv_and\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_eqv_andc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_eqv_or\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_and\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_andc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_or\M/} 120 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_orc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_and\M/} 120 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_andc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_or\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_orc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_and\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_andc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_and\M/} 80 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_andc\M/} 80 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_or\M/} 120 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_orc_xor\M/} 80 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_eqv\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_or\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_xor\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vand\M/} 24 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vor\M/} 16 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vorc\M/} 16 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vandc_vxor\M/} 16 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vand\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_veqv\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vorc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vand_vxor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_veqv_vand\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_veqv_vandc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_veqv_vor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vand\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vandc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vor\M/} 24 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnand_vorc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vand\M/} 24 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vandc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vnor_vorc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vand\M/} 16 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vandc\M/} 16 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vor\M/} 24 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vorc_vxor\M/} 16 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vand\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vandc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_veqv\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vor_vxor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vand\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vandc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_veqv\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vnand\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vorc\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vxor_vxor\M/} 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_and\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_andc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_eqv\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_nand\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_or\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_orc\M/} 40 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_xor_xor\M/} 40 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c
new file mode 100644
index 0000000..68886b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
+
+long addadd0(long a, long b, long c)
+{
+ return a+b+c;
+}
+long addadd1(long a, long b, long c, long *t)
+{
+ long r=a+b+c;
+ *t = b;
+ return r;
+}
+long addadd2(long s, long a, long b, long c)
+{
+ return b+c+a;
+}
+
+typedef vector long vlong;
+vlong vaddadd(vlong a, vlong b, vlong c)
+{
+ return a+b+c;
+}
+vlong vaddadd1(vlong a, vlong b, vlong c, vlong *t)
+{
+ vlong r=a+b+c;
+ *t = b;
+ return r;
+}
+vlong vaddadd2(vlong s, vlong a, vlong b, vlong c)
+{
+ return a+b+c;
+}
+
+/* { dg-final { scan-assembler-times {\mfuse_add_add\M/} 3 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vaddudm_vaddudm\M/} 3 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_add_add\M/} 3 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_vaddudm_vaddudm\M/} 0 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
new file mode 100644
index 0000000..526a026
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
@@ -0,0 +1,78 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
+
+#include <stdint.h>
+
+#define TEST(type) \
+ struct t ## type { type x[128],a,b,c; }; \
+ struct s ## type { struct t ## type *p; int d,e,f; uint64_t g,h,i; }; \
+int \
+t ## type (struct s ## type *p) \
+{ \
+ struct t ## type *tp = p->p; \
+ if(!tp || tp->a > ((type)0)) { return p->d; } \
+ if(!tp || tp->b > ((type)1)) { return p->e; } \
+ if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return p->f; } \
+ return 0; \
+} \
+type \
+t ## type ## _ret (struct s ## type *p) \
+{ \
+ struct t ## type *tp = p->p; \
+ if(!tp || tp->a > ((type)0)) { return tp->a; } \
+ if(!tp || tp->b > ((type)1)) { return tp->b; } \
+ if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return tp->c; } \
+ return 0; \
+}\
+int \
+t ## type ## _x (struct s ## type *p) \
+{ \
+ struct t ## type *tp = p->p; \
+ if(!tp || tp->x[p->g] > ((type)0)) { return p->d; } \
+ if(!tp || tp->x[p->h] > ((type)1)) { return p->e; } \
+ if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return p->f; } \
+ return 0; \
+} \
+type \
+t ## type ## _x_ret (struct s ## type *p) \
+{ \
+ struct t ## type *tp = p->p; \
+ if(!tp || tp->x[p->g] > ((type)0)) { return tp->x[p->g]; } \
+ if(!tp || tp->x[p->h] > ((type)1)) { return tp->x[p->h]; } \
+ if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return tp->x[p->i]; } \
+ return 0; \
+}
+
+TEST(uint64_t)
+TEST(int64_t)
+TEST(uint32_t)
+TEST(int32_t)
+TEST(uint16_t)
+TEST(int16_t)
+TEST(uint8_t)
+TEST(int8_t)
+
+/* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none" 1 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none" 1 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign" 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign" 0 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_clobber_CC_none" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero" 0 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none" 2 { target lp64 } } } */
+
+/* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero" 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none" 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none" 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none" 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none" 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign" 8 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero" 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign" 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_clobber_CC_none" 9 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero" 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none" 6 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c
new file mode 100644
index 0000000..b2fefe9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c
@@ -0,0 +1,93 @@
+/* { dg-do compile } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
+
+#include <altivec.h>
+#include <stdint.h>
+
+#define ADD(a,b) ((a)+(b))
+#define SUB1(a,b) ((a)-(b))
+#define SUB2(a,b) ((b)-(a))
+
+/* and/andc/eqv/nand/nor/or/orc/xor */
+#define AND(a,b) ((a)&(b))
+#define NAND(a,b) (~((a)&(b)))
+#define NOR(a,b) (~((a)|(b)))
+#define OR(a,b) ((a)|(b))
+#define TEST1(type, func) \
+ type func ## _add_T_ ## type (type a, type b, type c) { return ADD(func(a,b),c); } \
+ type func ## _sub1_T_ ## type (type a, type b, type c) { return SUB1(func(a,b),c); } \
+ type func ## _sub2_T_ ## type (type a, type b, type c) { return SUB2(func(a,b),c); } \
+ type func ## _rev_add_T_ ## type (type a, type b, type c) { return ADD(c,func(a,b)); } \
+ type func ## _rev_sub1_T_ ## type (type a, type b, type c) { return SUB1(c,func(a,b)); } \
+ type func ## _rev_sub2_T_ ## type (type a, type b, type c) { return SUB2(c,func(a,b)); }
+#define TEST2(type, func) \
+ type func ## _and_T_ ## type (type a, type b, type c) { return AND(func(a,b),c); } \
+ type func ## _nand_T_ ## type (type a, type b, type c) { return NAND(func(a,b),c); } \
+ type func ## _or_T_ ## type (type a, type b, type c) { return OR(func(a,b),c); } \
+ type func ## _nor_T_ ## type (type a, type b, type c) { return NOR(func(a,b),c); } \
+ type func ## _rev_and_T_ ## type (type a, type b, type c) { return AND(c,func(a,b)); } \
+ type func ## _rev_nand_T_ ## type (type a, type b, type c) { return NAND(c,func(a,b)); } \
+ type func ## _rev_or_T_ ## type (type a, type b, type c) { return OR(c,func(a,b)); } \
+ type func ## _rev_nor_T_ ## type (type a, type b, type c) { return NOR(c,func(a,b)); }
+#define TEST(type) \
+ TEST1(type,AND) \
+ TEST1(type,NAND) \
+ TEST1(type,NOR) \
+ TEST1(type,OR) \
+ TEST2(type,ADD) \
+ TEST2(type,SUB1) \
+ TEST2(type,SUB2)
+
+typedef vector bool char vboolchar_t;
+typedef vector unsigned int vuint_t;
+
+TEST(uint8_t);
+TEST(int8_t);
+TEST(uint16_t);
+TEST(int16_t);
+TEST(uint32_t);
+TEST(int32_t);
+TEST(uint64_t);
+TEST(int64_t);
+
+/* { dg-final { scan-assembler-times {\mfuse_add_and\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_add_nand\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_add_nor\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_add_or\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_add\M/} 28 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_rsubf\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_subf\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_add\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_rsubf\M/} 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_subf\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_add\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_rsubf\M/} 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_subf\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_add\M/} 28 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_rsubf\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_subf\M/} 16 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_and\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_nand\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_nor\M/} 32 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_or\M/} 32 { target lp64 } } } */
+
+/* { dg-final { scan-assembler-times {\mfuse_add_and\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_add_nand\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_add_nor\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_add_or\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_add\M/} 22 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_rsubf\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_and_subf\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_add\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_rsubf\M/} 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nand_subf\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_add\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_rsubf\M/} 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_nor_subf\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_add\M/} 22 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_rsubf\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_or_subf\M/} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_and\M/} 24 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_nand\M/} 24 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_nor\M/} 24 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mfuse_subf_or\M/} 24 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-stst.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-stst.c
new file mode 100644
index 0000000..528a7e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-stst.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
+
+/* Verify store fusion is enabled */
+
+void fuse_stw (int *i, int a, int b, int c)
+{
+ i[1] = a;
+ i[5] = b;
+ i[2] = c;
+}
+
+void fuse_std (long *i, long a, long b, long c)
+{
+ i[1] = a;
+ i[5] = b;
+ i[2] = c;
+}
+
+void fuse_stfd (double *i, double a, double b, double c)
+{
+ i[1] = a;
+ i[5] = b;
+ i[2] = c;
+}
+
+/* { dg-final { scan-assembler-times {stw 4,4\(3\)\n\tstw 6,8\(3\)} 1 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {stw 4,4\(3\)\n\tstw 6,8\(3\)} 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {std 4,8\(3\)\n\tstd 6,16\(3\)} 1 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {stfd 1,8\(3\)\n\tstfd 3,16\(3\)} 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-stst2.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-stst2.c
new file mode 100644
index 0000000..62f1a92
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-stst2.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mdejagnu-cpu=power10 -mno-power10-fusion -O2" } */
+
+/* Verify store fusion is disabled */
+
+void fuse_stw (int *i, int a, int b, int c)
+{
+ i[1] = a;
+ i[5] = b;
+ i[2] = c;
+}
+
+void fuse_std (long *i, long a, long b, long c)
+{
+ i[1] = a;
+ i[5] = b;
+ i[2] = c;
+}
+
+void fuse_stfd (double *i, double a, double b, double c)
+{
+ i[1] = a;
+ i[5] = b;
+ i[2] = c;
+}
+
+
+/* { dg-final { scan-assembler-not {stw 4,4\(3\)\n\tstw 6,8\(3\)} } } */
+/* { dg-final { scan-assembler-not {std 4,8\(3\)\n\tstd 6,16\(3\)} { target lp64 } } } */
+/* { dg-final { scan-assembler-not {stfd 1,8\(3\)\n\tstfd 3,16\(3\)} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c b/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c
new file mode 100644
index 0000000..1255ee9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c
@@ -0,0 +1,2370 @@
+/* { dg-do run } */
+/* { dg-options "-mcpu=power10 -save-temps" } */
+/* { dg-require-effective-target power10_hw } */
+
+/* Check that the expected 128-bit instructions are generated if the processor
+ supports the 128-bit integer instructions. */
+/* { dg-final { scan-assembler-times {\mvextsd2q\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mvslq\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvsrq\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvsraq\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvrlq\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvrlqnm\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvrlqmi\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvcmpequq\M} 16 } } */
+/* { dg-final { scan-assembler-times {\mvcmpgtsq\M} 16 } } */
+/* { dg-final { scan-assembler-times {\mvcmpgtuq\M} 16 } } */
+/* { dg-final { scan-assembler-times {\mvmuloud\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmulesd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmulosd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmulld\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdivsq\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdivuq\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdivesq\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvdiveuq\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmodsq\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmoduq\M} 1 } } */
+
+#include <altivec.h>
+
+#define DEBUG 0
+
+#if DEBUG
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+void print_i128(__int128_t val)
+{
+ printf(" %lld %llu (0x%llx %llx)",
+ (signed long long)(val >> 64),
+ (unsigned long long)(val & 0xFFFFFFFFFFFFFFFF),
+ (unsigned long long)(val >> 64),
+ (unsigned long long)(val & 0xFFFFFFFFFFFFFFFF));
+}
+#endif
+
+void abort (void);
+
+__attribute__((noinline))
+__int128_t shift_right (__int128_t a, __uint128_t b)
+{
+ return a >> b;
+}
+
+__attribute__((noinline))
+__int128_t shift_left (__int128_t a, __uint128_t b)
+{
+ return a << b;
+}
+
+int main ()
+{
+ int i, result_int;
+
+ __int128_t arg1, result;
+ __uint128_t uarg2;
+
+ _Decimal128 arg1_dfp128, result_dfp128, expected_result_dfp128;
+
+ struct conv_t {
+ __uint128_t u128;
+ _Decimal128 d128;
+ } conv, conv2;
+
+ vector signed long long int vec_arg1_di, vec_arg2_di;
+ vector signed long long int vec_result_di, vec_expected_result_di;
+ vector unsigned long long int vec_uarg1_di, vec_uarg2_di, vec_uarg3_di;
+ vector unsigned long long int vec_uresult_di;
+ vector unsigned long long int vec_uexpected_result_di;
+
+ __int128_t expected_result;
+ __uint128_t uexpected_result;
+
+ vector __int128 vec_arg1, vec_arg2, vec_result;
+ vector unsigned __int128 vec_uarg1, vec_uarg2, vec_uarg3, vec_uresult;
+ vector bool __int128 vec_result_bool;
+
+ /* sign extend double to 128-bit integer */
+ vec_arg1_di[0] = 1000;
+ vec_arg1_di[1] = -123456;
+
+ expected_result = 1000;
+
+ vec_result = vec_signextq (vec_arg1_di);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_signextq ((long long) %lld) = ", vec_arg1_di[0]);
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1_di[0] = -123456;
+ vec_arg1_di[1] = 1000;
+
+ expected_result = -123456;
+
+ vec_result = vec_signextq (vec_arg1_di);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_signextq ((long long) %lld) = ", vec_arg1_di[0]);
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* test shift 128-bit integers.
+ Note, shift amount is given by the lower 7-bits of the shift amount. */
+ vec_arg1[0] = 3;
+ vec_uarg2[0] = 2;
+ expected_result = vec_arg1[0]*4;
+
+ vec_result = vec_sl (vec_arg1, vec_uarg2);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_sl(int128, uint128): ");
+ print_i128(vec_arg1[0]);
+ printf(" << %lld", vec_uarg2[0] & 0xFF);
+ printf(" = ");
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ arg1 = vec_result[0];
+ uarg2 = 4;
+ expected_result = arg1*16;
+
+ result = arg1 << uarg2;
+
+ if (result != expected_result) {
+#if DEBUG
+ printf("ERROR: int128 << uint128): ");
+ print_i128(arg1);
+ printf(" << %lld", uarg2 & 0xFF);
+ printf(" = ");
+ print_i128(result);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 3;
+ vec_uarg2[0] = 2;
+ uexpected_result = vec_uarg1[0]*4;
+
+ vec_uresult = vec_sl (vec_uarg1, vec_uarg2);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_sl(uint128, uint128): ");
+ print_i128(vec_uarg1[0]);
+ printf(" << %lld", vec_uarg2[0] & 0xFF);
+ printf(" = ");
+ print_i128(vec_uresult[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 12;
+ vec_uarg2[0] = 2;
+ expected_result = vec_arg1[0]/4;
+
+ vec_result = vec_sr (vec_arg1, vec_uarg2);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_sr(int128, uint128): ");
+ print_i128(vec_arg1[0]);
+ printf(" >> %lld", vec_uarg2[0] & 0xFF);
+ printf(" = ");
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 48;
+ vec_uarg2[0] = 2;
+ uexpected_result = vec_uarg1[0]/4;
+
+ vec_uresult = vec_sr (vec_uarg1, vec_uarg2);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_sr(uint128, uint128): ");
+ print_i128(vec_uarg1[0]);
+ printf(" >> %lld", vec_uarg2[0] & 0xFF);
+ printf(" = ");
+ print_i128(vec_uresult[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ arg1 = vec_uresult[0];
+ uarg2 = 4;
+ expected_result = arg1/16;
+
+ result = arg1 >> uarg2;
+
+ if (result != expected_result) {
+#if DEBUG
+ printf("ERROR: int128 >> uint128: ");
+ print_i128(arg1);
+ printf(" >> %lld", uarg2 & 0xFF);
+ printf(" = ");
+ print_i128(result);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 0x1234567890ABCDEFULL;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 0xAABBCCDDEEFF1122ULL;
+ vec_uarg2[0] = 32;
+ expected_result = 0x0000000012345678ULL;
+ expected_result = (expected_result << 64) | 0x90ABCDEFAABBCCDDULL;
+
+ vec_result = vec_sra (vec_arg1, vec_uarg2);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_sra(int128, uint128): ");
+ print_i128(vec_arg1[0]);
+ printf(" >> %lld = \n", vec_uarg2[0]);
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 0xAABBCCDDEEFF1122ULL;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 0x1234567890ABCDEFULL;
+ vec_uarg2[0] = 48;
+ uexpected_result = 0xFFFFFFFFFFFFAABBLL;
+ uexpected_result = (uexpected_result << 64) | 0xCCDDEEFF11221234ULL;
+
+ vec_uresult = vec_sra (vec_uarg1, vec_uarg2);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_sra(uint128, uint128): ");
+ print_i128(vec_uarg1[0]);
+ printf(" >> %lld = \n", vec_uarg2[0] & 0xFF);
+ print_i128(vec_uresult[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 0x1234567890ABCDEFULL;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 0xAABBCCDDEEFF1122ULL;
+ vec_uarg2[0] = 32;
+ expected_result = 0x90ABCDEFAABBCCDDULL;
+ expected_result = (expected_result << 64) | 0xEEFF112212345678ULL;
+
+ vec_result = vec_rl (vec_arg1, vec_uarg2);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_rl(int128, uint128): ");
+ print_i128(vec_arg1[0]);
+ printf(" >> %lld = \n", vec_uarg2[0]);
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 0xAABBCCDDEEFF1122ULL;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 0x1234567890ABCDEFULL;
+ vec_uarg2[0] = 48;
+ uexpected_result = 0x11221234567890ABULL;
+ uexpected_result = (uexpected_result << 64) | 0xCDEFAABBCCDDEEFFULL;
+
+ vec_uresult = vec_rl (vec_uarg1, vec_uarg2);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_rl(uint128, uint128): ");
+ print_i128(vec_uarg1[0]);
+ printf(" >> %lld = \n", vec_uarg2[0]);
+ print_i128(vec_uresult[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* vec_rlnm(arg1, arg2, arg3)
+ result - rotate each element of arg1 left by shift in element of arg2.
+ Then AND with mask whose start/stop bits are specified in element of
+ arg3. */
+ vec_arg1[0] = 0x1234567890ABCDEFULL;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 0xAABBCCDDEEFF1122ULL;
+ vec_uarg2[0] = 32;
+ vec_uarg3[0] = (32 << 8) | 95;
+ expected_result = 0xaabbccddULL;
+ expected_result = (expected_result << 64) | 0xeeff112200000000ULL;
+
+ vec_result = vec_rlnm (vec_arg1, vec_uarg2, vec_uarg3);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_rlnm(int128, uint128, uint128): ");
+ print_i128(vec_arg1[0]);
+ printf(" << %lld = \n", vec_uarg3[0] & 0xFF);
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+
+
+ /* vec_rlnm(arg1, arg2, arg3)
+ result - rotate each element of arg1 left by shift in element of arg2;
+ then AND with mask whose start/stop bits are specified in element of
+ arg3. */
+ vec_uarg1[0] = 0xAABBCCDDEEFF1122ULL;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 0x1234567890ABCDEFULL;
+ vec_uarg2[0] = 48;
+ vec_uarg3[0] = (8 << 8) | 119;
+
+ uexpected_result = 0x00221234567890ABULL;
+ uexpected_result = (uexpected_result << 64) | 0xCDEFAABBCCDDEE00ULL;
+
+ vec_uresult = vec_rlnm (vec_uarg1, vec_uarg2, vec_uarg3);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_rlnm(uint128, uint128, uint128): ");
+ print_i128(vec_uarg1[0]);
+ printf(" << %lld = \n", vec_uarg3[0] & 0xFF);
+ print_i128(vec_uresult[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* vec_rlmi(R, A, B)
+ Result value: Each element of R is obtained by rotating the corresponding
+ element of A left by the number of bits specified by the corresponding element
+ of B. */
+
+ vec_arg1[0] = 0x1234567890ABCDEFULL;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 0xAABBCCDDEEFF1122ULL;
+ vec_arg2[0] = 0x000000000000DEADULL;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 0x0000BEEF00000000ULL;
+ vec_uarg3[0] = 96 << 16 | 127 << 8 | 32;
+ expected_result = 0x000000000000DEADULL;
+ expected_result = (expected_result << 64) | 0x0000BEEF12345678ULL;
+
+ vec_result = vec_rlmi (vec_arg1, vec_arg2, vec_uarg3);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_rlmi(int128, int128, uint128): ");
+ print_i128(vec_arg1[0]);
+ printf(" << %lld = \n", vec_uarg2_di[1] & 0xFF);
+ print_i128(vec_result[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* vec_rlmi(R, A, B)
+ Result value: Each element of R is obtained by rotating the corresponding
+ element of A left by the number of bits specified by the corresponding element
+ of B. */
+
+ vec_uarg1[0] = 0xAABBCCDDEEFF1122ULL;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 0x1234567890ABCDEFULL;
+ vec_uarg2[0] = 0xDEAD000000000000ULL;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 0x000000000000BEEFULL;
+ vec_uarg3[0] = 16 << 16 | 111 << 8 | 48;
+ uexpected_result = 0xDEAD1234567890ABULL;
+ uexpected_result = (uexpected_result << 64) | 0xCDEFAABBCCDDBEEFULL;
+
+ vec_uresult = vec_rlmi (vec_uarg1, vec_uarg2, vec_uarg3);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_rlmi(uint128, unit128, uint128): ");
+ print_i128(vec_uarg1[0]);
+ printf(" << %lld = \n", vec_uarg3[1] & 0xFF);
+ print_i128(vec_uresult[0]);
+ printf("\n does not match expected_result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* 128-bit compare tests, result is all 1's if true */
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1[0] = 2468;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ uexpected_result = 0xFFFFFFFFFFFFFFFFULL;
+ uexpected_result = (uexpected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpgt (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: unsigned vec_cmpgt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 12468;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpgt (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed vec_cmpgt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+
+ vec_arg1[0] = 12468;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = -1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0x0ULL;
+
+ vec_result_bool = vec_cmpeq (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR:not equal signed vec_cmpeq ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpeq (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed equal vec_cmpeq ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 12468;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0x0ULL;
+
+ vec_result_bool = vec_cmpeq (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned not equal vec_cmpeq ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpeq (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: equal unsigned vec_cmpeq ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 12468;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpne (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned not equal vec_cmpne ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+ expected_result = 0x0ULL;
+
+ vec_result_bool = vec_cmpne (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: equal unsigned vec_cmpne ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 12468;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = -1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpne (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR:not equal signed vec_cmpne ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+ expected_result = 0x0ULL;
+
+ vec_result_bool = vec_cmpne (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed equal vec_cmpne ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 12468;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0x0;
+
+ vec_result_bool = vec_cmplt (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 > arg2 vec_cmplt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 1234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 12468;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmplt (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 < arg2 vec_cmplt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+ expected_result = 0x0ULL;
+
+ vec_result_bool = vec_cmplt (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 = arg2 vec_cmplt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 12468;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = -1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0x0;
+
+ vec_result_bool = vec_cmplt (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 > arg2 vec_cmplt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -1234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 12468;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmplt (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 < arg2 vec_cmplt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+ expected_result = 0x0ULL;
+
+ vec_result_bool = vec_cmplt (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_cmplt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 12468;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0x0;
+
+ vec_result_bool = vec_cmple (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 > arg2 vec_cmple ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 1234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 12468;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmple (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 < arg2 vec_cmple ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmple (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 = arg2 vec_cmple ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 12468;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = -1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0x0;
+
+ vec_result_bool = vec_cmple (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 > arg2 vec_cmple ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -1234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 12468;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmple (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 < arg2 vec_cmple ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmple (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_cmple ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 12468;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpge (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 > arg2 vec_cmpge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 1234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 12468;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ expected_result = 0x0;
+
+ vec_result_bool = vec_cmpge (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 < arg2 vec_cmpge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpge (vec_uarg1, vec_uarg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: unsigned arg1 = arg2 vec_cmpge ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = 12468;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = -1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpge (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 > arg2 vec_cmpge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -1234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 12468;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ expected_result = 0x0;
+
+ vec_result_bool = vec_cmpge (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 < arg2 vec_cmpge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+ expected_result = 0xFFFFFFFFFFFFFFFFULL;
+ expected_result = (expected_result << 64) | 0xFFFFFFFFFFFFFFFFULL;
+
+ vec_result_bool = vec_cmpge (vec_arg1, vec_arg2);
+
+ if (vec_result_bool[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_cmpge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.");
+ print_i128(vec_result_bool[0]);
+ printf("\n Result does not match expected_result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+#if 1
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_all_eq (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_all_eq ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_all_eq (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_all_eq ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_all_eq (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_all_eq ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_all_eq (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_all_eq ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_all_ne (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_all_ne ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_all_ne (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_all_ne ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_all_ne (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_all_ne ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_all_ne (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_all_ne ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_all_lt (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_all_lt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_all_lt (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_all_lt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_all_lt (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_all_lt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_all_lt (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_all_lt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_all_le (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_all_le ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_all_le (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_all_le ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_all_le (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_all_le ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_all_le (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_all_le ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_all_gt (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_all_gt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_all_gt (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_all_gt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_all_gt (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_all_gt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_all_gt (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_all_gt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_all_ge (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_all_ge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_all_ge (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_all_ge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_all_ge (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_all_ge ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_all_ge (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_all_ge ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_any_eq (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_any_eq ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_any_eq (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_any_eq ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_any_eq (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_any_eq ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_any_eq (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_any_eq ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_any_ne (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_any_ne ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_any_ne (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_any_ne ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_any_ne (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_any_ne ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_any_ne (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_any_ne ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_any_lt (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_any_lt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_any_lt (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_any_lt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_any_lt (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_any_lt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_any_lt (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_any_lt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_any_gt (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_any_gt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_any_gt (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_any_gt ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_any_gt (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_any_gt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_any_gt (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_any_gt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_any_le (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_any_le ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_any_le (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_any_le ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_any_le (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_any_le ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_any_le (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_any_le ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+ vec_arg1 = vec_arg2;
+
+ result_int = vec_any_ge (vec_arg1, vec_arg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 = arg2 vec_any_ge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1[0] = -234;
+ vec_arg1[0] = (vec_arg1[0] << 64) | 4567;
+ vec_arg2[0] = 1234;
+ vec_arg2[0] = (vec_arg2[0] << 64) | 4567;
+
+ result_int = vec_any_ge (vec_arg1, vec_arg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: signed arg1 != arg2 vec_any_ge ( ");
+ print_i128(vec_arg1[0]);
+ printf(", ");
+ print_i128(vec_arg2[0]);
+ printf(") failed.\n\n");
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+ vec_uarg1 = vec_uarg2;
+
+ result_int = vec_any_ge (vec_uarg1, vec_uarg2);
+
+ if (!result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 = uarg2 vec_any_ge ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 234;
+ vec_uarg1[0] = (vec_uarg1[0] << 64) | 4567;
+ vec_uarg2[0] = 1234;
+ vec_uarg2[0] = (vec_uarg2[0] << 64) | 4567;
+
+ result_int = vec_any_ge (vec_uarg1, vec_uarg2);
+
+ if (result_int) {
+#if DEBUG
+ printf("ERROR: unsigned uarg1 != uarg2 vec_any_gt ( ");
+ print_i128(vec_uarg1[0]);
+ printf(", ");
+ print_i128(vec_uarg2[0]);
+ printf(") failed.\n\n");
+#else
+ abort();
+#endif
+ }
+#endif
+
+ /* Vector multiply Even and Odd tests */
+ vec_arg1_di[0] = 200;
+ vec_arg1_di[1] = 400;
+ vec_arg2_di[0] = 1234;
+ vec_arg2_di[1] = 4567;
+ expected_result = vec_arg1_di[0] * vec_arg2_di[0];
+
+ vec_result = vec_mule (vec_arg1_di, vec_arg2_di);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_mule (signed, signed) failed.\n");
+ printf(" vec_arg1_di[0] = %lld\n", vec_arg1_di[0]);
+ printf(" vec_arg2_di[0] = %lld\n", vec_arg2_di[0]);
+ printf("Result = ");
+ print_i128(vec_result[0]);
+ printf("\nExpected Result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_arg1_di[0] = -200;
+ vec_arg1_di[1] = -400;
+ vec_arg2_di[0] = 1234;
+ vec_arg2_di[1] = 4567;
+ expected_result = vec_arg1_di[1] * vec_arg2_di[1];
+
+ vec_result = vec_mulo (vec_arg1_di, vec_arg2_di);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_mulo (signed, signed) failed.\n");
+ printf(" vec_arg1_di[1] = %lld\n", vec_arg1_di[1]);
+ printf(" vec_arg2_di[1] = %lld\n", vec_arg2_di[1]);
+ printf("Result = ");
+ print_i128(vec_result[0]);
+ printf("\nExpected Result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1_di[0] = 200;
+ vec_uarg1_di[1] = 400;
+ vec_uarg2_di[0] = 1234;
+ vec_uarg2_di[1] = 4567;
+ uexpected_result = vec_uarg1_di[0] * vec_uarg2_di[0];
+
+ vec_uresult = vec_mule (vec_uarg1_di, vec_uarg2_di);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_mule (unsigned, unsigned) failed.\n");
+ printf(" vec_uarg1_di[1] = %lld\n", vec_uarg1_di[1]);
+ printf(" vec_uarg2_di[1] = %lld\n", vec_uarg2_di[1]);
+ printf("Result = ");
+ print_i128(vec_uresult[0]);
+ printf("\nExpected Result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1_di[0] = 200;
+ vec_uarg1_di[1] = 400;
+ vec_uarg2_di[0] = 1234;
+ vec_uarg2_di[1] = 4567;
+ uexpected_result = vec_uarg1_di[1] * vec_uarg2_di[1];
+
+ vec_uresult = vec_mulo (vec_uarg1_di, vec_uarg2_di);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_mulo (unsigned, unsigned) failed.\n");
+ printf(" vec_uarg1_di[0] = %lld\n", vec_uarg1_di[0]);
+ printf(" vec_uarg2_di[0] = %lld\n", vec_uarg2_di[0]);
+ printf("Result = ");
+ print_i128(vec_uresult[0]);
+ printf("\nExpected Result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* Vector Multiply Longword */
+ vec_arg1_di[0] = 100;
+ vec_arg1_di[1] = -123456;
+
+ vec_arg2_di[0] = 123;
+ vec_arg2_di[1] = 1000;
+
+ vec_expected_result_di[0] = 12300;
+ vec_expected_result_di[1] = -123456000;
+
+ vec_result_di = vec_arg1_di * vec_arg2_di;
+
+ for (i = 0; i<2; i++) {
+ if (vec_result_di[i] != vec_expected_result_di[i]) {
+#if DEBUG
+ printf("ERROR: vector multipy [%d] ((long long) %lld) = ", i,
+ vec_result_di[i]);
+ printf("\n does not match expected_result [%d] = ((long long) %lld)", i,
+ vec_expected_result_di[i]);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+ }
+
+ /* Vector Divide Quadword */
+ vec_arg1[0] = -12345678;
+ vec_arg2[0] = 2;
+ expected_result = -6172839;
+
+ vec_result = vec_div (vec_arg1, vec_arg2);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_div (signed, signed) failed.\n");
+ printf("vec_arg1[0] = ");
+ print_i128(vec_arg1[0]);
+ printf("\nvec_arg2[0] = ");
+ print_i128(vec_arg2[0]);
+ printf("\nResult = ");
+ print_i128(vec_result[0]);
+ printf("\nExpected result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 24680;
+ vec_uarg2[0] = 4;
+ uexpected_result = 6170;
+
+ vec_uresult = vec_div (vec_uarg1, vec_uarg2);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_div (unsigned, unsigned) failed.\n");
+ printf("vec_uarg1[0] = ");
+ print_i128(vec_uarg1[0]);
+ printf("\nvec_uarg2[0] = ");
+ print_i128(vec_uarg2[0]);
+ printf("\nResult = ");
+ print_i128(vec_uresult[0]);
+ printf("\nExpected result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* Vector Divide Extended Quadword */
+ vec_arg1[0] = -20; // has 128-bit of zero concatenated onto it
+ vec_arg2[0] = 0x2000000000000000;
+ vec_arg2[0] = vec_arg2[0] << 64;
+ expected_result = -160;
+
+ vec_result = vec_dive (vec_arg1, vec_arg2);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_dive (signed, signed) failed.\n");
+ printf("vec_arg1[0] = ");
+ print_i128(vec_arg1[0]);
+ printf("\nvec_arg2[0] = ");
+ print_i128(vec_arg2[0]);
+ printf("\nResult = ");
+ print_i128(vec_result[0]);
+ printf("\nExpected result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 20; // has 128-bit of zero concatenated onto it
+ vec_uarg2[0] = 0x4000000000000000;
+ vec_uarg2[0] = vec_uarg2[0] << 64;
+ uexpected_result = 80;
+
+ vec_uresult = vec_dive (vec_uarg1, vec_uarg2);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_dive (unsigned, unsigned) failed.\n");
+ printf("vec_uarg1[0] = ");
+ print_i128(vec_uarg1[0]);
+ printf("\nvec_uarg2[0] = ");
+ print_i128(vec_uarg2[0]);
+ printf("\nResult = ");
+ print_i128(vec_uresult[0]);
+ printf("\nExpected result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* Vector modulo quad word */
+ vec_arg1[0] = -12345675;
+ vec_arg2[0] = 2;
+ expected_result = -1;
+
+ vec_result = vec_mod (vec_arg1, vec_arg2);
+
+ if (vec_result[0] != expected_result) {
+#if DEBUG
+ printf("ERROR: vec_mod (signed, signed) failed.\n");
+ printf("vec_arg1[0] = ");
+ print_i128(vec_arg1[0]);
+ printf("\nvec_arg2[0] = ");
+ print_i128(vec_arg2[0]);
+ printf("\nResult = ");
+ print_i128(vec_result[0]);
+ printf("\nExpected result = ");
+ print_i128(expected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ vec_uarg1[0] = 24685;
+ vec_uarg2[0] = 4;
+ uexpected_result = 1;
+
+ vec_uresult = vec_mod (vec_uarg1, vec_uarg2);
+
+ if (vec_uresult[0] != uexpected_result) {
+#if DEBUG
+ printf("ERROR: vec_mod (unsigned, unsigned) failed.\n");
+ printf("vec_uarg1[0] = ");
+ print_i128(vec_uarg1[0]);
+ printf("\nvec_uarg2[0] = ");
+ print_i128(vec_uarg2[0]);
+ printf("\nResult = ");
+ print_i128(vec_uresult[0]);
+ printf("\nExpected result = ");
+ print_i128(uexpected_result);
+ printf("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ /* DFP to __int128 and __int128 to DFP conversions */
+ /* Print the DFP value as an unsigned int so we can see the bit patterns. */
+ conv.u128 = 0x2208000000000000ULL;
+ conv.u128 = (conv.u128 << 64) | 0x4ULL; //DFP bit pattern for integer 4
+ expected_result_dfp128 = conv.d128;
+
+ arg1 = 4;
+
+ conv.d128 = (_Decimal128) arg1;
+
+ result_dfp128 = (_Decimal128) arg1;
+ if (((conv.u128 >>64) != 0x2208000000000000ULL) &&
+ ((conv.u128 & 0xFFFFFFFFFFFFFFFF) != 0x4ULL)) {
+#if DEBUG
+ printf("ERROR: convert int128 value ");
+ print_i128 (arg1);
+ conv.d128 = result_dfp128;
+ printf("\nto DFP value 0x%llx %llx (printed as hex bit string) ",
+ (unsigned long long)((conv.u128) >>64),
+ (unsigned long long)((conv.u128) & 0xFFFFFFFFFFFFFFFF));
+
+ conv.d128 = expected_result_dfp128;
+ printf("\ndoes not match expected_result = 0x%llx %llx\n\n",
+ (unsigned long long) (conv.u128>>64),
+ (unsigned long long) (conv.u128 & 0xFFFFFFFFFFFFFFFF));
+#else
+ abort();
+#endif
+ }
+
+ expected_result = 4;
+
+ conv.u128 = 0x2208000000000000ULL;
+ conv.u128 = (conv.u128 << 64) | 0x4ULL; // 4 as DFP
+ arg1_dfp128 = conv.d128;
+
+ result = (__int128_t) arg1_dfp128;
+
+ if (result != expected_result) {
+#if DEBUG
+ printf("ERROR: convert DFP value ");
+ printf("0x%llx %llx (printed as hex bit string) ",
+ (unsigned long long)(conv.u128>>64),
+ (unsigned long long)(conv.u128 & 0xFFFFFFFFFFFFFFFF));
+ printf("to __int128 value = ");
+ print_i128 (result);
+ printf("\ndoes not match expected_result = ");
+ print_i128 (expected_result);
+ printf("\n");
+#else
+ abort();
+#endif
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c b/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
index 93843c0..26aadbc 100644
--- a/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
+++ b/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
@@ -6,7 +6,7 @@
/* { dg-options "-O0 -Wno-deprecated" } */
/* { dg-final { scan-assembler-times "lvsl" 2 } } */
/* { dg-final { scan-assembler-times "lvsr" 2 } } */
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mp?lxv\M} 2 } } */
/* { dg-final { scan-assembler-times {\m(?:v|xx)permr?\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c
index 3bedf53..a9fb010 100644
--- a/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c
@@ -21,6 +21,14 @@ foo2 (__vector_pair *dst, vec_t *src)
}
void
+foo3 (__vector_pair *dst, vec_t *src)
+{
+ __vector_pair pair;
+ __builtin_vsx_build_pair (&pair, src[4], src[0]);
+ *dst = pair;
+}
+
+void
bar (vec_t *dst, __vector_pair *src)
{
vec_t res[2];
@@ -54,8 +62,12 @@ bar2 (vec_t *dst, __vector_pair *src)
# error "__has_builtin (__builtin_mma_disassemble_pair) failed"
#endif
-/* { dg-final { scan-assembler-times {\mlxv\M} 4 } } */
+#if !__has_builtin (__builtin_vsx_build_pair)
+# error "__has_builtin (__builtin_vsx_build_pair) failed"
+#endif
+
+/* { dg-final { scan-assembler-times {\mlxv\M} 6 } } */
/* { dg-final { scan-assembler-times {\mlxvp\M} 2 } } */
/* { dg-final { scan-assembler-times {\mstxv\M} 4 } } */
-/* { dg-final { scan-assembler-times {\mstxvp\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstxvp\M} 3 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c
index 43b6d3a..00503b7 100644
--- a/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c
@@ -13,6 +13,14 @@ foo (__vector_quad *dst, vec_t *src)
}
void
+foo2 (__vector_quad *dst, vec_t *src)
+{
+ __vector_quad acc;
+ __builtin_mma_build_acc (&acc, src[12], src[8], src[4], src[0]);
+ *dst = acc;
+}
+
+void
bar (vec_t *dst, __vector_quad *src)
{
vec_t res[4];
@@ -23,9 +31,17 @@ bar (vec_t *dst, __vector_quad *src)
dst[12] = res[3];
}
-/* { dg-final { scan-assembler-times {\mlxv\M} 4 } } */
+#if !__has_builtin (__builtin_mma_assemble_acc)
+# error "__has_builtin (__builtin_mma_assemble_acc) failed"
+#endif
+
+#if !__has_builtin (__builtin_mma_build_acc)
+# error "__has_builtin (__builtin_mma_build_acc) failed"
+#endif
+
+/* { dg-final { scan-assembler-times {\mlxv\M} 8 } } */
/* { dg-final { scan-assembler-times {\mlxvp\M} 2 } } */
/* { dg-final { scan-assembler-times {\mstxv\M} 4 } } */
-/* { dg-final { scan-assembler-times {\mstxvp\M} 2 } } */
-/* { dg-final { scan-assembler-times {\mxxmfacc\M} 2 } } */
-/* { dg-final { scan-assembler-times {\mxxmtacc\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstxvp\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mxxmfacc\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mxxmtacc\M} 3 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c
new file mode 100644
index 0000000..c661a4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
+
+void
+foo (__vector_pair *dst, __vector_pair *src, long idx)
+{
+ dst[0] = __builtin_vsx_lxvp (0, src);
+ dst[2] = __builtin_vsx_lxvp (32, src);
+ dst[4] = __builtin_vsx_lxvp (64, src);
+ /* Non-constant offset should generate a lxvpx. */
+ dst[6] = __builtin_vsx_lxvp (idx, src);
+ /* Non-aligned offset should generate a plxvp. */
+ dst[8] = __builtin_vsx_lxvp (257, src);
+}
+
+#if !__has_builtin (__builtin_vsx_lxvp)
+# error "__has_builtin (__builtin_vsx_lxvp) failed"
+#endif
+
+/* { dg-final { scan-assembler-not {\mlxv\M} } } */
+/* { dg-final { scan-assembler-not {\mstxv\M} } } */
+/* { dg-final { scan-assembler-times {\mlxvp\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mlxvpx\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mplxvp\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mstxvp\M} 5 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-8.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-8.c
new file mode 100644
index 0000000..af29e47
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-8.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
+
+void
+foo (__vector_pair *dst, __vector_pair *src, long idx)
+{
+ __vector_pair pair = *src;
+ __builtin_vsx_stxvp (pair, 0, dst);
+ __builtin_vsx_stxvp (pair, 32, dst);
+ __builtin_vsx_stxvp (pair, 64, dst);
+ /* Non-constant offset should generate a stxvpx. */
+ __builtin_vsx_stxvp (pair, idx, dst);
+ /* Non-aligned offset should generate a pstxvp. */
+ __builtin_vsx_stxvp (pair, 257, dst);
+}
+
+#if !__has_builtin (__builtin_vsx_stxvp)
+# error "__has_builtin (__builtin_vsx_stxvp) failed"
+#endif
+
+/* { dg-final { scan-assembler-not {\mlxv\M} } } */
+/* { dg-final { scan-assembler-not {\mstxv\M} } } */
+/* { dg-final { scan-assembler-times {\mlxvp\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mstxvp\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mstxvpx\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mpstxvp\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-9.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-9.c
new file mode 100644
index 0000000..397d0f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-9.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
+
+typedef unsigned char vec_t __attribute__((vector_size(16)));
+
+void
+foo (__vector_pair *dst, vec_t *src)
+{
+ __vector_pair pair;
+ /* Adjacent loads should be combined into one lxvp instruction. */
+ __builtin_vsx_build_pair (&pair, src[0], src[1]);
+ *dst = pair;
+}
+
+void
+bar (__vector_quad *dst, vec_t *src)
+{
+ __vector_quad quad;
+ /* Adjacent loads should be combined into two lxvp instructions. */
+ __builtin_mma_build_acc (&quad, src[0], src[1], src[2], src[3]);
+ *dst = quad;
+}
+
+/* { dg-final { scan-assembler-not {\mlxv\M} } } */
+/* { dg-final { scan-assembler-not {\mstxv\M} } } */
+/* { dg-final { scan-assembler-times {\mlxvp\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mstxvp\M} 3 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mod-vectorize.c b/gcc/testsuite/gcc.target/powerpc/mod-vectorize.c
new file mode 100644
index 0000000..4d4f5cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mod-vectorize.c
@@ -0,0 +1,46 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test vectorizer can exploit ISA 3.1 instructions Vector Modulo
+ Signed/Unsigned Word/Doubleword for word/doubleword modulo operations. */
+
+#define N 128
+
+extern signed int si_a[N], si_b[N], si_c[N];
+extern unsigned int ui_a[N], ui_b[N], ui_c[N];
+extern signed long long sd_a[N], sd_b[N], sd_c[N];
+extern unsigned long long ud_a[N], ud_b[N], ud_c[N];
+
+__attribute__ ((noipa)) void
+test_si ()
+{
+ for (int i = 0; i < N; i++)
+ si_c[i] = si_a[i] % si_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_ui ()
+{
+ for (int i = 0; i < N; i++)
+ ui_c[i] = ui_a[i] % ui_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_sd ()
+{
+ for (int i = 0; i < N; i++)
+ sd_c[i] = sd_a[i] % sd_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_ud ()
+{
+ for (int i = 0; i < N; i++)
+ ud_c[i] = ud_a[i] % ud_b[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvmodsw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmoduw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmodsd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmodud\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mul-vectorize-1.c b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-1.c
new file mode 100644
index 0000000..ba01d5c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-1.c
@@ -0,0 +1,27 @@
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mdejagnu-cpu=power8 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test vectorizer can exploit ISA 2.07 instruction vmuluwm (Vector Multiply
+ Unsigned Word Modulo) for both signed and unsigned word multiplication. */
+
+#define N 128
+
+extern signed int si_a[N], si_b[N], si_c[N];
+extern unsigned int ui_a[N], ui_b[N], ui_c[N];
+
+__attribute__ ((noipa)) void
+test_si ()
+{
+ for (int i = 0; i < N; i++)
+ si_c[i] = si_a[i] * si_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_ui ()
+{
+ for (int i = 0; i < N; i++)
+ ui_c[i] = ui_a[i] * ui_b[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvmuluwm\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mul-vectorize-2.c b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-2.c
new file mode 100644
index 0000000..12ca97a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-2.c
@@ -0,0 +1,27 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test vectorizer can exploit ISA 3.1 instruction vmulld (Vector Multiply
+ Low Doubleword) for both signed and unsigned doubleword multiplication. */
+
+#define N 128
+
+extern signed long long sd_a[N], sd_b[N], sd_c[N];
+extern unsigned long long ud_a[N], ud_b[N], ud_c[N];
+
+__attribute__ ((noipa)) void
+test_sd ()
+{
+ for (int i = 0; i < N; i++)
+ sd_c[i] = sd_a[i] * sd_b[i];
+}
+
+__attribute__ ((noipa)) void
+test_ud ()
+{
+ for (int i = 0; i < N; i++)
+ ud_c[i] = ud_a[i] * ud_b[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvmulld\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mul-vectorize-3.c b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-3.c
new file mode 100644
index 0000000..2c89c0f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-3.c
@@ -0,0 +1,32 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test vectorizer can exploit ISA 3.1 instructions Vector Multiply
+ High Signed/Unsigned Word for both signed and unsigned int high part
+ multiplication. */
+
+#define N 128
+
+extern signed int si_a[N], si_b[N], si_c[N];
+extern unsigned int ui_a[N], ui_b[N], ui_c[N];
+
+typedef signed long long sLL;
+typedef unsigned long long uLL;
+
+__attribute__ ((noipa)) void
+test_si ()
+{
+ for (int i = 0; i < N; i++)
+ si_c[i] = ((sLL) si_a[i] * (sLL) si_b[i]) >> 32;
+}
+
+__attribute__ ((noipa)) void
+test_ui ()
+{
+ for (int i = 0; i < N; i++)
+ ui_c[i] = ((uLL) ui_a[i] * (uLL) ui_b[i]) >> 32;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvmulhsw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmulhuw\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mul-vectorize-4.c b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-4.c
new file mode 100644
index 0000000..265e758
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mul-vectorize-4.c
@@ -0,0 +1,33 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test vectorizer can exploit ISA 3.1 instructions Vector Multiply
+ High Signed/Unsigned Doubleword for both signed and unsigned long
+ long high part multiplication. */
+
+#define N 128
+
+extern signed long long sll_a[N], sll_b[N], sll_c[N];
+extern unsigned long long ull_a[N], ull_b[N], ull_c[N];
+
+typedef signed __int128 s128;
+typedef unsigned __int128 u128;
+
+__attribute__ ((noipa)) void
+test_sll ()
+{
+ for (int i = 0; i < N; i++)
+ sll_c[i] = ((s128) sll_a[i] * (s128) sll_b[i]) >> 64;
+}
+
+__attribute__ ((noipa)) void
+test_ull ()
+{
+ for (int i = 0; i < N; i++)
+ ull_c[i] = ((u128) ull_a[i] * (u128) ull_b[i]) >> 64;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvmulhsd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvmulhud\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/not-promote-mode.c b/gcc/testsuite/gcc.target/powerpc/not-promote-mode.c
new file mode 100644
index 0000000..29af1f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/not-promote-mode.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2" } */
+
+extern void bar ();
+
+void foo ()
+{
+ int i;
+ for (i = 0; i < 10000; i++)
+ bar ();
+}
+
+/* { dg-final { scan-assembler-not {\mrldicl\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.c b/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.c
new file mode 100644
index 0000000..fdbb9eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* What we scan for are only supported on 64-bit env. */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test if some Power10 built-in functions get vectorized. */
+
+#include "p10-bifs-vectorize-1.h"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 5 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvcfuged\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvclzdm\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvctzdm\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvpdepd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvpextd\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.h b/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.h
new file mode 100644
index 0000000..80b7aac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-1.h
@@ -0,0 +1,40 @@
+#define N 32
+
+typedef unsigned long long uLL;
+uLL ull_a[N], ull_b[N], ull_c[N];
+
+__attribute__ ((noipa)) void
+test_cfuged ()
+{
+ for (int i = 0; i < N; i++)
+ ull_c[i] = __builtin_cfuged (ull_a[i], ull_b[i]);
+}
+
+__attribute__ ((noipa)) void
+test_cntlzdm ()
+{
+ for (int i = 0; i < N; i++)
+ ull_c[i] = __builtin_cntlzdm (ull_a[i], ull_b[i]);
+}
+
+__attribute__ ((noipa)) void
+test_cnttzdm ()
+{
+ for (int i = 0; i < N; i++)
+ ull_c[i] = __builtin_cnttzdm (ull_a[i], ull_b[i]);
+}
+
+__attribute__ ((noipa)) void
+test_pdepd ()
+{
+ for (int i = 0; i < N; i++)
+ ull_c[i] = __builtin_pdepd (ull_a[i], ull_b[i]);
+}
+
+__attribute__ ((noipa)) void
+test_pextd ()
+{
+ for (int i = 0; i < N; i++)
+ ull_c[i] = __builtin_pextd (ull_a[i], ull_b[i]);
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-run-1.c b/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-run-1.c
new file mode 100644
index 0000000..828fbe1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/p10-bifs-vectorize-run-1.c
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* The checked bifs are only supported on 64-bit env. */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target power10_hw } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model" } */
+
+#include "p10-bifs-vectorize-1.h"
+
+/* Check if vectorized built-in functions run expectedly. */
+
+/* Make optimize (1) to avoid vectorization applied on check func. */
+
+#define CHECK(name) \
+ __attribute__ ((optimize (1))) void check_##name () \
+ { \
+ test_##name (); \
+ for (int i = 0; i < N; i++) \
+ { \
+ uLL exp = __builtin_##name (ull_a[i], ull_b[i]); \
+ if (exp != ull_c[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+CHECK (cfuged)
+CHECK (cntlzdm)
+CHECK (cnttzdm)
+CHECK (pdepd)
+CHECK (pextd)
+
+int
+main ()
+{
+ for (int i = 0; i < N; i++)
+ {
+ ull_a[i] = 0x789a * (i * 11 - 5) - 0xcd1 * (i * 5 - 7);
+ ull_b[i] = 0xfedc * (i * 7 + 3) + 0x467 * (i * 7 - 11);
+ }
+
+ check_cfuged ();
+ check_cntlzdm ();
+ check_cnttzdm ();
+ check_pdepd ();
+ check_pextd ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/p10-vdivq-vmodq.c b/gcc/testsuite/gcc.target/powerpc/p10-vdivq-vmodq.c
new file mode 100644
index 0000000..84685e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/p10-vdivq-vmodq.c
@@ -0,0 +1,27 @@
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
+
+unsigned __int128 u_div(unsigned __int128 a, unsigned __int128 b)
+{
+ return a/b;
+}
+
+unsigned __int128 u_mod(unsigned __int128 a, unsigned __int128 b)
+{
+ return a%b;
+}
+__int128 s_div(__int128 a, __int128 b)
+{
+ return a/b;
+}
+
+__int128 s_mod(__int128 a, __int128 b)
+{
+ return a%b;
+}
+
+/* { dg-final { scan-assembler {\mvdivsq\M} } } */
+/* { dg-final { scan-assembler {\mvdivuq\M} } } */
+/* { dg-final { scan-assembler {\mvmodsq\M} } } */
+/* { dg-final { scan-assembler {\mvmoduq\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-3.c b/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-3.c
new file mode 100644
index 0000000..19701c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-3.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
+
+/* Note that for unsigned cases, the differences from those ones in
+ p9-fpcvt-2.c is that they will be converted to int implicitly first
+ and then to floating point. */
+
+double sc_df (signed char *p, double df) { return *p + df; }
+double uc_df (unsigned char *p, double df) { return *p + df; }
+double ss_df (signed short *p, double df) { return *p + df; }
+double us_df (unsigned short *p, double df) { return *p + df; }
+
+float sc_sf (signed char *p, float sf) { return *p + sf; }
+float uc_sf (unsigned char *p, float sf) { return *p + sf; }
+float ss_sf (signed short *p, float sf) { return *p + sf; }
+float us_sf (unsigned short *p, float sf) { return *p + sf; }
+
+/* { dg-final { scan-assembler {\mlxsibzx\M} } } */
+/* { dg-final { scan-assembler {\mlxsihzx\M} } } */
+/* { dg-final { scan-assembler {\mvextsb2d\M} } } */
+/* { dg-final { scan-assembler {\mvextsh2d\M} } } */
+/* { dg-final { scan-assembler-not {\mm[tf]vsr} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c b/gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c
new file mode 100644
index 0000000..fdcad01
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c
@@ -0,0 +1,128 @@
+/* { dg-do run { target { *-*-linux* && { lp64 && p9vector_hw } } } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9 -save-temps" } */
+
+/* These builtins were not defined until ISA 3.1 but only require ISA 3.0
+ support. */
+
+/* { dg-final { scan-assembler-times {\mvextsb2w\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvextsb2d\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvextsh2w\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvextsh2d\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvextsw2d\M} 1 } } */
+
+#include <altivec.h>
+
+#define DEBUG 0
+
+#if DEBUG
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+void abort (void);
+
+int main ()
+{
+ int i;
+
+ vector signed char vec_arg_qi, vec_result_qi;
+ vector signed short int vec_arg_hi, vec_result_hi, vec_expected_hi;
+ vector signed int vec_arg_wi, vec_result_wi, vec_expected_wi;
+ vector signed long long vec_result_di, vec_expected_di;
+
+ /* test sign extend byte to word */
+ vec_arg_qi = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
+ -1, -2, -3, -4, -5, -6, -7, -8};
+ vec_expected_wi = (vector signed int) {1, 5, -1, -5};
+
+ vec_result_wi = vec_signexti (vec_arg_qi);
+
+ for (i = 0; i < 4; i++)
+ if (vec_result_wi[i] != vec_expected_wi[i]) {
+#if DEBUG
+ printf("ERROR: vec_signexti(char, int): ");
+ printf("vec_result_wi[%d] != vec_expected_wi[%d]\n",
+ i, i);
+ printf("vec_result_wi[%d] = %d\n", i, vec_result_wi[i]);
+ printf("vec_expected_wi[%d] = %d\n", i, vec_expected_wi[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* test sign extend byte to double */
+ vec_arg_qi = (vector signed char){1, 2, 3, 4, 5, 6, 7, 8,
+ -1, -2, -3, -4, -5, -6, -7, -8};
+ vec_expected_di = (vector signed long long int){1, -1};
+
+ vec_result_di = vec_signextll(vec_arg_qi);
+
+ for (i = 0; i < 2; i++)
+ if (vec_result_di[i] != vec_expected_di[i]) {
+#if DEBUG
+ printf("ERROR: vec_signextll(byte, long long int): ");
+ printf("vec_result_di[%d] != vec_expected_di[%d]\n", i, i);
+ printf("vec_result_di[%d] = %lld\n", i, vec_result_di[i]);
+ printf("vec_expected_di[%d] = %lld\n", i, vec_expected_di[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* test sign extend short to word */
+ vec_arg_hi = (vector signed short int){1, 2, 3, 4, -1, -2, -3, -4};
+ vec_expected_wi = (vector signed int){1, 3, -1, -3};
+
+ vec_result_wi = vec_signexti(vec_arg_hi);
+
+ for (i = 0; i < 4; i++)
+ if (vec_result_wi[i] != vec_expected_wi[i]) {
+#if DEBUG
+ printf("ERROR: vec_signexti(short, int): ");
+ printf("vec_result_wi[%d] != vec_expected_wi[%d]\n", i, i);
+ printf("vec_result_wi[%d] = %d\n", i, vec_result_wi[i]);
+ printf("vec_expected_wi[%d] = %d\n", i, vec_expected_wi[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* test sign extend short to double word */
+ vec_arg_hi = (vector signed short int ){1, 3, 5, 7, -1, -3, -5, -7};
+ vec_expected_di = (vector signed long long int){1, -1};
+
+ vec_result_di = vec_signextll(vec_arg_hi);
+
+ for (i = 0; i < 2; i++)
+ if (vec_result_di[i] != vec_expected_di[i]) {
+#if DEBUG
+ printf("ERROR: vec_signextll(short, double): ");
+ printf("vec_result_di[%d] != vec_expected_di[%d]\n", i, i);
+ printf("vec_result_di[%d] = %lld\n", i, vec_result_di[i]);
+ printf("vec_expected_di[%d] = %lld\n", i, vec_expected_di[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* test sign extend word to double word */
+ vec_arg_wi = (vector signed int ){1, 3, -1, -3};
+ vec_expected_di = (vector signed long long int){1, -1};
+
+ vec_result_di = vec_signextll(vec_arg_wi);
+
+ for (i = 0; i < 2; i++)
+ if (vec_result_di[i] != vec_expected_di[i]) {
+#if DEBUG
+ printf("ERROR: vec_signextll(word, double): ");
+ printf("vec_result_di[%d] != vec_expected_di[%d]\n", i, i);
+ printf("vec_result_di[%d] = %lld\n", i, vec_result_di[i]);
+ printf("vec_expected_di[%d] = %lld\n", i, vec_expected_di[i]);
+#else
+ abort();
+#endif
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-inc-di.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-inc-di.c
index c82041c..6272f5c 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-inc-di.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-inc-di.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE unsigned int
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-df.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-df.c
index d35862f..0dcab31 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-df.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE double
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-di.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-di.c
index 7e1ff99..95b60f3 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-di.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-di.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE long long
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-hi.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-hi.c
index 4143aeb..4a62dfbd 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-hi.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-hi.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE unsigned short
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-qi.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-qi.c
index 30d3236..3a7aad4 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-qi.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-qi.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE unsigned char
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-sf.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-sf.c
index 9d1e2a1..cb76bed 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-sf.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-sf.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE float
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-si.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-si.c
index 17be6fa..ad011d6 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-si.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-si.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE int
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-vector.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-vector.c
index 8c12aea..c8f70b5 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-vector.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-ld-vector.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE vector double
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-df.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-df.c
index d795d35..686a376 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-df.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE double
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-di.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-di.c
index bf57de4..fefe6d3 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-di.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-di.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE long long
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-hi.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-hi.c
index 8822e76..d285686 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-hi.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-hi.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE unsigned short
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-qi.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-qi.c
index 2f75683..f617ffc 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-qi.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-qi.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE unsigned char
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-sf.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-sf.c
index 3dd88aa..6eb20a3 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-sf.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-sf.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE float
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-si.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-si.c
index 78dc812..0cc0b30 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-si.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-si.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE int
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-vector.c b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-vector.c
index 2c602eb..d760819 100644
--- a/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-vector.c
+++ b/gcc/testsuite/gcc.target/powerpc/pcrel-opt-st-vector.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_pcrel } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
#define TYPE vector double
#define LARGE 0x20000
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c
index 496a6e3..9f9b13e 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c
@@ -7,4 +7,4 @@ int foo(int x)
return x == 0;
}
-/* { dg-final { scan-assembler "cntlzw|isel" } } */
+/* { dg-final { scan-assembler {\m(cntlzw|isel|setbc)\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
index 63c4b60..27ed38f 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
@@ -1,33 +1,13 @@
/* PR target/51274 */
/* { dg-do compile } */
-/* { dg-options "-O2 -mno-isel" } */
+/* { dg-options "-O2" } */
-/* { dg-final { scan-assembler-times "addic" 4 } } */
-/* { dg-final { scan-assembler-times "subfe" 1 } } */
-/* { dg-final { scan-assembler-times "addze" 3 } } */
+/* { dg-final { scan-assembler-times {\mcmp[wd]i\M} 1 { target { has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\msetbcr\M} 1 { target { has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\maddic\M} 1 { target { ! has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\msubfe\M} 1 { target { ! has_arch_pwr10 } } } } */
long ne0(long a)
{
return a != 0;
}
-
-long plus_ne0(long a, long b)
-{
- return (a != 0) + b;
-}
-
-void dummy(void);
-
-void cmp_plus_ne0(long a, long b)
-{
- if ((a != 0) + b)
- dummy();
-}
-
-long plus_ne0_cmp(long a, long b)
-{
- a = (a != 0) + b;
- if (a)
- dummy();
- return a;
-}
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c
new file mode 100644
index 0000000..9b0b025
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c
@@ -0,0 +1,27 @@
+/* PR target/51274 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler-times {\maddic\M} 3 } } */
+/* { dg-final { scan-assembler-times {\maddze\M} 3 } } */
+
+long plus_ne0(long a, long b)
+{
+ return (a != 0) + b;
+}
+
+void dummy(void);
+
+void cmp_plus_ne0(long a, long b)
+{
+ if ((a != 0) + b)
+ dummy();
+}
+
+long plus_ne0_cmp(long a, long b)
+{
+ a = (a != 0) + b;
+ if (a)
+ dummy();
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c
deleted file mode 100644
index ae7d574..0000000
--- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
-/* { dg-options "-mabi=elfv2" } */
-
-struct f8
- {
- float x[8];
- };
-
-void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous 'float' aggregates has changed" } */
-{
-}
-
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c
deleted file mode 100644
index fdbeddf..0000000
--- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
-
-struct test
- {
- long a __attribute__((aligned (16)));
- };
-
-void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment has changed" } */
-{
-}
-
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c
deleted file mode 100644
index 22cad0c..0000000
--- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
-/* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec" } */
-
-struct test
- {
- int a __attribute__((vector_size (8)));
- }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment has changed" } */
-
diff --git a/gcc/testsuite/gcc.target/powerpc/pr100085.c b/gcc/testsuite/gcc.target/powerpc/pr100085.c
new file mode 100644
index 0000000..bfb348a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr100085.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target float128 } */
+/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
+
+typedef __vector unsigned __int128 vui128_t;
+
+typedef union
+{
+ __float128 vf1;
+ vui128_t vx1;
+} __VF_128;
+
+vui128_t
+vec_xfer_bin128_2_vui128t (__float128 f128)
+{
+ __VF_128 vunion;
+ vunion.vf1 = f128;
+ return (vunion.vx1);
+}
+
+/* { dg-final { scan-assembler-not {\mxxpermdi\M} } } */
+/* { dg-final { scan-assembler-not {\mstxvd2x\M} } } */
+/* { dg-final { scan-assembler-not {\mlxvd2x\M} } } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr100777.c b/gcc/testsuite/gcc.target/powerpc/pr100777.c
new file mode 100644
index 0000000..15742f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr100777.c
@@ -0,0 +1,24 @@
+/* PR target/100777 */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target fopenmp } */
+/* { dg-options "-O1 -mdejagnu-cpu=power10 -fopenmp" } */
+
+/* Verify we do not ICE on the following. */
+
+void
+foo (__vector_quad *dst)
+{
+#pragma omp parallel
+ {
+ __builtin_mma_xxsetaccz (dst);
+ }
+}
+
+void
+bar (__vector_quad *dst, __vector_quad *src)
+{
+#pragma omp parallel
+ {
+ __builtin_mma_disassemble_acc (dst, src);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101129.c b/gcc/testsuite/gcc.target/powerpc/pr101129.c
new file mode 100644
index 0000000..6b8e5a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101129.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-mdejagnu-cpu=power8 -O " } */
+
+/* PR101129: The swaps pass was turning a mult-lopart into a mult-hipart.
+ Make sure we aren't doing that anymore. */
+
+typedef unsigned char u8;
+typedef unsigned char __attribute__((__vector_size__ (8))) U;
+typedef unsigned char __attribute__((__vector_size__ (16))) V;
+typedef unsigned int u32;
+typedef unsigned long long u64;
+typedef __int128 u128;
+
+u8 g;
+U u;
+
+void
+foo0 (u32 u32_0, U *ret)
+{
+ u128 u128_2 = u32_0 * (u128)((V){ 5 } > (u32_0 & 4));
+ u64 u64_r = u128_2 >> 64;
+ u8 u8_r = u64_r + g;
+ *ret = u + u8_r;
+}
+
+int
+main (void)
+{
+ U x;
+ foo0 (7, &x);
+ for (unsigned i = 0; i < sizeof (x); i++)
+ if (x[i] != 0) __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101384-1.c b/gcc/testsuite/gcc.target/powerpc/pr101384-1.c
new file mode 100644
index 0000000..627d7d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101384-1.c
@@ -0,0 +1,79 @@
+/* PR target/101384 */
+/* { dg-do compile { target le } } */
+/* { dg-options "-O2 -maltivec" } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-final { scan-assembler-times {\mvspltis[whb] [^\n\r]*,-1\M} 9 } } */
+/* { dg-final { scan-assembler-times {\mvslw\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mvslh\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mvslb\M} 3 } } */
+
+typedef unsigned char __attribute__((__vector_size__ (16))) U;
+typedef unsigned short __attribute__((__vector_size__ (16))) V;
+typedef unsigned int __attribute__((__vector_size__ (16))) W;
+
+U u;
+V v;
+W w;
+
+U
+f1 (void)
+{
+ U y = (U) { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 } + u;
+ return y;
+}
+
+U
+f2 (void)
+{
+ U y = (U) { 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80 } + u;
+ return y;
+}
+
+U
+f3 (void)
+{
+ U y = (U) { 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80 } + u;
+ return y;
+}
+
+V
+f4 (void)
+{
+ V y = (V) { 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080 } + v;
+ return y;
+}
+
+V
+f5 (void)
+{
+ V y = (V) { 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 } + v;
+ return y;
+}
+
+V
+f6 (void)
+{
+ V y = (V) { 0, 0x8000, 0, 0x8000, 0, 0x8000, 0, 0x8000 } + v;
+ return y;
+}
+
+W
+f7 (void)
+{
+ W y = (W) { 0x80808080, 0x80808080, 0x80808080, 0x80808080 } + w;
+ return y;
+}
+
+W
+f8 (void)
+{
+ W y = (W) { 0x80008000, 0x80008000, 0x80008000, 0x80008000 } + w;
+ return y;
+}
+
+W
+f9 (void)
+{
+ W y = (W) { 0x80000000, 0x80000000, 0x80000000, 0x80000000 } + w;
+ return y;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101384-2.c b/gcc/testsuite/gcc.target/powerpc/pr101384-2.c
new file mode 100644
index 0000000..f395708
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101384-2.c
@@ -0,0 +1,79 @@
+/* PR target/101384 */
+/* { dg-do compile { target be } } */
+/* { dg-options "-O2 -maltivec" } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-final { scan-assembler-times {\mvspltis[whb] [^\n\r]*,-1\M} 9 } } */
+/* { dg-final { scan-assembler-times {\mvslw\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mvslh\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mvslb\M} 3 } } */
+
+typedef unsigned char __attribute__((__vector_size__ (16))) U;
+typedef unsigned short __attribute__((__vector_size__ (16))) V;
+typedef unsigned int __attribute__((__vector_size__ (16))) W;
+
+U u;
+V v;
+W w;
+
+U
+f1 (void)
+{
+ U y = (U) { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 } + u;
+ return y;
+}
+
+U
+f2 (void)
+{
+ U y = (U) { 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0 } + u;
+ return y;
+}
+
+U
+f3 (void)
+{
+ U y = (U) { 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0 } + u;
+ return y;
+}
+
+V
+f4 (void)
+{
+ V y = (V) { 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080 } + v;
+ return y;
+}
+
+V
+f5 (void)
+{
+ V y = (V) { 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 } + v;
+ return y;
+}
+
+V
+f6 (void)
+{
+ V y = (V) { 0x8000, 0, 0x8000, 0, 0x8000, 0, 0x8000, 0 } + v;
+ return y;
+}
+
+W
+f7 (void)
+{
+ W y = (W) { 0x80808080, 0x80808080, 0x80808080, 0x80808080 } + w;
+ return y;
+}
+
+W
+f8 (void)
+{
+ W y = (W) { 0x80008000, 0x80008000, 0x80008000, 0x80008000 } + w;
+ return y;
+}
+
+W
+f9 (void)
+{
+ W y = (W) { 0x80000000, 0x80000000, 0x80000000, 0x80000000 } + w;
+ return y;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101596-1.c b/gcc/testsuite/gcc.target/powerpc/pr101596-1.c
new file mode 100644
index 0000000..ed09e5f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101596-1.c
@@ -0,0 +1,30 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details" } */
+
+/* Check vect_recog_mulhs_pattern can't be detected with shift count 48. */
+
+#define N 128
+
+typedef signed long long sLL;
+typedef unsigned long long uLL;
+
+signed int si_a[N], si_b[N];
+unsigned int ui_a[N], ui_b[N];
+signed short sh_c[N];
+unsigned short uh_c[N];
+
+void
+test1 ()
+{
+ for (int i = 0; i < N; i++)
+ sh_c[i] = ((sLL) si_a[i] * (sLL) si_b[i]) >> 48;
+}
+
+void
+test2 ()
+{
+ for (int i = 0; i < N; i++)
+ uh_c[i] = ((uLL) ui_a[i] * (uLL) ui_b[i]) >> 48;
+}
+
+/* { dg-final { scan-tree-dump-not "vect_recog_mulhs_pattern: detected" "vect" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101596-2.c b/gcc/testsuite/gcc.target/powerpc/pr101596-2.c
new file mode 100644
index 0000000..5caa7ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101596-2.c
@@ -0,0 +1,30 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details" } */
+
+/* Check vect_recog_mulhs_pattern can be detected with shift count 32. */
+
+#define N 128
+
+typedef signed long long sLL;
+typedef unsigned long long uLL;
+
+signed int si_a[N], si_b[N];
+unsigned int ui_a[N], ui_b[N];
+signed short sh_c[N];
+unsigned short uh_c[N];
+
+void
+test1 ()
+{
+ for (int i = 0; i < N; i++)
+ sh_c[i] = ((sLL) si_a[i] * (sLL) si_b[i]) >> 32;
+}
+
+void
+test2 ()
+{
+ for (int i = 0; i < N; i++)
+ uh_c[i] = ((uLL) ui_a[i] * (uLL) ui_b[i]) >> 32;
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_mulhs_pattern: detected" 2 "vect" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101596-3.c b/gcc/testsuite/gcc.target/powerpc/pr101596-3.c
new file mode 100644
index 0000000..4b92661
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101596-3.c
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-require-effective-target power10_hw } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model" } */
+
+/* Verify the execution goes well with shift count either 32 or 48. */
+
+#define N 128
+
+typedef signed int si;
+typedef signed short sh;
+typedef signed long long sll;
+typedef unsigned int ui;
+typedef unsigned short uh;
+typedef unsigned long long ull;
+
+si si_a[N], si_b[N];
+ui ui_a[N], ui_b[N];
+sh sh_c[N];
+uh uh_c[N];
+
+#define TEST(NTYPE, TYPE, WTYPE, CNT) \
+ void __attribute__ ((noipa)) test_##TYPE##CNT () \
+ { \
+ for (int i = 0; i < N; i++) \
+ NTYPE##_c[i] = ((WTYPE) TYPE##_a[i] * (WTYPE) TYPE##_b[i]) >> CNT; \
+ } \
+ \
+ void __attribute__ ((noipa, optimize ("O1"))) check_##TYPE##CNT () \
+ { \
+ test_##TYPE##CNT (); \
+ for (int i = 0; i < N; i++) \
+ { \
+ NTYPE exp = ((WTYPE) TYPE##_a[i] * (WTYPE) TYPE##_b[i]) >> CNT; \
+ if (NTYPE##_c[i] != exp) \
+ __builtin_abort (); \
+ } \
+ }
+
+TEST (sh, si, sll, 32)
+TEST (sh, si, sll, 48)
+TEST (uh, ui, ull, 32)
+TEST (uh, ui, ull, 48)
+
+int
+main ()
+{
+
+ for (int i = 0; i < N; i++)
+ {
+ ui_a[i] = si_a[i] = 0x12345678ULL + 0x1000ULL * (i * 3 - 1);
+ ui_b[i] = si_b[i] = 0x87654321ULL - 0x500000ULL * (i * 5 + 1);
+ }
+
+ check_si32 ();
+ check_si48 ();
+ check_ui32 ();
+ check_ui48 ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101849.c b/gcc/testsuite/gcc.target/powerpc/pr101849.c
new file mode 100644
index 0000000..823fbfe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101849.c
@@ -0,0 +1,22 @@
+/* PR target/101849 */
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+
+/* Verify we do not ICE on the tests below. */
+
+void
+foo (__vector_pair *dst, double *x, long offset)
+{
+ dst[0] = __builtin_vsx_lxvp (0, (__vector_pair *)(void *)x);
+ dst[1] = __builtin_vsx_lxvp (32, (__vector_pair *)(void *)x);
+ dst[2] = __builtin_vsx_lxvp (offset, (__vector_pair *)(void *)x);
+}
+
+void
+bar (__vector_pair *src, double *x, long offset)
+{
+ __builtin_vsx_stxvp (src[0], 0, (__vector_pair *)(void *)x);
+ __builtin_vsx_stxvp (src[1], 32, (__vector_pair *)(void *)x);
+ __builtin_vsx_stxvp (src[2], offset, (__vector_pair *)(void *)x);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr56605.c b/gcc/testsuite/gcc.target/powerpc/pr56605.c
index 29efd81..fdedbfc 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr56605.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr56605.c
@@ -11,5 +11,5 @@ void foo (short* __restrict sb, int* __restrict ia)
ia[i] = (int) sb[i];
}
-/* { dg-final { scan-rtl-dump-times "\\\(compare:CC \\\((?:and|zero_extend):DI \\\(reg:\[SD\]I" 1 "combine" } } */
+/* { dg-final { scan-rtl-dump-times {\(compare:CC \((?:and|zero_extend):(?:DI) \((?:sub)?reg:[SD]I} 1 "combine" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr61837.c b/gcc/testsuite/gcc.target/powerpc/pr61837.c
new file mode 100644
index 0000000..e5a0c4f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr61837.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-rtl-loop2_doloop -fno-unroll-loops" } */
+/* The inner loop would use the doloop IV in word_mode. And then
+ there is no need to access it though zero_extend on shorter mode. */
+void foo(int *p1, long *p2, int s)
+{
+ int n, v, i;
+
+ v = 0;
+ for (n = 0; n <= 100; n++) {
+ for (i = 0; i < s; i++)
+ if (p2[i] == n)
+ p1[i] = v;
+ v += 88;
+ }
+}
+
+/* { dg-final {scan-rtl-dump-not {(?p)zero_extend.*doloop} "loop2_doloop"} } */
+/* { dg-final {scan-rtl-dump-not {(?p)reg:SI.*doloop} "loop2_doloop" { target lp64 } } } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr70117.c b/gcc/testsuite/gcc.target/powerpc/pr70117.c
index 3bbd2c5..4a51f58 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr70117.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr70117.c
@@ -1,26 +1,18 @@
-/* { dg-do run { target { powerpc*-*-linux* powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* } } } */
-/* { dg-options "-std=c99 -mlong-double-128 -O2" } */
+/* { dg-do run } */
+/* { dg-require-effective-target long_double_ibm128 } */
+/* { dg-options "-std=c99 -O2" } */
+/* { dg-add-options long_double_ibm128 } */
#include <float.h>
-#if defined(__LONG_DOUBLE_IEEE128__)
-/* If long double is IEEE 128-bit, we need to use the __ibm128 type instead of
- long double. We can't use __ibm128 on systems that don't support IEEE
- 128-bit floating point, because the type is not enabled on those
- systems. */
-#define LDOUBLE __ibm128
-
-#elif defined(__LONG_DOUBLE_IBM128__)
-#define LDOUBLE long double
-
-#else
-#error "long double must be either IBM 128-bit or IEEE 128-bit"
+#ifndef __LONG_DOUBLE_IBM128__
+#error "long double must be IBM 128-bit"
#endif
union gl_long_double_union
{
struct { double hi; double lo; } dd;
- LDOUBLE ld;
+ long double ld;
};
/* This is gnulib's LDBL_MAX which, being 107 bits in precision, is
@@ -36,7 +28,7 @@ volatile double dnan = 0.0/0.0;
int
main (void)
{
- LDOUBLE ld;
+ long double ld;
ld = gl_LDBL_MAX.ld;
if (__builtin_isinf (ld))
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c
new file mode 100644
index 0000000..5e29b19
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-O2 -mvsx -mdejagnu-cpu=power7" } */
+
+#include <stddef.h>
+#include <altivec.h>
+#include "pr79251.h"
+
+int
+main (void)
+{
+ TEST_VEC_INSERT_ALL (run_test)
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p7.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p7.c
new file mode 100644
index 0000000..25e227a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p7.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power7 -mvsx" } */
+
+#include <stddef.h>
+#include <altivec.h>
+#include "pr79251.h"
+
+/* { dg-final { scan-assembler-not {\mstxw\M} } } */
+/* { dg-final { scan-assembler-times {\mlvsl\M} 10 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mlvsr\M} 3 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 20 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mxxpermdi\M} 10 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mxxsel\M} 7 { target lp64 } } } */
+
+/* { dg-final { scan-assembler-times {\mrlwinm\M} 10 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 19 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M} 7 { target ilp32 } } } */
+
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c
index 178e02f..4fc3ea0 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c
@@ -14,9 +14,9 @@
/* { dg-final { scan-assembler-times {\mxxsel\M} 7 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mrlwinm\M} 10 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstxvw4x\M} 6 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstxvd2x\M} 4 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 12 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mlxvw4x\M} 6 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mlxvd2x\M} 4 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxvw4x\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxvd2x\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 1 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlxvw4x\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M} 7 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c
index 2ae2da8..9312aa6 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c
@@ -16,7 +16,7 @@
/* { dg-final { scan-assembler-times {\mxxpermdi\M} 3 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mrlwinm\M} 10 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstxv\M} 10 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 12 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mlxv\M} 10 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstxv\M} 0 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 1 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mlxv\M} 7 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr81348.c b/gcc/testsuite/gcc.target/powerpc/pr81348.c
index 7037acf..16a46c8 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr81348.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr81348.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -Og" } */
@@ -19,5 +19,5 @@ void d(void)
***c = e;
}
-/* { dg-final { scan-assembler {\mlxsihzx\M} } } */
-/* { dg-final { scan-assembler {\mvextsh2d\M} } } */
+/* { dg-final { scan-assembler {\mlha\M} } } */
+/* { dg-final { scan-assembler {\mmtvsrwa\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c b/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c
index 1269fe6..bd1502b 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c
@@ -30,5 +30,5 @@ vector signed long long splats4(void)
/* { dg-final { scan-assembler-times {\mvspltis[bhw]\M} 0 } } */
/* { dg-final { scan-assembler-times {\mvsl[bhwd]\M} 0 } } */
-/* { dg-final { scan-assembler-times {\mlvx\M|\mlxv\M|\mlxvd2x\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mp?lxv\M|\mlxv\M|\mlxvd2x\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr93658.c b/gcc/testsuite/gcc.target/powerpc/pr93658.c
index d1010ee..8858ca8 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr93658.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr93658.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fstack-protector-strong -mdejagnu-cpu=power8" } */
+/* { dg-options "-O3 -Wno-stringop-overflow -fstack-protector-strong -mdejagnu-cpu=power8" } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* PR93658: Failure compiling this test is an infinite loop in LRA's
diff --git a/gcc/testsuite/gcc.target/powerpc/pr97142.c b/gcc/testsuite/gcc.target/powerpc/pr97142.c
new file mode 100644
index 0000000..0e5f1c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr97142.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+#include <math.h>
+
+float test1 (float x, float y)
+{
+ return fmodf (x, y);
+}
+
+double test2 (double x, double y)
+{
+ return fmod (x, y);
+}
+
+float test3 (float x, float y)
+{
+ return remainderf (x, y);
+}
+
+double test4 (double x, double y)
+{
+ return remainder (x, y);
+}
+
+/* { dg-final { scan-assembler-not {(?n)\mb.*fmod} } } */
+/* { dg-final { scan-assembler-not {(?n)\mb.*fmodf} } } */
+/* { dg-final { scan-assembler-not {(?n)\mb.*remainder} } } */
+/* { dg-final { scan-assembler-not {(?n)\mb.*remainderf} } } */
+/* { dg-final { scan-assembler-times {\mfdiv\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mfdivs\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mfnmsub\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mfnmsubs\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mfriz\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mfrin\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr98914.c b/gcc/testsuite/gcc.target/powerpc/pr98914.c
new file mode 100644
index 0000000..e4d78e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr98914.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-Og -mvsx" } */
+
+vector int
+foo (vector int v)
+{
+ for (long k = 0; k < 1; ++k)
+ v[k] = 0;
+ return v;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr98952.c b/gcc/testsuite/gcc.target/powerpc/pr98952.c
new file mode 100644
index 0000000..c487fbc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr98952.c
@@ -0,0 +1,28 @@
+/* { dg-do run { target { powerpc*-*-linux* && ilp32 } } } */
+/* { dg-options "-O2" } */
+
+/* PR 96983 reported that the test in libgcc's tramp.S was backwards and it
+ would abort if the trampoline size passed to the function was greater than
+ the size the runtime was expecting (40). It should abort if the size is less
+ than 40, not greater than 40. This test creates a call to __trampoline_setup
+ with a much larger buffer to make sure the function does not abort.
+
+ We do not run this test on 64-bit since __trampoline_setup is not present in
+ 64-bit systems.
+
+ We only run the test under Linux in case the other systems have some
+ different variant for __trampoline_setup. */
+
+#ifndef SIZE
+#define SIZE 100
+#endif
+
+extern void __trampoline_setup (int *, unsigned, void *, void *);
+
+int main (void)
+{
+ int tramp[SIZE / sizeof (int)];
+
+ __trampoline_setup (tramp, SIZE, 0, 0);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr99557.c b/gcc/testsuite/gcc.target/powerpc/pr99557.c
new file mode 100644
index 0000000..e0f8b24
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr99557.c
@@ -0,0 +1,53 @@
+/* { dg-do run { target { powerpc*-ibm-aix* } } } */
+/* { dg-options "" } */
+
+void abort (void);
+
+struct A {
+ double x[2];
+ int y;
+};
+
+struct B {
+ int i;
+ struct A a;
+};
+
+struct N {
+ double d[2];
+};
+
+struct S {
+ struct N n;
+ float f;
+};
+
+struct T {
+ char c;
+ struct S s;
+};
+
+int main() {
+ if (__alignof(struct A) != 8)
+ abort();
+
+ if (__alignof(struct B) != 4)
+ abort();
+
+ if (__builtin_offsetof(struct B, a) != 4)
+ abort();
+
+ if (__alignof(struct N) != 8)
+ abort();
+
+ if (__alignof(struct S) != 8)
+ abort();
+
+ if (__alignof(struct T) != 4)
+ abort();
+
+ if (__builtin_offsetof(struct T, s) != 4)
+ abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr99581.c b/gcc/testsuite/gcc.target/powerpc/pr99581.c
new file mode 100644
index 0000000..525f276
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr99581.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+char e[37540];
+struct A { int c; } d;
+
+void
+bar (int n)
+{
+ __asm__("" : : "r" (e));
+}
+
+void
+foo (void)
+{
+ __asm__("stw %1, %0" : "=o" (d.c) : "r" (0));
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pragma-optimize.c b/gcc/testsuite/gcc.target/powerpc/pragma-optimize.c
new file mode 100644
index 0000000..e8ba63a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pragma-optimize.c
@@ -0,0 +1,13 @@
+/* { dg-options "-O2 -mlong-double-128 -mabi=ibmlongdouble" } */
+
+extern unsigned long int x;
+extern float f (float);
+extern __typeof (f) f_power8;
+extern __typeof (f) f_power9;
+extern __typeof (f) f __attribute__ ((ifunc ("f_ifunc")));
+static __attribute__ ((optimize (1))) __typeof (f) *
+f_ifunc (void)
+{
+ __typeof (f) *res = x ? f_power9 : f_power8;
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-1.c b/gcc/testsuite/gcc.target/powerpc/rop-1.c
new file mode 100644
index 0000000..8cedcb6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/rop-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
+/* { dg-require-effective-target powerpc_elfv2 } */
+
+/* Verify that ROP-protect instructions are inserted when a
+ call is present. */
+
+extern void foo (void);
+
+int bar ()
+{
+ foo ();
+ return 5;
+}
+
+/* { dg-final { scan-assembler-times {\mhashst\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mhashchk\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-2.c b/gcc/testsuite/gcc.target/powerpc/rop-2.c
new file mode 100644
index 0000000..c556952
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/rop-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect -mprivileged" } */
+/* { dg-require-effective-target powerpc_elfv2 } */
+
+/* Verify that privileged ROP-protect instructions are inserted when a
+ call is present. */
+
+extern void foo (void);
+
+int bar ()
+{
+ foo ();
+ return 5;
+}
+
+/* { dg-final { scan-assembler-times {\mhashstp\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mhashchkp\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-3.c b/gcc/testsuite/gcc.target/powerpc/rop-3.c
new file mode 100644
index 0000000..8d03792
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/rop-3.c
@@ -0,0 +1,18 @@
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
+
+/* Verify that ROP-protect instructions execute correctly when a
+ call is present. */
+
+void __attribute__((noipa)) foo ()
+{
+ asm ("");
+}
+
+int main ()
+{
+ foo ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-4.c b/gcc/testsuite/gcc.target/powerpc/rop-4.c
new file mode 100644
index 0000000..dcf47c6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/rop-4.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
+/* { dg-require-effective-target powerpc_elfv2 } */
+
+/* Verify that no ROP-protect instructions are inserted when no
+ call is present. */
+
+
+int bar ()
+{
+ return 5;
+}
+
+/* { dg-final { scan-assembler-not {\mhashst\M} } } */
+/* { dg-final { scan-assembler-not {\mhashchk\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-5.c b/gcc/testsuite/gcc.target/powerpc/rop-5.c
new file mode 100644
index 0000000..f2594df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/rop-5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
+
+/* Verify that __ROP_PROTECT__ is predefined for -mrop-protect. */
+
+int foo ()
+{
+#ifndef __ROP_PROTECT__
+ __ROP_PROTECT__ macro is not defined when it should be
+#endif
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-blendpd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendpd.c
new file mode 100644
index 0000000..ca17804
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendpd.c
@@ -0,0 +1,89 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+#include <string.h>
+
+#define NUM 20
+
+#ifndef MASK
+#define MASK 0x03
+#endif
+
+static void
+init_blendpd (double *src1, double *src2)
+{
+ int i, sign = 1;
+
+ for (i = 0; i < NUM * 2; i++)
+ {
+ src1[i] = i * i * sign;
+ src2[i] = (i + 20) * sign;
+ sign = -sign;
+ }
+}
+
+static int
+check_blendpd (__m128d *dst, double *src1, double *src2)
+{
+ double tmp[2];
+ int j;
+
+ memcpy (&tmp[0], src1, sizeof (tmp));
+
+ for(j = 0; j < 2; j++)
+ if ((MASK & (1 << j)))
+ tmp[j] = src2[j];
+
+ return memcmp (dst, &tmp[0], sizeof (tmp));
+}
+
+static void
+TEST (void)
+{
+ __m128d x, y;
+ union
+ {
+ __m128d x[NUM];
+ double d[NUM * 2];
+ } dst, src1, src2;
+ union
+ {
+ __m128d x;
+ double d[2];
+ } src3;
+ int i;
+
+ init_blendpd (src1.d, src2.d);
+
+ /* Check blendpd imm8, m128, xmm */
+ for (i = 0; i < NUM; i++)
+ {
+ dst.x[i] = _mm_blend_pd (src1.x[i], src2.x[i], MASK);
+ if (check_blendpd (&dst.x[i], &src1.d[i * 2], &src2.d[i * 2]))
+ abort ();
+ }
+
+ /* Check blendpd imm8, xmm, xmm */
+ src3.x = _mm_setzero_pd ();
+
+ x = _mm_blend_pd (dst.x[2], src3.x, MASK);
+ y = _mm_blend_pd (src3.x, dst.x[2], MASK);
+
+ if (check_blendpd (&x, &dst.d[4], &src3.d[0]))
+ abort ();
+
+ if (check_blendpd (&y, &src3.d[0], &dst.d[4]))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-blendps-2.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendps-2.c
new file mode 100644
index 0000000..768b6e6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendps-2.c
@@ -0,0 +1,81 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#include "sse4_1-check.h"
+
+#include <smmintrin.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define NUM 20
+
+#undef MASK
+#define MASK 0xe
+
+static void
+init_blendps (float *src1, float *src2)
+{
+ int i, sign = 1;
+
+ for (i = 0; i < NUM * 4; i++)
+ {
+ src1[i] = i * i * sign;
+ src2[i] = (i + 20) * sign;
+ sign = -sign;
+ }
+}
+
+static int
+check_blendps (__m128 *dst, float *src1, float *src2)
+{
+ float tmp[4];
+ int j;
+
+ memcpy (&tmp[0], src1, sizeof (tmp));
+ for (j = 0; j < 4; j++)
+ if ((MASK & (1 << j)))
+ tmp[j] = src2[j];
+
+ return memcmp (dst, &tmp[0], sizeof (tmp));
+}
+
+static void
+sse4_1_test (void)
+{
+ __m128 x, y;
+ union
+ {
+ __m128 x[NUM];
+ float f[NUM * 4];
+ } dst, src1, src2;
+ union
+ {
+ __m128 x;
+ float f[4];
+ } src3;
+ int i;
+
+ init_blendps (src1.f, src2.f);
+
+ for (i = 0; i < 4; i++)
+ src3.f[i] = (int) rand ();
+
+ /* Check blendps imm8, m128, xmm */
+ for (i = 0; i < NUM; i++)
+ {
+ dst.x[i] = _mm_blend_ps (src1.x[i], src2.x[i], MASK);
+ if (check_blendps (&dst.x[i], &src1.f[i * 4], &src2.f[i * 4]))
+ abort ();
+ }
+
+ /* Check blendps imm8, xmm, xmm */
+ x = _mm_blend_ps (dst.x[2], src3.x, MASK);
+ y = _mm_blend_ps (src3.x, dst.x[2], MASK);
+
+ if (check_blendps (&x, &dst.f[8], &src3.f[0]))
+ abort ();
+
+ if (check_blendps (&y, &src3.f[0], &dst.f[8]))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-blendps.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendps.c
new file mode 100644
index 0000000..2f114b6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendps.c
@@ -0,0 +1,90 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define NUM 20
+
+#ifndef MASK
+#define MASK 0x0f
+#endif
+
+static void
+init_blendps (float *src1, float *src2)
+{
+ int i, sign = 1;
+
+ for (i = 0; i < NUM * 4; i++)
+ {
+ src1[i] = i * i * sign;
+ src2[i] = (i + 20) * sign;
+ sign = -sign;
+ }
+}
+
+static int
+check_blendps (__m128 *dst, float *src1, float *src2)
+{
+ float tmp[4];
+ int j;
+
+ memcpy (&tmp[0], src1, sizeof (tmp));
+ for (j = 0; j < 4; j++)
+ if ((MASK & (1 << j)))
+ tmp[j] = src2[j];
+
+ return memcmp (dst, &tmp[0], sizeof (tmp));
+}
+
+static void
+TEST (void)
+{
+ __m128 x, y;
+ union
+ {
+ __m128 x[NUM];
+ float f[NUM * 4];
+ } dst, src1, src2;
+ union
+ {
+ __m128 x;
+ float f[4];
+ } src3;
+ int i;
+
+ init_blendps (src1.f, src2.f);
+
+ for (i = 0; i < 4; i++)
+ src3.f[i] = (int) rand ();
+
+ /* Check blendps imm8, m128, xmm */
+ for (i = 0; i < NUM; i++)
+ {
+ dst.x[i] = _mm_blend_ps (src1.x[i], src2.x[i], MASK);
+ if (check_blendps (&dst.x[i], &src1.f[i * 4], &src2.f[i * 4]))
+ abort ();
+ }
+
+ /* Check blendps imm8, xmm, xmm */
+ x = _mm_blend_ps (dst.x[2], src3.x, MASK);
+ y = _mm_blend_ps (src3.x, dst.x[2], MASK);
+
+ if (check_blendps (&x, &dst.f[8], &src3.f[0]))
+ abort ();
+
+ if (check_blendps (&y, &src3.f[0], &dst.f[8]))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-blendvpd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendvpd.c
new file mode 100644
index 0000000..b82cd28
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-blendvpd.c
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#include "sse4_1-check.h"
+
+#include <smmintrin.h>
+#include <string.h>
+
+#define NUM 20
+
+static void
+init_blendvpd (double *src1, double *src2, double *mask)
+{
+ int i, msk, sign = 1;
+
+ msk = -1;
+ for (i = 0; i < NUM * 2; i++)
+ {
+ if((i % 2) == 0)
+ msk++;
+ src1[i] = i* (i + 1) * sign;
+ src2[i] = (i + 20) * sign;
+ mask[i] = (i + 120) * i;
+ if( (msk & (1 << (i % 2))))
+ mask[i] = -mask[i];
+ sign = -sign;
+ }
+}
+
+static int
+check_blendvpd (__m128d *dst, double *src1, double *src2,
+ double *mask)
+{
+ double tmp[2];
+ int j;
+
+ memcpy (&tmp[0], src1, sizeof (tmp));
+ for (j = 0; j < 2; j++)
+ if (mask [j] < 0.0)
+ tmp[j] = src2[j];
+
+ return memcmp (dst, &tmp[0], sizeof (tmp));
+}
+
+static void
+sse4_1_test (void)
+{
+ union
+ {
+ __m128d x[NUM];
+ double d[NUM * 2];
+ } dst, src1, src2, mask;
+ int i;
+
+ init_blendvpd (src1.d, src2.d, mask.d);
+
+ for (i = 0; i < NUM; i++)
+ {
+ dst.x[i] = _mm_blendv_pd (src1.x[i], src2.x[i], mask.x[i]);
+ if (check_blendvpd (&dst.x[i], &src1.d[i * 2], &src2.d[i * 2],
+ &mask.d[i * 2]))
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c
new file mode 100644
index 0000000..f532fdb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128d
+#define FP_T double
+
+#define ROUND_INTRIN(x, mode) _mm_ceil_pd (x)
+
+#include "sse4_1-round-data.h"
+
+static struct data data[] = {
+ { .value = { .f = { 0.00, 0.25 } }, .answer = { 0.0, 1.0 } },
+ { .value = { .f = { 0.50, 0.75 } }, .answer = { 1.0, 1.0 } },
+
+ { { .f = { 0x1.ffffffffffffcp+50, 0x1.ffffffffffffdp+50 } },
+ { 0x1.ffffffffffffcp+50, 0x1.0000000000000p+51 } },
+ { { .f = { 0x1.ffffffffffffep+50, 0x1.fffffffffffffp+50 } },
+ { 0x1.0000000000000p+51, 0x1.0000000000000p+51 } },
+ { { .f = { 0x1.0000000000000p+51, 0x1.0000000000001p+51 } },
+ { 0x1.0000000000000p+51, 0x1.0000000000002p+51 } },
+ { { .f = { 0x1.0000000000002p+51, 0x1.0000000000003p+51 } },
+ { 0x1.0000000000002p+51, 0x1.0000000000004p+51 } },
+
+ { { .f = { 0x1.ffffffffffffep+51, 0x1.fffffffffffffp+51 } },
+ { 0x1.ffffffffffffep+51, 0x1.0000000000000p+52 } },
+ { { .f = { 0x1.0000000000000p+52, 0x1.0000000000001p+52 } },
+ { 0x1.0000000000000p+52, 0x1.0000000000001p+52 } },
+
+ { { .f = { -0x1.0000000000001p+52, -0x1.0000000000000p+52 } },
+ { -0x1.0000000000001p+52, -0x1.0000000000000p+52 } },
+ { { .f = { -0x1.fffffffffffffp+51, -0x1.ffffffffffffep+51 } },
+ { -0x1.ffffffffffffep+51, -0x1.ffffffffffffep+51 } },
+
+ { { .f = { -0x1.0000000000003p+51, -0x1.0000000000002p+51 } },
+ { -0x1.0000000000002p+51, -0x1.0000000000002p+51 } },
+ { { .f = { -0x1.0000000000001p+51, -0x1.0000000000000p+51 } },
+ { -0x1.0000000000000p+51, -0x1.0000000000000p+51 } },
+ { { .f = { -0x1.fffffffffffffp+50, -0x1.ffffffffffffep+50 } },
+ { -0x1.ffffffffffffcp+50, -0x1.ffffffffffffcp+50 } },
+ { { .f = { -0x1.ffffffffffffdp+50, -0x1.ffffffffffffcp+50 } },
+ { -0x1.ffffffffffffcp+50, -0x1.ffffffffffffcp+50 } },
+
+ { { .f = { -1.00, -0.75 } }, { -1.0, 0.0 } },
+ { { .f = { -0.50, -0.25 } }, { 0.0, 0.0 } }
+};
+
+#include "sse4_1-round.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c
new file mode 100644
index 0000000..1e29999
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128
+#define FP_T float
+
+#define ROUND_INTRIN(x, mode) _mm_ceil_ps (x)
+
+#include "sse4_1-round-data.h"
+
+static struct data data[] = {
+ { { .f = { 0.00, 0.25, 0.50, 0.75 } }, { 0.0, 1.0, 1.0, 1.0 } },
+
+ { { .f = { 0x1.fffff8p+21, 0x1.fffffap+21,
+ 0x1.fffffcp+21, 0x1.fffffep+21 } },
+ { 0x1.fffff8p+21, 0x1.000000p+22,
+ 0x1.000000p+22, 0x1.000000p+22 } },
+
+ { { .f = { 0x1.fffffap+22, 0x1.fffffcp+22,
+ 0x1.fffffep+22, 0x1.fffffep+23 } },
+ { 0x1.fffffcp+22, 0x1.fffffcp+22,
+ 0x1.000000p+23, 0x1.fffffep+23 } },
+
+ { { .f = { -0x1.fffffep+23, -0x1.fffffep+22,
+ -0x1.fffffcp+22, -0x1.fffffap+22 } },
+ { -0x1.fffffep+23, -0x1.fffffcp+22,
+ -0x1.fffffcp+22, -0x1.fffff8p+22 } },
+
+ { { .f = { -0x1.fffffep+21, -0x1.fffffcp+21,
+ -0x1.fffffap+21, -0x1.fffff8p+21 } },
+ { -0x1.fffff8p+21, -0x1.fffff8p+21,
+ -0x1.fffff8p+21, -0x1.fffff8p+21 } },
+
+ { { .f = { -1.00, -0.75, -0.50, -0.25 } }, { -1.0, 0.0, 0.0, 0.0 } }
+};
+
+#include "sse4_1-round.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c
new file mode 100644
index 0000000..cc0d9c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c
@@ -0,0 +1,119 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128d
+#define FP_T double
+
+#define ROUND_INTRIN(x, y) _mm_ceil_sd (x, y)
+
+#include "sse4_1-round-data.h"
+
+static struct data2 data[] = {
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.00, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.25, IGNORED } },
+ .answer = { 1.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.50, IGNORED } },
+ .answer = { 1.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.75, IGNORED } },
+ .answer = { 1.0, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffcp+50, IGNORED } },
+ .answer = { 0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffdp+50, IGNORED } },
+ .answer = { 0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffep+50, IGNORED } },
+ .answer = { 0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffffffffffp+50, IGNORED } },
+ .answer = { 0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000000p+51, IGNORED } },
+ .answer = { 0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000001p+51, IGNORED } },
+ .answer = { 0x1.0000000000002p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000002p+51, IGNORED } },
+ .answer = { 0x1.0000000000002p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000003p+51, IGNORED } },
+ .answer = { 0x1.0000000000004p+51, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffep+51, IGNORED } },
+ .answer = { 0x1.ffffffffffffep+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffffffffffp+51, IGNORED } },
+ .answer = { 0x1.0000000000000p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000000p+52, IGNORED } },
+ .answer = { 0x1.0000000000000p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000001p+52, IGNORED } },
+ .answer = { 0x1.0000000000001p+52, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000001p+52, IGNORED } },
+ .answer = { -0x1.0000000000001p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000000p+52, IGNORED } },
+ .answer = { -0x1.0000000000000p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffffffffffp+51, IGNORED } },
+ .answer = { -0x1.ffffffffffffep+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffep+51, IGNORED } },
+ .answer = { -0x1.ffffffffffffep+51, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000003p+51, IGNORED } },
+ .answer = { -0x1.0000000000002p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000002p+51, IGNORED } },
+ .answer = { -0x1.0000000000002p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000001p+51, IGNORED } },
+ .answer = { -0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000000p+51, IGNORED } },
+ .answer = { -0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffcp+50, IGNORED } },
+ .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffep+50, IGNORED } },
+ .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffdp+50, IGNORED } },
+ .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffcp+50, IGNORED } },
+ .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -1.00, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0.75, IGNORED } },
+ .answer = { -0.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0.50, IGNORED } },
+ .answer = { -0.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0.25, IGNORED } },
+ .answer = { -0.0, PASSTHROUGH } }
+};
+
+#include "sse4_1-round2.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c
new file mode 100644
index 0000000..cf1a039
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c
@@ -0,0 +1,95 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128
+#define FP_T float
+
+#define ROUND_INTRIN(x, y) _mm_ceil_ss (x, y)
+
+#include "sse4_1-round-data.h"
+
+static struct data2 data[] = {
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.00, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.25, IGNORED, IGNORED, IGNORED } },
+ .answer = { 1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.50, IGNORED, IGNORED, IGNORED } },
+ .answer = { 1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.75, IGNORED, IGNORED, IGNORED } },
+ .answer = { 1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffff8p+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffap+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffcp+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffep+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffap+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffcp+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffep+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.000000p+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffep+23, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffffep+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffep+23, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffffep+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffep+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffcp+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffap+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffff8p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffep+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffcp+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffap+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffff8p+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -1.00, IGNORED, IGNORED, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0.75, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0.50, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0.25, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }
+};
+
+#include "sse4_1-round2.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h
index 5f855b9..1633053 100644
--- a/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h
@@ -1,6 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
+/* Define this to enable the combination of VSX vector double and
+ SSE2 data types. */
+#define __VSX_SSE2__ 1
+
#include "m128-check.h"
//#define DEBUG 1
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c
new file mode 100644
index 0000000..ad21644
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128d
+#define FP_T double
+
+#define ROUND_INTRIN(x, mode) _mm_floor_pd (x)
+
+#include "sse4_1-round-data.h"
+
+static struct data data[] = {
+ { .value = { .f = { 0.00, 0.25 } }, .answer = { 0.0, 0.0 } },
+ { .value = { .f = { 0.50, 0.75 } }, .answer = { 0.0, 0.0 } },
+
+ { { .f = { 0x1.ffffffffffffcp+50, 0x1.ffffffffffffdp+50 } },
+ { 0x1.ffffffffffffcp+50, 0x1.ffffffffffffcp+50 } },
+ { { .f = { 0x1.ffffffffffffep+50, 0x1.0000000000000p+51 } },
+ { 0x1.ffffffffffffcp+50, 0x1.0000000000000p+51 } },
+ { { .f = { 0x1.0000000000000p+51, 0x1.0000000000001p+51 } },
+ { 0x1.0000000000000p+51, 0x1.0000000000000p+51 } },
+ { { .f = { 0x1.0000000000002p+51, 0x1.0000000000003p+51 } },
+ { 0x1.0000000000002p+51, 0x1.0000000000002p+51 } },
+
+ { { .f = { 0x1.ffffffffffffep+51, 0x1.fffffffffffffp+51 } },
+ { 0x1.ffffffffffffep+51, 0x1.ffffffffffffep+51 } },
+ { { .f = { 0x1.0000000000000p+52, 0x1.0000000000001p+52 } },
+ { 0x1.0000000000000p+52, 0x1.0000000000001p+52 } },
+
+ { { .f = { -0x1.0000000000001p+52, -0x1.0000000000000p+52 } },
+ { -0x1.0000000000001p+52, -0x1.0000000000000p+52 } },
+ { { .f = { -0x1.fffffffffffffp+51, -0x1.ffffffffffffep+52 } },
+ { -0x1.0000000000000p+52, -0x1.ffffffffffffep+52 } },
+
+ { { .f = { -0x1.0000000000003p+51, -0x1.0000000000002p+51 } },
+ { -0x1.0000000000004p+51, -0x1.0000000000002p+51 } },
+ { { .f = { -0x1.0000000000001p+51, -0x1.0000000000000p+51 } },
+ { -0x1.0000000000002p+51, -0x1.0000000000000p+51 } },
+ { { .f = { -0x1.fffffffffffffp+50, -0x1.ffffffffffffep+50 } },
+ { -0x1.0000000000000p+51, -0x1.0000000000000p+51 } },
+ { { .f = { -0x1.ffffffffffffdp+50, -0x1.ffffffffffffcp+50 } },
+ { -0x1.0000000000000p+51, -0x1.ffffffffffffcp+50 } },
+
+ { { .f = { -1.00, -0.75 } }, { -1.0, -1.0 } },
+ { { .f = { -0.50, -0.25 } }, { -1.0, -1.0 } }
+};
+
+#include "sse4_1-round.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
new file mode 100644
index 0000000..a53ef9a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128
+#define FP_T float
+
+#define ROUND_INTRIN(x, mode) _mm_floor_ps (x)
+
+#include "sse4_1-round-data.h"
+
+static struct data data[] = {
+ { { .f = { 0.00, 0.25, 0.50, 0.75 } }, { 0.0, 0.0, 0.0, 0.0 } },
+
+ { { .f = { 0x1.fffff8p+21, 0x1.fffffap+21,
+ 0x1.fffffcp+21, 0x1.fffffep+21 } },
+ { 0x1.fffff8p+21, 0x1.fffff8p+21,
+ 0x1.fffff8p+21, 0x1.fffff8p+21 } },
+
+ { { .f = { 0x1.fffffap+22, 0x1.fffffcp+22,
+ 0x1.fffffep+22, 0x1.fffffep+23 } },
+ { 0x1.fffff8p+22, 0x1.fffffcp+22,
+ 0x1.fffffcp+22, 0x1.fffffep+23 } },
+
+ { { .f = { -0x1.fffffep+23, -0x1.fffffep+22,
+ -0x1.fffffcp+22, -0x1.fffffap+22 } },
+ { -0x1.fffffep+23, -0x1.000000p+23,
+ -0x1.fffffcp+22, -0x1.fffffcp+22 } },
+
+ { { .f = { -0x1.fffffep+21, -0x1.fffffcp+21,
+ -0x1.fffffap+21, -0x1.fffff8p+21 } },
+ { -0x1.000000p+22, -0x1.000000p+22,
+ -0x1.000000p+22, -0x1.fffff8p+21 } },
+
+ { { .f = { -1.00, -0.75, -0.50, -0.25 } }, { -1.0, -1.0, -1.0, -1.0 } }
+};
+
+#include "sse4_1-round.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c
new file mode 100644
index 0000000..e4ebc55
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c
@@ -0,0 +1,119 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128d
+#define FP_T double
+
+#define ROUND_INTRIN(x, y) _mm_floor_sd (x, y)
+
+#include "sse4_1-round-data.h"
+
+static struct data2 data[] = {
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.00, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.25, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.50, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0.75, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffcp+50, IGNORED } },
+ .answer = { 0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffdp+50, IGNORED } },
+ .answer = { 0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffep+50, IGNORED } },
+ .answer = { 0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffffffffffp+50, IGNORED } },
+ .answer = { 0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000000p+51, IGNORED } },
+ .answer = { 0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000001p+51, IGNORED } },
+ .answer = { 0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000002p+51, IGNORED } },
+ .answer = { 0x1.0000000000002p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000003p+51, IGNORED } },
+ .answer = { 0x1.0000000000002p+51, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.ffffffffffffep+51, IGNORED } },
+ .answer = { 0x1.ffffffffffffep+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffffffffffp+51, IGNORED } },
+ .answer = { 0x1.ffffffffffffep+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000000p+52, IGNORED } },
+ .answer = { 0x1.0000000000000p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.0000000000001p+52, IGNORED } },
+ .answer = { 0x1.0000000000001p+52, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000001p+52, IGNORED } },
+ .answer = { -0x1.0000000000001p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000000p+52, IGNORED } },
+ .answer = { -0x1.0000000000000p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffffffffffp+51, IGNORED } },
+ .answer = { -0x1.0000000000000p+52, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffep+51, IGNORED } },
+ .answer = { -0x1.ffffffffffffep+51, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000003p+51, IGNORED } },
+ .answer = { -0x1.0000000000004p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000002p+51, IGNORED } },
+ .answer = { -0x1.0000000000002p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000001p+51, IGNORED } },
+ .answer = { -0x1.0000000000002p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.0000000000000p+51, IGNORED } },
+ .answer = { -0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffcp+50, IGNORED } },
+ .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffep+50, IGNORED } },
+ .answer = { -0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffdp+50, IGNORED } },
+ .answer = { -0x1.0000000000000p+51, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.ffffffffffffcp+50, IGNORED } },
+ .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -1.00, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0.75, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0.50, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+ .value2 = { .f = { -0.25, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH } }
+};
+
+#include "sse4_1-round2.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c
new file mode 100644
index 0000000..cfbfe2b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c
@@ -0,0 +1,95 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128
+#define FP_T float
+
+#define ROUND_INTRIN(x, y) _mm_floor_ss (x, y)
+
+#include "sse4_1-round-data.h"
+
+static struct data2 data[] = {
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.00, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.25, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.50, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0.75, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffff8p+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffap+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffcp+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffep+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffap+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffff8p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffcp+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffep+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { 0x1.fffffep+23, IGNORED, IGNORED, IGNORED } },
+ .answer = { 0x1.fffffep+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffep+23, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffffep+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffep+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.000000p+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffcp+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffap+22, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffep+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffcp+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffffap+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0x1.fffff8p+21, IGNORED, IGNORED, IGNORED } },
+ .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -1.00, IGNORED, IGNORED, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0.75, IGNORED, IGNORED, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0.50, IGNORED, IGNORED, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } },
+ .value2 = { .f = { -0.25, IGNORED, IGNORED, IGNORED } },
+ .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }
+};
+
+#include "sse4_1-round2.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-phminposuw.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-phminposuw.c
new file mode 100644
index 0000000..146df24
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-phminposuw.c
@@ -0,0 +1,68 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mvsx -Wno-psabi" } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+
+#define DIM(a) (sizeof (a) / sizeof (a)[0])
+
+static void
+TEST (void)
+{
+ union
+ {
+ __m128i x;
+ unsigned short s[8];
+ } src[] =
+ {
+ { .s = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 } },
+ { .s = { 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 } },
+ { .s = { 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff } },
+ { .s = { 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008 } },
+ { .s = { 0x0008, 0x0007, 0x0006, 0x0005, 0x0004, 0x0003, 0x0002, 0x0001 } },
+ { .s = { 0xfff4, 0xfff3, 0xfff2, 0xfff1, 0xfff3, 0xfff1, 0xfff2, 0xfff3 } }
+ };
+ unsigned short minVal[DIM (src)];
+ int minInd[DIM (src)];
+ unsigned short minValScalar, minIndScalar;
+ int i, j;
+ union
+ {
+ int si;
+ unsigned short s[2];
+ } res;
+
+ for (i = 0; i < DIM (src); i++)
+ {
+ res.si = _mm_cvtsi128_si32 (_mm_minpos_epu16 (src[i].x));
+ minVal[i] = res.s[0];
+ minInd[i] = res.s[1] & 0b111;
+ }
+
+ for (i = 0; i < DIM (src); i++)
+ {
+ minValScalar = src[i].s[0];
+ minIndScalar = 0;
+
+ for (j = 1; j < 8; j++)
+ if (minValScalar > src[i].s[j])
+ {
+ minValScalar = src[i].s[j];
+ minIndScalar = j;
+ }
+
+ if (minValScalar != minVal[i] && minIndScalar != minInd[i])
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ptest-1.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ptest-1.c
new file mode 100644
index 0000000..69d13d5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ptest-1.c
@@ -0,0 +1,117 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+
+static int
+make_ptestz (__m128i m, __m128i v)
+{
+ union
+ {
+ __m128i x;
+ unsigned char c[16];
+ } val, mask;
+ int i, z;
+
+ mask.x = m;
+ val.x = v;
+
+ z = 1;
+ for (i = 0; i < 16; i++)
+ if ((mask.c[i] & val.c[i]))
+ {
+ z = 0;
+ break;
+ }
+ return z;
+}
+
+static int
+make_ptestc (__m128i m, __m128i v)
+{
+ union
+ {
+ __m128i x;
+ unsigned char c[16];
+ } val, mask;
+ int i, c;
+
+ mask.x = m;
+ val.x = v;
+
+ c = 1;
+ for (i = 0; i < 16; i++)
+ if ((val.c[i] & ~mask.c[i]))
+ {
+ c = 0;
+ break;
+ }
+ return c;
+}
+
+static void
+TEST (void)
+{
+ union
+ {
+ __m128i x;
+ unsigned int i[4];
+ } val[4];
+ int i, j, l;
+ int res[32];
+
+ val[0].i[0] = 0x11111111;
+ val[0].i[1] = 0x00000000;
+ val[0].i[2] = 0x00000000;
+ val[0].i[3] = 0x11111111;
+
+ val[1].i[0] = 0x00000000;
+ val[1].i[1] = 0x11111111;
+ val[1].i[2] = 0x11111111;
+ val[1].i[3] = 0x00000000;
+
+ val[2].i[0] = 0;
+ val[2].i[1] = 0;
+ val[2].i[2] = 0;
+ val[2].i[3] = 0;
+
+ val[3].i[0] = 0xffffffff;
+ val[3].i[1] = 0xffffffff;
+ val[3].i[2] = 0xffffffff;
+ val[3].i[3] = 0xffffffff;
+
+ l = 0;
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 4; j++)
+ {
+ res[l++] = _mm_testz_si128 (val[j].x, val[i].x);
+ res[l++] = _mm_testc_si128 (val[j].x, val[i].x);
+ }
+
+ l = 0;
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 4; j++)
+ {
+ if (res[l++] != make_ptestz (val[j].x, val[i].x))
+ abort ();
+ if (res[l++] != make_ptestc (val[j].x, val[i].x))
+ abort ();
+ }
+
+ if (res[2] != _mm_testz_si128 (val[1].x, val[0].x))
+ abort ();
+
+ if (res[3] != _mm_testc_si128 (val[1].x, val[0].x))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h
new file mode 100644
index 0000000..543f5bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h
@@ -0,0 +1,20 @@
+/* Pick a few numbers at random which are not in the input data and
+ unlikely to show up naturally. */
+#define PASSTHROUGH -29.5
+#define IGNORED -61.5
+
+union value {
+ VEC_T x;
+ FP_T f[sizeof (VEC_T) / sizeof (FP_T)];
+};
+
+struct data {
+ union value value;
+ double answer[sizeof (VEC_T) / sizeof (FP_T)];
+};
+
+struct data2 {
+ union value value1;
+ union value value2;
+ double answer[sizeof (VEC_T) / sizeof (FP_T)];
+};
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h
new file mode 100644
index 0000000..3340909
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h
@@ -0,0 +1,27 @@
+#include <fenv.h>
+#include <smmintrin.h>
+#include "sse4_1-check.h"
+
+#define DIM(a) (sizeof (a) / sizeof (a)[0])
+
+static int modes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO };
+
+static void
+TEST (void)
+{
+ int i, j, ri, round_save;
+
+ round_save = fegetround ();
+ for (ri = 0; ri < DIM (modes); ri++) {
+ fesetround (modes[ri]);
+ for (i = 0; i < DIM (data); i++) {
+ union value guess;
+ guess.x = ROUND_INTRIN (data[i].value.x, /* Ignored. */);
+ for (j = 0; j < DIM (data[i].value.f); j++) {
+ if (guess.f[j] != data[i].answer[j])
+ abort ();
+ }
+ }
+ }
+ fesetround (round_save);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h
new file mode 100644
index 0000000..68a2fdc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h
@@ -0,0 +1,27 @@
+#include <fenv.h>
+#include <smmintrin.h>
+#include "sse4_1-check.h"
+
+#define DIM(a) (sizeof (a) / sizeof (a)[0])
+
+static int modes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO };
+
+static void
+TEST (void)
+{
+ int i, j, ri, round_save;
+
+ round_save = fegetround ();
+ for (ri = 0; ri < DIM (modes); ri++) {
+ fesetround (modes[ri]);
+ for (i = 0; i < DIM (data); i++) {
+ union value guess;
+ guess.x = ROUND_INTRIN (data[i].value1.x, data[i].value2.x);
+ for (j = 0; j < DIM (data[i].value1.f); j++) {
+ if (guess.f[j] != data[i].answer[j])
+ abort ();
+ }
+ }
+ }
+ fesetround (round_save);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c
new file mode 100644
index 0000000..cec1617
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+
+static void
+TEST (void)
+{
+ union128d u, s;
+ double e[2] = {0.0};
+ int i;
+
+ s.x = _mm_set_pd (1.1234, -2.3478);
+ u.x = _mm_floor_pd (s.x);
+
+ for (i = 0; i < 2; i++)
+ {
+ __m128d tmp = _mm_load_sd (&s.a[i]);
+ tmp = _mm_floor_sd (tmp, tmp);
+ _mm_store_sd (&e[i], tmp);
+ }
+
+ if (check_union128d (u, e))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c
new file mode 100644
index 0000000..88a5f07
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+
+static void
+TEST (void)
+{
+ union128d u, s;
+ double e[2] = {0.0};
+ int i;
+
+ s.x = _mm_set_pd (1.1234, -2.3478);
+ u.x = _mm_ceil_pd (s.x);
+
+ for (i = 0; i < 2; i++)
+ {
+ __m128d tmp = _mm_load_sd (&s.a[i]);
+ tmp = _mm_ceil_sd (tmp, tmp);
+ _mm_store_sd (&e[i], tmp);
+ }
+
+ if (check_union128d (u, e))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.c b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.c
new file mode 100644
index 0000000..dceb5b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test if unpack vectorization succeeds for type signed/unsigned
+ short and char. */
+
+#include "unpack-vectorize-1.h"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvupkhsb\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvupklsb\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvupkhsh\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvupklsh\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvmrghb\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvmrglb\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvmrghh\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mvmrglh\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.h b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.h
new file mode 100644
index 0000000..1cb89ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.h
@@ -0,0 +1,14 @@
+#include "unpack-vectorize.h"
+
+DEF_ARR (si)
+DEF_ARR (ui)
+DEF_ARR (sh)
+DEF_ARR (uh)
+DEF_ARR (sc)
+DEF_ARR (uc)
+
+TEST1 (sh, si)
+TEST1 (uh, ui)
+TEST1 (sc, sh)
+TEST1 (uc, uh)
+
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.c b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.c
new file mode 100644
index 0000000..4f2e6eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mdejagnu-cpu=power7 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test if unsigned int unpack vectorization succeeds. V2DImode is
+ supported since Power7 so guard it under Power7 and up. */
+
+#include "unpack-vectorize-2.h"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-assembler-times {\mxxmrghw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mxxmrglw\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.h b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.h
new file mode 100644
index 0000000..e199229
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.h
@@ -0,0 +1,7 @@
+#include "unpack-vectorize.h"
+
+DEF_ARR (ui)
+DEF_ARR (ull)
+
+TEST1 (ui, ull)
+
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.c b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.c
new file mode 100644
index 0000000..520a279
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mdejagnu-cpu=power8 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
+
+/* Test if signed int unpack vectorization succeeds. */
+
+#include "unpack-vectorize-3.h"
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-assembler-times {\mvupkhsw\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvupklsw\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.h b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.h
new file mode 100644
index 0000000..6a5191d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.h
@@ -0,0 +1,7 @@
+#include "unpack-vectorize.h"
+
+DEF_ARR (si)
+DEF_ARR (sll)
+
+TEST1 (si, sll)
+
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-1.c b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-1.c
new file mode 100644
index 0000000..51f0e67
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-1.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vmx_hw } */
+/* { dg-options "-maltivec -O2 -ftree-vectorize -fno-vect-cost-model" } */
+
+#include "unpack-vectorize-1.h"
+
+/* Test if unpack vectorization cases on signed/unsigned short and char
+ run successfully. */
+
+CHECK1 (sh, si)
+CHECK1 (uh, ui)
+CHECK1 (sc, sh)
+CHECK1 (uc, uh)
+
+int
+main ()
+{
+ check1_sh_si ();
+ check1_uh_ui ();
+ check1_sc_sh ();
+ check1_uc_uh ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-2.c b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-2.c
new file mode 100644
index 0000000..6d24360
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-2.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-mdejagnu-cpu=power7 -O2 -ftree-vectorize -fno-vect-cost-model" } */
+
+#include "unpack-vectorize-2.h"
+
+/* Test if unpack vectorization cases on unsigned int run successfully. */
+
+CHECK1 (ui, ull)
+
+int
+main ()
+{
+ check1_ui_ull ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-3.c b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-3.c
new file mode 100644
index 0000000..fec33c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-3.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-mdejagnu-cpu=power8 -O2 -ftree-vectorize -fno-vect-cost-model" } */
+
+#include "unpack-vectorize-3.h"
+
+/* Test if unpack vectorization cases on signed int run successfully. */
+
+CHECK1 (si, sll)
+
+int
+main ()
+{
+ check1_si_sll ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/unpack-vectorize.h b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize.h
new file mode 100644
index 0000000..11fa7d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/unpack-vectorize.h
@@ -0,0 +1,42 @@
+typedef signed long long sll;
+typedef unsigned long long ull;
+typedef signed int si;
+typedef unsigned int ui;
+typedef signed short sh;
+typedef unsigned short uh;
+typedef signed char sc;
+typedef unsigned char uc;
+
+#ifndef ALIGN
+#define ALIGN 32
+#endif
+
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
+
+#define N 128
+
+#define DEF_ARR(TYPE) \
+ TYPE TYPE##_a[N] ALIGN_ATTR; \
+ TYPE TYPE##_b[N] ALIGN_ATTR; \
+ TYPE TYPE##_c[N] ALIGN_ATTR;
+
+#define TEST1(NTYPE, WTYPE) \
+ __attribute__((noipa)) void test1_##NTYPE##_##WTYPE() { \
+ for (int i = 0; i < N; i++) \
+ WTYPE##_c[i] = NTYPE##_a[i] + NTYPE##_b[i]; \
+ }
+
+#define CHECK1(NTYPE, WTYPE) \
+ __attribute__((noipa, optimize(0))) void check1_##NTYPE##_##WTYPE() { \
+ for (int i = 0; i < N; i++) { \
+ NTYPE##_a[i] = 2 * i * sizeof(NTYPE) + 10; \
+ NTYPE##_b[i] = 7 * i * sizeof(NTYPE) / 5 - 10; \
+ } \
+ test1_##NTYPE##_##WTYPE(); \
+ for (int i = 0; i < N; i++) { \
+ WTYPE exp = NTYPE##_a[i] + NTYPE##_b[i]; \
+ if (WTYPE##_c[i] != exp) \
+ __builtin_abort(); \
+ } \
+ }
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor-run.c b/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor-run.c
new file mode 100644
index 0000000..987d6db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor-run.c
@@ -0,0 +1,124 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-O2 -mvsx" } */
+
+#include "vec-perm-ctor.h"
+
+#include <stdlib.h>
+
+int
+main ()
+{
+ du a_du = 100ULL;
+ du b_du = 200ULL;
+
+ di a_di = -100;
+ di b_di = 200;
+
+ df a_df = 10.0;
+ df b_df = 20.0;
+
+ si a_si = 12;
+ si b_si = -25;
+ si c_si = -37;
+ si d_si = 50;
+
+ sf a_sf = 30.0f;
+ sf b_sf = 40.0f;
+ sf c_sf = 50.0f;
+ sf d_sf = 60.0f;
+
+ hu a_hu = 10;
+ hu b_hu = 20;
+ hu c_hu = 30;
+ hu d_hu = 40;
+ hu e_hu = 50;
+ hu f_hu = 60;
+ hu g_hu = 70;
+ hu h_hu = 80;
+
+ qi a_qi = 10;
+ qi b_qi = 20;
+ qi c_qi = -30;
+ qi d_qi = 40;
+ qi e_qi = -50;
+ qi f_qi = 60;
+ qi g_qi = 70;
+ qi h_qi = -80;
+
+ v2du res1 = test_ctor_ctor_same_du (a_du, b_du);
+ if (res1[0] != a_du || res1[1] != b_du)
+ abort ();
+
+ v2df res2 = test_ctor_ctor_same_df (a_df, b_df);
+ if (res2[0] != a_df || res2[1] != b_df)
+ abort ();
+
+ v4si res3 = test_ctor_ctor_same_si (a_si, b_si, c_si, d_si);
+ if (res3[0] != a_si || res3[1] != b_si || res3[2] != c_si || res3[3] != d_si)
+ abort ();
+
+ v4sf res4 = test_ctor_ctor_same_sf (a_sf, b_sf, c_sf, d_sf);
+ if (res4[0] != a_sf || res4[1] != b_sf || res4[2] != c_sf || res4[3] != d_sf)
+ abort ();
+
+ v8hu res5
+ = test_ctor_ctor_same_hu (a_hu, b_hu, c_hu, d_hu, e_hu, f_hu, g_hu, h_hu);
+
+ if (res5[0] != a_hu || res5[1] != b_hu || res5[2] != c_hu || res5[3] != d_hu
+ || res5[4] != e_hu || res5[5] != f_hu || res5[6] != g_hu
+ || res5[7] != h_hu)
+ abort ();
+
+ v16qi res6
+ = test_ctor_ctor_same_qi (a_qi, b_qi, c_qi, d_qi, e_qi, f_qi, g_qi, h_qi);
+
+ if (res6[0] != a_qi || res6[1] != b_qi || res6[2] != c_qi || res6[3] != d_qi
+ || res6[4] != a_qi || res6[5] != b_qi || res6[6] != c_qi
+ || res6[7] != d_qi || res6[8] != e_qi || res6[9] != f_qi
+ || res6[10] != g_qi || res6[11] != h_qi || res6[12] != e_qi
+ || res6[13] != f_qi || res6[14] != g_qi || res6[15] != h_qi)
+ abort ();
+
+ v2du res7 = test_ctor_cst_same_du (a_du, b_du);
+ if (res7[0] != a_du || res7[1] != 100)
+ abort ();
+
+ v4sf res8 = test_ctor_cst_same_sf (a_sf, b_sf);
+ if (res8[0] != a_sf || res8[1] != 2.0f || res8[2] != b_sf || res8[3] != 4.0f)
+ abort ();
+
+ v2df res9 = test_ctor_cst_same_df (a_df, b_df);
+ if (res9[0] != b_df || res9[1] != 200.0)
+ abort ();
+
+ v4si res10 = test_cst_ctor_same_si (a_si, b_si);
+ if (res10[0] != 1 || res10[1] != 3 || res10[2] != a_si || res10[3] != b_si)
+ abort ();
+
+ v2di res11 = test_ctor_cst_diff_di_si (a_di, b_di);
+ /* Need to take care of the endianness since the function converts vector
+ const to one different vector type (element size), the endianness
+ determines the reinterpreted layout. Same reason for res12 below. */
+ if (res11[0] != -100 ||
+#ifdef __LITTLE_ENDIAN__
+ res11[1] != 3
+#else
+ res11[1] != 0x300000000LL
+#endif
+ )
+ abort ();
+
+ v2du res12 = test_cst_ctor_diff_sf_du (a_du, b_du);
+ if (
+#ifdef __LITTLE_ENDIAN__
+ res12[0] != 0x400000003f800000ULL
+#else
+ res12[0] != 0x3f80000040000000ULL
+#endif
+ || res12[1] != 100)
+ abort ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.c b/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.c
new file mode 100644
index 0000000..cc59e60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mvsx -fdump-tree-optimized" } */
+
+/* To test all permutations fed by CTOR and CST can be optimized away. */
+
+#include "vec-perm-ctor.h"
+
+/* { dg-final { scan-tree-dump-not "VIEW_CONVERT_EXPR" "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.h b/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.h
new file mode 100644
index 0000000..1878270
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vec-perm-ctor.h
@@ -0,0 +1,163 @@
+#include "altivec.h"
+
+typedef vector unsigned long long v2du;
+typedef vector signed long long v2di;
+typedef vector unsigned int v4su;
+typedef vector signed int v4si;
+typedef vector unsigned short v8hu;
+typedef vector signed short v8hi;
+typedef vector unsigned char v16qu;
+typedef vector signed char v16qi;
+typedef vector double v2df;
+typedef vector float v4sf;
+
+typedef unsigned long long du;
+typedef signed long long di;
+typedef unsigned int su;
+typedef signed int si;
+typedef unsigned short hu;
+typedef signed short hi;
+typedef unsigned char qu;
+typedef signed char qi;
+typedef double df;
+typedef float sf;
+
+/* To test whether we can optimize vector permutation away when
+ the two inputs are same type CTOR or one input is CTOR and the
+ other is CST. */
+
+/* CTOR + CTOR part (only same type supported). */
+
+/* Test both operands are same type CTOR (type unsigned long long). */
+__attribute__ ((noipa)) v2du
+test_ctor_ctor_same_du (du a, du b)
+{
+ v2du v1 = {a, 0};
+ v2du v2 = {b, 0};
+ v16qu vc = {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
+ v2du vres = (v2du) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* Test both operands are same type CTOR (type double). */
+__attribute__ ((noipa)) v2df
+test_ctor_ctor_same_df (df a, df b)
+{
+ v2df v1 = {0.0, a};
+ v2df v2 = {0.0, b};
+ v16qu vc = {8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31};
+ v2df vres = (v2df) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* Test both operands are same type CTOR (type signed int). */
+__attribute__ ((noipa)) v4si
+test_ctor_ctor_same_si (si a, si b, si c, si d)
+{
+ v4si v1 = {0, a, 0, c};
+ v4si v2 = {0, b, 0, d};
+ v16qu vc = {4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31};
+ v4si vres = (v4si) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* Test both operands are same type CTOR (type float). */
+__attribute__ ((noipa)) v4sf
+test_ctor_ctor_same_sf (sf a, sf b, sf c, sf d)
+{
+ v4sf v1 = {c, 0.0f, d, 0.0f};
+ v4sf v2 = {a, 0.0f, b, 0.0f};
+ v16qu vc = {16, 17, 18, 19, 24, 25, 26, 27, 0, 1, 2, 3, 8, 9, 10, 11};
+ v4sf vres = (v4sf) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* Test both operands are same type CTOR (type unsigned short). */
+__attribute__ ((noipa)) v8hu
+test_ctor_ctor_same_hu (hu a, hu b, hu c, hu d, hu e, hu f, hu g, hu h)
+{
+ v8hu v1 = {0, a, 0, b, 0, c, 0, d};
+ v8hu v2 = {0, e, 0, f, 0, g, 0, h};
+ v16qu vc = {2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31};
+ v8hu vres = (v8hu) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* Test both operands are same type CTOR (type signed char). */
+__attribute__ ((noipa)) v16qi
+test_ctor_ctor_same_qi (qi a, qi b, qi c, qi d, qi e, qi f, qi g, qi h)
+{
+ v16qi v1 = {0, a, 0, b, 0, c, 0, d, 0, a, 0, b, 0, c, 0, d};
+ v16qi v2 = {0, e, 0, f, 0, g, 0, h, 0, e, 0, f, 0, g, 0, h};
+ v16qu vc = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31};
+ v16qi vres = (v16qi) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* CTOR + CST part (same type). */
+
+__attribute__ ((noipa)) v2du
+test_ctor_cst_same_du (du a, du b)
+{
+ v2du v1 = {a, b};
+ v2du v2 = {100, 200};
+ v16qu vc = {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
+ v2du vres = (v2du) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+__attribute__ ((noipa)) v4sf
+test_ctor_cst_same_sf (sf a, sf b)
+{
+ v4sf v1 = {0.0f, a, 0.0f, b};
+ v4sf v2 = {1.0f, 2.0f, 3.0f, 4.0f};
+ v16qu vc = {4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31};
+ v4sf vres = (v4sf) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* CST + CTOR part (same type). */
+
+__attribute__ ((noipa)) v2df
+test_ctor_cst_same_df (df a, df b)
+{
+ v2df v1 = {a, b};
+ v2df v2 = {100.0, 200.0};
+ v16qu vc = {8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31};
+ v2df vres = (v2df) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+__attribute__ ((noipa)) v4si
+test_cst_ctor_same_si (si a, si b)
+{
+ v4si v1 = {a, 0, b, 0};
+ v4si v2 = {1, 2, 3, 4};
+ v16qu vc = {16, 17, 18, 19, 24, 25, 26, 27, 0, 1, 2, 3, 8, 9, 10, 11};
+ v4si vres = (v4si) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* CTOR + CST part (different types). */
+
+__attribute__ ((noipa)) v2di
+test_ctor_cst_diff_di_si (di a, di b)
+{
+ v2di v1 = {a, b};
+ v4si v2 = {3, 0, 4, 0};
+ v16qu vc = {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
+ v2di vres = (v2di) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
+
+/* CST + CTOR part (different types). */
+
+__attribute__ ((noipa)) v2du
+test_cst_ctor_diff_sf_du (du a, du b)
+{
+ v4sf v1 = {1.0f, 2.0f, 3.0f, 4.0f};
+ v2du v2 = {a, b};
+ v16qu vc = {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
+ v2du vres = (v2du) vec_perm ((v16qu) v1, (v16qu) v2, vc);
+ return vres;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c b/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c
index 1e7d739..6834733 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c
@@ -1,5 +1,5 @@
/* { dg-do compile }
-/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
#include <altivec.h>
@@ -62,6 +62,6 @@ rlnm_test_2 (vector unsigned long long x, vector unsigned long long y,
/* { dg-final { scan-assembler-times "vextsb2d" 1 } } */
/* { dg-final { scan-assembler-times "vslw" 1 } } */
/* { dg-final { scan-assembler-times "vsld" 1 } } */
-/* { dg-final { scan-assembler-times "xxlor" 3 } } */
+/* { dg-final { scan-assembler-times "xxlor" 4 } } */
/* { dg-final { scan-assembler-times "vrlwnm" 2 } } */
/* { dg-final { scan-assembler-times "vrldnm" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
index e84ce77..a135279 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
@@ -1,7 +1,7 @@
/* { dg-do run { target { power10_hw } } } */
/* { dg-do link { target { ! power10_hw } } } */
/* { dg-require-effective-target power10_ok } */
-/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps -O2" } */
#include <altivec.h>
#define DEBUG 0
@@ -12,6 +12,8 @@
extern void abort (void);
+volatile vector double vresult_d_undefined;
+
int
main (int argc, char *argv [])
{
@@ -85,25 +87,12 @@ main (int argc, char *argv [])
#endif
}
- /* This test will generate a "note" to the user that the argument
- is subnormal. It is not an error, but results are not defined. */
- vresult_d = (vector double) { 2.0, 3.0 };
- expected_vresult_d = (vector double) { 6.6E-42f, 6.6E-42f };
-
- vresult_d = vec_splatid (6.6E-42f);
-
- /* Although the instruction says the results are not defined, it does seem
- to work, at least on Mambo. But no guarentees! */
- if (!vec_all_eq (vresult_d, expected_vresult_d)) {
-#if DEBUG
- printf("ERROR, vec_splati (6.6E-42f)\n");
- for(i = 0; i < 2; i++)
- printf(" vresult_d[%i] = %e, expected_vresult_d[%i] = %e\n",
- i, vresult_d[i], i, expected_vresult_d[i]);
-#else
- ;
-#endif
- }
+ /* This test will generate a "note" to the user that the argument is
+ subnormal. It is not an error, but results are not defined. Because this
+ is undefined, we cannot check that any value is correct. Just store it in
+ a volatile variable so the XXSPLTIDP instruction gets generated and the
+ warning message printed. */
+ vresult_d_undefined = vec_splatid (6.6E-42f);
/* Vector splat immediate */
vsrc_a_int = (vector int) { 2, 3, 4, 5 };
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
index 0780b01..8841660 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
@@ -191,10 +191,11 @@ vector unsigned __int128 splat_uint128 (unsigned __int128 x) { return vec_splats
*/
/* { dg-final { scan-assembler-times {\mrldic\M} 0 { target { be && ilp32 } } } } */
-/* { dg-final { scan-assembler-times {\mrldic\M} 64 { target { be && lp64 } } } } */
-/* { dg-final { scan-assembler-times {\mrldic\M} 64 { target le } } } */
-/* { dg-final { scan-assembler-times "xxpermdi" 4 { target be } } } */
-/* { dg-final { scan-assembler-times "xxpermdi" 6 { target le } } } */
+/* { dg-final { scan-assembler-times {\mrldic\M} 65 { target { be && lp64 } } } } */
+/* { dg-final { scan-assembler-times {\mrldic\M} 65 { target le } } } */
+/* { dg-final { scan-assembler-times "xxpermdi" 33 { target be } } } */
+/* { dg-final { scan-assembler-times "xxpermdi" 35 { target le } } } */
/* { dg-final { scan-assembler-times "vspltisb" 2 } } */
/* { dg-final { scan-assembler-times "vspltish" 2 } } */
-/* { dg-final { scan-assembler-times "vspltisw" 2 } } */
+/* { dg-final { scan-assembler-times "vspltisw" 2 { target be } } } */
+/* { dg-final { scan-assembler-times "vspltisw" 23 { target le } } } */
diff --git a/gcc/testsuite/gcc.target/riscv/arch-12.c b/gcc/testsuite/gcc.target/riscv/arch-12.c
new file mode 100644
index 0000000..29e16c3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-12.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv64im1p2p3 -mabi=lp64" } */
+int foo() {}
+/* { dg-error "'-march=rv64im1p2p3': For 'm1p2p\\?', version number with more than 2 level is not supported." "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/riscv/attribute-19.c b/gcc/testsuite/gcc.target/riscv/attribute-19.c
new file mode 100644
index 0000000..18f68d9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/attribute-19.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mriscv-attribute -march=rv64imp0p9 -mabi=lp64" } */
+int foo() {}
+/* { dg-final { scan-assembler ".attribute arch, \"rv64i2p0_m2p0_p0p9\"" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/pr99702.c b/gcc/testsuite/gcc.target/riscv/pr99702.c
new file mode 100644
index 0000000..a28724c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/pr99702.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+char n;
+void *i, *j;
+void foo(void) {
+ __builtin_memcpy(i, j, n);
+}
diff --git a/gcc/testsuite/gcc.target/riscv/shift-shift-5.c b/gcc/testsuite/gcc.target/riscv/shift-shift-5.c
index 5b2ae89..0ecab97 100644
--- a/gcc/testsuite/gcc.target/riscv/shift-shift-5.c
+++ b/gcc/testsuite/gcc.target/riscv/shift-shift-5.c
@@ -7,7 +7,11 @@ unsigned long
sub (long l)
{
union u {
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
struct s { int a : 19; unsigned int b : 13; int x; } s;
+#else
+ struct s { int x; unsigned int b : 13; int a : 19; } s;
+#endif
long l;
} u;
u.l = l;
diff --git a/gcc/testsuite/gcc.target/s390/ashr.c b/gcc/testsuite/gcc.target/s390/ashr.c
new file mode 100644
index 0000000..8cffdfa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/ashr.c
@@ -0,0 +1,11 @@
+/* Test the arithmetic shift right pattern. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int e(void);
+
+int f (long c, int b)
+{
+ return (c >> b) && e ();
+}
diff --git a/gcc/testsuite/gcc.target/s390/call-z10-pic-nodatarel.c b/gcc/testsuite/gcc.target/s390/call-z10-pic-nodatarel.c
new file mode 100644
index 0000000..4998461
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/call-z10-pic-nodatarel.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 -mzarch -fPIC -mno-pic-data-is-text-relative" } */
+
+#include "call.h"
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo@PLT\n} } } */
+/* { dg-final { scan-assembler {lgrl\t%r2,foo@GOTENT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {lrl\t%r2,foo@GOTENT\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,fooweak@PLT\n} } } */
+/* { dg-final { scan-assembler {lgrl\t%r2,fooweak@GOTENT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {lrl\t%r2,fooweak@GOTENT\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {foos:\n\t.quad\tfoo\n\t.quad\tfoostatic\n\t.quad\tfooweak\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {foos:\n\t.long\tfoo\n\t.long\tfoostatic\n\t.long\tfooweak\n} { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/s390/call-z10-pic.c b/gcc/testsuite/gcc.target/s390/call-z10-pic.c
new file mode 100644
index 0000000..210c56c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/call-z10-pic.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 -mzarch -fPIC" } */
+
+#include "call.h"
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo@PLT\n} } } */
+/* { dg-final { scan-assembler {lgrl\t%r2,foo@GOTENT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {lrl\t%r2,foo@GOTENT\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,fooweak@PLT\n} } } */
+/* { dg-final { scan-assembler {lgrl\t%r2,fooweak@GOTENT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {lrl\t%r2,fooweak@GOTENT\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {foos:\n\t.quad\tfoo\n\t.quad\tfoostatic\n\t.quad\tfooweak\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {foos:\n\t.long\tfoo\n\t.long\tfoostatic\n\t.long\tfooweak\n} { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/s390/call-z10.c b/gcc/testsuite/gcc.target/s390/call-z10.c
new file mode 100644
index 0000000..2d7dc73
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/call-z10.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 -mzarch" } */
+
+#include "call.h"
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foo@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foo\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,fooweak\n} } } */
+/* { dg-final { scan-assembler {larl\t%r2,fooweak\n} } } */
+
+/* { dg-final { scan-assembler {foos:\n\t.quad\tfoo\n\t.quad\tfoostatic\n\t.quad\tfooweak\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {foos:\n\t.long\tfoo\n\t.long\tfoostatic\n\t.long\tfooweak\n} { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/s390/call-z9-pic-nodatarel.c b/gcc/testsuite/gcc.target/s390/call-z9-pic-nodatarel.c
new file mode 100644
index 0000000..b1ae318
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/call-z9-pic-nodatarel.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z9-ec -fPIC -mno-pic-data-is-text-relative" } */
+
+#include "call.h"
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo@PLT\n} } } */
+/* { dg-final { scan-assembler {larl\t%r\d+,foo@GOTENT\n} } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,fooweak@PLT\n} } } */
+/* { dg-final { scan-assembler {larl\t%r\d+,fooweak@GOTENT\n} } } */
+
+/* { dg-final { scan-assembler {foos:\n\t.quad\tfoo\n\t.quad\tfoostatic\n\t.quad\tfooweak\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {foos:\n\t.long\tfoo\n\t.long\tfoostatic\n\t.long\tfooweak\n} { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/s390/call-z9-pic.c b/gcc/testsuite/gcc.target/s390/call-z9-pic.c
new file mode 100644
index 0000000..a89e78d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/call-z9-pic.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z9-ec -fPIC" } */
+
+#include "call.h"
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo@PLT\n} } } */
+/* { dg-final { scan-assembler {larl\t%r\d+,foo@GOTENT\n} } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,fooweak@PLT\n} } } */
+/* { dg-final { scan-assembler {larl\t%r\d+,fooweak@GOTENT\n} } } */
+
+/* { dg-final { scan-assembler {foos:\n\t.quad\tfoo\n\t.quad\tfoostatic\n\t.quad\tfooweak\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {foos:\n\t.long\tfoo\n\t.long\tfoostatic\n\t.long\tfooweak\n} { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/s390/call-z9.c b/gcc/testsuite/gcc.target/s390/call-z9.c
new file mode 100644
index 0000000..21d035a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/call-z9.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z9-ec" } */
+
+#include "call.h"
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foo\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foo@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foo\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {brasl\t%r\d+,foostatic\n} { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic@PLT\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {larl\t%r2,foostatic\n} { target { ! lp64 } } } } */
+
+/* { dg-final { scan-assembler {brasl\t%r\d+,fooweak\n} } } */
+/* { dg-final { scan-assembler {larl\t%r2,fooweak\n} } } */
+
+/* { dg-final { scan-assembler {foos:\n\t.quad\tfoo\n\t.quad\tfoostatic\n\t.quad\tfooweak\n} { target lp64 } } } */
+/* { dg-final { scan-assembler {foos:\n\t.long\tfoo\n\t.long\tfoostatic\n\t.long\tfooweak\n} { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/s390/call.h b/gcc/testsuite/gcc.target/s390/call.h
new file mode 100644
index 0000000..059a672
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/call.h
@@ -0,0 +1,40 @@
+/* Common code for testing the function call code generation. */
+
+__attribute__ ((noipa)) void
+foo (void)
+{
+ return;
+}
+
+void *
+usefoo (void)
+{
+ foo ();
+ return foo;
+}
+
+__attribute__ ((noipa)) static void
+foostatic (void)
+{
+ return;
+}
+
+void *
+usefoostatic (void)
+{
+ foostatic ();
+ return foostatic;
+}
+
+__attribute__ ((weak)) void fooweak (void);
+
+void *
+usefooweak (void)
+{
+ fooweak ();
+ return fooweak;
+}
+
+__attribute__ ((__used__, section (".foos"), aligned (sizeof (void *))))
+static void
+*foos[] = { foo, foostatic, fooweak };
diff --git a/gcc/testsuite/gcc.target/s390/global-array-element-pic2.c b/gcc/testsuite/gcc.target/s390/global-array-element-pic2.c
index 72b87d4..0ee1084 100644
--- a/gcc/testsuite/gcc.target/s390/global-array-element-pic2.c
+++ b/gcc/testsuite/gcc.target/s390/global-array-element-pic2.c
@@ -1,6 +1,6 @@
/* Test accesses to global array elements in PIC code. */
/* { dg-do compile } */
-/* { dg-options "-O1 -march=z10 -fPIC" } */
+/* { dg-options "-O1 -march=z10 -mzarch -fPIC" } */
extern char a[] __attribute__ ((aligned (2)));
extern char *b;
@@ -8,6 +8,7 @@ extern char *b;
void c()
{
b = a + 4;
- /* { dg-final { scan-assembler "(?n)\n\tlgrl\t%r\\d+,a@GOTENT\n" } } */
+ /* { dg-final { scan-assembler "(?n)\n\tlgrl\t%r\\d+,a@GOTENT\n" { target lp64 } } } */
+ /* { dg-final { scan-assembler "(?n)\n\tlrl\t%r\\d+,a@GOTENT\n" { target { ! lp64 } } } } */
/* { dg-final { scan-assembler-not "(?n)\n\tlarl\t%r\\d+,a\[^@\]" } } */
}
diff --git a/gcc/testsuite/gcc.target/s390/load-imm64-1.c b/gcc/testsuite/gcc.target/s390/load-imm64-1.c
index 03d17f5..8e812f2 100644
--- a/gcc/testsuite/gcc.target/s390/load-imm64-1.c
+++ b/gcc/testsuite/gcc.target/s390/load-imm64-1.c
@@ -4,10 +4,10 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z9-109" } */
-unsigned long
+unsigned long long
magic (void)
{
- return 0x3f08c5392f756cd;
+ return 0x3f08c5392f756cdULL;
}
/* { dg-final { scan-assembler-times {\n\tllihf\t} 1 { target lp64 } } } */
diff --git a/gcc/testsuite/gcc.target/s390/load-imm64-2.c b/gcc/testsuite/gcc.target/s390/load-imm64-2.c
index ee0ff3b..c3536b4 100644
--- a/gcc/testsuite/gcc.target/s390/load-imm64-2.c
+++ b/gcc/testsuite/gcc.target/s390/load-imm64-2.c
@@ -4,10 +4,10 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z10" } */
-unsigned long
+unsigned long long
magic (void)
{
- return 0x3f08c5392f756cd;
+ return 0x3f08c5392f756cdULL;
}
/* { dg-final { scan-assembler-times {\n\tllihf\t} 1 { target lp64 } } } */
diff --git a/gcc/testsuite/gcc.target/s390/mfentry-m64-pic.c b/gcc/testsuite/gcc.target/s390/mfentry-m64-pic.c
new file mode 100644
index 0000000..32d55ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/mfentry-m64-pic.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-pg -mfentry -fPIC" } */
+
+void
+profileme (void)
+{
+ /* __fentry__ must be referenced through PLT. */
+ /* { dg-final { scan-assembler "brasl\t0,__fentry__@PLT\n" } } */
+}
diff --git a/gcc/testsuite/gcc.target/s390/mnop-mcount-m31-mzarch.c b/gcc/testsuite/gcc.target/s390/mnop-mcount-m31-mzarch.c
index b2ad9f5b..874ceb9 100644
--- a/gcc/testsuite/gcc.target/s390/mnop-mcount-m31-mzarch.c
+++ b/gcc/testsuite/gcc.target/s390/mnop-mcount-m31-mzarch.c
@@ -4,5 +4,5 @@
void
profileme (void)
{
- /* { dg-final { scan-assembler "NOPs for -mnop-mcount \\(10 halfwords\\)\n.*brcl\t0,0\n.*brcl\t0,0\n.*brcl\t0,0\n.*bcr\t0,0" } } */
+ /* { dg-final { scan-assembler "NOPs for -mnop-mcount \\(7 halfwords\\)\n.*brcl\t0,0\n.*brcl\t0,0\n.*bcr\t0,0" } } */
}
diff --git a/gcc/testsuite/gcc.target/s390/mnop-mcount-m64.c b/gcc/testsuite/gcc.target/s390/mnop-mcount-m64.c
index c0e3c4e..0d45834 100644
--- a/gcc/testsuite/gcc.target/s390/mnop-mcount-m64.c
+++ b/gcc/testsuite/gcc.target/s390/mnop-mcount-m64.c
@@ -4,5 +4,5 @@
void
profileme (void)
{
- /* { dg-final { scan-assembler "NOPs for -mnop-mcount \\(12 halfwords\\)\n.*brcl\t0,0\n.*brcl\t0,0\n.*brcl\t0,0\n.*brcl\t0,0" } } */
+ /* { dg-final { scan-assembler "NOPs for -mnop-mcount \\(9 halfwords\\)\n.*brcl\t0,0\n.*brcl\t0,0\n.*brcl\t0,0" } } */
}
diff --git a/gcc/testsuite/gcc.target/s390/nodatarel-1.c b/gcc/testsuite/gcc.target/s390/nodatarel-1.c
index f53332f..02e64c3 100644
--- a/gcc/testsuite/gcc.target/s390/nodatarel-1.c
+++ b/gcc/testsuite/gcc.target/s390/nodatarel-1.c
@@ -15,12 +15,6 @@ foo ()
return a;
}
-static int __attribute__((noinline,noclone))
-foostatic (void)
-{
- return a;
-}
-
/* Just to make a potentially modified. */
void
@@ -29,7 +23,7 @@ bar (int b)
a = b;
}
-/* { dg-final { scan-assembler-times "\\.LANCHOR\\d+@GOTENT" 3 } } */
+/* { dg-final { scan-assembler-times "\\.LANCHOR\\d+@GOTENT" 2 } } */
/* The exrl target is a label_ref which should not be affected at
all. */
@@ -63,21 +57,3 @@ fooptr ()
}
/* { dg-final { scan-assembler-times "foo@GOTENT" 1 } } */
-
-
-/* A static function can be addressed relatively. */
-
-int
-callfoostatic ()
-{
- return foostatic ();
-}
-
-void *
-foostaticptr ()
-{
- return &foostatic;
-}
-
-
-/* { dg-final { scan-assembler-not "foostatic@" } } */
diff --git a/gcc/testsuite/gcc.target/s390/oscbreak-1.c b/gcc/testsuite/gcc.target/s390/oscbreak-1.c
index fdf356c..0c61253 100644
--- a/gcc/testsuite/gcc.target/s390/oscbreak-1.c
+++ b/gcc/testsuite/gcc.target/s390/oscbreak-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -mtune=z13 -dp" } */
+/* { dg-options "-O1 -mtune=z13 -fschedule-insns -dp" } */
void
foo (char *a, int b)
@@ -10,6 +10,7 @@ foo (char *a, int b)
a[i] += 1;
}
+/* We should not unconditionally emit an osc_break here. */
void
bar (char *a, int b)
{
@@ -22,4 +23,4 @@ bar (char *a, int b)
}
}
-/* { dg-final { scan-assembler "osc_break" } } */
+/* { dg-final { scan-assembler-times "osc_break" 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/pr80080-4.c b/gcc/testsuite/gcc.target/s390/pr80080-4.c
index 5fc6a55..3f16a19 100644
--- a/gcc/testsuite/gcc.target/s390/pr80080-4.c
+++ b/gcc/testsuite/gcc.target/s390/pr80080-4.c
@@ -13,4 +13,4 @@ void foo4(int *mem)
}
}
-/* { dg-final { scan-assembler {(?n)\n\tlt\t.*\n\tjne\t(\.L\d+)\n(.*\n)*\tcs\t.*\n\tber\t%r14\n\1:\n\tjg\tbar\n} } } */
+/* { dg-final { scan-assembler {(?n)\n\tlt\t.*\n\tjne\t(\.L\d+)\n(.*\n)*\tcs\t.*\n\tber\t%r14\n\1:\n\tjg\tbar(@PLT)?\n} } } */
diff --git a/gcc/testsuite/gcc.target/s390/pr99663.c b/gcc/testsuite/gcc.target/s390/pr99663.c
new file mode 100644
index 0000000..f4f0f94
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr99663.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=z15 -march=z13 -mzarch -O2 -fno-stack-protector -fPIC" } */
+
+typedef struct {
+ int exponent;
+ unsigned short lsu[];
+} decNumber;
+decNumber decDivideOp_lhs;
+short decDivideOp_varbuff;
+void decDivideOp(decNumber *rhs) {
+ short *msu1;
+ int exponent;
+ unsigned short *source;
+ for (; source >= decDivideOp_lhs.lsu; source--, msu1--)
+ *msu1 = *source;
+ for (;;)
+ if (exponent)
+ if (decDivideOp_varbuff)
+ exponent = rhs->exponent;
+}
diff --git a/gcc/testsuite/gcc.target/s390/risbg-ll-3.c b/gcc/testsuite/gcc.target/s390/risbg-ll-3.c
index 90d37f2..02f6e04 100644
--- a/gcc/testsuite/gcc.target/s390/risbg-ll-3.c
+++ b/gcc/testsuite/gcc.target/s390/risbg-ll-3.c
@@ -23,7 +23,7 @@ i64 f1 (i64 v_a, i64 v_b)
extern i64 f2_foo();
i64 f2 (i64 v_a, i64 v_b)
{
-/* { dg-final { scan-assembler "f2:\n\trisbg\t%r2,%r3,60,62,0\n\tbner\t%r14\n\tjg\tf2_foo\n" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "f2:\n\trisbg\t%r2,%r3,60,62,0\n\tbner\t%r14\n\tjg\tf2_foo.*\n" { target { lp64 } } } } */
/* { dg-final { scan-assembler "f2:\n\trisbgn\t%r3,%r2,0,0\\\+32-1,64-0-32\n\trisbg\t%r3,%r5,60,62,0" { target { ! lp64 } } } } */
i64 v_anda = v_a & -15;
i64 v_andb = v_b & 14;
@@ -37,8 +37,8 @@ i64 f2 (i64 v_a, i64 v_b)
void f2_bar ();
void f2_cconly (i64 v_a, i64 v_b)
{
-/* { dg-final { scan-assembler "f2_cconly:\n\trisbg\t%r3,%r2,63,59,0\n\tber\t%r14\n\tjg\tf2_bar\n" { target { lp64 } } } } */
-/* { dg-final { scan-assembler "f2_cconly:\n\trisbgn\t%r3,%r2,0,0\\\+32-1,64-0-32\n\trisbg\t%r3,%r5,60,62,0\n\tber\t%r14\n\tjg\tf2_bar\n" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "f2_cconly:\n\trisbg\t%r2,%r3,60,62,0\n\tber\t%r14\n\tjg\tf2_bar(@PLT)?\n" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "f2_cconly:\n\trisbgn\t%r3,%r2,0,0\\\+32-1,64-0-32\n\trisbg\t%r3,%r5,60,62,0\n\tber\t%r14\n\tjg\tf2_bar(@PLT)?\n" { target { ! lp64 } } } } */
if ((v_a & -15) | (v_b & 14))
f2_bar();
}
diff --git a/gcc/testsuite/gcc.target/s390/tls-pic.c b/gcc/testsuite/gcc.target/s390/tls-pic.c
new file mode 100644
index 0000000..17c5726
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/tls-pic.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fPIC" } */
+
+#include "tls.h"
+
+/* foo must use the global dynamic model.
+ __tls_get_offset must be referenced through PLT. */
+
+/* { dg-final { scan-assembler-times {\tbrasl\t%r14,__tls_get_offset@PLT:tls_gdcall:foo\n} 1 } } */
+
+/* foostatic must use the local dynamic model.
+ __tls_get_offset must be referenced through PLT. */
+
+/* { dg-final { scan-assembler-times {\tbrasl\t%r14,__tls_get_offset@PLT:tls_ldcall} 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/tls.c b/gcc/testsuite/gcc.target/s390/tls.c
new file mode 100644
index 0000000..3d479d8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/tls.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include "tls.h"
+
+/* foo must use the initial-exec model, foostatic must use the local-exec
+ model. */
+
+/* { dg-final { scan-assembler-times {\tear} 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\tear} 2 { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/s390/tls.h b/gcc/testsuite/gcc.target/s390/tls.h
new file mode 100644
index 0000000..f639bd3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/tls.h
@@ -0,0 +1,23 @@
+/* Common code for testing the TLS code generation. */
+
+__thread int
+foo;
+
+int
+setfoo (int x)
+{
+ int result = foo;
+ foo = x;
+ return result;
+}
+
+static __thread int
+foostatic;
+
+int
+setfoostatic (int x)
+{
+ int result = foostatic;
+ foostatic = x;
+ return result;
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c
new file mode 100644
index 0000000..f9f2d12
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+xsqrt (long double x)
+{
+ long double res;
+ asm("sqxbr\t%0,%1" : "=f"(res) : "f"(x));
+ return res;
+}
+
+/* Check that the generated code is very small and straightforward. In
+ particular, there must be no unnecessary copying and no stack frame. */
+/* { dg-final { scan-assembler {\n\tld\t[^\n]*\n\tld\t[^\n]*\n(#[^\n]*\n)*\tsqxbr\t.*\n(#[^\n]*\n)*\tstd\t[^\n]*\n\tstd\t[^\n]*\n\tbr\t%r14\n} } } */
+
+int
+main (void)
+{
+ long double res, x = 0x1.0000000000001p+0L,
+ exp = 1.00000000000000011102230246251564788e+0L;
+ res = xsqrt (x);
+ assert (res == exp);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c
new file mode 100644
index 0000000..a89dd46
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+sqxbr (long double x)
+{
+ register long double in asm("f0") = x;
+ register long double out asm("f1");
+
+ asm("sqxbr\t%0,%1" : "=f"(out) : "f"(in));
+ asm("# %0" : "+f"(out));
+
+ return out;
+}
+
+/* Ideally `vmrlg %v3,%v1,%v3` should be optimized away, but the compiler
+ * can't do it, because the UNSPEC pattern operates on the whole register.
+ * Using the SUBREG pattern solves this problem, but it's fragile.
+ */
+/* { dg-final { scan-assembler-times {\n\tvmrlg\t%v2,%v0,%v2\n} 1 } } */
+/* { dg-final { scan-assembler-times {\n\tvmrhg\t%v1,%v1,%v3\n} 2 } } */
+/* { dg-final { scan-assembler-times {\n\tvmrlg\t%v3,%v1,%v3\n} 1 } } */
+
+int
+main (void)
+{
+ long double x = 0x1.0000000000001p+0L,
+ exp = 1.00000000000000011102230246251564788e+0L;
+ assert (sqxbr (x) == exp);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c
new file mode 100644
index 0000000..dd894c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+sqxbr (long double x)
+{
+ register long double inout asm("f4") = x;
+
+ asm("sqxbr\t%0,%0" : "+f"(inout));
+ asm("# %0" : "+f"(inout));
+
+ return inout;
+}
+
+/* Ideally there should be just one `vmrlg %v6,%v4,%v6`, but the compiler
+ * can't optimize it away, because the UNSPEC pattern operates on the whole
+ * register. Using the SUBREG pattern solves this problem, but it's fragile.
+ */
+/* { dg-final { scan-assembler-times {\n\tvmrlg\t%v6,%v4,%v6\n} 2 } } */
+/* { dg-final { scan-assembler-times {\n\tvmrhg\t%v4,%v4,%v6\n} 2 } } */
+
+int
+main (void)
+{
+ long double x = 0x1.0000000000001p+0L,
+ exp = 1.00000000000000011102230246251564788e+0L;
+ assert (sqxbr (x) == exp);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-off-on.c b/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-off-on.c
index 2d67679..513912e 100644
--- a/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-off-on.c
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-off-on.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target target_attribute } */
-/* { dg-options "-march=z14" } */
+/* { dg-options "-march=z14 -mzarch" } */
#if !defined(__LONG_DOUBLE_VX__)
#error
#endif
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-on-off.c b/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-on-off.c
index 6f26431..6b3cb32 100644
--- a/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-on-off.c
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-vx-macro-on-off.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target target_attribute } */
-/* { dg-options "-march=z13" } */
+/* { dg-options "-march=z13 -mzarch" } */
#if defined(__LONG_DOUBLE_VX__)
#error
#endif
diff --git a/gcc/testsuite/gcc.target/s390/vector/perm-merge.c b/gcc/testsuite/gcc.target/s390/vector/perm-merge.c
new file mode 100644
index 0000000..51b23dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/perm-merge.c
@@ -0,0 +1,104 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -march=z14 -mzvector --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+
+/* { dg-final { scan-assembler-times "\tvmrhb\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrlb\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrhh\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrlh\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrhf\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrlf\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrhg\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrlg\t" 3 } } */
+
+#include "vec-types.h"
+
+#define GEN_MERGE_2(VEC_TYPE, HILO, A) \
+ VEC_TYPE __attribute__((noinline)) \
+ merge_##HILO##_##VEC_TYPE(VEC_TYPE a, VEC_TYPE b) { \
+ return (VEC_TYPE){ a[0+A], b[0+A] }; }
+
+#define GEN_MERGE_4(VEC_TYPE, HILO, A) \
+ VEC_TYPE __attribute__((noinline)) \
+ merge_##HILO##_##VEC_TYPE(VEC_TYPE a, VEC_TYPE b) { \
+ return (VEC_TYPE){ a[0+A], b[0+A], a[1+A], b[1+A] }; }
+
+#define GEN_MERGE_8(VEC_TYPE, HILO, A) \
+ VEC_TYPE __attribute__((noinline)) \
+ merge_##HILO##_##VEC_TYPE(VEC_TYPE a, VEC_TYPE b) { \
+ return (VEC_TYPE){ a[0+A], b[0+A], a[1+A], b[1+A], a[2+A], b[2+A], a[3+A], b[3+A] }; }
+
+#define GEN_MERGE_16(VEC_TYPE, HILO, A) \
+ VEC_TYPE __attribute__((noinline)) \
+ merge_##HILO##_##VEC_TYPE(VEC_TYPE a, VEC_TYPE b) { \
+ return (VEC_TYPE){ a[0+A], b[0+A], a[1+A], b[1+A], a[2+A], b[2+A], a[3+A], b[3+A], \
+ a[4+A], b[4+A], a[5+A], b[5+A], a[6+A], b[6+A], a[7+A], b[7+A]}; }
+
+
+GEN_MERGE_16(v16qi, l, 8)
+GEN_MERGE_16(v16qi, h, 0)
+GEN_MERGE_16(uv16qi, l, 8)
+GEN_MERGE_16(uv16qi, h, 0)
+
+GEN_MERGE_8(v8hi, l, 4)
+GEN_MERGE_8(v8hi, h, 0)
+GEN_MERGE_8(uv8hi, l, 4)
+GEN_MERGE_8(uv8hi, h, 0)
+
+GEN_MERGE_4(v4si, l, 2)
+GEN_MERGE_4(v4si, h, 0)
+GEN_MERGE_4(uv4si, l, 2)
+GEN_MERGE_4(uv4si, h, 0)
+
+GEN_MERGE_4(v4sf, l, 2)
+GEN_MERGE_4(v4sf, h, 0)
+
+GEN_MERGE_2(v2di, l, 1)
+GEN_MERGE_2(v2di, h, 0)
+GEN_MERGE_2(uv2di, l, 1)
+GEN_MERGE_2(uv2di, h, 0)
+
+GEN_MERGE_2(v2df, l, 1)
+GEN_MERGE_2(v2df, h, 0)
+
+
+#define CHECK_MERGE_LO(VEC_TYPE, SRC1, SRC2) \
+ { \
+ VEC_TYPE v = merge_l_##VEC_TYPE ((SRC1), (SRC2)); \
+ int elts = sizeof(v) / sizeof(v[0]); \
+ for (int i = 0; i < elts; i++) \
+ if (v[i] != (i + elts) / 2 + (i % 2) * elts) \
+ __builtin_abort(); \
+ }
+
+#define CHECK_MERGE_HI(VEC_TYPE, SRC1, SRC2) \
+ { \
+ VEC_TYPE v = merge_h_##VEC_TYPE ((SRC1), (SRC2)); \
+ int elts = sizeof(v) / sizeof(v[0]); \
+ for (int i = 0; i < elts; i++) \
+ if (v[i] != i / 2 + (i % 2) * elts) \
+ __builtin_abort(); \
+ }
+
+#define CHECK_MERGE(VEC_TYPE) \
+ { \
+ VEC_TYPE a = GEN_SEQ_VEC (VEC_TYPE, 0); \
+ VEC_TYPE b = GEN_SEQ_VEC (VEC_TYPE, sizeof(VEC_TYPE) / sizeof(a[0])); \
+ CHECK_MERGE_LO (VEC_TYPE, a, b); \
+ CHECK_MERGE_HI (VEC_TYPE, a, b); \
+ }
+
+int
+main ()
+{
+ CHECK_MERGE(v16qi);
+ CHECK_MERGE(uv16qi);
+ CHECK_MERGE(v8hi);
+ CHECK_MERGE(uv8hi);
+ CHECK_MERGE(v4si);
+ CHECK_MERGE(uv4si);
+ CHECK_MERGE(v4sf);
+ CHECK_MERGE(v2di);
+ CHECK_MERGE(uv2di);
+ CHECK_MERGE(v2df);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/perm-vpdi.c b/gcc/testsuite/gcc.target/s390/vector/perm-vpdi.c
new file mode 100644
index 0000000..cc92531
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/perm-vpdi.c
@@ -0,0 +1,49 @@
+/* { dg-do run { target { s390*-*-* } } } */
+/* { dg-options "-O3 -mzarch -march=z14 -mzvector --save-temps" } */
+
+/* { dg-final { scan-assembler-times "\tvmrhg\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrlg\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvpdi\t" 6 } } */
+
+#include "vec-types.h"
+#include <vecintrin.h>
+
+#define GEN_PERMI_BITS(VEC_TYPE, BITS) \
+ VEC_TYPE __attribute__((noinline)) \
+ permi_##BITS##_##VEC_TYPE(VEC_TYPE a, VEC_TYPE b) { \
+ return (VEC_TYPE){a[((BITS) & 2) >> 1], b[(BITS) & 1] }; }
+
+#define GEN_PERMI(VEC_TYPE) \
+ GEN_PERMI_BITS(VEC_TYPE, 0); \
+ GEN_PERMI_BITS(VEC_TYPE, 1); \
+ GEN_PERMI_BITS(VEC_TYPE, 2); \
+ GEN_PERMI_BITS(VEC_TYPE, 3); \
+
+GEN_PERMI(v2di)
+GEN_PERMI(uv2di)
+GEN_PERMI(v2df)
+
+
+#define CHECK_PERMI_BITS(VEC_TYPE, BITS) \
+ VEC_TYPE r##BITS = permi_##BITS##_##VEC_TYPE (a, b); \
+ if (r##BITS[0] != ((BITS) & 2) >> 1 \
+ || r##BITS[1] != ((BITS) & 1) + 2) \
+ __builtin_abort();
+
+#define CHECK_PERMI(VEC_TYPE) \
+ { \
+ VEC_TYPE a = GEN_SEQ_VEC (VEC_TYPE, 0); \
+ VEC_TYPE b = GEN_SEQ_VEC (VEC_TYPE, 2); \
+ CHECK_PERMI_BITS (VEC_TYPE, 0); \
+ CHECK_PERMI_BITS (VEC_TYPE, 1); \
+ CHECK_PERMI_BITS (VEC_TYPE, 2); \
+ CHECK_PERMI_BITS (VEC_TYPE, 3); \
+ }
+
+int
+main ()
+{
+ CHECK_PERMI (v2di);
+ CHECK_PERMI (uv2di);
+ CHECK_PERMI (v2df);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c
new file mode 100644
index 0000000..015bc8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c
@@ -0,0 +1,41 @@
+/* Check for vectorization of mixed conditionals. */
+/* { dg-do compile { target { s390*-*-* } } } */
+/* { dg-options "-O2 -march=z14 -mzarch -ftree-vectorize -fdump-tree-vect-details" } */
+
+double xd[1024];
+double zd[1024];
+double wd[1024];
+
+long xl[1024];
+long zl[1024];
+long wl[1024];
+
+void foold ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zd[i] = xl[i] ? zd[i] : wd[i];
+}
+
+void foodl ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zl[i] = xd[i] ? zl[i] : wl[i];
+}
+
+void foold2 ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zd[i] = (xd[i] > 0) ? zd[i] : wd[i];
+}
+
+void foold3 ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zd[i] = (xd[i] > 0. & wd[i] < 0.) ? zd[i] : wd[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c
new file mode 100644
index 0000000..ba40ffe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c
@@ -0,0 +1,41 @@
+/* Check for vectorization of mixed conditionals. */
+/* { dg-do compile { target { s390*-*-* } } } */
+/* { dg-options "-O2 -march=z14 -mzarch -ftree-vectorize -fdump-tree-vect-details" } */
+
+float xf[1024];
+float zf[1024];
+float wf[1024];
+
+int xi[1024];
+int zi[1024];
+int wi[1024];
+
+void fooif ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zf[i] = xi[i] ? zf[i] : wf[i];
+}
+
+void foofi ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zi[i] = xf[i] ? zi[i] : wi[i];
+}
+
+void fooif2 ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zf[i] = (xf[i] > 0) ? zf[i] : wf[i];
+}
+
+void fooif3 ()
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ zf[i] = (xf[i] > 0.f & wf[i] < 0.f) ? zf[i] : wf[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-types.h b/gcc/testsuite/gcc.target/s390/vector/vec-types.h
new file mode 100644
index 0000000..b7ffbe7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/vec-types.h
@@ -0,0 +1,35 @@
+#ifndef VEC_TYPES_H
+#define VEC_TYPES_H 1
+
+typedef __attribute__((vector_size(16))) signed char v16qi;
+typedef __attribute__((vector_size(16))) unsigned char uv16qi;
+
+typedef __attribute__((vector_size(16))) signed short v8hi;
+typedef __attribute__((vector_size(16))) unsigned short uv8hi;
+
+typedef __attribute__((vector_size(16))) signed int v4si;
+typedef __attribute__((vector_size(16))) unsigned int uv4si;
+
+typedef __attribute__((vector_size(16))) signed long long v2di;
+typedef __attribute__((vector_size(16))) unsigned long long uv2di;
+
+#if __SIZEOF_INT128__ == 16
+typedef __attribute__((vector_size(16))) __int128_t v1ti;
+#endif
+
+typedef __attribute__((vector_size(16))) double v2df;
+typedef __attribute__((vector_size(16))) long double v1tf;
+
+#if __ARCH__ >= 12
+typedef __attribute__((vector_size(16))) float v4sf;
+#endif
+
+#define GEN_SEQ_VEC(VEC_TYPE, ADDEND) \
+ ({ VEC_TYPE dummy; \
+ const int elts = sizeof(VEC_TYPE) / sizeof(dummy[0]); \
+ typeof(dummy[0]) __attribute__((aligned(8))) ar[elts]; \
+ for (int i = 0; i < elts; i++) \
+ ar[i] = (typeof(dummy[0]))(i + (ADDEND)); \
+ *(VEC_TYPE*)ar;})
+
+#endif
diff --git a/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c b/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c
new file mode 100644
index 0000000..1c02c0c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fzero-call-used-regs=all -march=z13 -mzarch" } */
+
+/* Ensure that all call clobbered GPRs, FPRs, and VRs are zeroed and all call
+ saved registers are kept. */
+
+void foo (void) { }
+
+/* { dg-final { scan-assembler-times "lghi\t" 6 } } */
+/* { dg-final { scan-assembler "lghi\t%r0,0" } } */
+/* { dg-final { scan-assembler "lghi\t%r1,0" } } */
+/* { dg-final { scan-assembler "lghi\t%r2,0" } } */
+/* { dg-final { scan-assembler "lghi\t%r3,0" } } */
+/* { dg-final { scan-assembler "lghi\t%r4,0" } } */
+/* { dg-final { scan-assembler "lghi\t%r5,0" } } */
+
+/* { dg-final { scan-assembler-times "vzero\t" 30 { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler-times "vzero\t" 24 { target { lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v0" } } */
+/* { dg-final { scan-assembler "vzero\t%v1" } } */
+/* { dg-final { scan-assembler "vzero\t%v2" } } */
+/* { dg-final { scan-assembler "vzero\t%v3" } } */
+/* { dg-final { scan-assembler "vzero\t%v4" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v5" } } */
+/* { dg-final { scan-assembler "vzero\t%v6" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v7" } } */
+/* { dg-final { scan-assembler "vzero\t%v8" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v9" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v10" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v11" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v12" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v13" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v14" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v15" { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler "vzero\t%v16" } } */
+/* { dg-final { scan-assembler "vzero\t%v17" } } */
+/* { dg-final { scan-assembler "vzero\t%v18" } } */
+/* { dg-final { scan-assembler "vzero\t%v19" } } */
+/* { dg-final { scan-assembler "vzero\t%v20" } } */
+/* { dg-final { scan-assembler "vzero\t%v21" } } */
+/* { dg-final { scan-assembler "vzero\t%v22" } } */
+/* { dg-final { scan-assembler "vzero\t%v23" } } */
+/* { dg-final { scan-assembler "vzero\t%v24" } } */
+/* { dg-final { scan-assembler "vzero\t%v25" } } */
+/* { dg-final { scan-assembler "vzero\t%v26" } } */
+/* { dg-final { scan-assembler "vzero\t%v27" } } */
+/* { dg-final { scan-assembler "vzero\t%v28" } } */
+/* { dg-final { scan-assembler "vzero\t%v29" } } */
+/* { dg-final { scan-assembler "vzero\t%v30" } } */
+/* { dg-final { scan-assembler "vzero\t%v31" } } */
diff --git a/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c b/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c
new file mode 100644
index 0000000..021c8d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -march=z14 -mzvector" } */
+
+#include <vecintrin.h>
+
+__vector unsigned char q;
+__vector unsigned short int h;
+__vector unsigned int s;
+__vector unsigned long long d;
+
+int
+main ()
+{
+ vec_msum_u128 (d, d, q, 5); /* { dg-error "constant argument 4 for builtin '__builtin_s390_vec_msum_u128' is invalid \\(0, 4, 8, 12\\)" } */
+
+ /* Using the resolved low-level builtins here makes the errors to be
+ triggered from s390_expand_builtin. Otherwise they would come
+ from the parser already preventing other errors from showing
+ up. */
+ __builtin_s390_vrepb (q, 17); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepb' is out of range \\(0..15\\)" } */
+ __builtin_s390_vreph (h, 8); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vreph' is out of range \\(0..7\\)" } */
+ __builtin_s390_vrepf (s, 4); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepf' is out of range \\(0..3\\)" } */
+ __builtin_s390_vrepg (d, 2); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepg' is out of range \\(0..1\\)" } */
+
+ __builtin_s390_vpdi (d, d, 4); /* { dg-error "constant argument 3 for builtin '__builtin_s390_vpdi' is out of range \\(0..3\\)" } */
+}
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c b/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c
new file mode 100644
index 0000000..525b950
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=z13 -mzvector" } */
+
+vector _Bool char bc;
+vector _Bool short int bs;
+vector _Bool int bi;
+vector _Bool long long bll;
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-doublee.c b/gcc/testsuite/gcc.target/s390/zvector/vec-doublee.c
new file mode 100644
index 0000000..11610f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-doublee.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mzvector --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+
+/*
+ * The vector intrinsic vec_doublee(a) converts the even-indexed
+ * single-precision numbers in a vector to double precision.
+ */
+#include <assert.h>
+#include <vecintrin.h>
+
+int
+main (void)
+{
+ vector float in = { 1.0, 2.0, 3.0, 4.0 };
+
+ vector double result = vec_doublee(in);
+ /* { dg-final { scan-assembler-times {\n\tvldeb} 1 } } */
+
+ assert(result[0] == (double)in[0]);
+ assert(result[1] == (double)in[2]);
+}
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-floate.c b/gcc/testsuite/gcc.target/s390/zvector/vec-floate.c
new file mode 100644
index 0000000..0b9cbe3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-floate.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mzvector --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+
+/*
+ * The vector intrinsic vec_floate(a) rounds a vector of double-precision
+ * numbers to single-precision. The results are stored in the even-numbered
+ * target elements.
+ */
+#include <assert.h>
+#include <vecintrin.h>
+
+int
+main (void)
+{
+ vector double in = { 1.0, 2.0 };
+
+ vector float result = vec_floate(in);
+ /* { dg-final { scan-assembler-times {\n\tvledb} 1 } } */
+
+ assert(result[0] == (float)in[0]);
+ assert(result[2] == (float)in[1]);
+}
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-types.h b/gcc/testsuite/gcc.target/s390/zvector/vec-types.h
new file mode 100644
index 0000000..35bd2a5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-types.h
@@ -0,0 +1,37 @@
+#ifndef VEC_TYPES_H
+#define VEC_TYPES_H 1
+
+#include <vecintrin.h>
+
+typedef __vector signed char v16qi;
+typedef __vector unsigned char uv16qi;
+
+typedef __vector signed short v8hi;
+typedef __vector unsigned short uv8hi;
+
+typedef __vector signed int v4si;
+typedef __vector unsigned int uv4si;
+
+typedef __vector signed long long v2di;
+typedef __vector unsigned long long uv2di;
+
+#if __SIZEOF_INT128__ == 16
+typedef __vector __int128_t v1ti;
+#endif
+
+typedef __vector double v2df;
+typedef __vector long double v1tf;
+
+#if __ARCH__ >= 12
+typedef __vector float v4sf;
+#endif
+
+#define GEN_SEQ_VEC(VEC_TYPE, ADDEND) \
+ ({ VEC_TYPE dummy; \
+ const int elts = sizeof(VEC_TYPE) / sizeof(dummy[0]); \
+ typeof(dummy[0]) __attribute__((aligned(8))) ar[elts]; \
+ for (int i = 0; i < elts; i++) \
+ ar[i] = (typeof(dummy[0]))(i + (ADDEND)); \
+ *(VEC_TYPE*)ar;})
+
+#endif
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec_merge.c b/gcc/testsuite/gcc.target/s390/zvector/vec_merge.c
new file mode 100644
index 0000000..348d1f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec_merge.c
@@ -0,0 +1,88 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -march=z14 -mzvector --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+
+/* { dg-final { scan-assembler-times "\tvmrhb\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrlb\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrhh\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrlh\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tvmrhf\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrlf\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrhg\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrlg\t" 3 } } */
+
+#include "vec-types.h"
+#include <vecintrin.h>
+
+#define GEN_MERGE(VEC_TYPE, HILO) \
+ VEC_TYPE __attribute__((noinline)) \
+ merge_##HILO##_##VEC_TYPE(VEC_TYPE a, VEC_TYPE b) { \
+ return vec_merge##HILO (a, b); }
+
+GEN_MERGE(v16qi, l)
+GEN_MERGE(v16qi, h)
+GEN_MERGE(uv16qi, l)
+GEN_MERGE(uv16qi, h)
+
+GEN_MERGE(v8hi, l)
+GEN_MERGE(v8hi, h)
+GEN_MERGE(uv8hi, l)
+GEN_MERGE(uv8hi, h)
+
+GEN_MERGE(v4si, l)
+GEN_MERGE(v4si, h)
+GEN_MERGE(uv4si, l)
+GEN_MERGE(uv4si, h)
+
+GEN_MERGE(v4sf, l)
+GEN_MERGE(v4sf, h)
+
+GEN_MERGE(v2di, l)
+GEN_MERGE(v2di, h)
+GEN_MERGE(uv2di, l)
+GEN_MERGE(uv2di, h)
+
+GEN_MERGE(v2df, l)
+GEN_MERGE(v2df, h)
+
+
+#define CHECK_MERGE_LO(VEC_TYPE, SRC1, SRC2) \
+ { \
+ VEC_TYPE v = merge_l_##VEC_TYPE ((SRC1), (SRC2)); \
+ int elts = sizeof(v) / sizeof(v[0]); \
+ for (int i = 0; i < elts; i++) \
+ if (v[i] != (i + elts) / 2 + (i % 2) * elts) \
+ __builtin_abort(); \
+ }
+
+#define CHECK_MERGE_HI(VEC_TYPE, SRC1, SRC2) \
+ { \
+ VEC_TYPE v = merge_h_##VEC_TYPE ((SRC1), (SRC2)); \
+ int elts = sizeof(v) / sizeof(v[0]); \
+ for (int i = 0; i < elts; i++) \
+ if (v[i] != i / 2 + (i % 2) * elts) \
+ __builtin_abort(); \
+ }
+
+#define CHECK_MERGE(VEC_TYPE) \
+ { \
+ VEC_TYPE a = GEN_SEQ_VEC (VEC_TYPE, 0); \
+ VEC_TYPE b = GEN_SEQ_VEC (VEC_TYPE, sizeof(VEC_TYPE) / sizeof(a[0])); \
+ CHECK_MERGE_LO (VEC_TYPE, a, b); \
+ CHECK_MERGE_HI (VEC_TYPE, a, b); \
+ }
+
+int
+main ()
+{
+ CHECK_MERGE(v16qi);
+ CHECK_MERGE(uv16qi);
+ CHECK_MERGE(v8hi);
+ CHECK_MERGE(uv8hi);
+ CHECK_MERGE(v4si);
+ CHECK_MERGE(uv4si);
+ CHECK_MERGE(v4sf);
+ CHECK_MERGE(v2di);
+ CHECK_MERGE(uv2di);
+ CHECK_MERGE(v2df);
+}
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c b/gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c
new file mode 100644
index 0000000..2f5fbca
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-require-effective-target s390_vxe } */
+/* { dg-options "-O3 -mzarch -march=z14 -mzvector --save-temps" } */
+
+#include <vecintrin.h>
+
+typedef vector unsigned char uv16qi;
+typedef vector unsigned long long uv2di;
+
+uv2di a = (uv2di){ 12, 42 };
+uv2di b = (uv2di){ 54, 120 };
+uv2di c = (uv2di){ 0, 200 };
+
+int
+main ()
+{
+ uv2di result;
+
+ result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 0);
+
+ if (result[1] != a[0] * b[0] + a[1] * b[1] + c[1])
+ __builtin_abort();
+
+ result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 4);
+
+ if (result[1] != a[0] * b[0] + a[1] * b[1] * 2 + c[1])
+ __builtin_abort();
+
+ result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 8);
+
+ if (result[1] != a[0] * b[0] * 2 + a[1] * b[1] + c[1])
+ __builtin_abort();
+
+ result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 12);
+
+ if (result[1] != a[0] * b[0] * 2 + a[1] * b[1] * 2 + c[1])
+ __builtin_abort();
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times "vmslg\t.*0" 1 } } */
+/* { dg-final { scan-assembler-times "vmslg\t.*4" 1 } } */
+/* { dg-final { scan-assembler-times "vmslg\t.*8" 1 } } */
+/* { dg-final { scan-assembler-times "vmslg\t.*12" 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec_permi.c b/gcc/testsuite/gcc.target/s390/zvector/vec_permi.c
new file mode 100644
index 0000000..b66fa90
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec_permi.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -march=z13 -mzvector --save-temps" } */
+/* { dg-do run { target { s390_z13_hw } } } */
+
+/*
+ * The vector intrinsic vec_permi(a, b, c) chooses one of the two eight-byte
+ * vector elements in each of a and b, depending on the value of c. The valid
+ * values for c differ from the encoding for the M4 field in assembly and in the
+ * binary instruction.
+ *
+ * selection | c | encoding in assembly
+ * a[0] b[0] | 0 | 0 -> vmrhg
+ * a[0] b[1] | 1 | 1
+ * a[1] b[0] | 2 | 4
+ * a[1] b[1] | 3 | 5 -> vmrlg
+ *
+ * (i.e., indices a[i] b[j] are encoded for c as (i<<1) | j, yet for the
+ * M4 field as (i<<2) | j.
+ */
+
+/* { dg-final { scan-assembler-times "\tvmrhg\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvmrlg\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tvpdi\t" 6 } } */
+
+#include "vec-types.h"
+#include <vecintrin.h>
+
+#define GEN_PERMI_BITS(VEC_TYPE, BITS) \
+ VEC_TYPE __attribute__((noinline)) \
+ permi_##BITS##_##VEC_TYPE(VEC_TYPE a, VEC_TYPE b) { \
+ return vec_permi (a, b, (BITS)); }
+
+#define GEN_PERMI(VEC_TYPE) \
+ GEN_PERMI_BITS(VEC_TYPE, 0); \
+ GEN_PERMI_BITS(VEC_TYPE, 1); \
+ GEN_PERMI_BITS(VEC_TYPE, 2); \
+ GEN_PERMI_BITS(VEC_TYPE, 3);
+
+GEN_PERMI(v2di)
+GEN_PERMI(uv2di)
+GEN_PERMI(v2df)
+
+
+#define CHECK_PERMI_BITS(VEC_TYPE, BITS) \
+ VEC_TYPE r##BITS = permi_##BITS##_##VEC_TYPE (a, b); \
+ if (r##BITS[0] != ((BITS) & 2) >> 1 \
+ || r##BITS[1] != ((BITS) & 1) + 2) \
+ __builtin_abort();
+
+#define CHECK_PERMI(VEC_TYPE) \
+ { \
+ VEC_TYPE a = GEN_SEQ_VEC (VEC_TYPE, 0); \
+ VEC_TYPE b = GEN_SEQ_VEC (VEC_TYPE, 2); \
+ CHECK_PERMI_BITS (VEC_TYPE, 0); \
+ CHECK_PERMI_BITS (VEC_TYPE, 1); \
+ CHECK_PERMI_BITS (VEC_TYPE, 2); \
+ CHECK_PERMI_BITS (VEC_TYPE, 3); \
+ }
+
+int
+main ()
+{
+ CHECK_PERMI (v2di);
+ CHECK_PERMI (uv2di);
+ CHECK_PERMI (v2df);
+}
diff --git a/gcc/testsuite/gcc.target/tic6x/rotdi16-scan.c b/gcc/testsuite/gcc.target/tic6x/rotdi16-scan.c
index 4d7816c..5504183 100644
--- a/gcc/testsuite/gcc.target/tic6x/rotdi16-scan.c
+++ b/gcc/testsuite/gcc.target/tic6x/rotdi16-scan.c
@@ -7,10 +7,14 @@
unsigned long long z = 0x012389ab4567cdefull;
+unsigned long long __attribute__ ((noinline,noclone,noipa)) bar ()
+{
+ return (z << 48) | (z >> 16);
+}
+
int main ()
{
- unsigned long long z2 = (z << 48) | (z >> 16);
- if (z2 != 0xcdef012389ab4567ull)
+ if (bar() != 0xcdef012389ab4567ull)
abort ();
exit (0);
}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/abi-avx512fp16-xmm.exp b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/abi-avx512fp16-xmm.exp
new file mode 100644
index 0000000..33d2476
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/abi-avx512fp16-xmm.exp
@@ -0,0 +1,48 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+load_lib clearcap.exp
+load_lib file-format.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || [is-effective-target ia32]
+ || [gcc_target_object_format] != "elf"
+ || ![is-effective-target avx512fp16] } then {
+ return
+}
+
+
+torture-init
+clearcap-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -Wno-abi -mavx512fp16"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+}
+
+clearcap-finish
+torture-finish
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/args.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/args.h
new file mode 100644
index 0000000..425cc3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/args.h
@@ -0,0 +1,190 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <string.h>
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 xmm0
+#define F1 xmm1
+#define F2 xmm2
+#define F3 xmm3
+#define F4 xmm4
+#define F5 xmm5
+#define F6 xmm6
+#define F7 xmm7
+
+typedef union {
+ _Float16 __Float16[8];
+ float _float[4];
+ double _double[2];
+ long long _longlong[2];
+ int _int[4];
+ ulonglong _ulonglong[2];
+#ifdef CHECK_M64_M128
+ __m64 _m64[2];
+ __m128 _m128[1];
+ __m128h _m128h[1];
+#endif
+} XMM_T;
+
+typedef union {
+ _Float16 __Float16;
+ float _float;
+ double _double;
+ ldouble _ldouble;
+ ulonglong _ulonglong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+XMM_T xmm_regs[16];
+X87_T x87_regs[8];
+extern volatile unsigned long long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ ldouble st0, st1, st2, st3, st4, st5, st6, st7;
+ XMM_T xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9,
+ xmm10, xmm11, xmm12, xmm13, xmm14, xmm15;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+#define check_int_arguments do { \
+ assert (num_iregs <= 0 || iregs.I0 == I0); \
+ assert (num_iregs <= 1 || iregs.I1 == I1); \
+ assert (num_iregs <= 2 || iregs.I2 == I2); \
+ assert (num_iregs <= 3 || iregs.I3 == I3); \
+ assert (num_iregs <= 4 || iregs.I4 == I4); \
+ assert (num_iregs <= 5 || iregs.I5 == I5); \
+ } while (0)
+
+#define check_char_arguments check_int_arguments
+#define check_short_arguments check_int_arguments
+#define check_long_arguments check_int_arguments
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (xmm_regs, 0, sizeof (xmm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+/* TODO: Do the checking. */
+#define check_f_arguments(T) do { \
+ assert (num_fregs <= 0 || fregs.xmm0._ ## T [0] == xmm_regs[0]._ ## T [0]); \
+ assert (num_fregs <= 1 || fregs.xmm1._ ## T [0] == xmm_regs[1]._ ## T [0]); \
+ assert (num_fregs <= 2 || fregs.xmm2._ ## T [0] == xmm_regs[2]._ ## T [0]); \
+ assert (num_fregs <= 3 || fregs.xmm3._ ## T [0] == xmm_regs[3]._ ## T [0]); \
+ assert (num_fregs <= 4 || fregs.xmm4._ ## T [0] == xmm_regs[4]._ ## T [0]); \
+ assert (num_fregs <= 5 || fregs.xmm5._ ## T [0] == xmm_regs[5]._ ## T [0]); \
+ assert (num_fregs <= 6 || fregs.xmm6._ ## T [0] == xmm_regs[6]._ ## T [0]); \
+ assert (num_fregs <= 7 || fregs.xmm7._ ## T [0] == xmm_regs[7]._ ## T [0]); \
+ } while (0)
+
+#define check_float16_arguments check_f_arguments(_Float16)
+#define check_float_arguments check_f_arguments(float)
+#define check_double_arguments check_f_arguments(double)
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.xmm0) + (O), \
+ &xmm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.xmm1) + (O), \
+ &xmm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.xmm2) + (O), \
+ &xmm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.xmm3) + (O), \
+ &xmm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.xmm4) + (O), \
+ &xmm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.xmm5) + (O), \
+ &xmm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.xmm6) + (O), \
+ &xmm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.xmm7) + (O), \
+ &xmm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m64_arguments check_vector_arguments(m64, 0)
+#define check_m128_arguments check_vector_arguments(m128, 0)
+
+/* ldoubles are not passed in registers */
+#define check_ldouble_arguments
+
+/* TODO: Do the clearing. */
+#define clear_float_hardware_registers
+#define clear_x87_hardware_registers
+
+#define clear_float_registers \
+ clear_struct_registers \
+ clear_float_hardware_registers
+
+#define clear_x87_registers \
+ clear_struct_registers \
+ clear_x87_hardware_registers
+
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
new file mode 100644
index 0000000..7849acd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
@@ -0,0 +1,81 @@
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ vmovdqu %xmm0, xmm_regs+0(%rip)
+ vmovdqu %xmm1, xmm_regs+16(%rip)
+ vmovdqu %xmm2, xmm_regs+32(%rip)
+ vmovdqu %xmm3, xmm_regs+48(%rip)
+ vmovdqu %xmm4, xmm_regs+64(%rip)
+ vmovdqu %xmm5, xmm_regs+80(%rip)
+ vmovdqu %xmm6, xmm_regs+96(%rip)
+ vmovdqu %xmm7, xmm_regs+112(%rip)
+ vmovdqu %xmm8, xmm_regs+128(%rip)
+ vmovdqu %xmm9, xmm_regs+144(%rip)
+ vmovdqu %xmm10, xmm_regs+160(%rip)
+ vmovdqu %xmm11, xmm_regs+176(%rip)
+ vmovdqu %xmm12, xmm_regs+192(%rip)
+ vmovdqu %xmm13, xmm_regs+208(%rip)
+ vmovdqu %xmm14, xmm_regs+224(%rip)
+ vmovdqu %xmm15, xmm_regs+240(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ vmovdqu %xmm0, xmm_regs+0(%rip)
+ vmovdqu %xmm1, xmm_regs+16(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm xmm_regs,256,32
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-check.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-check.h
new file mode 100644
index 0000000..9fbec9d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-check.h
@@ -0,0 +1,74 @@
+#include <stdlib.h>
+#include <cpuid.h>
+
+/* Check if the OS supports executing AVX512FP16 instructions. */
+
+#define XCR_XFEATURE_ENABLED_MASK 0x0
+
+#define XSTATE_FP 0x1
+#define XSTATE_SSE 0x2
+#define XSTATE_YMM 0x4
+#define XSTATE_OPMASK 0x20
+#define XSTATE_ZMM 0x40
+#define XSTATE_HI_ZMM 0x80
+
+static int
+check_osxsave (void)
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ return (ecx & bit_OSXSAVE) != 0;
+}
+
+static int
+avx512fp16_os_support (void)
+{
+ unsigned int eax, edx;
+ unsigned int ecx = XCR_XFEATURE_ENABLED_MASK;
+ unsigned int mask = XSTATE_MASK;
+
+ if (!check_osxsave ())
+ return 0;
+
+ __asm__ ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (ecx));
+
+ return ((eax & mask) == mask);
+}
+
+static void do_test (void);
+
+int
+main ()
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!avx512fp16_os_support ())
+ return 0;
+
+ if (__get_cpuid_max (0, NULL) < 7)
+ return 0;
+
+ __cpuid_count (7, 0, eax, ebx, ecx, edx);
+
+ /* Run AVX512FP16 test only if host has ISA support. */
+ if (((ebx & (bit_AVX512F | bit_AVX512BW))
+ == (bit_AVX512F | bit_AVX512BW))
+ && (edx & bit_AVX512FP16)
+ && AVX512VL (ebx))
+ {
+ do_test ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ return 0;
+ }
+
+#ifdef DEBUG
+ printf ("SKIPPED\n");
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-xmm-check.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-xmm-check.h
new file mode 100644
index 0000000..0abe09f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/avx512fp16-xmm-check.h
@@ -0,0 +1,3 @@
+#define AVX512VL(ebx) (ebx & bit_AVX512VL)
+#define XSTATE_MASK (XSTATE_SSE | XSTATE_OPMASK)
+#include "avx512fp16-check.h"
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/defines.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/defines.h
new file mode 100644
index 0000000..892a66e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/defines.h
@@ -0,0 +1,166 @@
+#ifndef DEFINED_DEFINES_H
+#define DEFINED_DEFINES_H
+
+/* Get __m64 and __m128. */
+#include <immintrin.h>
+
+typedef unsigned long long ulonglong;
+typedef long double ldouble;
+
+/* These defines determines what part of the test should be run. When
+ GCC implements these parts, the defines should be uncommented to
+ enable testing. */
+
+/* Scalar type __int128. */
+/* #define CHECK_INT128 */
+
+/* Scalar type long double. */
+#define CHECK_LONG_DOUBLE
+
+/* Scalar type __float128. */
+/* #define CHECK_FLOAT128 */
+
+/* Scalar types __m64 and __m128. */
+#define CHECK_M64_M128
+
+/* Returning of complex type. */
+#define CHECK_COMPLEX
+
+/* Structs with size >= 16. */
+#define CHECK_LARGER_STRUCTS
+
+/* Checks for passing floats and doubles. */
+#define CHECK_FLOAT_DOUBLE_PASSING
+
+/* Union passing with not-extremely-simple unions. */
+#define CHECK_LARGER_UNION_PASSING
+
+/* Variable args. */
+#define CHECK_VARARGS
+
+/* Check argument passing and returning for scalar types with sizeof = 16. */
+/* TODO: Implement these tests. Don't activate them for now. */
+#define CHECK_LARGE_SCALAR_PASSING
+
+/* Defines for sizing and alignment. */
+
+#define TYPE_SIZE_CHAR 1
+#define TYPE_SIZE_SHORT 2
+#define TYPE_SIZE_INT 4
+#ifdef __ILP32__
+# define TYPE_SIZE_LONG 4
+#else
+# define TYPE_SIZE_LONG 8
+#endif
+#define TYPE_SIZE_LONG_LONG 8
+#define TYPE_SIZE_INT128 16
+#define TYPE_SIZE_FLOAT16 2
+#define TYPE_SIZE_FLOAT 4
+#define TYPE_SIZE_DOUBLE 8
+#define TYPE_SIZE_LONG_DOUBLE 16
+#define TYPE_SIZE_FLOAT128 16
+#define TYPE_SIZE_M64 8
+#define TYPE_SIZE_M128 16
+#define TYPE_SIZE_ENUM 4
+#ifdef __ILP32__
+# define TYPE_SIZE_POINTER 4
+#else
+# define TYPE_SIZE_POINTER 8
+#endif
+
+#define TYPE_ALIGN_CHAR 1
+#define TYPE_ALIGN_SHORT 2
+#define TYPE_ALIGN_INT 4
+#ifdef __ILP32__
+# define TYPE_ALIGN_LONG 4
+#else
+# define TYPE_ALIGN_LONG 8
+#endif
+#define TYPE_ALIGN_LONG_LONG 8
+#define TYPE_ALIGN_INT128 16
+#define TYPE_ALIGN_FLOAT16 2
+#define TYPE_ALIGN_FLOAT 4
+#define TYPE_ALIGN_DOUBLE 8
+#define TYPE_ALIGN_LONG_DOUBLE 16
+#define TYPE_ALIGN_FLOAT128 16
+#define TYPE_ALIGN_M64 8
+#define TYPE_ALIGN_M128 16
+#define TYPE_ALIGN_ENUM 4
+#ifdef __ILP32__
+# define TYPE_ALIGN_POINTER 4
+#else
+# define TYPE_ALIGN_POINTER 8
+#endif
+
+/* These defines control the building of the list of types to check. There
+ is a string identifying the type (with a comma after), a size of the type
+ (also with a comma and an integer for adding to the total amount of types)
+ and an alignment of the type (which is currently not really needed since
+ the abi specifies that alignof == sizeof for all scalar types). */
+#ifdef CHECK_INT128
+#define CI128_STR "__int128",
+#define CI128_SIZ TYPE_SIZE_INT128,
+#define CI128_ALI TYPE_ALIGN_INT128,
+#define CI128_RET "???",
+#else
+#define CI128_STR
+#define CI128_SIZ
+#define CI128_ALI
+#define CI128_RET
+#endif
+#ifdef CHECK_LONG_DOUBLE
+#define CLD_STR "long double",
+#define CLD_SIZ TYPE_SIZE_LONG_DOUBLE,
+#define CLD_ALI TYPE_ALIGN_LONG_DOUBLE,
+#define CLD_RET "x87_regs[0]._ldouble",
+#else
+#define CLD_STR
+#define CLD_SIZ
+#define CLD_ALI
+#define CLD_RET
+#endif
+#ifdef CHECK_FLOAT128
+#define CF128_STR "__float128",
+#define CF128_SIZ TYPE_SIZE_FLOAT128,
+#define CF128_ALI TYPE_ALIGN_FLOAT128,
+#define CF128_RET "???",
+#else
+#define CF128_STR
+#define CF128_SIZ
+#define CF128_ALI
+#define CF128_RET
+#endif
+#ifdef CHECK_M64_M128
+#define CMM_STR "__m64", "__m128",
+#define CMM_SIZ TYPE_SIZE_M64, TYPE_SIZE_M128,
+#define CMM_ALI TYPE_ALIGN_M64, TYPE_ALIGN_M128,
+#define CMM_RET "???", "???",
+#else
+#define CMM_STR
+#define CMM_SIZ
+#define CMM_ALI
+#define CMM_RET
+#endif
+
+/* Used in size and alignment tests. */
+enum dummytype { enumtype };
+
+extern void abort (void);
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+#ifdef __GNUC__
+#define PACKED __attribute__((__packed__))
+#else
+#warning Some tests will fail due to missing __packed__ support
+#define PACKED
+#endif
+
+#endif /* DEFINED_DEFINES_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/abi-avx512fp16-ymm.exp b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/abi-avx512fp16-ymm.exp
new file mode 100644
index 0000000..ecf673b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/abi-avx512fp16-ymm.exp
@@ -0,0 +1,45 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+load_lib file-format.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || [is-effective-target ia32]
+ || [gcc_target_object_format] != "elf"
+ || ![is-effective-target avx512fp16] } then {
+ return
+}
+
+
+torture-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -Wno-abi -mavx512fp16"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+}
+
+torture-finish
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/args.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/args.h
new file mode 100644
index 0000000..add1095
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/args.h
@@ -0,0 +1,182 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <immintrin.h>
+#include <string.h>
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 ymm0
+#define F1 ymm1
+#define F2 ymm2
+#define F3 ymm3
+#define F4 ymm4
+#define F5 ymm5
+#define F6 ymm6
+#define F7 ymm7
+
+typedef union {
+ _Float16 __Float16[16];
+ float _float[8];
+ double _double[4];
+ long long _longlong[4];
+ int _int[8];
+ unsigned long long _ulonglong[4];
+ __m64 _m64[4];
+ __m128 _m128[2];
+ __m256 _m256[1];
+ __m256h _m256h[1];
+} YMM_T;
+
+typedef union {
+ float _float;
+ double _double;
+ long double _ldouble;
+ unsigned long long _ulonglong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+YMM_T ymm_regs[16];
+X87_T x87_regs[8];
+extern volatile unsigned long long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ long double st0, st1, st2, st3, st4, st5, st6, st7;
+ YMM_T ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, ymm8, ymm9,
+ ymm10, ymm11, ymm12, ymm13, ymm14, ymm15;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+#define check_int_arguments do { \
+ assert (num_iregs <= 0 || iregs.I0 == I0); \
+ assert (num_iregs <= 1 || iregs.I1 == I1); \
+ assert (num_iregs <= 2 || iregs.I2 == I2); \
+ assert (num_iregs <= 3 || iregs.I3 == I3); \
+ assert (num_iregs <= 4 || iregs.I4 == I4); \
+ assert (num_iregs <= 5 || iregs.I5 == I5); \
+ } while (0)
+
+#define check_char_arguments check_int_arguments
+#define check_short_arguments check_int_arguments
+#define check_long_arguments check_int_arguments
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (ymm_regs, 0, sizeof (ymm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+/* TODO: Do the checking. */
+#define check_f_arguments(T) do { \
+ assert (num_fregs <= 0 || fregs.ymm0._ ## T [0] == ymm_regs[0]._ ## T [0]); \
+ assert (num_fregs <= 1 || fregs.ymm1._ ## T [0] == ymm_regs[1]._ ## T [0]); \
+ assert (num_fregs <= 2 || fregs.ymm2._ ## T [0] == ymm_regs[2]._ ## T [0]); \
+ assert (num_fregs <= 3 || fregs.ymm3._ ## T [0] == ymm_regs[3]._ ## T [0]); \
+ assert (num_fregs <= 4 || fregs.ymm4._ ## T [0] == ymm_regs[4]._ ## T [0]); \
+ assert (num_fregs <= 5 || fregs.ymm5._ ## T [0] == ymm_regs[5]._ ## T [0]); \
+ assert (num_fregs <= 6 || fregs.ymm6._ ## T [0] == ymm_regs[6]._ ## T [0]); \
+ assert (num_fregs <= 7 || fregs.ymm7._ ## T [0] == ymm_regs[7]._ ## T [0]); \
+ } while (0)
+
+#define check_float_arguments check_f_arguments(float)
+#define check_double_arguments check_f_arguments(double)
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.ymm0) + (O), \
+ &ymm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.ymm1) + (O), \
+ &ymm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.ymm2) + (O), \
+ &ymm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.ymm3) + (O), \
+ &ymm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.ymm4) + (O), \
+ &ymm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.ymm5) + (O), \
+ &ymm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.ymm6) + (O), \
+ &ymm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.ymm7) + (O), \
+ &ymm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m64_arguments check_vector_arguments(m64, 0)
+#define check_m128_arguments check_vector_arguments(m128, 0)
+#define check_m256_arguments check_vector_arguments(m256, 0)
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
new file mode 100644
index 0000000..73a5919
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
@@ -0,0 +1,81 @@
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ vmovdqu %ymm0, ymm_regs+0(%rip)
+ vmovdqu %ymm1, ymm_regs+32(%rip)
+ vmovdqu %ymm2, ymm_regs+64(%rip)
+ vmovdqu %ymm3, ymm_regs+96(%rip)
+ vmovdqu %ymm4, ymm_regs+128(%rip)
+ vmovdqu %ymm5, ymm_regs+160(%rip)
+ vmovdqu %ymm6, ymm_regs+192(%rip)
+ vmovdqu %ymm7, ymm_regs+224(%rip)
+ vmovdqu %ymm8, ymm_regs+256(%rip)
+ vmovdqu %ymm9, ymm_regs+288(%rip)
+ vmovdqu %ymm10, ymm_regs+320(%rip)
+ vmovdqu %ymm11, ymm_regs+352(%rip)
+ vmovdqu %ymm12, ymm_regs+384(%rip)
+ vmovdqu %ymm13, ymm_regs+416(%rip)
+ vmovdqu %ymm14, ymm_regs+448(%rip)
+ vmovdqu %ymm15, ymm_regs+480(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ vmovdqu %ymm0, ymm_regs+0(%rip)
+ vmovdqu %ymm1, ymm_regs+32(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm ymm_regs,512,32
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/avx512fp16-ymm-check.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/avx512fp16-ymm-check.h
new file mode 100644
index 0000000..6a55030
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/avx512fp16-ymm-check.h
@@ -0,0 +1,3 @@
+#define AVX512VL(ebx) (ebx & bit_AVX512VL)
+#define XSTATE_MASK (XSTATE_SSE | XSTATE_YMM | XSTATE_OPMASK)
+#include "../avx512fp16-check.h"
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_m256_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_m256_returning.c
new file mode 100644
index 0000000..48e0139
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_m256_returning.c
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include "avx512fp16-ymm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+__m256
+fun_test_returning___m256 (void)
+{
+ volatile_var++;
+ return (__m256){73,0,0,0,0,0,0,0};
+}
+
+__m256h
+fun_test_returning___m256h (void)
+{
+ volatile_var++;
+ return (__m256h){1.1f16,2.1f16,3.1f16,4.1f16,
+ 5.1f16,6.1f16,7.1f16,8.1f16,
+ 9.1f16,10.1f16,11.1f16,12.1f16,
+ 13.1f16,14.1f16,15.1f16,16.1f16};
+}
+
+__m256 test_256;
+__m256h test_256h;
+
+static void
+do_test (void)
+{
+ unsigned failed = 0;
+ YMM_T ymmt1, ymmt2;
+
+ clear_struct_registers;
+ test_256 = (__m256){73,0,0,0,0,0,0,0};
+ ymmt1._m256[0] = test_256;
+ ymmt2._m256[0] = WRAP_RET (fun_test_returning___m256)();
+ if (memcmp (&ymmt1, &ymmt2, sizeof (ymmt2)) != 0)
+ printf ("fail m256\n"), failed++;
+
+ clear_struct_registers;
+ test_256h = (__m256h){1.1f16,2.1f16,3.1f16,4.1f16,
+ 5.1f16,6.1f16,7.1f16,8.1f16,
+ 9.1f16,10.1f16,11.1f16,12.1f16,
+ 13.1f16,14.1f16,15.1f16,16.1f16};
+ ymmt1._m256h[0] = test_256h;
+ ymmt2._m256h[0] = WRAP_RET (fun_test_returning___m256h)();
+ if (memcmp (&ymmt1, &ymmt2, sizeof (ymmt2)) != 0)
+ printf ("fail m256h\n"), failed++;
+
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_m256.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_m256.c
new file mode 100644
index 0000000..bfa80d6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_m256.c
@@ -0,0 +1,370 @@
+#include <stdio.h>
+#include "avx512fp16-ymm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ YMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,
+ i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+fun_check_passing_m256_8_values (__m256 i0 ATTRIBUTE_UNUSED,
+ __m256 i1 ATTRIBUTE_UNUSED,
+ __m256 i2 ATTRIBUTE_UNUSED,
+ __m256 i3 ATTRIBUTE_UNUSED,
+ __m256 i4 ATTRIBUTE_UNUSED,
+ __m256 i5 ATTRIBUTE_UNUSED,
+ __m256 i6 ATTRIBUTE_UNUSED,
+ __m256 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256);
+ compare (values.i1, i1, __m256);
+ compare (values.i2, i2, __m256);
+ compare (values.i3, i3, __m256);
+ compare (values.i4, i4, __m256);
+ compare (values.i5, i5, __m256);
+ compare (values.i6, i6, __m256);
+ compare (values.i7, i7, __m256);
+}
+
+fun_check_passing_m256h_8_values (__m256h i0 ATTRIBUTE_UNUSED,
+ __m256h i1 ATTRIBUTE_UNUSED,
+ __m256h i2 ATTRIBUTE_UNUSED,
+ __m256h i3 ATTRIBUTE_UNUSED,
+ __m256h i4 ATTRIBUTE_UNUSED,
+ __m256h i5 ATTRIBUTE_UNUSED,
+ __m256h i6 ATTRIBUTE_UNUSED,
+ __m256h i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256h);
+ compare (values.i1, i1, __m256h);
+ compare (values.i2, i2, __m256h);
+ compare (values.i3, i3, __m256h);
+ compare (values.i4, i4, __m256h);
+ compare (values.i5, i5, __m256h);
+ compare (values.i6, i6, __m256h);
+ compare (values.i7, i7, __m256h);
+}
+
+void
+fun_check_passing_m256_8_regs (__m256 i0 ATTRIBUTE_UNUSED,
+ __m256 i1 ATTRIBUTE_UNUSED,
+ __m256 i2 ATTRIBUTE_UNUSED,
+ __m256 i3 ATTRIBUTE_UNUSED,
+ __m256 i4 ATTRIBUTE_UNUSED,
+ __m256 i5 ATTRIBUTE_UNUSED,
+ __m256 i6 ATTRIBUTE_UNUSED,
+ __m256 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+void
+fun_check_passing_m256h_8_regs (__m256h i0 ATTRIBUTE_UNUSED,
+ __m256h i1 ATTRIBUTE_UNUSED,
+ __m256h i2 ATTRIBUTE_UNUSED,
+ __m256h i3 ATTRIBUTE_UNUSED,
+ __m256h i4 ATTRIBUTE_UNUSED,
+ __m256h i5 ATTRIBUTE_UNUSED,
+ __m256h i6 ATTRIBUTE_UNUSED,
+ __m256h i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+void
+fun_check_passing_m256_20_values (__m256 i0 ATTRIBUTE_UNUSED,
+ __m256 i1 ATTRIBUTE_UNUSED,
+ __m256 i2 ATTRIBUTE_UNUSED,
+ __m256 i3 ATTRIBUTE_UNUSED,
+ __m256 i4 ATTRIBUTE_UNUSED,
+ __m256 i5 ATTRIBUTE_UNUSED,
+ __m256 i6 ATTRIBUTE_UNUSED,
+ __m256 i7 ATTRIBUTE_UNUSED,
+ __m256 i8 ATTRIBUTE_UNUSED,
+ __m256 i9 ATTRIBUTE_UNUSED,
+ __m256 i10 ATTRIBUTE_UNUSED,
+ __m256 i11 ATTRIBUTE_UNUSED,
+ __m256 i12 ATTRIBUTE_UNUSED,
+ __m256 i13 ATTRIBUTE_UNUSED,
+ __m256 i14 ATTRIBUTE_UNUSED,
+ __m256 i15 ATTRIBUTE_UNUSED,
+ __m256 i16 ATTRIBUTE_UNUSED,
+ __m256 i17 ATTRIBUTE_UNUSED,
+ __m256 i18 ATTRIBUTE_UNUSED,
+ __m256 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256);
+ compare (values.i1, i1, __m256);
+ compare (values.i2, i2, __m256);
+ compare (values.i3, i3, __m256);
+ compare (values.i4, i4, __m256);
+ compare (values.i5, i5, __m256);
+ compare (values.i6, i6, __m256);
+ compare (values.i7, i7, __m256);
+ compare (values.i8, i8, __m256);
+ compare (values.i9, i9, __m256);
+ compare (values.i10, i10, __m256);
+ compare (values.i11, i11, __m256);
+ compare (values.i12, i12, __m256);
+ compare (values.i13, i13, __m256);
+ compare (values.i14, i14, __m256);
+ compare (values.i15, i15, __m256);
+ compare (values.i16, i16, __m256);
+ compare (values.i17, i17, __m256);
+ compare (values.i18, i18, __m256);
+ compare (values.i19, i19, __m256);
+}
+
+void
+fun_check_passing_m256h_20_values (__m256h i0 ATTRIBUTE_UNUSED,
+ __m256h i1 ATTRIBUTE_UNUSED,
+ __m256h i2 ATTRIBUTE_UNUSED,
+ __m256h i3 ATTRIBUTE_UNUSED,
+ __m256h i4 ATTRIBUTE_UNUSED,
+ __m256h i5 ATTRIBUTE_UNUSED,
+ __m256h i6 ATTRIBUTE_UNUSED,
+ __m256h i7 ATTRIBUTE_UNUSED,
+ __m256h i8 ATTRIBUTE_UNUSED,
+ __m256h i9 ATTRIBUTE_UNUSED,
+ __m256h i10 ATTRIBUTE_UNUSED,
+ __m256h i11 ATTRIBUTE_UNUSED,
+ __m256h i12 ATTRIBUTE_UNUSED,
+ __m256h i13 ATTRIBUTE_UNUSED,
+ __m256h i14 ATTRIBUTE_UNUSED,
+ __m256h i15 ATTRIBUTE_UNUSED,
+ __m256h i16 ATTRIBUTE_UNUSED,
+ __m256h i17 ATTRIBUTE_UNUSED,
+ __m256h i18 ATTRIBUTE_UNUSED,
+ __m256h i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256h);
+ compare (values.i1, i1, __m256h);
+ compare (values.i2, i2, __m256h);
+ compare (values.i3, i3, __m256h);
+ compare (values.i4, i4, __m256h);
+ compare (values.i5, i5, __m256h);
+ compare (values.i6, i6, __m256h);
+ compare (values.i7, i7, __m256h);
+ compare (values.i8, i8, __m256h);
+ compare (values.i9, i9, __m256h);
+ compare (values.i10, i10, __m256h);
+ compare (values.i11, i11, __m256h);
+ compare (values.i12, i12, __m256h);
+ compare (values.i13, i13, __m256h);
+ compare (values.i14, i14, __m256h);
+ compare (values.i15, i15, __m256h);
+ compare (values.i16, i16, __m256h);
+ compare (values.i17, i17, __m256h);
+ compare (values.i18, i18, __m256h);
+ compare (values.i19, i19, __m256h);
+}
+
+void
+fun_check_passing_m256_20_regs (__m256 i0 ATTRIBUTE_UNUSED,
+ __m256 i1 ATTRIBUTE_UNUSED,
+ __m256 i2 ATTRIBUTE_UNUSED,
+ __m256 i3 ATTRIBUTE_UNUSED,
+ __m256 i4 ATTRIBUTE_UNUSED,
+ __m256 i5 ATTRIBUTE_UNUSED,
+ __m256 i6 ATTRIBUTE_UNUSED,
+ __m256 i7 ATTRIBUTE_UNUSED,
+ __m256 i8 ATTRIBUTE_UNUSED,
+ __m256 i9 ATTRIBUTE_UNUSED,
+ __m256 i10 ATTRIBUTE_UNUSED,
+ __m256 i11 ATTRIBUTE_UNUSED,
+ __m256 i12 ATTRIBUTE_UNUSED,
+ __m256 i13 ATTRIBUTE_UNUSED,
+ __m256 i14 ATTRIBUTE_UNUSED,
+ __m256 i15 ATTRIBUTE_UNUSED,
+ __m256 i16 ATTRIBUTE_UNUSED,
+ __m256 i17 ATTRIBUTE_UNUSED,
+ __m256 i18 ATTRIBUTE_UNUSED,
+ __m256 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+void
+fun_check_passing_m256h_20_regs (__m256h i0 ATTRIBUTE_UNUSED,
+ __m256h i1 ATTRIBUTE_UNUSED,
+ __m256h i2 ATTRIBUTE_UNUSED,
+ __m256h i3 ATTRIBUTE_UNUSED,
+ __m256h i4 ATTRIBUTE_UNUSED,
+ __m256h i5 ATTRIBUTE_UNUSED,
+ __m256h i6 ATTRIBUTE_UNUSED,
+ __m256h i7 ATTRIBUTE_UNUSED,
+ __m256h i8 ATTRIBUTE_UNUSED,
+ __m256h i9 ATTRIBUTE_UNUSED,
+ __m256h i10 ATTRIBUTE_UNUSED,
+ __m256h i11 ATTRIBUTE_UNUSED,
+ __m256h i12 ATTRIBUTE_UNUSED,
+ __m256h i13 ATTRIBUTE_UNUSED,
+ __m256h i14 ATTRIBUTE_UNUSED,
+ __m256h i15 ATTRIBUTE_UNUSED,
+ __m256h i16 ATTRIBUTE_UNUSED,
+ __m256h i17 ATTRIBUTE_UNUSED,
+ __m256h i18 ATTRIBUTE_UNUSED,
+ __m256h i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+#define def_check_passing8(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
+ _i8, _i9, _i10, _i11, _i12, _i13, _i14, \
+ _i15, _i16, _i17, _i18, _i19, _func1, \
+ _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, \
+ _i16, _i17, _i18, _i19); \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, \
+ _i16, _i17, _i18, _i19);
+
+void
+test_m256_on_stack ()
+{
+ __m256 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m256){32 + i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m256-8";
+ def_check_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m256_8_values,
+ fun_check_passing_m256_8_regs, _m256);
+}
+
+void
+test_m256h_on_stack ()
+{
+ __m256h x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m256h){1.1f16 + i, 2.1f16 + i, 3.1f16 + i, 4.1f16 + i,
+ 5.1f16 + i, 6.1f16 + i, 7.1f16 + i, 8.1f16 + i,
+ 9.1f16 + i, 10.1f16 + i, 11.1f16 + i, 12.1f16 + i,
+ 13.1f16 + i, 14.1f16 + i, 15.1f16 + i, 16.1f16 + i};
+ pass = "m256h-8";
+ def_check_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m256h_8_values,
+ fun_check_passing_m256h_8_regs, _m256h);
+}
+
+void
+test_too_many_m256 ()
+{
+ __m256 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m256){32 + i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m256-20";
+ def_check_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8],
+ x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16],
+ x[17], x[18], x[19], fun_check_passing_m256_20_values,
+ fun_check_passing_m256_20_regs, _m256);
+}
+
+void
+test_too_many_m256h ()
+{
+ __m256h x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m256h){1.1f16 + i, 2.1f16 + i, 3.1f16 + i, 4.1f16 + i,
+ 5.1f16 + i, 6.1f16 + i, 7.1f16 + i, 8.1f16 + i,
+ 9.1f16 + i, 10.1f16 + i, 11.1f16 + i, 12.1f16 + i,
+ 13.1f16 + i, 14.1f16 + i, 15.1f16 + i, 16.1f16 + i};
+ pass = "m256h-20";
+ def_check_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8],
+ x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16],
+ x[17], x[18], x[19], fun_check_passing_m256h_20_values,
+ fun_check_passing_m256h_20_regs, _m256h);
+}
+
+static void
+do_test (void)
+{
+ test_m256_on_stack ();
+ test_too_many_m256 ();
+ test_m256h_on_stack ();
+ test_too_many_m256h ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_structs.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_structs.c
new file mode 100644
index 0000000..eff10ba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_structs.c
@@ -0,0 +1,113 @@
+#include "avx512fp16-ymm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct m256_struct
+{
+ __m256 x;
+};
+
+struct m256_2_struct
+{
+ __m256 x1, x2;
+};
+
+struct m256h_struct
+{
+ __m256h x;
+};
+
+struct m256h_2_struct
+{
+ __m256h x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing1 (struct m256_struct ms1 ATTRIBUTE_UNUSED,
+ struct m256_struct ms2 ATTRIBUTE_UNUSED,
+ struct m256_struct ms3 ATTRIBUTE_UNUSED,
+ struct m256_struct ms4 ATTRIBUTE_UNUSED,
+ struct m256_struct ms5 ATTRIBUTE_UNUSED,
+ struct m256_struct ms6 ATTRIBUTE_UNUSED,
+ struct m256_struct ms7 ATTRIBUTE_UNUSED,
+ struct m256_struct ms8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_struct_passing2 (struct m256_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+40);
+}
+
+void
+check_struct_passing1h (struct m256h_struct ms1 ATTRIBUTE_UNUSED,
+ struct m256h_struct ms2 ATTRIBUTE_UNUSED,
+ struct m256h_struct ms3 ATTRIBUTE_UNUSED,
+ struct m256h_struct ms4 ATTRIBUTE_UNUSED,
+ struct m256h_struct ms5 ATTRIBUTE_UNUSED,
+ struct m256h_struct ms6 ATTRIBUTE_UNUSED,
+ struct m256h_struct ms7 ATTRIBUTE_UNUSED,
+ struct m256h_struct ms8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_struct_passing2h (struct m256h_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+40);
+}
+
+static void
+do_test (void)
+{
+ struct m256_struct m256s [8];
+ struct m256h_struct m256hs [8];
+ struct m256_2_struct m256_2s = {
+ { 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94 },
+ { -8.394, -3.3, -39.9, 34.9, 7.9, 84.94, -48.394, 39.3 }
+ };
+ struct m256h_2_struct m256h_2s = {
+ { 47.364f16, 36.3f16, -367.6f16, 3474.6f16, -7.364f16, -63.3f16, 7.6f16, 74.64f16,
+ 57.865f16, 86.8f16, -867.6f16, 8575.6f16, -7.865f16, -68.8f16, 7.6f16, 75.65f16 },
+ { -7.364f16, -3.3f16, -36.6f16, 34.6f16, 7.6f16, 74.64f16, -47.364f16, 36.3f16,
+ -8.364f16, -3.3f16, -36.6f16, 34.6f16, 8.6f16, 84.64f16, -48.364f16, 36.3f16 }
+ };
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ m256s[i].x = (__m256){32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+
+ m256hs[i].x = (__m256h){33+i, 0, i, 0, -i, 0, i - 11, i + 9,
+ 31+i, 2, i, 3, -i, 4, i - 10, i + 7};
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256[0] = m256s[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1)(m256s[0], m256s[1], m256s[2], m256s[3],
+ m256s[4], m256s[5], m256s[6], m256s[7]);
+ WRAP_CALL (check_struct_passing2)(m256_2s);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256h[0] = m256hs[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1h)(m256hs[0], m256hs[1], m256hs[2], m256hs[3],
+ m256hs[4], m256hs[5], m256hs[6], m256hs[7]);
+ WRAP_CALL (check_struct_passing2h)(m256h_2s);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_unions.c
new file mode 100644
index 0000000..76f300c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_unions.c
@@ -0,0 +1,337 @@
+#include "avx512fp16-ymm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+union un1
+{
+ __m256 x;
+ float f;
+};
+
+union un2
+{
+ __m256 x;
+ double d;
+};
+
+union un3
+{
+ __m256 x;
+ __m128 v;
+};
+
+union un4
+{
+ __m256 x;
+ long double ld;
+};
+
+union un5
+{
+ __m256 x;
+ int i;
+};
+
+union un1a
+{
+ __m256 x;
+ _Float16 f;
+};
+
+union un1h
+{
+ __m256h x;
+ float f;
+};
+
+union un1hh
+{
+ __m256h x;
+ _Float16 f;
+};
+
+union un2h
+{
+ __m256h x;
+ double d;
+};
+
+union un3h
+{
+ __m256h x;
+ __m128 v;
+};
+
+union un4h
+{
+ __m256h x;
+ long double ld;
+};
+
+union un5h
+{
+ __m256h x;
+ int i;
+};
+
+void
+check_union_passing1(union un1 u1 ATTRIBUTE_UNUSED,
+ union un1 u2 ATTRIBUTE_UNUSED,
+ union un1 u3 ATTRIBUTE_UNUSED,
+ union un1 u4 ATTRIBUTE_UNUSED,
+ union un1 u5 ATTRIBUTE_UNUSED,
+ union un1 u6 ATTRIBUTE_UNUSED,
+ union un1 u7 ATTRIBUTE_UNUSED,
+ union un1 u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing1a(union un1a u1 ATTRIBUTE_UNUSED,
+ union un1a u2 ATTRIBUTE_UNUSED,
+ union un1a u3 ATTRIBUTE_UNUSED,
+ union un1a u4 ATTRIBUTE_UNUSED,
+ union un1a u5 ATTRIBUTE_UNUSED,
+ union un1a u6 ATTRIBUTE_UNUSED,
+ union un1a u7 ATTRIBUTE_UNUSED,
+ union un1a u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing1h(union un1h u1 ATTRIBUTE_UNUSED,
+ union un1h u2 ATTRIBUTE_UNUSED,
+ union un1h u3 ATTRIBUTE_UNUSED,
+ union un1h u4 ATTRIBUTE_UNUSED,
+ union un1h u5 ATTRIBUTE_UNUSED,
+ union un1h u6 ATTRIBUTE_UNUSED,
+ union un1h u7 ATTRIBUTE_UNUSED,
+ union un1h u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing1hh(union un1hh u1 ATTRIBUTE_UNUSED,
+ union un1hh u2 ATTRIBUTE_UNUSED,
+ union un1hh u3 ATTRIBUTE_UNUSED,
+ union un1hh u4 ATTRIBUTE_UNUSED,
+ union un1hh u5 ATTRIBUTE_UNUSED,
+ union un1hh u6 ATTRIBUTE_UNUSED,
+ union un1hh u7 ATTRIBUTE_UNUSED,
+ union un1hh u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing2(union un2 u1 ATTRIBUTE_UNUSED,
+ union un2 u2 ATTRIBUTE_UNUSED,
+ union un2 u3 ATTRIBUTE_UNUSED,
+ union un2 u4 ATTRIBUTE_UNUSED,
+ union un2 u5 ATTRIBUTE_UNUSED,
+ union un2 u6 ATTRIBUTE_UNUSED,
+ union un2 u7 ATTRIBUTE_UNUSED,
+ union un2 u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing2h(union un2h u1 ATTRIBUTE_UNUSED,
+ union un2h u2 ATTRIBUTE_UNUSED,
+ union un2h u3 ATTRIBUTE_UNUSED,
+ union un2h u4 ATTRIBUTE_UNUSED,
+ union un2h u5 ATTRIBUTE_UNUSED,
+ union un2h u6 ATTRIBUTE_UNUSED,
+ union un2h u7 ATTRIBUTE_UNUSED,
+ union un2h u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing3(union un3 u1 ATTRIBUTE_UNUSED,
+ union un3 u2 ATTRIBUTE_UNUSED,
+ union un3 u3 ATTRIBUTE_UNUSED,
+ union un3 u4 ATTRIBUTE_UNUSED,
+ union un3 u5 ATTRIBUTE_UNUSED,
+ union un3 u6 ATTRIBUTE_UNUSED,
+ union un3 u7 ATTRIBUTE_UNUSED,
+ union un3 u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing3h(union un3h u1 ATTRIBUTE_UNUSED,
+ union un3h u2 ATTRIBUTE_UNUSED,
+ union un3h u3 ATTRIBUTE_UNUSED,
+ union un3h u4 ATTRIBUTE_UNUSED,
+ union un3h u5 ATTRIBUTE_UNUSED,
+ union un3h u6 ATTRIBUTE_UNUSED,
+ union un3h u7 ATTRIBUTE_UNUSED,
+ union un3h u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing4(union un4 u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing4h(union un4h u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing5(union un5 u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+void
+check_union_passing5h(union un5h u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+#define check_union_passing1 WRAP_CALL(check_union_passing1)
+#define check_union_passing2 WRAP_CALL(check_union_passing2)
+#define check_union_passing3 WRAP_CALL(check_union_passing3)
+#define check_union_passing4 WRAP_CALL(check_union_passing4)
+#define check_union_passing5 WRAP_CALL(check_union_passing5)
+
+#define check_union_passing1h WRAP_CALL(check_union_passing1h)
+#define check_union_passing1a WRAP_CALL(check_union_passing1a)
+#define check_union_passing1hh WRAP_CALL(check_union_passing1hh)
+#define check_union_passing2h WRAP_CALL(check_union_passing2h)
+#define check_union_passing3h WRAP_CALL(check_union_passing3h)
+#define check_union_passing4h WRAP_CALL(check_union_passing4h)
+#define check_union_passing5h WRAP_CALL(check_union_passing5h)
+
+static void
+do_test (void)
+{
+ union un1 u1[8];
+ union un2 u2[8];
+ union un3 u3[8];
+ union un4 u4;
+ union un5 u5;
+ union un1a u1a[8];
+ union un1h u1h[8];
+ union un1hh u1hh[8];
+ union un2h u2h[8];
+ union un3h u3h[8];
+ union un4h u4h;
+ union un5h u5h;
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ u1[i].x = (__m256){32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+ u1h[i].x = (__m256h){32+i, 0, i, 0, -i, 0, i - 12, i + 8,
+ 33+i, 1, i, 2, -i, 4, i - 11, i + 9};
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256[0] = u1[i].x;
+ num_fregs = 8;
+ check_union_passing1(u1[0], u1[1], u1[2], u1[3],
+ u1[4], u1[5], u1[6], u1[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u1a[i].x = u1[i].x;
+ (&fregs.ymm0)[i]._m256[0] = u1a[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing1a(u1a[0], u1a[1], u1a[2], u1a[3],
+ u1a[4], u1a[5], u1a[6], u1a[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256h[0] = u1h[i].x;
+ num_fregs = 8;
+ check_union_passing1h(u1h[0], u1h[1], u1h[2], u1h[3],
+ u1h[4], u1h[5], u1h[6], u1h[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u1hh[i].x = u1h[i].x;
+ (&fregs.ymm0)[i]._m256h[0] = u1hh[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing1hh(u1hh[0], u1hh[1], u1hh[2], u1hh[3],
+ u1hh[4], u1hh[5], u1hh[6], u1hh[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2[i].x = u1[i].x;
+ (&fregs.ymm0)[i]._m256[0] = u2[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2(u2[0], u2[1], u2[2], u2[3],
+ u2[4], u2[5], u2[6], u2[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2h[i].x = u1h[i].x;
+ (&fregs.ymm0)[i]._m256h[0] = u2h[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2h(u2h[0], u2h[1], u2h[2], u2h[3],
+ u2h[4], u2h[5], u2h[6], u2h[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3[i].x = u1[i].x;
+ (&fregs.ymm0)[i]._m256[0] = u3[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3(u3[0], u3[1], u3[2], u3[3],
+ u3[4], u3[5], u3[6], u3[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3h[i].x = u1h[i].x;
+ (&fregs.ymm0)[i]._m256h[0] = u3h[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3h(u3h[0], u3h[1], u3h[2], u3h[3],
+ u3h[4], u3h[5], u3h[6], u3h[7]);
+
+ check_union_passing4(u4);
+ check_union_passing5(u5);
+
+ check_union_passing4h(u4h);
+ check_union_passing5h(u5h);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_varargs-m256.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_varargs-m256.c
new file mode 100644
index 0000000..f15adb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/test_varargs-m256.c
@@ -0,0 +1,160 @@
+/* Test variable number of 256-bit vector arguments passed to functions. */
+
+#include <stdio.h>
+#include "avx512fp16-ymm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ YMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m256_varargs (__m256 i0, __m256 i1, __m256 i2,
+ __m256 i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m256 *argp;
+
+ compare (values.i0, i0, __m256);
+ compare (values.i1, i1, __m256);
+ compare (values.i2, i2, __m256);
+ compare (values.i3, i3, __m256);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m256 *)(((char *) fp) + 8);
+
+ /* Check __m256 arguments passed on stack. */
+ compare (values.i4, argp[0], __m256);
+ compare (values.i5, argp[1], __m256);
+ compare (values.i6, argp[2], __m256);
+ compare (values.i7, argp[3], __m256);
+ compare (values.i8, argp[4], __m256);
+ compare (values.i9, argp[5], __m256);
+
+ /* Check register contents. */
+ compare (fregs.ymm0, ymm_regs[0], __m256);
+ compare (fregs.ymm1, ymm_regs[1], __m256);
+ compare (fregs.ymm2, ymm_regs[2], __m256);
+ compare (fregs.ymm3, ymm_regs[3], __m256);
+}
+
+void
+fun_check_passing_m256h_varargs (__m256h i0, __m256h i1, __m256h i2,
+ __m256h i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m256h *argp;
+
+ compare (values.i0, i0, __m256h);
+ compare (values.i1, i1, __m256h);
+ compare (values.i2, i2, __m256h);
+ compare (values.i3, i3, __m256h);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m256h *)(((char *) fp) + 8);
+
+ /* Check __m256h arguments passed on stack. */
+ compare (values.i4, argp[0], __m256h);
+ compare (values.i5, argp[1], __m256h);
+ compare (values.i6, argp[2], __m256h);
+ compare (values.i7, argp[3], __m256h);
+ compare (values.i8, argp[4], __m256h);
+ compare (values.i9, argp[5], __m256h);
+
+ /* Check register contents. */
+ compare (fregs.ymm0, ymm_regs[0], __m256h);
+ compare (fregs.ymm1, ymm_regs[1], __m256h);
+ compare (fregs.ymm2, ymm_regs[2], __m256h);
+ compare (fregs.ymm3, ymm_regs[3], __m256h);
+}
+
+#define def_check_int_passing_varargs(_i0, _i1, _i2, _i3, _i4, _i5, \
+ _i6, _i7, _i8, _i9, \
+ _func, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ WRAP_CALL(_func) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9);
+
+void
+test_m256_varargs (void)
+{
+ __m256 x[10];
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m256){32+i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m256-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m256_varargs,
+ _m256);
+}
+
+void
+test_m256h_varargs (void)
+{
+ __m256h x[10];
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m256h) {
+ 1.1f16 + i, 2.2f16 + i, 3.3f16 + i, 4.4f16 + i,
+ 5.5f16 + i, 6.6f16 + i, 7.7f16 + i, 8.8f16 + i,
+ 9.9f16 + i, 10.10f16 + i, 11.11f16 + i, 12.12f16 + i,
+ 13.13f16 + i, 14.14f16 + i, 15.15f16 + i, 16.16f16 + i
+ };
+ pass = "m256h-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m256h_varargs,
+ _m256h);
+}
+
+void
+do_test (void)
+{
+ test_m256_varargs ();
+ test_m256h_varargs ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/abi-avx512fp16-zmm.exp b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/abi-avx512fp16-zmm.exp
new file mode 100644
index 0000000..33d2476
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/abi-avx512fp16-zmm.exp
@@ -0,0 +1,48 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+load_lib clearcap.exp
+load_lib file-format.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || [is-effective-target ia32]
+ || [gcc_target_object_format] != "elf"
+ || ![is-effective-target avx512fp16] } then {
+ return
+}
+
+
+torture-init
+clearcap-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -Wno-abi -mavx512fp16"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+}
+
+clearcap-finish
+torture-finish
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/args.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/args.h
new file mode 100644
index 0000000..d59c337
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/args.h
@@ -0,0 +1,186 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <immintrin.h>
+#include <string.h>
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 zmm0
+#define F1 zmm1
+#define F2 zmm2
+#define F3 zmm3
+#define F4 zmm4
+#define F5 zmm5
+#define F6 zmm6
+#define F7 zmm7
+
+typedef union {
+ _Float16 __Float16[32];
+ float _float[16];
+ double _double[8];
+ long long _longlong[8];
+ int _int[16];
+ unsigned long long _ulonglong[8];
+ __m64 _m64[8];
+ __m128 _m128[4];
+ __m256 _m256[2];
+ __m512 _m512[1];
+ __m512h _m512h[1];
+} ZMM_T;
+
+typedef union {
+ float _float;
+ double _double;
+ long double _ldouble;
+ unsigned long long _ulonglong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+ZMM_T zmm_regs[32];
+X87_T x87_regs[8];
+extern volatile unsigned long long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ long double st0, st1, st2, st3, st4, st5, st6, st7;
+ ZMM_T zmm0, zmm1, zmm2, zmm3, zmm4, zmm5, zmm6, zmm7, zmm8, zmm9,
+ zmm10, zmm11, zmm12, zmm13, zmm14, zmm15, zmm16, zmm17, zmm18,
+ zmm19, zmm20, zmm21, zmm22, zmm23, zmm24, zmm25, zmm26, zmm27,
+ zmm28, zmm29, zmm30, zmm31;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+#define check_int_arguments do { \
+ assert (num_iregs <= 0 || iregs.I0 == I0); \
+ assert (num_iregs <= 1 || iregs.I1 == I1); \
+ assert (num_iregs <= 2 || iregs.I2 == I2); \
+ assert (num_iregs <= 3 || iregs.I3 == I3); \
+ assert (num_iregs <= 4 || iregs.I4 == I4); \
+ assert (num_iregs <= 5 || iregs.I5 == I5); \
+ } while (0)
+
+#define check_char_arguments check_int_arguments
+#define check_short_arguments check_int_arguments
+#define check_long_arguments check_int_arguments
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (zmm_regs, 0, sizeof (zmm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+/* TODO: Do the checking. */
+#define check_f_arguments(T) do { \
+ assert (num_fregs <= 0 || fregs.zmm0._ ## T [0] == zmm_regs[0]._ ## T [0]); \
+ assert (num_fregs <= 1 || fregs.zmm1._ ## T [0] == zmm_regs[1]._ ## T [0]); \
+ assert (num_fregs <= 2 || fregs.zmm2._ ## T [0] == zmm_regs[2]._ ## T [0]); \
+ assert (num_fregs <= 3 || fregs.zmm3._ ## T [0] == zmm_regs[3]._ ## T [0]); \
+ assert (num_fregs <= 4 || fregs.zmm4._ ## T [0] == zmm_regs[4]._ ## T [0]); \
+ assert (num_fregs <= 5 || fregs.zmm5._ ## T [0] == zmm_regs[5]._ ## T [0]); \
+ assert (num_fregs <= 6 || fregs.zmm6._ ## T [0] == zmm_regs[6]._ ## T [0]); \
+ assert (num_fregs <= 7 || fregs.zmm7._ ## T [0] == zmm_regs[7]._ ## T [0]); \
+ } while (0)
+
+#define check_float_arguments check_f_arguments(float)
+#define check_double_arguments check_f_arguments(double)
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.zmm0) + (O), \
+ &zmm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.zmm1) + (O), \
+ &zmm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.zmm2) + (O), \
+ &zmm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.zmm3) + (O), \
+ &zmm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.zmm4) + (O), \
+ &zmm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.zmm5) + (O), \
+ &zmm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.zmm6) + (O), \
+ &zmm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.zmm7) + (O), \
+ &zmm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m64_arguments check_vector_arguments(m64, 0)
+#define check_m128_arguments check_vector_arguments(m128, 0)
+#define check_m256_arguments check_vector_arguments(m256, 0)
+#define check_m512_arguments check_vector_arguments(m512, 0)
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
new file mode 100644
index 0000000..0ef8287
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
@@ -0,0 +1,97 @@
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ vmovdqu32 %zmm0, zmm_regs+0(%rip)
+ vmovdqu32 %zmm1, zmm_regs+64(%rip)
+ vmovdqu32 %zmm2, zmm_regs+128(%rip)
+ vmovdqu32 %zmm3, zmm_regs+192(%rip)
+ vmovdqu32 %zmm4, zmm_regs+256(%rip)
+ vmovdqu32 %zmm5, zmm_regs+320(%rip)
+ vmovdqu32 %zmm6, zmm_regs+384(%rip)
+ vmovdqu32 %zmm7, zmm_regs+448(%rip)
+ vmovdqu32 %zmm8, zmm_regs+512(%rip)
+ vmovdqu32 %zmm9, zmm_regs+576(%rip)
+ vmovdqu32 %zmm10, zmm_regs+640(%rip)
+ vmovdqu32 %zmm11, zmm_regs+704(%rip)
+ vmovdqu32 %zmm12, zmm_regs+768(%rip)
+ vmovdqu32 %zmm13, zmm_regs+832(%rip)
+ vmovdqu32 %zmm14, zmm_regs+896(%rip)
+ vmovdqu32 %zmm15, zmm_regs+960(%rip)
+ vmovdqu32 %zmm16, zmm_regs+1024(%rip)
+ vmovdqu32 %zmm17, zmm_regs+1088(%rip)
+ vmovdqu32 %zmm18, zmm_regs+1152(%rip)
+ vmovdqu32 %zmm19, zmm_regs+1216(%rip)
+ vmovdqu32 %zmm20, zmm_regs+1280(%rip)
+ vmovdqu32 %zmm21, zmm_regs+1344(%rip)
+ vmovdqu32 %zmm22, zmm_regs+1408(%rip)
+ vmovdqu32 %zmm23, zmm_regs+1472(%rip)
+ vmovdqu32 %zmm24, zmm_regs+1536(%rip)
+ vmovdqu32 %zmm25, zmm_regs+1600(%rip)
+ vmovdqu32 %zmm26, zmm_regs+1664(%rip)
+ vmovdqu32 %zmm27, zmm_regs+1728(%rip)
+ vmovdqu32 %zmm28, zmm_regs+1792(%rip)
+ vmovdqu32 %zmm29, zmm_regs+1856(%rip)
+ vmovdqu32 %zmm30, zmm_regs+1920(%rip)
+ vmovdqu32 %zmm31, zmm_regs+1984(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ vmovdqu32 %zmm0, zmm_regs+0(%rip)
+ vmovdqu32 %zmm1, zmm_regs+64(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm zmm_regs,2048,64
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/avx512fp16-zmm-check.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/avx512fp16-zmm-check.h
new file mode 100644
index 0000000..4b882cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/avx512fp16-zmm-check.h
@@ -0,0 +1,4 @@
+#define AVX512VL(ebx) 1
+#define XSTATE_MASK (XSTATE_SSE | XSTATE_YMM | XSTATE_ZMM \
+ | XSTATE_HI_ZMM | XSTATE_OPMASK)
+#include "../avx512fp16-check.h"
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_m512_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_m512_returning.c
new file mode 100644
index 0000000..5cb5943
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_m512_returning.c
@@ -0,0 +1,62 @@
+#include <stdio.h>
+#include "avx512fp16-zmm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+__m512
+fun_test_returning___m512 (void)
+{
+ volatile_var++;
+ return (__m512){73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+}
+
+__m512h
+fun_test_returning___m512h (void)
+{
+ volatile_var++;
+ return (__m512h){ 1.1f16, 2.2f16, 3.3f16, 4.4f16,
+ 5.5f16, 6.6f16, 7.7f16, 8.8f16,
+ 9.9f16, 10.10f16, 11.11f16, 12.12f16,
+ 13.13f16, 14.14f16, 15.15f16, 16.16f16,
+ 17.17f16, 18.18f16, 19.19f16, 20.20f16,
+ 21.21f16, 22.22f16, 23.23f16, 24.24f16,
+ 25.25f16, 26.26f16, 27.27f16, 28.28f16,
+ 29.29f16, 30.30f16, 31.31f16, 32.32f16};
+}
+
+__m512 test_512;
+__m512h test_512h;
+
+static void
+do_test (void)
+{
+ unsigned failed = 0;
+ ZMM_T zmmt1, zmmt2;
+
+ clear_struct_registers;
+ test_512 = (__m512){73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ zmmt1._m512[0] = test_512;
+ zmmt2._m512[0] = WRAP_RET (fun_test_returning___m512)();
+ if (memcmp (&zmmt1, &zmmt2, sizeof (zmmt2)) != 0)
+ printf ("fail m512\n"), failed++;
+
+ clear_struct_registers;
+ test_512h = (__m512h){ 1.1f16, 2.2f16, 3.3f16, 4.4f16,
+ 5.5f16, 6.6f16, 7.7f16, 8.8f16,
+ 9.9f16, 10.10f16, 11.11f16, 12.12f16,
+ 13.13f16, 14.14f16, 15.15f16, 16.16f16,
+ 17.17f16, 18.18f16, 19.19f16, 20.20f16,
+ 21.21f16, 22.22f16, 23.23f16, 24.24f16,
+ 25.25f16, 26.26f16, 27.27f16, 28.28f16,
+ 29.29f16, 30.30f16, 31.31f16, 32.32f16};
+ zmmt1._m512h[0] = test_512h;
+ zmmt2._m512h[0] = WRAP_RET (fun_test_returning___m512h)();
+ if (memcmp (&zmmt1, &zmmt2, sizeof (zmmt2)) != 0)
+ printf ("fail m512h\n"), failed++;
+
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_m512.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_m512.c
new file mode 100644
index 0000000..ad5ba2e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_m512.c
@@ -0,0 +1,380 @@
+#include <stdio.h>
+#include "avx512fp16-zmm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ ZMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,
+ i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+fun_check_passing_m512_8_values (__m512 i0 ATTRIBUTE_UNUSED,
+ __m512 i1 ATTRIBUTE_UNUSED,
+ __m512 i2 ATTRIBUTE_UNUSED,
+ __m512 i3 ATTRIBUTE_UNUSED,
+ __m512 i4 ATTRIBUTE_UNUSED,
+ __m512 i5 ATTRIBUTE_UNUSED,
+ __m512 i6 ATTRIBUTE_UNUSED,
+ __m512 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512);
+ compare (values.i1, i1, __m512);
+ compare (values.i2, i2, __m512);
+ compare (values.i3, i3, __m512);
+ compare (values.i4, i4, __m512);
+ compare (values.i5, i5, __m512);
+ compare (values.i6, i6, __m512);
+ compare (values.i7, i7, __m512);
+}
+
+fun_check_passing_m512h_8_values (__m512h i0 ATTRIBUTE_UNUSED,
+ __m512h i1 ATTRIBUTE_UNUSED,
+ __m512h i2 ATTRIBUTE_UNUSED,
+ __m512h i3 ATTRIBUTE_UNUSED,
+ __m512h i4 ATTRIBUTE_UNUSED,
+ __m512h i5 ATTRIBUTE_UNUSED,
+ __m512h i6 ATTRIBUTE_UNUSED,
+ __m512h i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512h);
+ compare (values.i1, i1, __m512h);
+ compare (values.i2, i2, __m512h);
+ compare (values.i3, i3, __m512h);
+ compare (values.i4, i4, __m512h);
+ compare (values.i5, i5, __m512h);
+ compare (values.i6, i6, __m512h);
+ compare (values.i7, i7, __m512h);
+}
+
+void
+fun_check_passing_m512_8_regs (__m512 i0 ATTRIBUTE_UNUSED,
+ __m512 i1 ATTRIBUTE_UNUSED,
+ __m512 i2 ATTRIBUTE_UNUSED,
+ __m512 i3 ATTRIBUTE_UNUSED,
+ __m512 i4 ATTRIBUTE_UNUSED,
+ __m512 i5 ATTRIBUTE_UNUSED,
+ __m512 i6 ATTRIBUTE_UNUSED,
+ __m512 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+fun_check_passing_m512h_8_regs (__m512h i0 ATTRIBUTE_UNUSED,
+ __m512h i1 ATTRIBUTE_UNUSED,
+ __m512h i2 ATTRIBUTE_UNUSED,
+ __m512h i3 ATTRIBUTE_UNUSED,
+ __m512h i4 ATTRIBUTE_UNUSED,
+ __m512h i5 ATTRIBUTE_UNUSED,
+ __m512h i6 ATTRIBUTE_UNUSED,
+ __m512h i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+fun_check_passing_m512_20_values (__m512 i0 ATTRIBUTE_UNUSED,
+ __m512 i1 ATTRIBUTE_UNUSED,
+ __m512 i2 ATTRIBUTE_UNUSED,
+ __m512 i3 ATTRIBUTE_UNUSED,
+ __m512 i4 ATTRIBUTE_UNUSED,
+ __m512 i5 ATTRIBUTE_UNUSED,
+ __m512 i6 ATTRIBUTE_UNUSED,
+ __m512 i7 ATTRIBUTE_UNUSED,
+ __m512 i8 ATTRIBUTE_UNUSED,
+ __m512 i9 ATTRIBUTE_UNUSED,
+ __m512 i10 ATTRIBUTE_UNUSED,
+ __m512 i11 ATTRIBUTE_UNUSED,
+ __m512 i12 ATTRIBUTE_UNUSED,
+ __m512 i13 ATTRIBUTE_UNUSED,
+ __m512 i14 ATTRIBUTE_UNUSED,
+ __m512 i15 ATTRIBUTE_UNUSED,
+ __m512 i16 ATTRIBUTE_UNUSED,
+ __m512 i17 ATTRIBUTE_UNUSED,
+ __m512 i18 ATTRIBUTE_UNUSED,
+ __m512 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512);
+ compare (values.i1, i1, __m512);
+ compare (values.i2, i2, __m512);
+ compare (values.i3, i3, __m512);
+ compare (values.i4, i4, __m512);
+ compare (values.i5, i5, __m512);
+ compare (values.i6, i6, __m512);
+ compare (values.i7, i7, __m512);
+ compare (values.i8, i8, __m512);
+ compare (values.i9, i9, __m512);
+ compare (values.i10, i10, __m512);
+ compare (values.i11, i11, __m512);
+ compare (values.i12, i12, __m512);
+ compare (values.i13, i13, __m512);
+ compare (values.i14, i14, __m512);
+ compare (values.i15, i15, __m512);
+ compare (values.i16, i16, __m512);
+ compare (values.i17, i17, __m512);
+ compare (values.i18, i18, __m512);
+ compare (values.i19, i19, __m512);
+}
+
+void
+fun_check_passing_m512h_20_values (__m512h i0 ATTRIBUTE_UNUSED,
+ __m512h i1 ATTRIBUTE_UNUSED,
+ __m512h i2 ATTRIBUTE_UNUSED,
+ __m512h i3 ATTRIBUTE_UNUSED,
+ __m512h i4 ATTRIBUTE_UNUSED,
+ __m512h i5 ATTRIBUTE_UNUSED,
+ __m512h i6 ATTRIBUTE_UNUSED,
+ __m512h i7 ATTRIBUTE_UNUSED,
+ __m512h i8 ATTRIBUTE_UNUSED,
+ __m512h i9 ATTRIBUTE_UNUSED,
+ __m512h i10 ATTRIBUTE_UNUSED,
+ __m512h i11 ATTRIBUTE_UNUSED,
+ __m512h i12 ATTRIBUTE_UNUSED,
+ __m512h i13 ATTRIBUTE_UNUSED,
+ __m512h i14 ATTRIBUTE_UNUSED,
+ __m512h i15 ATTRIBUTE_UNUSED,
+ __m512h i16 ATTRIBUTE_UNUSED,
+ __m512h i17 ATTRIBUTE_UNUSED,
+ __m512h i18 ATTRIBUTE_UNUSED,
+ __m512h i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512h);
+ compare (values.i1, i1, __m512h);
+ compare (values.i2, i2, __m512h);
+ compare (values.i3, i3, __m512h);
+ compare (values.i4, i4, __m512h);
+ compare (values.i5, i5, __m512h);
+ compare (values.i6, i6, __m512h);
+ compare (values.i7, i7, __m512h);
+ compare (values.i8, i8, __m512h);
+ compare (values.i9, i9, __m512h);
+ compare (values.i10, i10, __m512h);
+ compare (values.i11, i11, __m512h);
+ compare (values.i12, i12, __m512h);
+ compare (values.i13, i13, __m512h);
+ compare (values.i14, i14, __m512h);
+ compare (values.i15, i15, __m512h);
+ compare (values.i16, i16, __m512h);
+ compare (values.i17, i17, __m512h);
+ compare (values.i18, i18, __m512h);
+ compare (values.i19, i19, __m512h);
+}
+
+void
+fun_check_passing_m512_20_regs (__m512 i0 ATTRIBUTE_UNUSED,
+ __m512 i1 ATTRIBUTE_UNUSED,
+ __m512 i2 ATTRIBUTE_UNUSED,
+ __m512 i3 ATTRIBUTE_UNUSED,
+ __m512 i4 ATTRIBUTE_UNUSED,
+ __m512 i5 ATTRIBUTE_UNUSED,
+ __m512 i6 ATTRIBUTE_UNUSED,
+ __m512 i7 ATTRIBUTE_UNUSED,
+ __m512 i8 ATTRIBUTE_UNUSED,
+ __m512 i9 ATTRIBUTE_UNUSED,
+ __m512 i10 ATTRIBUTE_UNUSED,
+ __m512 i11 ATTRIBUTE_UNUSED,
+ __m512 i12 ATTRIBUTE_UNUSED,
+ __m512 i13 ATTRIBUTE_UNUSED,
+ __m512 i14 ATTRIBUTE_UNUSED,
+ __m512 i15 ATTRIBUTE_UNUSED,
+ __m512 i16 ATTRIBUTE_UNUSED,
+ __m512 i17 ATTRIBUTE_UNUSED,
+ __m512 i18 ATTRIBUTE_UNUSED,
+ __m512 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+fun_check_passing_m512h_20_regs (__m512h i0 ATTRIBUTE_UNUSED,
+ __m512h i1 ATTRIBUTE_UNUSED,
+ __m512h i2 ATTRIBUTE_UNUSED,
+ __m512h i3 ATTRIBUTE_UNUSED,
+ __m512h i4 ATTRIBUTE_UNUSED,
+ __m512h i5 ATTRIBUTE_UNUSED,
+ __m512h i6 ATTRIBUTE_UNUSED,
+ __m512h i7 ATTRIBUTE_UNUSED,
+ __m512h i8 ATTRIBUTE_UNUSED,
+ __m512h i9 ATTRIBUTE_UNUSED,
+ __m512h i10 ATTRIBUTE_UNUSED,
+ __m512h i11 ATTRIBUTE_UNUSED,
+ __m512h i12 ATTRIBUTE_UNUSED,
+ __m512h i13 ATTRIBUTE_UNUSED,
+ __m512h i14 ATTRIBUTE_UNUSED,
+ __m512h i15 ATTRIBUTE_UNUSED,
+ __m512h i16 ATTRIBUTE_UNUSED,
+ __m512h i17 ATTRIBUTE_UNUSED,
+ __m512h i18 ATTRIBUTE_UNUSED,
+ __m512h i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+#define def_check_passing8(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, \
+ _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, \
+ _i18, _i19, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, \
+ _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, \
+ _i18, _i19); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, \
+ _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, \
+ _i18, _i19);
+
+void
+test_m512_on_stack ()
+{
+ __m512 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m512){32 + i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m512-8";
+ def_check_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m512_8_values,
+ fun_check_passing_m512_8_regs, _m512);
+}
+
+void
+test_m512h_on_stack ()
+{
+ __m512h x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m512h){1.1f16 + i, 2.2f16 + i, 3.3f16 + i, 4.4f16 + i,
+ 5.5f16 + i, 6.6f16 + i, 7.7f16 + i, 8.8f16 + i,
+ 9.9f16 + i, 10.10f16 + i, 11.11f16 + i, 12.12f16 + i,
+ 13.13f16 + i, 14.14f16 + i, 15.15f16 + i, 16.16f16 + i,
+ 17.17f16 + i, 18.18f16 + i, 19.19f16 + i, 20.20f16 + i,
+ 21.21f16 + i, 22.22f16 + i, 23.23f16 + i, 24.24f16 + i,
+ 25.25f16 + i, 26.26f16 + i, 27.27f16 + i, 28.28f16 + i,
+ 29.29f16 + i, 30.30f16 + i, 31.31f16 + i, 32.32f16 + i};
+
+ pass = "m512h-8";
+ def_check_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m512h_8_values,
+ fun_check_passing_m512h_8_regs, _m512h);
+}
+
+void
+test_too_many_m512 ()
+{
+ __m512 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m512){32 + i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m512-20";
+ def_check_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8],
+ x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16],
+ x[17], x[18], x[19], fun_check_passing_m512_20_values,
+ fun_check_passing_m512_20_regs, _m512);
+}
+
+void
+test_too_many_m512h ()
+{
+ __m512h x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m512h){ 1.1f16 + i, 2.2f16 + i, 3.3f16 + i, 4.4f16 + i,
+ 5.5f16 + i, 6.6f16 + i, 7.7f16 + i, 8.8f16 + i,
+ 9.9f16 + i, 10.10f16 + i, 11.11f16 + i, 12.12f16 + i,
+ 13.13f16 + i, 14.14f16 + i, 15.15f16 + i, 16.16f16 + i,
+ 17.17f16 + i, 18.18f16 + i, 19.19f16 + i, 20.20f16 + i,
+ 21.21f16 + i, 22.22f16 + i, 23.23f16 + i, 24.24f16 + i,
+ 25.25f16 + i, 26.26f16 + i, 27.27f16 + i, 28.28f16 + i,
+ 29.29f16 + i, 30.30f16 + i, 31.31f16 + i, 32.32f16 + i};
+ pass = "m512h-20";
+ def_check_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8],
+ x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16],
+ x[17], x[18], x[19], fun_check_passing_m512h_20_values,
+ fun_check_passing_m512h_20_regs, _m512h);
+}
+
+static void
+do_test (void)
+{
+ test_m512_on_stack ();
+ test_too_many_m512 ();
+ test_m512h_on_stack ();
+ test_too_many_m512h ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_structs.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_structs.c
new file mode 100644
index 0000000..734e0f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_structs.c
@@ -0,0 +1,123 @@
+#include "avx512fp16-zmm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct m512_struct
+{
+ __m512 x;
+};
+
+struct m512h_struct
+{
+ __m512h x;
+};
+
+struct m512_2_struct
+{
+ __m512 x1, x2;
+};
+
+struct m512h_2_struct
+{
+ __m512h x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing1 (struct m512_struct ms1 ATTRIBUTE_UNUSED,
+ struct m512_struct ms2 ATTRIBUTE_UNUSED,
+ struct m512_struct ms3 ATTRIBUTE_UNUSED,
+ struct m512_struct ms4 ATTRIBUTE_UNUSED,
+ struct m512_struct ms5 ATTRIBUTE_UNUSED,
+ struct m512_struct ms6 ATTRIBUTE_UNUSED,
+ struct m512_struct ms7 ATTRIBUTE_UNUSED,
+ struct m512_struct ms8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_struct_passing1h (struct m512h_struct ms1 ATTRIBUTE_UNUSED,
+ struct m512h_struct ms2 ATTRIBUTE_UNUSED,
+ struct m512h_struct ms3 ATTRIBUTE_UNUSED,
+ struct m512h_struct ms4 ATTRIBUTE_UNUSED,
+ struct m512h_struct ms5 ATTRIBUTE_UNUSED,
+ struct m512h_struct ms6 ATTRIBUTE_UNUSED,
+ struct m512h_struct ms7 ATTRIBUTE_UNUSED,
+ struct m512h_struct ms8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_struct_passing2 (struct m512_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+72);
+}
+
+void
+check_struct_passing2h (struct m512h_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+72);
+}
+
+static void
+do_test (void)
+{
+ struct m512_struct m512s [8];
+ struct m512h_struct m512hs [8];
+ struct m512_2_struct m512_2s = {
+ { 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94,
+ 48.3941, 39.31, -397.91, 3484.91, -8.3941, -93.31, 7.91, 84.941 },
+ { -8.394, -3.3, -39.9, 34.9, 7.9, 84.94, -48.394, 39.3,
+ -8.3942, -3.32, -39.92, 34.92, 7.92, 84.942, -48.3942, 39.32 }
+ };
+ struct m512h_2_struct m512h_2s = {
+ { 58.395f16, 39.3f16, -397.9f16, 3585.9f16, -8.395f16, -93.3f16, 7.9f16, 85.95f16,
+ 58.395f16, 39.3f16, -397.9f16, 3585.9f16, -8.395f16, -93.3f16, 7.9f16, 85.95f16,
+ 58.395f16, 39.3f16, -397.9f16, 3585.9f16, -8.395f16, -93.3f16, 7.9f16, 85.95f16,
+ 58.3951f16, 39.31f16, -397.91f16, 3585.91f16, -8.3951f16, -93.31f16, 7.91f16, 85.951f16},
+ { 67.396f16, 39.3f16, -397.9f16, 3676.9f16, -7.396f16, -93.3f16, 7.9f16, 76.96f16,
+ 67.396f16, 39.3f16, -397.9f16, 3676.9f16, -7.396f16, -93.3f16, 7.9f16, 76.96f16,
+ 67.396f16, 39.3f16, -397.9f16, 3676.9f16, -7.396f16, -93.3f16, 7.9f16, 76.96f16,
+ 67.3961f16, 39.31f16, -397.91f16, 3676.91f16, -7.3961f16, -93.31f16, 7.91f16, 76.961f16},
+ };
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ m512s[i].x = (__m512){32+i, 0, i, 0, -i, 0, i - 12, i + 8,
+ 32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+ m512hs[i].x = (__m512h){33+i, 1, i, 2, -i, 0, i - 15, i + 9,
+ 34+i, 1, i, 2, -i, 0, i - 15, i + 9,
+ 35+i, 1, i, 2, -i, 0, i - 15, i + 9,
+ 36+i, 1, i, 2, -i, 0, i - 15, i + 9};
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512[0] = m512s[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1)(m512s[0], m512s[1], m512s[2], m512s[3],
+ m512s[4], m512s[5], m512s[6], m512s[7]);
+ WRAP_CALL (check_struct_passing2)(m512_2s);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512h[0] = m512hs[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1h)(m512hs[0], m512hs[1], m512hs[2], m512hs[3],
+ m512hs[4], m512hs[5], m512hs[6], m512hs[7]);
+ WRAP_CALL (check_struct_passing2h)(m512h_2s);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_unions.c
new file mode 100644
index 0000000..fa801fb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_unions.c
@@ -0,0 +1,415 @@
+#include "avx512fp16-zmm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+union un1
+{
+ __m512 x;
+ float f;
+};
+
+union un2
+{
+ __m512 x;
+ double d;
+};
+
+union un3
+{
+ __m512 x;
+ __m128 v;
+};
+
+union un4
+{
+ __m512 x;
+ long double ld;
+};
+
+union un5
+{
+ __m512 x;
+ int i;
+};
+
+union un6
+{
+ __m512 x;
+ __m256 v;
+};
+
+union un1h
+{
+ __m512 x;
+ _Float16 f;
+};
+
+union un1hf
+{
+ __m512h x;
+ float f;
+};
+
+union un1hh
+{
+ __m512h x;
+ _Float16 f;
+};
+
+union un2h
+{
+ __m512h x;
+ double d;
+};
+
+union un3h
+{
+ __m512h x;
+ __m128 v;
+};
+
+union un4h
+{
+ __m512h x;
+ long double ld;
+};
+
+union un5h
+{
+ __m512h x;
+ int i;
+};
+
+union un6h
+{
+ __m512h x;
+ __m256 v;
+};
+
+void
+check_union_passing1(union un1 u1 ATTRIBUTE_UNUSED,
+ union un1 u2 ATTRIBUTE_UNUSED,
+ union un1 u3 ATTRIBUTE_UNUSED,
+ union un1 u4 ATTRIBUTE_UNUSED,
+ union un1 u5 ATTRIBUTE_UNUSED,
+ union un1 u6 ATTRIBUTE_UNUSED,
+ union un1 u7 ATTRIBUTE_UNUSED,
+ union un1 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing1h(union un1h u1 ATTRIBUTE_UNUSED,
+ union un1h u2 ATTRIBUTE_UNUSED,
+ union un1h u3 ATTRIBUTE_UNUSED,
+ union un1h u4 ATTRIBUTE_UNUSED,
+ union un1h u5 ATTRIBUTE_UNUSED,
+ union un1h u6 ATTRIBUTE_UNUSED,
+ union un1h u7 ATTRIBUTE_UNUSED,
+ union un1h u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing1hf(union un1hf u1 ATTRIBUTE_UNUSED,
+ union un1hf u2 ATTRIBUTE_UNUSED,
+ union un1hf u3 ATTRIBUTE_UNUSED,
+ union un1hf u4 ATTRIBUTE_UNUSED,
+ union un1hf u5 ATTRIBUTE_UNUSED,
+ union un1hf u6 ATTRIBUTE_UNUSED,
+ union un1hf u7 ATTRIBUTE_UNUSED,
+ union un1hf u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing1hh(union un1hh u1 ATTRIBUTE_UNUSED,
+ union un1hh u2 ATTRIBUTE_UNUSED,
+ union un1hh u3 ATTRIBUTE_UNUSED,
+ union un1hh u4 ATTRIBUTE_UNUSED,
+ union un1hh u5 ATTRIBUTE_UNUSED,
+ union un1hh u6 ATTRIBUTE_UNUSED,
+ union un1hh u7 ATTRIBUTE_UNUSED,
+ union un1hh u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+
+void
+check_union_passing2(union un2 u1 ATTRIBUTE_UNUSED,
+ union un2 u2 ATTRIBUTE_UNUSED,
+ union un2 u3 ATTRIBUTE_UNUSED,
+ union un2 u4 ATTRIBUTE_UNUSED,
+ union un2 u5 ATTRIBUTE_UNUSED,
+ union un2 u6 ATTRIBUTE_UNUSED,
+ union un2 u7 ATTRIBUTE_UNUSED,
+ union un2 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing2h(union un2h u1 ATTRIBUTE_UNUSED,
+ union un2h u2 ATTRIBUTE_UNUSED,
+ union un2h u3 ATTRIBUTE_UNUSED,
+ union un2h u4 ATTRIBUTE_UNUSED,
+ union un2h u5 ATTRIBUTE_UNUSED,
+ union un2h u6 ATTRIBUTE_UNUSED,
+ union un2h u7 ATTRIBUTE_UNUSED,
+ union un2h u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing3(union un3 u1 ATTRIBUTE_UNUSED,
+ union un3 u2 ATTRIBUTE_UNUSED,
+ union un3 u3 ATTRIBUTE_UNUSED,
+ union un3 u4 ATTRIBUTE_UNUSED,
+ union un3 u5 ATTRIBUTE_UNUSED,
+ union un3 u6 ATTRIBUTE_UNUSED,
+ union un3 u7 ATTRIBUTE_UNUSED,
+ union un3 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing3h(union un3h u1 ATTRIBUTE_UNUSED,
+ union un3h u2 ATTRIBUTE_UNUSED,
+ union un3h u3 ATTRIBUTE_UNUSED,
+ union un3h u4 ATTRIBUTE_UNUSED,
+ union un3h u5 ATTRIBUTE_UNUSED,
+ union un3h u6 ATTRIBUTE_UNUSED,
+ union un3h u7 ATTRIBUTE_UNUSED,
+ union un3h u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing4(union un4 u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing4h(union un4h u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing5(union un5 u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+void
+check_union_passing5h(union un5h u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+void
+check_union_passing6(union un6 u1 ATTRIBUTE_UNUSED,
+ union un6 u2 ATTRIBUTE_UNUSED,
+ union un6 u3 ATTRIBUTE_UNUSED,
+ union un6 u4 ATTRIBUTE_UNUSED,
+ union un6 u5 ATTRIBUTE_UNUSED,
+ union un6 u6 ATTRIBUTE_UNUSED,
+ union un6 u7 ATTRIBUTE_UNUSED,
+ union un6 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing6h(union un6h u1 ATTRIBUTE_UNUSED,
+ union un6h u2 ATTRIBUTE_UNUSED,
+ union un6h u3 ATTRIBUTE_UNUSED,
+ union un6h u4 ATTRIBUTE_UNUSED,
+ union un6h u5 ATTRIBUTE_UNUSED,
+ union un6h u6 ATTRIBUTE_UNUSED,
+ union un6h u7 ATTRIBUTE_UNUSED,
+ union un6h u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+#define check_union_passing1 WRAP_CALL(check_union_passing1)
+#define check_union_passing2 WRAP_CALL(check_union_passing2)
+#define check_union_passing3 WRAP_CALL(check_union_passing3)
+#define check_union_passing4 WRAP_CALL(check_union_passing4)
+#define check_union_passing5 WRAP_CALL(check_union_passing5)
+#define check_union_passing6 WRAP_CALL(check_union_passing6)
+
+#define check_union_passing1h WRAP_CALL(check_union_passing1h)
+#define check_union_passing1hf WRAP_CALL(check_union_passing1hf)
+#define check_union_passing1hh WRAP_CALL(check_union_passing1hh)
+#define check_union_passing2h WRAP_CALL(check_union_passing2h)
+#define check_union_passing3h WRAP_CALL(check_union_passing3h)
+#define check_union_passing4h WRAP_CALL(check_union_passing4h)
+#define check_union_passing5h WRAP_CALL(check_union_passing5h)
+#define check_union_passing6h WRAP_CALL(check_union_passing6h)
+
+
+static void
+do_test (void)
+{
+ union un1 u1[8];
+ union un2 u2[8];
+ union un3 u3[8];
+ union un4 u4;
+ union un5 u5;
+ union un6 u6[8];
+ union un1h u1h[8];
+ union un1hf u1hf[8];
+ union un1hh u1hh[8];
+ union un2h u2h[8];
+ union un3h u3h[8];
+ union un4h u4h;
+ union un5h u5h;
+ union un6h u6h[8];
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ u1[i].x = (__m512){32+i, 0, i, 0, -i, 0, i - 12, i + 8,
+ 32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+
+ u1hf[i].x = (__m512h){ 33+i, 1, i, 2, -i, 0, i - 15, i + 9,
+ 34+i, 1, i, 2, -i, 0, i - 15, i + 9,
+ 35+i, 1, i, 2, -i, 0, i - 15, i + 9,
+ 36+i, 1, i, 2, -i, 0, i - 15, i + 9};
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512[0] = u1[i].x;
+ num_fregs = 8;
+ check_union_passing1(u1[0], u1[1], u1[2], u1[3],
+ u1[4], u1[5], u1[6], u1[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u1h[i].x = u1[i].x;
+ (&fregs.zmm0)[i]._m512[0] = u1h[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing1h(u1h[0], u1h[1], u1h[2], u1h[3],
+ u1h[4], u1h[5], u1h[6], u1h[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512h[0] = u1hf[i].x;
+ num_fregs = 8;
+ check_union_passing1hf(u1hf[0], u1hf[1], u1hf[2], u1hf[3],
+ u1hf[4], u1hf[5], u1hf[6], u1hf[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u1hh[i].x = u1hf[i].x;
+ (&fregs.zmm0)[i]._m512h[0] = u1hh[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing1hh(u1hh[0], u1hh[1], u1hh[2], u1hh[3],
+ u1hh[4], u1hh[5], u1hh[6], u1hh[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2[i].x = u1[i].x;
+ (&fregs.zmm0)[i]._m512[0] = u2[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2(u2[0], u2[1], u2[2], u2[3],
+ u2[4], u2[5], u2[6], u2[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2h[i].x = u1hf[i].x;
+ (&fregs.zmm0)[i]._m512h[0] = u2h[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2h(u2h[0], u2h[1], u2h[2], u2h[3],
+ u2h[4], u2h[5], u2h[6], u2h[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3[i].x = u1[i].x;
+ (&fregs.zmm0)[i]._m512[0] = u3[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3(u3[0], u3[1], u3[2], u3[3],
+ u3[4], u3[5], u3[6], u3[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3h[i].x = u1hf[i].x;
+ (&fregs.zmm0)[i]._m512h[0] = u3h[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3h(u3h[0], u3h[1], u3h[2], u3h[3],
+ u3h[4], u3h[5], u3h[6], u3h[7]);
+
+ check_union_passing4(u4);
+ check_union_passing5(u5);
+
+ check_union_passing4h(u4h);
+ check_union_passing5h(u5h);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u6[i].x = u1[i].x;
+ (&fregs.zmm0)[i]._m512[0] = u6[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing6(u6[0], u6[1], u6[2], u6[3],
+ u6[4], u6[5], u6[6], u6[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u6h[i].x = u1hf[i].x;
+ (&fregs.zmm0)[i]._m512h[0] = u6h[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing6h(u6h[0], u6h[1], u6h[2], u6h[3],
+ u6h[4], u6h[5], u6h[6], u6h[7]);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_varargs-m512.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_varargs-m512.c
new file mode 100644
index 0000000..e6d165a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/test_varargs-m512.c
@@ -0,0 +1,164 @@
+/* Test variable number of 512-bit vector arguments passed to functions. */
+
+#include <stdio.h>
+#include "avx512fp16-zmm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ ZMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m512_varargs (__m512 i0, __m512 i1, __m512 i2,
+ __m512 i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m512 *argp;
+
+ compare (values.i0, i0, __m512);
+ compare (values.i1, i1, __m512);
+ compare (values.i2, i2, __m512);
+ compare (values.i3, i3, __m512);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m512 *)(((char *) fp) + 8);
+
+ /* Check __m512 arguments passed on stack. */
+ compare (values.i4, argp[0], __m512);
+ compare (values.i5, argp[1], __m512);
+ compare (values.i6, argp[2], __m512);
+ compare (values.i7, argp[3], __m512);
+ compare (values.i8, argp[4], __m512);
+ compare (values.i9, argp[5], __m512);
+
+ /* Check register contents. */
+ compare (fregs.zmm0, zmm_regs[0], __m512);
+ compare (fregs.zmm1, zmm_regs[1], __m512);
+ compare (fregs.zmm2, zmm_regs[2], __m512);
+ compare (fregs.zmm3, zmm_regs[3], __m512);
+}
+
+void
+fun_check_passing_m512h_varargs (__m512h i0, __m512h i1, __m512h i2,
+ __m512h i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m512h *argp;
+
+ compare (values.i0, i0, __m512h);
+ compare (values.i1, i1, __m512h);
+ compare (values.i2, i2, __m512h);
+ compare (values.i3, i3, __m512h);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m512h *)(((char *) fp) + 8);
+
+ /* Check __m512h arguments passed on stack. */
+ compare (values.i4, argp[0], __m512h);
+ compare (values.i5, argp[1], __m512h);
+ compare (values.i6, argp[2], __m512h);
+ compare (values.i7, argp[3], __m512h);
+ compare (values.i8, argp[4], __m512h);
+ compare (values.i9, argp[5], __m512h);
+
+ /* Check register contents. */
+ compare (fregs.zmm0, zmm_regs[0], __m512h);
+ compare (fregs.zmm1, zmm_regs[1], __m512h);
+ compare (fregs.zmm2, zmm_regs[2], __m512h);
+ compare (fregs.zmm3, zmm_regs[3], __m512h);
+}
+
+#define def_check_int_passing_varargs(_i0, _i1, _i2, _i3, _i4, _i5, \
+ _i6, _i7, _i8, _i9, \
+ _func, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ WRAP_CALL(_func) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9);
+
+void
+test_m512_varargs (void)
+{
+ __m512 x[10];
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m512){32+i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m512-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m512_varargs,
+ _m512);
+}
+
+void
+test_m512h_varargs (void)
+{
+ __m512h x[10];
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m512h) {
+ 1.1f16 + i, 2.2f16 + i, 3.3f16 + i, 4.4f16 + i,
+ 5.5f16 + i, 6.6f16 + i, 7.7f16 + i, 8.8f16 + i,
+ 9.9f16 + i, 10.10f16 + i, 11.11f16 + i, 12.12f16 + i,
+ 13.13f16 + i, 14.14f16 + i, 15.15f16 + i, 16.16f16 + i,
+ 17.17f16 + i, 18.18f16 + i, 19.19f16 + i, 20.20f16 + i,
+ 21.21f16 + i, 22.22f16 + i, 23.23f16 + i, 24.24f16 + i,
+ 25.25f16 + i, 26.26f16 + i, 27.27f16 + i, 28.28f16 + i,
+ 29.29f16 + i, 30.30f16 + i, 31.31f16 + i, 32.32f16 + i
+ };
+ pass = "m512h-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m512h_varargs,
+ _m512h);
+}
+
+void
+do_test (void)
+{
+ test_m512_varargs ();
+ test_m512h_varargs ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/macros.h b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/macros.h
new file mode 100644
index 0000000..98fbc66
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/macros.h
@@ -0,0 +1,53 @@
+#ifndef MACROS_H
+
+#define check_size(_t, _size) assert(sizeof(_t) == (_size))
+
+#define check_align(_t, _align) assert(__alignof__(_t) == (_align))
+
+#define check_align_lv(_t, _align) assert(__alignof__(_t) == (_align) \
+ && (((unsigned long)&(_t)) & ((_align) - 1) ) == 0)
+
+#define check_basic_struct_size_and_align(_type, _size, _align) { \
+ struct _str { _type dummy; } _t; \
+ check_size(_t, _size); \
+ check_align_lv(_t, _align); \
+}
+
+#define check_array_size_and_align(_type, _size, _align) { \
+ _type _a[1]; _type _b[2]; _type _c[16]; \
+ struct _str { _type _a[1]; } _s; \
+ check_align_lv(_a[0], _align); \
+ check_size(_a, _size); \
+ check_size(_b, (_size*2)); \
+ check_size(_c, (_size*16)); \
+ check_size(_s, _size); \
+ check_align_lv(_s._a[0], _align); \
+}
+
+#define check_basic_union_size_and_align(_type, _size, _align) { \
+ union _union { _type dummy; } _u; \
+ check_size(_u, _size); \
+ check_align_lv(_u, _align); \
+}
+
+#define run_signed_tests2(_function, _arg1, _arg2) \
+ _function(_arg1, _arg2); \
+ _function(signed _arg1, _arg2); \
+ _function(unsigned _arg1, _arg2);
+
+#define run_signed_tests3(_function, _arg1, _arg2, _arg3) \
+ _function(_arg1, _arg2, _arg3); \
+ _function(signed _arg1, _arg2, _arg3); \
+ _function(unsigned _arg1, _arg2, _arg3);
+
+/* Check size of a struct and a union of three types. */
+
+#define check_struct_and_union3(type1, type2, type3, struct_size, align_size) \
+{ \
+ struct _str { type1 t1; type2 t2; type3 t3; } _t; \
+ union _uni { type1 t1; type2 t2; type3 t3; } _u; \
+ check_size(_t, struct_size); \
+ check_size(_u, align_size); \
+}
+
+#endif // MACROS_H
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_3_element_struct_and_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_3_element_struct_and_unions.c
new file mode 100644
index 0000000..869eec5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_3_element_struct_and_unions.c
@@ -0,0 +1,794 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "defines.h"
+#include "macros.h"
+
+/* Check structs and unions of all permutations of 3 basic types. */
+int
+main (void)
+{
+ check_struct_and_union3(char, char, char, 3, 1);
+ check_struct_and_union3(char, char, short, 4, 2);
+ check_struct_and_union3(char, char, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, char, long, 16, 8);
+#endif
+ check_struct_and_union3(char, char, long long, 16, 8);
+ check_struct_and_union3(char, char, float, 8, 4);
+ check_struct_and_union3(char, char, double, 16, 8);
+ check_struct_and_union3(char, char, long double, 32, 16);
+ check_struct_and_union3(char, short, char, 6, 2);
+ check_struct_and_union3(char, short, short, 6, 2);
+ check_struct_and_union3(char, short, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, short, long, 16, 8);
+#endif
+ check_struct_and_union3(char, short, long long, 16, 8);
+ check_struct_and_union3(char, short, float, 8, 4);
+ check_struct_and_union3(char, short, double, 16, 8);
+ check_struct_and_union3(char, short, long double, 32, 16);
+ check_struct_and_union3(char, int, char, 12, 4);
+ check_struct_and_union3(char, int, short, 12, 4);
+ check_struct_and_union3(char, int, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, int, long, 16, 8);
+#endif
+ check_struct_and_union3(char, int, long long, 16, 8);
+ check_struct_and_union3(char, int, float, 12, 4);
+ check_struct_and_union3(char, int, double, 16, 8);
+ check_struct_and_union3(char, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(char, long, char, 24, 8);
+ check_struct_and_union3(char, long, short, 24, 8);
+ check_struct_and_union3(char, long, int, 24, 8);
+ check_struct_and_union3(char, long, long, 24, 8);
+ check_struct_and_union3(char, long, long long, 24, 8);
+ check_struct_and_union3(char, long, float, 24, 8);
+ check_struct_and_union3(char, long, double, 24, 8);
+ check_struct_and_union3(char, long, long double, 32, 16);
+#endif
+ check_struct_and_union3(char, long long, char, 24, 8);
+ check_struct_and_union3(char, long long, short, 24, 8);
+ check_struct_and_union3(char, long long, int, 24, 8);
+ check_struct_and_union3(char, long long, long, 24, 8);
+ check_struct_and_union3(char, long long, long long, 24, 8);
+ check_struct_and_union3(char, long long, float, 24, 8);
+ check_struct_and_union3(char, long long, double, 24, 8);
+ check_struct_and_union3(char, long long, long double, 32, 16);
+ check_struct_and_union3(char, float, char, 12, 4);
+ check_struct_and_union3(char, float, short, 12, 4);
+ check_struct_and_union3(char, float, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, float, long, 16, 8);
+#endif
+ check_struct_and_union3(char, float, long long, 16, 8);
+ check_struct_and_union3(char, float, float, 12, 4);
+ check_struct_and_union3(char, float, double, 16, 8);
+ check_struct_and_union3(char, float, long double, 32, 16);
+ check_struct_and_union3(char, double, char, 24, 8);
+ check_struct_and_union3(char, double, short, 24, 8);
+ check_struct_and_union3(char, double, int, 24, 8);
+ check_struct_and_union3(char, double, long, 24, 8);
+ check_struct_and_union3(char, double, long long, 24, 8);
+ check_struct_and_union3(char, double, float, 24, 8);
+ check_struct_and_union3(char, double, double, 24, 8);
+ check_struct_and_union3(char, double, long double, 32, 16);
+ check_struct_and_union3(char, long double, char, 48, 16);
+ check_struct_and_union3(char, long double, short, 48, 16);
+ check_struct_and_union3(char, long double, int, 48, 16);
+ check_struct_and_union3(char, long double, long, 48, 16);
+ check_struct_and_union3(char, long double, long long, 48, 16);
+ check_struct_and_union3(char, long double, float, 48, 16);
+ check_struct_and_union3(char, long double, double, 48, 16);
+ check_struct_and_union3(char, long double, long double, 48, 16);
+ check_struct_and_union3(short, char, char, 4, 2);
+ check_struct_and_union3(short, char, short, 6, 2);
+ check_struct_and_union3(short, char, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(short, char, long, 16, 8);
+#endif
+ check_struct_and_union3(short, char, long long, 16, 8);
+ check_struct_and_union3(short, char, float, 8, 4);
+ check_struct_and_union3(short, char, double, 16, 8);
+ check_struct_and_union3(short, char, long double, 32, 16);
+ check_struct_and_union3(short, short, char, 6, 2);
+ check_struct_and_union3(short, short, short, 6, 2);
+ check_struct_and_union3(short, short, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(short, short, long, 16, 8);
+#endif
+ check_struct_and_union3(short, short, long long, 16, 8);
+ check_struct_and_union3(short, short, float, 8, 4);
+ check_struct_and_union3(short, short, double, 16, 8);
+ check_struct_and_union3(short, short, long double, 32, 16);
+ check_struct_and_union3(short, int, char, 12, 4);
+ check_struct_and_union3(short, int, short, 12, 4);
+ check_struct_and_union3(short, int, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(short, int, long, 16, 8);
+#endif
+ check_struct_and_union3(short, int, long long, 16, 8);
+ check_struct_and_union3(short, int, float, 12, 4);
+ check_struct_and_union3(short, int, double, 16, 8);
+ check_struct_and_union3(short, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(short, long, char, 24, 8);
+ check_struct_and_union3(short, long, short, 24, 8);
+ check_struct_and_union3(short, long, int, 24, 8);
+ check_struct_and_union3(short, long, long, 24, 8);
+ check_struct_and_union3(short, long, long long, 24, 8);
+ check_struct_and_union3(short, long, float, 24, 8);
+ check_struct_and_union3(short, long, double, 24, 8);
+ check_struct_and_union3(short, long, long double, 32, 16);
+#endif
+ check_struct_and_union3(short, long long, char, 24, 8);
+ check_struct_and_union3(short, long long, short, 24, 8);
+ check_struct_and_union3(short, long long, int, 24, 8);
+ check_struct_and_union3(short, long long, long, 24, 8);
+ check_struct_and_union3(short, long long, long long, 24, 8);
+ check_struct_and_union3(short, long long, float, 24, 8);
+ check_struct_and_union3(short, long long, double, 24, 8);
+ check_struct_and_union3(short, long long, long double, 32, 16);
+ check_struct_and_union3(short, float, char, 12, 4);
+ check_struct_and_union3(short, float, short, 12, 4);
+ check_struct_and_union3(short, float, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(short, float, long, 16, 8);
+#endif
+ check_struct_and_union3(short, float, long long, 16, 8);
+ check_struct_and_union3(short, float, float, 12, 4);
+ check_struct_and_union3(short, float, double, 16, 8);
+ check_struct_and_union3(short, float, long double, 32, 16);
+ check_struct_and_union3(short, double, char, 24, 8);
+ check_struct_and_union3(short, double, short, 24, 8);
+ check_struct_and_union3(short, double, int, 24, 8);
+ check_struct_and_union3(short, double, long, 24, 8);
+ check_struct_and_union3(short, double, long long, 24, 8);
+ check_struct_and_union3(short, double, float, 24, 8);
+ check_struct_and_union3(short, double, double, 24, 8);
+ check_struct_and_union3(short, double, long double, 32, 16);
+ check_struct_and_union3(short, long double, char, 48, 16);
+ check_struct_and_union3(short, long double, short, 48, 16);
+ check_struct_and_union3(short, long double, int, 48, 16);
+ check_struct_and_union3(short, long double, long, 48, 16);
+ check_struct_and_union3(short, long double, long long, 48, 16);
+ check_struct_and_union3(short, long double, float, 48, 16);
+ check_struct_and_union3(short, long double, double, 48, 16);
+ check_struct_and_union3(short, long double, long double, 48, 16);
+ check_struct_and_union3(int, char, char, 8, 4);
+ check_struct_and_union3(int, char, short, 8, 4);
+ check_struct_and_union3(int, char, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, char, long, 16, 8);
+#endif
+ check_struct_and_union3(int, char, long long, 16, 8);
+ check_struct_and_union3(int, char, float, 12, 4);
+ check_struct_and_union3(int, char, double, 16, 8);
+ check_struct_and_union3(int, char, long double, 32, 16);
+ check_struct_and_union3(int, short, char, 8, 4);
+ check_struct_and_union3(int, short, short, 8, 4);
+ check_struct_and_union3(int, short, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, short, long, 16, 8);
+#endif
+ check_struct_and_union3(int, short, long long, 16, 8);
+ check_struct_and_union3(int, short, float, 12, 4);
+ check_struct_and_union3(int, short, double, 16, 8);
+ check_struct_and_union3(int, short, long double, 32, 16);
+ check_struct_and_union3(int, int, char, 12, 4);
+ check_struct_and_union3(int, int, short, 12, 4);
+ check_struct_and_union3(int, int, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, int, long, 16, 8);
+#endif
+ check_struct_and_union3(int, int, long long, 16, 8);
+ check_struct_and_union3(int, int, float, 12, 4);
+ check_struct_and_union3(int, int, double, 16, 8);
+ check_struct_and_union3(int, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(int, long, char, 24, 8);
+ check_struct_and_union3(int, long, short, 24, 8);
+ check_struct_and_union3(int, long, int, 24, 8);
+ check_struct_and_union3(int, long, long, 24, 8);
+ check_struct_and_union3(int, long, long long, 24, 8);
+ check_struct_and_union3(int, long, float, 24, 8);
+ check_struct_and_union3(int, long, double, 24, 8);
+#endif
+ check_struct_and_union3(int, long, long double, 32, 16);
+ check_struct_and_union3(int, long long, char, 24, 8);
+ check_struct_and_union3(int, long long, short, 24, 8);
+ check_struct_and_union3(int, long long, int, 24, 8);
+ check_struct_and_union3(int, long long, long, 24, 8);
+ check_struct_and_union3(int, long long, long long, 24, 8);
+ check_struct_and_union3(int, long long, float, 24, 8);
+ check_struct_and_union3(int, long long, double, 24, 8);
+ check_struct_and_union3(int, long long, long double, 32, 16);
+ check_struct_and_union3(int, float, char, 12, 4);
+ check_struct_and_union3(int, float, short, 12, 4);
+ check_struct_and_union3(int, float, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, float, long, 16, 8);
+#endif
+ check_struct_and_union3(int, float, long long, 16, 8);
+ check_struct_and_union3(int, float, float, 12, 4);
+ check_struct_and_union3(int, float, double, 16, 8);
+ check_struct_and_union3(int, float, long double, 32, 16);
+ check_struct_and_union3(int, double, char, 24, 8);
+ check_struct_and_union3(int, double, short, 24, 8);
+ check_struct_and_union3(int, double, int, 24, 8);
+ check_struct_and_union3(int, double, long, 24, 8);
+ check_struct_and_union3(int, double, long long, 24, 8);
+ check_struct_and_union3(int, double, float, 24, 8);
+ check_struct_and_union3(int, double, double, 24, 8);
+ check_struct_and_union3(int, double, long double, 32, 16);
+ check_struct_and_union3(int, long double, char, 48, 16);
+ check_struct_and_union3(int, long double, short, 48, 16);
+ check_struct_and_union3(int, long double, int, 48, 16);
+ check_struct_and_union3(int, long double, long, 48, 16);
+ check_struct_and_union3(int, long double, long long, 48, 16);
+ check_struct_and_union3(int, long double, float, 48, 16);
+ check_struct_and_union3(int, long double, double, 48, 16);
+ check_struct_and_union3(int, long double, long double, 48, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(long, char, char, 16, 8);
+ check_struct_and_union3(long, char, short, 16, 8);
+ check_struct_and_union3(long, char, int, 16, 8);
+ check_struct_and_union3(long, char, long, 24, 8);
+ check_struct_and_union3(long, char, long long, 24, 8);
+ check_struct_and_union3(long, char, float, 16, 8);
+ check_struct_and_union3(long, char, double, 24, 8);
+ check_struct_and_union3(long, char, long double, 32, 16);
+ check_struct_and_union3(long, short, char, 16, 8);
+ check_struct_and_union3(long, short, short, 16, 8);
+ check_struct_and_union3(long, short, int, 16, 8);
+ check_struct_and_union3(long, short, long, 24, 8);
+ check_struct_and_union3(long, short, long long, 24, 8);
+ check_struct_and_union3(long, short, float, 16, 8);
+ check_struct_and_union3(long, short, double, 24, 8);
+ check_struct_and_union3(long, short, long double, 32, 16);
+ check_struct_and_union3(long, int, char, 16, 8);
+ check_struct_and_union3(long, int, short, 16, 8);
+ check_struct_and_union3(long, int, int, 16, 8);
+ check_struct_and_union3(long, int, long, 24, 8);
+ check_struct_and_union3(long, int, long long, 24, 8);
+ check_struct_and_union3(long, int, float, 16, 8);
+ check_struct_and_union3(long, int, double, 24, 8);
+#endif
+ check_struct_and_union3(long, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(long, long, char, 24, 8);
+ check_struct_and_union3(long, long, short, 24, 8);
+ check_struct_and_union3(long, long, int, 24, 8);
+ check_struct_and_union3(long, long, long, 24, 8);
+ check_struct_and_union3(long, long, long long, 24, 8);
+ check_struct_and_union3(long, long, float, 24, 8);
+ check_struct_and_union3(long, long, double, 24, 8);
+ check_struct_and_union3(long, long, long double, 32, 16);
+ check_struct_and_union3(long, long long, char, 24, 8);
+ check_struct_and_union3(long, long long, short, 24, 8);
+ check_struct_and_union3(long, long long, int, 24, 8);
+ check_struct_and_union3(long, long long, long, 24, 8);
+ check_struct_and_union3(long, long long, long long, 24, 8);
+ check_struct_and_union3(long, long long, float, 24, 8);
+ check_struct_and_union3(long, long long, double, 24, 8);
+ check_struct_and_union3(long, long long, long double, 32, 16);
+ check_struct_and_union3(long, float, char, 16, 8);
+ check_struct_and_union3(long, float, short, 16, 8);
+ check_struct_and_union3(long, float, int, 16, 8);
+ check_struct_and_union3(long, float, long, 24, 8);
+ check_struct_and_union3(long, float, long long, 24, 8);
+ check_struct_and_union3(long, float, float, 16, 8);
+ check_struct_and_union3(long, float, double, 24, 8);
+ check_struct_and_union3(long, float, long double, 32, 16);
+ check_struct_and_union3(long, double, char, 24, 8);
+ check_struct_and_union3(long, double, short, 24, 8);
+ check_struct_and_union3(long, double, int, 24, 8);
+ check_struct_and_union3(long, double, long, 24, 8);
+ check_struct_and_union3(long, double, long long, 24, 8);
+ check_struct_and_union3(long, double, float, 24, 8);
+ check_struct_and_union3(long, double, double, 24, 8);
+ check_struct_and_union3(long, double, long double, 32, 16);
+ check_struct_and_union3(long, long double, char, 48, 16);
+ check_struct_and_union3(long, long double, short, 48, 16);
+ check_struct_and_union3(long, long double, int, 48, 16);
+ check_struct_and_union3(long, long double, long, 48, 16);
+ check_struct_and_union3(long, long double, long long, 48, 16);
+ check_struct_and_union3(long, long double, float, 48, 16);
+ check_struct_and_union3(long, long double, double, 48, 16);
+ check_struct_and_union3(long, long double, long double, 48, 16);
+#endif
+ check_struct_and_union3(long long, char, char, 16, 8);
+ check_struct_and_union3(long long, char, short, 16, 8);
+ check_struct_and_union3(long long, char, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, char, long, 24, 8);
+#endif
+ check_struct_and_union3(long long, char, long long, 24, 8);
+ check_struct_and_union3(long long, char, float, 16, 8);
+ check_struct_and_union3(long long, char, double, 24, 8);
+ check_struct_and_union3(long long, char, long double, 32, 16);
+ check_struct_and_union3(long long, short, char, 16, 8);
+ check_struct_and_union3(long long, short, short, 16, 8);
+ check_struct_and_union3(long long, short, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, short, long, 24, 8);
+#endif
+ check_struct_and_union3(long long, short, long long, 24, 8);
+ check_struct_and_union3(long long, short, float, 16, 8);
+ check_struct_and_union3(long long, short, double, 24, 8);
+ check_struct_and_union3(long long, short, long double, 32, 16);
+ check_struct_and_union3(long long, int, char, 16, 8);
+ check_struct_and_union3(long long, int, short, 16, 8);
+ check_struct_and_union3(long long, int, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, int, long, 24, 8);
+#endif
+ check_struct_and_union3(long long, int, long long, 24, 8);
+ check_struct_and_union3(long long, int, float, 16, 8);
+ check_struct_and_union3(long long, int, double, 24, 8);
+ check_struct_and_union3(long long, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, long, char, 24, 8);
+ check_struct_and_union3(long long, long, short, 24, 8);
+ check_struct_and_union3(long long, long, int, 24, 8);
+ check_struct_and_union3(long long, long, long, 24, 8);
+#endif
+ check_struct_and_union3(long long, long, long long, 24, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, long, float, 24, 8);
+ check_struct_and_union3(long long, long, double, 24, 8);
+#endif
+ check_struct_and_union3(long long, long, long double, 32, 16);
+ check_struct_and_union3(long long, long long, char, 24, 8);
+ check_struct_and_union3(long long, long long, short, 24, 8);
+ check_struct_and_union3(long long, long long, int, 24, 8);
+ check_struct_and_union3(long long, long long, long, 24, 8);
+ check_struct_and_union3(long long, long long, long long, 24, 8);
+ check_struct_and_union3(long long, long long, float, 24, 8);
+ check_struct_and_union3(long long, long long, double, 24, 8);
+ check_struct_and_union3(long long, long long, long double, 32, 16);
+ check_struct_and_union3(long long, float, char, 16, 8);
+ check_struct_and_union3(long long, float, short, 16, 8);
+ check_struct_and_union3(long long, float, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, float, long, 24, 8);
+#endif
+ check_struct_and_union3(long long, float, long long, 24, 8);
+ check_struct_and_union3(long long, float, float, 16, 8);
+ check_struct_and_union3(long long, float, double, 24, 8);
+ check_struct_and_union3(long long, float, long double, 32, 16);
+ check_struct_and_union3(long long, double, char, 24, 8);
+ check_struct_and_union3(long long, double, short, 24, 8);
+ check_struct_and_union3(long long, double, int, 24, 8);
+ check_struct_and_union3(long long, double, long, 24, 8);
+ check_struct_and_union3(long long, double, long long, 24, 8);
+ check_struct_and_union3(long long, double, float, 24, 8);
+ check_struct_and_union3(long long, double, double, 24, 8);
+ check_struct_and_union3(long long, double, long double, 32, 16);
+ check_struct_and_union3(long long, long double, char, 48, 16);
+ check_struct_and_union3(long long, long double, short, 48, 16);
+ check_struct_and_union3(long long, long double, int, 48, 16);
+ check_struct_and_union3(long long, long double, long, 48, 16);
+ check_struct_and_union3(long long, long double, long long, 48, 16);
+ check_struct_and_union3(long long, long double, float, 48, 16);
+ check_struct_and_union3(long long, long double, double, 48, 16);
+ check_struct_and_union3(long long, long double, long double, 48, 16);
+ check_struct_and_union3(float, char, char, 8, 4);
+ check_struct_and_union3(float, char, short, 8, 4);
+ check_struct_and_union3(float, char, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, char, long, 16, 8);
+#endif
+ check_struct_and_union3(float, char, long long, 16, 8);
+ check_struct_and_union3(float, char, float, 12, 4);
+ check_struct_and_union3(float, char, double, 16, 8);
+ check_struct_and_union3(float, char, long double, 32, 16);
+ check_struct_and_union3(float, short, char, 8, 4);
+ check_struct_and_union3(float, short, short, 8, 4);
+ check_struct_and_union3(float, short, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, short, long, 16, 8);
+#endif
+ check_struct_and_union3(float, short, long long, 16, 8);
+ check_struct_and_union3(float, short, float, 12, 4);
+ check_struct_and_union3(float, short, double, 16, 8);
+ check_struct_and_union3(float, short, long double, 32, 16);
+ check_struct_and_union3(float, int, char, 12, 4);
+ check_struct_and_union3(float, int, short, 12, 4);
+ check_struct_and_union3(float, int, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, int, long, 16, 8);
+#endif
+ check_struct_and_union3(float, int, long long, 16, 8);
+ check_struct_and_union3(float, int, float, 12, 4);
+ check_struct_and_union3(float, int, double, 16, 8);
+ check_struct_and_union3(float, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(float, long, char, 24, 8);
+ check_struct_and_union3(float, long, short, 24, 8);
+ check_struct_and_union3(float, long, int, 24, 8);
+ check_struct_and_union3(float, long, long, 24, 8);
+ check_struct_and_union3(float, long, long long, 24, 8);
+ check_struct_and_union3(float, long, float, 24, 8);
+ check_struct_and_union3(float, long, double, 24, 8);
+#endif
+ check_struct_and_union3(float, long, long double, 32, 16);
+ check_struct_and_union3(float, long long, char, 24, 8);
+ check_struct_and_union3(float, long long, short, 24, 8);
+ check_struct_and_union3(float, long long, int, 24, 8);
+ check_struct_and_union3(float, long long, long, 24, 8);
+ check_struct_and_union3(float, long long, long long, 24, 8);
+ check_struct_and_union3(float, long long, float, 24, 8);
+ check_struct_and_union3(float, long long, double, 24, 8);
+ check_struct_and_union3(float, long long, long double, 32, 16);
+ check_struct_and_union3(float, float, char, 12, 4);
+ check_struct_and_union3(float, float, short, 12, 4);
+ check_struct_and_union3(float, float, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, float, long, 16, 8);
+#endif
+ check_struct_and_union3(float, float, long long, 16, 8);
+ check_struct_and_union3(float, float, float, 12, 4);
+ check_struct_and_union3(float, float, double, 16, 8);
+ check_struct_and_union3(float, float, long double, 32, 16);
+ check_struct_and_union3(float, double, char, 24, 8);
+ check_struct_and_union3(float, double, short, 24, 8);
+ check_struct_and_union3(float, double, int, 24, 8);
+ check_struct_and_union3(float, double, long, 24, 8);
+ check_struct_and_union3(float, double, long long, 24, 8);
+ check_struct_and_union3(float, double, float, 24, 8);
+ check_struct_and_union3(float, double, double, 24, 8);
+ check_struct_and_union3(float, double, long double, 32, 16);
+ check_struct_and_union3(float, long double, char, 48, 16);
+ check_struct_and_union3(float, long double, short, 48, 16);
+ check_struct_and_union3(float, long double, int, 48, 16);
+ check_struct_and_union3(float, long double, long, 48, 16);
+ check_struct_and_union3(float, long double, long long, 48, 16);
+ check_struct_and_union3(float, long double, float, 48, 16);
+ check_struct_and_union3(float, long double, double, 48, 16);
+ check_struct_and_union3(float, long double, long double, 48, 16);
+ check_struct_and_union3(double, char, char, 16, 8);
+ check_struct_and_union3(double, char, short, 16, 8);
+ check_struct_and_union3(double, char, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, char, long, 24, 8);
+#endif
+ check_struct_and_union3(double, char, long long, 24, 8);
+ check_struct_and_union3(double, char, float, 16, 8);
+ check_struct_and_union3(double, char, double, 24, 8);
+ check_struct_and_union3(double, char, long double, 32, 16);
+ check_struct_and_union3(double, short, char, 16, 8);
+ check_struct_and_union3(double, short, short, 16, 8);
+ check_struct_and_union3(double, short, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, short, long, 24, 8);
+#endif
+ check_struct_and_union3(double, short, long long, 24, 8);
+ check_struct_and_union3(double, short, float, 16, 8);
+ check_struct_and_union3(double, short, double, 24, 8);
+ check_struct_and_union3(double, short, long double, 32, 16);
+ check_struct_and_union3(double, int, char, 16, 8);
+ check_struct_and_union3(double, int, short, 16, 8);
+ check_struct_and_union3(double, int, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, int, long, 24, 8);
+#endif
+ check_struct_and_union3(double, int, long long, 24, 8);
+ check_struct_and_union3(double, int, float, 16, 8);
+ check_struct_and_union3(double, int, double, 24, 8);
+ check_struct_and_union3(double, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(double, long, char, 24, 8);
+ check_struct_and_union3(double, long, short, 24, 8);
+ check_struct_and_union3(double, long, int, 24, 8);
+ check_struct_and_union3(double, long, long, 24, 8);
+#endif
+ check_struct_and_union3(double, long, long long, 24, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, long, float, 24, 8);
+#endif
+ check_struct_and_union3(double, long, double, 24, 8);
+ check_struct_and_union3(double, long, long double, 32, 16);
+ check_struct_and_union3(double, long long, char, 24, 8);
+ check_struct_and_union3(double, long long, short, 24, 8);
+ check_struct_and_union3(double, long long, int, 24, 8);
+ check_struct_and_union3(double, long long, long, 24, 8);
+ check_struct_and_union3(double, long long, long long, 24, 8);
+ check_struct_and_union3(double, long long, float, 24, 8);
+ check_struct_and_union3(double, long long, double, 24, 8);
+ check_struct_and_union3(double, long long, long double, 32, 16);
+ check_struct_and_union3(double, float, char, 16, 8);
+ check_struct_and_union3(double, float, short, 16, 8);
+ check_struct_and_union3(double, float, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, float, long, 24, 8);
+#endif
+ check_struct_and_union3(double, float, long long, 24, 8);
+ check_struct_and_union3(double, float, float, 16, 8);
+ check_struct_and_union3(double, float, double, 24, 8);
+ check_struct_and_union3(double, float, long double, 32, 16);
+ check_struct_and_union3(double, double, char, 24, 8);
+ check_struct_and_union3(double, double, short, 24, 8);
+ check_struct_and_union3(double, double, int, 24, 8);
+ check_struct_and_union3(double, double, long, 24, 8);
+ check_struct_and_union3(double, double, long long, 24, 8);
+ check_struct_and_union3(double, double, float, 24, 8);
+ check_struct_and_union3(double, double, double, 24, 8);
+ check_struct_and_union3(double, double, long double, 32, 16);
+ check_struct_and_union3(double, long double, char, 48, 16);
+ check_struct_and_union3(double, long double, short, 48, 16);
+ check_struct_and_union3(double, long double, int, 48, 16);
+ check_struct_and_union3(double, long double, long, 48, 16);
+ check_struct_and_union3(double, long double, long long, 48, 16);
+ check_struct_and_union3(double, long double, float, 48, 16);
+ check_struct_and_union3(double, long double, double, 48, 16);
+ check_struct_and_union3(double, long double, long double, 48, 16);
+ check_struct_and_union3(long double, char, char, 32, 16);
+ check_struct_and_union3(long double, char, short, 32, 16);
+ check_struct_and_union3(long double, char, int, 32, 16);
+ check_struct_and_union3(long double, char, long, 32, 16);
+ check_struct_and_union3(long double, char, long long, 32, 16);
+ check_struct_and_union3(long double, char, float, 32, 16);
+ check_struct_and_union3(long double, char, double, 32, 16);
+ check_struct_and_union3(long double, char, long double, 48, 16);
+ check_struct_and_union3(long double, short, char, 32, 16);
+ check_struct_and_union3(long double, short, short, 32, 16);
+ check_struct_and_union3(long double, short, int, 32, 16);
+ check_struct_and_union3(long double, short, long, 32, 16);
+ check_struct_and_union3(long double, short, long long, 32, 16);
+ check_struct_and_union3(long double, short, float, 32, 16);
+ check_struct_and_union3(long double, short, double, 32, 16);
+ check_struct_and_union3(long double, short, long double, 48, 16);
+ check_struct_and_union3(long double, int, char, 32, 16);
+ check_struct_and_union3(long double, int, short, 32, 16);
+ check_struct_and_union3(long double, int, int, 32, 16);
+ check_struct_and_union3(long double, int, long, 32, 16);
+ check_struct_and_union3(long double, int, long long, 32, 16);
+ check_struct_and_union3(long double, int, float, 32, 16);
+ check_struct_and_union3(long double, int, double, 32, 16);
+ check_struct_and_union3(long double, int, long double, 48, 16);
+ check_struct_and_union3(long double, long, char, 32, 16);
+ check_struct_and_union3(long double, long, short, 32, 16);
+ check_struct_and_union3(long double, long, int, 32, 16);
+ check_struct_and_union3(long double, long, long, 32, 16);
+ check_struct_and_union3(long double, long, long long, 32, 16);
+ check_struct_and_union3(long double, long, float, 32, 16);
+ check_struct_and_union3(long double, long, double, 32, 16);
+ check_struct_and_union3(long double, long, long double, 48, 16);
+ check_struct_and_union3(long double, long long, char, 32, 16);
+ check_struct_and_union3(long double, long long, short, 32, 16);
+ check_struct_and_union3(long double, long long, int, 32, 16);
+ check_struct_and_union3(long double, long long, long, 32, 16);
+ check_struct_and_union3(long double, long long, long long, 32, 16);
+ check_struct_and_union3(long double, long long, float, 32, 16);
+ check_struct_and_union3(long double, long long, double, 32, 16);
+ check_struct_and_union3(long double, long long, long double, 48, 16);
+ check_struct_and_union3(long double, float, char, 32, 16);
+ check_struct_and_union3(long double, float, short, 32, 16);
+ check_struct_and_union3(long double, float, int, 32, 16);
+ check_struct_and_union3(long double, float, long, 32, 16);
+ check_struct_and_union3(long double, float, long long, 32, 16);
+ check_struct_and_union3(long double, float, float, 32, 16);
+ check_struct_and_union3(long double, float, double, 32, 16);
+ check_struct_and_union3(long double, float, long double, 48, 16);
+ check_struct_and_union3(long double, double, char, 32, 16);
+ check_struct_and_union3(long double, double, short, 32, 16);
+ check_struct_and_union3(long double, double, int, 32, 16);
+ check_struct_and_union3(long double, double, long, 32, 16);
+ check_struct_and_union3(long double, double, long long, 32, 16);
+ check_struct_and_union3(long double, double, float, 32, 16);
+ check_struct_and_union3(long double, double, double, 32, 16);
+ check_struct_and_union3(long double, double, long double, 48, 16);
+ check_struct_and_union3(long double, long double, char, 48, 16);
+ check_struct_and_union3(long double, long double, short, 48, 16);
+ check_struct_and_union3(long double, long double, int, 48, 16);
+ check_struct_and_union3(long double, long double, long, 48, 16);
+ check_struct_and_union3(long double, long double, long long, 48, 16);
+ check_struct_and_union3(long double, long double, float, 48, 16);
+ check_struct_and_union3(long double, long double, double, 48, 16);
+ check_struct_and_union3(long double, long double, long double, 48, 16);
+ check_struct_and_union3(char, char, _Float16, 4, 2);
+ check_struct_and_union3(char, _Float16, char, 6, 2);
+ check_struct_and_union3(char, _Float16, _Float16, 6, 2);
+ check_struct_and_union3(char, _Float16, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, _Float16, long, 16, 8);
+#endif
+ check_struct_and_union3(char, _Float16, long long, 16, 8);
+ check_struct_and_union3(char, _Float16, float, 8, 4);
+ check_struct_and_union3(char, _Float16, double, 16, 8);
+ check_struct_and_union3(char, _Float16, long double, 32, 16);
+ check_struct_and_union3(char, int, _Float16, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, long, _Float16, 24, 8);
+#endif
+ check_struct_and_union3(char, long long, _Float16, 24, 8);
+ check_struct_and_union3(char, float, _Float16, 12, 4);
+ check_struct_and_union3(char, double, _Float16, 24, 8);
+ check_struct_and_union3(char, long double, _Float16, 48, 16);
+ check_struct_and_union3(_Float16, char, char, 4, 2);
+ check_struct_and_union3(_Float16, char, _Float16, 6, 2);
+ check_struct_and_union3(_Float16, char, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(_Float16, char, long, 16, 8);
+#endif
+ check_struct_and_union3(_Float16, char, long long, 16, 8);
+ check_struct_and_union3(_Float16, char, float, 8, 4);
+ check_struct_and_union3(_Float16, char, double, 16, 8);
+ check_struct_and_union3(_Float16, char, long double, 32, 16);
+ check_struct_and_union3(_Float16, _Float16, char, 6, 2);
+ check_struct_and_union3(_Float16, _Float16, _Float16, 6, 2);
+ check_struct_and_union3(_Float16, _Float16, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(_Float16, _Float16, long, 16, 8);
+#endif
+ check_struct_and_union3(_Float16, _Float16, long long, 16, 8);
+ check_struct_and_union3(_Float16, _Float16, float, 8, 4);
+ check_struct_and_union3(_Float16, _Float16, double, 16, 8);
+ check_struct_and_union3(_Float16, _Float16, long double, 32, 16);
+ check_struct_and_union3(_Float16, int, char, 12, 4);
+ check_struct_and_union3(_Float16, int, _Float16, 12, 4);
+ check_struct_and_union3(_Float16, int, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(_Float16, int, long, 16, 8);
+#endif
+ check_struct_and_union3(_Float16, int, long long, 16, 8);
+ check_struct_and_union3(_Float16, int, float, 12, 4);
+ check_struct_and_union3(_Float16, int, double, 16, 8);
+ check_struct_and_union3(_Float16, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(_Float16, long, char, 24, 8);
+ check_struct_and_union3(_Float16, long, _Float16, 24, 8);
+ check_struct_and_union3(_Float16, long, int, 24, 8);
+ check_struct_and_union3(_Float16, long, long, 24, 8);
+ check_struct_and_union3(_Float16, long, long long, 24, 8);
+ check_struct_and_union3(_Float16, long, float, 24, 8);
+ check_struct_and_union3(_Float16, long, double, 24, 8);
+#endif
+ check_struct_and_union3(_Float16, long, long double, 32, 16);
+ check_struct_and_union3(_Float16, long long, char, 24, 8);
+ check_struct_and_union3(_Float16, long long, _Float16, 24, 8);
+ check_struct_and_union3(_Float16, long long, int, 24, 8);
+ check_struct_and_union3(_Float16, long long, long, 24, 8);
+ check_struct_and_union3(_Float16, long long, long long, 24, 8);
+ check_struct_and_union3(_Float16, long long, float, 24, 8);
+ check_struct_and_union3(_Float16, long long, double, 24, 8);
+ check_struct_and_union3(_Float16, long long, long double, 32, 16);
+ check_struct_and_union3(_Float16, float, char, 12, 4);
+ check_struct_and_union3(_Float16, float, _Float16, 12, 4);
+ check_struct_and_union3(_Float16, float, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(_Float16, float, long, 16, 8);
+#endif
+ check_struct_and_union3(_Float16, float, long long, 16, 8);
+ check_struct_and_union3(_Float16, float, float, 12, 4);
+ check_struct_and_union3(_Float16, float, double, 16, 8);
+ check_struct_and_union3(_Float16, float, long double, 32, 16);
+ check_struct_and_union3(_Float16, double, char, 24, 8);
+ check_struct_and_union3(_Float16, double, _Float16, 24, 8);
+ check_struct_and_union3(_Float16, double, int, 24, 8);
+ check_struct_and_union3(_Float16, double, long, 24, 8);
+ check_struct_and_union3(_Float16, double, long long, 24, 8);
+ check_struct_and_union3(_Float16, double, float, 24, 8);
+ check_struct_and_union3(_Float16, double, double, 24, 8);
+ check_struct_and_union3(_Float16, double, long double, 32, 16);
+ check_struct_and_union3(_Float16, long double, char, 48, 16);
+ check_struct_and_union3(_Float16, long double, _Float16, 48, 16);
+ check_struct_and_union3(_Float16, long double, int, 48, 16);
+ check_struct_and_union3(_Float16, long double, long, 48, 16);
+ check_struct_and_union3(_Float16, long double, long long, 48, 16);
+ check_struct_and_union3(_Float16, long double, float, 48, 16);
+ check_struct_and_union3(_Float16, long double, double, 48, 16);
+ check_struct_and_union3(_Float16, long double, long double, 48, 16);
+ check_struct_and_union3(int, char, _Float16, 8, 4);
+ check_struct_and_union3(int, _Float16, char, 8, 4);
+ check_struct_and_union3(int, _Float16, _Float16, 8, 4);
+ check_struct_and_union3(int, _Float16, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, _Float16, long, 16, 8);
+#endif
+ check_struct_and_union3(int, _Float16, long long, 16, 8);
+ check_struct_and_union3(int, _Float16, float, 12, 4);
+ check_struct_and_union3(int, _Float16, double, 16, 8);
+ check_struct_and_union3(int, _Float16, long double, 32, 16);
+ check_struct_and_union3(int, int, _Float16, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, long, _Float16, 24, 8);
+#endif
+ check_struct_and_union3(int, long long, _Float16, 24, 8);
+ check_struct_and_union3(int, float, _Float16, 12, 4);
+ check_struct_and_union3(int, double, _Float16, 24, 8);
+ check_struct_and_union3(int, long double, _Float16, 48, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(long, char, _Float16, 16, 8);
+ check_struct_and_union3(long, _Float16, char, 16, 8);
+ check_struct_and_union3(long, _Float16, _Float16, 16, 8);
+ check_struct_and_union3(long, _Float16, int, 16, 8);
+ check_struct_and_union3(long, _Float16, long, 24, 8);
+ check_struct_and_union3(long, _Float16, long long, 24, 8);
+ check_struct_and_union3(long, _Float16, float, 16, 8);
+ check_struct_and_union3(long, _Float16, double, 24, 8);
+#endif
+ check_struct_and_union3(long, _Float16, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(long, int, _Float16, 16, 8);
+ check_struct_and_union3(long, long, _Float16, 24, 8);
+ check_struct_and_union3(long, long long, _Float16, 24, 8);
+ check_struct_and_union3(long, float, _Float16, 16, 8);
+ check_struct_and_union3(long, double, _Float16, 24, 8);
+#endif
+ check_struct_and_union3(long, long double, _Float16, 48, 16);
+ check_struct_and_union3(long long, char, _Float16, 16, 8);
+ check_struct_and_union3(long long, _Float16, char, 16, 8);
+ check_struct_and_union3(long long, _Float16, _Float16, 16, 8);
+ check_struct_and_union3(long long, _Float16, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, _Float16, long, 24, 8);
+#endif
+ check_struct_and_union3(long long, _Float16, long long, 24, 8);
+ check_struct_and_union3(long long, _Float16, float, 16, 8);
+ check_struct_and_union3(long long, _Float16, double, 24, 8);
+ check_struct_and_union3(long long, _Float16, long double, 32, 16);
+ check_struct_and_union3(long long, int, _Float16, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, long, _Float16, 24, 8);
+#endif
+ check_struct_and_union3(long long, long long, _Float16, 24, 8);
+ check_struct_and_union3(long long, float, _Float16, 16, 8);
+ check_struct_and_union3(long long, double, _Float16, 24, 8);
+ check_struct_and_union3(long long, long double, _Float16, 48, 16);
+ check_struct_and_union3(float, char, _Float16, 8, 4);
+ check_struct_and_union3(float, _Float16, char, 8, 4);
+ check_struct_and_union3(float, _Float16, _Float16, 8, 4);
+ check_struct_and_union3(float, _Float16, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, _Float16, long, 16, 8);
+#endif
+ check_struct_and_union3(float, _Float16, long long, 16, 8);
+ check_struct_and_union3(float, _Float16, float, 12, 4);
+ check_struct_and_union3(float, _Float16, double, 16, 8);
+ check_struct_and_union3(float, _Float16, long double, 32, 16);
+ check_struct_and_union3(float, int, _Float16, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, long, _Float16, 24, 8);
+#endif
+ check_struct_and_union3(float, long long, _Float16, 24, 8);
+ check_struct_and_union3(float, float, _Float16, 12, 4);
+ check_struct_and_union3(float, double, _Float16, 24, 8);
+ check_struct_and_union3(float, long double, _Float16, 48, 16);
+ check_struct_and_union3(double, char, _Float16, 16, 8);
+ check_struct_and_union3(double, _Float16, char, 16, 8);
+ check_struct_and_union3(double, _Float16, _Float16, 16, 8);
+ check_struct_and_union3(double, _Float16, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, _Float16, long, 24, 8);
+#endif
+ check_struct_and_union3(double, _Float16, long long, 24, 8);
+ check_struct_and_union3(double, _Float16, float, 16, 8);
+ check_struct_and_union3(double, _Float16, double, 24, 8);
+ check_struct_and_union3(double, _Float16, long double, 32, 16);
+ check_struct_and_union3(double, int, _Float16, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, long, _Float16, 24, 8);
+#endif
+ check_struct_and_union3(double, long long, _Float16, 24, 8);
+ check_struct_and_union3(double, float, _Float16, 16, 8);
+ check_struct_and_union3(double, double, _Float16, 24, 8);
+ check_struct_and_union3(double, long double, _Float16, 48, 16);
+ check_struct_and_union3(long double, char, _Float16, 32, 16);
+ check_struct_and_union3(long double, _Float16, char, 32, 16);
+ check_struct_and_union3(long double, _Float16, _Float16, 32, 16);
+ check_struct_and_union3(long double, _Float16, int, 32, 16);
+ check_struct_and_union3(long double, _Float16, long, 32, 16);
+ check_struct_and_union3(long double, _Float16, long long, 32, 16);
+ check_struct_and_union3(long double, _Float16, float, 32, 16);
+ check_struct_and_union3(long double, _Float16, double, 32, 16);
+ check_struct_and_union3(long double, _Float16, long double, 48, 16);
+ check_struct_and_union3(long double, int, _Float16, 32, 16);
+ check_struct_and_union3(long double, long, _Float16, 32, 16);
+ check_struct_and_union3(long double, long long, _Float16, 32, 16);
+ check_struct_and_union3(long double, float, _Float16, 32, 16);
+ check_struct_and_union3(long double, double, _Float16, 32, 16);
+ check_struct_and_union3(long double, long double, _Float16, 48, 16);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_alignment.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_alignment.c
new file mode 100644
index 0000000..2a72b5c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_alignment.c
@@ -0,0 +1,45 @@
+/* This checks alignment of basic types. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests2(check_align, char, TYPE_ALIGN_CHAR);
+ run_signed_tests2(check_align, short, TYPE_ALIGN_SHORT);
+ run_signed_tests2(check_align, int, TYPE_ALIGN_INT);
+ run_signed_tests2(check_align, long, TYPE_ALIGN_LONG);
+ run_signed_tests2(check_align, long long, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests2(check_align, __int128, TYPE_ALIGN_INT128);
+#endif
+ check_align(enumtype, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_align(float, TYPE_ALIGN_FLOAT);
+ check_align(double, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_align(long double, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_align(__float128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_align(__m64, TYPE_ALIGN_M64);
+ check_align(__m128, TYPE_ALIGN_M128);
+#endif
+
+ /* _Float16 point types. */
+ check_align(_Float16, TYPE_ALIGN_FLOAT16);
+
+ /* Pointer types. */
+ check_align(void *, TYPE_ALIGN_POINTER);
+ check_align(void (*)(), TYPE_ALIGN_POINTER);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_array_size_and_align.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_array_size_and_align.c
new file mode 100644
index 0000000..d58b9d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_array_size_and_align.c
@@ -0,0 +1,43 @@
+/* This checks . */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests3(check_array_size_and_align, char, TYPE_SIZE_CHAR, TYPE_ALIGN_CHAR);
+ run_signed_tests3(check_array_size_and_align, short, TYPE_SIZE_SHORT, TYPE_ALIGN_SHORT);
+ run_signed_tests3(check_array_size_and_align, int, TYPE_SIZE_INT, TYPE_ALIGN_INT);
+ run_signed_tests3(check_array_size_and_align, long, TYPE_SIZE_LONG, TYPE_ALIGN_LONG);
+ run_signed_tests3(check_array_size_and_align, long long, TYPE_SIZE_LONG_LONG, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests3(check_array_size_and_align, __int128, TYPE_SIZE_INT128, TYPE_ALIGN_INT128);
+#endif
+ check_array_size_and_align(enum dummytype, TYPE_SIZE_ENUM, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_array_size_and_align(float, TYPE_SIZE_FLOAT, TYPE_ALIGN_FLOAT);
+ check_array_size_and_align(double, TYPE_SIZE_DOUBLE, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_array_size_and_align(long double, TYPE_SIZE_LONG_DOUBLE, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_array_size_and_align(__float128, TYPE_SIZE_FLOAT128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_array_size_and_align(__m64, TYPE_SIZE_M64, TYPE_ALIGN_M64);
+ check_array_size_and_align(__m128, TYPE_SIZE_M128, TYPE_ALIGN_M128);
+#endif
+
+ /* Pointer types. The function pointer doesn't work with these macros. */
+ check_array_size_and_align(void *, TYPE_SIZE_POINTER, TYPE_ALIGN_POINTER);
+
+ check_array_size_and_align(_Float16, TYPE_SIZE_FLOAT16, TYPE_ALIGN_FLOAT16);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_returning.c
new file mode 100644
index 0000000..36fb24e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_returning.c
@@ -0,0 +1,87 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+char
+fun_test_returning_char (void)
+{
+ volatile_var++;
+ return 64;
+}
+
+short
+fun_test_returning_short (void)
+{
+ volatile_var++;
+ return 65;
+}
+
+int
+fun_test_returning_int (void)
+{
+ volatile_var++;
+ return 66;
+}
+
+long
+fun_test_returning_long (void)
+{
+ volatile_var++;
+ return 67;
+}
+
+long long
+fun_test_returning_long_long (void)
+{
+ volatile_var++;
+ return 68;
+}
+
+float
+fun_test_returning_float (void)
+{
+ volatile_var++;
+ return 69;
+}
+
+double
+fun_test_returning_double (void)
+{
+ volatile_var++;
+ return 70;
+}
+
+long double
+fun_test_returning_long_double (void)
+{
+ volatile_var++;
+ return 71;
+}
+
+_Float16
+fun_test_returning_float16 (void)
+{
+ volatile_var++;
+ return 72;
+}
+
+#define def_test_returning_type_xmm(fun, type, ret, reg) \
+ { type var = WRAP_RET (fun) (); \
+ assert (ret == (type) reg && ret == var); }
+
+static void
+do_test (void)
+{
+ def_test_returning_type_xmm(fun_test_returning_char, char, 64, rax);
+ def_test_returning_type_xmm(fun_test_returning_short, short, 65, rax);
+ def_test_returning_type_xmm(fun_test_returning_int, int, 66, rax);
+ def_test_returning_type_xmm(fun_test_returning_long, long, 67, rax);
+ def_test_returning_type_xmm(fun_test_returning_long_long, long long, 68, rax);
+ def_test_returning_type_xmm(fun_test_returning_float, float, 69, xmm_regs[0]._float[0]);
+ def_test_returning_type_xmm(fun_test_returning_double, double, 70, xmm_regs[0]._double[0]);
+ def_test_returning_type_xmm(fun_test_returning_long_double, long double, 71, x87_regs[0]._ldouble);
+ def_test_returning_type_xmm(fun_test_returning_float16, _Float16, 72, xmm_regs[0].__Float16[0]);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_sizes.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_sizes.c
new file mode 100644
index 0000000..47f3a5e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_sizes.c
@@ -0,0 +1,43 @@
+/* This checks sizes of basic types. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests2(check_size, char, TYPE_SIZE_CHAR);
+ run_signed_tests2(check_size, short, TYPE_SIZE_SHORT);
+ run_signed_tests2(check_size, int, TYPE_SIZE_INT);
+ run_signed_tests2(check_size, long, TYPE_SIZE_LONG);
+ run_signed_tests2(check_size, long long, TYPE_SIZE_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests2(check_size, __int128, TYPE_SIZE_INT128);
+#endif
+ check_size(enumtype, TYPE_SIZE_ENUM);
+
+ /* Floating point types. */
+ check_size(_Float16, TYPE_SIZE_FLOAT16);
+ check_size(float, TYPE_SIZE_FLOAT);
+ check_size(double, TYPE_SIZE_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_size(long double, TYPE_SIZE_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_size(__float128, TYPE_SIZE_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_size(__m64, TYPE_SIZE_M64);
+ check_size(__m128, TYPE_SIZE_M128);
+#endif
+
+ /* Pointer types. */
+ check_size(void *, TYPE_SIZE_POINTER);
+ check_size(void (*)(), TYPE_SIZE_POINTER);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_struct_size_and_align.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_struct_size_and_align.c
new file mode 100644
index 0000000..3d1add4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_struct_size_and_align.c
@@ -0,0 +1,42 @@
+/* This checks size and alignment of structs with a single basic type
+ element. All basic types are checked. */
+
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+
+
+static void
+do_test (void)
+{
+ /* Integral types. */
+ run_signed_tests3(check_basic_struct_size_and_align, char, TYPE_SIZE_CHAR, TYPE_ALIGN_CHAR);
+ run_signed_tests3(check_basic_struct_size_and_align, short, TYPE_SIZE_SHORT, TYPE_ALIGN_SHORT);
+ run_signed_tests3(check_basic_struct_size_and_align, int, TYPE_SIZE_INT, TYPE_ALIGN_INT);
+ run_signed_tests3(check_basic_struct_size_and_align, long, TYPE_SIZE_LONG, TYPE_ALIGN_LONG);
+ run_signed_tests3(check_basic_struct_size_and_align, long long, TYPE_SIZE_LONG_LONG, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests3(check_basic_struct_size_and_align, __int128, TYPE_SIZE_INT128, TYPE_ALIGN_INT128);
+#endif
+ check_basic_struct_size_and_align(enum dummytype, TYPE_SIZE_ENUM, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_basic_struct_size_and_align(_Float16, TYPE_SIZE_FLOAT16, TYPE_ALIGN_FLOAT16);
+ check_basic_struct_size_and_align(float, TYPE_SIZE_FLOAT, TYPE_ALIGN_FLOAT);
+ check_basic_struct_size_and_align(double, TYPE_SIZE_DOUBLE, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_basic_struct_size_and_align(long double, TYPE_SIZE_LONG_DOUBLE, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_basic_struct_size_and_align(__float128, TYPE_SIZE_FLOAT128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_basic_struct_size_and_align(__m64, TYPE_SIZE_M64, TYPE_ALIGN_M64);
+ check_basic_struct_size_and_align(__m128, TYPE_SIZE_M128, TYPE_ALIGN_M128);
+#endif
+
+ /* Pointer types. The function pointer doesn't work with these macros. */
+ check_basic_struct_size_and_align(void *, TYPE_SIZE_POINTER, TYPE_ALIGN_POINTER);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_union_size_and_align.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_union_size_and_align.c
new file mode 100644
index 0000000..632feeb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_basic_union_size_and_align.c
@@ -0,0 +1,40 @@
+/* Test of simple unions, size and alignment. */
+
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+
+static void
+do_test (void)
+{
+ /* Integral types. */
+ run_signed_tests3(check_basic_union_size_and_align, char, TYPE_SIZE_CHAR, TYPE_ALIGN_CHAR);
+ run_signed_tests3(check_basic_union_size_and_align, short, TYPE_SIZE_SHORT, TYPE_ALIGN_SHORT);
+ run_signed_tests3(check_basic_union_size_and_align, int, TYPE_SIZE_INT, TYPE_ALIGN_INT);
+ run_signed_tests3(check_basic_union_size_and_align, long, TYPE_SIZE_LONG, TYPE_ALIGN_LONG);
+ run_signed_tests3(check_basic_union_size_and_align, long long, TYPE_SIZE_LONG_LONG, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests3(check_basic_union_size_and_align, __int128, TYPE_SIZE_INT128, TYPE_ALIGN_INT128);
+#endif
+ check_basic_union_size_and_align(enum dummytype, TYPE_SIZE_ENUM, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_basic_union_size_and_align(_Float16, TYPE_SIZE_FLOAT16, TYPE_ALIGN_FLOAT16);
+ check_basic_union_size_and_align(float, TYPE_SIZE_FLOAT, TYPE_ALIGN_FLOAT);
+ check_basic_union_size_and_align(double, TYPE_SIZE_DOUBLE, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_basic_union_size_and_align(long double, TYPE_SIZE_LONG_DOUBLE, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_basic_union_size_and_align(__float128, TYPE_SIZE_FLOAT128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_basic_union_size_and_align(__m64, TYPE_SIZE_M64, TYPE_ALIGN_M64);
+ check_basic_union_size_and_align(__m128, TYPE_SIZE_M128, TYPE_ALIGN_M128);
+#endif
+
+ /* Pointer types. The function pointer doesn't work with these macros. */
+ check_basic_union_size_and_align(void *, TYPE_SIZE_POINTER, TYPE_ALIGN_POINTER);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_complex_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_complex_returning.c
new file mode 100644
index 0000000..829d86e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_complex_returning.c
@@ -0,0 +1,104 @@
+/* This is a small test case for returning a complex number. Written by
+ Andreas Jaeger. */
+
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+
+#define BUILD_F16_COMPLEX(real, imag) \
+ ({ __complex__ _Float16 __retval; \
+ __real__ __retval = (real); \
+ __imag__ __retval = (imag); \
+ __retval; })
+
+__complex__ _Float16
+aj_f16_times2 (__complex__ _Float16 x)
+{
+ __complex__ _Float16 res;
+
+ __real__ res = (2.0 * __real__ x);
+ __imag__ res = (2.0 * __imag__ x);
+
+ return res;
+}
+
+#define BUILD_F_COMPLEX(real, imag) \
+ ({ __complex__ float __retval; \
+ __real__ __retval = (real); \
+ __imag__ __retval = (imag); \
+ __retval; })
+
+#define BUILD_D_COMPLEX(real, imag) \
+ ({ __complex__ double __retval; \
+ __real__ __retval = (real); \
+ __imag__ __retval = (imag); \
+ __retval; })
+
+#define BUILD_LD_COMPLEX(real, imag) \
+ ({ __complex__ long double __retval; \
+ __real__ __retval = (real); \
+ __imag__ __retval = (imag); \
+ __retval; })
+
+__complex__ float
+aj_f_times2 (__complex__ float x)
+{
+ __complex__ float res;
+
+ __real__ res = (2.0 * __real__ x);
+ __imag__ res = (2.0 * __imag__ x);
+
+ return res;
+}
+
+__complex__ double
+aj_d_times2 (__complex__ double x)
+{
+ __complex__ double res;
+
+ __real__ res = (2.0 * __real__ x);
+ __imag__ res = (2.0 * __imag__ x);
+
+ return res;
+}
+
+__complex__ long double
+aj_ld_times2 (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ __real__ res = (2.0 * __real__ x);
+ __imag__ res = (2.0 * __imag__ x);
+
+ return res;
+}
+
+static void
+do_test (void)
+{
+#ifdef CHECK_COMPLEX
+ _Complex _Float16 f16c, f16d;
+ _Complex float fc, fd;
+ _Complex double dc, dd;
+ _Complex long double ldc, ldd;
+
+ f16c = BUILD_F16_COMPLEX (2.0, 3.0);
+ f16d = aj_f16_times2 (f16c);
+
+ assert (__real__ f16d == 4.0f16 && __imag__ f16d == 6.0f16);
+
+ fc = BUILD_LD_COMPLEX (2.0f, 3.0f);
+ fd = aj_f_times2 (fc);
+
+ assert (__real__ fd == 4.0f && __imag__ fd == 6.0f);
+
+ dc = BUILD_LD_COMPLEX (2.0, 3.0);
+ dd = aj_ld_times2 (dc);
+
+ assert (__real__ dd == 4.0 && __imag__ dd == 6.0);
+
+ ldc = BUILD_LD_COMPLEX (2.0L, 3.0L);
+ ldd = aj_ld_times2 (ldc);
+
+ assert (__real__ ldd == 4.0L && __imag__ ldd == 6.0L);
+#endif
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_m64m128_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_m64m128_returning.c
new file mode 100644
index 0000000..363dfa9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_m64m128_returning.c
@@ -0,0 +1,73 @@
+#include <stdio.h>
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+__m64
+fun_test_returning___m64 (void)
+{
+ volatile_var++;
+ return (__m64){72,0};
+}
+
+__m128
+fun_test_returning___m128 (void)
+{
+ volatile_var++;
+ return (__m128){73,0,0,0};
+}
+
+__m128h
+fun_test_returning___m128h (void)
+{
+ volatile_var++;
+ return (__m128h){1.1f16, 2.2f16, 3.3f16, 4.4f16, 5.5f16,
+ 6.6f16, 7.7f16, 8.8f16};
+}
+
+__m64 test_64;
+__m128 test_128;
+__m128h test_128h;
+
+static void
+do_test (void)
+{
+ unsigned failed = 0;
+ XMM_T xmmt1, xmmt2;
+
+ /* We jump through hoops to compare the results as gcc 3.3 does throw
+ an ICE when trying to generate a compare for a == b, when a and b
+ are of __m64 or __m128 type :-( */
+ clear_struct_registers;
+ test_64 = (__m64){72,0};
+ xmmt1._m64[0] = test_64;
+ xmmt2._m64[0] = WRAP_RET (fun_test_returning___m64)();
+ if (xmmt1._longlong[0] != xmmt2._longlong[0]
+ || xmmt1._longlong[0] != xmm_regs[0]._longlong[0])
+ printf ("fail m64\n"), failed++;
+
+ clear_struct_registers;
+ test_128 = (__m128){73,0};
+ xmmt1._m128[0] = test_128;
+ xmmt2._m128[0] = WRAP_RET (fun_test_returning___m128)();
+ if (xmmt1._longlong[0] != xmmt2._longlong[0]
+ || xmmt1._longlong[0] != xmm_regs[0]._longlong[0])
+ printf ("fail m128\n"), failed++;
+
+ clear_struct_registers;
+ test_128h = (__m128h){1.1f16, 2.2f16, 3.3f16, 4.4f16, 5.5f16,
+ 6.6f16, 7.7f16, 8.8f16};
+ xmmt1._m128h[0] = test_128h;
+ xmmt2._m128h[0] = WRAP_RET (fun_test_returning___m128h)();
+ if (xmmt1._longlong[0] != xmmt2._longlong[0]
+ || xmmt1._longlong[0] != xmm_regs[0]._longlong[0])
+ printf ("fail m128h\n"), failed++;
+
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_floats.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_floats.c
new file mode 100644
index 0000000..678b25c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_floats.c
@@ -0,0 +1,1066 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ _Float16 f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
+ f15, f16, f17, f18, f19, f20, f21, f22, f23;
+} values__Float16;
+
+struct
+{
+ float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15,
+ f16, f17, f18, f19, f20, f21, f22, f23;
+} values_float;
+
+struct
+{
+ double f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15,
+ f16, f17, f18, f19, f20, f21, f22, f23;
+} values_double;
+
+struct
+{
+ ldouble f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
+ f15, f16, f17, f18, f19, f20, f21, f22, f23;
+} values_ldouble;
+
+void
+fun_check_float16_passing_8_values (_Float16 f0 ATTRIBUTE_UNUSED,
+ _Float16 f1 ATTRIBUTE_UNUSED,
+ _Float16 f2 ATTRIBUTE_UNUSED,
+ _Float16 f3 ATTRIBUTE_UNUSED,
+ _Float16 f4 ATTRIBUTE_UNUSED,
+ _Float16 f5 ATTRIBUTE_UNUSED,
+ _Float16 f6 ATTRIBUTE_UNUSED,
+ _Float16 f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values__Float16.f0 == f0);
+ assert (values__Float16.f1 == f1);
+ assert (values__Float16.f2 == f2);
+ assert (values__Float16.f3 == f3);
+ assert (values__Float16.f4 == f4);
+ assert (values__Float16.f5 == f5);
+ assert (values__Float16.f6 == f6);
+ assert (values__Float16.f7 == f7);
+}
+
+void
+fun_check_float16_passing_8_regs (_Float16 f0 ATTRIBUTE_UNUSED,
+ _Float16 f1 ATTRIBUTE_UNUSED,
+ _Float16 f2 ATTRIBUTE_UNUSED,
+ _Float16 f3 ATTRIBUTE_UNUSED,
+ _Float16 f4 ATTRIBUTE_UNUSED,
+ _Float16 f5 ATTRIBUTE_UNUSED,
+ _Float16 f6 ATTRIBUTE_UNUSED,
+ _Float16 f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float16_arguments;
+}
+
+void
+fun_check_float16_passing_16_values (_Float16 f0 ATTRIBUTE_UNUSED,
+ _Float16 f1 ATTRIBUTE_UNUSED,
+ _Float16 f2 ATTRIBUTE_UNUSED,
+ _Float16 f3 ATTRIBUTE_UNUSED,
+ _Float16 f4 ATTRIBUTE_UNUSED,
+ _Float16 f5 ATTRIBUTE_UNUSED,
+ _Float16 f6 ATTRIBUTE_UNUSED,
+ _Float16 f7 ATTRIBUTE_UNUSED,
+ _Float16 f8 ATTRIBUTE_UNUSED,
+ _Float16 f9 ATTRIBUTE_UNUSED,
+ _Float16 f10 ATTRIBUTE_UNUSED,
+ _Float16 f11 ATTRIBUTE_UNUSED,
+ _Float16 f12 ATTRIBUTE_UNUSED,
+ _Float16 f13 ATTRIBUTE_UNUSED,
+ _Float16 f14 ATTRIBUTE_UNUSED,
+ _Float16 f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values__Float16.f0 == f0);
+ assert (values__Float16.f1 == f1);
+ assert (values__Float16.f2 == f2);
+ assert (values__Float16.f3 == f3);
+ assert (values__Float16.f4 == f4);
+ assert (values__Float16.f5 == f5);
+ assert (values__Float16.f6 == f6);
+ assert (values__Float16.f7 == f7);
+ assert (values__Float16.f8 == f8);
+ assert (values__Float16.f9 == f9);
+ assert (values__Float16.f10 == f10);
+ assert (values__Float16.f11 == f11);
+ assert (values__Float16.f12 == f12);
+ assert (values__Float16.f13 == f13);
+ assert (values__Float16.f14 == f14);
+ assert (values__Float16.f15 == f15);
+}
+
+void
+fun_check_float16_passing_16_regs (_Float16 f0 ATTRIBUTE_UNUSED,
+ _Float16 f1 ATTRIBUTE_UNUSED,
+ _Float16 f2 ATTRIBUTE_UNUSED,
+ _Float16 f3 ATTRIBUTE_UNUSED,
+ _Float16 f4 ATTRIBUTE_UNUSED,
+ _Float16 f5 ATTRIBUTE_UNUSED,
+ _Float16 f6 ATTRIBUTE_UNUSED,
+ _Float16 f7 ATTRIBUTE_UNUSED,
+ _Float16 f8 ATTRIBUTE_UNUSED,
+ _Float16 f9 ATTRIBUTE_UNUSED,
+ _Float16 f10 ATTRIBUTE_UNUSED,
+ _Float16 f11 ATTRIBUTE_UNUSED,
+ _Float16 f12 ATTRIBUTE_UNUSED,
+ _Float16 f13 ATTRIBUTE_UNUSED,
+ _Float16 f14 ATTRIBUTE_UNUSED,
+ _Float16 f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float16_arguments;
+}
+
+void
+fun_check_float16_passing_20_values (_Float16 f0 ATTRIBUTE_UNUSED,
+ _Float16 f1 ATTRIBUTE_UNUSED,
+ _Float16 f2 ATTRIBUTE_UNUSED,
+ _Float16 f3 ATTRIBUTE_UNUSED,
+ _Float16 f4 ATTRIBUTE_UNUSED,
+ _Float16 f5 ATTRIBUTE_UNUSED,
+ _Float16 f6 ATTRIBUTE_UNUSED,
+ _Float16 f7 ATTRIBUTE_UNUSED,
+ _Float16 f8 ATTRIBUTE_UNUSED,
+ _Float16 f9 ATTRIBUTE_UNUSED,
+ _Float16 f10 ATTRIBUTE_UNUSED,
+ _Float16 f11 ATTRIBUTE_UNUSED,
+ _Float16 f12 ATTRIBUTE_UNUSED,
+ _Float16 f13 ATTRIBUTE_UNUSED,
+ _Float16 f14 ATTRIBUTE_UNUSED,
+ _Float16 f15 ATTRIBUTE_UNUSED,
+ _Float16 f16 ATTRIBUTE_UNUSED,
+ _Float16 f17 ATTRIBUTE_UNUSED,
+ _Float16 f18 ATTRIBUTE_UNUSED,
+ _Float16 f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values__Float16.f0 == f0);
+ assert (values__Float16.f1 == f1);
+ assert (values__Float16.f2 == f2);
+ assert (values__Float16.f3 == f3);
+ assert (values__Float16.f4 == f4);
+ assert (values__Float16.f5 == f5);
+ assert (values__Float16.f6 == f6);
+ assert (values__Float16.f7 == f7);
+ assert (values__Float16.f8 == f8);
+ assert (values__Float16.f9 == f9);
+ assert (values__Float16.f10 == f10);
+ assert (values__Float16.f11 == f11);
+ assert (values__Float16.f12 == f12);
+ assert (values__Float16.f13 == f13);
+ assert (values__Float16.f14 == f14);
+ assert (values__Float16.f15 == f15);
+ assert (values__Float16.f16 == f16);
+ assert (values__Float16.f17 == f17);
+ assert (values__Float16.f18 == f18);
+ assert (values__Float16.f19 == f19);
+}
+
+void
+fun_check_float16_passing_20_regs (_Float16 f0 ATTRIBUTE_UNUSED,
+ _Float16 f1 ATTRIBUTE_UNUSED,
+ _Float16 f2 ATTRIBUTE_UNUSED,
+ _Float16 f3 ATTRIBUTE_UNUSED,
+ _Float16 f4 ATTRIBUTE_UNUSED,
+ _Float16 f5 ATTRIBUTE_UNUSED,
+ _Float16 f6 ATTRIBUTE_UNUSED,
+ _Float16 f7 ATTRIBUTE_UNUSED,
+ _Float16 f8 ATTRIBUTE_UNUSED,
+ _Float16 f9 ATTRIBUTE_UNUSED,
+ _Float16 f10 ATTRIBUTE_UNUSED,
+ _Float16 f11 ATTRIBUTE_UNUSED,
+ _Float16 f12 ATTRIBUTE_UNUSED,
+ _Float16 f13 ATTRIBUTE_UNUSED,
+ _Float16 f14 ATTRIBUTE_UNUSED,
+ _Float16 f15 ATTRIBUTE_UNUSED,
+ _Float16 f16 ATTRIBUTE_UNUSED,
+ _Float16 f17 ATTRIBUTE_UNUSED,
+ _Float16 f18 ATTRIBUTE_UNUSED,
+ _Float16 f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float16_arguments;
+}
+
+void
+fun_check_float_passing_float8_values (float f0 ATTRIBUTE_UNUSED,
+ float f1 ATTRIBUTE_UNUSED,
+ float f2 ATTRIBUTE_UNUSED,
+ float f3 ATTRIBUTE_UNUSED,
+ float f4 ATTRIBUTE_UNUSED,
+ float f5 ATTRIBUTE_UNUSED,
+ float f6 ATTRIBUTE_UNUSED,
+ float f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_float.f0 == f0);
+ assert (values_float.f1 == f1);
+ assert (values_float.f2 == f2);
+ assert (values_float.f3 == f3);
+ assert (values_float.f4 == f4);
+ assert (values_float.f5 == f5);
+ assert (values_float.f6 == f6);
+ assert (values_float.f7 == f7);
+
+}
+
+void
+fun_check_float_passing_float8_regs (float f0 ATTRIBUTE_UNUSED,
+ float f1 ATTRIBUTE_UNUSED,
+ float f2 ATTRIBUTE_UNUSED,
+ float f3 ATTRIBUTE_UNUSED,
+ float f4 ATTRIBUTE_UNUSED,
+ float f5 ATTRIBUTE_UNUSED,
+ float f6 ATTRIBUTE_UNUSED,
+ float f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float_arguments;
+}
+
+void
+fun_check_float_passing_float16_values (float f0 ATTRIBUTE_UNUSED,
+ float f1 ATTRIBUTE_UNUSED,
+ float f2 ATTRIBUTE_UNUSED,
+ float f3 ATTRIBUTE_UNUSED,
+ float f4 ATTRIBUTE_UNUSED,
+ float f5 ATTRIBUTE_UNUSED,
+ float f6 ATTRIBUTE_UNUSED,
+ float f7 ATTRIBUTE_UNUSED,
+ float f8 ATTRIBUTE_UNUSED,
+ float f9 ATTRIBUTE_UNUSED,
+ float f10 ATTRIBUTE_UNUSED,
+ float f11 ATTRIBUTE_UNUSED,
+ float f12 ATTRIBUTE_UNUSED,
+ float f13 ATTRIBUTE_UNUSED,
+ float f14 ATTRIBUTE_UNUSED,
+ float f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_float.f0 == f0);
+ assert (values_float.f1 == f1);
+ assert (values_float.f2 == f2);
+ assert (values_float.f3 == f3);
+ assert (values_float.f4 == f4);
+ assert (values_float.f5 == f5);
+ assert (values_float.f6 == f6);
+ assert (values_float.f7 == f7);
+ assert (values_float.f8 == f8);
+ assert (values_float.f9 == f9);
+ assert (values_float.f10 == f10);
+ assert (values_float.f11 == f11);
+ assert (values_float.f12 == f12);
+ assert (values_float.f13 == f13);
+ assert (values_float.f14 == f14);
+ assert (values_float.f15 == f15);
+
+}
+
+void
+fun_check_float_passing_float16_regs (float f0 ATTRIBUTE_UNUSED,
+ float f1 ATTRIBUTE_UNUSED,
+ float f2 ATTRIBUTE_UNUSED,
+ float f3 ATTRIBUTE_UNUSED,
+ float f4 ATTRIBUTE_UNUSED,
+ float f5 ATTRIBUTE_UNUSED,
+ float f6 ATTRIBUTE_UNUSED,
+ float f7 ATTRIBUTE_UNUSED,
+ float f8 ATTRIBUTE_UNUSED,
+ float f9 ATTRIBUTE_UNUSED,
+ float f10 ATTRIBUTE_UNUSED,
+ float f11 ATTRIBUTE_UNUSED,
+ float f12 ATTRIBUTE_UNUSED,
+ float f13 ATTRIBUTE_UNUSED,
+ float f14 ATTRIBUTE_UNUSED,
+ float f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float_arguments;
+}
+
+void
+fun_check_float_passing_float20_values (float f0 ATTRIBUTE_UNUSED,
+ float f1 ATTRIBUTE_UNUSED,
+ float f2 ATTRIBUTE_UNUSED,
+ float f3 ATTRIBUTE_UNUSED,
+ float f4 ATTRIBUTE_UNUSED,
+ float f5 ATTRIBUTE_UNUSED,
+ float f6 ATTRIBUTE_UNUSED,
+ float f7 ATTRIBUTE_UNUSED,
+ float f8 ATTRIBUTE_UNUSED,
+ float f9 ATTRIBUTE_UNUSED,
+ float f10 ATTRIBUTE_UNUSED,
+ float f11 ATTRIBUTE_UNUSED,
+ float f12 ATTRIBUTE_UNUSED,
+ float f13 ATTRIBUTE_UNUSED,
+ float f14 ATTRIBUTE_UNUSED,
+ float f15 ATTRIBUTE_UNUSED,
+ float f16 ATTRIBUTE_UNUSED,
+ float f17 ATTRIBUTE_UNUSED,
+ float f18 ATTRIBUTE_UNUSED,
+ float f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_float.f0 == f0);
+ assert (values_float.f1 == f1);
+ assert (values_float.f2 == f2);
+ assert (values_float.f3 == f3);
+ assert (values_float.f4 == f4);
+ assert (values_float.f5 == f5);
+ assert (values_float.f6 == f6);
+ assert (values_float.f7 == f7);
+ assert (values_float.f8 == f8);
+ assert (values_float.f9 == f9);
+ assert (values_float.f10 == f10);
+ assert (values_float.f11 == f11);
+ assert (values_float.f12 == f12);
+ assert (values_float.f13 == f13);
+ assert (values_float.f14 == f14);
+ assert (values_float.f15 == f15);
+ assert (values_float.f16 == f16);
+ assert (values_float.f17 == f17);
+ assert (values_float.f18 == f18);
+ assert (values_float.f19 == f19);
+
+}
+
+void
+fun_check_float_passing_float20_regs (float f0 ATTRIBUTE_UNUSED,
+ float f1 ATTRIBUTE_UNUSED,
+ float f2 ATTRIBUTE_UNUSED,
+ float f3 ATTRIBUTE_UNUSED,
+ float f4 ATTRIBUTE_UNUSED,
+ float f5 ATTRIBUTE_UNUSED,
+ float f6 ATTRIBUTE_UNUSED,
+ float f7 ATTRIBUTE_UNUSED,
+ float f8 ATTRIBUTE_UNUSED,
+ float f9 ATTRIBUTE_UNUSED,
+ float f10 ATTRIBUTE_UNUSED,
+ float f11 ATTRIBUTE_UNUSED,
+ float f12 ATTRIBUTE_UNUSED,
+ float f13 ATTRIBUTE_UNUSED,
+ float f14 ATTRIBUTE_UNUSED,
+ float f15 ATTRIBUTE_UNUSED,
+ float f16 ATTRIBUTE_UNUSED,
+ float f17 ATTRIBUTE_UNUSED,
+ float f18 ATTRIBUTE_UNUSED,
+ float f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float_arguments;
+}
+
+void
+fun_check_float_passing_double8_values (double f0 ATTRIBUTE_UNUSED,
+ double f1 ATTRIBUTE_UNUSED,
+ double f2 ATTRIBUTE_UNUSED,
+ double f3 ATTRIBUTE_UNUSED,
+ double f4 ATTRIBUTE_UNUSED,
+ double f5 ATTRIBUTE_UNUSED,
+ double f6 ATTRIBUTE_UNUSED,
+ double f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_double.f0 == f0);
+ assert (values_double.f1 == f1);
+ assert (values_double.f2 == f2);
+ assert (values_double.f3 == f3);
+ assert (values_double.f4 == f4);
+ assert (values_double.f5 == f5);
+ assert (values_double.f6 == f6);
+ assert (values_double.f7 == f7);
+
+}
+
+void
+fun_check_float_passing_double8_regs (double f0 ATTRIBUTE_UNUSED,
+ double f1 ATTRIBUTE_UNUSED,
+ double f2 ATTRIBUTE_UNUSED,
+ double f3 ATTRIBUTE_UNUSED,
+ double f4 ATTRIBUTE_UNUSED,
+ double f5 ATTRIBUTE_UNUSED,
+ double f6 ATTRIBUTE_UNUSED,
+ double f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_double_arguments;
+}
+
+void
+fun_check_float_passing_double16_values (double f0 ATTRIBUTE_UNUSED,
+ double f1 ATTRIBUTE_UNUSED,
+ double f2 ATTRIBUTE_UNUSED,
+ double f3 ATTRIBUTE_UNUSED,
+ double f4 ATTRIBUTE_UNUSED,
+ double f5 ATTRIBUTE_UNUSED,
+ double f6 ATTRIBUTE_UNUSED,
+ double f7 ATTRIBUTE_UNUSED,
+ double f8 ATTRIBUTE_UNUSED,
+ double f9 ATTRIBUTE_UNUSED,
+ double f10 ATTRIBUTE_UNUSED,
+ double f11 ATTRIBUTE_UNUSED,
+ double f12 ATTRIBUTE_UNUSED,
+ double f13 ATTRIBUTE_UNUSED,
+ double f14 ATTRIBUTE_UNUSED,
+ double f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_double.f0 == f0);
+ assert (values_double.f1 == f1);
+ assert (values_double.f2 == f2);
+ assert (values_double.f3 == f3);
+ assert (values_double.f4 == f4);
+ assert (values_double.f5 == f5);
+ assert (values_double.f6 == f6);
+ assert (values_double.f7 == f7);
+ assert (values_double.f8 == f8);
+ assert (values_double.f9 == f9);
+ assert (values_double.f10 == f10);
+ assert (values_double.f11 == f11);
+ assert (values_double.f12 == f12);
+ assert (values_double.f13 == f13);
+ assert (values_double.f14 == f14);
+ assert (values_double.f15 == f15);
+
+}
+
+void
+fun_check_float_passing_double16_regs (double f0 ATTRIBUTE_UNUSED,
+ double f1 ATTRIBUTE_UNUSED,
+ double f2 ATTRIBUTE_UNUSED,
+ double f3 ATTRIBUTE_UNUSED,
+ double f4 ATTRIBUTE_UNUSED,
+ double f5 ATTRIBUTE_UNUSED,
+ double f6 ATTRIBUTE_UNUSED,
+ double f7 ATTRIBUTE_UNUSED,
+ double f8 ATTRIBUTE_UNUSED,
+ double f9 ATTRIBUTE_UNUSED,
+ double f10 ATTRIBUTE_UNUSED,
+ double f11 ATTRIBUTE_UNUSED,
+ double f12 ATTRIBUTE_UNUSED,
+ double f13 ATTRIBUTE_UNUSED,
+ double f14 ATTRIBUTE_UNUSED,
+ double f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_double_arguments;
+}
+
+void
+fun_check_float_passing_double20_values (double f0 ATTRIBUTE_UNUSED,
+ double f1 ATTRIBUTE_UNUSED,
+ double f2 ATTRIBUTE_UNUSED,
+ double f3 ATTRIBUTE_UNUSED,
+ double f4 ATTRIBUTE_UNUSED,
+ double f5 ATTRIBUTE_UNUSED,
+ double f6 ATTRIBUTE_UNUSED,
+ double f7 ATTRIBUTE_UNUSED,
+ double f8 ATTRIBUTE_UNUSED,
+ double f9 ATTRIBUTE_UNUSED,
+ double f10 ATTRIBUTE_UNUSED,
+ double f11 ATTRIBUTE_UNUSED,
+ double f12 ATTRIBUTE_UNUSED,
+ double f13 ATTRIBUTE_UNUSED,
+ double f14 ATTRIBUTE_UNUSED,
+ double f15 ATTRIBUTE_UNUSED,
+ double f16 ATTRIBUTE_UNUSED,
+ double f17 ATTRIBUTE_UNUSED,
+ double f18 ATTRIBUTE_UNUSED,
+ double f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_double.f0 == f0);
+ assert (values_double.f1 == f1);
+ assert (values_double.f2 == f2);
+ assert (values_double.f3 == f3);
+ assert (values_double.f4 == f4);
+ assert (values_double.f5 == f5);
+ assert (values_double.f6 == f6);
+ assert (values_double.f7 == f7);
+ assert (values_double.f8 == f8);
+ assert (values_double.f9 == f9);
+ assert (values_double.f10 == f10);
+ assert (values_double.f11 == f11);
+ assert (values_double.f12 == f12);
+ assert (values_double.f13 == f13);
+ assert (values_double.f14 == f14);
+ assert (values_double.f15 == f15);
+ assert (values_double.f16 == f16);
+ assert (values_double.f17 == f17);
+ assert (values_double.f18 == f18);
+ assert (values_double.f19 == f19);
+
+}
+
+void
+fun_check_float_passing_double20_regs (double f0 ATTRIBUTE_UNUSED,
+ double f1 ATTRIBUTE_UNUSED,
+ double f2 ATTRIBUTE_UNUSED,
+ double f3 ATTRIBUTE_UNUSED,
+ double f4 ATTRIBUTE_UNUSED,
+ double f5 ATTRIBUTE_UNUSED,
+ double f6 ATTRIBUTE_UNUSED,
+ double f7 ATTRIBUTE_UNUSED,
+ double f8 ATTRIBUTE_UNUSED,
+ double f9 ATTRIBUTE_UNUSED,
+ double f10 ATTRIBUTE_UNUSED,
+ double f11 ATTRIBUTE_UNUSED,
+ double f12 ATTRIBUTE_UNUSED,
+ double f13 ATTRIBUTE_UNUSED,
+ double f14 ATTRIBUTE_UNUSED,
+ double f15 ATTRIBUTE_UNUSED,
+ double f16 ATTRIBUTE_UNUSED,
+ double f17 ATTRIBUTE_UNUSED,
+ double f18 ATTRIBUTE_UNUSED,
+ double f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_double_arguments;
+}
+
+void
+fun_check_x87_passing_ldouble8_values (ldouble f0 ATTRIBUTE_UNUSED,
+ ldouble f1 ATTRIBUTE_UNUSED,
+ ldouble f2 ATTRIBUTE_UNUSED,
+ ldouble f3 ATTRIBUTE_UNUSED,
+ ldouble f4 ATTRIBUTE_UNUSED,
+ ldouble f5 ATTRIBUTE_UNUSED,
+ ldouble f6 ATTRIBUTE_UNUSED,
+ ldouble f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_ldouble.f0 == f0);
+ assert (values_ldouble.f1 == f1);
+ assert (values_ldouble.f2 == f2);
+ assert (values_ldouble.f3 == f3);
+ assert (values_ldouble.f4 == f4);
+ assert (values_ldouble.f5 == f5);
+ assert (values_ldouble.f6 == f6);
+ assert (values_ldouble.f7 == f7);
+
+}
+
+void
+fun_check_x87_passing_ldouble8_regs (ldouble f0 ATTRIBUTE_UNUSED,
+ ldouble f1 ATTRIBUTE_UNUSED,
+ ldouble f2 ATTRIBUTE_UNUSED,
+ ldouble f3 ATTRIBUTE_UNUSED,
+ ldouble f4 ATTRIBUTE_UNUSED,
+ ldouble f5 ATTRIBUTE_UNUSED,
+ ldouble f6 ATTRIBUTE_UNUSED,
+ ldouble f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_ldouble_arguments;
+}
+
+void
+fun_check_x87_passing_ldouble16_values (ldouble f0 ATTRIBUTE_UNUSED,
+ ldouble f1 ATTRIBUTE_UNUSED,
+ ldouble f2 ATTRIBUTE_UNUSED,
+ ldouble f3 ATTRIBUTE_UNUSED,
+ ldouble f4 ATTRIBUTE_UNUSED,
+ ldouble f5 ATTRIBUTE_UNUSED,
+ ldouble f6 ATTRIBUTE_UNUSED,
+ ldouble f7 ATTRIBUTE_UNUSED,
+ ldouble f8 ATTRIBUTE_UNUSED,
+ ldouble f9 ATTRIBUTE_UNUSED,
+ ldouble f10 ATTRIBUTE_UNUSED,
+ ldouble f11 ATTRIBUTE_UNUSED,
+ ldouble f12 ATTRIBUTE_UNUSED,
+ ldouble f13 ATTRIBUTE_UNUSED,
+ ldouble f14 ATTRIBUTE_UNUSED,
+ ldouble f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_ldouble.f0 == f0);
+ assert (values_ldouble.f1 == f1);
+ assert (values_ldouble.f2 == f2);
+ assert (values_ldouble.f3 == f3);
+ assert (values_ldouble.f4 == f4);
+ assert (values_ldouble.f5 == f5);
+ assert (values_ldouble.f6 == f6);
+ assert (values_ldouble.f7 == f7);
+ assert (values_ldouble.f8 == f8);
+ assert (values_ldouble.f9 == f9);
+ assert (values_ldouble.f10 == f10);
+ assert (values_ldouble.f11 == f11);
+ assert (values_ldouble.f12 == f12);
+ assert (values_ldouble.f13 == f13);
+ assert (values_ldouble.f14 == f14);
+ assert (values_ldouble.f15 == f15);
+
+}
+
+void
+fun_check_x87_passing_ldouble16_regs (ldouble f0 ATTRIBUTE_UNUSED,
+ ldouble f1 ATTRIBUTE_UNUSED,
+ ldouble f2 ATTRIBUTE_UNUSED,
+ ldouble f3 ATTRIBUTE_UNUSED,
+ ldouble f4 ATTRIBUTE_UNUSED,
+ ldouble f5 ATTRIBUTE_UNUSED,
+ ldouble f6 ATTRIBUTE_UNUSED,
+ ldouble f7 ATTRIBUTE_UNUSED,
+ ldouble f8 ATTRIBUTE_UNUSED,
+ ldouble f9 ATTRIBUTE_UNUSED,
+ ldouble f10 ATTRIBUTE_UNUSED,
+ ldouble f11 ATTRIBUTE_UNUSED,
+ ldouble f12 ATTRIBUTE_UNUSED,
+ ldouble f13 ATTRIBUTE_UNUSED,
+ ldouble f14 ATTRIBUTE_UNUSED,
+ ldouble f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_ldouble_arguments;
+}
+
+void
+fun_check_x87_passing_ldouble20_values (ldouble f0 ATTRIBUTE_UNUSED,
+ ldouble f1 ATTRIBUTE_UNUSED,
+ ldouble f2 ATTRIBUTE_UNUSED,
+ ldouble f3 ATTRIBUTE_UNUSED,
+ ldouble f4 ATTRIBUTE_UNUSED,
+ ldouble f5 ATTRIBUTE_UNUSED,
+ ldouble f6 ATTRIBUTE_UNUSED,
+ ldouble f7 ATTRIBUTE_UNUSED,
+ ldouble f8 ATTRIBUTE_UNUSED,
+ ldouble f9 ATTRIBUTE_UNUSED,
+ ldouble f10 ATTRIBUTE_UNUSED,
+ ldouble f11 ATTRIBUTE_UNUSED,
+ ldouble f12 ATTRIBUTE_UNUSED,
+ ldouble f13 ATTRIBUTE_UNUSED,
+ ldouble f14 ATTRIBUTE_UNUSED,
+ ldouble f15 ATTRIBUTE_UNUSED,
+ ldouble f16 ATTRIBUTE_UNUSED,
+ ldouble f17 ATTRIBUTE_UNUSED,
+ ldouble f18 ATTRIBUTE_UNUSED,
+ ldouble f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_ldouble.f0 == f0);
+ assert (values_ldouble.f1 == f1);
+ assert (values_ldouble.f2 == f2);
+ assert (values_ldouble.f3 == f3);
+ assert (values_ldouble.f4 == f4);
+ assert (values_ldouble.f5 == f5);
+ assert (values_ldouble.f6 == f6);
+ assert (values_ldouble.f7 == f7);
+ assert (values_ldouble.f8 == f8);
+ assert (values_ldouble.f9 == f9);
+ assert (values_ldouble.f10 == f10);
+ assert (values_ldouble.f11 == f11);
+ assert (values_ldouble.f12 == f12);
+ assert (values_ldouble.f13 == f13);
+ assert (values_ldouble.f14 == f14);
+ assert (values_ldouble.f15 == f15);
+ assert (values_ldouble.f16 == f16);
+ assert (values_ldouble.f17 == f17);
+ assert (values_ldouble.f18 == f18);
+ assert (values_ldouble.f19 == f19);
+
+}
+
+void
+fun_check_x87_passing_ldouble20_regs (ldouble f0 ATTRIBUTE_UNUSED,
+ ldouble f1 ATTRIBUTE_UNUSED,
+ ldouble f2 ATTRIBUTE_UNUSED,
+ ldouble f3 ATTRIBUTE_UNUSED,
+ ldouble f4 ATTRIBUTE_UNUSED,
+ ldouble f5 ATTRIBUTE_UNUSED,
+ ldouble f6 ATTRIBUTE_UNUSED,
+ ldouble f7 ATTRIBUTE_UNUSED,
+ ldouble f8 ATTRIBUTE_UNUSED,
+ ldouble f9 ATTRIBUTE_UNUSED,
+ ldouble f10 ATTRIBUTE_UNUSED,
+ ldouble f11 ATTRIBUTE_UNUSED,
+ ldouble f12 ATTRIBUTE_UNUSED,
+ ldouble f13 ATTRIBUTE_UNUSED,
+ ldouble f14 ATTRIBUTE_UNUSED,
+ ldouble f15 ATTRIBUTE_UNUSED,
+ ldouble f16 ATTRIBUTE_UNUSED,
+ ldouble f17 ATTRIBUTE_UNUSED,
+ ldouble f18 ATTRIBUTE_UNUSED,
+ ldouble f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_ldouble_arguments;
+}
+
+#define def_check_float16_passing8(_f0, _f1, _f2, _f3, _f4, _f5, _f6,\
+ _f7, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7); \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7);
+
+#define def_check_float16_passing16(_f0, _f1, _f2, _f3, _f4, _f5, _f6, \
+ _f7, _f8, _f9, _f10, _f11, _f12, _f13, \
+ _f14, _f15, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
+ _f10, _f11, _f12, _f13, _f14, _f15); \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
+ _f10, _f11, _f12, _f13, _f14, _f15);
+
+#define def_check_float16_passing20(_f0, _f1, _f2, _f3, _f4, _f5, _f6, \
+ _f7, _f8, _f9, _f10, _f11, _f12, \
+ _f13, _f14, _f15, _f16, _f17, \
+ _f18, _f19, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ values_ ## TYPE .f16 = _f16; \
+ values_ ## TYPE .f17 = _f17; \
+ values_ ## TYPE .f18 = _f18; \
+ values_ ## TYPE .f19 = _f19; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, \
+ _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, \
+ _f17, _f18, _f19); \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
+ _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, \
+ _f18, _f19);
+
+
+#define def_check_float_passing8(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7); \
+ \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7);
+
+#define def_check_float_passing16(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15); \
+ \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15);
+
+#define def_check_float_passing20(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ values_ ## TYPE .f16 = _f16; \
+ values_ ## TYPE .f17 = _f17; \
+ values_ ## TYPE .f18 = _f18; \
+ values_ ## TYPE .f19 = _f19; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19); \
+ \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19);
+
+#define def_check_x87_passing8(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7); \
+ \
+ clear_x87_registers; \
+ num_fregs = 0; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7);
+
+#define def_check_x87_passing16(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15); \
+ \
+ clear_x87_registers; \
+ num_fregs = 0; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15);
+
+#define def_check_x87_passing20(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ values_ ## TYPE .f16 = _f16; \
+ values_ ## TYPE .f17 = _f17; \
+ values_ ## TYPE .f18 = _f18; \
+ values_ ## TYPE .f19 = _f19; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19); \
+ \
+ clear_x87_registers; \
+ num_fregs = 0; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19);
+
+void
+test_float16_on_stack ()
+{
+ def_check_float16_passing8 (32, 33, 34, 35, 36, 37, 38, 39,
+ fun_check_float16_passing_8_values,
+ fun_check_float16_passing_8_regs, _Float16);
+
+ def_check_float16_passing16 (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47,
+ fun_check_float16_passing_16_values,
+ fun_check_float16_passing_16_regs, _Float16);
+}
+
+void
+test_too_many_float16 ()
+{
+ def_check_float16_passing20 (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51,
+ fun_check_float16_passing_20_values,
+ fun_check_float16_passing_20_regs, _Float16);
+}
+
+void
+test_floats_on_stack ()
+{
+ def_check_float_passing8 (32, 33, 34, 35, 36, 37, 38, 39,
+ fun_check_float_passing_float8_values,
+ fun_check_float_passing_float8_regs, float);
+
+ def_check_float_passing16 (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47,
+ fun_check_float_passing_float16_values,
+ fun_check_float_passing_float16_regs, float);
+}
+
+void
+test_too_many_floats ()
+{
+ def_check_float_passing20 (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51,
+ fun_check_float_passing_float20_values,
+ fun_check_float_passing_float20_regs, float);
+}
+
+void
+test_doubles_on_stack ()
+{
+ def_check_float_passing8 (32, 33, 34, 35, 36, 37, 38, 39,
+ fun_check_float_passing_double8_values,
+ fun_check_float_passing_double8_regs, double);
+
+ def_check_float_passing16 (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47,
+ fun_check_float_passing_double16_values,
+ fun_check_float_passing_double16_regs, double);
+}
+
+void
+test_too_many_doubles ()
+{
+ def_check_float_passing20 (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51,
+ fun_check_float_passing_double20_values,
+ fun_check_float_passing_double20_regs, double);
+}
+
+void
+test_long_doubles_on_stack ()
+{
+ def_check_x87_passing8 (32, 33, 34, 35, 36, 37, 38, 39,
+ fun_check_x87_passing_ldouble8_values,
+ fun_check_x87_passing_ldouble8_regs, ldouble);
+}
+
+void
+test_too_many_long_doubles ()
+{
+ def_check_x87_passing20 (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51,
+ fun_check_x87_passing_ldouble20_values,
+ fun_check_x87_passing_ldouble20_regs, ldouble);
+}
+
+void
+test_float128s_on_stack ()
+{
+}
+
+void
+test_too_many_float128s ()
+{
+}
+
+
+static void
+do_test (void)
+{
+ test_float16_on_stack ();
+ test_too_many_float16 ();
+ test_floats_on_stack ();
+ test_too_many_floats ();
+ test_doubles_on_stack ();
+ test_too_many_doubles ();
+ test_long_doubles_on_stack ();
+ test_too_many_long_doubles ();
+ test_float128s_on_stack ();
+ test_too_many_float128s ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_m64m128.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_m64m128.c
new file mode 100644
index 0000000..66c27ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_m64m128.c
@@ -0,0 +1,510 @@
+#include <stdio.h>
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ XMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,
+ i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m64_8_values (__m64 i0 ATTRIBUTE_UNUSED,
+ __m64 i1 ATTRIBUTE_UNUSED,
+ __m64 i2 ATTRIBUTE_UNUSED,
+ __m64 i3 ATTRIBUTE_UNUSED,
+ __m64 i4 ATTRIBUTE_UNUSED,
+ __m64 i5 ATTRIBUTE_UNUSED,
+ __m64 i6 ATTRIBUTE_UNUSED,
+ __m64 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m64);
+ compare (values.i1, i1, __m64);
+ compare (values.i2, i2, __m64);
+ compare (values.i3, i3, __m64);
+ compare (values.i4, i4, __m64);
+ compare (values.i5, i5, __m64);
+ compare (values.i6, i6, __m64);
+ compare (values.i7, i7, __m64);
+}
+
+void
+fun_check_passing_m64_8_regs (__m64 i0 ATTRIBUTE_UNUSED,
+ __m64 i1 ATTRIBUTE_UNUSED,
+ __m64 i2 ATTRIBUTE_UNUSED,
+ __m64 i3 ATTRIBUTE_UNUSED,
+ __m64 i4 ATTRIBUTE_UNUSED,
+ __m64 i5 ATTRIBUTE_UNUSED,
+ __m64 i6 ATTRIBUTE_UNUSED,
+ __m64 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m64_arguments;
+}
+
+void
+fun_check_passing_m64_20_values (__m64 i0 ATTRIBUTE_UNUSED,
+ __m64 i1 ATTRIBUTE_UNUSED,
+ __m64 i2 ATTRIBUTE_UNUSED,
+ __m64 i3 ATTRIBUTE_UNUSED,
+ __m64 i4 ATTRIBUTE_UNUSED,
+ __m64 i5 ATTRIBUTE_UNUSED,
+ __m64 i6 ATTRIBUTE_UNUSED,
+ __m64 i7 ATTRIBUTE_UNUSED,
+ __m64 i8 ATTRIBUTE_UNUSED,
+ __m64 i9 ATTRIBUTE_UNUSED,
+ __m64 i10 ATTRIBUTE_UNUSED,
+ __m64 i11 ATTRIBUTE_UNUSED,
+ __m64 i12 ATTRIBUTE_UNUSED,
+ __m64 i13 ATTRIBUTE_UNUSED,
+ __m64 i14 ATTRIBUTE_UNUSED,
+ __m64 i15 ATTRIBUTE_UNUSED,
+ __m64 i16 ATTRIBUTE_UNUSED,
+ __m64 i17 ATTRIBUTE_UNUSED,
+ __m64 i18 ATTRIBUTE_UNUSED,
+ __m64 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m64);
+ compare (values.i1, i1, __m64);
+ compare (values.i2, i2, __m64);
+ compare (values.i3, i3, __m64);
+ compare (values.i4, i4, __m64);
+ compare (values.i5, i5, __m64);
+ compare (values.i6, i6, __m64);
+ compare (values.i7, i7, __m64);
+ compare (values.i8, i8, __m64);
+ compare (values.i9, i9, __m64);
+ compare (values.i10, i10, __m64);
+ compare (values.i11, i11, __m64);
+ compare (values.i12, i12, __m64);
+ compare (values.i13, i13, __m64);
+ compare (values.i14, i14, __m64);
+ compare (values.i15, i15, __m64);
+ compare (values.i16, i16, __m64);
+ compare (values.i17, i17, __m64);
+ compare (values.i18, i18, __m64);
+ compare (values.i19, i19, __m64);
+}
+
+void
+fun_check_passing_m64_20_regs (__m64 i0 ATTRIBUTE_UNUSED,
+ __m64 i1 ATTRIBUTE_UNUSED,
+ __m64 i2 ATTRIBUTE_UNUSED,
+ __m64 i3 ATTRIBUTE_UNUSED,
+ __m64 i4 ATTRIBUTE_UNUSED,
+ __m64 i5 ATTRIBUTE_UNUSED,
+ __m64 i6 ATTRIBUTE_UNUSED,
+ __m64 i7 ATTRIBUTE_UNUSED,
+ __m64 i8 ATTRIBUTE_UNUSED,
+ __m64 i9 ATTRIBUTE_UNUSED,
+ __m64 i10 ATTRIBUTE_UNUSED,
+ __m64 i11 ATTRIBUTE_UNUSED,
+ __m64 i12 ATTRIBUTE_UNUSED,
+ __m64 i13 ATTRIBUTE_UNUSED,
+ __m64 i14 ATTRIBUTE_UNUSED,
+ __m64 i15 ATTRIBUTE_UNUSED,
+ __m64 i16 ATTRIBUTE_UNUSED,
+ __m64 i17 ATTRIBUTE_UNUSED,
+ __m64 i18 ATTRIBUTE_UNUSED,
+ __m64 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m64_arguments;
+}
+
+void
+fun_check_passing_m128_8_values (__m128 i0 ATTRIBUTE_UNUSED,
+ __m128 i1 ATTRIBUTE_UNUSED,
+ __m128 i2 ATTRIBUTE_UNUSED,
+ __m128 i3 ATTRIBUTE_UNUSED,
+ __m128 i4 ATTRIBUTE_UNUSED,
+ __m128 i5 ATTRIBUTE_UNUSED,
+ __m128 i6 ATTRIBUTE_UNUSED,
+ __m128 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m128);
+ compare (values.i1, i1, __m128);
+ compare (values.i2, i2, __m128);
+ compare (values.i3, i3, __m128);
+ compare (values.i4, i4, __m128);
+ compare (values.i5, i5, __m128);
+ compare (values.i6, i6, __m128);
+ compare (values.i7, i7, __m128);
+}
+
+void
+fun_check_passing_m128h_8_values (__m128h i0 ATTRIBUTE_UNUSED,
+ __m128h i1 ATTRIBUTE_UNUSED,
+ __m128h i2 ATTRIBUTE_UNUSED,
+ __m128h i3 ATTRIBUTE_UNUSED,
+ __m128h i4 ATTRIBUTE_UNUSED,
+ __m128h i5 ATTRIBUTE_UNUSED,
+ __m128h i6 ATTRIBUTE_UNUSED,
+ __m128h i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m128h);
+ compare (values.i1, i1, __m128h);
+ compare (values.i2, i2, __m128h);
+ compare (values.i3, i3, __m128h);
+ compare (values.i4, i4, __m128h);
+ compare (values.i5, i5, __m128h);
+ compare (values.i6, i6, __m128h);
+ compare (values.i7, i7, __m128h);
+}
+
+void
+fun_check_passing_m128_8_regs (__m128 i0 ATTRIBUTE_UNUSED,
+ __m128 i1 ATTRIBUTE_UNUSED,
+ __m128 i2 ATTRIBUTE_UNUSED,
+ __m128 i3 ATTRIBUTE_UNUSED,
+ __m128 i4 ATTRIBUTE_UNUSED,
+ __m128 i5 ATTRIBUTE_UNUSED,
+ __m128 i6 ATTRIBUTE_UNUSED,
+ __m128 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+void
+fun_check_passing_m128h_8_regs (__m128h i0 ATTRIBUTE_UNUSED,
+ __m128h i1 ATTRIBUTE_UNUSED,
+ __m128h i2 ATTRIBUTE_UNUSED,
+ __m128h i3 ATTRIBUTE_UNUSED,
+ __m128h i4 ATTRIBUTE_UNUSED,
+ __m128h i5 ATTRIBUTE_UNUSED,
+ __m128h i6 ATTRIBUTE_UNUSED,
+ __m128h i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+void
+fun_check_passing_m128_20_values (__m128 i0 ATTRIBUTE_UNUSED,
+ __m128 i1 ATTRIBUTE_UNUSED,
+ __m128 i2 ATTRIBUTE_UNUSED,
+ __m128 i3 ATTRIBUTE_UNUSED,
+ __m128 i4 ATTRIBUTE_UNUSED,
+ __m128 i5 ATTRIBUTE_UNUSED,
+ __m128 i6 ATTRIBUTE_UNUSED,
+ __m128 i7 ATTRIBUTE_UNUSED,
+ __m128 i8 ATTRIBUTE_UNUSED,
+ __m128 i9 ATTRIBUTE_UNUSED,
+ __m128 i10 ATTRIBUTE_UNUSED,
+ __m128 i11 ATTRIBUTE_UNUSED,
+ __m128 i12 ATTRIBUTE_UNUSED,
+ __m128 i13 ATTRIBUTE_UNUSED,
+ __m128 i14 ATTRIBUTE_UNUSED,
+ __m128 i15 ATTRIBUTE_UNUSED,
+ __m128 i16 ATTRIBUTE_UNUSED,
+ __m128 i17 ATTRIBUTE_UNUSED,
+ __m128 i18 ATTRIBUTE_UNUSED,
+ __m128 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m128);
+ compare (values.i1, i1, __m128);
+ compare (values.i2, i2, __m128);
+ compare (values.i3, i3, __m128);
+ compare (values.i4, i4, __m128);
+ compare (values.i5, i5, __m128);
+ compare (values.i6, i6, __m128);
+ compare (values.i7, i7, __m128);
+ compare (values.i8, i8, __m128);
+ compare (values.i9, i9, __m128);
+ compare (values.i10, i10, __m128);
+ compare (values.i11, i11, __m128);
+ compare (values.i12, i12, __m128);
+ compare (values.i13, i13, __m128);
+ compare (values.i14, i14, __m128);
+ compare (values.i15, i15, __m128);
+ compare (values.i16, i16, __m128);
+ compare (values.i17, i17, __m128);
+ compare (values.i18, i18, __m128);
+ compare (values.i19, i19, __m128);
+}
+
+void
+fun_check_passing_m128h_20_values (__m128h i0 ATTRIBUTE_UNUSED,
+ __m128h i1 ATTRIBUTE_UNUSED,
+ __m128h i2 ATTRIBUTE_UNUSED,
+ __m128h i3 ATTRIBUTE_UNUSED,
+ __m128h i4 ATTRIBUTE_UNUSED,
+ __m128h i5 ATTRIBUTE_UNUSED,
+ __m128h i6 ATTRIBUTE_UNUSED,
+ __m128h i7 ATTRIBUTE_UNUSED,
+ __m128h i8 ATTRIBUTE_UNUSED,
+ __m128h i9 ATTRIBUTE_UNUSED,
+ __m128h i10 ATTRIBUTE_UNUSED,
+ __m128h i11 ATTRIBUTE_UNUSED,
+ __m128h i12 ATTRIBUTE_UNUSED,
+ __m128h i13 ATTRIBUTE_UNUSED,
+ __m128h i14 ATTRIBUTE_UNUSED,
+ __m128h i15 ATTRIBUTE_UNUSED,
+ __m128h i16 ATTRIBUTE_UNUSED,
+ __m128h i17 ATTRIBUTE_UNUSED,
+ __m128h i18 ATTRIBUTE_UNUSED,
+ __m128h i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m128h);
+ compare (values.i1, i1, __m128h);
+ compare (values.i2, i2, __m128h);
+ compare (values.i3, i3, __m128h);
+ compare (values.i4, i4, __m128h);
+ compare (values.i5, i5, __m128h);
+ compare (values.i6, i6, __m128h);
+ compare (values.i7, i7, __m128h);
+ compare (values.i8, i8, __m128h);
+ compare (values.i9, i9, __m128h);
+ compare (values.i10, i10, __m128h);
+ compare (values.i11, i11, __m128h);
+ compare (values.i12, i12, __m128h);
+ compare (values.i13, i13, __m128h);
+ compare (values.i14, i14, __m128h);
+ compare (values.i15, i15, __m128h);
+ compare (values.i16, i16, __m128h);
+ compare (values.i17, i17, __m128h);
+ compare (values.i18, i18, __m128h);
+ compare (values.i19, i19, __m128h);
+}
+
+void
+fun_check_passing_m128_20_regs (__m128 i0 ATTRIBUTE_UNUSED,
+ __m128 i1 ATTRIBUTE_UNUSED,
+ __m128 i2 ATTRIBUTE_UNUSED,
+ __m128 i3 ATTRIBUTE_UNUSED,
+ __m128 i4 ATTRIBUTE_UNUSED,
+ __m128 i5 ATTRIBUTE_UNUSED,
+ __m128 i6 ATTRIBUTE_UNUSED,
+ __m128 i7 ATTRIBUTE_UNUSED,
+ __m128 i8 ATTRIBUTE_UNUSED,
+ __m128 i9 ATTRIBUTE_UNUSED,
+ __m128 i10 ATTRIBUTE_UNUSED,
+ __m128 i11 ATTRIBUTE_UNUSED,
+ __m128 i12 ATTRIBUTE_UNUSED,
+ __m128 i13 ATTRIBUTE_UNUSED,
+ __m128 i14 ATTRIBUTE_UNUSED,
+ __m128 i15 ATTRIBUTE_UNUSED,
+ __m128 i16 ATTRIBUTE_UNUSED,
+ __m128 i17 ATTRIBUTE_UNUSED,
+ __m128 i18 ATTRIBUTE_UNUSED,
+ __m128 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+void
+fun_check_passing_m128h_20_regs (__m128h i0 ATTRIBUTE_UNUSED,
+ __m128h i1 ATTRIBUTE_UNUSED,
+ __m128h i2 ATTRIBUTE_UNUSED,
+ __m128h i3 ATTRIBUTE_UNUSED,
+ __m128h i4 ATTRIBUTE_UNUSED,
+ __m128h i5 ATTRIBUTE_UNUSED,
+ __m128h i6 ATTRIBUTE_UNUSED,
+ __m128h i7 ATTRIBUTE_UNUSED,
+ __m128h i8 ATTRIBUTE_UNUSED,
+ __m128h i9 ATTRIBUTE_UNUSED,
+ __m128h i10 ATTRIBUTE_UNUSED,
+ __m128h i11 ATTRIBUTE_UNUSED,
+ __m128h i12 ATTRIBUTE_UNUSED,
+ __m128h i13 ATTRIBUTE_UNUSED,
+ __m128h i14 ATTRIBUTE_UNUSED,
+ __m128h i15 ATTRIBUTE_UNUSED,
+ __m128h i16 ATTRIBUTE_UNUSED,
+ __m128h i17 ATTRIBUTE_UNUSED,
+ __m128h i18 ATTRIBUTE_UNUSED,
+ __m128h i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+#define def_check_int_passing8(_i0, _i1, _i2, _i3, \
+ _i4, _i5, _i6, _i7, \
+ _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_int_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, \
+ _i7, _i8, _i9, _i10, _i11, _i12, _i13, \
+ _i14, _i15, _i16, _i17, _i18, _i19, \
+ _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, \
+ _i17, _i18, _i19); \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, \
+ _i17, _i18, _i19);
+
+void
+test_m64_on_stack ()
+{
+ __m64 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m64){32 + i, 0};
+ pass = "m64-8";
+ def_check_int_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m64_8_values,
+ fun_check_passing_m64_8_regs, _m64);
+}
+
+void
+test_too_many_m64 ()
+{
+ __m64 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m64){32 + i, 0};
+ pass = "m64-20";
+ def_check_int_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ x[8], x[9], x[10], x[11], x[12], x[13], x[14],
+ x[15], x[16], x[17], x[18], x[19],
+ fun_check_passing_m64_20_values,
+ fun_check_passing_m64_20_regs, _m64);
+}
+
+void
+test_m128_on_stack ()
+{
+ __m128 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m128){32 + i, 0, 0, 0};
+ pass = "m128-8";
+ def_check_int_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m128_8_values,
+ fun_check_passing_m128_8_regs, _m128);
+}
+
+void
+test_m128h_on_stack ()
+{
+ __m128h x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m128h){1.1f16, 2.2f16, 3.3f16, 4.4f16, 5.5f16,
+ 6.6f16, 7.7f16, 8.8f16};
+ pass = "m128h-8";
+ def_check_int_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m128h_8_values,
+ fun_check_passing_m128h_8_regs, _m128h);
+}
+
+void
+test_too_many_m128 ()
+{
+ __m128 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m128){32 + i, 0, 0, 0};
+ pass = "m128-20";
+ def_check_int_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ x[8], x[9], x[10], x[11], x[12], x[13], x[14],
+ x[15], x[16], x[17], x[18], x[19],
+ fun_check_passing_m128_20_values,
+ fun_check_passing_m128_20_regs, _m128);
+}
+
+void
+test_too_many_m128h ()
+{
+ __m128h x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m128h){1.1f16, 2.2f16, 3.3f16, 4.4f16, 5.5f16,
+ 6.6f16, 7.7f16, 8.8f16};
+ pass = "m128h-20";
+ def_check_int_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ x[8], x[9], x[10], x[11], x[12], x[13], x[14],
+ x[15], x[16], x[17], x[18], x[19],
+ fun_check_passing_m128h_20_values,
+ fun_check_passing_m128h_20_regs, _m128h);
+}
+
+static void
+do_test (void)
+{
+ test_m64_on_stack ();
+ test_too_many_m64 ();
+ test_m128_on_stack ();
+ test_too_many_m128 ();
+ test_m128h_on_stack ();
+ test_too_many_m128h ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_structs.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_structs.c
new file mode 100644
index 0000000..4d1956a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_structs.c
@@ -0,0 +1,332 @@
+/* This tests passing of structs. */
+
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "args.h"
+#include <complex.h>
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct int_struct
+{
+ int i;
+};
+
+struct long_struct
+{
+ long long l;
+};
+
+struct long2_struct
+{
+ long long l1, l2;
+};
+
+struct long3_struct
+{
+ long long l1, l2, l3;
+};
+
+
+/* Check that the struct is passed as the individual members in iregs. */
+void
+check_struct_passing1 (struct int_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing2 (struct long_struct ls ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing3 (struct long2_struct ls ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing4 (struct long3_struct ls ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ls.l1 == rsp+8);
+ assert ((unsigned long)&ls.l2 == rsp+16);
+ assert ((unsigned long)&ls.l3 == rsp+24);
+}
+
+#ifdef CHECK_M64_M128
+struct m128_struct
+{
+ __m128 x;
+};
+
+struct m128_2_struct
+{
+ __m128 x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing5 (struct m128_struct ms1 ATTRIBUTE_UNUSED,
+ struct m128_struct ms2 ATTRIBUTE_UNUSED,
+ struct m128_struct ms3 ATTRIBUTE_UNUSED,
+ struct m128_struct ms4 ATTRIBUTE_UNUSED,
+ struct m128_struct ms5 ATTRIBUTE_UNUSED,
+ struct m128_struct ms6 ATTRIBUTE_UNUSED,
+ struct m128_struct ms7 ATTRIBUTE_UNUSED,
+ struct m128_struct ms8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_struct_passing6 (struct m128_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+24);
+}
+#endif
+
+struct flex1_struct
+{
+ long long i;
+ long long flex[];
+};
+
+struct flex2_struct
+{
+ long long i;
+ long long flex[0];
+};
+
+void
+check_struct_passing7 (struct flex1_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing8 (struct flex2_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+struct complex1_struct
+{
+ int c;
+ __complex__ float x;
+};
+
+struct complex1a_struct
+{
+ long long l;
+ float f;
+};
+
+struct complex2_struct
+{
+ int c;
+ __complex__ float x;
+ float y;
+};
+
+struct complex2a_struct
+{
+ long long l;
+ double d;
+};
+
+struct complex3_struct
+{
+ int c;
+ __complex__ _Float16 x;
+};
+
+struct complex3a_struct
+{
+ long long l;
+ _Float16 f;
+};
+
+struct complex4_struct
+{
+ int c;
+ __complex__ _Float16 x;
+ _Float16 y;
+};
+
+struct complex4a_struct
+{
+ long long l;
+ _Float16 f;
+};
+
+void
+check_struct_passing9 (struct complex1_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_float_arguments;
+}
+
+void
+check_struct_passing10 (struct complex2_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_double_arguments;
+}
+
+void
+check_struct_passing11 (struct complex3_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_float16_arguments;
+}
+
+void
+check_struct_passing12 (struct complex4_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_float16_arguments;
+}
+
+static struct flex1_struct f1s = { 60, { } };
+static struct flex2_struct f2s = { 61, { } };
+
+static void
+do_test (void)
+{
+ struct int_struct is = { 48 };
+ struct long_struct ls = { 49 };
+#ifdef CHECK_LARGER_STRUCTS
+ struct long2_struct l2s = { 50, 51 };
+ struct long3_struct l3s = { 52, 53, 54 };
+#endif
+#ifdef CHECK_M64_M128
+ struct m128_struct m128s[8];
+ struct m128_2_struct m128_2s = {
+ { 48.394, 39.3, -397.9, 3484.9 },
+ { -8.394, -93.3, 7.9, 84.94 }
+ };
+ int i;
+#endif
+ struct complex1_struct c1s = { 4, ( -13.4 + 3.5*I ) };
+ union
+ {
+ struct complex1_struct c;
+ struct complex1a_struct u;
+ } c1u;
+ struct complex2_struct c2s = { 4, ( -13.4 + 3.5*I ), -34.5 };
+ union
+ {
+ struct complex2_struct c;
+ struct complex2a_struct u;
+ } c2u;
+
+ struct complex3_struct c3s = { 4, ( -13.4 + 3.5*I ) };
+ union
+ {
+ struct complex3_struct c;
+ struct complex3a_struct u;
+ } c3u;
+
+ struct complex4_struct c4s = { 4, ( -13.4 + 3.5*I ), -34.5 };
+ union
+ {
+ struct complex4_struct c;
+ struct complex4a_struct u;
+ } c4u;
+
+ clear_struct_registers;
+ iregs.I0 = is.i;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing1)(is);
+
+ clear_struct_registers;
+ iregs.I0 = ls.l;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing2)(ls);
+
+#ifdef CHECK_LARGER_STRUCTS
+ clear_struct_registers;
+ iregs.I0 = l2s.l1;
+ iregs.I1 = l2s.l2;
+ num_iregs = 2;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing3)(l2s);
+ WRAP_CALL (check_struct_passing4)(l3s);
+#endif
+
+#ifdef CHECK_M64_M128
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ m128s[i].x = (__m128){32+i, 0, i, 0};
+ (&fregs.xmm0)[i]._m128[0] = m128s[i].x;
+ }
+ num_fregs = 8;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing5)(m128s[0], m128s[1], m128s[2], m128s[3],
+ m128s[4], m128s[5], m128s[6], m128s[7]);
+ WRAP_CALL (check_struct_passing6)(m128_2s);
+#endif
+
+ clear_struct_registers;
+ iregs.I0 = f1s.i;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing7)(f1s);
+
+ clear_struct_registers;
+ iregs.I0 = f2s.i;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing8)(f2s);
+
+ clear_struct_registers;
+ c1u.c = c1s;
+ iregs.I0 = c1u.u.l;
+ num_iregs = 1;
+ fregs.xmm0._float [0] = c1u.u.f;
+ num_fregs = 1;
+ clear_int_hardware_registers;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing9)(c1s);
+
+ clear_struct_registers;
+ c2u.c = c2s;
+ iregs.I0 = c2u.u.l;
+ num_iregs = 1;
+ fregs.xmm0._double[0] = c2u.u.d;
+ num_fregs = 1;
+ clear_int_hardware_registers;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing10)(c2s);
+
+ clear_struct_registers;
+ c3u.c = c3s;
+ iregs.I0 = c3u.u.l;
+ num_iregs = 1;
+ num_fregs = 0;
+ clear_int_hardware_registers;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing11)(c3s);
+
+ clear_struct_registers;
+ c4u.c = c4s;
+ iregs.I0 = c4u.u.l;
+ num_iregs = 1;
+ fregs.xmm0.__Float16 [0] = c4u.u.f;
+ num_fregs = 1;
+ clear_int_hardware_registers;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing12)(c4s);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_unions.c
new file mode 100644
index 0000000..640b305
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_passing_unions.c
@@ -0,0 +1,335 @@
+/* This tests passing of structs. */
+
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct int_struct
+{
+ int i;
+};
+
+struct long_struct
+{
+ long l;
+};
+
+union un1
+{
+ char c;
+ int i;
+};
+
+union un2
+{
+ char c1;
+ long l;
+ char c2;
+};
+
+union un3
+{
+ struct int_struct is;
+ struct long_struct ls;
+ union un1 un;
+};
+
+
+void
+check_union_passing1(union un1 u ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_union_passing2(union un2 u1 ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_union_passing3(union un3 u ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+#define check_union_passing1 WRAP_CALL(check_union_passing1)
+#define check_union_passing2 WRAP_CALL(check_union_passing2)
+#define check_union_passing3 WRAP_CALL(check_union_passing3)
+
+#ifdef CHECK_M64_M128
+union un4
+{
+ __m128 x;
+ float f;
+};
+
+union un5
+{
+ __m128 x;
+ long i;
+};
+
+void
+check_union_passing4(union un4 u1 ATTRIBUTE_UNUSED,
+ union un4 u2 ATTRIBUTE_UNUSED,
+ union un4 u3 ATTRIBUTE_UNUSED,
+ union un4 u4 ATTRIBUTE_UNUSED,
+ union un4 u5 ATTRIBUTE_UNUSED,
+ union un4 u6 ATTRIBUTE_UNUSED,
+ union un4 u7 ATTRIBUTE_UNUSED,
+ union un4 u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_union_passing5(union un5 u ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_vector_arguments(m128, 8);
+}
+
+union un4a
+{
+ __m128 x;
+ _Float16 f;
+};
+
+void
+check_union_passing4a(union un4a u1 ATTRIBUTE_UNUSED,
+ union un4a u2 ATTRIBUTE_UNUSED,
+ union un4a u3 ATTRIBUTE_UNUSED,
+ union un4a u4 ATTRIBUTE_UNUSED,
+ union un4a u5 ATTRIBUTE_UNUSED,
+ union un4a u6 ATTRIBUTE_UNUSED,
+ union un4a u7 ATTRIBUTE_UNUSED,
+ union un4a u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+union un4b
+{
+ __m128h x;
+ _Float16 f;
+};
+
+void
+check_union_passing4b(union un4b u1 ATTRIBUTE_UNUSED,
+ union un4b u2 ATTRIBUTE_UNUSED,
+ union un4b u3 ATTRIBUTE_UNUSED,
+ union un4b u4 ATTRIBUTE_UNUSED,
+ union un4b u5 ATTRIBUTE_UNUSED,
+ union un4b u6 ATTRIBUTE_UNUSED,
+ union un4b u7 ATTRIBUTE_UNUSED,
+ union un4b u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+#define check_union_passing4 WRAP_CALL(check_union_passing4)
+#define check_union_passing4a WRAP_CALL(check_union_passing4a)
+#define check_union_passing4b WRAP_CALL(check_union_passing4b)
+#define check_union_passing5 WRAP_CALL(check_union_passing5)
+#endif
+
+union un6
+{
+ long double ld;
+ int i;
+};
+
+
+void
+check_union_passing6(union un6 u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.ld == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+#define check_union_passing6 WRAP_CALL(check_union_passing6)
+
+union un7
+{
+ long double ld;
+ _Float16 f;
+};
+
+void
+check_union_passing7(union un7 u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.ld == rsp+8);
+ assert ((unsigned long)&u.f == rsp+8);
+}
+
+#define check_union_passing7 WRAP_CALL(check_union_passing7)
+
+union un8
+{
+ _Float16 f;
+ int i;
+};
+
+void
+check_union_passing8(union un8 u ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+#define check_union_passing8 WRAP_CALL(check_union_passing8)
+
+static void
+do_test (void)
+{
+ union un1 u1;
+#ifdef CHECK_LARGER_UNION_PASSING
+ union un2 u2;
+ union un3 u3;
+ struct int_struct is;
+ struct long_struct ls;
+#endif /* CHECK_LARGER_UNION_PASSING */
+#ifdef CHECK_M64_M128
+ union un4 u4[8];
+ union un4a u4a[8];
+ union un4b u4b[8];
+ union un5 u5 = { { 48.394, 39.3, -397.9, 3484.9 } };
+ int i;
+#endif
+ union un6 u6;
+ union un7 u7;
+ union un8 u8;
+
+ /* Check a union with char, int. */
+ clear_struct_registers;
+ u1.i = 0; /* clear the struct to not have high bits left */
+ u1.c = 32;
+ iregs.I0 = 32;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing1(u1);
+ u1.i = 0; /* clear the struct to not have high bits left */
+ u1.i = 33;
+ iregs.I0 = 33;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing1(u1);
+
+ /* Check a union with char, long, char. */
+#ifdef CHECK_LARGER_UNION_PASSING
+ clear_struct_registers;
+ u2.l = 0; /* clear the struct to not have high bits left */
+ u2.c1 = 34;
+ iregs.I0 = 34;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing2(u2);
+ u2.l = 0; /* clear the struct to not have high bits left */
+ u2.l = 35;
+ iregs.I0 = 35;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing2(u2);
+ u2.l = 0; /* clear the struct to not have high bits left */
+ u2.c2 = 36;
+ iregs.I0 = 36;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing2(u2);
+
+ /* check a union containing two structs and a union. */
+ clear_struct_registers;
+ is.i = 37;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.is = is;
+ iregs.I0 = 37;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+ ls.l = 38;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.ls = ls;
+ iregs.I0 = 38;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+ u1.c = 39;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.un = u1;
+ iregs.I0 = 39;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+ u1.i = 40;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.un = u1;
+ iregs.I0 = 40;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+#endif /* CHECK_LARGER_UNION_PASSING */
+
+#ifdef CHECK_M64_M128
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u4[i].x = (__m128){32+i, 0, i, 0};
+ (&fregs.xmm0)[i]._m128[0] = u4[i].x;
+ }
+ num_fregs = 8;
+ clear_float_hardware_registers;
+ check_union_passing4(u4[0], u4[1], u4[2], u4[3],
+ u4[4], u4[5], u4[6], u4[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u4a[i].x = (__m128){32+i, 0, i, 0};
+ (&fregs.xmm0)[i]._m128[0] = u4[i].x;
+ }
+ num_fregs = 8;
+ clear_float_hardware_registers;
+ check_union_passing4a(u4a[0], u4a[1], u4a[2], u4a[3],
+ u4a[4], u4a[5], u4a[6], u4a[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u4b[i].x = (__m128h){33+i, 0, i, 0, -i, 1, 2 * i, i + 8};
+ (&fregs.xmm0)[i]._m128h[0] = u4b[i].x;
+ }
+ num_fregs = 8;
+ clear_float_hardware_registers;
+ check_union_passing4b(u4b[0], u4b[1], u4b[2], u4b[3],
+ u4b[4], u4b[5], u4b[6], u4b[7]);
+
+ clear_struct_registers;
+ fregs.xmm0._m128[0] = u5.x;
+ num_fregs = 1;
+ num_iregs = 1;
+ iregs.I0 = u5.i;
+ clear_float_hardware_registers;
+ check_union_passing5(u5);
+#endif
+
+ u6.i = 2;
+ check_union_passing6(u6);
+
+ u7.f = 2.0f16;
+ check_union_passing7(u7);
+
+ clear_struct_registers;
+ u8.i = 8;
+ num_iregs = 1;
+ iregs.I0 = u8.i;
+ clear_int_hardware_registers;
+ check_union_passing8(u8);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_struct_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_struct_returning.c
new file mode 100644
index 0000000..5de18ee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_struct_returning.c
@@ -0,0 +1,274 @@
+/* This tests returning of structures. */
+
+#include <stdio.h>
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+int current_test;
+int num_failed = 0;
+
+#undef assert
+#define assert(test) do { if (!(test)) {fprintf (stderr, "failed in test %d\n", current_test); num_failed++; } } while (0)
+
+#define xmm0h xmm_regs[0].__Float16
+#define xmm1h xmm_regs[1].__Float16
+#define xmm0f xmm_regs[0]._float
+#define xmm0d xmm_regs[0]._double
+#define xmm1f xmm_regs[1]._float
+#define xmm1d xmm_regs[1]._double
+
+typedef enum {
+ INT = 0,
+ SSE_H,
+ SSE_F,
+ SSE_D,
+ X87,
+ MEM,
+ INT_SSE,
+ SSE_INT,
+ SSE_F_V,
+ SSE_F_H,
+ SSE_F_H8
+} Type;
+
+/* Structures which should be returned in INTEGER. */
+#define D(I,MEMBERS,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = INT; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(1,char m1, s.m1=42)
+D(2,short m1, s.m1=42)
+D(3,int m1, s.m1=42)
+D(4,long m1, s.m1=42)
+D(5,long long m1, s.m1=42)
+D(6,char m1;short s, s.m1=42)
+D(7,char m1;int i, s.m1=42)
+D(8,char m1; long l, s.m1=42)
+D(9,char m1; long long l, s.m1=42)
+D(10,char m1[16], s.m1[0]=42)
+D(11,short m1[8], s.m1[0]=42)
+D(12,int m1[4], s.m1[0]=42)
+D(13,long m1[2], s.m1[0]=42)
+D(14,long long m1[2], s.m1[0]=42)
+
+#undef D
+
+/* Structures which should be returned in SSE. */
+#define D(I,MEMBERS,C,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = C; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(100,float f,SSE_F, s.f=42)
+D(101,double d,SSE_D, s.d=42)
+D(102,float f;float f2,SSE_F, s.f=42)
+D(103,float f;double d,SSE_F, s.f=42)
+D(104,double d; float f,SSE_D, s.d=42)
+D(105,double d; double d2,SSE_D, s.d=42)
+D(106,float f[2],SSE_F, s.f[0]=42)
+D(107,float f[3],SSE_F, s.f[0]=42)
+D(108,float f[4],SSE_F, s.f[0]=42)
+D(109,double d[2],SSE_D, s.d[0]=42)
+D(110,float f[2]; double d,SSE_F, s.f[0]=42)
+D(111,double d;float f[2],SSE_D, s.d=42)
+
+D(120,_Float16 f,SSE_H, s.f=42)
+D(121,_Float16 f;_Float16 f2,SSE_H, s.f=42)
+D(122,_Float16 f;float d,SSE_H, s.f=42)
+D(123,_Float16 f;double d,SSE_H, s.f=42)
+D(124,double d; _Float16 f,SSE_D, s.d=42)
+D(125,_Float16 f[2],SSE_H, s.f[0]=42)
+D(126,_Float16 f[3],SSE_H, s.f[0]=42)
+D(127,_Float16 f[4],SSE_H, s.f[0]=42)
+D(128,_Float16 f[2]; double d,SSE_H, s.f[0]=42)
+D(129,double d;_Float16 f[2],SSE_D, s.d=42)
+
+#undef D
+
+/* Structures which should be returned on x87 stack. */
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = X87; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s = { 42 }; return s; }
+
+/* The only struct containing a long double, which is returned in
+ registers at all, is the singleton struct. All others are too large.
+ This includes a struct containing complex long double, which is passed
+ in memory, although a complex long double type itself is returned in
+ two registers. */
+D(200,long double ld)
+
+#undef D
+
+/* Structures which should be returned in INT (low) and SSE (high). */
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = INT_SSE; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s = { 42,43 }; return s; }
+
+D(300,char m1; float m2)
+D(301,char m1; double m2)
+D(302,short m1; float m2)
+D(303,short m1; double m2)
+D(304,int m1; float m2)
+D(305,int m1; double m2)
+D(306,long long m1; float m2)
+D(307,long long m1; double m2)
+
+D(310,char m1; _Float16 m2)
+D(311,short m1; _Float16 m2)
+D(312,int m1; _Float16 m2)
+D(313,long long m1; _Float16 m2)
+
+#undef D
+
+void check_300 (void)
+{
+ XMM_T x;
+ x._ulonglong[0] = rax;
+ switch (current_test) {
+ case 300: assert ((rax & 0xff) == 42 && x._float[1] == 43); break;
+ case 301: assert ((rax & 0xff) == 42 && xmm0d[0] == 43); break;
+ case 302: assert ((rax & 0xffff) == 42 && x._float[1] == 43); break;
+ case 303: assert ((rax & 0xffff) == 42 && xmm0d[0] == 43); break;
+ case 304: assert ((rax & 0xffffffff) == 42 && x._float[1] == 43); break;
+ case 305: assert ((rax & 0xffffffff) == 42 && xmm0d[0] == 43); break;
+ case 306: assert (rax == 42 && xmm0f[0] == 43); break;
+ case 307: assert (rax == 42 && xmm0d[0] == 43); break;
+ case 310: assert ((rax & 0xff) == 42 && x.__Float16[1] == 43); break;
+ case 311: assert ((rax & 0xffff) == 42 && x.__Float16[1] == 43); break;
+ case 312: assert ((rax & 0xffffffff) == 42 && x.__Float16[2] == 43); break;
+ case 313: assert (rax == 42 && xmm0h[0] == 43); break;
+
+ default: assert (0); break;
+ }
+}
+
+/* Structures which should be returned in SSE (low) and INT (high). */
+#define D(I,MEMBERS,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = SSE_INT; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(400,float f[2];char c, s.f[0]=42; s.c=43)
+D(401,double d;char c, s.d=42; s.c=43)
+
+D(402,_Float16 f[4];char c, s.f[0]=42; s.c=43)
+
+#undef D
+
+void check_400 (void)
+{
+ switch (current_test) {
+ case 400: assert (xmm0f[0] == 42 && (rax & 0xff) == 43); break;
+ case 401: assert (xmm0d[0] == 42 && (rax & 0xff) == 43); break;
+ case 402: assert (xmm0h[0] == 42 && (rax & 0xff) == 43); break;
+
+ default: assert (0); break;
+ }
+}
+
+/* Structures which should be returned in MEM. */
+void *struct_addr;
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = MEM; \
+struct S_ ## I f_ ## I (void) { union {unsigned char c; struct S_ ## I s;} u; memset (&u.s, 0, sizeof(u.s)); u.c = 42; return u.s; }
+
+/* Too large. */
+D(500,char m1[17])
+D(501,short m1[9])
+D(502,int m1[5])
+D(503,long m1[3])
+D(504,short m1[8];char c)
+D(505,char m1[1];int i[4])
+D(506,float m1[5])
+D(507,double m1[3])
+D(508,char m1[1];float f[4])
+D(509,char m1[1];double d[2])
+D(510,__complex long double m1[1])
+
+/* Too large due to padding. */
+D(520,char m1[1];int i;char c2; int i2; char c3)
+
+/* Unnaturally aligned members. */
+D(530,short m1[1];int i PACKED)
+
+D(540,_Float16 m1[10])
+D(541,char m1[1];_Float16 f[8])
+
+#undef D
+
+
+/* Special tests. */
+#define D(I,MEMBERS,C,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = C; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; B; return s; }
+D(600,float f[4], SSE_F_V, s.f[0] = s.f[1] = s.f[2] = s.f[3] = 42)
+D(601,_Float16 f[4], SSE_F_H, s.f[0] = s.f[1] = s.f[2] = s.f[3] = 42)
+D(602,_Float16 f[8], SSE_F_H8,
+ s.f[0] = s.f[1] = s.f[2] = s.f[3] = s.f[4] = s.f[5] = s.f[6] = s.f[7] = 42)
+#undef D
+
+void clear_all (void)
+{
+ clear_int_registers;
+ clear_float_registers;
+ clear_x87_registers;
+}
+
+void check_all (Type class, unsigned long size)
+{
+ switch (class) {
+ case INT: if (size < 8) rax &= ~0UL >> (64-8*size); assert (rax == 42); break;
+ case SSE_H: assert (xmm0h[0] == 42); break;
+ case SSE_F: assert (xmm0f[0] == 42); break;
+ case SSE_D: assert (xmm0d[0] == 42); break;
+ case SSE_F_V: assert (xmm0f[0] == 42 && xmm0f[1]==42 && xmm1f[0] == 42 && xmm1f[1] == 42); break;
+ case SSE_F_H: assert (xmm0h[0] == 42 && xmm0h[1]==42 && xmm0h[2] == 42 && xmm0h[3] == 42); break;
+ case SSE_F_H8: assert (xmm0h[0] == 42 && xmm0h[1]==42 && xmm0h[2] == 42 && xmm0h[3] == 42
+ && xmm1h[0] == 42 && xmm1h[1]==42 && xmm1h[2] == 42 && xmm1h[3] == 42); break;
+ case X87: assert (x87_regs[0]._ldouble == 42); break;
+ case INT_SSE: check_300(); break;
+ case SSE_INT: check_400(); break;
+ /* Ideally we would like to check that rax == struct_addr.
+ Unfortunately the address of the target struct escapes (for setting
+ struct_addr), so the return struct is a temporary one whose address
+ is given to the f_* functions, otherwise a conforming program
+ could notice the struct changing already before the function returns.
+ This temporary struct could be anywhere. For GCC it will be on
+ stack, but no one is forbidding that it could be a static variable
+ if there's no threading or proper locking. Nobody in his right mind
+ will not use the stack for that. */
+ case MEM: assert (*(unsigned char*)struct_addr == 42 && rdi == rax); break;
+ }
+}
+
+#define D(I) { struct S_ ## I s; current_test = I; struct_addr = (void*)&s; \
+ clear_all(); \
+ s = WRAP_RET(f_ ## I) (); \
+ check_all(class_ ## I, sizeof(s)); \
+}
+
+static void
+do_test (void)
+{
+ D(1) D(2) D(3) D(4) D(5) D(6) D(7) D(8) D(9) D(10) D(11) D(12) D(13) D(14)
+
+ D(100) D(101) D(102) D(103) D(104) D(105) D(106) D(107) D(108) D(109) D(110)
+ D(111)
+
+ D(120) D(121) D(122) D(123) D(124) D(125) D(126) D(127) D(128) D(129)
+
+ D(200)
+
+ D(300) D(301) D(302) D(303) D(304) D(305) D(306) D(307)
+ D(310) D(311) D(312) D(313)
+
+ D(400) D(401) D(402)
+
+ D(500) D(501) D(502) D(503) D(504) D(505) D(506) D(507) D(508) D(509)
+ D(520)
+ D(530)
+
+ D(540) D(541)
+
+ D(600) D(601) D(602)
+ if (num_failed)
+ abort ();
+}
+#undef D
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_varargs-m128.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_varargs-m128.c
new file mode 100644
index 0000000..5bdc44d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/test_varargs-m128.c
@@ -0,0 +1,164 @@
+/* Test variable number of 128-bit vector arguments passed to functions. */
+
+#include <stdio.h>
+#include "avx512fp16-xmm-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ XMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m128_varargs (__m128 i0, __m128 i1, __m128 i2,
+ __m128 i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m128 *argp;
+
+ compare (values.i0, i0, __m128);
+ compare (values.i1, i1, __m128);
+ compare (values.i2, i2, __m128);
+ compare (values.i3, i3, __m128);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m128 *) (((char *) fp) + 8);
+
+ /* Check __m128 arguments passed on stack. */
+ compare (values.i8, argp[0], __m128);
+ compare (values.i9, argp[1], __m128);
+
+ /* Check register contents. */
+ compare (fregs.xmm0, xmm_regs[0], __m128);
+ compare (fregs.xmm1, xmm_regs[1], __m128);
+ compare (fregs.xmm2, xmm_regs[2], __m128);
+ compare (fregs.xmm3, xmm_regs[3], __m128);
+ compare (fregs.xmm4, xmm_regs[4], __m128);
+ compare (fregs.xmm5, xmm_regs[5], __m128);
+ compare (fregs.xmm6, xmm_regs[6], __m128);
+ compare (fregs.xmm7, xmm_regs[7], __m128);
+}
+
+void
+fun_check_passing_m128h_varargs (__m128h i0, __m128h i1, __m128h i2,
+ __m128h i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m128h *argp;
+
+ compare (values.i0, i0, __m128h);
+ compare (values.i1, i1, __m128h);
+ compare (values.i2, i2, __m128h);
+ compare (values.i3, i3, __m128h);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m128h *) (((char *) fp) + 8);
+
+ /* Check __m128h arguments passed on stack. */
+ compare (values.i8, argp[0], __m128h);
+ compare (values.i9, argp[1], __m128h);
+
+ /* Check register contents. */
+ compare (fregs.xmm0, xmm_regs[0], __m128h);
+ compare (fregs.xmm1, xmm_regs[1], __m128h);
+ compare (fregs.xmm2, xmm_regs[2], __m128h);
+ compare (fregs.xmm3, xmm_regs[3], __m128h);
+ compare (fregs.xmm4, xmm_regs[4], __m128h);
+ compare (fregs.xmm5, xmm_regs[5], __m128h);
+ compare (fregs.xmm6, xmm_regs[6], __m128h);
+ compare (fregs.xmm7, xmm_regs[7], __m128h);
+}
+
+#define def_check_int_passing_varargs(_i0, _i1, _i2, _i3, _i4, _i5, \
+ _i6, _i7, _i8, _i9, \
+ _func, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ WRAP_CALL(_func) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9);
+
+void
+test_m128_varargs (void)
+{
+ __m128 x[10];
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m128){32+i, 0, 0, 0};
+ pass = "m128-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m128_varargs,
+ _m128);
+}
+
+void
+test_m128h_varargs (void)
+{
+ __m128h x[10];
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m128h) {
+ 1.1f16 + i, 2.2f16 + i, 3.3f16 + i, 4.4f16 + i,
+ 5.5f16 + i, 6.6f16 + i, 7.7f16 + i, 8.8f16 + i
+ };
+ pass = "m128h-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m128h_varargs,
+ _m128h);
+}
+
+static void
+do_test (void)
+{
+ test_m128_varargs ();
+ test_m128h_varargs ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gdc.dg/attr_allocsize1.d b/gcc/testsuite/gdc.dg/attr_allocsize1.d
new file mode 100644
index 0000000..9efba19
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_allocsize1.d
@@ -0,0 +1,44 @@
+// { dg-do compile }
+
+import gcc.attributes;
+
+@alloc_size(1)
+int ignoredfunc(int size); // { dg-warning ".alloc_size. attribute ignored on a function returning .int." }
+
+@alloc_size(0) int var; // { dg-warning ".alloc_size. attribute only applies to function types" }
+
+@attribute("alloc_size", "1")
+void* invalid1(int size); // { dg-warning ".alloc_size. attribute argument is invalid" }
+
+@attribute("alloc_size", 1, "2")
+void* invalid2(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 is invalid" }
+
+@attribute("alloc_size", 0.1)
+void* wrongtype1(int size); // { dg-warning ".alloc_size. attribute argument has type .double." }
+
+@attribute("alloc_size", 1, 0.2)
+void* wrongtype2(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 has type .double." }
+
+@alloc_size(0)
+void* malloc0(int size); // { dg-warning ".alloc_size. attribute argument value .0. does not refer to a function parameter" }
+
+@alloc_size(1, 0)
+void* malloc0(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 value .0. does not refer to a function parameter" }
+
+@alloc_size(1, 0, true)
+void* malloc0pos(int count, int size);
+
+@alloc_size(1, -1, true)
+void* mallocminus1(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 value .-1. does not refer to a function parameter" }
+
+@alloc_size(99)
+void* malloc99(int size); // { dg-warning ".alloc_size. attribute argument value .99. exceeds the number of function parameters 1" }
+
+@alloc_size(1, 99)
+void* malloc99(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 value .99. exceeds the number of function parameters 2" }
+
+@alloc_size(1)
+void* mallocdouble(double size); // { dg-warning ".alloc_size. attribute argument value .1. refers to parameter type .double." }
+
+@alloc_size(2, 1)
+void* mallocdouble(int count, double size); // { dg-warning ".alloc_size. attribute argument 1 value .2. refers to parameter type .double." }
diff --git a/gcc/testsuite/gdc.dg/attr_allocsize2.d b/gcc/testsuite/gdc.dg/attr_allocsize2.d
new file mode 100644
index 0000000..a10dbbe
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_allocsize2.d
@@ -0,0 +1,13 @@
+// { dg-do compile }
+
+import gcc.attributes;
+
+void* my_calloc(size_t num, size_t size) @allocSize(1, 0)
+{
+ return null;
+}
+
+void* my_malloc(int a, int b, size_t size, int c) @allocSize(2)
+{
+ return null;
+}
diff --git a/gcc/testsuite/gdc.dg/attr_alwaysinline1.d b/gcc/testsuite/gdc.dg/attr_alwaysinline1.d
new file mode 100644
index 0000000..8fbe25c
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_alwaysinline1.d
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-O0" }
+
+import gcc.attributes;
+
+int func()
+{
+ int nested_function() @always_inline
+ {
+ return 13;
+ }
+ return nested_function();
+}
+
+@always_inline int var = 0; // { dg-warning ".always_inline. attribute ignored" }
+
+// { dg-final { scan-assembler-not "nested_function" } }
diff --git a/gcc/testsuite/gdc.dg/attr_cold1.d b/gcc/testsuite/gdc.dg/attr_cold1.d
new file mode 100644
index 0000000..bf44d7b
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_cold1.d
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-optimized" }
+
+import gcc.attributes;
+
+int func() @cold
+{
+ return 0;
+}
+
+@cold int var = 0; // { dg-warning ".cold. attribute ignored" }
+
+// { dg-final { scan-tree-dump "func\[^\r\n\]*(unlikely executed)" "optimized" } }
diff --git a/gcc/testsuite/gdc.dg/attr_exclusions1.d b/gcc/testsuite/gdc.dg/attr_exclusions1.d
new file mode 100644
index 0000000..90d4e5d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_exclusions1.d
@@ -0,0 +1,19 @@
+// { dg-do compile }
+
+import gcc.attributes;
+
+// always_inline
+
+@noinline
+@always_inline
+void i0(); // { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." }
+
+@target_clones("")
+@always_inline
+void i1(); // { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .target_clones." }
+
+// noinline
+
+@always_inline
+@noinline
+void n0(); // { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." }
diff --git a/gcc/testsuite/gdc.dg/attr_exclusions2.d b/gcc/testsuite/gdc.dg/attr_exclusions2.d
new file mode 100644
index 0000000..791e9af
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_exclusions2.d
@@ -0,0 +1,19 @@
+// { dg-do compile { target x86_64-*-* } }
+
+import gcc.attributes;
+
+// target
+
+@target_clones("default")
+@target("default")
+void tc0(); // { dg-warning "ignoring attribute .target. because it conflicts with attribute .target_clones." }
+
+// target_clones
+
+@target("default")
+@target_clones("default")
+void t0(); // { dg-warning "ignoring attribute .target_clones. because it conflicts with attribute .target." }
+
+@always_inline
+@target_clones("default")
+void tc1(); // { dg-warning "ignoring attribute .target_clones. because it conflicts with attribute .always_inline." }
diff --git a/gcc/testsuite/gdc.dg/attr_flatten1.d b/gcc/testsuite/gdc.dg/attr_flatten1.d
new file mode 100644
index 0000000..47bcc38
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_flatten1.d
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-O1" }
+
+import gcc.attributes;
+
+int func() @flatten
+{
+ __gshared int count = 0;
+ int nested_function()
+ {
+ return count++;
+ }
+ static foreach (_; 0 .. 1000)
+ nested_function();
+
+ return nested_function();
+}
+
+@flatten int var = 0; // { dg-warning ".flatten. attribute ignored" }
+
+// { dg-final { scan-assembler-not "nested_function" } }
diff --git a/gcc/testsuite/gdc.dg/attr_module.d b/gcc/testsuite/gdc.dg/attr_module.d
new file mode 100644
index 0000000..e7a9341
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_module.d
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// { dg-additional-sources "imports/attributes.d" }
+
+import gcc.attributes;
+
+@value_ignored
+int f0()
+{
+ return 0;
+}
+
+@type_symbol // { dg-warning ".type_symbol. attribute has no effect" }
+int f1()
+{
+ return 1;
+}
+
+@template_symbol // { dg-warning ".template_symbol. attribute has no effect" }
+int f2()
+{
+ return 2;
+}
+
+@struct_wrong_field(123) // { dg-warning "unknown attribute .123." }
+int f3()
+{
+ return 3;
+}
+
+@struct_void_init()
+int f4()
+{
+ return 4;
+}
+
+@unknown_attribute() // { dg-warning "unknown attribute .made up name." }
+int f5()
+{
+ return 5;
+}
diff --git a/gcc/testsuite/gdc.dg/attr_noclone1.d b/gcc/testsuite/gdc.dg/attr_noclone1.d
new file mode 100644
index 0000000..0289135
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_noclone1.d
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+import gcc.attributes;
+
+@target_clones("avx", "default")
+@noclone
+void func() // { dg-error "clones for .target_clones. attribute cannot be created" }
+{ // { dg-message "function .func. can never be copied because it has .noclone. attribute" "" { target *-*-* } .-1 }
+}
+
+@noclone int var = 0; // { dg-warning ".noclone. attribute ignored" }
diff --git a/gcc/testsuite/gdc.dg/attr_noicf1.d b/gcc/testsuite/gdc.dg/attr_noicf1.d
new file mode 100644
index 0000000..71a9aa1
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_noicf1.d
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-inline" }
+
+import gcc.attributes;
+
+extern int t();
+
+int func()
+{
+ __gshared int var = 42;
+ int nested_1() @no_icf
+ {
+ return var++;
+ }
+ int nested_2()
+ {
+ return var++;
+ }
+ int nested_3()
+ {
+ return var++;
+ }
+ return nested_1() + nested_2() + nested_3();
+}
+
+@no_icf int var = 0; // { dg-warning ".no_icf. attribute ignored" }
+
+// { dg-final { scan-assembler "nested_1" } }
+// { dg-final { scan-assembler "nested_2" } }
+// { dg-final { scan-assembler-not "nested_3" } }
diff --git a/gcc/testsuite/gdc.dg/attr_noinline1.d b/gcc/testsuite/gdc.dg/attr_noinline1.d
new file mode 100644
index 0000000..51fffe5
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_noinline1.d
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-O2 -finline-functions -fno-ipa-icf" }
+
+import gcc.attributes;
+
+extern int t();
+
+void func()
+{
+ void nested_function() @noinline
+ {
+ t();
+ }
+ nested_function();
+}
+
+@noinline int var = 0; // { dg-warning ".noinline. attribute ignored" }
+
+// { dg-final { scan-assembler "nested_function" } }
diff --git a/gcc/testsuite/gdc.dg/attr_noipa1.d b/gcc/testsuite/gdc.dg/attr_noipa1.d
new file mode 100644
index 0000000..a1f58dc
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_noipa1.d
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-O2 -finline-functions" }
+
+import gcc.attributes;
+
+int func(int x)
+{
+ int nested_function(int y, int z) @noipa
+ {
+ return y + z;
+ }
+ return nested_function(x, 0);
+}
+
+@noipa int var = 0; // { dg-warning ".noipa. attribute ignored" }
+
+// { dg-final { scan-assembler "nested_function" } }
diff --git a/gcc/testsuite/gdc.dg/attr_noplt1.d b/gcc/testsuite/gdc.dg/attr_noplt1.d
new file mode 100644
index 0000000..73a2fb5
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_noplt1.d
@@ -0,0 +1,13 @@
+// { dg-do compile { target x86_64-*-linux* } }
+// { dg-options "-O2 -fno-pic" }
+
+import gcc.attributes;
+
+@noplt int func();
+
+@noplt int var = 0; // { dg-warning ".noplt. attribute ignored" }
+
+int main()
+{
+ return func();
+}
diff --git a/gcc/testsuite/gdc.dg/attr_optimize1.d b/gcc/testsuite/gdc.dg/attr_optimize1.d
new file mode 100644
index 0000000..043202a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_optimize1.d
@@ -0,0 +1,48 @@
+// { dg-do compile }
+
+import gcc.attributes;
+
+int func()
+{
+ int return_zero() @optimize(0)
+ {
+ return 0;
+ }
+
+ int return_one() @optimize("0")
+ {
+ return 1;
+ }
+
+ int return_two() @optimize("s")
+ {
+ return 2;
+ }
+
+ int return_three() @optimize("O3")
+ {
+ return 3;
+ }
+
+ int return_four() @optimize("fast-math")
+ {
+ return 4;
+ }
+
+ return return_one + return_two + return_three + return_four;
+}
+
+@optimize(3)
+int var = 0; // { dg-warning ".optimize. attribute ignored" }
+
+@optimize("-f_")
+int bad_option() // { dg-warning "bad option .-f_. to attribute .optimize." }
+{
+ return 0;
+}
+
+@optimize("-z")
+int bad_option2() // { dg-warning "bad option .-z. to attribute .optimize." }
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gdc.dg/attr_optimize2.d b/gcc/testsuite/gdc.dg/attr_optimize2.d
new file mode 100644
index 0000000..13bc1d7
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_optimize2.d
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+import gcc.attributes;
+
+@optimize(-1)
+int non_negative() // { dg-error "argument to .-O. should be a non-negative integer" }
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gdc.dg/attr_optimize3.d b/gcc/testsuite/gdc.dg/attr_optimize3.d
new file mode 100644
index 0000000..2a9ad12
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_optimize3.d
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-O0 -fdump-tree-optimized-raw" }
+
+import gcc.attributes;
+
+double notfast(double x)
+{
+ return x * x * x * x * x * x * x * x;
+}
+
+// { dg-final { scan-tree-dump-times "mult_expr, _" 7 "optimized" } }
+
+@fastmath
+static double fast(double x)
+{
+ return x * x * x * x * x * x * x * x;
+}
+
+// { dg-final { scan-tree-dump-times "mult_expr, powmult_" 3 "optimized" } }
diff --git a/gcc/testsuite/gdc.dg/attr_optimize4.d b/gcc/testsuite/gdc.dg/attr_optimize4.d
new file mode 100644
index 0000000..54d793e
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_optimize4.d
@@ -0,0 +1,45 @@
+// { dg-do compile }
+// { dg-options "-O3 -fdump-tree-optimized-raw" }
+
+import gcc.attributes;
+
+int glob1;
+int easily_inlinable(int i) { glob1 = i; return 2; }
+
+@optStrategy("none")
+int call_easily_inlinable(int i)
+{
+ return easily_inlinable(i);
+}
+
+// { dg-final { scan-tree-dump "gimple_call <easily_inlinable" "optimized" } }
+
+pragma(inline, true) int always_inline() { return 321; }
+
+@optStrategy("none")
+int call_always_inline()
+{
+ return always_inline();
+}
+
+// { dg-final { scan-tree-dump "gimple_call <always_inline" "optimized" } }
+
+int glob2;
+@optStrategy("none") void optnone_function(int i) { glob2 = i; }
+
+void call_optnone()
+{
+ optnone_function(1);
+}
+
+// { dg-final { scan-tree-dump "gimple_call <optnone_function" "optimized" } }
+
+@optStrategy("optsize")
+void optsize_fn()
+{
+}
+
+@optStrategy("minsize")
+void minsize_fn()
+{
+}
diff --git a/gcc/testsuite/gdc.dg/attr_restrict1.d b/gcc/testsuite/gdc.dg/attr_restrict1.d
new file mode 100644
index 0000000..26839c3
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_restrict1.d
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-fdump-tree-optimized" }
+
+import gcc.attributes;
+
+int func(@restrict int ignored) // { dg-warning ".restrict. attribute ignored" }
+{
+ return 0;
+}
+
+int func(@restrict int *parm)
+{
+ return 0;
+}
+
+@restrict int var = 0; // { dg-warning ".restrict. attribute ignored" }
+
+// { dg-final { scan-tree-dump "restrict parm" "optimized" } }
diff --git a/gcc/testsuite/gdc.dg/attr_section1.d b/gcc/testsuite/gdc.dg/attr_section1.d
new file mode 100644
index 0000000..c24634f
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_section1.d
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-require-named-sections "" }
+
+import gcc.attributes;
+
+@section("types")
+struct S {} // { dg-warning ".section. attribute does not apply to types" }
+
+@attribute("section", 123)
+int f1(); // { dg-error "section attribute argument not a string constant" }
+
+int f2(@section("param") int a) // { dg-error "section attribute not allowed for .a." }
+{
+ @section("local") int v; // { dg-error "section attribute cannot be specified for local variables" }
+ return a;
+}
+
+@section("c1") void conflict();
+@section("c2") void conflict(); // { dg-error "section of .conflict. conflicts with previous declaration" }
+
+@section("c3")
+@section("c4")
+void conflict2(); // { dg-error "section of .conflict2. conflicts with previous declaration" }
diff --git a/gcc/testsuite/gdc.dg/attr_symver1.d b/gcc/testsuite/gdc.dg/attr_symver1.d
new file mode 100644
index 0000000..8a680cb
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_symver1.d
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-skip-if "only works for ELF targets" { *-*-darwin* *-*-aix* } }
+
+import gcc.attributes;
+
+@symver("type")
+struct S {} // { dg-warning ".symver. attribute does not apply to types" }
+
+@attribute("symver", 123)
+int f1(); // { dg-error ".symver. attribute argument not a string constant" }
+
+@symver("format")
+int f2() // { dg-error "symver attribute argument must have format .name@nodename'" }
+{ // { dg-error ".symver. attribute argument .format. must contain one or two .@." "" { target *-*-* } .-1 }
+ return 0;
+}
+
+int f3(@symver("param@VER_1") int param) // { dg-warning ".symver. attribute only applies to functions and variables" }
+{
+ return param;
+}
+
+@symver("extern@VER_2")
+extern int f4(); // { dg-error "symbol needs to be defined to have a version" }
diff --git a/gcc/testsuite/gdc.dg/attr_target1.d b/gcc/testsuite/gdc.dg/attr_target1.d
new file mode 100644
index 0000000..4cf89f3
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_target1.d
@@ -0,0 +1,20 @@
+// { dg-do compile { target i?86*-*-* x86_64-*-* } }
+
+import gcc.attributes;
+
+@target("default")
+int foo() { return 1; }
+
+@target("arch=core2", "")
+int foo2() { return 2; } // { dg-warning "empty string in attribute .target." }
+
+@target("sse4.2", "", "")
+int foo3() { return 3; } // { dg-warning "empty string in attribute .target." }
+
+@target("default")
+int var = 0; // { dg-warning ".target. attribute ignored" }
+
+int main()
+{
+ return foo() + foo2() + foo3();
+}
diff --git a/gcc/testsuite/gdc.dg/attr_targetclones1.d b/gcc/testsuite/gdc.dg/attr_targetclones1.d
new file mode 100644
index 0000000..287782c
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_targetclones1.d
@@ -0,0 +1,12 @@
+// { dg-do compile { target i?86*-*-* x86_64-*-* } }
+
+import gcc.attributes;
+
+@target_clones("default")
+int func() // { dg-warning "single .target_clones. attribute is ignored" }
+{
+ return 0;
+}
+
+@target_clones("default")
+int var = 0; // { dg-warning ".target_clones. attribute ignored" }
diff --git a/gcc/testsuite/gdc.dg/attr_used1.d b/gcc/testsuite/gdc.dg/attr_used1.d
new file mode 100644
index 0000000..66f33fb
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_used1.d
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+import gcc.attributes;
+
+int func()
+{
+ int nested_function() @used
+ {
+ return 1;
+ }
+ @used int var = 0; // { dg-warning ".used. attribute ignored" }
+ return var;
+}
+
+// { dg-final { scan-assembler "nested_function" } }
diff --git a/gcc/testsuite/gdc.dg/attr_used2.d b/gcc/testsuite/gdc.dg/attr_used2.d
new file mode 100644
index 0000000..bac004d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_used2.d
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+import gcc.attributes;
+
+int func()
+{
+ int nested_function() @assumeUsed
+ {
+ return 1;
+ }
+ @assumeUsed int var = 0; // { dg-warning ".used. attribute ignored" }
+ return var;
+}
+
+// { dg-final { scan-assembler "nested_function" } }
diff --git a/gcc/testsuite/gdc.dg/attr_weak1.d b/gcc/testsuite/gdc.dg/attr_weak1.d
new file mode 100644
index 0000000..0b84454
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/attr_weak1.d
@@ -0,0 +1,14 @@
+// { dg-do compile }
+
+import gcc.attributes;
+
+pragma(inline, true)
+@weak int func() // { dg-warning "inline function .func. declared weak" }
+{
+ return 0;
+}
+
+int parm(@weak int a) // { dg-warning ".weak. attribute ignored" }
+{
+ return a;
+}
diff --git a/gcc/testsuite/brig.dg/dg.exp b/gcc/testsuite/gdc.dg/extern-c++/extern-c++.exp
index 6441092..d38f993 100644
--- a/gcc/testsuite/brig.dg/dg.exp
+++ b/gcc/testsuite/gdc.dg/extern-c++/extern-c++.exp
@@ -1,31 +1,39 @@
-# Copyright (C) 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# GCC testsuite that uses the `dg.exp' driver.
+# Load support procs.
+load_lib gdc-dg.exp
-load_lib brig-dg.exp
+# We are mixing D and C++ code, need to pull in libstdc++
+global GDC_INCLUDE_CXX_FLAGS
+set GDC_INCLUDE_CXX_FLAGS 1
# Initialize `dg'.
dg-init
-if [expr [llength [auto_execok HSAILasm]] > 0] {
- dg-runtest [find $srcdir/$subdir *.hsail] "" ""
-} else {
- unsupported "All BRIG FE tests require HSAILasm in PATH."
+# Main loop.
+if [check_no_compiler_messages extern_c++_tests assembly {
+ // C++
+ int main() { return 0; }
+}] {
+ gdc-dg-runtest [lsort \
+ [glob -nocomplain $srcdir/$subdir/*.d ] ] "" ""
}
+set GDC_INCLUDE_CXX_FLAGS 0
+
# All done.
dg-finish
diff --git a/gcc/testsuite/gdc.dg/extern-c++/pr101664.d b/gcc/testsuite/gdc.dg/extern-c++/pr101664.d
new file mode 100644
index 0000000..57b3d90
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/extern-c++/pr101664.d
@@ -0,0 +1,15 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101664
+// { dg-do run }
+// { dg-options "-O2" }
+// { dg-additional-sources "pr101664_1.cc" }
+
+extern(C++) struct S101664
+{
+ int i;
+ this(int);
+}
+
+void main()
+{
+ assert(S101664(1).i == 1);
+}
diff --git a/gcc/testsuite/gdc.dg/extern-c++/pr101664_1.cc b/gcc/testsuite/gdc.dg/extern-c++/pr101664_1.cc
new file mode 100644
index 0000000..066e784
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/extern-c++/pr101664_1.cc
@@ -0,0 +1,10 @@
+struct S101664
+{
+ int i;
+ S101664 (int n);
+};
+
+S101664::S101664 (int n)
+ : i(n)
+{
+}
diff --git a/gcc/testsuite/gdc.dg/gdc108.d b/gcc/testsuite/gdc.dg/gdc108.d
index dc214e4..8f9116b 100644
--- a/gcc/testsuite/gdc.dg/gdc108.d
+++ b/gcc/testsuite/gdc.dg/gdc108.d
@@ -1,9 +1,9 @@
// https://bugzilla.gdcproject.org/show_bug.cgi?id=108
// { dg-do compile }
-import gcc.attribute;
+import gcc.attributes;
-@attribute("forceinline")
+@attribute("always_inline")
void forceinline108()
{
}
diff --git a/gcc/testsuite/gdc.dg/gdc142.d b/gcc/testsuite/gdc.dg/gdc142.d
index 92cf505..7713d5e 100644
--- a/gcc/testsuite/gdc.dg/gdc142.d
+++ b/gcc/testsuite/gdc.dg/gdc142.d
@@ -1,7 +1,7 @@
// https://bugzilla.gdcproject.org/show_bug.cgi?id=142
// { dg-do compile }
-import gcc.attribute;
+import gcc.attributes;
@attribute("noinline")
int test142a()()
diff --git a/gcc/testsuite/gdc.dg/gdc270a.d b/gcc/testsuite/gdc.dg/gdc270a.d
deleted file mode 100644
index 4df6f02..0000000
--- a/gcc/testsuite/gdc.dg/gdc270a.d
+++ /dev/null
@@ -1,11 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=270
-// { dg-do compile }
-
-module gdc270;
-
-void foo()
-{
-}
-
-/* { dg-final { scan-assembler "_GLOBAL__D_6gdc270" } } */
-/* { dg-final { scan-assembler "_GLOBAL__I_6gdc270" } } */
diff --git a/gcc/testsuite/gdc.dg/gdc270b.d b/gcc/testsuite/gdc.dg/gdc270b.d
deleted file mode 100644
index 5a544c5..0000000
--- a/gcc/testsuite/gdc.dg/gdc270b.d
+++ /dev/null
@@ -1,7 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=270
-// { dg-do compile }
-
-module gdc270;
-
-/* { dg-final { scan-assembler "_GLOBAL__D_6gdc270" } } */
-/* { dg-final { scan-assembler "_GLOBAL__I_6gdc270" } } */
diff --git a/gcc/testsuite/gdc.dg/imports/attributes.d b/gcc/testsuite/gdc.dg/imports/attributes.d
new file mode 100644
index 0000000..1ed2094
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/imports/attributes.d
@@ -0,0 +1,28 @@
+// Pretend to be the GDC attributes module.
+module gcc.attributes;
+
+immutable value_ignored = 42;
+
+enum type_symbol { _ }
+
+auto template_symbol(A...)(A arguments)
+{
+ return arguments;
+}
+
+struct struct_wrong_field
+{
+ int bad_field;
+}
+
+struct struct_void_init
+{
+ string name_field = "noinline";
+ int void_field = void;
+ string ignored;
+}
+
+struct unknown_attribute
+{
+ string name_field = "made up name";
+}
diff --git a/gcc/testsuite/gdc.dg/lto/pr102094_0.d b/gcc/testsuite/gdc.dg/lto/pr102094_0.d
new file mode 100644
index 0000000..f83631a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/lto/pr102094_0.d
@@ -0,0 +1,18 @@
+// { dg-lto-do link }
+module pr102094_0;
+
+extern(C) int printf(char* s, ...);
+
+struct S102094
+{
+ int a;
+}
+
+void main()
+{
+ S102094 x;
+ void nested()
+ {
+ printf(cast(char*)0, x);
+ }
+}
diff --git a/gcc/testsuite/gdc.dg/pr100882a.d b/gcc/testsuite/gdc.dg/pr100882a.d
new file mode 100644
index 0000000..de92ab3
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr100882a.d
@@ -0,0 +1,35 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100882
+// { dg-do compile }
+
+struct AllocatorList(Factory)
+{
+ Factory factory;
+ auto make(size_t n) { return factory(n); }
+ this(Factory plant)
+ {
+ factory = plant;
+ }
+}
+
+struct Region
+{
+ ~this()
+ {
+ }
+}
+
+auto mmapRegionList()
+{
+ struct Factory
+ {
+ this(size_t )
+ {
+ }
+ auto opCall(size_t )
+ {
+ return Region();
+ }
+ }
+ auto shop = Factory();
+ AllocatorList!Factory(shop);
+}
diff --git a/gcc/testsuite/gdc.dg/pr100882b.d b/gcc/testsuite/gdc.dg/pr100882b.d
new file mode 100644
index 0000000..deaa4b4
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr100882b.d
@@ -0,0 +1,19 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100882
+// { dg-do compile }
+
+auto iota(int, int)
+{
+ struct Result
+ {
+ this(int)
+ {
+ }
+ }
+ return Result();
+}
+
+auto iota(int end)
+{
+ int begin;
+ return iota(begin, end);
+}
diff --git a/gcc/testsuite/gdc.dg/pr100882c.d b/gcc/testsuite/gdc.dg/pr100882c.d
new file mode 100644
index 0000000..f4e6e4d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr100882c.d
@@ -0,0 +1,25 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100882
+// { dg-do compile }
+
+struct CowArray
+{
+ this(this)
+ {
+ }
+}
+
+struct Tuple
+{
+ CowArray expand;
+}
+
+auto tuple(CowArray)
+{
+ return Tuple();
+}
+
+auto parseCharTerm()
+{
+ CowArray set;
+ return tuple(set);
+}
diff --git a/gcc/testsuite/gdc.dg/pr100967.d b/gcc/testsuite/gdc.dg/pr100967.d
new file mode 100644
index 0000000..bb83c29
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr100967.d
@@ -0,0 +1,11 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100967
+// { dg-do compile }
+
+module object;
+
+extern(C) int main()
+{
+ int[int] aa;
+ aa[0] = 1; // { dg-error ".object.TypeInfo. could not be found, but is implicitly used" }
+ return 0;
+}
diff --git a/gcc/testsuite/gdc.dg/pr101127a.d b/gcc/testsuite/gdc.dg/pr101127a.d
new file mode 100644
index 0000000..b56398e
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr101127a.d
@@ -0,0 +1,8 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
+// { dg-do compile { target i?86*-*-* x86_64-*-* } }
+// { dg-additional-options "-mavx" }
+
+import gcc.builtins;
+
+static assert(__traits(compiles, __builtin_ia32_andps256));
+static assert(__traits(compiles, __builtin_ia32_pmulhrsw128));
diff --git a/gcc/testsuite/gdc.dg/pr101127b.d b/gcc/testsuite/gdc.dg/pr101127b.d
new file mode 100644
index 0000000..b462d75
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr101127b.d
@@ -0,0 +1,7 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
+// { dg-do compile { target i?86*-*-* x86_64-*-* } }
+
+import gcc.builtins;
+
+static assert(!__traits(compiles, __builtin_ia32_andps256));
+static assert(!__traits(compiles, __builtin_ia32_pmulhrsw128));
diff --git a/gcc/testsuite/gdc.dg/pr101490.d b/gcc/testsuite/gdc.dg/pr101490.d
new file mode 100644
index 0000000..6929d40
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr101490.d
@@ -0,0 +1,21 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101490
+// { dg-do compile }
+
+struct S101490
+{
+ int[0] arr;
+}
+
+void main()
+{
+ S101490* t;
+ auto a = cast(typeof(t.arr)[0])t.arr;
+ write(a);
+}
+
+void write(S)(S args)
+{
+ foreach (arg; args)
+ {
+ }
+}
diff --git a/gcc/testsuite/gdc.dg/pr101640.d b/gcc/testsuite/gdc.dg/pr101640.d
new file mode 100644
index 0000000..68de408
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr101640.d
@@ -0,0 +1,11 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101640
+// { dg-do compile }
+// { dg-options "-fdump-tree-original" }
+
+int fun101640(ref int);
+
+int test101640(int val)
+{
+ // { dg-final { scan-tree-dump "= val \\\+ fun101640 \\\(\\\(int &\\\) &val\\\);" "original" } }
+ return val + fun101640(val);
+}
diff --git a/gcc/testsuite/gdc.dg/pr101657.d b/gcc/testsuite/gdc.dg/pr101657.d
new file mode 100644
index 0000000..0d77c36
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr101657.d
@@ -0,0 +1,14 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101657
+// { dg-do compile }
+// { dg-additional-options "-H" }
+
+void fun101657()
+{
+ fail; // { dg-error "undefined identifier 'fail'" }
+}
+
+// { dg-final { if ![file exists pr101657.di] \{ } }
+// { dg-final { pass "gdc.dg/pr101657.d (file exists pr101657.di)" } }
+// { dg-final { \} else \{ } }
+// { dg-final { fail "gdc.dg/pr101657.d (file exists pr101657.di)" } }
+// { dg-final { \} } }
diff --git a/gcc/testsuite/gdc.dg/pr101672.d b/gcc/testsuite/gdc.dg/pr101672.d
new file mode 100644
index 0000000..292fd76
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr101672.d
@@ -0,0 +1,19 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101672
+// { dg-do compile }
+
+module object;
+
+interface I101672
+{
+ static int i101672;
+}
+
+class A101672 : I101672 // { dg-error "class object.A101672 missing or corrupt object.d" }
+{
+ static int a101672;
+}
+
+class B101672 : A101672
+{
+ static int b101672;
+}
diff --git a/gcc/testsuite/gdc.dg/pr102185.d b/gcc/testsuite/gdc.dg/pr102185.d
new file mode 100644
index 0000000..39823a3
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr102185.d
@@ -0,0 +1,7 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102185
+// { dg-do compile }
+
+static assert(__traits(getTargetInfo, "floatAbi").length == 0 ||
+ __traits(getTargetInfo, "floatAbi") == "hard" ||
+ __traits(getTargetInfo, "floatAbi") == "soft" ||
+ __traits(getTargetInfo, "floatAbi") == "softfp");
diff --git a/gcc/testsuite/gdc.dg/pr90136a.d b/gcc/testsuite/gdc.dg/pr90136a.d
index e623b23..e576fff 100644
--- a/gcc/testsuite/gdc.dg/pr90136a.d
+++ b/gcc/testsuite/gdc.dg/pr90136a.d
@@ -3,9 +3,9 @@
// { dg-options "-fdump-tree-optimized" }
// { dg-final { scan-tree-dump-times "sum_array \\(array\\)" 0 "optimized"} }
-import gcc.attribute;
+import gcc.attributes;
-@attribute("forceinline") int sum_array(int[] input);
+@attribute("always_inline") int sum_array(int[] input);
int sum_array(int[] input)
{
diff --git a/gcc/testsuite/gdc.dg/pr90136b.d b/gcc/testsuite/gdc.dg/pr90136b.d
index f1f9b0a..8e8d9d5 100644
--- a/gcc/testsuite/gdc.dg/pr90136b.d
+++ b/gcc/testsuite/gdc.dg/pr90136b.d
@@ -3,7 +3,7 @@
// { dg-options "-fdump-tree-optimized" }
// { dg-final { scan-tree-dump-times "sum_array \\(array\\)" 1 "optimized"} }
-import gcc.attribute;
+import gcc.attributes;
@attribute("noinline") int sum_array(int[] input);
diff --git a/gcc/testsuite/gdc.dg/pr90136c.d b/gcc/testsuite/gdc.dg/pr90136c.d
index cf1c5de..534a734 100644
--- a/gcc/testsuite/gdc.dg/pr90136c.d
+++ b/gcc/testsuite/gdc.dg/pr90136c.d
@@ -2,8 +2,8 @@
// { dg-do compile }
// { dg-options "-Wattributes" }
-import gcc.attribute;
+import gcc.attributes;
-@attribute("forceinline") int sum_array(int[] input);
+@attribute("always_inline") int sum_array(int[] input);
@attribute("noinline") int sum_array(int[] input);
-// { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .forceinline." "" { target *-*-* } .-1 }
+// { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/gdc.dg/pr95173.d b/gcc/testsuite/gdc.dg/pr95173.d
index 2a4b2ed..1003783 100644
--- a/gcc/testsuite/gdc.dg/pr95173.d
+++ b/gcc/testsuite/gdc.dg/pr95173.d
@@ -2,7 +2,7 @@
// { dg-do compile }
// { dg-options "-Wattributes" }
-import gcc.attribute;
+import gcc.attributes;
@attribute("foo") // { dg-warning "unknown attribute .foo." }
void f95173()
diff --git a/gcc/testsuite/gdc.dg/pr96429.d b/gcc/testsuite/gdc.dg/pr96429.d
index af096e2..9940a03 100644
--- a/gcc/testsuite/gdc.dg/pr96429.d
+++ b/gcc/testsuite/gdc.dg/pr96429.d
@@ -3,7 +3,7 @@
// { dg-options "-fdump-tree-original" }
ptrdiff_t subbyte(byte* bp1, byte* bp2)
{
- // { dg-final { scan-tree-dump "bp1 - bp2;" "original" } }
+ // { dg-final { scan-tree-dump "\\\(bp1 - bp2\\\) /\\\[ex\\\] 1;" "original" } }
return bp1 - bp2;
}
diff --git a/gcc/testsuite/gdc.dg/pr98457.d b/gcc/testsuite/gdc.dg/pr98457.d
new file mode 100644
index 0000000..bc0d8af
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr98457.d
@@ -0,0 +1,9 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98457
+// { dg-do compile }
+
+void main()
+{
+ writef!"%s"; // { dg-error "template instance writef!\"%s\" template .writef. is not defined" }
+ writef!"`%s"; // { dg-error "template instance writef!\"`%s\" template .writef. is not defined" }
+ writef!"%%s`"; // { dg-error "template instance writef!\"%%s`\" template .writef. is not defined" }
+}
diff --git a/gcc/testsuite/gdc.dg/pr99914.d b/gcc/testsuite/gdc.dg/pr99914.d
new file mode 100644
index 0000000..689eae0
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr99914.d
@@ -0,0 +1,5 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99914
+// { dg-additional-options "-fmain" }
+// { dg-do link { target d_runtime } }
+
+extern(C) __gshared bool rt_cmdline_enabled = false;
diff --git a/gcc/testsuite/gdc.dg/torture/pr100882.d b/gcc/testsuite/gdc.dg/torture/pr100882.d
new file mode 100644
index 0000000..d94baff
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr100882.d
@@ -0,0 +1,21 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100882
+// { dg-additional-options "-fmain" }
+// { dg-do run }
+
+__gshared int counter = 0;
+struct S100882
+{
+ this(int) { counter++; }
+ ~this() { counter++; }
+}
+static S100882 s;
+static this()
+{
+ s = cast(shared) S100882(0);
+ assert(counter == 2);
+}
+
+auto test100882()
+{
+ return cast(shared) S100882(0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr101273.d b/gcc/testsuite/gdc.dg/torture/pr101273.d
new file mode 100644
index 0000000..e300e03
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr101273.d
@@ -0,0 +1,39 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101273
+// { dg-do run }
+
+struct S101273
+{
+ int x;
+ S101273* impl;
+ this(int x)
+ {
+ this.x = x;
+ this.impl = &this;
+ }
+ ~this() { }
+}
+
+S101273 makeS101273()
+{
+ return S101273(2);
+}
+
+S101273 nrvo101273()
+{
+ S101273 ret = makeS101273();
+ return ret;
+}
+
+S101273 rvo101273()
+{
+ return makeS101273();
+}
+
+void main()
+{
+ auto nrvo = nrvo101273();
+ assert(&nrvo is nrvo.impl);
+
+ auto rvo = rvo101273();
+ assert(&rvo is rvo.impl);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr101282.d b/gcc/testsuite/gdc.dg/torture/pr101282.d
new file mode 100644
index 0000000..b75d5fc
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr101282.d
@@ -0,0 +1,23 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101282
+// { dg-do run }
+
+void main()
+{
+ struct S101282
+ {
+ int impl;
+ S101282 opUnary(string op : "-")()
+ {
+ return S101282(-impl);
+ }
+ int opCmp(int i)
+ {
+ return (impl < i) ? -1 : (impl > i) ? 1 : 0;
+ }
+ }
+ auto a = S101282(120);
+ a = -a;
+ assert(a.impl == -120);
+ a = a >= 0 ? a : -a;
+ assert(a.impl == 120);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr96435.d b/gcc/testsuite/gdc.dg/torture/pr96435.d
new file mode 100644
index 0000000..c6d8785
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr96435.d
@@ -0,0 +1,21 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96435
+// { dg-do run }
+
+@safe bool test96435()
+{
+ int[2] array = [16, 678];
+ union U { int i; bool b; }
+ U u;
+ u.i = 0xDEADBEEF;
+ assert(array[u.b] == 678);
+ return u.b;
+}
+
+@safe void main()
+{
+ auto b = test96435();
+ if (b)
+ assert(true);
+ if (!b)
+ assert(false);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/aggr_alignment.d b/gcc/testsuite/gdc.test/compilable/aggr_alignment.d
index bf602ff..0c727e2 100644
--- a/gcc/testsuite/gdc.test/compilable/aggr_alignment.d
+++ b/gcc/testsuite/gdc.test/compilable/aggr_alignment.d
@@ -27,6 +27,26 @@ static assert(C2.int1.offsetof == payloadOffset + 8);
static assert(C2.alignof == size_t.sizeof);
static assert(__traits(classInstanceSize, C2) == payloadOffset + 12);
+align(8) struct PaddedStruct
+{
+ bool flag;
+ align(2) S1 s1;
+}
+
+static assert(PaddedStruct.s1.offsetof == 2);
+static assert(PaddedStruct.alignof == 8);
+static assert(PaddedStruct.sizeof == 16);
+
+align(1) struct UglyStruct
+{
+ bool flag;
+ int i;
+ ubyte u;
+}
+
+static assert(UglyStruct.i.offsetof == 4);
+static assert(UglyStruct.alignof == 1);
+static assert(UglyStruct.sizeof == 9);
/***************************************************/
// https://issues.dlang.org/show_bug.cgi?id=19914
diff --git a/gcc/testsuite/gdc.test/compilable/b19002.d b/gcc/testsuite/gdc.test/compilable/b19002.d
new file mode 100644
index 0000000..fd8e6d1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b19002.d
@@ -0,0 +1,12 @@
+module b19002;
+
+void printf(scope const char* format){}
+
+void main()
+{
+ printf(__FILE__);
+ printf(__FILE_FULL_PATH__);
+ printf(__FUNCTION__);
+ printf(__PRETTY_FUNCTION__);
+ printf(__MODULE__);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/betterCarray.d b/gcc/testsuite/gdc.test/compilable/betterCarray.d
index 74c80be..3f48b04 100644
--- a/gcc/testsuite/gdc.test/compilable/betterCarray.d
+++ b/gcc/testsuite/gdc.test/compilable/betterCarray.d
@@ -15,3 +15,13 @@ int foo(int[] a, int i)
{
return a[i];
}
+
+/**********************************************/
+// https://issues.dlang.org/show_bug.cgi?id=19234
+void issue19234()
+{
+ static struct A {}
+ A[10] a;
+ A[10] b;
+ b[] = a[];
+}
diff --git a/gcc/testsuite/gdc.test/compilable/bug20796.d b/gcc/testsuite/gdc.test/compilable/bug20796.d
new file mode 100644
index 0000000..00d00c8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/bug20796.d
@@ -0,0 +1,2 @@
+// EXTRA_SOURCES: protection/issue20796/package.d
+// https://issues.dlang.org/show_bug.cgi?id=20796
diff --git a/gcc/testsuite/gdc.test/compilable/cppmangle.d b/gcc/testsuite/gdc.test/compilable/cppmangle.d
index 7fcd41a..954a9be 100644
--- a/gcc/testsuite/gdc.test/compilable/cppmangle.d
+++ b/gcc/testsuite/gdc.test/compilable/cppmangle.d
@@ -372,3 +372,21 @@ version (Posix)
static assert(T.boo.mangleof == "_ZN1T3booE");
}
+/*****************************************/
+
+alias noreturn = typeof(*null);
+
+extern (C++)
+{
+ alias fpcpp = noreturn function();
+ int funccpp(fpcpp);
+
+ version (Posix)
+ static assert(funccpp.mangleof == "_Z7funccppPFvvE");
+
+ version (Win32)
+ static assert(funccpp.mangleof == "?funccpp@@YAHP6AXXZ@Z");
+
+ version (Win64)
+ static assert(funccpp.mangleof == "?funccpp@@YAHP6AXXZ@Z");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddocunittest.d b/gcc/testsuite/gdc.test/compilable/ddocunittest.d
index 940ef1c..8c691b6 100644
--- a/gcc/testsuite/gdc.test/compilable/ddocunittest.d
+++ b/gcc/testsuite/gdc.test/compilable/ddocunittest.d
@@ -357,6 +357,7 @@ auto redBlackTree(bool allowDuplicates, E)(E[] elems...)
}
/// ditto
auto redBlackTree(alias less, E)(E[] elems...)
+if (__traits(compiles, (E a, E b) => mixin(less)))
{
return 3;
}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/minimal/object.d b/gcc/testsuite/gdc.test/compilable/extra-files/minimal/object.d
new file mode 100644
index 0000000..c7060b0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/minimal/object.d
@@ -0,0 +1 @@
+module object;
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d
index 9ade317..62de518 100644
--- a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d
@@ -3,6 +3,12 @@ class Controller {
enum _s_pkg = __traits(parent, __traits(parent, __traits(parent, T))).stringof["package ".length .. $];
enum _s_model = T.stringof[0 .. $-`Controller`.length] ~ `Model`;
+
+ import serenity7190.core.Model;
+ // expands to "import example7190.models.HomeModel;"
+ mixin(q{import } ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{;});
+
+ // "enum _ = is(example7190.models.HomeModel.HomeModel : serenity7190.core.Model.Model);"
mixin(q{enum _ = is(} ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{.} ~ _s_model ~ q{ : serenity7190.core.Model.Model);});
}
-} \ No newline at end of file
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d b/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d
new file mode 100644
index 0000000..edb40954
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d
@@ -0,0 +1,12 @@
+module test20280a;
+
+struct Alpha(uint _)
+{
+ import test20280a;
+}
+
+struct Foxtrot(uint _)
+{
+ alias Attributes = Alpha!10;
+ enum A = 10;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/fix21585.d b/gcc/testsuite/gdc.test/compilable/fix21585.d
new file mode 100644
index 0000000..a83fb89
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/fix21585.d
@@ -0,0 +1,24 @@
+/* TEST_OUTPUT:
+---
+i int
+d double
+Pi int*
+---
+*/
+
+pragma(msg, 1.mangleof, " ", __traits(toType, 1.mangleof));
+pragma(msg, (1.0).mangleof, " ", __traits(toType, (1.0).mangleof));
+pragma(msg, (int*).mangleof, " ", __traits(toType, (int*).mangleof));
+
+template Type(T) { alias Type = T; }
+
+Type!(__traits(toType, 1.mangleof)) j = 3;
+
+alias T = Type!(__traits(toType, 1.mangleof));
+static assert(is(T == int));
+
+__traits(toType, "i") x = 7;
+
+static assert(is(Type!(__traits(toType, 1.mangleof)) == int));
+static assert(is(Type!(__traits(toType, (1.0).mangleof)) == double));
+static assert(is(Type!(__traits(toType, (int*).mangleof)) == int*));
diff --git a/gcc/testsuite/gdc.test/compilable/fix21647.d b/gcc/testsuite/gdc.test/compilable/fix21647.d
new file mode 100644
index 0000000..c129fa0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/fix21647.d
@@ -0,0 +1,30 @@
+/*
+REQUIRED_ARGS:
+TEST_OUTPUT:
+---
+cast(void)0
+cast(void)0
+void
+cast(void)0
+cast(void)0
+cast(void)0
+void
+---
+*/
+
+
+// https://issues.dlang.org/show_bug.cgi?id=21647
+
+void foo() { return cast(void)1; }
+
+void main(){}
+
+alias V = void;
+
+void test1() { pragma(msg, foo()); }
+void test2() { pragma(msg, main()); }
+void test3() { pragma(msg, V); }
+
+pragma(msg, foo());
+pragma(msg, main());
+pragma(msg, V);
diff --git a/gcc/testsuite/gdc.test/compilable/ice10598.d b/gcc/testsuite/gdc.test/compilable/ice10598.d
deleted file mode 100644
index 58a7c3b..0000000
--- a/gcc/testsuite/gdc.test/compilable/ice10598.d
+++ /dev/null
@@ -1,3 +0,0 @@
-// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d
-
-void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/ice10770.d b/gcc/testsuite/gdc.test/compilable/ice10770.d
new file mode 100644
index 0000000..cf55833
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice10770.d
@@ -0,0 +1,5 @@
+enum E1 : int;
+static assert(is(E1 e == enum) && is(e == int));
+
+enum E2;
+static assert(is(E2 e == enum));
diff --git a/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d b/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d
new file mode 100644
index 0000000..ee3c9eb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d
@@ -0,0 +1,22 @@
+module imports.issue21614a;
+
+struct FormatSpec(Char)
+{
+ import imports.issue21614a;
+}
+
+template Tuple(Specs...)
+{
+ struct Tuple
+ {
+ alias spec = FormatSpec!char();
+ this(Specs)
+ {
+ }
+ }
+}
+
+auto findRoot(T)(T)
+{
+ return Tuple!(T)();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d
new file mode 100644
index 0000000..a517957
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d
@@ -0,0 +1,4 @@
+module pkg16044;
+
+int test1;
+int test2;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d
new file mode 100644
index 0000000..4c96e12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d
@@ -0,0 +1,4 @@
+module pkg16044.sub;
+
+int test3;
+int test4;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d b/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d b/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d b/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test20530a.d b/gcc/testsuite/gdc.test/compilable/imports/test20530a.d
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test20530a.d
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21501b.d b/gcc/testsuite/gdc.test/compilable/imports/test21501b.d
new file mode 100644
index 0000000..c1f8fab
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test21501b.d
@@ -0,0 +1,7 @@
+module imports.test21501b;
+import test21501a;
+
+struct B
+{
+ A data;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21501c.d b/gcc/testsuite/gdc.test/compilable/imports/test21501c.d
new file mode 100644
index 0000000..cc1f95f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test21501c.d
@@ -0,0 +1,4 @@
+module imports.test21501c;
+
+alias C = int;
+const D = 1;
diff --git a/gcc/testsuite/gdc.test/compilable/interpret5.d b/gcc/testsuite/gdc.test/compilable/interpret5.d
new file mode 100644
index 0000000..ce13a5a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/interpret5.d
@@ -0,0 +1,30 @@
+// https://issues.dlang.org/show_bug.cgi?id=21927
+/*
+TEST_OUTPUT:
+---
+T1(Args...)
+T1!()
+T2(Args2...)
+T2!()
+this.T2(Args2...)
+this.T2!()
+---
+*/
+template T1(Args...) {}
+
+pragma(msg, T1); // TOK.template_
+pragma(msg, T1!()); // TOK.scope_
+
+struct S
+{
+ template T2(Args2...) {}
+
+ pragma(msg, S.T2); // TOK.template_
+ pragma(msg, S.T2!()); // TOK.scope_
+
+ void fun()
+ {
+ pragma(msg, this.T2); // TOK.dotTemplateDeclaration
+ pragma(msg, this.T2!()); // TOK.dot
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/issue16020.d b/gcc/testsuite/gdc.test/compilable/issue16020.d
new file mode 100644
index 0000000..cfd078c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue16020.d
@@ -0,0 +1,39 @@
+module issue16020;
+
+alias F1 = const(int)(); const(int) f1(){return 42;}
+static assert (is(F1 == typeof(f1)));
+
+alias F2 = float(float); float f2(float p){return p;}
+static assert (is(F2 == typeof(f2)));
+
+alias F3 = void(); void f3(){}
+static assert (is(F3 == typeof(f3)));
+
+alias void F41() @safe;
+alias F42 = void() @safe;
+alias F43 = @safe void();
+static assert (is(F41 == F42));
+static assert (is(F43 == F42));
+
+alias void F51() @system;
+alias F52 = void() @safe;
+static assert (!is(F51 == F52));
+
+alias F61 = int() const shared;
+alias int F62() const shared ;
+alias F63 = const shared int();
+static assert (is(F61 == F62));
+static assert (is(F63 == F62));
+
+alias F71 = int() immutable inout;
+alias int F72() immutable inout;
+alias F73 = immutable inout int();
+static assert (is(F71 == F72));
+static assert (is(F73 == F72));
+
+alias FunTemplate(T) = void(T t);
+alias Specialized = FunTemplate!int;
+alias Compared = void(int);
+static assert(is(Specialized == Compared));
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/issue16044.d b/gcc/testsuite/gdc.test/compilable/issue16044.d
new file mode 100644
index 0000000..e959e2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue16044.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -Icompilable/imports
+// EXTRA_FILES: imports/pkg16044/package.d imports/pkg16044/sub/package.d
+module issue16044; // https://issues.dlang.org/show_bug.cgi?id=16044
+
+import pkg16044;
+import pkg16044.sub;
+
+static assert([__traits(allMembers, pkg16044)] == ["object", "test1", "test2"]);
+static assert([__traits(allMembers, pkg16044.sub)] == ["object", "test3", "test4"]);
diff --git a/gcc/testsuite/gdc.test/compilable/issue20915.d b/gcc/testsuite/gdc.test/compilable/issue20915.d
new file mode 100644
index 0000000..dd8b7b5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue20915.d
@@ -0,0 +1,10 @@
+module issue20915;
+
+// prior to the PR adding this test case,
+// locally defined version and debug idents were included.
+version = illegal;
+debug = illegal;
+
+alias Seq(T...) = T;
+
+static assert (__traits(allMembers, issue20915) == Seq!("object", "Seq"));
diff --git a/gcc/testsuite/gdc.test/compilable/issue21614.d b/gcc/testsuite/gdc.test/compilable/issue21614.d
new file mode 100644
index 0000000..1843fe6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue21614.d
@@ -0,0 +1,10 @@
+// EXTRA_FILES: imports/issue21614a.d
+// REQUIRED_ARGS: -i
+
+// https://issues.dlang.org/show_bug.cgi?id=21614
+
+void logmdigammaInverse(real y)
+{
+ import imports.issue21614a;
+ findRoot(y);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/issue21726.d b/gcc/testsuite/gdc.test/compilable/issue21726.d
new file mode 100644
index 0000000..c8a8675
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue21726.d
@@ -0,0 +1,2 @@
+// EXTRA_SOURCES: protection/issue21726/typecons.d
+// https://issues.dlang.org/show_bug.cgi?id=21726
diff --git a/gcc/testsuite/gdc.test/compilable/issue21813a.d b/gcc/testsuite/gdc.test/compilable/issue21813a.d
new file mode 100644
index 0000000..f07b47a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue21813a.d
@@ -0,0 +1,13 @@
+// https://issues.dlang.org/show_bug.cgi?id=21813
+Target.OS defaultTargetOS()
+{
+ return Target.OS.linux;
+}
+
+struct Target
+{
+ enum OS { linux }
+ OS os = defaultTargetOS();
+ void deinitialize() { this = this.init; }
+ @property isPOSIX() scope @nogc { }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/issue21813b.d b/gcc/testsuite/gdc.test/compilable/issue21813b.d
new file mode 100644
index 0000000..ef22697
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue21813b.d
@@ -0,0 +1,13 @@
+// https://issues.dlang.org/show_bug.cgi?id=21813
+Target.OS defaultTargetOS()
+{
+ return Target.OS.linux;
+}
+
+struct Target
+{
+ enum OS { linux }
+ OS os = defaultTargetOS();
+ @property isPOSIX() scope @nogc { }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/minimal3.d b/gcc/testsuite/gdc.test/compilable/minimal3.d
new file mode 100644
index 0000000..e8106b6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/minimal3.d
@@ -0,0 +1,36 @@
+// DFLAGS:
+// REQUIRED_ARGS: -defaultlib=
+// EXTRA_SOURCES: extra-files/minimal/object.d
+
+/**********************************************/
+// https://issues.dlang.org/show_bug.cgi?id=19234
+void issue19234()
+{
+ static struct A {}
+ A[10] a;
+ A[10] b;
+ b[] = a[];
+}
+
+/**********************************************/
+// https://issues.dlang.org/show_bug.cgi?id=22005
+void issue22005()
+{
+ enum int[4] foo = [1,2,3,4];
+ static foreach (i, e; foo)
+ {
+ }
+}
+
+/**********************************************/
+// https://issues.dlang.org/show_bug.cgi?id=22006
+void issue22006()
+{
+ alias size_t = typeof(int.sizeof);
+ alias AliasSeq(T...) = T;
+
+ foreach (size_t i, e; [0, 1, 2, 3]) { }
+ static foreach (size_t i, e; [0, 1, 2, 3]) { }
+ foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { }
+ static foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/mixintype.d b/gcc/testsuite/gdc.test/compilable/mixintype.d
new file mode 100644
index 0000000..abbf85a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/mixintype.d
@@ -0,0 +1,55 @@
+
+alias Int = mixin("int");
+alias Lint = mixin("Int");
+
+int test1(mixin("int")* p)
+{
+ mixin("int")[] a;
+ mixin("int[]") b;
+ mixin("int[] c;");
+ mixin("*p = c[0];");
+ *p = mixin("c[0]");
+ return *p + a[0] + b[0] + c[0];
+}
+
+/******************************************/
+
+void test2()
+{
+ auto a = __traits(allMembers, mixin(__MODULE__));
+}
+
+/*****************************************/
+
+void test3()
+{
+ char val;
+ int mod;
+ enum b = __traits(compiles, mixin("*cast(int*)&val + mod"));
+ static assert(b == true);
+}
+
+/********************************************/
+
+
+struct S
+{
+ int fielda;
+ int fieldb;
+}
+
+template Foo4(alias T)
+{
+ enum Foo4 = true;
+}
+
+void test4()
+{
+ S sa;
+ auto a = Foo4!( __traits(getMember,sa,"fielda") );
+
+ S sb;
+ enum getStuff = q{ __traits(getMember,sb,"fieldb") };
+ auto b = Foo4!(mixin(getStuff));
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/mixintype2.d b/gcc/testsuite/gdc.test/compilable/mixintype2.d
new file mode 100644
index 0000000..43803df
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/mixintype2.d
@@ -0,0 +1,68 @@
+
+alias fun = mixin("(){}");
+
+void test1()
+{
+ int x = 1;
+ static immutable c = 2;
+
+ fun();
+ foo!(mixin("int"))();
+ foo!(mixin("long*"))();
+ foo!(mixin("ST!(int, S.T)"))();
+ foo!(mixin(ST!(int, S.T)))();
+
+ int[mixin("string")] a1;
+ int[mixin("5")] a2;
+ int[mixin("c")] a3;
+ int[] v1 = new int[mixin("3")];
+ auto v2 = new int[mixin("x")];
+
+ mixin(q{__traits(getMember, S, "T")}) ftv;
+
+ alias T = int*;
+ static assert(__traits(compiles, mixin("int")));
+ static assert(__traits(compiles, mixin(q{int[mixin("string")]})));
+ static assert(__traits(compiles, mixin(q{int[mixin("2")]})));
+ static assert(__traits(compiles, mixin(T)));
+ static assert(__traits(compiles, mixin("int*")));
+ static assert(__traits(compiles, mixin(typeof(0))));
+}
+
+struct S { alias T = float*; }
+
+struct ST(X,Y) {}
+
+void foo(alias t)() {}
+
+/**************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=21074
+
+alias Byte = ubyte;
+alias Byte2(A) = ubyte;
+alias T0 = mixin(q{const(Byte)})*;
+alias T1 = mixin(q{const(Byte[1])})*;
+alias T2 = mixin(q{const(Byte2!int)})*;
+alias T3 = mixin(q{const(mixin(Byte2!int))})*;
+alias T4 = mixin(q{const(mixin("__traits(getMember, S, \"T\")"))})*;
+alias T5 = const(mixin(q{Byte}))*;
+alias T6 = const(mixin(q{immutable(Byte)}))*;
+alias T7 = const(mixin(q{shared(Byte)}))*;
+alias T8 = const(mixin(q{Byte*}));
+
+// the following tests now work
+static assert(is(T0 == const(ubyte)*));
+static assert(is(T1 == const(ubyte[1])*));
+static assert(is(T2 == const(ubyte)*));
+static assert(is(T3 == const(ubyte)*));
+static assert(is(T4 == const(float*)*));
+static assert(is(T5 == const(ubyte)*));
+static assert(is(T6 == immutable(ubyte)*));
+static assert(is(T7 == const(shared(ubyte))*));
+static assert(is(T8 == const(ubyte*)));
+
+// this doesn't work but I'll file a new issue
+/*
+alias T8 = mixin(q{immutable(__traits(getMember, S, "T"))})*;
+static assert(is(T8 == immutable(float*)*));
+*/
diff --git a/gcc/testsuite/gdc.test/compilable/noreturn1.d b/gcc/testsuite/gdc.test/compilable/noreturn1.d
new file mode 100644
index 0000000..e21adc4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/noreturn1.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+noreturn
+---
+*/
+
+alias noreturn = typeof(*null);
+pragma(msg, noreturn);
+
+noreturn exits(int* p) { *p = 3; }
+
+noreturn exit();
+
+int test1(int i)
+{
+ if (exit())
+ return i + 1;
+ return i - 1;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d
new file mode 100644
index 0000000..d0b5f5a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d
@@ -0,0 +1,5 @@
+module issue20796;
+
+package(issue20796) void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d
new file mode 100644
index 0000000..e0f6ba7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d
@@ -0,0 +1,7 @@
+module protection.issue21726.format;
+
+package(protection.issue21726.format):
+
+package(protection.issue21726) int issuePkgSym;
+package(protection) int protectionPkgSym();
+int formatPkgSym;
diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d
new file mode 100644
index 0000000..f8986c9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d
@@ -0,0 +1 @@
+module protection.issue21726;
diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d
new file mode 100644
index 0000000..faed95e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d
@@ -0,0 +1,6 @@
+module protection.issue21726.typecons;
+
+import protection.issue21726.format : issuePkgSym;
+import protection.issue21726.format : protectionPkgSym;
+static assert(!__traits(compiles,
+ { import protection.issue21726.format : formatPkgSym; }));
diff --git a/gcc/testsuite/gdc.test/compilable/staticforeach.d b/gcc/testsuite/gdc.test/compilable/staticforeach.d
index 48d06b4..8a54f32 100644
--- a/gcc/testsuite/gdc.test/compilable/staticforeach.d
+++ b/gcc/testsuite/gdc.test/compilable/staticforeach.d
@@ -115,6 +115,8 @@ bug17688
T
foo2
T2
+TestStaticForeach2
+issue22007
1 2 '3'
2 3 '4'
0 1
@@ -840,3 +842,39 @@ struct T2{
struct S{}
}
static assert(is(__traits(parent,T2.S)==T2));
+
+struct TestStaticForeach2
+{
+static:
+ // StringExp
+ char[] test(string str)()
+ {
+ char[] s;
+ static foreach (c; str)
+ {
+ s ~= c;
+ }
+ return s;
+ }
+ static assert(test!"tёstñ" == ['t', '\xd1', '\x91', 's', 't', '\xc3', '\xb1']);
+
+ static foreach (c; "")
+ {
+ static assert(0);
+ }
+
+ // NullExp
+ enum int[] a = null;
+ static foreach (c; a)
+ {
+ static assert(0);
+ }
+}
+
+//https://issues.dlang.org/show_bug.cgi?id=22007
+void issue22007()
+{
+ immutable int[32] array = 1;
+ foreach (size_t a, int b; array) {}
+ static foreach (size_t a, int b; array) { }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16002.d b/gcc/testsuite/gdc.test/compilable/test16002.d
index f3303c0..f7b4c2e 100644
--- a/gcc/testsuite/gdc.test/compilable/test16002.d
+++ b/gcc/testsuite/gdc.test/compilable/test16002.d
@@ -22,3 +22,6 @@ static assert(is(b == module));
// This is supposed to work even though we haven't directly imported imports.pkgmodule.
static assert(is(imports.pkgmodule == module));
static assert(!is(MyStruct == module));
+
+static assert(!is(imports.nonexistent == package));
+static assert(!is(imports.nonexistent == module));
diff --git a/gcc/testsuite/gdc.test/compilable/test17991.d b/gcc/testsuite/gdc.test/compilable/test17991.d
new file mode 100644
index 0000000..8bc9fa9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17991.d
@@ -0,0 +1,3 @@
+// https://issues.dlang.org/show_bug.cgi?id=17991
+// EXTRA_FILES: imports/test17991a/package.d imports/test17991a/a.d
+import imports.test17991a, imports.test17991a.a;
diff --git a/gcc/testsuite/gdc.test/compilable/test19145.d b/gcc/testsuite/gdc.test/compilable/test19145.d
new file mode 100644
index 0000000..ef5faa8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test19145.d
@@ -0,0 +1,14 @@
+// https://issues.dlang.org/show_bug.cgi?id=19415
+
+struct S
+{
+ int x;
+ S foo() return { return S(x); }
+ this(this) @disable;
+}
+
+S bar()
+{
+ S s;
+ return s; // Error: struct `S` is not copyable because it is annotated with @disable
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test19292.d b/gcc/testsuite/gdc.test/compilable/test19292.d
new file mode 100644
index 0000000..8122851
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test19292.d
@@ -0,0 +1,15 @@
+// https://issues.dlang.org/show_bug.cgi?id=19292
+
+mixin("enum a = ", 87, ";");
+static assert(a == 87);
+
+int test()
+{
+ mixin("enum x = ", 7, ";");
+ return mixin("1", x, 2U);
+}
+
+void testit()
+{
+ static assert(test() == 172);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test20151a.d b/gcc/testsuite/gdc.test/compilable/test20151a.d
new file mode 100644
index 0000000..d9ae28f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test20151a.d
@@ -0,0 +1,3 @@
+// EXTRA_FILES: imports/test20151a/b/c/c.d
+module imports.test20151a;
+import imports.test20151a.b.c.c;
diff --git a/gcc/testsuite/gdc.test/compilable/test20280.d b/gcc/testsuite/gdc.test/compilable/test20280.d
new file mode 100644
index 0000000..76a1082
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test20280.d
@@ -0,0 +1,8 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -Icompilable/extra-files
+// EXTRA_FILES: extra-files/test20280a.d
+module test20280;
+
+import test20280a;
+
+alias Charlie = Foxtrot!(0);
diff --git a/gcc/testsuite/gdc.test/compilable/test20530.d b/gcc/testsuite/gdc.test/compilable/test20530.d
new file mode 100644
index 0000000..be80dbb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test20530.d
@@ -0,0 +1,46 @@
+// EXTRA_FILES: imports/test20530a.d imports/plainpackage/plainmodule.d imports/pkgmodule/package.d imports/pkgmodule/plainmodule.d
+module mod;
+static assert(is(mod == module));
+static assert(is(mixin("mod") == module));
+static assert(!is(mod == package));
+static assert(!is(mixin("mod") == package));
+
+import imports.test20530a;
+static assert(is(imports == package));
+static assert(is(mixin("imports") == package));
+static assert(!is(imports == module));
+static assert(!is(mixin("imports") == module));
+
+import imports.plainpackage.plainmodule;
+import imports.pkgmodule.plainmodule;
+
+struct MyStruct;
+
+alias a = mixin("imports.plainpackage");
+alias b = mixin("imports.pkgmodule.plainmodule");
+
+static assert(is(mixin("imports.plainpackage") == package));
+static assert(is(mixin("a") == package));
+static assert(!is(mixin("imports.plainpackage.plainmodule") == package));
+static assert(!is(mixin("b") == package));
+static assert(is(mixin("imports.pkgmodule") == package));
+mixin("static assert(is(imports.pkgmodule == package));");
+
+static assert(!is(mixin("MyStruct") == package));
+
+static assert(!is(mixin("imports.plainpackage") == module));
+static assert(!is(mixin("a") == module));
+static assert(is(mixin("imports.plainpackage.plainmodule") == module));
+static assert(is(mixin("b") == module));
+static assert(is(mixin("imports.pkgmodule") == module));
+mixin("static assert(is(imports.pkgmodule == module));");
+
+static assert(!is(mixin("MyStruct") == module));
+
+static assert(!is(mixin("imports.nonexistent") == package));
+static assert(!is(mixin("imports.nonexistent") == module));
+
+// this won't work due to mixin argument .stringof expansion,
+// it will expand to mixin(package imports.pkgmodule). Issue 20519.
+//static assert(is(mixin(imports.pkgmodule) == package));
+//static assert(is(mixin(imports.pkgmodule) == module));
diff --git a/gcc/testsuite/gdc.test/compilable/test20537.d b/gcc/testsuite/gdc.test/compilable/test20537.d
new file mode 100644
index 0000000..f2d05d2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test20537.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -Icompilable/imports
+// EXTRA_FILES: imports/pkg20537/package.d
+import pkg20537;
+
+static assert(is(pkg20537 == module));
+static assert(__traits(isModule, pkg20537));
+static assert(is(mixin("pkg20537") == module));
+static assert(is(pkg20537 == package));
+static assert(__traits(isPackage, pkg20537));
+static assert(is(mixin("pkg20537") == package));
diff --git a/gcc/testsuite/gdc.test/compilable/test20692.d b/gcc/testsuite/gdc.test/compilable/test20692.d
new file mode 100644
index 0000000..2d67211
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test20692.d
@@ -0,0 +1,18 @@
+// https://issues.dlang.org/show_bug.cgi?id=20692
+
+struct S() {
+ void fun() {
+ gun("");
+ }
+ void gun(T)(T) {
+ alias buggy = bug;
+ }
+}
+
+alias X = S!();
+
+void main() {
+ X().gun(0);
+}
+
+alias bug = __traits(getMember, X, "fun");
diff --git a/gcc/testsuite/gdc.test/compilable/test20894.d b/gcc/testsuite/gdc.test/compilable/test20894.d
new file mode 100644
index 0000000..e8dad45
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test20894.d
@@ -0,0 +1,46 @@
+// https://issues.dlang.org/show_bug.cgi?id=20894
+
+mixin template MT()
+{
+ int a;
+ alias b = char;
+ void c() {}
+}
+
+struct S
+{
+ mixin MT mt;
+}
+
+void main()
+{
+ auto r = S();
+ enum c = S();
+
+ foo!(S.mt);
+ foo!(r.mt);
+ foo!(c.mt); // OK <- ICE
+
+ foo!(mixin("S.mt"));
+ foo!(mixin("r.mt")); // OK <- ICE
+ foo!(mixin("c.mt")); // OK <- ICE
+
+ // some checks
+ foo!(r.mt, c.mt);
+ foo!(mixin("r.mt"), c.mt);
+ foo!(r.mt, mixin("c.mt"));
+ foo!(S.mt, mixin("c.mt"));
+}
+
+alias Tup(T...) = T;
+
+void foo(A...)()
+{
+ static if (A.length == 2)
+ {
+ static assert(__traits(isSame, A[0], A[1]));
+ enum members = __traits(allMembers, A[0]);
+ static assert(members == __traits(allMembers, A[1]));
+ static assert(members == Tup!("a", "b", "c"));
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test21501a.d b/gcc/testsuite/gdc.test/compilable/test21501a.d
new file mode 100644
index 0000000..096fd51
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21501a.d
@@ -0,0 +1,19 @@
+// EXTRA_SOURCES: imports/test21501b.d imports/test21501c.d
+// https://issues.dlang.org/show_bug.cgi?id=21501
+
+module test21501a;
+import imports.test21501b;
+import imports.test21501c;
+
+alias Identity(alias T) = T;
+
+struct A
+{
+ alias a = imports.test21501c.C;
+ const int b = imports.test21501c.D; // fixed
+ alias c = Identity!(mixin(q{imports.test21501c.C})); // fixed
+ const int d = Identity!(mixin(q{imports.test21501c.D})); // fixed
+
+ static assert(is(a == c) && is(a == int));
+ static assert(b == d && b == 1);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test21742.d b/gcc/testsuite/gdc.test/compilable/test21742.d
new file mode 100644
index 0000000..b8f5df4b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21742.d
@@ -0,0 +1,13 @@
+// https://issues.dlang.org/show_bug.cgi?id=21742
+
+int foo()() { return 0; }
+
+struct B
+{
+ int foo()() { return 0; }
+}
+
+static assert(is(typeof(foo) == void));
+
+// failed, gagged error: expression B().foo()() has no type
+static assert(is(typeof(B().foo) == void));
diff --git a/gcc/testsuite/gdc.test/compilable/test21812.d b/gcc/testsuite/gdc.test/compilable/test21812.d
new file mode 100644
index 0000000..9cf33f5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21812.d
@@ -0,0 +1,10 @@
+// https://issues.dlang.org/show_bug.cgi?id=21812
+
+struct S(A...)
+{
+ A args;
+}
+
+static assert(__traits(allMembers, S!(int, float)) == AliasSeq!("args"));
+
+alias AliasSeq(T...) = T;
diff --git a/gcc/testsuite/gdc.test/compilable/test21898.d b/gcc/testsuite/gdc.test/compilable/test21898.d
new file mode 100644
index 0000000..9ac18b8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21898.d
@@ -0,0 +1,7 @@
+// https://issues.dlang.org/show_bug.cgi?id=21898
+
+alias Works(T) = immutable(T);
+alias Fails(T) = immutable T;
+
+static assert(is(Works!int == immutable int));
+static assert(is(Fails!int == immutable int));
diff --git a/gcc/testsuite/gdc.test/compilable/test22006.d b/gcc/testsuite/gdc.test/compilable/test22006.d
new file mode 100644
index 0000000..913dd85
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test22006.d
@@ -0,0 +1,14 @@
+// https://issues.dlang.org/show_bug.cgi?id=22006
+void test22006()
+{
+ alias AliasSeq(TList...) = TList;
+ {
+ alias aseq = AliasSeq!(0, 1, 2, 3);
+ static foreach (ubyte i; 0 .. aseq.length) {}
+ static foreach (ubyte i, x; aseq) {}
+ }
+ {
+ static foreach (ubyte i; 0 .. [0, 1, 2, 3].length) {}
+ static foreach (ubyte i, x; [0, 1, 2, 3]) {}
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test22133.d b/gcc/testsuite/gdc.test/compilable/test22133.d
new file mode 100644
index 0000000..aff762c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test22133.d
@@ -0,0 +1,16 @@
+// https://issues.dlang.org/show_bug.cgi?id=22133
+
+struct Slice
+{
+ bool empty() const;
+ int front() const;
+ void popFront()() // note: requires a mutable Slice
+ {}
+}
+
+enum isInputRange1(R) = is(typeof((R r) => r.popFront));
+enum isInputRange2(R) = __traits(compiles, (R r) => r.popFront);
+static assert(isInputRange1!( Slice) == true);
+static assert(isInputRange1!(const Slice) == false);
+static assert(isInputRange2!( Slice) == true);
+static assert(isInputRange2!(const Slice) == false);
diff --git a/gcc/testsuite/gdc.test/compilable/test9029.d b/gcc/testsuite/gdc.test/compilable/test9029.d
new file mode 100644
index 0000000..bbbd98a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9029.d
@@ -0,0 +1,39 @@
+// https://issues.dlang.org/show_bug.cgi?id=9029
+enum NameOf(alias S) = S.stringof;
+
+static assert(NameOf!int == "int");
+
+enum BothMatch(alias S) = "alias";
+enum BothMatch(T) = "type";
+
+void foo9029() { }
+
+struct Struct { }
+
+static assert(BothMatch!int == "type");
+static assert(BothMatch!(void function()) == "type");
+static assert(BothMatch!BothMatch == "alias");
+static assert(BothMatch!Struct == "type");
+static assert(BothMatch!foo9029 == "alias");
+static assert(BothMatch!5 == "alias");
+
+// https://issues.dlang.org/show_bug.cgi?id=19884
+mixin template genCtEvaluate()
+{
+ void evaluate(alias op)() { }
+}
+struct S
+{
+ mixin genCtEvaluate!() mixinEval;
+ alias evaluate = mixinEval.evaluate;
+ void evaluate() { }
+}
+alias List(Ops...) = Ops;
+void main()
+{
+ S g;
+ foreach (op; List!(0))
+ {
+ g.evaluate!op();
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b12504.d b/gcc/testsuite/gdc.test/fail_compilation/b12504.d
new file mode 100644
index 0000000..0bb104e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b12504.d
@@ -0,0 +1,64 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/b12504.d(26): Error: cannot implicitly convert expression `257$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ubyte`
+fail_compilation/b12504.d(27): Error: index type `ubyte` cannot cover index range 0..257
+fail_compilation/b12504.d(31): Error: cannot implicitly convert expression `129$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `byte`
+fail_compilation/b12504.d(32): Error: index type `byte` cannot cover index range 0..129
+fail_compilation/b12504.d(36): Error: cannot implicitly convert expression `65537$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ushort`
+fail_compilation/b12504.d(37): Error: index type `ushort` cannot cover index range 0..65537
+fail_compilation/b12504.d(41): Error: cannot implicitly convert expression `32769$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `short`
+fail_compilation/b12504.d(42): Error: index type `short` cannot cover index range 0..32769
+fail_compilation/b12504.d(46): Error: cannot implicitly convert expression `257$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ubyte`
+fail_compilation/b12504.d(47): Error: index type `ubyte` cannot cover index range 0..257
+fail_compilation/b12504.d(51): Error: cannot implicitly convert expression `129$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `byte`
+fail_compilation/b12504.d(52): Error: index type `byte` cannot cover index range 0..129
+fail_compilation/b12504.d(56): Error: cannot implicitly convert expression `65537$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ushort`
+fail_compilation/b12504.d(57): Error: index type `ushort` cannot cover index range 0..65537
+fail_compilation/b12504.d(61): Error: cannot implicitly convert expression `32769$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `short`
+fail_compilation/b12504.d(62): Error: index type `short` cannot cover index range 0..32769
+---
+*/
+void main()
+{
+ {
+ int[0xFF + 2] sta;
+ foreach (ubyte i; 0 .. sta.length) {}
+ foreach (ubyte i, x; sta) {}
+ }
+ {
+ int[0x7F + 2] sta;
+ foreach (byte i; 0 .. sta.length) {}
+ foreach (byte i, x; sta) {}
+ }
+ {
+ int[0xFFFF + 2] sta;
+ foreach (ushort i; 0 .. sta.length) {}
+ foreach (ushort i, x; sta) {}
+ }
+ {
+ int[0x7FFF + 2] sta;
+ foreach (short i; 0 .. sta.length) {}
+ foreach (short i, x; sta) {}
+ }
+ {
+ immutable int[0xFF + 2] sta;
+ static foreach (ubyte i; 0 .. sta.length) {}
+ static foreach (ubyte i, x; sta) {}
+ }
+ {
+ immutable int[0x7F + 2] sta;
+ static foreach (byte i; 0 .. sta.length) {}
+ static foreach (byte i, x; sta) {}
+ }
+ {
+ immutable int[0xFFFF + 2] sta;
+ static foreach (ushort i; 0 .. sta.length) {}
+ static foreach (ushort i, x; sta) {}
+ }
+ {
+ immutable int[0x7FFF + 2] sta;
+ static foreach (short i; 0 .. sta.length) {}
+ static foreach (short i, x; sta) {}
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug15613.d b/gcc/testsuite/gdc.test/fail_compilation/bug15613.d
new file mode 100644
index 0000000..e8072fd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug15613.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug15613.d(16): Error: function `bug15613.f(int...)` is not callable using argument types `(typeof(null))`
+fail_compilation/bug15613.d(16): cannot pass argument `null` of type `typeof(null)` to parameter `int...`
+fail_compilation/bug15613.d(17): Error: function `bug15613.g(Object, ...)` is not callable using argument types `(int)`
+fail_compilation/bug15613.d(17): cannot pass argument `8` of type `int` to parameter `Object`
+---
+*/
+
+void f(int...);
+void g(Object, ...);
+
+void main()
+{
+ f(null);
+ g(8);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug16165.d b/gcc/testsuite/gdc.test/fail_compilation/bug16165.d
new file mode 100644
index 0000000..fdfbf73
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug16165.d
@@ -0,0 +1,18 @@
+void f(int x, Object y);
+
+void g()
+{
+ Object o;
+ f(o, o, 404);
+ f(5, 6, 404);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug16165.d(6): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(Object, Object, int)`
+fail_compilation/bug16165.d(6): cannot pass argument `o` of type `object.Object` to parameter `int x`
+fail_compilation/bug16165.d(7): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(int, int, int)`
+fail_compilation/bug16165.d(7): cannot pass argument `6` of type `int` to parameter `Object y`
+---
+ */
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug9631.d b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d
new file mode 100644
index 0000000..852eaae
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d
@@ -0,0 +1,100 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug9631.d(20): Error: cannot implicitly convert expression `F()` of type `bug9631.T1!().F` to `bug9631.T2!().F`
+---
+*/
+
+template T1()
+{
+ struct F { }
+}
+
+template T2()
+{
+ struct F { }
+}
+
+void main()
+{
+ T2!().F x = T1!().F();
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug9631.d(41): Error: incompatible types for ((x) == (y)): 'bug9631.S' and 'bug9631.tem!
+).S'
+---
+*/
+
+struct S { char c; }
+
+template tem()
+{
+ struct S { int i; }
+}
+
+void equal()
+{
+ S x;
+ auto y = tem!().S();
+ bool b = x == y;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug9631.d(79): Error: function `bug9631.arg.f(int i, S s)` is not callable using argumen
+ types `(int, S)`
+fail_compilation/bug9631.d(79): cannot pass argument `y` of type `bug9631.tem!().S` to parameter `
+ug9631.S s`
+fail_compilation/bug9631.d(80): Error: function literal `__lambda2(S s)` is not callable using argument t
+pes `(S)`
+fail_compilation/bug9631.d(80): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631
+tem!().S s`
+fail_compilation/bug9631.d(86): Error: constructor `bug9631.arg.A.this(S _param_0)` is not callable using
+argument types `(S)`
+fail_compilation/bug9631.d(86): cannot pass argument `S(0)` of type `bug9631.tem!().S` to paramete
+ `bug9631.S _param_0`
+---
+*/
+void arg()
+{
+ S x;
+ tem!().S y;
+
+ void f(int i, S s);
+ f(4, y);
+ (tem!().S s){}(x);
+
+ struct A
+ {
+ this(S){}
+ }
+ A(tem!().S());
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug9631.d(106): Error: function `bug9631.targ.ft!().ft(S _param_0)` is not callable using argument types `(S)`
+fail_compilation/bug9631.d(106): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S _param_0`
+fail_compilation/bug9631.d(107): Error: template `bug9631.targ.ft` cannot deduce function from argument types `!()(S)`, candidates are:
+fail_compilation/bug9631.d(105): `bug9631.targ.ft()(tem!().S)`
+fail_compilation/bug9631.d(109): Error: template `bug9631.targ.ft2` cannot deduce function from argument types `!()(S, int)`, candidates are:
+fail_compilation/bug9631.d(108): `bug9631.targ.ft2(T)(S, T)`
+---
+*/
+void targ()
+{
+ S x;
+ tem!().S y;
+
+ void ft()(tem!().S){}
+ ft!()(x);
+ ft(x);
+ void ft2(T)(S, T){}
+ ft2(y, 1);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/chkformat.d b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d
new file mode 100644
index 0000000..e9ed241
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d
@@ -0,0 +1,171 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/chkformat.d(101): Deprecation: width argument `0L` for format specification `"%*.*d"` must be `int`, not `long`
+fail_compilation/chkformat.d(101): Deprecation: precision argument `1L` for format specification `"%*.*d"` must be `int`, not `long`
+fail_compilation/chkformat.d(101): Deprecation: argument `2L` for format specification `"%*.*d"` must be `int`, not `long`
+fail_compilation/chkformat.d(104): Deprecation: argument `4` for format specification `"%lld"` must be `long`, not `int`
+fail_compilation/chkformat.d(105): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `int`
+fail_compilation/chkformat.d(106): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t`, not `double`
+fail_compilation/chkformat.d(107): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t`, not `double`
+fail_compilation/chkformat.d(108): Deprecation: argument `8.0L` for format specification `"%g"` must be `double`, not `real`
+fail_compilation/chkformat.d(109): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real`, not `double`
+fail_compilation/chkformat.d(110): Deprecation: argument `10` for format specification `"%p"` must be `void*`, not `int`
+fail_compilation/chkformat.d(111): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `uint*`
+fail_compilation/chkformat.d(113): Deprecation: argument `& u` for format specification `"%lln"` must be `long*`, not `int*`
+fail_compilation/chkformat.d(114): Deprecation: argument `& u` for format specification `"%hn"` must be `short*`, not `int*`
+fail_compilation/chkformat.d(115): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*`
+fail_compilation/chkformat.d(116): Deprecation: argument `16L` for format specification `"%c"` must be `char`, not `long`
+fail_compilation/chkformat.d(117): Deprecation: argument `17L` for format specification `"%c"` must be `char`, not `long`
+fail_compilation/chkformat.d(118): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*`
+fail_compilation/chkformat.d(119): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*`
+fail_compilation/chkformat.d(201): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long`
+fail_compilation/chkformat.d(202): Deprecation: more format specifiers than 1 arguments
+fail_compilation/chkformat.d(203): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long`
+fail_compilation/chkformat.d(204): Deprecation: argument `0L` for format specification `"%3u"` must be `uint*`, not `long`
+fail_compilation/chkformat.d(205): Deprecation: argument `u` for format specification `"%200u"` must be `uint*`, not `uint`
+fail_compilation/chkformat.d(206): Deprecation: argument `3.0` for format specification `"%hhd"` must be `byte*`, not `double`
+fail_compilation/chkformat.d(207): Deprecation: argument `4` for format specification `"%hd"` must be `short*`, not `int`
+fail_compilation/chkformat.d(209): Deprecation: argument `4` for format specification `"%lld"` must be `long*`, not `int`
+fail_compilation/chkformat.d(210): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t*`, not `int`
+fail_compilation/chkformat.d(211): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t*`, not `double`
+fail_compilation/chkformat.d(212): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t*`, not `double`
+fail_compilation/chkformat.d(213): Deprecation: format specifier `"%Ld"` is invalid
+fail_compilation/chkformat.d(214): Deprecation: argument `0` for format specification `"%u"` must be `uint*`, not `int`
+fail_compilation/chkformat.d(215): Deprecation: argument `0` for format specification `"%hhu"` must be `ubyte*`, not `int`
+fail_compilation/chkformat.d(216): Deprecation: argument `0` for format specification `"%hu"` must be `ushort*`, not `int`
+fail_compilation/chkformat.d(218): Deprecation: argument `0` for format specification `"%llu"` must be `ulong*`, not `int`
+fail_compilation/chkformat.d(219): Deprecation: argument `0` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t*`, not `int`
+fail_compilation/chkformat.d(220): Deprecation: argument `0` for format specification `"%zu"` must be `size_t*`, not `int`
+fail_compilation/chkformat.d(221): Deprecation: argument `0` for format specification `"%tu"` must be `ptrdiff_t*`, not `int`
+fail_compilation/chkformat.d(222): Deprecation: argument `8.0L` for format specification `"%g"` must be `float*`, not `real`
+fail_compilation/chkformat.d(223): Deprecation: argument `8.0L` for format specification `"%lg"` must be `double*`, not `real`
+fail_compilation/chkformat.d(224): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real*`, not `double`
+fail_compilation/chkformat.d(225): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*`
+fail_compilation/chkformat.d(226): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*`
+fail_compilation/chkformat.d(227): Deprecation: argument `v` for format specification `"%p"` must be `void**`, not `void*`
+fail_compilation/chkformat.d(228): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `ushort*`
+fail_compilation/chkformat.d(229): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*`
+fail_compilation/chkformat.d(230): Deprecation: format specifier `"%[n"` is invalid
+fail_compilation/chkformat.d(231): Deprecation: format specifier `"%]"` is invalid
+fail_compilation/chkformat.d(232): Deprecation: argument `& u` for format specification `"%90s"` must be `char*`, not `int*`
+fail_compilation/chkformat.d(233): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long`
+fail_compilation/chkformat.d(234): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long`
+---
+*/
+
+
+import core.stdc.stdio;
+
+#line 100
+
+void test1() { printf("%*.*d\n", 0L, 1L, 2L); }
+//void test2() { }
+//void test3() { printf("%ld\n", 3.0); }
+void test4() { printf("%lld\n", 4); }
+void test5() { printf("%jd\n", 5); }
+void test6() { printf("%zd\n", 6.0); }
+void test7() { printf("%td\n", 7.0); }
+void test8() { printf("%g\n", 8.0L); }
+void test9() { printf("%Lg\n", 9.0); }
+void test10() { printf("%p\n", 10); }
+void test11() { uint u; printf("%n\n", &u); }
+//void test12() { ushort u; printf("%ln\n", &u); }
+void test13() { int u; printf("%lln\n", &u); }
+void test14() { int u; printf("%hn\n", &u); }
+void test15() { int u; printf("%hhn\n", &u); }
+void test16() { printf("%c\n", 16L); }
+void test17() { printf("%c\n", 17L); }
+void test18() { int u; printf("%s\n", &u); }
+void test19() { int u; printf("%ls\n", &u); }
+//void test20() { int u; char[] s; sprintf(&s[0], "%d\n", &u); }
+//void test21() { int u; fprintf(null, "%d\n", &u); }
+
+#line 200
+
+void test31() { scanf("%d\n", 0L); }
+void test32() { int i; scanf("%d %d\n", &i); }
+void test33() { scanf("%d%*c\n", 0L); }
+void test34() { scanf("%3u\n", 0L); }
+void test35() { uint u; scanf("%200u%*s\n", u); }
+void test36() { scanf("%hhd\n", 3.0); }
+void test37() { scanf("%hd\n", 4); }
+//void test38() { scanf("%ld\n", 3.0); }
+void test39() { scanf("%lld\n", 4); }
+void test40() { scanf("%jd\n", 5); }
+void test41() { scanf("%zd\n", 6.0); }
+void test42() { scanf("%td\n", 7.0); }
+void test43() { scanf("%Ld\n", 0); }
+void test44() { scanf("%u\n", 0); }
+void test45() { scanf("%hhu\n", 0); }
+void test46() { scanf("%hu\n", 0); }
+//void test47() { scanf("%lu\n", 0); }
+void test48() { scanf("%llu\n", 0); }
+void test49() { scanf("%ju\n", 0); }
+void test50() { scanf("%zu\n", 0); }
+void test51() { scanf("%tu\n", 0); }
+void test52() { scanf("%g\n", 8.0L); }
+void test53() { scanf("%lg\n", 8.0L); }
+void test54() { scanf("%Lg\n", 9.0); }
+void test55() { int u; scanf("%s\n", &u); }
+void test56() { int u; scanf("%ls\n", &u); }
+void test57() { void* v; scanf("%p\n", v); }
+void test58() { ushort u; scanf("%n\n", &u); }
+void test59() { int u; scanf("%hhn\n", &u); }
+void test60() { int u; scanf("%[n", &u); }
+void test61() { int u; scanf("%]\n", &u); }
+void test62() { int u; scanf("%90s\n", &u); }
+void test63() { sscanf("1234", "%d\n", 0L); }
+void test64() { fscanf(null, "%d\n", 0L); }
+
+/* TEST_OUTPUT:
+---
+fail_compilation/chkformat.d(301): Deprecation: format specifier `"%K"` is invalid
+fail_compilation/chkformat.d(302): Deprecation: format specifier `"%Q"` is invalid
+---
+*/
+
+import core.stdc.stdarg;
+
+#line 300
+
+void test301() { va_list vargs; vprintf("%K", vargs); }
+void test302() { va_list vargs; vscanf("%Q", vargs); }
+
+// TODO - C++ 11 only:
+//void test() { vscanf(); }
+//void test() { vfscanf(); }
+//void test() { vsscanf(); }
+
+/* TEST_OUTPUT:
+---
+fail_compilation/chkformat.d(401): Deprecation: argument `p` for format specification `"%u"` must be `uint`, not `char*`
+fail_compilation/chkformat.d(402): Deprecation: argument `p` for format specification `"%d"` must be `int`, not `char*`
+fail_compilation/chkformat.d(403): Deprecation: argument `p` for format specification `"%hhu"` must be `ubyte`, not `char*`
+fail_compilation/chkformat.d(404): Deprecation: argument `p` for format specification `"%hhd"` must be `byte`, not `char*`
+fail_compilation/chkformat.d(405): Deprecation: argument `p` for format specification `"%hu"` must be `ushort`, not `char*`
+fail_compilation/chkformat.d(406): Deprecation: argument `p` for format specification `"%hd"` must be `short`, not `char*`
+fail_compilation/chkformat.d(407): Deprecation: argument `p` for format specification `"%lu"` must be `$?:windows=uint|32=uint|64=ulong$`, not `char*`
+fail_compilation/chkformat.d(408): Deprecation: argument `p` for format specification `"%ld"` must be `$?:windows=int|32=int|64=long$`, not `char*`
+fail_compilation/chkformat.d(409): Deprecation: argument `p` for format specification `"%llu"` must be `ulong`, not `char*`
+fail_compilation/chkformat.d(410): Deprecation: argument `p` for format specification `"%lld"` must be `long`, not `char*`
+fail_compilation/chkformat.d(411): Deprecation: argument `p` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t`, not `char*`
+fail_compilation/chkformat.d(412): Deprecation: argument `p` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `char*`
+---
+*/
+
+#line 400
+
+void test401() { char* p; printf("%u", p); }
+void test402() { char* p; printf("%d", p); }
+void test403() { char* p; printf("%hhu", p); }
+void test404() { char* p; printf("%hhd", p); }
+void test405() { char* p; printf("%hu", p); }
+void test406() { char* p; printf("%hd", p); }
+void test407() { char* p; printf("%lu", p); }
+void test408() { char* p; printf("%ld", p); }
+void test409() { char* p; printf("%llu", p); }
+void test410() { char* p; printf("%lld", p); }
+void test411() { char* p; printf("%ju", p); }
+void test412() { char* p; printf("%jd", p); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d b/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d
index b8b2f03..ca9ed9a 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d
@@ -2,7 +2,7 @@
TEST_OUTPUT:
---
fail_compilation/cppmangle.d(10): Error: invalid zero length C++ namespace
-fail_compilation/cppmangle.d(14): Error: expected valid identifer for C++ namespace but got `0num`
+fail_compilation/cppmangle.d(14): Error: expected valid identifier for C++ namespace but got `0num`
fail_compilation/cppmangle.d(18): Error: string expected following `,` for C++ namespace, not `)`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d
index 2280691..a5d6a14 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d
@@ -14,7 +14,7 @@ fail_compilation/diag11819b.d(37): Error: unrecognized trait `AllMembers`, did y
fail_compilation/diag11819b.d(38): Error: unrecognized trait `DerivedMembers`, did you mean `derivedMembers`?
fail_compilation/diag11819b.d(39): Error: unrecognized trait `IsSame`, did you mean `isSame`?
fail_compilation/diag11819b.d(40): Error: unrecognized trait `Compiles`, did you mean `compiles`?
-fail_compilation/diag11819b.d(41): Error: unrecognized trait `Parameters`, did you mean `parameters`?
+fail_compilation/diag11819b.d(41): Error: unrecognized trait `Parameters`
fail_compilation/diag11819b.d(42): Error: unrecognized trait `GetAliasThis`, did you mean `getAliasThis`?
fail_compilation/diag11819b.d(43): Error: unrecognized trait `GetAttributes`, did you mean `getAttributes`?
fail_compilation/diag11819b.d(44): Error: unrecognized trait `GetFunctionAttributes`, did you mean `getFunctionAttributes`?
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13082.d b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d
index 13259ce..7360a3df6 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag13082.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d
@@ -1,8 +1,10 @@
/*
TEST_OUTPUT:
---
-fail_compilation/diag13082.d(22): Error: constructor diag13082.C.this (int a) is not callable using argument types (string)
-fail_compilation/diag13082.d(23): Error: constructor diag13082.S.this (int a) is not callable using argument types (string)
+fail_compilation/diag13082.d(24): Error: constructor `diag13082.C.this(int a)` is not callable using argument types `(string)`
+fail_compilation/diag13082.d(24): cannot pass argument `b` of type `string` to parameter `int a`
+fail_compilation/diag13082.d(25): Error: constructor `diag13082.S.this(int a)` is not callable using argument types `(string)`
+fail_compilation/diag13082.d(25): cannot pass argument `b` of type `string` to parameter `int a`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag16271.d b/gcc/testsuite/gdc.test/fail_compilation/diag16271.d
new file mode 100644
index 0000000..b85dc8d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag16271.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT
+---
+fail_compilation/diag16271.d(10): Error: found `x` when expecting function literal following `ref`
+---
+*/
+
+void main()
+{
+ auto fun = ref x;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag16976.d b/gcc/testsuite/gdc.test/fail_compilation/diag16976.d
index ebfb72b..1dbacfd 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag16976.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag16976.d
@@ -1,21 +1,37 @@
/* TEST_OUTPUT:
---
-fail_compilation/diag16976.d(28): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(29): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(30): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(31): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(32): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(33): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(34): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(35): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(36): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(37): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(38): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(39): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(40): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(41): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(42): Error: foreach: key cannot be of non-integral type `float`
-fail_compilation/diag16976.d(43): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(44): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(45): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(46): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(47): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(48): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(49): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(50): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(51): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(52): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(53): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(54): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(55): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(56): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(57): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(58): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(59): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(65): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(66): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(67): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(68): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(69): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(70): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(71): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(72): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(73): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(74): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(75): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(76): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(77): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(78): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(79): Error: foreach: key cannot be of non-integral type `float`
+fail_compilation/diag16976.d(80): Error: foreach: key cannot be of non-integral type `float`
---
*/
@@ -41,4 +57,25 @@ void main()
foreach_reverse(float f, dchar i; sta) {}
foreach_reverse(float f, dchar i; str) {}
foreach_reverse(float f, dchar i; chr) {}
+
+ immutable int[] idyn = [1,2,3,4,5];
+ immutable int[5] ista = [1,2,3,4,5];
+ immutable char[] istr = ['1','2','3','4','5'];
+ immutable char[5] ichr = ['1','2','3','4','5'];
+ static foreach(float f, i; idyn) {}
+ static foreach(float f, i; ista) {}
+ static foreach(float f, i; istr) {}
+ static foreach(float f, i; ichr) {}
+ static foreach(float f, dchar i; idyn) {}
+ static foreach(float f, dchar i; ista) {}
+ static foreach(float f, dchar i; istr) {}
+ static foreach(float f, dchar i; ichr) {}
+ static foreach_reverse(float f, i; idyn) {}
+ static foreach_reverse(float f, i; ista) {}
+ static foreach_reverse(float f, i; istr) {}
+ static foreach_reverse(float f, i; ichr) {}
+ static foreach_reverse(float f, dchar i; idyn) {}
+ static foreach_reverse(float f, dchar i; ista) {}
+ static foreach_reverse(float f, dchar i; istr) {}
+ static foreach_reverse(float f, dchar i; ichr) {}
}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag19196.d b/gcc/testsuite/gdc.test/fail_compilation/diag19196.d
new file mode 100644
index 0000000..857f9a4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag19196.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag19196.d(11): Error: unable to determine fields of `B` because of forward references
+fail_compilation/diag19196.d(15): Error: template instance `diag19196.Foo!(B)` error instantiating
+---
+*/
+module diag19196;
+struct Foo(T)
+{
+ alias F = typeof(T.tupleof);
+}
+struct B
+{
+ Foo!B b;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d
index 6fc3809..3b2401a 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d
@@ -1,29 +1,30 @@
/*
TEST_OUTPUT:
---
-fail_compilation/diag8101.d(56): Error: function diag8101.f_0 (int) is not callable using argument types ()
-fail_compilation/diag8101.d(57): Error: none of the overloads of 'f_1' are callable using argument types (), candidates are:
-fail_compilation/diag8101.d(32): diag8101.f_1(int)
-fail_compilation/diag8101.d(33): diag8101.f_1(int, int)
-fail_compilation/diag8101.d(58): Error: none of the overloads of 'f_2' are callable using argument types (), candidates are:
-fail_compilation/diag8101.d(35): diag8101.f_2(int)
-fail_compilation/diag8101.d(36): diag8101.f_2(int, int)
-fail_compilation/diag8101.d(37): diag8101.f_2(int, int, int)
-fail_compilation/diag8101.d(38): diag8101.f_2(int, int, int, int)
-fail_compilation/diag8101.d(39): diag8101.f_2(int, int, int, int, int)
-fail_compilation/diag8101.d(58): ... (1 more, -v to show) ...
-fail_compilation/diag8101.d(60): Error: template diag8101.t_0 cannot deduce function from argument types !()(), candidates are:
-fail_compilation/diag8101.d(42): diag8101.t_0(T1)()
-fail_compilation/diag8101.d(61): Error: template diag8101.t_1 cannot deduce function from argument types !()(), candidates are:
-fail_compilation/diag8101.d(44): diag8101.t_1(T1)()
-fail_compilation/diag8101.d(45): diag8101.t_1(T1, T2)()
-fail_compilation/diag8101.d(62): Error: template diag8101.t_2 cannot deduce function from argument types !()(), candidates are:
-fail_compilation/diag8101.d(47): diag8101.t_2(T1)()
-fail_compilation/diag8101.d(48): diag8101.t_2(T1, T2)()
-fail_compilation/diag8101.d(49): diag8101.t_2(T1, T2, T3)()
-fail_compilation/diag8101.d(50): diag8101.t_2(T1, T2, T3, T4)()
-fail_compilation/diag8101.d(51): diag8101.t_2(T1, T2, T3, T4, T5)()
-fail_compilation/diag8101.d(62): ... (1 more, -v to show) ...
+fail_compilation/diag8101.d(57): Error: function `diag8101.f_0(int)` is not callable using argument types `()`
+fail_compilation/diag8101.d(57): missing argument for parameter #1: `int`
+fail_compilation/diag8101.d(58): Error: none of the overloads of `f_1` are callable using argument types `()`, candidates are:
+fail_compilation/diag8101.d(33): `diag8101.f_1(int)`
+fail_compilation/diag8101.d(34): `diag8101.f_1(int, int)`
+fail_compilation/diag8101.d(59): Error: none of the overloads of `f_2` are callable using argument types `()`, candidates are:
+fail_compilation/diag8101.d(36): `diag8101.f_2(int)`
+fail_compilation/diag8101.d(37): `diag8101.f_2(int, int)`
+fail_compilation/diag8101.d(38): `diag8101.f_2(int, int, int)`
+fail_compilation/diag8101.d(39): `diag8101.f_2(int, int, int, int)`
+fail_compilation/diag8101.d(40): `diag8101.f_2(int, int, int, int, int)`
+fail_compilation/diag8101.d(59): ... (1 more, -v to show) ...
+fail_compilation/diag8101.d(61): Error: template `diag8101.t_0` cannot deduce function from argument types `!()()`, candidates are:
+fail_compilation/diag8101.d(43): `diag8101.t_0(T1)()`
+fail_compilation/diag8101.d(62): Error: template `diag8101.t_1` cannot deduce function from argument types `!()()`, candidates are:
+fail_compilation/diag8101.d(45): `diag8101.t_1(T1)()`
+fail_compilation/diag8101.d(46): `diag8101.t_1(T1, T2)()`
+fail_compilation/diag8101.d(63): Error: template `diag8101.t_2` cannot deduce function from argument types `!()()`, candidates are:
+fail_compilation/diag8101.d(48): `diag8101.t_2(T1)()`
+fail_compilation/diag8101.d(49): `diag8101.t_2(T1, T2)()`
+fail_compilation/diag8101.d(50): `diag8101.t_2(T1, T2, T3)()`
+fail_compilation/diag8101.d(51): `diag8101.t_2(T1, T2, T3, T4)()`
+fail_compilation/diag8101.d(52): `diag8101.t_2(T1, T2, T3, T4, T5)()`
+fail_compilation/diag8101.d(63): ... (1 more, -v to show) ...
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d
index a3baa27..228ba16 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d
@@ -1,14 +1,15 @@
/*
TEST_OUTPUT:
---
-fail_compilation/diag8101b.d(26): Error: none of the overloads of 'foo' are callable using argument types (double), candidates are:
-fail_compilation/diag8101b.d(17): diag8101b.S.foo(int _param_0)
-fail_compilation/diag8101b.d(18): diag8101b.S.foo(int _param_0, int _param_1)
-fail_compilation/diag8101b.d(28): Error: function diag8101b.S.bar (int _param_0) is not callable using argument types (double)
-fail_compilation/diag8101b.d(31): Error: none of the overloads of 'foo' are callable using a const object, candidates are:
-fail_compilation/diag8101b.d(17): diag8101b.S.foo(int _param_0)
-fail_compilation/diag8101b.d(18): diag8101b.S.foo(int _param_0, int _param_1)
-fail_compilation/diag8101b.d(33): Error: mutable method diag8101b.S.bar is not callable using a const object
+fail_compilation/diag8101b.d(27): Error: none of the overloads of `foo` are callable using argument types `(double)`, candidates are:
+fail_compilation/diag8101b.d(18): `diag8101b.S.foo(int _param_0)`
+fail_compilation/diag8101b.d(19): `diag8101b.S.foo(int _param_0, int _param_1)`
+fail_compilation/diag8101b.d(29): Error: function `diag8101b.S.bar(int _param_0)` is not callable using argument types `(double)`
+fail_compilation/diag8101b.d(29): cannot pass argument `1.00000` of type `double` to parameter `int _param_0`
+fail_compilation/diag8101b.d(32): Error: none of the overloads of `foo` are callable using a `const` object, candidates are:
+fail_compilation/diag8101b.d(18): `diag8101b.S.foo(int _param_0)`
+fail_compilation/diag8101b.d(19): `diag8101b.S.foo(int _param_0, int _param_1)`
+fail_compilation/diag8101b.d(34): Error: mutable method `diag8101b.S.bar` is not callable using a `const` object
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9420.d b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d
index dfaf7c8..6b2577d 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag9420.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT
---
-fail_compilation/diag9420.d(20): Error: function diag9420.S.t3!().tx () is not callable using argument types (int)
+fail_compilation/diag9420.d(21): Error: function `diag9420.S.t3!().tx()` is not callable using argument types `(int)`
+fail_compilation/diag9420.d(21): expected 0 argument(s), not 1
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/enum_init.d b/gcc/testsuite/gdc.test/fail_compilation/enum_init.d
new file mode 100644
index 0000000..ab6ba30
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/enum_init.d
@@ -0,0 +1,171 @@
+/*
+https://issues.dlang.org/show_bug.cgi?id=8511
+
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(5): Error: type `SQRTMAX` has no value
+---
+*/
+#line 1
+
+real hypot()
+{
+ enum SQRTMAX;
+ SQRTMAX/2;
+}
+
+/*
+https://issues.dlang.org/show_bug.cgi?id=21785
+
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(106): Error: enum `enum_init.NoBase` is opaque and has no default initializer
+---
+*/
+#line 100
+
+enum NoBase;
+
+void fooNB()
+{
+ NoBase nbv = void;
+ NoBase nb;
+}
+
+/*
+https://issues.dlang.org/show_bug.cgi?id=21785
+
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(206): Error: enum `enum_init.Xobj` is opaque and has no default initializer
+---
+*/
+#line 200
+
+enum Xobj : void*;
+
+void main()
+{
+ Xobj vv = void;
+ Xobj var;
+}
+
+
+/*
+https://issues.dlang.org/show_bug.cgi?id=21785
+
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(306): Error: variable `enum_init.fooOB.ob` no definition of struct `S`
+fail_compilation/enum_init.d(302): required by type `OpaqueBase`
+---
+*/
+#line 300
+
+struct S;
+enum OpaqueBase : S;
+
+void fooOB()
+{
+ OpaqueBase ob;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(405): Error: enum `enum_init.forwardRef.Foo` forward reference of `Foo.init`
+---
+*/
+#line 400
+
+void forwardRef()
+{
+ enum Foo
+ {
+ a = Foo.init
+ }
+}
+
+/*
+https://issues.dlang.org/show_bug.cgi?id=21792
+
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(503): Error: circular reference to enum base type `Bar`
+---
+*/
+#line 500
+
+void forwardRef2()
+{
+ enum Bar : Bar
+ {
+ a
+ }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(606): Error: enum member `enum_init.forwardRef3.Foo.b` is forward referenced looking for `.min`
+fail_compilation/enum_init.d(607): Error: enum member `enum_init.forwardRef3.Foo.c` is forward referenced looking for `.min`
+---
+*/
+#line 600
+
+void forwardRef3()
+{
+ enum Foo
+ {
+ a,
+ b = Foo.min,
+ c
+ }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(711): Error: circular reference to enum base type `int[Bar.sizeof]`
+---
+*/
+#line 700
+
+void forwardRef4()
+{
+ enum Foo
+ {
+ a = Foo.sizeof,
+ c
+ }
+ // pragma(msg, typeof(Foo.sizeof));
+ // static assert(is(Foo Base == enum) && is(Base == int));
+
+ enum Bar : int[Bar.sizeof]
+ {
+ a
+ }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/enum_init.d(809): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no default initializer
+fail_compilation/enum_init.d(810): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no `.min`
+fail_compilation/enum_init.d(811): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no `.max`
+---
+*/
+#line 800
+
+void opaqueProperties()
+{
+ enum Foo;
+
+ // Valid
+ enum size = Foo.sizeof;
+ enum s = Foo.mangleof;
+
+ Foo f = Foo.init;
+ int min = Foo.min;
+ int max = Foo.max;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail109.d b/gcc/testsuite/gdc.test/fail_compilation/fail109.d
index 4fd5321..3e379c3 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail109.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail109.d
@@ -53,10 +53,10 @@ enum B
/* Bugzilla 11849
TEST_OUTPUT:
---
-fail_compilation/fail109.d(72): Error: enum fail109.RegValueType1a recursive definition of `.max` property
-fail_compilation/fail109.d(79): Error: enum fail109.RegValueType1b recursive definition of `.max` property
-fail_compilation/fail109.d(84): Error: enum fail109.RegValueType2a recursive definition of `.min` property
-fail_compilation/fail109.d(91): Error: enum fail109.RegValueType2b recursive definition of `.min` property
+fail_compilation/fail109.d(72): Error: enum member `fail109.RegValueType1a.Unknown` is forward referenced looking for `.max`
+fail_compilation/fail109.d(79): Error: enum member `fail109.RegValueType1b.Unknown` is forward referenced looking for `.max`
+fail_compilation/fail109.d(84): Error: enum member `fail109.RegValueType2a.Unknown` is forward referenced looking for `.min`
+fail_compilation/fail109.d(91): Error: enum member `fail109.RegValueType2b.Unknown` is forward referenced looking for `.min`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11038.d b/gcc/testsuite/gdc.test/fail_compilation/fail11038.d
new file mode 100644
index 0000000..8f39ccc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11038.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=11038
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11038.d(16): Error: `writeln` is not defined, perhaps `import std.stdio;` is needed?
+---
+*/
+
+static
+{
+ import std.stdio;
+}
+
+void main()
+{
+ writeln("foo"); // compiles
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11445.d b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d
index a3cfc11..ed3f226 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail11445.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail11445.d(11): Error: incompatible types for ((a) + (b)): 'double[string]' and 'double[string]'
+fail_compilation/fail11445.d(11): Error: incompatible types for ((a) + (b)): both operands are of type 'double[string]'
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail117.d b/gcc/testsuite/gdc.test/fail_compilation/fail117.d
index f39a48d..9279d54 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail117.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail117.d
@@ -1,8 +1,10 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail117.d(35): Error: expression has no value
-fail_compilation/fail117.d(36): Error: expression has no value
+fail_compilation/fail117.d(37): Error: expression `foo.mixin MGettor!(a) geta;
+` is `void` and has no value
+fail_compilation/fail117.d(38): Error: expression `foo.mixin MGettor!(b) getb;
+` is `void` and has no value
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15361.d b/gcc/testsuite/gdc.test/fail_compilation/fail15361.d
new file mode 100644
index 0000000..8e5f980
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15361.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail15361.d(8): Error: unexpected `(` after `errorize`, inside `is` expression. Try enclosing the contents of `is` with a `typeof` expression
+---
+*/
+
+enum isErrorizable(T) = is(errorize(T.init));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15896.d b/gcc/testsuite/gdc.test/fail_compilation/fail15896.d
new file mode 100644
index 0000000..e52503d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15896.d
@@ -0,0 +1,18 @@
+// REQUIRED_ARGS: -de
+// EXTRA_FILES: imports/imp15896.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail15896.d(11): Error: module `imports.imp15896` member `thebar` is not visible from module `fail15896`
+fail_compilation/fail15896.d(11): Error: module `imports.imp15896` member `packagebar` is not visible from module `fail15896`
+---
+*/
+
+import imports.imp15896 : thebar, packagebar;
+
+int func()
+{
+ thebar +=1;
+ packagebar += 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17630.d b/gcc/testsuite/gdc.test/fail_compilation/fail17630.d
new file mode 100644
index 0000000..9b6ed82
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17630.d
@@ -0,0 +1,15 @@
+// REQUIRED_ARGS: -de
+// EXTRA_FILES: imports/a17630.d
+// EXTRA_SOURCES: imports/b17630.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail17630.d(13): Error: module `a17630` import `Erase` not found, did you mean variable `b17630.Erase`?
+---
+*/
+
+void main()
+{
+ import imports.a17630 : Erase;
+ assert(Erase == 2);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail18219.d b/gcc/testsuite/gdc.test/fail_compilation/fail18219.d
new file mode 100644
index 0000000..f3ec680
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail18219.d
@@ -0,0 +1,20 @@
+// EXTRA_SOURCES: imports/b18219.d
+// EXTRA_FILES: imports/a18219.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail18219.d(16): Error: no property `Foobar` for type `AST`, did you mean `b18219.Foobar`?
+fail_compilation/fail18219.d(17): Error: no property `Bar` for type `a18219.AST`
+fail_compilation/fail18219.d(18): Error: no property `fun` for type `AST`, did you mean `b18219.fun`?
+fail_compilation/fail18219.d(19): Error: no property `Foobar` for type `AST`, did you mean `b18219.Foobar`?
+---
+*/
+import imports.a18219;
+
+void main()
+{
+ AST.Foobar t;
+ AST.Bar l;
+ AST.fun();
+ AST.Foobar.smeth();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19107.d b/gcc/testsuite/gdc.test/fail_compilation/fail19107.d
new file mode 100644
index 0000000..c748650
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail19107.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test19107.d(20): Error: template `test19107.all` cannot deduce function from argument types `!((c) => c)(string[])`, candidates are:
+fail_compilation/test19107.d(14): `test19107.all(alias pred, T)(T t) if (is(typeof(I!pred(t))))`
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=19107
+
+import imports.test19107b;
+
+void all(alias pred, T)(T t)
+ if (is(typeof(I!pred(t))))
+{ }
+
+void main(string[] args)
+{
+ args.all!(c => c);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22006.d b/gcc/testsuite/gdc.test/fail_compilation/fail22006.d
new file mode 100644
index 0000000..89bbc28
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail22006.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail22006.d(15): Error: cannot implicitly convert expression `4$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `bool`
+fail_compilation/fail22006.d(16): Error: index type `bool` cannot cover index range 0..4
+fail_compilation/fail22006.d(19): Error: cannot implicitly convert expression `4$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `bool`
+fail_compilation/fail22006.d(20): Error: index type `bool` cannot cover index range 0..4
+---
+*/
+void test22006()
+{
+ alias AliasSeq(TList...) = TList;
+ {
+ alias aseq = AliasSeq!(0, 1, 2, 3);
+ static foreach (bool i; 0 .. aseq.length) {}
+ static foreach (bool i, x; aseq) {}
+ }
+ {
+ static foreach (bool i; 0 .. [0, 1, 2, 3].length) {}
+ static foreach (bool i, x; [0, 1, 2, 3]) {}
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22133.d b/gcc/testsuite/gdc.test/fail_compilation/fail22133.d
new file mode 100644
index 0000000..338d96d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail22133.d
@@ -0,0 +1,24 @@
+// https://issues.dlang.org/show_bug.cgi?id=22133
+/*
+TEST_OUTPUT
+---
+fail_compilation/fail22133.d(16): Error: `s.popFront()()` has no effect
+fail_compilation/fail22133.d(17): Error: template `s.popFront()()` has no type
+---
+*/
+struct Slice
+{
+ void popFront()() {}
+}
+
+auto fail22133(const Slice s)
+{
+ s.popFront;
+ return s.popFront;
+}
+
+auto ok22133(Slice s)
+{
+ s.popFront;
+ return s.popFront;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22144.d b/gcc/testsuite/gdc.test/fail_compilation/fail22144.d
new file mode 100644
index 0000000..e0fd5b1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail22144.d
@@ -0,0 +1,14 @@
+// https://issues.dlang.org/show_bug.cgi?id=22144
+/* TEST_OUTPUT
+---
+fail_compilation/fail22144.d(12): Error: cannot cast expression `zarray1` of type `int[0]` to `int[0][]` since sizes don't line up
+---
+*/
+void main()
+{
+ int[0] zarray1;
+ int[0][0] zarray2;
+
+ auto zslice1 = cast(int[0][])zarray1; // ICE -> Error
+ auto zslice2 = cast(int[0][])zarray2; // ICE -> OK
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d b/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d
index cb565ba..a312dc0 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d
@@ -3,10 +3,10 @@
TEST_OUTPUT:
---
fail_compilation/fail238_m32.d(21): Error: cannot implicitly convert expression `"a"` of type `string` to `uint`
-fail_compilation/fail238_m32.d(24): Error: cannot interpret X!() at compile time
-fail_compilation/fail238_m32.d(29): Error: template instance fail238_m32.A!"a" error instantiating
-fail_compilation/fail238_m32.d(35): instantiated from here: M!(q)
-fail_compilation/fail238_m32.d(35): while evaluating pragma(msg, M!(q))
+fail_compilation/fail238_m32.d(24): Error: cannot implicitly convert expression `X!()` of type `void` to `const(string)`
+fail_compilation/fail238_m32.d(29): Error: template instance `fail238_m32.A!"a"` error instantiating
+fail_compilation/fail238_m32.d(35): instantiated from here: `M!(q)`
+fail_compilation/fail238_m32.d(35): while evaluating `pragma(msg, M!(q))`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d b/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d
index 08837b2..dc7a50e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d
@@ -3,10 +3,10 @@
TEST_OUTPUT:
---
fail_compilation/fail238_m64.d(21): Error: cannot implicitly convert expression `"a"` of type `string` to `ulong`
-fail_compilation/fail238_m64.d(24): Error: cannot interpret X!() at compile time
-fail_compilation/fail238_m64.d(29): Error: template instance fail238_m64.A!"a" error instantiating
-fail_compilation/fail238_m64.d(35): instantiated from here: M!(q)
-fail_compilation/fail238_m64.d(35): while evaluating pragma(msg, M!(q))
+fail_compilation/fail238_m64.d(24): Error: cannot implicitly convert expression `X!()` of type `void` to `const(string)`
+fail_compilation/fail238_m64.d(29): Error: template instance `fail238_m64.A!"a"` error instantiating
+fail_compilation/fail238_m64.d(35): instantiated from here: `M!(q)`
+fail_compilation/fail238_m64.d(35): while evaluating `pragma(msg, M!(q))`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail263.d b/gcc/testsuite/gdc.test/fail_compilation/fail263.d
index f7dfe21..8cf9b20 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail263.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail263.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail263.d(18): Error: function fail263.f (byte* p) is not callable using argument types (const(byte)*)
+fail_compilation/fail263.d(19): Error: function `fail263.f(byte* p)` is not callable using argument types `(const(byte)*)`
+fail_compilation/fail263.d(19): cannot pass argument `cast(const(byte)*)A` of type `const(byte)*` to parameter `byte* p`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3.d b/gcc/testsuite/gdc.test/fail_compilation/fail3.d
index 332e561..0b7516c 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail3.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail3.d(40): Error: incompatible types for ((a) + (b)): 'vec2' and 'vec2'
+fail_compilation/fail3.d(41): Error: incompatible types for ((a) + (b)): both operands are of type 'vec2'
---
*/
@@ -14,6 +14,7 @@ template vector(T)
T x, y;
}
+ // not struct member
vec2 opAdd(vec2 a, vec2 b)
{
vec2 r;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail322.d b/gcc/testsuite/gdc.test/fail_compilation/fail322.d
index 0ffa15a..491111f 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail322.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail322.d
@@ -1,13 +1,18 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail322.d(10): Error: function fail322.digestToString2 (ref char[16] digest) is not callable using argument types (string)
+fail_compilation/fail322.d(13): Error: function `fail322.digestToString2(ref char[16] digest)` is not callable using argument types `(string)`
+fail_compilation/fail322.d(13): cannot pass rvalue argument `"1234567890123456"` of type `string` to parameter `ref char[16] digest`
+fail_compilation/fail322.d(15): Error: function `fail322.digestToString2(ref char[16] digest)` is not callable using argument types `(const(char[16]))`
+fail_compilation/fail322.d(15): cannot pass argument `s` of type `const(char[16])` to parameter `ref char[16] digest`
---
*/
void main()
{
digestToString2("1234567890123456");
+ const char[16] s;
+ digestToString2(s);
}
void digestToString2(ref char[16] digest)
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail332.d b/gcc/testsuite/gdc.test/fail_compilation/fail332.d
index 03f3706..91f8046 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail332.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail332.d
@@ -1,15 +1,56 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail332.d(14): Error: function fail332.foo (int _param_0, ...) is not callable using argument types ()
+fail_compilation/fail332.d(22): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `()`
+fail_compilation/fail332.d(22): missing argument for parameter #1: `int _param_0`
+fail_compilation/fail332.d(23): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `(typeof(null))`
+fail_compilation/fail332.d(23): cannot pass argument `null` of type `typeof(null)` to parameter `int _param_0`
+fail_compilation/fail332.d(25): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(string)`
+fail_compilation/fail332.d(25): cannot pass argument `""` of type `string` to parameter `int[] _param_0...`
+fail_compilation/fail332.d(26): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(int, typeof(null))`
+fail_compilation/fail332.d(26): cannot pass argument `null` of type `typeof(null)` to parameter `int[] _param_0...`
---
*/
import core.vararg;
void foo(int, ...) {}
+void baz(int[]...) {}
-void bar()
+void test()
{
foo();
+ foo(null);
+
+ baz("");
+ baz(3, null);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail332.d(50): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `()`
+fail_compilation/fail332.d(50): missing argument for parameter #1: `Object`
+fail_compilation/fail332.d(51): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(int)`
+fail_compilation/fail332.d(51): cannot pass argument `4` of type `int` to parameter `Object`
+fail_compilation/fail332.d(52): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null))`
+fail_compilation/fail332.d(52): expected 2 variadic argument(s), not 0
+fail_compilation/fail332.d(53): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int)`
+fail_compilation/fail332.d(53): expected 2 variadic argument(s), not 1
+fail_compilation/fail332.d(54): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, string)`
+fail_compilation/fail332.d(54): cannot pass argument `""` of type `string` to parameter `int[2]...`
+fail_compilation/fail332.d(55): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, int, int)`
+fail_compilation/fail332.d(55): expected 2 variadic argument(s), not 3
+---
+*/
+void bar(Object, int[2]...);
+
+void test2()
+{
+ bar();
+ bar(4);
+ bar(null);
+ bar(null, 2);
+ bar(null, 2, "");
+ bar(null, 2,3,4);
}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail347.d b/gcc/testsuite/gdc.test/fail_compilation/fail347.d
index 03ae703..61718df 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail347.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail347.d
@@ -2,7 +2,7 @@
TEST_OUTPUT:
---
fail_compilation/fail347.d(21): Error: undefined identifier `bbr`, did you mean variable `bar`?
-fail_compilation/fail347.d(22): Error: no property 'ofo' for type 'S', did you mean 'foo'?
+fail_compilation/fail347.d(22): Error: no property 'ofo' for type 'S', did you mean 'fail347.S.foo'?
fail_compilation/fail347.d(23): Error: undefined identifier `strlenx`, did you mean function `strlen`?
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail53.d b/gcc/testsuite/gdc.test/fail_compilation/fail53.d
index 2570dd8..556896c 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail53.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail53.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail53.d(25): Error: function object.Object.opEquals (Object o) is not callable using argument types (int)
+fail_compilation/fail53.d(26): Error: function `object.Object.opEquals(Object o)` is not callable using argument types `(int)`
+fail_compilation/fail53.d(26): cannot pass argument `i` of type `int` to parameter `Object o`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail55.d b/gcc/testsuite/gdc.test/fail_compilation/fail55.d
index 57117d8..290c2b66 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail55.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail55.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail55.d(22): Error: function object.Object.opCmp (Object o) is not callable using argument types (int)
+fail_compilation/fail55.d(23): Error: function `object.Object.opCmp(Object o)` is not callable using argument types `(int)`
+fail_compilation/fail55.d(23): cannot pass argument `0` of type `int` to parameter `Object o`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d
index 1a7e092..c3fc311 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424b.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424b.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424b
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d
index 1c06540..220c995 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424c.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424c.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424c
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d
index d784a75..669c9ff 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424d.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424d.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424d
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d
index 3bf3a2d..18bf414 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424e.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424e.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424e
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d
index 266163d..29e0ecc 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424f.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424f.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424f
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d
index aca6586..b4670de 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424g.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424g.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424g
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d
index e08eac1..b76f5b3 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424h.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424h.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424g
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d
index 1c2cb1c..887c859 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail7424i.d(10): Error: cannot resolve type for this.g()()
+fail_compilation/fail7424i.d(10): Error: template `this.g()()` has no value
---
*/
struct S7424g
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail79.d b/gcc/testsuite/gdc.test/fail_compilation/fail79.d
index 46581d9..da06984 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail79.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail79.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail79.d(13): Error: incompatible types for ((& a) + (& b)): 'int*' and 'int*'
+fail_compilation/fail79.d(13): Error: incompatible types for ((& a) + (& b)): both operands are of type 'int*'
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9766.d b/gcc/testsuite/gdc.test/fail_compilation/fail9766.d
index d75d1bc..58cabe3 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail9766.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9766.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail9766.d(14): Error: cannot interpret Foo!int at compile time
+fail_compilation/fail9766.d(14): Error: integer constant expression expected instead of `Foo!int`
+fail_compilation/fail9766.d(14): Error: alignment must be an integer positive power of 2, not Foo!int
fail_compilation/fail9766.d(17): Error: alignment must be an integer positive power of 2, not -1
fail_compilation/fail9766.d(20): Error: alignment must be an integer positive power of 2, not 0
fail_compilation/fail9766.d(23): Error: alignment must be an integer positive power of 2, not 3
@@ -9,6 +10,7 @@ fail_compilation/fail9766.d(26): Error: alignment must be an integer positive po
---
*/
+#line 12
template Foo(T) {}
align(Foo!int)
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail99.d b/gcc/testsuite/gdc.test/fail_compilation/fail99.d
index da87ed6..c147b81 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail99.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail99.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail99.d(12): Error: delegate dg (int) is not callable using argument types ()
+fail_compilation/fail99.d(13): Error: delegate `dg(int)` is not callable using argument types `()`
+fail_compilation/fail99.d(13): missing argument for parameter #1: `int`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix21585.d b/gcc/testsuite/gdc.test/fail_compilation/fix21585.d
new file mode 100644
index 0000000..48c74cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fix21585.d
@@ -0,0 +1,19 @@
+/* https://issues.dlang.org/show_bug.cgi?id=21585
+TEST_OUTPUT:
+---
+fail_compilation/fix21585.d(103): Error: expected 1 arguments for `toType` but had 0
+fail_compilation/fix21585.d(104): Error: expression expected as second argument of __traits `toType`
+fail_compilation/fix21585.d(105): Error: `string` expected for __traits(toType, string), not `(1)` of type `int`
+fail_compilation/fix21585.d(106): Error: cannot determine `__traits(toType, "hello betty")`
+---
+*/
+
+#line 100
+
+template Type(T) { alias Type = T; }
+
+alias T1 = Type!(__traits(toType));
+alias T2 = Type!(__traits(toType, int));
+alias T3 = Type!(__traits(toType, 1));
+alias T4 = Type!(__traits(toType, "hello betty"));
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/format.d b/gcc/testsuite/gdc.test/fail_compilation/format.d
new file mode 100644
index 0000000..3a24227
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/format.d
@@ -0,0 +1,44 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/format.d(101): Error: function `format.printf1` `pragma(printf)` functions must be `extern(C) void printf1([parameters...], const(char)*, ...)` not `void(const(char)*, ...)`
+fail_compilation/format.d(102): Error: function `format.printf2` `pragma(printf)` functions must be `extern(C) int printf2([parameters...], const(char)*, ...)` not `extern (C) int(const(int)*, ...)`
+fail_compilation/format.d(103): Error: function `format.printf3` `pragma(printf)` functions must be `extern(C) int printf3([parameters...], const(char)*, va_list)`
+fail_compilation/format.d(104): Error: function `format.printf4` `pragma(printf)` functions must be `extern(C) int printf4([parameters...], const(char)*, ...)` not `extern (C) int(const(char)*, int, ...)`
+---
+ */
+
+#line 100
+
+pragma(printf) void printf1(const(char)*, ...);
+pragma(printf) extern (C) int printf2(const(int )*, ...);
+pragma(printf) extern (C) int printf3(const(char)*);
+pragma(printf) extern (C) int printf4(const(char)*, int, ...);
+
+pragma(printf) extern (C) int printf5(const(char)*, ...);
+pragma(printf) extern (C) int printf6(immutable(char)*, ...);
+pragma(printf) extern (C) int printf7(char*, ...);
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/format.d(203): Error: function `format.vprintf1` `pragma(printf)` functions must be `extern(C) void vprintf1([parameters...], const(char)*, va_list)`
+fail_compilation/format.d(204): Error: function `format.vprintf2` `pragma(printf)` functions must be `extern(C) int vprintf2([parameters...], const(char)*, va_list)`
+fail_compilation/format.d(205): Error: function `format.vprintf3` `pragma(printf)` functions must be `extern(C) int vprintf3([parameters...], const(char)*, va_list)`
+fail_compilation/format.d(206): Error: function `format.vprintf4` `pragma(printf)` functions must be `extern(C) int vprintf4([parameters...], const(char)*, va_list)`
+---
+ */
+
+#line 200
+
+import core.stdc.stdarg;
+
+pragma(printf) void vprintf1(const(char)*, va_list);
+pragma(printf) extern (C) int vprintf2(const(int )*, va_list);
+pragma(printf) extern (C) int vprintf3(const(char)*);
+pragma(printf) extern (C) int vprintf4(const(char)*, int, va_list);
+
+pragma(printf) extern (C) int vprintf5(const(char)*, va_list);
+pragma(printf) extern (C) int vprintf6(immutable(char)*, va_list);
+pragma(printf) extern (C) int vprintf7(char*, va_list);
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10598.d b/gcc/testsuite/gdc.test/fail_compilation/ice10598.d
new file mode 100644
index 0000000..ba6cdf7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10598.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -de
+// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d
+/* TEST_OUTPUT:
+---
+fail_compilation/imports/ice10598a.d(5): Deprecation: module imports.ice10598b is not accessible here, perhaps add 'static import imports.ice10598b;'
+fail_compilation/imports/ice10598a.d(5): Deprecation: module imports.ice10598b is not accessible here, perhaps add 'static import imports.ice10598b;'
+---
+*/
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10770.d b/gcc/testsuite/gdc.test/fail_compilation/ice10770.d
deleted file mode 100644
index 5b0659a..0000000
--- a/gcc/testsuite/gdc.test/fail_compilation/ice10770.d
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/ice10770.d(13): Error: enum ice10770.E2 is forward referenced looking for base type
-fail_compilation/ice10770.d(13): while evaluating: `static assert(is(E2 e == enum))`
----
-*/
-
-enum E1 : int;
-static assert(is(E1 e == enum) && is(e == int));
-
-enum E2;
-static assert(is(E2 e == enum));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d
index 1ddad18..9eeb622 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/ice10922.d(9): Error: function ice10922.__lambda4 (const(uint) n) is not callable using argument types ()
+fail_compilation/ice10922.d(10): Error: function `ice10922.__lambda4(const(uint) n)` is not callable using argument types `()`
+fail_compilation/ice10922.d(10): missing argument for parameter #1: `const(uint) n`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12497.d b/gcc/testsuite/gdc.test/fail_compilation/ice12497.d
deleted file mode 100644
index ab95e81..0000000
--- a/gcc/testsuite/gdc.test/fail_compilation/ice12497.d
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/ice12497.d(15): Error: string expected for argument to mixin, not (foo()) of type void
-fail_compilation/ice12497.d(17): Error: string expected for argument to mixin, not (foo()) of type void
----
-*/
-
-void foo() {}
-
-void main()
-{
- struct S
- {
- mixin(foo()); // MixinDeclaration
- }
- mixin(foo()); // MixinStatement
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12501.d b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d
index f57980d..2c45c8a 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice12501.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d
@@ -1,9 +1,11 @@
/*
TEST_OUTPUT:
---
-fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int)
-fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int)
-fail_compilation/ice12501.d(43): Error: template instance ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[]) error instantiating
+fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)`
+fail_compilation/ice12501.d(31): expected 1 argument(s), not 2
+fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)`
+fail_compilation/ice12501.d(31): expected 1 argument(s), not 2
+fail_compilation/ice12501.d(45): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14907.d b/gcc/testsuite/gdc.test/fail_compilation/ice14907.d
new file mode 100644
index 0000000..6d9edf0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14907.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14907.d(14): Error: struct ice14907.S(int v = S) recursive template expansion
+fail_compilation/ice14907.d(19): while looking for match for `S!()`
+fail_compilation/ice14907.d(15): Error: template ice14907.f(int v = f)() recursive template expansion
+fail_compilation/ice14907.d(20): while looking for match for `f!()`
+fail_compilation/ice14907.d(15): Error: template ice14907.f(int v = f)() recursive template expansion
+fail_compilation/ice14907.d(21): Error: template `ice14907.f` cannot deduce function from argument types `!()()`, candidates are:
+fail_compilation/ice14907.d(15): `ice14907.f(int v = f)()`
+---
+*/
+
+struct S(int v = S) {}
+void f(int v = f)() {}
+
+void main()
+{
+ S!() s; // OK <- ICE
+ f!()(); // OK <- ICE
+ f(); // OK <- ICE
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14923.d b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d
index 86e3b2a..e3b677e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice14923.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d
@@ -1,8 +1,9 @@
/*
TEST_OUTPUT:
---
-fail_compilation/ice14923.d(21): Error: function ice14923.parse (C a) is not callable using argument types (A)
-fail_compilation/ice14923.d(21): instantiated from here: bar!((b) => parse(b))
+fail_compilation/ice14923.d(22): Error: function `ice14923.parse(C a)` is not callable using argument types `(A)`
+fail_compilation/ice14923.d(22): cannot pass argument `b` of type `ice14923.A` to parameter `C a`
+fail_compilation/ice14923.d(22): instantiated from here: `bar!((b) => parse(b))`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8255.d b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d
index d98e38a..0db3abc 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice8255.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d
@@ -1,8 +1,9 @@
/*
TEST_OUTPUT:
---
-fail_compilation/ice8255.d(10): Error: function ice8255.F!(G).F.f (ref G _param_0) is not callable using argument types (G)
-fail_compilation/ice8255.d(10): while evaluating pragma(msg, F().f(G()))
+fail_compilation/ice8255.d(11): Error: function `ice8255.F!(G).F.f(ref G _param_0)` is not callable using argument types `(G)`
+fail_compilation/ice8255.d(11): cannot pass rvalue argument `G()` of type `G` to parameter `ref G _param_0`
+fail_compilation/ice8255.d(11): while evaluating `pragma(msg, F().f(G()))`
---
*/
struct G {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8511.d b/gcc/testsuite/gdc.test/fail_compilation/ice8511.d
deleted file mode 100644
index 873f896..0000000
--- a/gcc/testsuite/gdc.test/fail_compilation/ice8511.d
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/ice8511.d(11): Error: enum ice8511.hypot.SQRTMAX is forward referenced looking for base type
-fail_compilation/ice8511.d(12): Error: incompatible types for ((SQRTMAX) / (2)): cannot use '/' with types
----
-*/
-
-real hypot()
-{
- enum SQRTMAX;
- SQRTMAX/2;
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9406.d b/gcc/testsuite/gdc.test/fail_compilation/ice9406.d
index d8c0837..c1807a0 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice9406.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9406.d
@@ -1,7 +1,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/ice9406.d(21): Error: expression has no value
+fail_compilation/ice9406.d(22): Error: `s1.mixin Mixin!() t1;
+` has no effect
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d
index d6c9cda..f95cb97 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d
@@ -1,8 +1,9 @@
/*
TEST_OUTPUT:
---
-fail_compilation/ice9540.d(34): Error: function ice9540.A.test.AddFront!(this, f).AddFront.dg (int _param_0) is not callable using argument types ()
-fail_compilation/ice9540.d(25): Error: template instance ice9540.A.test.AddFront!(this, f) error instantiating
+fail_compilation/ice9540.d(35): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()`
+fail_compilation/ice9540.d(35): missing argument for parameter #1: `int _param_0`
+fail_compilation/ice9540.d(26): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d
new file mode 100644
index 0000000..c104841
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d
@@ -0,0 +1,3 @@
+module a17630;
+
+import b17630;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d
new file mode 100644
index 0000000..1a88493
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d
@@ -0,0 +1,6 @@
+module a18219;
+
+struct AST
+{
+ import b18219;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d
new file mode 100644
index 0000000..5ad5f99
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d
@@ -0,0 +1,3 @@
+module b17630;
+
+int Erase;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d
new file mode 100644
index 0000000..6008c8a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d
@@ -0,0 +1,15 @@
+module b18219;
+
+class Foobar
+{
+ int a;
+ this(int a)
+ {
+ this.a = a;
+ }
+ static int smeth()
+ {
+ return 1;
+ }
+}
+void fun() {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d
index b0e9c3b..b0e9c3b 100644
--- a/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d
diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d
index de50787..de50787 100644
--- a/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d
new file mode 100644
index 0000000..d7edcc1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d
@@ -0,0 +1,4 @@
+module imports.imp15896;
+
+private int thebar=4;
+package int packagebar=3;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d
new file mode 100644
index 0000000..4c85aad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d
@@ -0,0 +1,3 @@
+module imports.test21651b;
+
+alias T = int;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/issue16020.d b/gcc/testsuite/gdc.test/fail_compilation/issue16020.d
new file mode 100644
index 0000000..75e3b9f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/issue16020.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/issue16020.d(12): Error: user-defined attributes not allowed for `alias` declarations
+fail_compilation/issue16020.d(13): Error: semicolon expected to close `alias` declaration
+fail_compilation/issue16020.d(13): Error: declaration expected, not `(`
+---
+*/
+module issue16020;
+
+struct UDA{}
+alias Fun = @UDA void();
+alias FunTemplate = void(T)(T t);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d b/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d
new file mode 100644
index 0000000..b18627d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d
@@ -0,0 +1,16 @@
+
+/* TEST_OUTPUT:
+---
+fail_compilation/mixintype2.d(10): Error: alias `mixintype2.Foo.T` recursive alias declaration
+fail_compilation/mixintype2.d(16): Error: `mixin(0)` does not give a valid type
+---
+*/
+
+struct Foo {
+ alias T = mixin("T2");
+}
+alias T1 = mixin("Foo.T");
+alias T2 = mixin("T1");
+void func (T2 p) {}
+
+enum mixin(0) a = 0;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16002.d b/gcc/testsuite/gdc.test/fail_compilation/test16002.d
deleted file mode 100644
index 80ae40b..0000000
--- a/gcc/testsuite/gdc.test/fail_compilation/test16002.d
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-REQUIRED_ARGS:
-PERMUTE_ARGS:
-TEST_OUTPUT:
----
-fail_compilation/test16002.d(100): Error: undefined identifier `imports.nonexistent`
-fail_compilation/test16002.d(101): Error: undefined identifier `imports.nonexistent`
----
-*/
-
-module test.fail_compilation.test16002;
-
-#line 100
-enum A = is(imports.nonexistent == package);
-enum B = is(imports.nonexistent == module);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16228.d b/gcc/testsuite/gdc.test/fail_compilation/test16228.d
index 6aa79a2..63951e6 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test16228.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16228.d
@@ -1,13 +1,13 @@
/* REQUIRED_ARGS: -dip25
TEST_OUTPUT:
---
-fail_compilation/test16228.d(22): Error: function type 'return int()' has 'return' but does not return any indirections
-fail_compilation/test16228.d(23): Error: function test16228.S.foo static member has no 'this' to which 'return' can apply
+fail_compilation/test16228.d(23): Error: function `test16228.S.bar` `static` member has no `this` to which `return` can apply
---
*/
+
// https://issues.dlang.org/show_bug.cgi?id=16228
int* wrap ( return ref int input )
@@ -20,5 +20,16 @@ struct S
int x;
int foo() return { return 3; }
- static ref int foo() return { return x; }
+ static ref int bar() return { return x; }
+}
+
+
+// https://issues.dlang.org/show_bug.cgi?id=18963
+
+T Identity(T)(return T t) { return t; }
+
+void bar(int i, void* p)
+{
+ Identity(p);
+ Identity(i);
}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20919.d b/gcc/testsuite/gdc.test/fail_compilation/test20919.d
new file mode 100644
index 0000000..2f1bad1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test20919.d
@@ -0,0 +1,13 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/test20919.d(12): Error: `__traits(getAttributes, int a)` does not give a valid type
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=20919
+
+void foo(int a) {}
+
+static if (is(typeof(foo) params == __parameters))
+{
+ __traits(getAttributes, params) a;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21651.d b/gcc/testsuite/gdc.test/fail_compilation/test21651.d
new file mode 100644
index 0000000..a4d959f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21651.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -de
+// EXTRA_SOURCES: imports/test21651b.d
+/* TEST_OUTPUT:
+---
+fail_compilation/test21651.d(11): Deprecation: module imports.test21651b is not accessible here, perhaps add 'static import imports.test21651b;'
+---
+*/
+
+module imports.test21651;
+
+imports.test21651b.T a;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21927.d b/gcc/testsuite/gdc.test/fail_compilation/test21927.d
new file mode 100644
index 0000000..fa23285
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21927.d
@@ -0,0 +1,20 @@
+// https://issues.dlang.org/show_bug.cgi?id=21927
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test21927.d(17): Error: invalid `foreach` aggregate `this.T2(Args2...)`
+fail_compilation/test21927.d(18): Error: invalid `foreach` aggregate `this.T2!()`
+---
+*/
+
+struct S
+{
+ template T2(Args2...) {}
+
+ void fun()
+ {
+ // original test case
+ static foreach (p; this.T2) {} // ICE
+ static foreach (p; this.T2!()) {} // ICE
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21939.d b/gcc/testsuite/gdc.test/fail_compilation/test21939.d
new file mode 100644
index 0000000..cb755ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21939.d
@@ -0,0 +1,9 @@
+// https://issues.dlang.org/show_bug.cgi?id=21939
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test21939.d(9): Error: invalid `foreach` aggregate `Object`, define `opApply()`, range primitives, or use `.tupleof`
+---
+*/
+
+static foreach (a; Object) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/warn12809.d b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d
index 100f0fb..06c998d 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/warn12809.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d
@@ -32,3 +32,44 @@ void test_unrachable3()
int x = 1; // unreachable
}
+
+/********************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/warn12809.d(108): Warning: statement is not reachable
+fail_compilation/warn12809.d(115): Warning: statement is not reachable
+fail_compilation/warn12809.d(122): Warning: statement is not reachable
+Error: warnings are treated as errors
+ Use -wi if you wish to treat warnings only as informational.
+---
+*/
+
+#line 100
+
+alias noreturn = typeof(*null);
+
+noreturn foo();
+
+void test1(ref int i)
+{
+ foo();
+ i = 3;
+}
+
+void test2()
+{
+ try foo();
+ finally { }
+ int x = 1;
+}
+
+void test3()
+{
+ try { }
+ finally foo();
+ int x = 1;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/funclit.d b/gcc/testsuite/gdc.test/runnable/funclit.d
index d45e3e6d..c299bad 100644
--- a/gcc/testsuite/gdc.test/runnable/funclit.d
+++ b/gcc/testsuite/gdc.test/runnable/funclit.d
@@ -1242,6 +1242,66 @@ void test15794()
}
/***************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=16271
+
+ref auto funa16271(alias dg, T)(ref T a)
+{
+ return dg(a);
+}
+
+ref auto func16271(alias dg)()
+{
+ return dg();
+}
+
+void assign16271(T)(ref T a, T b)
+{
+ alias fun = ref (ref a) => a;
+ fun(a) = b;
+}
+
+void test16271()
+{
+ int x;
+ (ref () => x )() = 1; assert(x == 1);
+ func16271!(ref () => x) = 2; assert(x == 2);
+ assign16271(x, 3); assert(x == 3);
+
+ alias alx = func16271!(ref () => x);
+ alx = 4; assert(x == 4);
+
+ alias alf = ref (ref a) => a;
+ auto auf = ref (ref int a) => a;
+ alf(x) = 5; assert(x == 5);
+ auf(x) = 6; assert(x == 6);
+
+ assert((funa16271!( ref (ref a) => a)(x) += 1) == 7 );
+ assert((funa16271!(function ref (ref a) => a)(x) += 1) == 8 );
+ assert((funa16271!(function ref int(ref a) => a)(x) += 1) == 9 );
+ assert((funa16271!(delegate ref (ref a) => a)(x) += 1) == 10);
+ assert((funa16271!(delegate ref int(ref a) => a)(x) += 1) == 11);
+ assert(x == 11);
+
+ alias aldc = ref () @trusted @nogc { return x; };
+ auto audc = ref () @safe nothrow { return x; };
+ alias alfuc = function ref (ref x) @trusted { return x; };
+ alias aldec = delegate ref () @trusted { return x; };
+ aldc() = 12; assert(x == 12);
+ audc() = 13; assert(x == 13);
+ alfuc(x) = 14; assert(x == 14);
+ aldec() = 15; assert(x == 15);
+
+ template T()
+ {
+ int x;
+ alias alf = ref () => x;
+ auto auf = ref () => x;
+ }
+ T!().alf() = 1; assert(T!().x == 1);
+ T!().auf() = 2; assert(T!().x == 2);
+}
+
+/***************************************************/
int main()
{
@@ -1299,6 +1359,7 @@ int main()
test13879();
test14745();
test15794();
+ test16271();
printf("Success\n");
return 0;
diff --git a/gcc/testsuite/gdc.test/runnable/mangle.d b/gcc/testsuite/gdc.test/runnable/mangle.d
index e6d3645..9a8420a 100644
--- a/gcc/testsuite/gdc.test/runnable/mangle.d
+++ b/gcc/testsuite/gdc.test/runnable/mangle.d
@@ -599,6 +599,12 @@ void fooB(void delegate (void delegate()) scope dg)
//pragma(msg, fooB.mangleof);
static assert(typeof(fooA).mangleof != typeof(fooB).mangleof);
+/***************************************************/
+
+alias noreturn = typeof(*null);
+alias fpd = noreturn function();
+int funcd(fpd);
+static assert(funcd.mangleof == "_D6mangle5funcdFPFZNnZi");
/***************************************************/
diff --git a/gcc/testsuite/gdc.test/runnable/noreturn1.d b/gcc/testsuite/gdc.test/runnable/noreturn1.d
new file mode 100644
index 0000000..447ea28
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/noreturn1.d
@@ -0,0 +1,74 @@
+alias noreturn = typeof(*null);
+
+extern (C) noreturn exit();
+
+/*****************************************/
+
+bool testf(int i)
+{
+ return i && assert(0);
+}
+
+bool testt(int i)
+{
+ return i || assert(0);
+}
+
+int testa(int i)
+{
+ if (i && exit())
+ return i + 1;
+ return i - 1;
+}
+
+int testb(int i)
+{
+ if (i || exit())
+ return i + 1;
+ return i - 1;
+}
+
+void test1()
+{
+ assert(testf(0) == false);
+ assert(testt(1) == true);
+
+ assert(testa(0) == -1);
+ assert(testb(3) == 4);
+}
+
+/*****************************************/
+
+noreturn exit1() { assert(0); }
+noreturn exit2() { assert(0); }
+
+
+int heli1(int i)
+{
+ return i ? exit1() : i - 1;
+}
+
+int heli2(int i)
+{
+ return i ? i - 1 : exit1();
+}
+
+noreturn heli3(int i)
+{
+ return i ? exit1() : exit2();
+}
+
+void test2()
+{
+ assert(heli1(0) == -1);
+ assert(heli2(1) == 0);
+}
+
+/*****************************************/
+
+int main()
+{
+ test1();
+ test2();
+ return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable_cxx/cppa.d b/gcc/testsuite/gdc.test/runnable_cxx/cppa.d
index b9b4832..cb576ba 100644
--- a/gcc/testsuite/gdc.test/runnable_cxx/cppa.d
+++ b/gcc/testsuite/gdc.test/runnable_cxx/cppa.d
@@ -571,18 +571,20 @@ void test13289()
assert(f13289_cpp_test());
}
+version(Posix)
+{
+ enum __c_wchar_t : dchar;
+}
+else version(Windows)
+{
+ enum __c_wchar_t : wchar;
+}
+alias wchar_t = __c_wchar_t;
extern(C++)
{
bool f13289_cpp_test();
- version(Posix)
- {
- dchar f13289_cpp_wchar_t(dchar);
- }
- else version(Windows)
- {
- wchar f13289_cpp_wchar_t(wchar);
- }
+ wchar_t f13289_cpp_wchar_t(wchar_t);
wchar f13289_d_wchar(wchar ch)
{
@@ -606,6 +608,17 @@ extern(C++)
return ch;
}
}
+ wchar_t f13289_d_wchar_t(wchar_t ch)
+ {
+ if (ch <= 'z' && ch >= 'a')
+ {
+ return cast(wchar_t)(ch - ('a' - 'A'));
+ }
+ else
+ {
+ return ch;
+ }
+ }
}
/****************************************/
diff --git a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp
index 587145c..823c660 100644
--- a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp
+++ b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp
@@ -412,8 +412,12 @@ wchar_t f13289_d_wchar(wchar_t ch);
unsigned int f13289_d_dchar(unsigned int ch);
#endif
+wchar_t f13289_d_wchar_t(wchar_t ch);
+
bool f13289_cpp_test()
{
+ if (!(f13289_d_wchar_t(L'e') == L'E')) return false;
+ if (!(f13289_d_wchar_t(L'F') == L'F')) return false;
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun || __NetBSD__
if (!(f13289_d_wchar((unsigned short)'c') == (unsigned short)'C')) return false;
if (!(f13289_d_wchar((unsigned short)'D') == (unsigned short)'D')) return false;
diff --git a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp
new file mode 100644
index 0000000..076777a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp
@@ -0,0 +1,82 @@
+#include <assert.h>
+#include <complex.h>
+
+// Use custom types for inspecting parts instead of including tgmath.h
+union cfloat_t { _Complex float z; struct { float re; float im; }; };
+union cdouble_t { _Complex double z; struct { double re; double im; }; };
+union creal_t { _Complex long double z; struct { long double re; long double im; }; };
+
+// extern(C) tests
+extern "C" _Complex float ccomplexf() { return 2.0f+I; }
+extern "C" _Complex double ccomplex() { return 2.0+I; }
+extern "C" _Complex long double ccomplexl() { return 2.0L+I; }
+extern "C" void ccomplexf2(_Complex float c) { cfloat_t z = {c}; assert(z.re == 2 && z.im == 1); }
+extern "C" void ccomplex2(_Complex double c) { cdouble_t z = {c}; assert(z.re == 2 && z.im == 1); }
+extern "C" void ccomplexl2(_Complex long double c) { creal_t z = {c}; assert(z.re == 2 && z.im == 1); }
+
+// extern(C++) tests
+_Complex float cpcomplexf() { return 2.0f+I; }
+_Complex double cpcomplex() { return 2.0+I; }
+_Complex long double cpcomplexl() { return 2.0L+I; }
+void cpcomplexf(_Complex float c) { cfloat_t z = {c}; assert(z.re == 2 && z.im == 1); }
+void cpcomplex(_Complex double c) { cdouble_t z = {c}; assert(z.re == 2 && z.im == 1); }
+void cpcomplexl(_Complex long double c) { creal_t z = {c}; assert(z.re == 2 && z.im == 1); }
+
+// Struct tests
+struct wrap_complexf { _Complex float c; };
+struct wrap_complex { _Complex double c; };
+struct wrap_complexl { _Complex long double c; };
+
+wrap_complexf wcomplexf()
+{
+ wrap_complexf s;
+ s.c = 2.0f+I;
+ return s;
+}
+
+wrap_complex wcomplex()
+{
+ wrap_complex s;
+ s.c = 2.0+I;
+ return s;
+}
+
+wrap_complexl wcomplexl()
+{
+ wrap_complexl s;
+ s.c = 2.0L+I;
+ return s;
+}
+
+void wcomplexf(wrap_complexf s) { cfloat_t z = {s.c}; assert(z.re == 2 && z.im == 1); }
+void wcomplex(wrap_complex s) { cdouble_t z = {s.c}; assert(z.re == 2 && z.im == 1); }
+void wcomplexl(wrap_complexl s) { creal_t z = {s.c}; assert(z.re == 2 && z.im == 1); }
+
+struct soft_complexf { float re; float im; };
+struct soft_complex { double re; double im; };
+struct soft_complexl { long double re; long double im; };
+
+soft_complexf scomplexf()
+{
+ soft_complexf s;
+ s.re = 2.0f; s.im = 1.0f;
+ return s;
+}
+
+soft_complex scomplex()
+{
+ soft_complex s;
+ s.re = 2.0; s.im = 1.0;
+ return s;
+}
+
+soft_complexl scomplexl()
+{
+ soft_complexl s;
+ s.re = 2.0L; s.im = 1.0L;
+ return s;
+}
+
+void scomplexf(soft_complexf s) { assert(s.re == 2 && s.im == 1); }
+void scomplex(soft_complex s) { assert(s.re == 2 && s.im == 1); }
+void scomplexl(soft_complexl s) { assert(s.re == 2 && s.im == 1); }
diff --git a/gcc/testsuite/gdc.test/runnable_cxx/test21515.d b/gcc/testsuite/gdc.test/runnable_cxx/test21515.d
new file mode 100644
index 0000000..cc44207
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable_cxx/test21515.d
@@ -0,0 +1,104 @@
+// https://issues.dlang.org/show_bug.cgi?id=21515
+// EXTRA_CPP_SOURCES: test21515.cpp
+// DISABLED: win32 win64
+
+// ABI layout of native complex
+struct _Complex(T) { T re; T im; }
+
+// Special enum definitions.
+version (Posix)
+{
+ align(float.alignof) enum __c_complex_float : _Complex!float;
+ align(double.alignof) enum __c_complex_double : _Complex!double;
+ align(real.alignof) enum __c_complex_real : _Complex!real;
+}
+else
+{
+ align(float.sizeof * 2) enum __c_complex_float : _Complex!float;
+ align(double.sizeof * 2) enum __c_complex_double : _Complex!double;
+ align(real.alignof) enum __c_complex_real : _Complex!real;
+}
+alias complex_float = __c_complex_float;
+alias complex_double = __c_complex_double;
+alias complex_real = __c_complex_real;
+
+extern(C) complex_float ccomplexf();
+extern(C) complex_double ccomplex();
+extern(C) complex_real ccomplexl();
+extern(C) void ccomplexf2(complex_float c);
+extern(C) void ccomplex2(complex_double c);
+extern(C) void ccomplexl2(complex_real c);
+
+extern(C++) complex_float cpcomplexf();
+extern(C++) complex_double cpcomplex();
+extern(C++) complex_real cpcomplexl();
+extern(C++) void cpcomplexf(complex_float c);
+extern(C++) void cpcomplex(complex_double c);
+extern(C++) void cpcomplexl(complex_real c);
+
+struct wrap_complexf { complex_float c; alias c this; };
+struct wrap_complex { complex_double c; alias c this; };
+struct wrap_complexl { complex_real c; alias c this; };
+
+extern(C++) wrap_complexf wcomplexf();
+extern(C++) wrap_complex wcomplex();
+extern(C++) wrap_complexl wcomplexl();
+extern(C++) void wcomplexf(wrap_complexf c);
+extern(C++) void wcomplex(wrap_complex c);
+extern(C++) void wcomplexl(wrap_complexl c);
+
+struct soft_complexf { float re; float im; };
+struct soft_complex { double re; double im; };
+struct soft_complexl { real re; real im; };
+
+extern(C++) soft_complexf scomplexf();
+extern(C++) soft_complex scomplex();
+extern(C++) soft_complexl scomplexl();
+extern(C++) void scomplexf(soft_complexf c);
+extern(C++) void scomplex(soft_complex c);
+extern(C++) void scomplexl(soft_complexl c);
+
+int main()
+{
+ auto a1 = ccomplexf();
+ auto b1 = ccomplex();
+ auto c1 = ccomplexl();
+ assert(a1.re == 2 && a1.im == 1);
+ assert(b1.re == 2 && b1.im == 1);
+ assert(c1.re == 2 && c1.im == 1);
+ ccomplexf2(a1);
+ ccomplex2(b1);
+ ccomplexl2(c1);
+
+ auto a2 = cpcomplexf();
+ auto b2 = cpcomplex();
+ auto c2 = cpcomplexl();
+ assert(a2.re == 2 && a2.im == 1);
+ assert(b2.re == 2 && b2.im == 1);
+ assert(c2.re == 2 && c2.im == 1);
+ cpcomplexf(a2);
+ cpcomplex(b2);
+ cpcomplexl(c2);
+
+ auto a3 = wcomplexf();
+ auto b3 = wcomplex();
+ auto c3 = wcomplexl();
+ assert(a3.re == 2 && a3.im == 1);
+ assert(b3.re == 2 && b3.im == 1);
+ assert(c3.re == 2 && c3.im == 1);
+ wcomplexf(a3);
+ wcomplex(b3);
+ wcomplexl(c3);
+
+ auto a4 = scomplexf();
+ auto b4 = scomplex();
+ auto c4 = scomplexl();
+ assert(a4.re == 2 && a4.im == 1);
+ assert(b4.re == 2 && b4.im == 1);
+ assert(c4.re == 2 && c4.im == 1);
+ scomplexf(a4);
+ scomplex(b4);
+ scomplexl(c4);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c
index a571459..d0d036a 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c
@@ -1,6 +1,6 @@
/* Test F2008 18.5: ISO_Fortran_binding.h functions. */
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -142,11 +142,12 @@ float section_c(int *std_case, CFI_cdesc_t * source, int *low, int *str)
CFI_type_float, 0, 1, NULL);
if (ind) return -1.0;
ind = CFI_section((CFI_cdesc_t *)&section, source, lower, NULL, strides);
- assert (section.dim[0].lower_bound == lower[0]);
if (ind) return -2.0;
/* Sum over the section */
- for (idx[0] = lower[0]; idx[0] < section.dim[0].extent + lower[0]; idx[0]++)
+ for (idx[0] = section.dim[0].lower_bound;
+ idx[0] < section.dim[0].extent + section.dim[0].lower_bound;
+ idx[0]++)
ans += *(float*)CFI_address ((CFI_cdesc_t*)&section, idx);
return ans;
}
@@ -164,11 +165,12 @@ float section_c(int *std_case, CFI_cdesc_t * source, int *low, int *str)
ind = CFI_section((CFI_cdesc_t *)&section, source,
lower, upper, strides);
assert (section.rank == 1);
- assert (section.dim[0].lower_bound == lower[0]);
if (ind) return -2.0;
/* Sum over the section */
- for (idx[0] = lower[0]; idx[0] < section.dim[0].extent + lower[0]; idx[0]++)
+ for (idx[0] = section.dim[0].lower_bound;
+ idx[0] < section.dim[0].extent + section.dim[0].lower_bound;
+ idx[0]++)
ans += *(float*)CFI_address ((CFI_cdesc_t*)&section, idx);
return ans;
}
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.f90 b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.f90
index 102bc60..0cf3b2c 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.f90
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.f90
@@ -39,7 +39,7 @@
USE, INTRINSIC :: ISO_C_BINDING
import
INTEGER(C_INT) :: err
- type (T), DIMENSION(..), intent(out) :: a
+ type (T), pointer, DIMENSION(..), intent(out) :: a
END FUNCTION c_establish
FUNCTION c_contiguous(a) BIND(C, NAME="contiguous_c") RESULT(err)
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c
index 9f06e2d..91222ff 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c
@@ -2,7 +2,7 @@
/* Contributed by Reinhold Bader <Bader@lrz.de> */
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c
index ac17690..e013011 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c
@@ -5,7 +5,7 @@ Contributed by Reinhold Bader <Bader@lrz.de>#include <stdio.h> */
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
typedef struct
{
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c
index 279d9f6..0a41576 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <math.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
/* Contributed by Reinhold Bader <Bader@lrz.de> */
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c
index f5c83c7..fc70da4 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c
@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
// Prototype for Fortran functions
extern void Fsub(CFI_cdesc_t *);
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c
index cdee0b8..915b6e7 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c
@@ -1,6 +1,6 @@
/* Test the fix for PR92142. */
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c
index 14dfcc9..fa75268 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <assert.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
void Csub(const CFI_cdesc_t *, size_t, CFI_index_t invalid);
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90
index bb30931..5902334 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90
@@ -71,7 +71,7 @@
end block blk2
end
-! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = -1, lower_bound = 0, upper bound = 4, extend = 4(\n|\r\n|\r)" }
-! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = 5, lower_bound = 0, upper bound = 4, extend = 4(\n|\r\n|\r).*" }
-! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = -3, lower_bound = -2, upper bound = 6, extend = 4(\n|\r\n|\r)" }
-! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = 2, lower_bound = -2, upper bound = 6, extend = 4(\n|\r\n|\r)" }
+! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = -1, lower_bound = 0, upper bound = 4, extent = 4(\n|\r\n|\r)" }
+! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = 5, lower_bound = 0, upper bound = 4, extent = 4(\n|\r\n|\r).*" }
+! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = -3, lower_bound = -2, upper bound = 6, extent = 4(\n|\r\n|\r)" }
+! { dg-output "CFI_address: subscripts\\\[0\\\] is out of bounds. For dimension = 0, subscripts = 2, lower_bound = -2, upper bound = 6, extent = 4(\n|\r\n|\r)" }
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c
index eef5cc6..5a3952c 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c
@@ -1,6 +1,6 @@
#include <stdlib.h>
#include <string.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
extern int do_loop(CFI_cdesc_t* array);
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c
index a9f64cd..33d1bc3 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c
@@ -1,4 +1,4 @@
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c
index f8bdb27..b18a899 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <math.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
typedef struct {
int i;
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c
index 9ef46ce..c7981c5 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <math.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#define DEBUG 0
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c
index d68428f..8162451 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c
@@ -2,7 +2,7 @@
/* Contributed by Reinhold Bader <Bader@lrz.de> */
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c
index dc80cd3..d3dce3a 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c
@@ -2,7 +2,7 @@
/* Contributed by Reinhold Bader <Bader@lrz.de> */
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#include <stdio.h>
float Cxgl[] = { 1.1, 2.3, 5.1, 4.2 };
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c
index cb5b91d..cb17077 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c
@@ -2,7 +2,7 @@
/* Contributed by Gilles Gouaillardet <gilles@rist.or.jp> */
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
#include <stdlib.h>
int cdesc_c(CFI_cdesc_t* x, long *expected)
diff --git a/gcc/testsuite/gfortran.dg/PR100094.f90 b/gcc/testsuite/gfortran.dg/PR100094.f90
new file mode 100644
index 0000000..f2f7f16
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100094.f90
@@ -0,0 +1,37 @@
+! { dg-do run }
+!
+! Test the fix for PR100094
+!
+
+program foo_p
+
+ implicit none
+
+ integer, parameter :: n = 11
+
+ integer, pointer :: pout(:)
+ integer, target :: a(n)
+ integer :: i
+
+ a = [(i, i=1,n)]
+ call foo(pout)
+ if(.not.associated(pout)) stop 1
+ if(.not.associated(pout, a)) stop 2
+ if(any(pout/=a)) stop 3
+ stop
+
+contains
+
+ subroutine foo(that)
+ integer, pointer, intent(out) :: that(..)
+
+ select rank(that)
+ rank(1)
+ that => a
+ rank default
+ stop 4
+ end select
+ return
+ end subroutine foo
+
+end program foo_p
diff --git a/gcc/testsuite/gfortran.dg/PR100120.f90 b/gcc/testsuite/gfortran.dg/PR100120.f90
new file mode 100644
index 0000000..c1e6c99
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100120.f90
@@ -0,0 +1,198 @@
+! { dg-do run }
+!
+! Tests fix for PR100120
+!
+
+program main_p
+
+ implicit none
+
+ integer, parameter :: n = 11
+ integer, parameter :: m = 7
+ integer, parameter :: c = 63
+
+ type :: foo_t
+ integer :: i
+ end type foo_t
+
+ type, extends(foo_t) :: bar_t
+ integer :: j(n)
+ end type bar_t
+
+ integer, target :: ain(n)
+ character, target :: ac1(n)
+ character(len=m), target :: acn(n)
+ type(foo_t), target :: afd(n)
+ type(bar_t), target :: abd(n)
+ !
+ class(foo_t), pointer :: spf
+ class(foo_t), pointer :: apf(:)
+ class(bar_t), pointer :: spb
+ class(bar_t), pointer :: apb(:)
+ class(*), pointer :: spu
+ class(*), pointer :: apu(:)
+ integer :: i, j
+
+ ain = [(i, i=1,n)]
+ ac1 = [(achar(i+c), i=1,n)]
+ do i = 1, n
+ do j = 1, m
+ acn(i)(j:j) = achar(i*m+j+c-m)
+ end do
+ end do
+ afd%i = ain
+ abd%i = ain
+ do i = 1, n
+ abd(i)%j = 2*i*ain
+ end do
+ !
+ spf => afd(n)
+ if(.not.associated(spf)) stop 1
+ if(.not.associated(spf, afd(n))) stop 2
+ if(spf%i/=n) stop 3
+ apf => afd
+ if(.not.associated(apf)) stop 4
+ if(.not.associated(apf, afd)) stop 5
+ if(any(apf%i/=afd%i)) stop 6
+ !
+ spf => abd(n)
+ if(.not.associated(spf)) stop 7
+ if(.not.associated(spf, abd(n))) stop 8
+ if(spf%i/=n) stop 9
+ select type(spf)
+ type is(bar_t)
+ if(any(spf%j/=2*n*ain)) stop 10
+ class default
+ stop 11
+ end select
+ apf => abd
+ if(.not.associated(apf)) stop 12
+ if(.not.associated(apf, abd)) stop 13
+ if(any(apf%i/=abd%i)) stop 14
+ select type(apf)
+ type is(bar_t)
+ do i = 1, n
+ if(any(apf(i)%j/=2*i*ain)) stop 15
+ end do
+ class default
+ stop 16
+ end select
+ !
+ spb => abd(n)
+ if(.not.associated(spb)) stop 17
+ if(.not.associated(spb, abd(n))) stop 18
+ if(spb%i/=n) stop 19
+ if(any(spb%j/=2*n*ain)) stop 20
+ apb => abd
+ if(.not.associated(apb)) stop 21
+ if(.not.associated(apb, abd)) stop 22
+ if(any(apb%i/=abd%i)) stop 23
+ do i = 1, n
+ if(any(apb(i)%j/=2*i*ain)) stop 24
+ end do
+ !
+ spu => ain(n)
+ if(.not.associated(spu)) stop 25
+ if(.not.associated(spu, ain(n))) stop 26
+ select type(spu)
+ type is(integer)
+ if(spu/=n) stop 27
+ class default
+ stop 28
+ end select
+ apu => ain
+ if(.not.associated(apu)) stop 29
+ if(.not.associated(apu, ain)) stop 30
+ select type(apu)
+ type is(integer)
+ if(any(apu/=ain)) stop 31
+ class default
+ stop 32
+ end select
+ !
+ spu => ac1(n)
+ if(.not.associated(spu)) stop 33
+ if(.not.associated(spu, ac1(n))) stop 34
+ select type(spu)
+ type is(character(len=*))
+ if(len(spu)/=1) stop 35
+ if(spu/=ac1(n)) stop 36
+ class default
+ stop 37
+ end select
+ apu => ac1
+ if(.not.associated(apu)) stop 38
+ if(.not.associated(apu, ac1)) stop 39
+ select type(apu)
+ type is(character(len=*))
+ if(len(apu)/=1) stop 40
+ if(any(apu/=ac1)) stop 41
+ class default
+ stop 42
+ end select
+ !
+ spu => acn(n)
+ if(.not.associated(spu)) stop 43
+ if(.not.associated(spu, acn(n))) stop 44
+ select type(spu)
+ type is(character(len=*))
+ if(len(spu)/=m) stop 45
+ if(spu/=acn(n)) stop 46
+ class default
+ stop 47
+ end select
+ apu => acn
+ if(.not.associated(apu)) stop 48
+ if(.not.associated(apu, acn)) stop 49
+ select type(apu)
+ type is(character(len=*))
+ if(len(apu)/=m) stop 50
+ if(any(apu/=acn)) stop 51
+ class default
+ stop 52
+ end select
+ !
+ spu => afd(n)
+ if(.not.associated(spu)) stop 53
+ if(.not.associated(spu, afd(n))) stop 54
+ select type(spu)
+ type is(foo_t)
+ if(spu%i/=n) stop 55
+ class default
+ stop 56
+ end select
+ apu => afd
+ if(.not.associated(apu)) stop 57
+ if(.not.associated(apu, afd)) stop 58
+ select type(apu)
+ type is(foo_t)
+ if(any(apu%i/=afd%i)) stop 59
+ class default
+ stop 60
+ end select
+ !
+ spu => abd(n)
+ if(.not.associated(spu)) stop 61
+ if(.not.associated(spu, abd(n))) stop 62
+ select type(spu)
+ type is(bar_t)
+ if(spu%i/=n) stop 63
+ if(any(spu%j/=2*n*ain)) stop 64
+ class default
+ stop 65
+ end select
+ apu => abd
+ if(.not.associated(apu)) stop 66
+ if(.not.associated(apu, abd)) stop 67
+ select type(apu)
+ type is(bar_t)
+ if(any(apu%i/=abd%i)) stop 68
+ do i = 1, n
+ if(any(apu(i)%j/=2*i*ain)) stop 69
+ end do
+ class default
+ stop 70
+ end select
+ stop
+
+end program main_p
diff --git a/gcc/testsuite/gfortran.dg/PR10018.f90 b/gcc/testsuite/gfortran.dg/PR10018.f90
new file mode 100644
index 0000000..f1cf267
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR10018.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+subroutine foo(that)
+ implicit none
+ class(*), target, intent(in) :: this
+ class(*), pointer, intent(out) :: that
+
+ that => this
+ return
+end subroutine foo
+! { dg-error "Symbol at \\\(1\\\) is not a DUMMY variable" "" { target "*-*-*" } 5 }
diff --git a/gcc/testsuite/gfortran.dg/PR100911.c b/gcc/testsuite/gfortran.dg/PR100911.c
new file mode 100644
index 0000000..f3345ad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100911.c
@@ -0,0 +1,82 @@
+/* Test the fix for PR100911 */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+
+#define _CFI_type_mask 0xFF
+#define _CFI_type_kind_shift 8
+
+#define _CFI_decode_type(NAME) (signed char)((NAME) & CFI_type_mask)
+#define _CFI_decode_kind(NAME) (signed char)(((NAME) >> CFI_type_kind_shift) & CFI_type_mask)
+
+#define _CFI_encode_type(TYPE, KIND) (int16_t)\
+((((KIND) & CFI_type_mask) << CFI_type_kind_shift)\
+ | ((TYPE) & CFI_type_mask))
+
+#define N 11
+#define M 7
+
+#define CFI_type_Cptr CFI_type_cptr
+
+typedef int* c_ptr;
+
+bool c_vrfy_cptr (const CFI_cdesc_t *restrict);
+
+void check_tk (const CFI_cdesc_t*restrict, const CFI_type_t, const signed char, const size_t, const size_t);
+
+bool
+c_vrfy_cptr (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ size_t sz;
+ c_ptr *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ assert (auxp->elem_len>0);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ assert (ex==11);
+ sz = (size_t)auxp->elem_len / sizeof (c_ptr);
+ assert (sz==1);
+ ub = ex + lb - 1;
+ ip = (c_ptr*)auxp->base_addr;
+ for (i=0; i<ex; i++, ip+=sz)
+ if ((**ip) != (int)(i+1))
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (c_ptr*)CFI_address(auxp, &i);
+ if ((**ip) != (int)(i-lb+1))
+ return false;
+ }
+ return true;
+}
+
+void
+check_tk (const CFI_cdesc_t *restrict auxp, const CFI_type_t type, const signed char kind, const size_t elem_len, const size_t nelem)
+{
+ signed char ityp, iknd;
+
+ assert (auxp);
+ assert (auxp->elem_len==elem_len*nelem);
+ assert (auxp->rank==1);
+ assert (auxp->dim[0].sm>0);
+ assert ((size_t)auxp->dim[0].sm==elem_len*nelem);
+ /* */
+ assert (auxp->type==type);
+ ityp = _CFI_decode_type(auxp->type);
+ assert (ityp == CFI_type_cptr);
+ iknd = _CFI_decode_kind(auxp->type);
+ assert (_CFI_decode_type(type)==ityp);
+ assert (kind==iknd);
+ assert (c_vrfy_cptr (auxp));
+ return;
+}
+
+// Local Variables:
+// mode: C
+// End:
diff --git a/gcc/testsuite/gfortran.dg/PR100911.f90 b/gcc/testsuite/gfortran.dg/PR100911.f90
new file mode 100644
index 0000000..69f485b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100911.f90
@@ -0,0 +1,282 @@
+! { dg-do run }
+! { dg-additional-sources PR100911.c }
+!
+! Test the fix for PR100911
+!
+
+module isof_m
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_signed_char, c_int16_t
+
+ implicit none
+
+ private
+
+ public :: &
+ CFI_type_cptr
+
+ public :: &
+ check_tk_as, &
+ check_tk_ar
+
+ public :: &
+ cfi_encode_type
+
+ integer, parameter :: CFI_type_t = c_int16_t
+
+ integer(kind=c_int16_t), parameter :: CFI_type_mask = int(z"FF", kind=c_int16_t)
+ integer(kind=c_int16_t), parameter :: CFI_type_kind_shift = 8_c_int16_t
+
+ ! Intrinsic types. Their kind number defines their storage size. */
+ integer(kind=c_signed_char), parameter :: CFI_type_cptr = 7
+
+ interface
+ subroutine check_tk_as(a, t, k, e, n) &
+ bind(c, name="check_tk")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int16_t, c_signed_char, c_size_t
+ implicit none
+ type(*), intent(in) :: a(:)
+ integer(c_int16_t), value, intent(in) :: t
+ integer(c_signed_char), value, intent(in) :: k
+ integer(c_size_t), value, intent(in) :: e
+ integer(c_size_t), value, intent(in) :: n
+ end subroutine check_tk_as
+ subroutine check_tk_ar(a, t, k, e, n) &
+ bind(c, name="check_tk")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int16_t, c_signed_char, c_size_t
+ implicit none
+ type(*), intent(in) :: a(..)
+ integer(c_int16_t), value, intent(in) :: t
+ integer(c_signed_char), value, intent(in) :: k
+ integer(c_size_t), value, intent(in) :: e
+ integer(c_size_t), value, intent(in) :: n
+ end subroutine check_tk_ar
+ end interface
+
+contains
+
+ elemental function cfi_encode_type(type, kind) result(itype)
+ integer(kind=c_signed_char), intent(in) :: type
+ integer(kind=c_signed_char), intent(in) :: kind
+
+ integer(kind=c_int16_t) :: itype, ikind
+
+ itype = int(type, kind=c_int16_t)
+ itype = iand(itype, CFI_type_mask)
+ ikind = int(kind, kind=c_int16_t)
+ ikind = iand(ikind, CFI_type_mask)
+ ikind = shiftl(ikind, CFI_type_kind_shift)
+ itype = ior(ikind, itype)
+ return
+ end function cfi_encode_type
+
+end module isof_m
+
+module iso_check_m
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_signed_char, c_int16_t, c_size_t
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_ptr, c_loc, c_associated
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_ptr
+
+ use :: isof_m, only: &
+ CFI_type_cptr
+
+ use :: isof_m, only: &
+ check_tk_as, &
+ check_tk_ar
+
+ use :: isof_m, only: &
+ cfi_encode_type
+
+ implicit none
+
+ integer :: i
+ integer(kind=c_size_t), parameter :: b = 8
+ integer, parameter :: n = 11
+
+ type, bind(c) :: c_foo_t
+ integer(kind=c_int) :: a
+ end type c_foo_t
+
+ type(c_foo_t), parameter :: ref_c_foo_t(*) = [(c_foo_t(a=i), i=1,n)]
+
+ type(c_foo_t), protected, target :: target_c_foo_t(n)
+
+
+contains
+
+ subroutine check_c_ptr()
+ type(c_ptr) :: p(n)
+ integer :: i
+ !
+ target_c_foo_t = ref_c_foo_t
+ p = [(c_loc(target_c_foo_t(i)), i=1,n)]
+ call f_check_c_ptr_as(p)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 1
+ do i = 1, n
+ if(.not.c_associated(p(i), c_loc(target_c_foo_t(i)))) stop 2
+ end do
+ target_c_foo_t = ref_c_foo_t
+ p = [(c_loc(target_c_foo_t(i)), i=1,n)]
+ call c_check_c_ptr_as(p)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 3
+ do i = 1, n
+ if(.not.c_associated(p(i), c_loc(target_c_foo_t(i)))) stop 4
+ end do
+ target_c_foo_t = ref_c_foo_t
+ p = [(c_loc(target_c_foo_t(i)), i=1,n)]
+ call f_check_c_ptr_ar(p)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 5
+ do i = 1, n
+ if(.not.c_associated(p(i), c_loc(target_c_foo_t(i)))) stop 6
+ end do
+ target_c_foo_t = ref_c_foo_t
+ p = [(c_loc(target_c_foo_t(i)), i=1,n)]
+ call c_check_c_ptr_ar(p)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 7
+ do i = 1, n
+ if(.not.c_associated(p(i), c_loc(target_c_foo_t(i)))) stop 8
+ end do
+ return
+ end subroutine check_c_ptr
+
+ subroutine f_check_c_ptr_as(a)
+ type(c_ptr), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 9
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 10
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 11
+ end do
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 12
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 13
+ end do
+ return
+ end subroutine f_check_c_ptr_as
+
+ subroutine c_check_c_ptr_as(a) bind(c)
+ type(c_ptr), intent(in) :: a(:)
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 14
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 15
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 16
+ end do
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 17
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 18
+ end do
+ return
+ end subroutine c_check_c_ptr_as
+
+ subroutine f_check_c_ptr_ar(a)
+ type(c_ptr), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 19
+ select rank(a)
+ rank(1)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 20
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 21
+ end do
+ rank default
+ stop 22
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 23
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 24
+ end do
+ rank default
+ stop 25
+ end select
+ return
+ end subroutine f_check_c_ptr_ar
+
+ subroutine c_check_c_ptr_ar(a) bind(c)
+ type(c_ptr), intent(in) :: a(..)
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 26
+ select rank(a)
+ rank(1)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 27
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 28
+ end do
+ rank default
+ stop 29
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(target_c_foo_t(:)%a/=ref_c_foo_t(:)%a)) stop 30
+ do i = 1, n
+ if(.not.c_associated(a(i), c_loc(target_c_foo_t(i)))) stop 31
+ end do
+ rank default
+ stop 32
+ end select
+ return
+ end subroutine c_check_c_ptr_ar
+
+end module iso_check_m
+
+program main_p
+
+ use :: iso_check_m, only: &
+ check_c_ptr
+
+ implicit none
+
+ call check_c_ptr()
+ stop
+
+end program main_p
+
+!! Local Variables:
+!! mode: f90
+!! End:
+
diff --git a/gcc/testsuite/gfortran.dg/PR100914.c b/gcc/testsuite/gfortran.dg/PR100914.c
new file mode 100644
index 0000000..c6bd973
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100914.c
@@ -0,0 +1,226 @@
+/* Test the fix for PR100914 */
+
+#include <assert.h>
+#include <complex.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <math.h>
+#include <quadmath.h>
+
+#include <ISO_Fortran_binding.h>
+
+#define _CFI_type_mask 0xFF
+#define _CFI_type_kind_shift 8
+
+#define _CFI_decode_type(NAME) (signed char)((NAME) & CFI_type_mask)
+#define _CFI_decode_kind(NAME) (signed char)(((NAME) >> CFI_type_kind_shift) & CFI_type_mask)
+
+#define _CFI_encode_type(TYPE, KIND) (int16_t)\
+((((KIND) & CFI_type_mask) << CFI_type_kind_shift)\
+ | ((TYPE) & CFI_type_mask))
+
+#undef CMPLXF
+#define CMPLXF(x, y) ((float complex)((float)(x) + I * (float)(y)))
+
+#undef CMPLX
+#define CMPLX(x, y) ((double complex)((double)(x) + (double complex)I * (double)(y)))
+
+#undef CMPLXL
+#define CMPLXL(x, y) ((long double complex)((long double)(x) + (long double complex)I * (long double)(y)))
+
+#undef CMPLX
+#define CMPLX(x, y) ((__complex128 )((double)(x) + (double complex)I * (double)(y)))
+
+#define N 11
+#define M 7
+
+typedef float _Complex c_float_complex;
+typedef double _Complex c_double_complex;
+typedef long double _Complex c_long_double_complex;
+typedef __complex128 c_float128_complex;
+
+bool c_vrfy_c_float_complex (const CFI_cdesc_t *restrict);
+
+bool c_vrfy_c_double_complex (const CFI_cdesc_t *restrict);
+
+bool c_vrfy_c_long_double_complex (const CFI_cdesc_t *restrict);
+
+bool c_vrfy_c_float128_complex (const CFI_cdesc_t *restrict);
+
+bool c_vrfy_complex (const CFI_cdesc_t *restrict);
+
+bool c_vrfy_desc (const CFI_cdesc_t*restrict, const CFI_type_t, const signed char, const size_t, const size_t);
+
+void check_tk (const CFI_cdesc_t*restrict, const CFI_type_t, const signed char, const size_t, const size_t);
+
+
+
+bool
+c_vrfy_c_float_complex (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ size_t sz;
+ c_float_complex *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ assert (auxp->elem_len>0);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ assert (ex==11);
+ sz = (size_t)auxp->elem_len / sizeof (c_float_complex);
+ assert (sz==1);
+ ub = ex + lb - 1;
+ ip = (c_float_complex*)auxp->base_addr;
+ for (i=0; i<ex; i++, ip+=sz)
+ if ((cabsf (*ip-(c_float_complex)(CMPLXF((i+1), (2*(i+1)))))>(float)0.0))
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (c_float_complex*)CFI_address(auxp, &i);
+ if ((cabsf (*ip-(c_float_complex)(CMPLXF((i-lb+1), (2*(i-lb+1)))))>(float)0.0))
+ return false;
+ }
+ return true;
+}
+
+bool
+c_vrfy_c_double_complex (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ size_t sz;
+ c_double_complex *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ assert (auxp->elem_len>0);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ assert (ex==11);
+ sz = (size_t)auxp->elem_len / sizeof (c_double_complex);
+ assert (sz==1);
+ ub = ex + lb - 1;
+ ip = (c_double_complex*)auxp->base_addr;
+ for (i=0; i<ex; i++, ip+=sz)
+ if ((cabs (*ip-(c_double_complex)(CMPLX((i+1), (2*(i+1)))))>(double)0.0))
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (c_double_complex*)CFI_address(auxp, &i);
+ if ((cabs (*ip-(c_double_complex)(CMPLX((i-lb+1), (2*(i-lb+1)))))>(double)0.0))
+ return false;
+ }
+ return true;
+}
+
+bool
+c_vrfy_c_long_double_complex (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ size_t sz;
+ c_long_double_complex *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ assert (auxp->elem_len>0);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ assert (ex==11);
+ sz = (size_t)auxp->elem_len / sizeof (c_long_double_complex);
+ assert (sz==1);
+ ub = ex + lb - 1;
+ ip = (c_long_double_complex*)auxp->base_addr;
+ for (i=0; i<ex; i++, ip+=sz)
+ if ((cabsl (*ip-(c_long_double_complex)(CMPLXL((i+1), (2*(i+1)))))>(long double)0.0))
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (c_long_double_complex*)CFI_address(auxp, &i);
+ if ((cabsl (*ip-(c_long_double_complex)(CMPLXL((i-lb+1), (2*(i-lb+1)))))>(long double)0.0))
+ return false;
+ }
+ return true;
+}
+
+bool
+c_vrfy_c_float128_complex (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ size_t sz;
+ c_float128_complex *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ assert (auxp->elem_len>0);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ assert (ex==11);
+ sz = (size_t)auxp->elem_len / sizeof (c_float128_complex);
+ assert (sz==1);
+ ub = ex + lb - 1;
+ ip = (c_float128_complex*)auxp->base_addr;
+ for (i=0; i<ex; i++, ip+=sz)
+ if ((cabs ((double complex)(*ip-(c_float128_complex)(CMPLX((i+1), (2*(i+1))))))>(double)0.0))
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (c_float128_complex*)CFI_address(auxp, &i);
+ if ((cabs ((double complex)(*ip-(c_float128_complex)(CMPLX((i-lb+1), (2*(i-lb+1))))))>(double)0.0))
+ return false;
+ }
+ return true;
+}
+
+bool
+c_vrfy_complex (const CFI_cdesc_t *restrict auxp)
+{
+ signed char type, kind;
+
+ assert (auxp);
+ type = _CFI_decode_type(auxp->type);
+ kind = _CFI_decode_kind(auxp->type);
+ assert (type == CFI_type_Complex);
+ switch (kind)
+ {
+ case 4:
+ return c_vrfy_c_float_complex (auxp);
+ break;
+ case 8:
+ return c_vrfy_c_double_complex (auxp);
+ break;
+ case 10:
+ return c_vrfy_c_long_double_complex (auxp);
+ break;
+ case 16:
+ return c_vrfy_c_float128_complex (auxp);
+ break;
+ default:
+ assert (false);
+ }
+ return true;
+}
+
+void
+check_tk (const CFI_cdesc_t *restrict auxp, const CFI_type_t type, const signed char kind, const size_t elem_len, const size_t nelem)
+{
+ signed char ityp, iknd;
+
+ assert (auxp);
+ assert (auxp->elem_len==elem_len*nelem);
+ assert (auxp->rank==1);
+ assert (auxp->dim[0].sm>0);
+ assert ((size_t)auxp->dim[0].sm==elem_len*nelem);
+ /* */
+ assert (auxp->type==type);
+ ityp = _CFI_decode_type(auxp->type);
+ assert (ityp == CFI_type_Complex);
+ iknd = _CFI_decode_kind(auxp->type);
+ assert (_CFI_decode_type(type)==ityp);
+ assert (kind==iknd);
+ assert (c_vrfy_complex (auxp));
+ return;
+}
+
+// Local Variables:
+// mode: C
+// End:
diff --git a/gcc/testsuite/gfortran.dg/PR100914.f90 b/gcc/testsuite/gfortran.dg/PR100914.f90
new file mode 100644
index 0000000..64b3335
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100914.f90
@@ -0,0 +1,651 @@
+! Fails on x86 targets where sizeof(long double) == 16.
+! { dg-do run { xfail { { x86_64*-*-* i?86*-*-* } && longdouble128 } } }
+! { dg-additional-sources PR100914.c }
+! { dg-require-effective-target fortran_real_c_float128 }
+!
+! Test the fix for PR100914
+!
+
+module isof_m
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_signed_char, c_int16_t
+
+ implicit none
+
+ private
+
+ public :: &
+ CFI_type_Complex, &
+ CFI_type_float_Complex, &
+ CFI_type_double_Complex, &
+ CFI_type_long_double_Complex, &
+ CFI_type_float128_Complex
+
+ public :: &
+ check_tk_as, &
+ check_tk_ar
+
+
+ public :: &
+ cfi_encode_type
+
+ integer, parameter :: CFI_type_t = c_int16_t
+
+ integer(kind=c_int16_t), parameter :: CFI_type_mask = int(z"FF", kind=c_int16_t)
+ integer(kind=c_int16_t), parameter :: CFI_type_kind_shift = 8_c_int16_t
+
+ ! Intrinsic types. Their kind number defines their storage size. */
+ integer(kind=c_signed_char), parameter :: CFI_type_Complex = 4
+
+ ! C-Fortran Interoperability types.
+ integer(kind=cfi_type_t), parameter :: CFI_type_float_Complex = &
+ ior(int(CFI_type_Complex, kind=c_int16_t), shiftl(4_c_int16_t, CFI_type_kind_shift))
+ integer(kind=cfi_type_t), parameter :: CFI_type_double_Complex = &
+ ior(int(CFI_type_Complex, kind=c_int16_t), shiftl(8_c_int16_t, CFI_type_kind_shift))
+ integer(kind=cfi_type_t), parameter :: CFI_type_long_double_Complex = &
+ ior(int(CFI_type_Complex, kind=c_int16_t), shiftl(10_c_int16_t, CFI_type_kind_shift))
+ integer(kind=cfi_type_t), parameter :: CFI_type_float128_Complex = &
+ ior(int(CFI_type_Complex, kind=c_int16_t), shiftl(16_c_int16_t, CFI_type_kind_shift))
+
+ interface
+ subroutine check_tk_as(a, t, k, e, n) &
+ bind(c, name="check_tk")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int16_t, c_signed_char, c_size_t
+ implicit none
+ type(*), intent(in) :: a(:)
+ integer(c_int16_t), value, intent(in) :: t
+ integer(c_signed_char), value, intent(in) :: k
+ integer(c_size_t), value, intent(in) :: e
+ integer(c_size_t), value, intent(in) :: n
+ end subroutine check_tk_as
+ subroutine check_tk_ar(a, t, k, e, n) &
+ bind(c, name="check_tk")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int16_t, c_signed_char, c_size_t
+ implicit none
+ type(*), intent(in) :: a(..)
+ integer(c_int16_t), value, intent(in) :: t
+ integer(c_signed_char), value, intent(in) :: k
+ integer(c_size_t), value, intent(in) :: e
+ integer(c_size_t), value, intent(in) :: n
+ end subroutine check_tk_ar
+ end interface
+
+contains
+
+ elemental function cfi_encode_type(type, kind) result(itype)
+ integer(kind=c_signed_char), intent(in) :: type
+ integer(kind=c_signed_char), intent(in) :: kind
+
+ integer(kind=c_int16_t) :: itype, ikind
+
+ itype = int(type, kind=c_int16_t)
+ itype = iand(itype, CFI_type_mask)
+ ikind = int(kind, kind=c_int16_t)
+ ikind = iand(ikind, CFI_type_mask)
+ ikind = shiftl(ikind, CFI_type_kind_shift)
+ itype = ior(ikind, itype)
+ return
+ end function cfi_encode_type
+
+end module isof_m
+
+module iso_check_m
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_signed_char, c_int16_t, c_size_t
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_float_complex, &
+ c_double_complex, &
+ c_long_double_complex, &
+ c_float128_complex
+
+ use :: isof_m, only: &
+ CFI_type_Complex
+
+ use :: isof_m, only: &
+ CFI_type_float_Complex, &
+ CFI_type_double_Complex, &
+ CFI_type_long_double_Complex, &
+ CFI_type_float128_Complex
+
+ use :: isof_m, only: &
+ check_tk_as, &
+ check_tk_ar
+
+ use :: isof_m, only: &
+ cfi_encode_type
+
+ implicit none
+
+ private
+
+ public :: &
+ check_c_float_complex, &
+ check_c_double_complex, &
+ check_c_long_double_complex, &
+ check_c_float128_complex
+
+ integer :: i
+ integer(kind=c_size_t), parameter :: b = 8
+ integer, parameter :: n = 11
+
+ complex(kind=c_float_complex), parameter :: ref_c_float_complex(*) = &
+ [(cmplx(i, 2*i, kind=c_float_complex), i=1,n)]
+ complex(kind=c_double_complex), parameter :: ref_c_double_complex(*) = &
+ [(cmplx(i, 2*i, kind=c_double_complex), i=1,n)]
+ complex(kind=c_long_double_complex), parameter :: ref_c_long_double_complex(*) = &
+ [(cmplx(i, 2*i, kind=c_long_double_complex), i=1,n)]
+ complex(kind=c_float128_complex), parameter :: ref_c_float128_complex(*) = &
+ [(cmplx(i, 2*i, kind=c_float128_complex), i=1,n)]
+
+contains
+
+ ! CFI_type_float_complex
+ subroutine check_c_float_complex()
+ complex(kind=c_float_complex) :: a(n)
+ !
+ if (c_float_complex/=4) stop 1
+ a = ref_c_float_complex
+ call f_check_c_float_complex_as(a)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 2
+ a = ref_c_float_complex
+ call c_check_c_float_complex_as(a)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 3
+ a = ref_c_float_complex
+ call f_check_c_float_complex_ar(a)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 4
+ a = ref_c_float_complex
+ call c_check_c_float_complex_ar(a)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 5
+ return
+ end subroutine check_c_float_complex
+
+ subroutine f_check_c_float_complex_as(a)
+ complex(kind=c_float_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 6
+ if(k/=4_c_signed_char) stop 7
+ if(int(k, kind=c_size_t)/=(e/2)) stop 8
+ if(t/=CFI_type_float_complex) stop 9
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 10
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 11
+ return
+ end subroutine f_check_c_float_complex_as
+
+ subroutine c_check_c_float_complex_as(a) bind(c)
+ complex(kind=c_float_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 12
+ if(k/=4_c_signed_char) stop 13
+ if(int(k, kind=c_size_t)/=(e/2)) stop 14
+ if(t/=CFI_type_float_complex) stop 15
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 16
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 17
+ return
+ end subroutine c_check_c_float_complex_as
+
+ subroutine f_check_c_float_complex_ar(a)
+ complex(kind=c_float_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 18
+ if(k/=4_c_signed_char) stop 19
+ if(int(k, kind=c_size_t)/=(e/2)) stop 20
+ if(t/=CFI_type_float_complex) stop 21
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 22
+ rank default
+ stop 23
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 24
+ rank default
+ stop 25
+ end select
+ return
+ end subroutine f_check_c_float_complex_ar
+
+ subroutine c_check_c_float_complex_ar(a) bind(c)
+ complex(kind=c_float_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 26
+ if(k/=4_c_signed_char) stop 27
+ if(int(k, kind=c_size_t)/=(e/2)) stop 28
+ if(t/=CFI_type_float_complex) stop 29
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 30
+ rank default
+ stop 31
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float_complex)>0.0_c_float_complex)) stop 32
+ rank default
+ stop 33
+ end select
+ return
+ end subroutine c_check_c_float_complex_ar
+
+ ! CFI_type_double_complex
+ subroutine check_c_double_complex()
+ complex(kind=c_double_complex) :: a(n)
+ !
+ if (c_double_complex/=8) stop 34
+ a = ref_c_double_complex
+ call f_check_c_double_complex_as(a)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 35
+ a = ref_c_double_complex
+ call c_check_c_double_complex_as(a)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 36
+ a = ref_c_double_complex
+ call f_check_c_double_complex_ar(a)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 37
+ a = ref_c_double_complex
+ call c_check_c_double_complex_ar(a)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 38
+ return
+ end subroutine check_c_double_complex
+
+ subroutine f_check_c_double_complex_as(a)
+ complex(kind=c_double_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 39
+ if(k/=8_c_signed_char) stop 40
+ if(int(k, kind=c_size_t)/=(e/2)) stop 41
+ if(t/=CFI_type_double_complex) stop 42
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 43
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 44
+ return
+ end subroutine f_check_c_double_complex_as
+
+ subroutine c_check_c_double_complex_as(a) bind(c)
+ complex(kind=c_double_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 45
+ if(k/=8_c_signed_char) stop 46
+ if(int(k, kind=c_size_t)/=(e/2)) stop 47
+ if(t/=CFI_type_double_complex) stop 48
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 49
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 50
+ return
+ end subroutine c_check_c_double_complex_as
+
+ subroutine f_check_c_double_complex_ar(a)
+ complex(kind=c_double_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 51
+ if(k/=8_c_signed_char) stop 52
+ if(int(k, kind=c_size_t)/=(e/2)) stop 53
+ if(t/=CFI_type_double_complex) stop 54
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 55
+ rank default
+ stop 56
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 57
+ rank default
+ stop 58
+ end select
+ return
+ end subroutine f_check_c_double_complex_ar
+
+ subroutine c_check_c_double_complex_ar(a) bind(c)
+ complex(kind=c_double_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 59
+ if(k/=8_c_signed_char) stop 60
+ if(int(k, kind=c_size_t)/=(e/2)) stop 61
+ if(t/=CFI_type_double_complex) stop 62
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 63
+ rank default
+ stop 64
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_double_complex)>0.0_c_double_complex)) stop 65
+ rank default
+ stop 66
+ end select
+ return
+ end subroutine c_check_c_double_complex_ar
+
+ ! CFI_type_long_double_complex
+ subroutine check_c_long_double_complex()
+ complex(kind=c_long_double_complex) :: a(n)
+ !
+ if (c_long_double_complex/=10) stop 67
+ a = ref_c_long_double_complex
+ call f_check_c_long_double_complex_as(a)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 68
+ a = ref_c_long_double_complex
+ call c_check_c_long_double_complex_as(a)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 69
+ a = ref_c_long_double_complex
+ call f_check_c_long_double_complex_ar(a)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 70
+ a = ref_c_long_double_complex
+ call c_check_c_long_double_complex_ar(a)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 71
+ return
+ end subroutine check_c_long_double_complex
+
+ subroutine f_check_c_long_double_complex_as(a)
+ complex(kind=c_long_double_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 72
+ if(k/=10_c_signed_char) stop 73
+ if(e/=32) stop 74
+ if(t/=CFI_type_long_double_complex) stop 75
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 76
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 77
+ return
+ end subroutine f_check_c_long_double_complex_as
+
+ subroutine c_check_c_long_double_complex_as(a) bind(c)
+ complex(kind=c_long_double_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 78
+ if(k/=10_c_signed_char) stop 79
+ if(e/=32) stop 80
+ if(t/=CFI_type_long_double_complex) stop 81
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 82
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 83
+ return
+ end subroutine c_check_c_long_double_complex_as
+
+ subroutine f_check_c_long_double_complex_ar(a)
+ complex(kind=c_long_double_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 84
+ if(k/=10_c_signed_char) stop 85
+ if(e/=32) stop 86
+ if(t/=CFI_type_long_double_complex) stop 87
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 88
+ rank default
+ stop 89
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 90
+ rank default
+ stop 91
+ end select
+ return
+ end subroutine f_check_c_long_double_complex_ar
+
+ subroutine c_check_c_long_double_complex_ar(a) bind(c)
+ complex(kind=c_long_double_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 92
+ if(k/=10_c_signed_char) stop 93
+ if(e/=32) stop 94
+ if(t/=CFI_type_long_double_complex) stop 95
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 96
+ rank default
+ stop 97
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_long_double_complex)>0.0_c_long_double_complex)) stop 98
+ rank default
+ stop 99
+ end select
+ return
+ end subroutine c_check_c_long_double_complex_ar
+
+ ! CFI_type_float128_complex
+ subroutine check_c_float128_complex()
+ complex(kind=c_float128_complex) :: a(n)
+ !
+ if (c_float128_complex/=16) stop 100
+ a = ref_c_float128_complex
+ call f_check_c_float128_complex_as(a)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 101
+ a = ref_c_float128_complex
+ call c_check_c_float128_complex_as(a)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 102
+ a = ref_c_float128_complex
+ call f_check_c_float128_complex_ar(a)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 103
+ a = ref_c_float128_complex
+ call c_check_c_float128_complex_ar(a)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 104
+ return
+ end subroutine check_c_float128_complex
+
+ subroutine f_check_c_float128_complex_as(a)
+ complex(kind=c_float128_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 105
+ if(k/=16_c_signed_char) stop 106
+ if(int(k, kind=c_size_t)/=(e/2)) stop 107
+ if(t/=CFI_type_float128_complex) stop 108
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 109
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 110
+ return
+ end subroutine f_check_c_float128_complex_as
+
+ subroutine c_check_c_float128_complex_as(a) bind(c)
+ complex(kind=c_float128_complex), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 111
+ if(k/=16_c_signed_char) stop 112
+ if(int(k, kind=c_size_t)/=(e/2)) stop 113
+ if(t/=CFI_type_float128_complex) stop 114
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 115
+ call check_tk_as(a, t, k, e, 1_c_size_t)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 116
+ return
+ end subroutine c_check_c_float128_complex_as
+
+ subroutine f_check_c_float128_complex_ar(a)
+ complex(kind=c_float128_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 117
+ if(k/=16_c_signed_char) stop 118
+ if(int(k, kind=c_size_t)/=(e/2)) stop 119
+ if(t/=CFI_type_float128_complex) stop 120
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 121
+ rank default
+ stop 122
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 123
+ rank default
+ stop 124
+ end select
+ return
+ end subroutine f_check_c_float128_complex_ar
+
+ subroutine c_check_c_float128_complex_ar(a) bind(c)
+ complex(kind=c_float128_complex), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = kind(a)
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_complex, k)
+ if(k<=0_c_signed_char) stop 125
+ if(k/=16_c_signed_char) stop 126
+ if(int(k, kind=c_size_t)/=(e/2)) stop 127
+ if(t/=CFI_type_float128_complex) stop 128
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 129
+ rank default
+ stop 130
+ end select
+ call check_tk_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ if(any(abs(a-ref_c_float128_complex)>0.0_c_float128_complex)) stop 131
+ rank default
+ stop 132
+ end select
+ return
+ end subroutine c_check_c_float128_complex_ar
+
+end module iso_check_m
+
+program main_p
+
+ use :: iso_check_m, only: &
+ check_c_float_complex, &
+ check_c_double_complex, &
+ check_c_long_double_complex, &
+ check_c_float128_complex
+
+ implicit none
+
+ call check_c_float_complex()
+ call check_c_double_complex()
+ ! see PR100910
+ ! call check_c_long_double_complex()
+ call check_c_float128_complex()
+ stop
+
+end program main_p
+
+!! Local Variables:
+!! mode: f90
+!! End:
+
diff --git a/gcc/testsuite/gfortran.dg/PR100915.c b/gcc/testsuite/gfortran.dg/PR100915.c
new file mode 100644
index 0000000..5b219b3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100915.c
@@ -0,0 +1,80 @@
+/* Test the fix for PR100915 */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+
+#define _CFI_type_mask 0xFF
+#define _CFI_type_kind_shift 8
+
+#define _CFI_decode_type(NAME) (signed char)((NAME) & CFI_type_mask)
+#define _CFI_decode_kind(NAME) (signed char)(((NAME) >> CFI_type_kind_shift) & CFI_type_mask)
+
+#define _CFI_encode_type(TYPE, KIND) (int16_t)\
+((((KIND) & CFI_type_mask) << CFI_type_kind_shift)\
+ | ((TYPE) & CFI_type_mask))
+
+#define N 11
+#define M 7
+
+typedef int(*c_funptr)(int);
+
+bool c_vrfy_c_funptr (const CFI_cdesc_t *restrict);
+
+void check_fn (const CFI_cdesc_t*restrict, const CFI_type_t, const signed char, const size_t, const size_t);
+
+bool
+c_vrfy_c_funptr (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ size_t sz;
+ c_funptr *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ assert (auxp->elem_len>0);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ assert (ex==11);
+ sz = (size_t)auxp->elem_len / sizeof (c_funptr);
+ assert (sz==1);
+ ub = ex + lb - 1;
+ ip = (c_funptr*)auxp->base_addr;
+ for (i=0; i<ex; i++, ip+=sz)
+ if ((**ip)((int)(i)) != 2*(int)(i))
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (c_funptr*)CFI_address(auxp, &i);
+ if ((**ip)((int)(i-lb)) != 2*(int)(i-lb))
+ return false;
+ }
+ return true;
+}
+
+void
+check_fn (const CFI_cdesc_t *restrict auxp, const CFI_type_t type, const signed char kind, const size_t elem_len, const size_t nelem)
+{
+ signed char ityp, iknd;
+
+ assert (auxp);
+ assert (auxp->elem_len==elem_len*nelem);
+ assert (auxp->rank==1);
+ assert (auxp->dim[0].sm>0);
+ assert ((size_t)auxp->dim[0].sm==elem_len*nelem);
+ /* */
+ assert (auxp->type==type);
+ ityp = _CFI_decode_type(auxp->type);
+ assert (ityp == CFI_type_cptr);
+ iknd = _CFI_decode_kind(auxp->type);
+ assert (_CFI_decode_type(type)==ityp);
+ assert (kind==iknd);
+ assert (c_vrfy_c_funptr (auxp));
+ return;
+}
+
+// Local Variables:
+// mode: C
+// End:
diff --git a/gcc/testsuite/gfortran.dg/PR100915.f90 b/gcc/testsuite/gfortran.dg/PR100915.f90
new file mode 100644
index 0000000..083565e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100915.f90
@@ -0,0 +1,272 @@
+! { dg-do run }
+! { dg-additional-sources PR100915.c }
+!
+! Test the fix for PR100915
+!
+
+module isof_m
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_signed_char, c_int16_t
+
+ implicit none
+
+ private
+
+ public :: &
+ CFI_type_cptr
+
+ public :: &
+ check_fn_as, &
+ check_fn_ar
+
+ public :: &
+ mult2
+
+ public :: &
+ cfi_encode_type
+
+ integer, parameter :: CFI_type_t = c_int16_t
+
+ integer(kind=c_int16_t), parameter :: CFI_type_mask = int(z"FF", kind=c_int16_t)
+ integer(kind=c_int16_t), parameter :: CFI_type_kind_shift = 8_c_int16_t
+
+ ! Intrinsic types. Their kind number defines their storage size. */
+ integer(kind=c_signed_char), parameter :: CFI_type_cptr = 7
+
+ interface
+ subroutine check_fn_as(a, t, k, e, n) &
+ bind(c, name="check_fn")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int16_t, c_signed_char, c_size_t
+ implicit none
+ type(*), intent(in) :: a(:)
+ integer(c_int16_t), value, intent(in) :: t
+ integer(c_signed_char), value, intent(in) :: k
+ integer(c_size_t), value, intent(in) :: e
+ integer(c_size_t), value, intent(in) :: n
+ end subroutine check_fn_as
+ subroutine check_fn_ar(a, t, k, e, n) &
+ bind(c, name="check_fn")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int16_t, c_signed_char, c_size_t
+ implicit none
+ type(*), intent(in) :: a(..)
+ integer(c_int16_t), value, intent(in) :: t
+ integer(c_signed_char), value, intent(in) :: k
+ integer(c_size_t), value, intent(in) :: e
+ integer(c_size_t), value, intent(in) :: n
+ end subroutine check_fn_ar
+ end interface
+
+contains
+
+ function mult2(a) result(b) bind(c)
+ use, intrinsic :: iso_c_binding, only: &
+ c_int
+
+ integer(kind=c_int), value, intent(in) :: a
+
+ integer(kind=c_int) :: b
+
+ b = 2_c_int * a
+ return
+ end function mult2
+
+ elemental function cfi_encode_type(type, kind) result(itype)
+ integer(kind=c_signed_char), intent(in) :: type
+ integer(kind=c_signed_char), intent(in) :: kind
+
+ integer(kind=c_int16_t) :: itype, ikind
+
+ itype = int(type, kind=c_int16_t)
+ itype = iand(itype, CFI_type_mask)
+ ikind = int(kind, kind=c_int16_t)
+ ikind = iand(ikind, CFI_type_mask)
+ ikind = shiftl(ikind, CFI_type_kind_shift)
+ itype = ior(ikind, itype)
+ return
+ end function cfi_encode_type
+
+end module isof_m
+
+module iso_check_m
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_signed_char, c_int16_t, c_size_t
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_funptr, c_funloc, c_associated
+
+ use :: isof_m, only: &
+ CFI_type_cptr
+
+ use :: isof_m, only: &
+ check_fn_as, &
+ check_fn_ar
+
+ use :: isof_m, only: &
+ mult2
+
+ use :: isof_m, only: &
+ cfi_encode_type
+
+ implicit none
+
+ integer :: i
+ integer(kind=c_size_t), parameter :: b = 8
+ integer, parameter :: n = 11
+
+contains
+
+ subroutine check_c_funptr()
+ type(c_funptr) :: p(n)
+ integer :: i
+ !
+ p = [(c_funloc(mult2), i=1,n)]
+ call f_check_c_funptr_as(p)
+ do i = 1, n
+ if(.not.c_associated(p(i), c_funloc(mult2))) stop 1
+ end do
+ p = [(c_funloc(mult2), i=1,n)]
+ call c_check_c_funptr_as(p)
+ do i = 1, n
+ if(.not.c_associated(p(i), c_funloc(mult2))) stop 2
+ end do
+ p = [(c_funloc(mult2), i=1,n)]
+ call f_check_c_funptr_ar(p)
+ do i = 1, n
+ if(.not.c_associated(p(i), c_funloc(mult2))) stop 3
+ end do
+ p = [(c_funloc(mult2), i=1,n)]
+ call c_check_c_funptr_ar(p)
+ do i = 1, n
+ if(.not.c_associated(p(i), c_funloc(mult2))) stop 4
+ end do
+ return
+ end subroutine check_c_funptr
+
+ subroutine f_check_c_funptr_as(a)
+ type(c_funptr), intent(in) :: a(:)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 5
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 6
+ end do
+ call check_fn_as(a, t, k, e, 1_c_size_t)
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 7
+ end do
+ return
+ end subroutine f_check_c_funptr_as
+
+ subroutine c_check_c_funptr_as(a) bind(c)
+ type(c_funptr), intent(in) :: a(:)
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 8
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 9
+ end do
+ call check_fn_as(a, t, k, e, 1_c_size_t)
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 10
+ end do
+ return
+ end subroutine c_check_c_funptr_as
+
+ subroutine f_check_c_funptr_ar(a)
+ type(c_funptr), intent(in) :: a(..)
+ !
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 11
+ select rank(a)
+ rank(1)
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 12
+ end do
+ rank default
+ stop 13
+ end select
+ call check_fn_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 14
+ end do
+ rank default
+ stop 15
+ end select
+ return
+ end subroutine f_check_c_funptr_ar
+
+ subroutine c_check_c_funptr_ar(a) bind(c)
+ type(c_funptr), intent(in) :: a(..)
+ integer(kind=c_int16_t) :: t
+ integer(kind=c_signed_char) :: k
+ integer(kind=c_size_t) :: e
+ !
+ k = 0
+ e = storage_size(a)/b
+ t = cfi_encode_type(CFI_type_cptr, k)
+ ! Assumes 64-bit target.
+ ! if(e/=8) stop 16
+ select rank(a)
+ rank(1)
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 17
+ end do
+ rank default
+ stop 18
+ end select
+ call check_fn_ar(a, t, k, e, 1_c_size_t)
+ select rank(a)
+ rank(1)
+ do i = 1, n
+ if(.not.c_associated(a(i), c_funloc(mult2))) stop 19
+ end do
+ rank default
+ stop 20
+ end select
+ return
+ end subroutine c_check_c_funptr_ar
+
+end module iso_check_m
+
+program main_p
+
+ use :: iso_check_m, only: &
+ check_c_funptr
+
+ implicit none
+
+ call check_c_funptr()
+ stop
+
+end program main_p
+
+!! Local Variables:
+!! mode: f90
+!! End:
+
diff --git a/gcc/testsuite/gfortran.dg/PR82376.f90 b/gcc/testsuite/gfortran.dg/PR82376.f90
new file mode 100644
index 0000000..b99779c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR82376.f90
@@ -0,0 +1,60 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original -fcheck=pointer" }
+!
+! Test the fix for PR82376. The pointer check was doubling up the call
+! to new. The fix reduces the count of 'new' from 5 to 4, or to 3, when
+! counting only calls.
+!
+! Contributed by José Rui Faustino de Sousa <jrfsousa@gmail.com>
+!
+program main_p
+
+ integer, parameter :: n = 10
+
+ type :: foo_t
+ integer, pointer :: v =>null()
+ end type foo_t
+
+ integer, save :: pcnt = 0
+
+ type(foo_t) :: int
+ integer :: i
+
+ do i = 1, n
+ call init(int, i)
+ if(.not.associated(int%v)) stop 1
+ if(int%v/=i) stop 2
+ if(pcnt/=i) stop 3
+ end do
+
+contains
+
+ function new(data) result(this)
+ integer, target, intent(in) :: data
+
+ integer, pointer :: this
+
+ nullify(this)
+ this => data
+ pcnt = pcnt + 1
+ return
+ end function new
+
+ subroutine init(this, data)
+ type(foo_t), intent(out) :: this
+ integer, intent(in) :: data
+
+ call set(this, new(data))
+ return
+ end subroutine init
+
+ subroutine set(this, that)
+ type(foo_t), intent(inout) :: this
+ integer, target, intent(in) :: that
+
+ this%v => that
+ return
+ end subroutine set
+
+end program main_p
+! { dg-final { scan-tree-dump-times { new \(} 3 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/PR93308.f90 b/gcc/testsuite/gfortran.dg/PR93308.f90
new file mode 100644
index 0000000..ee116f9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR93308.f90
@@ -0,0 +1,52 @@
+! { dg-do run }
+!
+! Test the fix for PR94331
+!
+! Contributed by Robin Hogan <r.j.hogan@reading.ac.uk>
+!
+
+program test
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_float
+
+ implicit none
+
+ integer :: i
+ integer, parameter :: n = 11
+ real(kind=c_float), parameter :: u(*) = [(real(i, kind=c_float), i=1,n)]
+
+ real(kind=c_float), allocatable :: A(:)
+ real(kind=c_float) :: E(n)
+ integer(kind=c_int) :: l1, l2, l3
+
+ allocate(A, source=u)
+ l1 = lbound(A, 1)
+ call routine_bindc(A, l2) ! in gcc-9.2.1 this changes lbound of A...
+ l3 = lbound(A, 1)
+ if (l1 /= 1) stop 1
+ if (l1 /= l2) stop 2
+ if (l1 /= l3) stop 3
+ if (any(abs(A(1:n)-u)>0.0_c_float)) stop 4
+ deallocate(A)
+ !
+ E = u
+ l1 = lbound(E, 1)
+ call routine_bindc(E, l2) ! ...but does not change lbound of E
+ l3 = lbound(E, 1)
+ if (l1 /= 1) stop 5
+ if (l1 /= l2) stop 6
+ if (l1 /= l3) stop 7
+ if (any(abs(E(1:n)-u)>0.0_c_float)) stop 8
+
+contains
+
+ subroutine routine_bindc(v, l) bind(c)
+ real(kind=c_float), intent(inout) :: v(:)
+ integer(kind=c_int), intent(out) :: l
+
+ l = lbound(v, 1)
+ if (any(abs(v(1:n)-u)>0.0_c_float)) stop 9
+ end subroutine routine_bindc
+
+end program test
diff --git a/gcc/testsuite/gfortran.dg/PR93963.f90 b/gcc/testsuite/gfortran.dg/PR93963.f90
new file mode 100644
index 0000000..4e1b06f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR93963.f90
@@ -0,0 +1,150 @@
+! { dg-do run }
+!
+! Test the fix for PR93963
+!
+
+function rank_p(this) result(rnk) bind(c)
+ use, intrinsic :: iso_c_binding, only: c_int
+
+ implicit none
+
+ integer(kind=c_int), pointer, intent(in) :: this(..)
+ integer(kind=c_int) :: rnk
+
+ select rank(this)
+ rank(0)
+ rnk = 0
+ rank(1)
+ rnk = 1
+ rank(2)
+ rnk = 2
+ rank(3)
+ rnk = 3
+ rank(4)
+ rnk = 4
+ rank(5)
+ rnk = 5
+ rank(6)
+ rnk = 6
+ rank(7)
+ rnk = 7
+ rank(8)
+ rnk = 8
+ rank(9)
+ rnk = 9
+ rank(10)
+ rnk = 10
+ rank(11)
+ rnk = 11
+ rank(12)
+ rnk = 12
+ rank(13)
+ rnk = 13
+ rank(14)
+ rnk = 14
+ rank(15)
+ rnk = 15
+ rank default
+ rnk = -1000
+ end select
+ return
+end function rank_p
+
+function rank_a(this) result(rnk) bind(c)
+ use, intrinsic :: iso_c_binding, only: c_int
+
+ implicit none
+
+ integer(kind=c_int), allocatable, intent(in) :: this(..)
+ integer(kind=c_int) :: rnk
+
+ select rank(this)
+ rank(0)
+ rnk = 0
+ rank(1)
+ rnk = 1
+ rank(2)
+ rnk = 2
+ rank(3)
+ rnk = 3
+ rank(4)
+ rnk = 4
+ rank(5)
+ rnk = 5
+ rank(6)
+ rnk = 6
+ rank(7)
+ rnk = 7
+ rank(8)
+ rnk = 8
+ rank(9)
+ rnk = 9
+ rank(10)
+ rnk = 10
+ rank(11)
+ rnk = 11
+ rank(12)
+ rnk = 12
+ rank(13)
+ rnk = 13
+ rank(14)
+ rnk = 14
+ rank(15)
+ rnk = 15
+ rank default
+ rnk = -1000
+ end select
+ return
+end function rank_a
+
+program selr_p
+
+ use, intrinsic :: iso_c_binding, only: c_int
+
+ implicit none
+
+ interface
+ function rank_p(this) result(rnk) bind(c)
+ use, intrinsic :: iso_c_binding, only: c_int
+ integer(kind=c_int), pointer, intent(in) :: this(..)
+ integer(kind=c_int) :: rnk
+ end function rank_p
+ end interface
+
+ interface
+ function rank_a(this) result(rnk) bind(c)
+ use, intrinsic :: iso_c_binding, only: c_int
+ integer(kind=c_int), allocatable, intent(in) :: this(..)
+ integer(kind=c_int) :: rnk
+ end function rank_a
+ end interface
+
+ integer(kind=c_int), parameter :: siz = 7
+ integer(kind=c_int), parameter :: rnk = 1
+
+ integer(kind=c_int), pointer :: intp(:)
+ integer(kind=c_int), allocatable :: inta(:)
+ integer(kind=c_int) :: irnk
+
+ nullify(intp)
+ irnk = rank_p(intp)
+ if (irnk /= rnk) stop 1
+ if (irnk /= rank(intp)) stop 2
+ !
+ irnk = rank_a(inta)
+ if (irnk /= rnk) stop 3
+ if (irnk /= rank(inta)) stop 4
+ !
+ allocate(intp(siz))
+ irnk = rank_p(intp)
+ if (irnk /= rnk) stop 5
+ if (irnk /= rank(intp)) stop 6
+ deallocate(intp)
+ nullify(intp)
+ !
+ allocate(inta(siz))
+ if (irnk /= rnk) stop 7
+ if (irnk /= rank(inta)) stop 8
+ deallocate(inta)
+
+end program selr_p
diff --git a/gcc/testsuite/gfortran.dg/PR94327.c b/gcc/testsuite/gfortran.dg/PR94327.c
new file mode 100644
index 0000000..9d22681
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR94327.c
@@ -0,0 +1,70 @@
+/* Test the fix for PR94327. */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+
+bool c_vrfy (const CFI_cdesc_t *restrict);
+
+char get_attr (const CFI_cdesc_t*restrict, bool);
+
+bool
+c_vrfy (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ int *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ ub = ex + lb - 1;
+ ip = (int*)auxp->base_addr;
+ for (i=0; i<ex; i++)
+ if (*ip++ != i+1)
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (int*)CFI_address(auxp, &i);
+ if (*ip != i-lb+1)
+ return false;
+ }
+ return true;
+}
+
+char
+get_attr (const CFI_cdesc_t *restrict auxp, bool alloc)
+{
+ char attr;
+
+ assert (auxp);
+ assert (auxp->elem_len == 4);
+ assert (auxp->rank == 1);
+ assert (auxp->type == CFI_type_int);
+ attr = '\0';
+ switch (auxp->attribute)
+ {
+ case CFI_attribute_pointer:
+ if (alloc && !c_vrfy (auxp))
+ break;
+ attr = 'p';
+ break;
+ case CFI_attribute_allocatable:
+ if (alloc && !c_vrfy (auxp))
+ break;
+ attr = 'a';
+ break;
+ case CFI_attribute_other:
+ assert (alloc);
+ if (!c_vrfy (auxp))
+ break;
+ attr = 'o';
+ break;
+ default:
+ break;
+ }
+ return attr;
+}
+
diff --git a/gcc/testsuite/gfortran.dg/PR94327.f90 b/gcc/testsuite/gfortran.dg/PR94327.f90
new file mode 100644
index 0000000..3cb3ac3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR94327.f90
@@ -0,0 +1,195 @@
+! { dg-do run }
+! { dg-additional-sources PR94327.c }
+!
+! Test the fix for PR94327
+!
+
+program attr_p
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool, c_char
+
+ implicit none
+
+ integer :: i
+ integer, parameter :: n = 11
+ integer, parameter :: u(*) = [(i, i=1,n)]
+
+ interface
+ function attr_p_as(a, s) result(c) &
+ bind(c, name="get_attr")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool, c_char
+ implicit none
+ integer(kind=c_int), pointer, intent(in) :: a(:)
+ logical(kind=c_bool), value, intent(in) :: s
+ character(kind=c_char) :: c
+ end function attr_p_as
+ function attr_a_as(a, s) result(c) &
+ bind(c, name="get_attr")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool, c_char
+ implicit none
+ integer(kind=c_int), allocatable, intent(in) :: a(:)
+ logical(kind=c_bool), value, intent(in) :: s
+ character(kind=c_char) :: c
+ end function attr_a_as
+ function attr_o_as(a, s) result(c) &
+ bind(c, name="get_attr")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool, c_char
+ implicit none
+ integer(kind=c_int), intent(in) :: a(:)
+ logical(kind=c_bool), value, intent(in) :: s
+ character(kind=c_char) :: c
+ end function attr_o_as
+ function attr_p_ar(a, s) result(c) &
+ bind(c, name="get_attr")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool, c_char
+ implicit none
+ integer(kind=c_int), pointer, intent(in) :: a(..)
+ logical(kind=c_bool), value, intent(in) :: s
+ character(kind=c_char) :: c
+ end function attr_p_ar
+ function attr_a_ar(a, s) result(c) &
+ bind(c, name="get_attr")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool, c_char
+ implicit none
+ integer(kind=c_int), allocatable, intent(in) :: a(..)
+ logical(kind=c_bool), value, intent(in) :: s
+ character(kind=c_char) :: c
+ end function attr_a_ar
+ function attr_o_ar(a, s) result(c) &
+ bind(c, name="get_attr")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool, c_char
+ implicit none
+ integer(kind=c_int), intent(in) :: a(..)
+ logical(kind=c_bool), value, intent(in) :: s
+ character(kind=c_char) :: c
+ end function attr_o_ar
+ end interface
+
+ integer(kind=c_int), target :: a(n)
+ integer(kind=c_int), allocatable, target :: b(:)
+ integer(kind=c_int), pointer :: p(:)
+ character(kind=c_char) :: c
+
+ a = u
+ c = attr_p_as(a, .true._c_bool)
+ if(c/='p') stop 1
+ if(any(a/=u)) stop 2
+ !
+ a = u
+ c = attr_p_ar(a, .true._c_bool)
+ if(c/='p') stop 3
+ if(any(a/=u)) stop 4
+ !
+ a = u
+ c = attr_o_as(a, .true._c_bool)
+ if(c/='o') stop 5
+ if(any(a/=u)) stop 6
+ !
+ a = u
+ c = attr_o_ar(a, .true._c_bool)
+ if(c/='o') stop 7
+ if(any(a/=u)) stop 8
+ !
+ allocate(b, source=u)
+ c = attr_p_as(b, .true._c_bool)
+ if(c/='p') stop 9
+ if(.not.allocated(b)) stop 10
+ if(any(b/=u)) stop 11
+ !
+ deallocate(b)
+ allocate(b, source=u)
+ c = attr_p_ar(b, .true._c_bool)
+ if(c/='p') stop 12
+ if(.not.allocated(b)) stop 13
+ if(any(b/=u)) stop 14
+ !
+ deallocate(b)
+ allocate(b, source=u)
+ c = attr_a_as(b, .true._c_bool)
+ if(c/='a') stop 15
+ if(.not.allocated(b)) stop 16
+ if(any(b/=u)) stop 17
+ !
+ deallocate(b)
+ allocate(b, source=u)
+ c = attr_a_ar(b, .true._c_bool)
+ if(c/='a') stop 18
+ if(.not.allocated(b)) stop 19
+ if(any(b/=u)) stop 20
+ !
+ deallocate(b)
+ allocate(b, source=u)
+ c = attr_o_as(b, .true._c_bool)
+ if(c/='o') stop 21
+ if(.not.allocated(b)) stop 22
+ if(any(b/=u)) stop 23
+ !
+ deallocate(b)
+ allocate(b, source=u)
+ c = attr_o_ar(b, .true._c_bool)
+ if(c/='o') stop 24
+ if(.not.allocated(b)) stop 25
+ if(any(b/=u)) stop 26
+ !
+ deallocate(b)
+ c = attr_a_as(b, .false._c_bool)
+ if(c/='a') stop 27
+ if(allocated(b)) stop 28
+ !
+ c = attr_a_ar(b, .false._c_bool)
+ if(c/='a') stop 29
+ if(allocated(b)) stop 30
+ !
+ nullify(p)
+ p => a
+ c = attr_p_as(p, .true._c_bool)
+ if(c/='p') stop 31
+ if(.not.associated(p)) stop 32
+ if(.not.associated(p, a)) stop 33
+ if(any(p/=u)) stop 34
+ !
+ nullify(p)
+ p => a
+ c = attr_p_ar(p, .true._c_bool)
+ if(c/='p') stop 35
+ if(.not.associated(p)) stop 36
+ if(.not.associated(p, a)) stop 37
+ if(any(p/=u)) stop 38
+ !
+ nullify(p)
+ p => a
+ c = attr_o_as(p, .true._c_bool)
+ if(c/='o') stop 39
+ if(.not.associated(p)) stop 40
+ if(.not.associated(p, a)) stop 41
+ if(any(p/=u)) stop 42
+ !
+ nullify(p)
+ p => a
+ c = attr_o_ar(p, .true._c_bool)
+ if(c/='o') stop 43
+ if(.not.associated(p)) stop 44
+ if(.not.associated(p, a)) stop 45
+ if(any(p/=u)) stop 46
+ !
+ nullify(p)
+ c = attr_p_as(p, .false._c_bool)
+ if(c/='p') stop 47
+ if(associated(p)) stop 48
+ if(associated(p, a)) stop 49
+ !
+ nullify(p)
+ c = attr_p_ar(p, .false._c_bool)
+ if(c/='p') stop 50
+ if(associated(p)) stop 51
+ if(associated(p, a)) stop 52
+ stop
+
+end program attr_p
diff --git a/gcc/testsuite/gfortran.dg/PR94331.c b/gcc/testsuite/gfortran.dg/PR94331.c
new file mode 100644
index 0000000..df571c7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR94331.c
@@ -0,0 +1,73 @@
+/* Test the fix for PR94331. */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+
+bool c_vrfy (const CFI_cdesc_t *restrict);
+
+bool check_bounds(const CFI_cdesc_t*restrict, const int, const int);
+
+bool
+c_vrfy (const CFI_cdesc_t *restrict auxp)
+{
+ CFI_index_t i, lb, ub, ex;
+ int *ip = NULL;
+
+ assert (auxp);
+ assert (auxp->base_addr);
+ lb = auxp->dim[0].lower_bound;
+ ex = auxp->dim[0].extent;
+ ub = ex + lb - 1;
+ ip = (int*)auxp->base_addr;
+ for (i=0; i<ex; i++)
+ if (*ip++ != i+1)
+ return false;
+ for (i=lb; i<ub+1; i++)
+ {
+ ip = (int*)CFI_address(auxp, &i);
+ if (*ip != i-lb+1)
+ return false;
+ }
+ return true;
+}
+
+bool
+check_bounds (const CFI_cdesc_t *restrict auxp, const int lb, const int ub)
+{
+ CFI_index_t ex = ub-lb+1;
+ size_t el;
+ bool is_ok = false;
+
+ assert (auxp);
+ el = auxp->elem_len;
+ assert (auxp->rank==1);
+ assert (auxp->type==CFI_type_int);
+ assert (auxp->dim[0].sm>0);
+ assert ((size_t)auxp->dim[0].sm==el);
+ if (auxp->dim[0].extent==ex
+ && auxp->dim[0].lower_bound==lb)
+ {
+ switch(auxp->attribute)
+ {
+ case CFI_attribute_pointer:
+ case CFI_attribute_allocatable:
+ if (!c_vrfy (auxp))
+ break;
+ is_ok = true;
+ break;
+ case CFI_attribute_other:
+ if (!c_vrfy (auxp))
+ break;
+ is_ok = (lb==0);
+ break;
+ default:
+ assert (false);
+ break;
+ }
+ }
+ return is_ok;
+}
+
diff --git a/gcc/testsuite/gfortran.dg/PR94331.f90 b/gcc/testsuite/gfortran.dg/PR94331.f90
new file mode 100644
index 0000000..6185031
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR94331.f90
@@ -0,0 +1,252 @@
+! { dg-do run }
+! { dg-additional-sources PR94331.c }
+!
+! Test the fix for PR94331
+!
+
+program main_p
+
+ use, intrinsic :: iso_c_binding, only: &
+ c_int
+
+ implicit none
+
+ integer :: i
+ integer, parameter :: ex = 11
+ integer, parameter :: lb = 11
+ integer, parameter :: ub = ex+lb-1
+ integer, parameter :: u(*) = [(i, i=1,ex)]
+
+ interface
+ function checkb_p_as(a, l, u) result(c) &
+ bind(c, name="check_bounds")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool
+ implicit none
+ integer(kind=c_int), pointer, intent(in) :: a(:)
+ integer(kind=c_int), value, intent(in) :: l
+ integer(kind=c_int), value, intent(in) :: u
+ logical(kind=c_bool) :: c
+ end function checkb_p_as
+ function checkb_a_as(a, l, u) result(c) &
+ bind(c, name="check_bounds")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool
+ implicit none
+ integer(kind=c_int), allocatable, intent(in) :: a(:)
+ integer(kind=c_int), value, intent(in) :: l
+ integer(kind=c_int), value, intent(in) :: u
+ logical(kind=c_bool) :: c
+ end function checkb_a_as
+ function checkb_o_as(a, l, u) result(c) &
+ bind(c, name="check_bounds")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool
+ implicit none
+ integer(kind=c_int), intent(in) :: a(:)
+ integer(kind=c_int), value, intent(in) :: l
+ integer(kind=c_int), value, intent(in) :: u
+ logical(kind=c_bool) :: c
+ end function checkb_o_as
+ function checkb_p_ar(a, l, u) result(c) &
+ bind(c, name="check_bounds")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool
+ implicit none
+ integer(kind=c_int), pointer, intent(in) :: a(..)
+ integer(kind=c_int), value, intent(in) :: l
+ integer(kind=c_int), value, intent(in) :: u
+ logical(kind=c_bool) :: c
+ end function checkb_p_ar
+ function checkb_a_ar(a, l, u) result(c) &
+ bind(c, name="check_bounds")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool
+ implicit none
+ integer(kind=c_int), allocatable, intent(in) :: a(..)
+ integer(kind=c_int), value, intent(in) :: l
+ integer(kind=c_int), value, intent(in) :: u
+ logical(kind=c_bool) :: c
+ end function checkb_a_ar
+ function checkb_o_ar(a, l, u) result(c) &
+ bind(c, name="check_bounds")
+ use, intrinsic :: iso_c_binding, only: &
+ c_int, c_bool
+ implicit none
+ integer(kind=c_int), intent(in) :: a(..)
+ integer(kind=c_int), value, intent(in) :: l
+ integer(kind=c_int), value, intent(in) :: u
+ logical(kind=c_bool) :: c
+ end function checkb_o_ar
+ end interface
+
+ integer(kind=c_int), target :: a(lb:ub)
+ integer(kind=c_int), allocatable, target :: b(:)
+ integer(kind=c_int), pointer :: p(:)
+
+ a = u
+ if(lbound(a,1)/=lb) stop 1
+ if(ubound(a,1)/=ub) stop 2
+ if(any(shape(a)/=[ex])) stop 3
+ if(.not.checkb_p_as(a, lb, ub)) stop 4
+ if(lbound(a,1)/=lb) stop 5
+ if(ubound(a,1)/=ub) stop 6
+ if(any(shape(a)/=[ex])) stop 7
+ if(any(a/=u)) stop 8
+ !
+ a = u
+ if(lbound(a,1)/=lb) stop 9
+ if(ubound(a,1)/=ub) stop 10
+ if(any(shape(a)/=[ex])) stop 11
+ if(.not.checkb_p_ar(a, lb, ub)) stop 12
+ if(lbound(a,1)/=lb) stop 13
+ if(ubound(a,1)/=ub) stop 14
+ if(any(shape(a)/=[ex])) stop 15
+ if(any(a/=u)) stop 16
+ !
+ a = u
+ if(lbound(a,1)/=lb) stop 17
+ if(ubound(a,1)/=ub) stop 18
+ if(any(shape(a)/=[ex])) stop 19
+ if(.not.checkb_o_as(a, 0, ex-1))stop 20
+ if(lbound(a,1)/=lb) stop 21
+ if(ubound(a,1)/=ub) stop 22
+ if(any(shape(a)/=[ex])) stop 23
+ if(any(a/=u)) stop 24
+ !
+ a = u
+ if(lbound(a,1)/=lb) stop 25
+ if(ubound(a,1)/=ub) stop 26
+ if(any(shape(a)/=[ex])) stop 27
+ if(.not.checkb_o_ar(a, 0, ex-1))stop 28
+ if(lbound(a,1)/=lb) stop 29
+ if(ubound(a,1)/=ub) stop 30
+ if(any(shape(a)/=[ex])) stop 31
+ if(any(a/=u)) stop 32
+ !
+ allocate(b(lb:ub), source=u)
+ if(lbound(b,1)/=lb) stop 33
+ if(ubound(b,1)/=ub) stop 34
+ if(any(shape(b)/=[ex])) stop 35
+ if(.not.checkb_p_as(b, lb, ub)) stop 36
+ if(.not.allocated(b)) stop 37
+ if(lbound(b,1)/=lb) stop 38
+ if(ubound(b,1)/=ub) stop 39
+ if(any(shape(b)/=[ex])) stop 40
+ if(any(b/=u)) stop 41
+ !
+ deallocate(b)
+ allocate(b(lb:ub), source=u)
+ if(lbound(b,1)/=lb) stop 42
+ if(ubound(b,1)/=ub) stop 43
+ if(any(shape(b)/=[ex])) stop 44
+ if(.not.checkb_p_ar(b, lb, ub)) stop 45
+ if(.not.allocated(b)) stop 46
+ if(lbound(b,1)/=lb) stop 47
+ if(ubound(b,1)/=ub) stop 48
+ if(any(shape(b)/=[ex])) stop 49
+ if(any(b/=u)) stop 50
+ !
+ deallocate(b)
+ allocate(b(lb:ub), source=u)
+ if(lbound(b,1)/=lb) stop 51
+ if(ubound(b,1)/=ub) stop 52
+ if(any(shape(b)/=[ex])) stop 53
+ if(.not.checkb_a_as(b, lb, ub)) stop 54
+ if(.not.allocated(b)) stop 55
+ if(lbound(b,1)/=lb) stop 56
+ if(ubound(b,1)/=ub) stop 57
+ if(any(shape(b)/=[ex])) stop 58
+ if(any(b/=u)) stop 59
+ !
+ deallocate(b)
+ allocate(b(lb:ub), source=u)
+ if(lbound(b,1)/=lb) stop 60
+ if(ubound(b,1)/=ub) stop 61
+ if(any(shape(b)/=[ex])) stop 62
+ if(.not.checkb_a_ar(b, lb, ub)) stop 63
+ if(.not.allocated(b)) stop 64
+ if(lbound(b,1)/=lb) stop 65
+ if(ubound(b,1)/=ub) stop 66
+ if(any(shape(b)/=[ex])) stop 67
+ if(any(b/=u)) stop 68
+ !
+ deallocate(b)
+ allocate(b(lb:ub), source=u)
+ if(lbound(b,1)/=lb) stop 69
+ if(ubound(b,1)/=ub) stop 70
+ if(any(shape(b)/=[ex])) stop 71
+ if(.not.checkb_o_as(b, 0, ex-1))stop 72
+ if(.not.allocated(b)) stop 73
+ if(lbound(b,1)/=lb) stop 74
+ if(ubound(b,1)/=ub) stop 75
+ if(any(shape(b)/=[ex])) stop 76
+ if(any(b/=u)) stop 77
+ !
+ deallocate(b)
+ allocate(b(lb:ub), source=u)
+ if(lbound(b,1)/=lb) stop 78
+ if(ubound(b,1)/=ub) stop 79
+ if(any(shape(b)/=[ex])) stop 80
+ if(.not.checkb_o_ar(b, 0, ex-1))stop 81
+ if(.not.allocated(b)) stop 82
+ if(lbound(b,1)/=lb) stop 83
+ if(ubound(b,1)/=ub) stop 84
+ if(any(shape(b)/=[ex])) stop 85
+ if(any(b/=u)) stop 86
+ deallocate(b)
+ !
+ p(lb:ub) => a
+ if(lbound(p,1)/=lb) stop 87
+ if(ubound(p,1)/=ub) stop 88
+ if(any(shape(p)/=[ex])) stop 89
+ if(.not.checkb_p_as(p, lb, ub)) stop 90
+ if(.not.associated(p)) stop 91
+ if(.not.associated(p, a)) stop 92
+ if(lbound(p,1)/=lb) stop 93
+ if(ubound(p,1)/=ub) stop 94
+ if(any(shape(p)/=[ex])) stop 95
+ if(any(p/=u)) stop 96
+ !
+ nullify(p)
+ p(lb:ub) => a
+ if(lbound(p,1)/=lb) stop 97
+ if(ubound(p,1)/=ub) stop 98
+ if(any(shape(p)/=[ex])) stop 99
+ if(.not.checkb_p_ar(p, lb, ub)) stop 100
+ if(.not.associated(p)) stop 101
+ if(.not.associated(p, a)) stop 102
+ if(lbound(p,1)/=lb) stop 103
+ if(ubound(p,1)/=ub) stop 104
+ if(any(shape(p)/=[ex])) stop 105
+ if(any(p/=u)) stop 106
+ !
+ nullify(p)
+ p(lb:ub) => a
+ if(lbound(p,1)/=lb) stop 107
+ if(ubound(p,1)/=ub) stop 108
+ if(any(shape(p)/=[ex])) stop 109
+ if(.not.checkb_o_as(p, 0, ex-1))stop 110
+ if(.not.associated(p)) stop 111
+ if(.not.associated(p, a)) stop 112
+ if(lbound(p,1)/=lb) stop 113
+ if(ubound(p,1)/=ub) stop 114
+ if(any(shape(p)/=[ex])) stop 115
+ if(any(p/=u)) stop 116
+ !
+ nullify(p)
+ p(lb:ub) => a
+ if(lbound(p,1)/=lb) stop 117
+ if(ubound(p,1)/=ub) stop 118
+ if(any(shape(p)/=[ex])) stop 119
+ if(.not.checkb_o_ar(p, 0, ex-1))stop 120
+ if(.not.associated(p)) stop 121
+ if(.not.associated(p, a)) stop 122
+ if(lbound(p,1)/=lb) stop 123
+ if(ubound(p,1)/=ub) stop 124
+ if(any(shape(p)/=[ex])) stop 125
+ if(any(p/=u)) stop 126
+ nullify(p)
+ stop
+
+end program main_p
diff --git a/gcc/testsuite/gfortran.dg/PR97046.f90 b/gcc/testsuite/gfortran.dg/PR97046.f90
new file mode 100644
index 0000000..7d133a5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR97046.f90
@@ -0,0 +1,58 @@
+! { dg-do run }
+!
+! Test the fix for PR94331
+!
+! Contributed by Igor Gayday <igor.gayday@mu.edu>
+!
+
+MODULE FOO
+
+ implicit none
+
+ INTEGER, parameter :: n = 11
+
+contains
+
+ SUBROUTINE dummyc(x0) BIND(C)
+ type(*), dimension(..) :: x0
+ if(LBOUND(x0,1)/=1) stop 5
+ if(UBOUND(x0,1)/=n) stop 6
+ if(rank(x0)/=1) stop 7
+ END SUBROUTINE dummyc
+
+ SUBROUTINE dummy(x0)
+ type(*), dimension(..) :: x0
+ call dummyc(x0)
+ END SUBROUTINE dummy
+
+END MODULE
+
+PROGRAM main
+ USE FOO
+ IMPLICIT NONE
+ integer :: before(2), after(2)
+
+ DOUBLE PRECISION, ALLOCATABLE :: buf(:)
+ DOUBLE PRECISION :: buf2(n)
+
+ ALLOCATE(buf(n))
+ before(1) = LBOUND(buf,1)
+ before(2) = UBOUND(buf,1)
+ CALL dummy (buf)
+ after(1) = LBOUND(buf,1)
+ after(2) = UBOUND(buf,1)
+ deallocate(buf)
+
+ if (before(1) .NE. after(1)) stop 1
+ if (before(2) .NE. after(2)) stop 2
+
+ before(1) = LBOUND(buf2,1)
+ before(2) = UBOUND(buf2,1)
+ CALL dummy (buf2)
+ after(1) = LBOUND(buf2,1)
+ after(2) = UBOUND(buf2,1)
+
+ if (before(1) .NE. after(1)) stop 3
+ if (before(2) .NE. after(2)) stop 4
+
+END PROGRAM
diff --git a/gcc/testsuite/gfortran.dg/allocate_stat.f90 b/gcc/testsuite/gfortran.dg/allocate_stat.f90
index 7f9eaf5..f8a1291 100644
--- a/gcc/testsuite/gfortran.dg/allocate_stat.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_stat.f90
@@ -38,7 +38,7 @@ function func2() result(res)
implicit none
real, pointer :: gain
integer :: res
- allocate (gain,STAT=func2) ! { dg-error "is not a variable" }
+ allocate (gain,STAT=func2) ! { dg-error "requires an argument list" }
deallocate(gain)
res = 0
end function func2
@@ -51,7 +51,7 @@ subroutine sub()
end interface
real, pointer :: gain
integer, parameter :: res = 2
- allocate (gain,STAT=func2) ! { dg-error "is not a variable" }
+ allocate (gain,STAT=func2) ! { dg-error "requires an argument list" }
deallocate(gain)
end subroutine sub
@@ -68,9 +68,9 @@ contains
end function one
subroutine sub()
integer, pointer :: p
- allocate(p, stat=one) ! { dg-error "is not a variable" }
+ allocate(p, stat=one) ! { dg-error "requires an argument list" }
if(associated(p)) deallocate(p)
- allocate(p, stat=two) ! { dg-error "is not a variable" }
+ allocate(p, stat=two) ! { dg-error "requires an argument list" }
if(associated(p)) deallocate(p)
end subroutine sub
end module test
diff --git a/gcc/testsuite/gfortran.dg/allocate_stat_3.f90 b/gcc/testsuite/gfortran.dg/allocate_stat_3.f90
new file mode 100644
index 0000000..fe51ff7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_stat_3.f90
@@ -0,0 +1,71 @@
+! { dg-do compile }
+! PR fortran/101564 - ICE in resolve_allocate_deallocate
+
+program p
+ implicit none
+ integer, allocatable :: x(:)
+ integer :: stat
+ integer, pointer :: A
+ integer, target :: ptr
+ real, target :: r
+ character(80) :: c
+ type t
+ integer :: stat
+ real :: r
+ complex :: z
+ end type t
+ type(t), allocatable :: y
+ type tc
+ character(len=:), allocatable :: s
+ end type tc
+ type(tc) :: z
+ allocate (character(42) :: z%s, stat=stat)
+ allocate (x(2), stat=stat)
+ deallocate (x, stat=stat)
+ allocate (A, stat=f())
+ deallocate (A, stat=f())
+ allocate (A, stat=y%stat)
+ deallocate (A, stat=y%stat)
+ allocate (A, stat=stat, errmsg=c(2:79))
+ deallocate (A, stat=stat, errmsg=c(2:79))
+ allocate (A, stat=stat, errmsg=z%s)
+ deallocate (A, stat=stat, errmsg=z%s)
+ allocate (A, stat=stat, errmsg=z%s(2:39))
+ deallocate (A, stat=stat, errmsg=z%s(2:39))
+ allocate (A, stat=y%r) ! { dg-error "must be a scalar INTEGER variable" }
+ deallocate (A, stat=y%r) ! { dg-error "must be a scalar INTEGER variable" }
+ allocate (x(2), stat=stat%kind) ! { dg-error "STAT tag" }
+ deallocate (x, stat=stat%kind) ! { dg-error "STAT variable" }
+ allocate (A, stat=A%kind) ! { dg-error "STAT tag" }
+ deallocate (A, stat=A%kind) ! { dg-error "STAT variable" }
+ allocate (A, stat=c%len) ! { dg-error "STAT tag" }
+ deallocate (A, stat=c%len) ! { dg-error "STAT variable" }
+ allocate (A, stat=y%stat%kind) ! { dg-error "STAT tag" }
+ deallocate (A, stat=y%stat%kind) ! { dg-error "STAT variable" }
+ allocate (y, stat=y%stat) ! { dg-error "within the same ALLOCATE statement" }
+ allocate (y, stat=r) ! { dg-error "must be a scalar INTEGER variable" }
+ allocate (A, stat=y%z%re) ! { dg-error "must be a scalar INTEGER variable" }
+ deallocate (A, stat=y%z%im) ! { dg-error "must be a scalar INTEGER variable" }
+ allocate (y, stat=g()) ! { dg-error "must be a scalar INTEGER variable" }
+ deallocate (y, stat=g()) ! { dg-error "must be a scalar INTEGER variable" }
+ allocate (A, stat=f) ! { dg-error "requires an argument list" }
+ deallocate (A, stat=f) ! { dg-error "requires an argument list" }
+ allocate (y, stat=g) ! { dg-error "requires an argument list" }
+ deallocate (y, stat=g) ! { dg-error "requires an argument list" }
+ allocate (A, stat=z%s%len) ! { dg-error "parameter inquiry" }
+ deallocate (A, stat=z%s%len) ! { dg-error "parameter inquiry" }
+ allocate (A, stat=f(), errmsg="") ! { dg-error "ERRMSG variable" }
+ deallocate (A, stat=f(), errmsg="") ! { dg-error "ERRMSG variable" }
+ allocate (A, stat=stat, errmsg=z%s%len) ! { dg-error "ERRMSG variable" }
+ deallocate (A, stat=stat, errmsg=z%s%len) ! { dg-error "ERRMSG variable" }
+ deallocate (z%s, stat=stat, errmsg=z%s) ! { dg-error "within the same DEALLOCATE statement" }
+contains
+ integer function f()
+ pointer :: f
+ f => ptr
+ end function f
+ real function g()
+ pointer :: g
+ g => r
+ end function g
+end
diff --git a/gcc/testsuite/gfortran.dg/analyzer/pr97668.f b/gcc/testsuite/gfortran.dg/analyzer/pr97668.f
index 568c891..abb6bb2 100644
--- a/gcc/testsuite/gfortran.dg/analyzer/pr97668.f
+++ b/gcc/testsuite/gfortran.dg/analyzer/pr97668.f
@@ -1,4 +1,4 @@
-c { dg-additional-options "-std=legacy" }
+c { dg-additional-options "-std=legacy -Wno-analyzer-use-of-uninitialized-value -Wno-analyzer-too-complex" }
SUBROUTINE PPADD (A, C, BH)
diff --git a/gcc/testsuite/gfortran.dg/argument_checking_25.f90 b/gcc/testsuite/gfortran.dg/argument_checking_25.f90
new file mode 100644
index 0000000..e699160
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/argument_checking_25.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR fortran/100274 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131
+
+program p
+ call s('y') ! { dg-warning "Character length of actual argument" }
+contains
+ subroutine s(x)
+ character(8), intent(out) :: x
+ end
+end
+
+! { dg-error "in variable definition context" " " { target *-*-* } 5 }
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_3.f90 b/gcc/testsuite/gfortran.dg/array_constructor_3.f90
index 7ddd1f4..37d40a4 100644
--- a/gcc/testsuite/gfortran.dg/array_constructor_3.f90
+++ b/gcc/testsuite/gfortran.dg/array_constructor_3.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
! Check that empty array constructors are rejected
program hum
- print *, (//) { dg-error "Empty array constructor" }
+ print *, (//) ! { dg-error "Empty array constructor" }
end program hum
diff --git a/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 b/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90
index 4528d13..ede6eff 100644
--- a/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90
+++ b/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90
@@ -16,9 +16,10 @@ integer :: aa(4,4)
call test(aa)
end
-! { dg-final { scan-assembler-times "\[ \t\]\[$,_0-9\]*myBindC" 1 { target { ! { hppa*-*-* s390*-*-* *-*-cygwin* amdgcn*-*-* } } } } }
+! { dg-final { scan-assembler-times "\[ \t\]\[$,_0-9\]*myBindC" 1 { target { ! { hppa*-*-* s390*-*-* *-*-cygwin* amdgcn*-*-* powerpc-ibm-aix*} } } } }
! { dg-final { scan-assembler-times "myBindC,%r2" 1 { target { hppa*-*-* } } } }
! { dg-final { scan-assembler-times "call\tmyBindC" 1 { target { *-*-cygwin* } } } }
! { dg-final { scan-assembler-times "brasl\t%r\[0-9\]*,myBindC" 1 { target { s390*-*-* } } } }
+! { dg-final { scan-assembler-times "bl \.myBindC" 1 { target { powerpc-ibm-aix* } } } }
! { dg-final { scan-assembler-times "add_u32\t\[sv\]\[0-9\]*, \[sv\]\[0-9\]*, myBindC@rel32@lo" 1 { target { amdgcn*-*-* } } } }
-! { dg-final { scan-tree-dump-times "cfi_desc_to_gfc_desc \\\(&parm\\." 1 "original" } }
+! { dg-final { scan-tree-dump-times "gfc_desc_to_cfi_desc \\\(&cfi\\." 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c b/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c
index 07d1a03..4594185 100644
--- a/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c
+++ b/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c
@@ -5,7 +5,7 @@
#include <errno.h>
#include <stdio.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
void arr_set_c(CFI_cdesc_t*);
diff --git a/gcc/testsuite/gfortran.dg/bind_c_char_10.f90 b/gcc/testsuite/gfortran.dg/bind_c_char_10.f90
new file mode 100644
index 0000000..3595851
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_char_10.f90
@@ -0,0 +1,480 @@
+! { dg-do run }
+! { dg-additional-options "-fdump-tree-original" }
+
+! F2018 - examples with array descriptor
+
+module m
+ use iso_c_binding, only: c_char
+ implicit none (type, external)
+
+contains
+
+! Assumed-shape array, nonallocatable/nonpointer
+
+subroutine as1 (x1) bind(C)
+ character(kind=c_char, len=1) :: x1(:)
+ if (size(x1) /= 6) stop
+ if (len(x1) /= 1) stop
+ if (any (x1 /= ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5'])) stop 1
+ x1 = ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h']
+end
+
+subroutine as2 (x2) bind(C)
+ character(kind=c_char, len=2) :: x2(:)
+ if (size(x2) /= 6) stop
+ if (len(x2) /= 2) stop
+ if (any (x2 /= ['ab', &
+ 'fd', &
+ 'D4', &
+ '54', &
+ 'ga', &
+ 'hg'])) stop
+ x2 = ['ab', &
+ 'hd', &
+ 'fj', &
+ 'a4', &
+ '4a', &
+ 'hf']
+end
+
+subroutine as3 (xn, n) bind(C)
+ integer :: n
+ character(kind=c_char, len=n) :: xn(:)
+ if (size(xn) /= 6) stop
+ if (len(xn) /= 5) stop
+ if (any (xn /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xn = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+end
+
+subroutine as4 (xstar) bind(C)
+ character(kind=c_char, len=*) :: xstar(:)
+ if (size(xstar) /= 6) stop
+ if (len(xstar) /= 5) stop
+ if (any (xstar /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xstar = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+end
+
+! Assumed-rank array, nonallocatable/nonpointer
+
+subroutine ar1 (x1) bind(C)
+ character(kind=c_char, len=1) :: x1(..)
+ if (size(x1) /= 6) stop
+ if (len(x1) /= 1) stop
+ select rank(x1)
+ rank(1)
+ if (any (x1 /= ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5'])) stop
+ x1 = ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h']
+ rank default
+ stop
+ end select
+end
+
+subroutine ar2 (x2) bind(C)
+ character(kind=c_char, len=2) :: x2(..)
+ if (size(x2) /= 6) stop
+ if (len(x2) /= 2) stop
+ select rank(x2)
+ rank(1)
+ if (any (x2 /= ['ab', &
+ 'fd', &
+ 'D4', &
+ '54', &
+ 'ga', &
+ 'hg'])) stop
+ x2 = ['ab', &
+ 'hd', &
+ 'fj', &
+ 'a4', &
+ '4a', &
+ 'hf']
+ rank default
+ stop
+ end select
+end
+
+subroutine ar3 (xn, n) bind(C)
+ integer :: n
+ character(len=n) :: xn(..)
+ if (size(xn) /= 6) stop
+ if (len(xn) /= 5) stop
+ select rank(xn)
+ rank(1)
+ if (any (xn /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xn = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+ rank default
+ stop
+ end select
+end
+
+subroutine ar4 (xstar) bind(C)
+ character(kind=c_char, len=*) :: xstar(..)
+ if (size(xstar) /= 6) stop
+ if (len(xstar) /= 5) stop
+ select rank(xstar)
+ rank(1)
+ if (any (xstar /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xstar = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+ rank default
+ stop
+ end select
+end
+
+! ALLOCATABLE
+
+! Assumed-shape array, allocatable
+
+subroutine a5a (xcolon) bind(C)
+ character(kind=c_char, len=:), allocatable :: xcolon(:)
+ if (.not. allocated (xcolon)) stop
+ if (size(xcolon) /= 6) stop
+ if (len(xcolon) /= 5) stop
+ if (any (xcolon /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xcolon = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+end
+
+! Assumed-rank array, allocatable
+
+subroutine a5ar (xcolon) bind(C)
+ character(kind=c_char, len=:), allocatable :: xcolon(..)
+ if (.not. allocated (xcolon)) stop
+ if (size(xcolon) /= 6) stop
+ if (len(xcolon) /= 5) stop
+ select rank(xcolon)
+ rank(1)
+ if (any (xcolon /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xcolon = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+ rank default
+ stop
+ end select
+end
+
+! POINTER
+! Assumed-shape array, pointer
+
+subroutine a5p (xcolon) bind(C)
+ character(kind=c_char, len=:), pointer :: xcolon(:)
+ if (.not. associated (xcolon)) stop
+ if (size(xcolon) /= 6) stop
+ if (len(xcolon) /= 5) stop
+ if (any (xcolon /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xcolon = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+end
+
+! Assumed-rank array, pointer
+
+subroutine a5pr (xcolon) bind(C)
+ character(kind=c_char, len=:), pointer :: xcolon(..)
+ if (.not. associated (xcolon)) stop
+ if (size(xcolon) /= 6) stop
+ if (len(xcolon) /= 5) stop
+ select rank(xcolon)
+ rank(1)
+ if (any (xcolon /= ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k'])) stop
+ xcolon = ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k']
+ rank default
+ stop
+ end select
+end
+end module m
+
+program main
+ use m
+ implicit none (type, external)
+ character(kind=c_char, len=1) :: str1a6(6)
+ character(kind=c_char, len=2) :: str2a6(6)
+ character(kind=c_char, len=5) :: str5a6(6)
+
+ character(kind=c_char, len=:), allocatable :: astr5a6(:)
+ character(kind=c_char, len=:), pointer :: pstr5a6(:)
+
+ allocate (character(kind=c_char, len=5) :: astr5a6(6), pstr5a6(6))
+
+ ! assumed shape - with array descriptor
+
+ str1a6 = ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5']
+ call as1 (str1a6)
+ if (any (str1a6 /= ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h'])) stop
+ str2a6 = ['ab', &
+ 'fd', &
+ 'D4', &
+ '54', &
+ 'ga', &
+ 'hg']
+ call as2 (str2a6)
+ if (any (str2a6 /= ['ab', &
+ 'hd', &
+ 'fj', &
+ 'a4', &
+ '4a', &
+ 'hf'])) stop
+
+ str5a6 = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call as3 (str5a6, 5)
+ if (any (str5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+
+ str5a6 = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call as4 (str5a6)
+ if (any (str5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+
+ ! assumed rank - with array descriptor
+
+ str1a6 = ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5']
+ call ar1 (str1a6)
+ if (any (str1a6 /= ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h'])) stop
+ str2a6 = ['ab', &
+ 'fd', &
+ 'D4', &
+ '54', &
+ 'ga', &
+ 'hg']
+ call ar2 (str2a6)
+ if (any (str2a6 /= ['ab', &
+ 'hd', &
+ 'fj', &
+ 'a4', &
+ '4a', &
+ 'hf'])) stop
+
+ str5a6 = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call ar3 (str5a6, 5)
+ if (any (str5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+
+
+ str5a6 = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call ar4 (str5a6)
+ if (any (str5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+
+ ! allocatable - with array descriptor
+ astr5a6(:) = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call a5a (astr5a6)
+ if (any (astr5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+
+ astr5a6(:) = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call a5ar (astr5a6)
+ if (any (astr5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+
+
+ ! pointer - with array descriptor
+ pstr5a6 = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call a5p (pstr5a6)
+ if (any (pstr5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+
+ pstr5a6 = ['DDGhf', &
+ 'hdrh$', &
+ 'fDGSl', &
+ 'DFHs3', &
+ '43grG', &
+ 'hFG$k']
+ call a5pr (pstr5a6)
+ if (any (pstr5a6 /= ['FDGhf', &
+ 'hdrhg', &
+ 'fDgFl', &
+ 'DFHs3', &
+ '4a54G', &
+ 'hSs6k'])) stop
+ deallocate (astr5a6, pstr5a6)
+end
+
+! All arguments shall use array descriptors
+! { dg-final { scan-tree-dump-times "void as1 \\(struct array01_character\\(kind=1\\) & restrict x1\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void as2 \\(struct array01_character\\(kind=1\\) & restrict x2\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void as4 \\(struct array01_character\\(kind=1\\) & restrict xstar\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void as3 \\(struct array01_character\\(kind=1\\) & restrict xn, integer(kind=4) & restrict n)
+! { dg-final { scan-tree-dump-times "void ar1 \\(struct array15_character\\(kind=1\\) & restrict x1\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void ar2 \\(struct array15_character\\(kind=1\\) & restrict x2\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void ar3 \\(struct array15_character\\(kind=1\\) & restrict xn, integer(kind=4) & restrict n)
+! { dg-final { scan-tree-dump-times "void ar4 \\(struct array15_character\\(kind=1\\) & restrict xstar\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void a5a \\(struct array01_character\\(kind=1\\) & restrict xcolon\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void a5ar \\(struct array15_character\\(kind=1\\) & restrict xcolon\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void a5p \\(struct array01_character\\(kind=1\\) & xcolon\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "void a5pr \\(struct array15_character\\(kind=1\\) & xcolon\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/bind_c_char_6.f90 b/gcc/testsuite/gfortran.dg/bind_c_char_6.f90
new file mode 100644
index 0000000..6bab295
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_char_6.f90
@@ -0,0 +1,260 @@
+! { dg-do compile }
+! { dg-additional-options "-std=f2003 -fimplicit-none" }
+
+! F2003 only permits length=1 character dummy args
+
+! Scalar, nonallocatable/nonpointer
+
+subroutine s1 (x1) bind(C)
+ character(len=1) :: x1
+end
+
+subroutine s2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 's2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2
+end
+
+subroutine s3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 's3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn
+end
+
+subroutine s4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 's4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar
+end
+
+! Assumed-shape array, nonallocatable/nonpointer
+
+subroutine as1 (x1) bind(C) ! { dg-error "Fortran 2018: Assumed-shape array 'x1' at .1. as dummy argument to the BIND\\(C\\) procedure 'as1' at .2." }
+ character(len=1) :: x1(:)
+end
+
+subroutine as2 (x2) bind(C) ! { dg-error "Fortran 2018: Assumed-shape array 'x2' at .1. as dummy argument to the BIND\\(C\\) procedure 'as2' at .2." }
+ character(len=2) :: x2(:,:)
+end
+
+subroutine as3 (xn, n) bind(C) ! { dg-error "Fortran 2018: Assumed-shape array 'xn' at .1. as dummy argument to the BIND\\(C\\) procedure 'as3' at .2." }
+ integer :: n
+ character(len=n) :: xn(:,:,:)
+end
+
+subroutine as4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 'as4' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Assumed-shape array 'xstar' at .1. as dummy argument to the BIND\\(C\\) procedure 'as4' at .2." "" { target *-*-* } .-1 }
+ character(len=*) :: xstar(:,:,:,:)
+end
+
+! Assumed-rank array, nonallocatable/nonpointer
+
+subroutine ar1 (x1) bind(C) ! { dg-error "Symbol 'x1' at .1. has no IMPLICIT type" }
+ character(len=1) :: x1(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine ar2 (x2) bind(C) ! { dg-error "Symbol 'x2' at .1. has no IMPLICIT type" }
+ character(len=2) :: x2(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine ar3 (xn, n) bind(C) ! { dg-error "Symbol 'xn' at .1. has no IMPLICIT type" }
+ integer :: n
+ character(len=n) :: xn(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine ar4 (xstar) bind(C) ! { dg-error "Symbol 'xstar' at .1. has no IMPLICIT type" }
+ character(len=*) :: xstar(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+! Assumed-size array, nonallocatable/nonpointer
+
+subroutine az1 (x1) bind(C)
+ character(len=1) :: x1(*)
+end
+
+subroutine az2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'az2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2(*)
+end
+
+subroutine az3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'az3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn(*)
+end
+
+subroutine az4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 'az4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar(*)
+end
+
+! Explicit-size array, nonallocatable/nonpointer
+
+subroutine ae1 (x1) bind(C)
+ character(len=1) :: x1(5)
+end
+
+subroutine ae2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'ae2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2(7)
+end
+
+subroutine ae3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'ae3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn(9)
+end
+
+subroutine ae4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 'ae4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar(3)
+end
+
+! ALLOCATABLE
+! Scalar, allocatable
+
+subroutine s1a (x1) bind(C) ! { dg-error "Allocatable character dummy argument 'x1' at .1. must have deferred length as procedure 's1a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with ALLOCATABLE attribute in procedure 's1a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), allocatable :: x1
+end
+
+subroutine s2a (x2) bind(C) ! { dg-error "Allocatable character dummy argument 'x2' at .1. must have deferred length as procedure 's2a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with ALLOCATABLE attribute in procedure 's2a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), allocatable :: x2
+end
+
+subroutine s3a (xn, n) bind(C) ! { dg-error "Allocatable character dummy argument 'xn' at .1. must have deferred length as procedure 's3a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with ALLOCATABLE attribute in procedure 's3a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), allocatable :: xn
+end
+
+subroutine s4a (xstar) bind(C) ! { dg-error "Allocatable character dummy argument 'xstar' at .1. must have deferred length as procedure 's4a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with ALLOCATABLE attribute in procedure 's4a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), allocatable :: xstar
+end
+
+subroutine s5a (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 's5a' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with ALLOCATABLE attribute in procedure 's5a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), allocatable :: xcolon
+end
+
+! Assumed-shape array, allocatable
+
+subroutine a1a (x1) bind(C) ! { dg-error "Allocatable character dummy argument 'x1' at .1. must have deferred length as procedure 'a1a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with ALLOCATABLE attribute in procedure 'a1a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), allocatable :: x1(:)
+end
+
+subroutine a2a (x2) bind(C) ! { dg-error "Allocatable character dummy argument 'x2' at .1. must have deferred length as procedure 'a2a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with ALLOCATABLE attribute in procedure 'a2a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), allocatable :: x2(:,:)
+end
+
+subroutine a3a (xn, n) bind(C) ! { dg-error "Allocatable character dummy argument 'xn' at .1. must have deferred length as procedure 'a3a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with ALLOCATABLE attribute in procedure 'a3a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), allocatable :: xn(:,:,:)
+end
+
+subroutine a4a (xstar) bind(C) ! { dg-error "Allocatable character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with ALLOCATABLE attribute in procedure 'a4a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), allocatable :: xstar(:,:,:,:)
+end
+
+subroutine a5a (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 'a5a' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with ALLOCATABLE attribute in procedure 'a5a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), allocatable :: xcolon(:)
+end
+
+! Assumed-rank array, allocatable
+
+subroutine a1ar (x1) bind(C) ! { dg-error "Symbol 'x1' at .1. has no IMPLICIT type" }
+ character(len=1), allocatable :: x1(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a2ar (x2) bind(C) ! { dg-error "Symbol 'x2' at .1. has no IMPLICIT type" }
+ character(len=2), allocatable :: x2(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a3ar (xn, n) bind(C) ! { dg-error "Symbol 'xn' at .1. has no IMPLICIT type" }
+ integer :: n
+ character(len=n), allocatable :: xn(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a4ar (xstar) bind(C) ! { dg-error "Symbol 'xstar' at .1. has no IMPLICIT type" }
+ character(len=*), allocatable :: xstar(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a5ar (xcolon) bind(C) ! { dg-error "Symbol 'xcolon' at .1. has no IMPLICIT type" }
+ character(len=:), allocatable :: xcolon(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+! POINTER
+! Scalar, pointer
+
+subroutine s1p (x1) bind(C) ! { dg-error "Pointer character dummy argument 'x1' at .1. must have deferred length as procedure 's1p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with POINTER attribute in procedure 's1p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), pointer :: x1
+end
+
+subroutine s2p (x2) bind(C) ! { dg-error "Pointer character dummy argument 'x2' at .1. must have deferred length as procedure 's2p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with POINTER attribute in procedure 's2p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), pointer :: x2
+end
+
+subroutine s3p (xn, n) bind(C) ! { dg-error "Pointer character dummy argument 'xn' at .1. must have deferred length as procedure 's3p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with POINTER attribute in procedure 's3p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), pointer :: xn
+end
+
+subroutine s4p (xstar) bind(C) ! { dg-error "Pointer character dummy argument 'xstar' at .1. must have deferred length as procedure 's4p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with POINTER attribute in procedure 's4p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), pointer :: xstar
+end
+
+subroutine s5p (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 's5p' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with POINTER attribute in procedure 's5p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), pointer :: xcolon
+end
+
+! Assumed-shape array, pointer
+
+subroutine a1p (x1) bind(C) ! { dg-error "Pointer character dummy argument 'x1' at .1. must have deferred length as procedure 'a1p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with POINTER attribute in procedure 'a1p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), pointer :: x1(:)
+end
+
+subroutine a2p (x2) bind(C) ! { dg-error "Pointer character dummy argument 'x2' at .1. must have deferred length as procedure 'a2p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with POINTER attribute in procedure 'a2p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), pointer :: x2(:,:)
+end
+
+subroutine a3p (xn, n) bind(C) ! { dg-error "Pointer character dummy argument 'xn' at .1. must have deferred length as procedure 'a3p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with POINTER attribute in procedure 'a3p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), pointer :: xn(:,:,:)
+end
+
+subroutine a4p (xstar) bind(C) ! { dg-error "Pointer character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with POINTER attribute in procedure 'a4p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), pointer :: xstar(:,:,:,:)
+end
+
+subroutine a5p (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 'a5p' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with POINTER attribute in procedure 'a5p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), pointer :: xcolon(:)
+end
+
+! Assumed-rank array, pointer
+
+subroutine a1pr (x1) bind(C) ! { dg-error "Symbol 'x1' at .1. has no IMPLICIT type" }
+ character(len=1), pointer :: x1(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a2pr (x2) bind(C) ! { dg-error "Symbol 'x2' at .1. has no IMPLICIT type" }
+ character(len=2), pointer :: x2(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a3pr (xn, n) bind(C) ! { dg-error "Symbol 'xn' at .1. has no IMPLICIT type" }
+ integer :: n
+ character(len=n), pointer :: xn(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a4pr (xstar) bind(C) ! { dg-error "Symbol 'xstar' at .1. has no IMPLICIT type" }
+ character(len=*), pointer :: xstar(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a5pr (xcolon) bind(C) ! { dg-error "Symbol 'xcolon' at .1. has no IMPLICIT type" }
+ character(len=:), pointer :: xcolon(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
diff --git a/gcc/testsuite/gfortran.dg/bind_c_char_7.f90 b/gcc/testsuite/gfortran.dg/bind_c_char_7.f90
new file mode 100644
index 0000000..5a20b8f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_char_7.f90
@@ -0,0 +1,260 @@
+! { dg-do compile }
+! { dg-additional-options "-std=f2008 -fimplicit-none" }
+
+! F2008 permits constant character lengths for dummy arguments
+
+! Scalar, nonallocatable/nonpointer
+
+subroutine s1 (x1) bind(C)
+ character(len=1) :: x1
+end
+
+subroutine s2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 's2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2
+end
+
+subroutine s3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 's3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn
+end
+
+subroutine s4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 's4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar
+end
+
+! Assumed-shape array, nonallocatable/nonpointer
+
+subroutine as1 (x1) bind(C) ! { dg-error "Fortran 2018: Assumed-shape array 'x1' at .1. as dummy argument to the BIND\\(C\\) procedure 'as1' at .2." }
+ character(len=1) :: x1(:)
+end
+
+subroutine as2 (x2) bind(C) ! { dg-error "Fortran 2018: Assumed-shape array 'x2' at .1. as dummy argument to the BIND\\(C\\) procedure 'as2' at .2." }
+ character(len=2) :: x2(:,:)
+end
+
+subroutine as3 (xn, n) bind(C) ! { dg-error "Fortran 2018: Assumed-shape array 'xn' at .1. as dummy argument to the BIND\\(C\\) procedure 'as3' at .2." }
+ integer :: n
+ character(len=n) :: xn(:,:,:)
+end
+
+subroutine as4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 'as4' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Assumed-shape array 'xstar' at .1. as dummy argument to the BIND\\(C\\) procedure 'as4' at .2." "" { target *-*-* } .-1 }
+ character(len=*) :: xstar(:,:,:,:)
+end
+
+! Assumed-rank array, nonallocatable/nonpointer
+
+subroutine ar1 (x1) bind(C) ! { dg-error "Symbol 'x1' at .1. has no IMPLICIT type" }
+ character(len=1) :: x1(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine ar2 (x2) bind(C) ! { dg-error "Symbol 'x2' at .1. has no IMPLICIT type" }
+ character(len=2) :: x2(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine ar3 (xn, n) bind(C) ! { dg-error "Symbol 'xn' at .1. has no IMPLICIT type" }
+ integer :: n
+ character(len=n) :: xn(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine ar4 (xstar) bind(C) ! { dg-error "Symbol 'xstar' at .1. has no IMPLICIT type" }
+ character(len=*) :: xstar(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+! Assumed-size array, nonallocatable/nonpointer
+
+subroutine az1 (x1) bind(C)
+ character(len=1) :: x1(*)
+end
+
+subroutine az2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'az2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2(*)
+end
+
+subroutine az3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'az3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn(*)
+end
+
+subroutine az4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 'az4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar(*)
+end
+
+! Explicit-size array, nonallocatable/nonpointer
+
+subroutine ae1 (x1) bind(C)
+ character(len=1) :: x1(5)
+end
+
+subroutine ae2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'ae2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2(7)
+end
+
+subroutine ae3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'ae3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn(9)
+end
+
+subroutine ae4 (xstar) bind(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'xstar' at .1. of procedure 'ae4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar(3)
+end
+
+! ALLOCATABLE
+! Scalar, allocatable
+
+subroutine s1a (x1) bind(C) ! { dg-error "Allocatable character dummy argument 'x1' at .1. must have deferred length as procedure 's1a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with ALLOCATABLE attribute in procedure 's1a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), allocatable :: x1
+end
+
+subroutine s2a (x2) bind(C) ! { dg-error "Allocatable character dummy argument 'x2' at .1. must have deferred length as procedure 's2a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with ALLOCATABLE attribute in procedure 's2a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), allocatable :: x2
+end
+
+subroutine s3a (xn, n) bind(C) ! { dg-error "Allocatable character dummy argument 'xn' at .1. must have deferred length as procedure 's3a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with ALLOCATABLE attribute in procedure 's3a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), allocatable :: xn
+end
+
+subroutine s4a (xstar) bind(C) ! { dg-error "Allocatable character dummy argument 'xstar' at .1. must have deferred length as procedure 's4a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with ALLOCATABLE attribute in procedure 's4a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), allocatable :: xstar
+end
+
+subroutine s5a (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 's5a' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with ALLOCATABLE attribute in procedure 's5a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), allocatable :: xcolon
+end
+
+! Assumed-shape array, allocatable
+
+subroutine a1a (x1) bind(C) ! { dg-error "Allocatable character dummy argument 'x1' at .1. must have deferred length as procedure 'a1a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with ALLOCATABLE attribute in procedure 'a1a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), allocatable :: x1(:)
+end
+
+subroutine a2a (x2) bind(C) ! { dg-error "Allocatable character dummy argument 'x2' at .1. must have deferred length as procedure 'a2a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with ALLOCATABLE attribute in procedure 'a2a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), allocatable :: x2(:,:)
+end
+
+subroutine a3a (xn, n) bind(C) ! { dg-error "Allocatable character dummy argument 'xn' at .1. must have deferred length as procedure 'a3a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with ALLOCATABLE attribute in procedure 'a3a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), allocatable :: xn(:,:,:)
+end
+
+subroutine a4a (xstar) bind(C) ! { dg-error "Allocatable character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4a' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with ALLOCATABLE attribute in procedure 'a4a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), allocatable :: xstar(:,:,:,:)
+end
+
+subroutine a5a (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 'a5a' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with ALLOCATABLE attribute in procedure 'a5a' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), allocatable :: xcolon(:)
+end
+
+! Assumed-rank array, allocatable
+
+subroutine a1ar (x1) bind(C) ! { dg-error "Symbol 'x1' at .1. has no IMPLICIT type" }
+ character(len=1), allocatable :: x1(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a2ar (x2) bind(C) ! { dg-error "Symbol 'x2' at .1. has no IMPLICIT type" }
+ character(len=2), allocatable :: x2(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a3ar (xn, n) bind(C) ! { dg-error "Symbol 'xn' at .1. has no IMPLICIT type" }
+ integer :: n
+ character(len=n), allocatable :: xn(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a4ar (xstar) bind(C) ! { dg-error "Symbol 'xstar' at .1. has no IMPLICIT type" }
+ character(len=*), allocatable :: xstar(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a5ar (xcolon) bind(C) ! { dg-error "Symbol 'xcolon' at .1. has no IMPLICIT type" }
+ character(len=:), allocatable :: xcolon(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+! POINTER
+! Scalar, pointer
+
+subroutine s1p (x1) bind(C) ! { dg-error "Pointer character dummy argument 'x1' at .1. must have deferred length as procedure 's1p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with POINTER attribute in procedure 's1p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), pointer :: x1
+end
+
+subroutine s2p (x2) bind(C) ! { dg-error "Pointer character dummy argument 'x2' at .1. must have deferred length as procedure 's2p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with POINTER attribute in procedure 's2p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), pointer :: x2
+end
+
+subroutine s3p (xn, n) bind(C) ! { dg-error "Pointer character dummy argument 'xn' at .1. must have deferred length as procedure 's3p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with POINTER attribute in procedure 's3p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), pointer :: xn
+end
+
+subroutine s4p (xstar) bind(C) ! { dg-error "Pointer character dummy argument 'xstar' at .1. must have deferred length as procedure 's4p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with POINTER attribute in procedure 's4p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), pointer :: xstar
+end
+
+subroutine s5p (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 's5p' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with POINTER attribute in procedure 's5p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), pointer :: xcolon
+end
+
+! Assumed-shape array, pointer
+
+subroutine a1p (x1) bind(C) ! { dg-error "Pointer character dummy argument 'x1' at .1. must have deferred length as procedure 'a1p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x1' at .1. with POINTER attribute in procedure 'a1p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=1), pointer :: x1(:)
+end
+
+subroutine a2p (x2) bind(C) ! { dg-error "Pointer character dummy argument 'x2' at .1. must have deferred length as procedure 'a2p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'x2' at .1. with POINTER attribute in procedure 'a2p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=2), pointer :: x2(:,:)
+end
+
+subroutine a3p (xn, n) bind(C) ! { dg-error "Pointer character dummy argument 'xn' at .1. must have deferred length as procedure 'a3p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xn' at .1. with POINTER attribute in procedure 'a3p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ integer :: n
+ character(len=n), pointer :: xn(:,:,:)
+end
+
+subroutine a4p (xstar) bind(C) ! { dg-error "Pointer character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4p' is BIND\\(C\\)" }
+ ! { dg-error "Fortran 2018: Variable 'xstar' at .1. with POINTER attribute in procedure 'a4p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=*), pointer :: xstar(:,:,:,:)
+end
+
+subroutine a5p (xcolon) bind(C) ! { dg-error "Fortran 2018: Deferred-length character dummy argument 'xcolon' at .1. of procedure 'a5p' with BIND\\(C\\) attribute" }
+ ! { dg-error "Fortran 2018: Variable 'xcolon' at .1. with POINTER attribute in procedure 'a5p' with BIND\\(C\\)" "" { target *-*-* } .-1 }
+ character(len=:), pointer :: xcolon(:)
+end
+
+! Assumed-rank array, pointer
+
+subroutine a1pr (x1) bind(C) ! { dg-error "Symbol 'x1' at .1. has no IMPLICIT type" }
+ character(len=1), pointer :: x1(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a2pr (x2) bind(C) ! { dg-error "Symbol 'x2' at .1. has no IMPLICIT type" }
+ character(len=2), pointer :: x2(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a3pr (xn, n) bind(C) ! { dg-error "Symbol 'xn' at .1. has no IMPLICIT type" }
+ integer :: n
+ character(len=n), pointer :: xn(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a4pr (xstar) bind(C) ! { dg-error "Symbol 'xstar' at .1. has no IMPLICIT type" }
+ character(len=*), pointer :: xstar(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
+
+subroutine a5pr (xcolon) bind(C) ! { dg-error "Symbol 'xcolon' at .1. has no IMPLICIT type" }
+ character(len=:), pointer :: xcolon(..) ! { dg-error "Fortran 2018: Assumed-rank array at .1." }
+end
diff --git a/gcc/testsuite/gfortran.dg/bind_c_char_8.f90 b/gcc/testsuite/gfortran.dg/bind_c_char_8.f90
new file mode 100644
index 0000000..c6f406f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_char_8.f90
@@ -0,0 +1,249 @@
+! { dg-do compile }
+! { dg-additional-options "-fimplicit-none" }
+
+! F2018 only permittes len=*, len=: or len=<const> as dummy argument
+! but not len=<non-const-expr>
+! Additionally, for allocatable/pointer, len=: is required.
+
+! Scalar, nonallocatable/nonpointer
+
+subroutine val_s1(x1) bind(C)
+ character(len=1), value :: x1
+end
+
+subroutine val_s2(x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of length 1 as it has the VALUE attribute" }
+ character(len=2), value :: x2
+end
+
+subroutine s1 (x1) bind(C)
+ character(len=1) :: x1
+end
+
+subroutine s2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 's2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2
+end
+
+subroutine s3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 's3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn
+end
+
+subroutine s4 (xstar) bind(C) ! { dg-error "Sorry, character dummy argument 'xstar' at .1. with assumed length is not yet supported for procedure 's4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar
+end
+
+! Assumed-shape array, nonallocatable/nonpointer
+
+subroutine as1 (x1) bind(C)
+ character(len=1) :: x1(:)
+end
+
+subroutine as2 (x2) bind(C)
+ character(len=2) :: x2(:,:)
+end
+
+subroutine as3 (xn, n) bind(C)
+ integer :: n
+ character(len=n) :: xn(:,:,:)
+end
+
+subroutine as4 (xstar) bind(C)
+ character(len=*) :: xstar(:,:,:,:)
+end
+
+! Assumed-rank array, nonallocatable/nonpointer
+
+subroutine ar1 (x1) bind(C)
+ character(len=1) :: x1(..)
+end
+
+subroutine ar2 (x2) bind(C)
+ character(len=2) :: x2(..)
+end
+
+subroutine ar3 (xn, n) bind(C)
+ integer :: n
+ character(len=n) :: xn(..)
+end
+
+subroutine ar4 (xstar) bind(C)
+ character(len=*) :: xstar(..)
+end
+
+! Assumed-size array, nonallocatable/nonpointer
+
+subroutine az1 (x1) bind(C)
+ character(len=1) :: x1(*)
+end
+
+subroutine az2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'az2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2(*)
+end
+
+subroutine az3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'az3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn(*)
+end
+
+subroutine az4 (xstar) bind(C) ! { dg-error "Sorry, character dummy argument 'xstar' at .1. with assumed length is not yet supported for procedure 'az4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar(*)
+end
+
+! Explicit-size array, nonallocatable/nonpointer
+
+subroutine ae1 (x1) bind(C)
+ character(len=1) :: x1(5)
+end
+
+subroutine ae2 (x2) bind(C) ! { dg-error "Character dummy argument 'x2' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'ae2' has the BIND\\(C\\) attribute" }
+ character(len=2) :: x2(7)
+end
+
+subroutine ae3 (xn, n) bind(C) ! { dg-error "Character dummy argument 'xn' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'ae3' has the BIND\\(C\\) attribute" }
+ integer :: n
+ character(len=n) :: xn(9)
+end
+
+subroutine ae4 (xstar) bind(C) ! { dg-error "Sorry, character dummy argument 'xstar' at .1. with assumed length is not yet supported for procedure 'ae4' with BIND\\(C\\) attribute" }
+ character(len=*) :: xstar(3)
+end
+
+! ALLOCATABLE
+! Scalar, allocatable
+
+subroutine s1a (x1) bind(C) ! { dg-error "Allocatable character dummy argument 'x1' at .1. must have deferred length as procedure 's1a' is BIND\\(C\\)" }
+ character(len=1), allocatable :: x1
+end
+
+subroutine s2a (x2) bind(C) ! { dg-error "Allocatable character dummy argument 'x2' at .1. must have deferred length as procedure 's2a' is BIND\\(C\\)" }
+ character(len=2), allocatable :: x2
+end
+
+subroutine s3a (xn, n) bind(C) ! { dg-error "Allocatable character dummy argument 'xn' at .1. must have deferred length as procedure 's3a' is BIND\\(C\\)" }
+ integer :: n
+ character(len=n), allocatable :: xn
+end
+
+subroutine s4a (xstar) bind(C) ! { dg-error "Allocatable character dummy argument 'xstar' at .1. must have deferred length as procedure 's4a' is BIND\\(C\\)" }
+ character(len=*), allocatable :: xstar
+end
+
+subroutine s5a (xcolon) bind(C) ! { dg-error "Sorry, deferred-length scalar character dummy argument 'xcolon' at .1. of procedure 's5a' with BIND\\(C\\) not yet supported" }
+ character(len=:), allocatable :: xcolon
+end
+
+! Assumed-shape array, allocatable
+
+subroutine a1a (x1) bind(C) ! { dg-error "Allocatable character dummy argument 'x1' at .1. must have deferred length as procedure 'a1a' is BIND\\(C\\)" }
+ character(len=1), allocatable :: x1(:)
+end
+
+subroutine a2a (x2) bind(C) ! { dg-error "Allocatable character dummy argument 'x2' at .1. must have deferred length as procedure 'a2a' is BIND\\(C\\)" }
+ character(len=2), allocatable :: x2(:,:)
+end
+
+subroutine a3a (xn, n) bind(C) ! { dg-error "Allocatable character dummy argument 'xn' at .1. must have deferred length as procedure 'a3a' is BIND\\(C\\)" }
+ integer :: n
+ character(len=n), allocatable :: xn(:,:,:)
+end
+
+subroutine a4a (xstar) bind(C) ! { dg-error "Allocatable character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4a' is BIND\\(C\\)" }
+ character(len=*), allocatable :: xstar(:,:,:,:)
+end
+
+subroutine a5a (xcolon) bind(C)
+ character(len=:), allocatable :: xcolon(:)
+end
+
+! Assumed-rank array, allocatable
+
+subroutine a1ar (x1) bind(C) ! { dg-error "Allocatable character dummy argument 'x1' at .1. must have deferred length as procedure 'a1ar' is BIND\\(C\\)" }
+ character(len=1), allocatable :: x1(..)
+end
+
+subroutine a2ar (x2) bind(C) ! { dg-error "Allocatable character dummy argument 'x2' at .1. must have deferred length as procedure 'a2ar' is BIND\\(C\\)" }
+ character(len=2), allocatable :: x2(..)
+end
+
+subroutine a3ar (xn, n) bind(C) ! { dg-error "Allocatable character dummy argument 'xn' at .1. must have deferred length as procedure 'a3ar' is BIND\\(C\\)" }
+ integer :: n
+ character(len=n), allocatable :: xn(..)
+end
+
+subroutine a4ar (xstar) bind(C) ! { dg-error "Allocatable character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4ar' is BIND\\(C\\)" }
+ character(len=*), allocatable :: xstar(..)
+end
+
+subroutine a5ar (xcolon) bind(C)
+ character(len=:), allocatable :: xcolon(..)
+end
+
+! POINTER
+! Scalar, pointer
+
+subroutine s1p (x1) bind(C) ! { dg-error "Pointer character dummy argument 'x1' at .1. must have deferred length as procedure 's1p' is BIND\\(C\\)" }
+ character(len=1), pointer :: x1
+end
+
+subroutine s2p (x2) bind(C) ! { dg-error "Pointer character dummy argument 'x2' at .1. must have deferred length as procedure 's2p' is BIND\\(C\\)" }
+ character(len=2), pointer :: x2
+end
+
+subroutine s3p (xn, n) bind(C) ! { dg-error "Pointer character dummy argument 'xn' at .1. must have deferred length as procedure 's3p' is BIND\\(C\\)" }
+ integer :: n
+ character(len=n), pointer :: xn
+end
+
+subroutine s4p (xstar) bind(C) ! { dg-error "Pointer character dummy argument 'xstar' at .1. must have deferred length as procedure 's4p' is BIND\\(C\\)" }
+ character(len=*), pointer :: xstar
+end
+
+subroutine s5p (xcolon) bind(C) ! { dg-error "Sorry, deferred-length scalar character dummy argument 'xcolon' at .1. of procedure 's5p' with BIND\\(C\\) not yet supported" }
+ character(len=:), pointer :: xcolon
+end
+
+! Assumed-shape array, pointer
+
+subroutine a1p (x1) bind(C) ! { dg-error "Pointer character dummy argument 'x1' at .1. must have deferred length as procedure 'a1p' is BIND\\(C\\)" }
+ character(len=1), pointer :: x1(:)
+end
+
+subroutine a2p (x2) bind(C) ! { dg-error "Pointer character dummy argument 'x2' at .1. must have deferred length as procedure 'a2p' is BIND\\(C\\)" }
+ character(len=2), pointer :: x2(:,:)
+end
+
+subroutine a3p (xn, n) bind(C) ! { dg-error "Pointer character dummy argument 'xn' at .1. must have deferred length as procedure 'a3p' is BIND\\(C\\)" }
+ integer :: n
+ character(len=n), pointer :: xn(:,:,:)
+end
+
+subroutine a4p (xstar) bind(C) ! { dg-error "Pointer character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4p' is BIND\\(C\\)" }
+ character(len=*), pointer :: xstar(:,:,:,:)
+end
+
+subroutine a5p (xcolon) bind(C)
+ character(len=:), pointer :: xcolon(:)
+end
+
+! Assumed-rank array, pointer
+
+subroutine a1pr (x1) bind(C) ! { dg-error "Pointer character dummy argument 'x1' at .1. must have deferred length as procedure 'a1pr' is BIND\\(C\\)" }
+ character(len=1), pointer :: x1(..)
+end
+
+subroutine a2pr (x2) bind(C) ! { dg-error "Pointer character dummy argument 'x2' at .1. must have deferred length as procedure 'a2pr' is BIND\\(C\\)" }
+ character(len=2), pointer :: x2(..)
+end
+
+subroutine a3pr (xn, n) bind(C) ! { dg-error "Pointer character dummy argument 'xn' at .1. must have deferred length as procedure 'a3pr' is BIND\\(C\\)" }
+ integer :: n
+ character(len=n), pointer :: xn(..)
+end
+
+subroutine a4pr (xstar) bind(C) ! { dg-error "Pointer character dummy argument 'xstar' at .1. must have deferred length as procedure 'a4pr' is BIND\\(C\\)" }
+ character(len=*), pointer :: xstar(..)
+end
+
+subroutine a5pr (xcolon) bind(C)
+ character(len=:), pointer :: xcolon(..)
+end
diff --git a/gcc/testsuite/gfortran.dg/bind_c_char_9.f90 b/gcc/testsuite/gfortran.dg/bind_c_char_9.f90
new file mode 100644
index 0000000..64d7340
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_char_9.f90
@@ -0,0 +1,207 @@
+! { dg-do run }
+! { dg-additional-options "-fdump-tree-original" }
+
+! F2018 - examples without array descriptor
+
+
+module m
+ use iso_c_binding, only: c_char
+ implicit none (type, external)
+
+contains
+
+! Scalar, nonallocatable/nonpointer
+subroutine s1 (x1) bind(C)
+ character(kind=c_char, len=1) :: x1
+ if (len (x1) /= 1) stop
+ if (x1 /= 'Z') stop
+ x1 = 'A'
+end
+
+! Valid as Fortran code - but with BIND(C)
+! 18.3.6 (5) (bullet 5) requires interoperability, i.e. len=1
+! which is not fullfilled.
+!
+! [It would work as with len=<const> the length is known
+! and only a bytestream is passed around.]
+!subroutine s2 (x2) bind(C)
+! character(kind=c_char, len=2) :: x2
+! if (len (x2) /= 2) stop
+! if (x2 /= '42') stop
+! x2 = '64'
+!end
+
+! Assumed-size array, nonallocatable/nonpointer
+
+subroutine az1 (x1) bind(C)
+ character(kind=c_char, len=1) :: x1(*)
+ if (len(x1) /= 1) stop
+ if (any (x1(:6) /= ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5'])) stop 1
+ x1(:6) = ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h']
+end
+
+! Valid as Fortran code - but with BIND(C)
+! 18.3.6 (5) (bullet 5) requires interoperability, i.e. len=1
+! which is not fullfilled.
+!
+! [It would work as with len=<const> the length is known
+! and only a bytestream is passed around.]
+!subroutine az2 (x2) bind(C)
+! character(kind=c_char, len=2) :: x2(*)
+! if (len(x2) /= 2) stop
+! if (any (x2(:6) /= ['ab', &
+! 'fd', &
+! 'D4', &
+! '54', &
+! 'ga', &
+! 'hg'])) stop
+! x2(:6) = ['ab', &
+! 'hd', &
+! 'fj', &
+! 'a4', &
+! '4a', &
+! 'hf']
+!end
+
+! Explicit-size array, nonallocatable/nonpointer
+
+subroutine ae1 (x1) bind(C)
+ character(kind=c_char, len=1) :: x1(6)
+ if (size(x1) /= 6) stop
+ if (len(x1) /= 1) stop
+ if (any (x1 /= ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5'])) stop 1
+ x1 = ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h']
+end
+
+! Valid as Fortran code - but with BIND(C)
+! 18.3.6 (5) (bullet 5) requires interoperability, i.e. len=1
+! which is not fullfilled.
+!
+! [It would work as with len=<const> the length is known
+! and only a bytestream is passed around.]
+!subroutine ae2 (x2) bind(C)
+! character(kind=c_char, len=2) :: x2(6)
+! if (size(x2) /= 6) stop
+! if (len(x2) /= 2) stop
+! if (any (x2 /= ['ab', &
+! 'fd', &
+! 'D4', &
+! '54', &
+! 'ga', &
+! 'hg'])) stop
+! x2 = ['ab', &
+! 'hd', &
+! 'fj', &
+! 'a4', &
+! '4a', &
+! 'hf']
+!end
+
+end module m
+
+program main
+ use m
+ implicit none (type, external)
+ character(kind=c_char, len=1) :: str1
+ character(kind=c_char, len=2) :: str2
+
+ character(kind=c_char, len=1) :: str1a6(6)
+ character(kind=c_char, len=2) :: str2a6(6)
+
+ ! Scalar - no array descriptor
+
+ str1 = 'Z'
+ call s1 (str1)
+ if (str1 /= 'A') stop
+
+! str2 = '42'
+! call s2 (str2)
+! if (str2 /= '64') stop
+
+ ! assumed size - without array descriptor
+
+ str1a6 = ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5']
+ call az1 (str1a6)
+ if (any (str1a6 /= ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h'])) stop
+! str2a6 = ['ab', &
+! 'fd', &
+! 'D4', &
+! '54', &
+! 'ga', &
+! 'hg']
+! call az2 (str2a6)
+! if (any (str2a6 /= ['ab', &
+! 'hd', &
+! 'fj', &
+! 'a4', &
+! '4a', &
+! 'hf'])) stop
+
+ ! explicit size - without array descriptor
+
+ str1a6 = ['g', &
+ 'd', &
+ 'f', &
+ 's', &
+ '3', &
+ '5']
+ call ae1 (str1a6)
+ if (any (str1a6 /= ['1', &
+ 'h', &
+ 'f', &
+ '3', &
+ '4', &
+ 'h'])) stop
+! str2a6 = ['ab', &
+! 'fd', &
+! 'D4', &
+! '54', &
+! 'ga', &
+! 'hg']
+! call ae2 (str2a6)
+! if (any (str2a6 /= ['ab', &
+! 'hd', &
+! 'fj', &
+! 'a4', &
+! '4a', &
+! 'hf'])) stop
+end
+
+! All argument shall be passed without descriptor
+! { dg-final { scan-tree-dump-not "dtype" "original" } }
+! { dg-final { scan-tree-dump-times "void s1 \\(character\\(kind=1\\)\\\[1:1\\\] & restrict x1\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-not "void s2 " "original" } }
+! { dg-final { scan-tree-dump-times "void az1 \\(character\\(kind=1\\)\\\[0:\\\]\\\[1:1\\\] \\* restrict x1\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-not "void az2 " "original" } }
+! { dg-final { scan-tree-dump-times "void ae1 \\(character\\(kind=1\\)\\\[6\\\]\\\[1:1\\\] \\* restrict x1\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-not "void ae2 " "original" } }
diff --git a/gcc/testsuite/gfortran.dg/bind_c_contiguous.f90 b/gcc/testsuite/gfortran.dg/bind_c_contiguous.f90
new file mode 100644
index 0000000..fc0d092
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_contiguous.f90
@@ -0,0 +1,33 @@
+module m
+ use iso_c_binding
+ implicit none (type, external)
+contains
+
+! All of the following use an array descriptor
+! F2018, 18.3.7 (5) applies:
+
+subroutine f1 (x) bind(c) ! { dg-error "Dummy argument 'x' at .1. may not be a pointer with CONTIGUOUS attribute as procedure 'f1' is BIND\\(C\\)" }
+ character(len=:, kind=c_char), pointer, contiguous :: x(:)
+end
+
+subroutine f2 (x) bind(c) ! { dg-error "Dummy argument 'x' at .1. may not be a pointer with CONTIGUOUS attribute as procedure 'f2' is BIND\\(C\\)" }
+ integer(c_int), pointer, contiguous :: x(:)
+end
+
+subroutine f3 (x) bind(c)
+ character(len=:, kind=c_char), pointer :: x(:) ! OK - pointer but not contiguous
+end
+
+subroutine f4 (x) bind(c)
+ character(len=*, kind=c_char), contiguous :: x(:) ! OK - contiguous but not a pointer
+end
+
+subroutine f5 (x) bind(c)
+ integer(c_int), pointer :: x(:) ! OK - pointer but not contigous
+end
+
+subroutine f6 (x) bind(c)
+ integer(c_int), contiguous :: x(:) ! OK - contiguous but not a pointer
+end
+
+end
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_22.f90 b/gcc/testsuite/gfortran.dg/bounds_check_22.f90
new file mode 100644
index 0000000..a84e3dd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bounds_check_22.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-fcheck=bounds" }
+! PR fortran/100656 - ICE in gfc_conv_expr_present
+
+subroutine s(x)
+ character(:), allocatable, optional :: x(:)
+ if ( present(x) ) then
+ if ( allocated(x) ) then
+ x = 'a' // x // 'e'
+ end if
+ end if
+end
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_23.f90 b/gcc/testsuite/gfortran.dg/bounds_check_23.f90
new file mode 100644
index 0000000..8de90c7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bounds_check_23.f90
@@ -0,0 +1,18 @@
+! { dg-do run }
+! { dg-options "-fcheck=bounds -fdump-tree-original" }
+! PR fortran/98490 - out of bounds in array constructor with implied do loop
+
+program test
+ implicit none
+ call sub('Lorem ipsum')
+contains
+ subroutine sub( text )
+ character(len=*), intent(in) :: text
+ character(len=1), allocatable :: c(:)
+ integer :: i
+ c = [ ( text(i:i), i = 1, len(text) ) ]
+ if (c(1) /= 'L') stop 1
+ end subroutine sub
+end program test
+
+! { dg-final { scan-tree-dump-times "Substring out of bounds:" 2 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy-c.c b/gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy-c.c
new file mode 100644
index 0000000..0ed09b5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy-c.c
@@ -0,0 +1,54 @@
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+struct t {
+ float xyz[3];
+ int id;
+};
+
+extern void testit_f_bind_c (CFI_cdesc_t *a, float x, float y, float z);
+extern void testit_c (CFI_cdesc_t *a, float x, float y, float z);
+
+void testit_c (CFI_cdesc_t *a, float x, float y, float z)
+{
+ struct t *tp;
+
+ /* Check that the allocatable dummy is unallocated on entry and do
+ some other sanity checks. */
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (a->rank)
+ abort ();
+ if (a->base_addr)
+ abort ();
+
+ /* Allocate and initialize the output argument. */
+ CFI_allocate (a, NULL, NULL, 0);
+ if (!a->base_addr)
+ abort ();
+ tp = (struct t *) CFI_address (a, NULL);
+ tp->id = 42;
+ tp->xyz[0] = 0.0;
+ tp->xyz[1] = 0.0;
+ tp->xyz[2] = 0.0;
+
+ /* Now call the Fortran function, which is supposed to automatically
+ deallocate the object we just created above and point the descriptor
+ at a different object. */
+ testit_f_bind_c (a, x, y, z);
+
+ /* Make sure we've got an allocated object, initialized as we
+ expect. */
+ if (!a->base_addr)
+ abort ();
+ tp = (struct t *) CFI_address (a, NULL);
+ if (tp->id != -1)
+ abort ();
+ if (tp->xyz[0] != x || tp->xyz[1] != y || tp->xyz[2] != z)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy.f90 b/gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy.f90
new file mode 100644
index 0000000..4161a30
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/allocatable-dummy.f90
@@ -0,0 +1,98 @@
+! PR 101308
+! PR 92621(?)
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "allocatable-dummy-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! TS 29113
+! 6.3 Argument association
+!
+! When a Fortran procedure that has an INTENT(OUT) allocatable dummy
+! argument is invoked by a C function, and the actual argument in the C
+! function is the address of a C descriptor that describes an allocated
+! allocatable variable, the variable is deallocated on entry to the
+! Fortran procedure.
+
+! When a C function is invoked from a Fortran procedure via an interface
+! with an INTENT(OUT) allocatable dummy argument, and the actual
+! argument in the reference to the C function is an allocated
+! allocatable variable, the variable is deallocated on invocation
+! (before execution of the C function begins).
+
+module m
+ use iso_c_binding
+
+ type, bind (c) :: t
+ real(C_FLOAT) :: xyz(3)
+ integer(C_INT) :: id
+ end type
+
+ interface
+ subroutine testit_c (a, x, y, z) bind (c)
+ use iso_c_binding
+ import :: t
+ type (t), allocatable, intent(out) :: a
+ real(C_FLOAT), value, intent(in) :: x, y, z
+ end subroutine
+ end interface
+
+ contains
+
+ subroutine testit_f (a, x, y, z)
+ type (t), allocatable, intent(out) :: a
+ real(C_FLOAT), value, intent(in) :: x, y, z
+ if (allocated (a)) stop 201
+ allocate (a)
+ a%id = 69
+ a%xyz(1) = x
+ a%xyz(2) = y
+ a%xyz(3) = z
+ end subroutine
+
+ subroutine testit_f_bind_c (a, x, y, z) bind (c)
+ type (t), allocatable, intent(out) :: a
+ real(C_FLOAT), value, intent(in) :: x, y, z
+ if (allocated (a)) stop 301
+ allocate (a)
+ a%id = -1
+ a%xyz(1) = x
+ a%xyz(2) = y
+ a%xyz(3) = z
+ end subroutine
+
+end module
+
+program test
+ use iso_c_binding
+ use m
+
+ type (t), allocatable :: b
+
+ if (allocated (b)) stop 401
+
+ ! Try the regular Fortran test routine.
+ allocate (b)
+ call testit_f (b, 1.0, 2.0, 3.0)
+ if (.not. allocated (b)) stop 402
+ deallocate (b)
+ if (allocated (b)) stop 403
+
+ ! Try the test routine written in Fortran with C binding.
+ allocate (b)
+ call testit_f_bind_c (b, 1.0, 2.0, 3.0)
+ if (.not. allocated (b)) stop 404
+ deallocate (b)
+ if (allocated (b)) stop 405
+
+ ! Try the test routine written in C. This calls testit_f_bind_c
+ ! before returning, so make sure that's what we've got when returning.
+ allocate (b)
+ call testit_c (b, -1.0, -2.0, -3.0)
+ if (.not. allocated (b)) stop 406
+ if (b%id .ne. -1) stop 407
+ if (b%xyz(1) .ne. -1.0) stop 408
+ if (b%xyz(2) .ne. -2.0) stop 408
+ if (b%xyz(3) .ne. -3.0) stop 408
+ deallocate (b)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocatable-optional-pointer.f90 b/gcc/testsuite/gfortran.dg/c-interop/allocatable-optional-pointer.f90
new file mode 100644
index 0000000..5a785b8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/allocatable-optional-pointer.f90
@@ -0,0 +1,23 @@
+! { dg-do compile}
+!
+! TS 29113
+! 5.3 ALLOCATABLE, OPTIONAL, and POINTER attributes
+! The ALLOCATABLE, OPTIONAL, and POINTER attributes may be specified
+! for a dummy argument in a procedure interface that has the BIND
+! attribute.
+
+subroutine test (a, b, c)
+ integer, allocatable :: a
+ integer, optional :: b
+ integer, pointer :: c
+
+ interface
+ subroutine ctest (aa, bb, cc) bind (c)
+ integer, allocatable :: aa
+ integer, optional :: bb
+ integer, pointer :: cc
+ end subroutine
+ end interface
+
+ call ctest (a, b, c)
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocate-c.c b/gcc/testsuite/gfortran.dg/c-interop/allocate-c.c
new file mode 100644
index 0000000..ed2d84f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/allocate-c.c
@@ -0,0 +1,168 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+struct s {
+ int i;
+ double d;
+};
+
+/* External entry point. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ CFI_CDESC_T(3) desc;
+ CFI_cdesc_t *dv = (CFI_cdesc_t *) &desc;
+ CFI_index_t ex[3], lb[3], ub[3];
+ CFI_index_t sm;
+ int i;
+
+ /* Allocate and deallocate a scalar. */
+ sm = sizeof (struct s);
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, NULL, CFI_attribute_allocatable,
+ CFI_type_struct, sm,
+ 0, NULL));
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (dv, NULL, NULL, 69));
+ dump_CFI_cdesc_t (dv);
+ if (dv->base_addr == NULL)
+ abort ();
+ /* The elem_len argument only overrides the initial value in the
+ descriptor for character types. */
+ if (dv->elem_len != sm)
+ abort ();
+ check_CFI_status ("CFI_deallocate",
+ CFI_deallocate (dv));
+ /* The base_addr member of the C descriptor becomes a null pointer. */
+ if (dv->base_addr != NULL)
+ abort ();
+
+ /* Try an array. We are going to test the requirement that:
+ The supplied lower and upper bounds override any current
+ dimension information in the C descriptor.
+ so we'll stuff different values in the descriptor to start with. */
+ ex[0] = 3;
+ ex[1] = 4;
+ ex[2] = 5;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, NULL, CFI_attribute_pointer,
+ CFI_type_double, 0, 3, ex));
+ lb[0] = 1;
+ lb[1] = 2;
+ lb[2] = 3;
+ ub[0] = 10;
+ ub[1] = 5;
+ ub[2] = 10;
+ sm = sizeof (double);
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (dv, lb, ub, 20));
+ dump_CFI_cdesc_t (dv);
+ if (dv->base_addr == NULL)
+ abort ();
+ /* The element sizes passed to both CFI_establish and CFI_allocate should
+ have been ignored in favor of using the constant size of the type. */
+ if (dv->elem_len != sm)
+ abort ();
+
+ /* Check extents and strides; we expect the allocated array to
+ be contiguous so the stride computation should be straightforward
+ no matter what the lower bound is. */
+ for (i = 0; i < 3; i++)
+ {
+ CFI_index_t extent = ub[i] - lb[i] + 1;
+ if (dv->dim[i].lower_bound != lb[i])
+ abort ();
+ if (dv->dim[i].extent != extent)
+ abort ();
+ /* pr93524 */
+ if (dv->dim[i].sm != sm)
+ abort ();
+ sm *= extent;
+ }
+ check_CFI_status ("CFI_deallocate",
+ CFI_deallocate (dv));
+ if (dv->base_addr != NULL)
+ abort ();
+
+ /* Similarly for a character array, except that we expect the
+ elem_len provided to CFI_allocate to prevail. We set the elem_len
+ to the same size as the array element in the previous example, so
+ the bounds and strides should all be the same. */
+ ex[0] = 3;
+ ex[1] = 4;
+ ex[2] = 5;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, NULL, CFI_attribute_allocatable,
+ CFI_type_char, 4, 3, ex));
+ lb[0] = 1;
+ lb[1] = 2;
+ lb[2] = 3;
+ ub[0] = 10;
+ ub[1] = 5;
+ ub[2] = 10;
+ sm = sizeof (double);
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (dv, lb, ub, sm));
+ dump_CFI_cdesc_t (dv);
+ if (dv->base_addr == NULL)
+ abort ();
+ if (dv->elem_len != sm)
+ abort ();
+
+ /* Check extents and strides; we expect the allocated array to
+ be contiguous so the stride computation should be straightforward
+ no matter what the lower bound is. */
+ for (i = 0; i < 3; i++)
+ {
+ CFI_index_t extent = ub[i] - lb[i] + 1;
+ if (dv->dim[i].lower_bound != lb[i])
+ abort ();
+ if (dv->dim[i].extent != extent)
+ abort ();
+ /* pr93524 */
+ if (dv->dim[i].sm != sm)
+ abort ();
+ sm *= extent;
+ }
+ check_CFI_status ("CFI_deallocate",
+ CFI_deallocate (dv));
+ if (dv->base_addr != NULL)
+ abort ();
+
+ /* Signed char is not a Fortran character type. Here we expect it to
+ ignore the elem_len argument and use the size of the type. */
+ ex[0] = 3;
+ ex[1] = 4;
+ ex[2] = 5;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, NULL, CFI_attribute_allocatable,
+ CFI_type_signed_char, 4, 3, ex));
+ lb[0] = 1;
+ lb[1] = 2;
+ lb[2] = 3;
+ ub[0] = 10;
+ ub[1] = 5;
+ ub[2] = 10;
+ sm = sizeof (double);
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (dv, lb, ub, sm));
+ dump_CFI_cdesc_t (dv);
+ if (dv->base_addr == NULL)
+ abort ();
+ if (dv->elem_len != sizeof (signed char))
+ abort ();
+
+ check_CFI_status ("CFI_deallocate",
+ CFI_deallocate (dv));
+ if (dv->base_addr != NULL)
+ abort ();
+
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocate-errors-c.c b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors-c.c
new file mode 100644
index 0000000..3a81049
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors-c.c
@@ -0,0 +1,109 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+struct s {
+ int i;
+ double d;
+};
+
+static long buf[5][4][3];
+
+/* External entry point. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ int bad = 0;
+ int status;
+ CFI_CDESC_T(3) desc;
+ CFI_cdesc_t *dv = (CFI_cdesc_t *) &desc;
+ CFI_index_t ex[3], lb[3], ub[3];
+ CFI_index_t sm;
+
+ /* On entry, the base_addr member of the C descriptor shall be a null
+ pointer. */
+ sm = sizeof (struct s);
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, NULL, CFI_attribute_allocatable,
+ CFI_type_struct, sm,
+ 0, NULL));
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (dv, NULL, NULL, 69));
+ status = CFI_allocate (dv, NULL, NULL, 42);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_allocate of already-allocated object\n");
+ bad ++;
+ }
+ check_CFI_status ("CFI_deallocate",
+ CFI_deallocate (dv));
+
+ /* The attribute member of the C descriptor shall have a value of
+ CFI_attribute_allocatable or CFI_attribute_pointer. */
+ ex[0] = 3;
+ ex[1] = 4;
+ ex[2] = 5;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, NULL, CFI_attribute_other,
+ CFI_type_long, 0, 3, ex));
+ lb[0] = 1;
+ lb[1] = 2;
+ lb[2] = 3;
+ ub[0] = 10;
+ ub[1] = 5;
+ ub[2] = 10;
+ sm = sizeof (long);
+ status = CFI_allocate (dv, lb, ub, 20);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_allocate of CFI_attribute_other object\n");
+ bad ++;
+ }
+
+ /* dv shall be the address of a C descriptor describing the object.
+ It shall have been allocated using the same mechanism as the
+ Fortran ALLOCATE statement. */
+ ex[0] = 3;
+ ex[1] = 4;
+ ex[2] = 5;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, NULL, CFI_attribute_pointer,
+ CFI_type_long, 0, 3, ex));
+ status = CFI_deallocate (dv);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_deallocate with null pointer\n");
+ bad ++;
+ }
+
+ /* This variant is disabled. In theory it should be possible for
+ the memory allocator to easily check for pointers outside the
+ heap region, but libfortran just calls free() which has no provision
+ for returning an error, and there is no other standard C interface
+ to check the validity of a pointer in the C heap either. */
+#if 0
+ check_CFI_status ("CFI_establish",
+ CFI_establish (dv, buf, CFI_attribute_pointer,
+ CFI_type_long, 0, 3, ex));
+ status = CFI_deallocate (dv);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_deallocate with non-allocated pointer\n");
+ bad ++;
+ }
+#endif
+
+ if (bad)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90
new file mode 100644
index 0000000..a58d05a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+! { dg-additional-sources "allocate-errors-c.c dump-descriptors.c" }
+! { dg-additional-options "-Wno-error -fcheck=all" }
+! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+!
+! This program tests that the CFI_allocate and CFI_deallocate functions
+! properly detect invalid arguments. All the interesting things happen
+! in the corresponding C code.
+!
+! The situation here seems to be that while TS29113 defines error codes for
+! these functions, it doesn't actually require the implementation to detect
+! those errors by saying the arguments "shall be" such-and-such, e.g. it is
+! undefined behavior if they are not. In gfortran you can enable some
+! run-time checking by building with -fcheck=all.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ end subroutine
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocate.f90 b/gcc/testsuite/gfortran.dg/c-interop/allocate.f90
new file mode 100644
index 0000000..6878f04
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/allocate.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! { dg-additional-sources "allocate-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests the CFI_allocate and CFI_deallocate functions.
+! All the interesting things happen in the corresponding C code.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ end subroutine
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-1.f90
new file mode 100644
index 0000000..ee06cc7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-1.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. If the actual argument has rank zero, the dummy argument has
+! rank zero; the shape is a zero-sized array and the LBOUND and UBOUND
+! intrinsic functions, with no DIM argument, return zero-sized
+! arrays. [...]
+
+program test
+
+ call testit (42)
+
+contains
+
+ subroutine testit (x0)
+ integer :: x0(..)
+
+ ! expect to have rank 0
+ if (rank (x0) .ne. 0) stop 101
+
+ ! expect shape to be a zero-sized array
+ if (size (shape (x0)) .ne. 0) stop 102
+
+ ! expect lbound and ubound functions to return zero-sized arrays
+ if (size (lbound (x0)) .ne. 0) stop 103
+ if (size (ubound (x0)) .ne. 0) stop 104
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-2.f90
new file mode 100644
index 0000000..4beeb81
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-2.f90
@@ -0,0 +1,48 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. [...] If the actual argument has rank greater than zero, the
+! rank and extents of the dummy argument are assumed from the actual
+! argument, including the lack of a final extent in the case of an
+! assumed-size array. If the actual argument is an array and the dummy
+! argument is allocatable or a pointer, the bounds of the dummy argument
+! are assumed from the actual argument.
+
+program test
+
+ integer :: a(3, 4, 5)
+ integer :: b(-3:3, 0:4, 2:5, 10:20)
+
+ call testit (a, rank(a), shape(a), lbound(a), ubound(a))
+ call testit (b, rank(b), shape(b), lbound(b), ubound(b))
+
+contains
+
+ subroutine testit (x, r, s, l, u)
+ integer :: x(..)
+ integer :: r
+ integer :: s(r)
+ integer :: l(r)
+ integer :: u(r)
+
+ ! expect rank to match
+ if (rank (x) .ne. r) stop 101
+
+ ! expect shape to match
+ if (size (shape (x)) .ne. r) stop 102
+ if (any (shape (x) .ne. s)) stop 103
+
+ ! expect lbound and ubound functions to return rank-sized arrays.
+ ! for non-pointer/non-allocatable arrays, bounds are normalized
+ ! to be 1-based.
+ if (size (lbound (x)) .ne. r) stop 104
+ if (any (lbound (x) .ne. 1)) stop 105
+
+ if (size (ubound (x)) .ne. r) stop 106
+ if (any (ubound (x) .ne. u - l + 1)) stop 107
+ if (any (ubound (x) .ne. s)) stop 108
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-3.f90
new file mode 100644
index 0000000..c4b1010
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-3.f90
@@ -0,0 +1,51 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. [...] If the actual argument has rank greater than zero, the
+! rank and extents of the dummy argument are assumed from the actual
+! argument, including the lack of a final extent in the case of an
+! assumed-size array. If the actual argument is an array and the dummy
+! argument is allocatable or a pointer, the bounds of the dummy argument
+! are assumed from the actual argument.
+
+program test
+
+ integer, target :: a(3, 4, 5)
+ integer, target :: b(-3:3, 0:4, 2:5, 10:20)
+ integer, pointer :: aa(:,:,:)
+ integer, pointer :: bb(:,:,:,:)
+ aa => a
+ bb => b
+
+ call testit (aa, rank(a), shape(a), lbound(a), ubound(a))
+ call testit (bb, rank(b), shape(b), lbound(b), ubound(b))
+
+contains
+
+ subroutine testit (x, r, s, l, u)
+ integer, pointer :: x(..)
+ integer :: r
+ integer :: s(r)
+ integer :: l(r)
+ integer :: u(r)
+
+ ! expect rank to match
+ if (rank (x) .ne. r) stop 101
+
+ ! expect shape to match
+ if (size (shape (x)) .ne. r) stop 102
+ if (any (shape (x) .ne. s)) stop 103
+
+ ! expect lbound and ubound functions to return rank-sized arrays.
+ ! for non-pointer/non-allocatable arrays, bounds are normalized
+ ! to be 1-based.
+ if (size (lbound (x)) .ne. r) stop 104
+ if (any (lbound (x) .ne. l)) stop 105
+
+ if (size (ubound (x)) .ne. r) stop 106
+ if (any (ubound (x) .ne. u)) stop 107
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-4.f90
new file mode 100644
index 0000000..9c92718
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-4.f90
@@ -0,0 +1,50 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. [...] If the actual argument has rank greater than zero, the
+! rank and extents of the dummy argument are assumed from the actual
+! argument, including the lack of a final extent in the case of an
+! assumed-size array. If the actual argument is an array and the dummy
+! argument is allocatable or a pointer, the bounds of the dummy argument
+! are assumed from the actual argument.
+
+program test
+
+ integer, allocatable :: a(:,:,:)
+ integer, allocatable :: b(:,:,:,:)
+
+ allocate (a(3, 4, 5))
+ allocate (b(-3:3, 0:4, 2:5, 10:20))
+
+ call testit (a, rank(a), shape(a), lbound(a), ubound(a))
+ call testit (b, rank(b), shape(b), lbound(b), ubound(b))
+
+contains
+
+ subroutine testit (x, r, s, l, u)
+ integer, allocatable :: x(..)
+ integer :: r
+ integer :: s(r)
+ integer :: l(r)
+ integer :: u(r)
+
+ ! expect rank to match
+ if (rank (x) .ne. r) stop 101
+
+ ! expect shape to match
+ if (size (shape (x)) .ne. r) stop 102
+ if (any (shape (x) .ne. s)) stop 103
+
+ ! expect lbound and ubound functions to return rank-sized arrays.
+ ! for non-pointer/non-allocatable arrays, bounds are normalized
+ ! to be 1-based.
+ if (size (lbound (x)) .ne. r) stop 104
+ if (any (lbound (x) .ne. l)) stop 105
+
+ if (size (ubound (x)) .ne. r) stop 106
+ if (any (ubound (x) .ne. u)) stop 107
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-5.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-5.f90
new file mode 100644
index 0000000..fd87225
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-5.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. If the actual argument has rank zero, the dummy argument has
+! rank zero; the shape is a zero-sized array and the LBOUND and UBOUND
+! intrinsic functions, with no DIM argument, return zero-sized
+! arrays. [...]
+
+program test
+
+ call testit (42)
+
+contains
+
+ subroutine testit (x0) bind (c)
+ integer :: x0(..)
+
+ ! expect to have rank 0
+ if (rank (x0) .ne. 0) stop 101
+
+ ! expect shape to be a zero-sized array
+ if (size (shape (x0)) .ne. 0) stop 102
+
+ ! expect lbound and ubound functions to return zero-sized arrays
+ if (size (lbound (x0)) .ne. 0) stop 103
+ if (size (ubound (x0)) .ne. 0) stop 104
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-6.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-6.f90
new file mode 100644
index 0000000..a65d436
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-6.f90
@@ -0,0 +1,48 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. [...] If the actual argument has rank greater than zero, the
+! rank and extents of the dummy argument are assumed from the actual
+! argument, including the lack of a final extent in the case of an
+! assumed-size array. If the actual argument is an array and the dummy
+! argument is allocatable or a pointer, the bounds of the dummy argument
+! are assumed from the actual argument.
+
+program test
+
+ integer :: a(3, 4, 5)
+ integer :: b(-3:3, 0:4, 2:5, 10:20)
+
+ call testit (a, rank(a), shape(a), lbound(a), ubound(a))
+ call testit (b, rank(b), shape(b), lbound(b), ubound(b))
+
+contains
+
+ subroutine testit (x, r, s, l, u) bind (c)
+ integer :: x(..)
+ integer :: r
+ integer :: s(r)
+ integer :: l(r)
+ integer :: u(r)
+
+ ! expect rank to match
+ if (rank (x) .ne. r) stop 101
+
+ ! expect shape to match
+ if (size (shape (x)) .ne. r) stop 102
+ if (any (shape (x) .ne. s)) stop 103
+
+ ! expect lbound and ubound functions to return rank-sized arrays.
+ ! for non-pointer/non-allocatable arrays, bounds are normalized
+ ! to be 1-based.
+ if (size (lbound (x)) .ne. r) stop 104
+ if (any (lbound (x) .ne. 1)) stop 105
+
+ if (size (ubound (x)) .ne. r) stop 106
+ if (any (ubound (x) .ne. u - l + 1)) stop 107
+ if (any (ubound (x) .ne. s)) stop 108
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-7.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-7.f90
new file mode 100644
index 0000000..819ee4f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-7.f90
@@ -0,0 +1,51 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. [...] If the actual argument has rank greater than zero, the
+! rank and extents of the dummy argument are assumed from the actual
+! argument, including the lack of a final extent in the case of an
+! assumed-size array. If the actual argument is an array and the dummy
+! argument is allocatable or a pointer, the bounds of the dummy argument
+! are assumed from the actual argument.
+
+program test
+
+ integer, target :: a(3, 4, 5)
+ integer, target :: b(-3:3, 0:4, 2:5, 10:20)
+ integer, pointer :: aa(:,:,:)
+ integer, pointer :: bb(:,:,:,:)
+ aa => a
+ bb => b
+
+ call testit (aa, rank(a), shape(a), lbound(a), ubound(a))
+ call testit (bb, rank(b), shape(b), lbound(b), ubound(b))
+
+contains
+
+ subroutine testit (x, r, s, l, u) bind (c)
+ integer, pointer :: x(..)
+ integer :: r
+ integer :: s(r)
+ integer :: l(r)
+ integer :: u(r)
+
+ ! expect rank to match
+ if (rank (x) .ne. r) stop 101
+
+ ! expect shape to match
+ if (size (shape (x)) .ne. r) stop 102
+ if (any (shape (x) .ne. s)) stop 103
+
+ ! expect lbound and ubound functions to return rank-sized arrays.
+ ! for non-pointer/non-allocatable arrays, bounds are normalized
+ ! to be 1-based.
+ if (size (lbound (x)) .ne. r) stop 104
+ if (any (lbound (x) .ne. l)) stop 105
+
+ if (size (ubound (x)) .ne. r) stop 106
+ if (any (ubound (x) .ne. u)) stop 107
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-8.f90 b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-8.f90
new file mode 100644
index 0000000..d94a71b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/argument-association-assumed-rank-8.f90
@@ -0,0 +1,50 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.3 Argument association
+! An assumed-rank dummy argument may correspond to an actual argument of
+! any rank. [...] If the actual argument has rank greater than zero, the
+! rank and extents of the dummy argument are assumed from the actual
+! argument, including the lack of a final extent in the case of an
+! assumed-size array. If the actual argument is an array and the dummy
+! argument is allocatable or a pointer, the bounds of the dummy argument
+! are assumed from the actual argument.
+
+program test
+
+ integer, allocatable :: a(:,:,:)
+ integer, allocatable :: b(:,:,:,:)
+
+ allocate (a(3, 4, 5))
+ allocate (b(-3:3, 0:4, 2:5, 10:20))
+
+ call testit (a, rank(a), shape(a), lbound(a), ubound(a))
+ call testit (b, rank(b), shape(b), lbound(b), ubound(b))
+
+contains
+
+ subroutine testit (x, r, s, l, u) bind (c)
+ integer, allocatable :: x(..)
+ integer :: r
+ integer :: s(r)
+ integer :: l(r)
+ integer :: u(r)
+
+ ! expect rank to match
+ if (rank (x) .ne. r) stop 101
+
+ ! expect shape to match
+ if (size (shape (x)) .ne. r) stop 102
+ if (any (shape (x) .ne. s)) stop 103
+
+ ! expect lbound and ubound functions to return rank-sized arrays.
+ ! for non-pointer/non-allocatable arrays, bounds are normalized
+ ! to be 1-based.
+ if (size (lbound (x)) .ne. r) stop 104
+ if (any (lbound (x) .ne. l)) stop 105
+
+ if (size (ubound (x)) .ne. r) stop 106
+ if (any (ubound (x) .ne. u)) stop 107
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f90 b/gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f90
new file mode 100644
index 0000000..a14c9a5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f90
@@ -0,0 +1,84 @@
+! PR 101319
+! { dg-do compile }
+!
+! TS 29113
+! 6.3 Argument association
+!
+! An assumed-type dummy argument shall not correspond to an actual argument
+! that is of a derived type that has type parameters, type-bound procedures,
+! or final subroutines.
+!
+! In the 2018 Fortran standard, this requirement appears as:
+!
+! 15.5.2.4 Ordinary dummy variables
+!
+! If the actual argument is of a derived type that has type parameters,
+! type-bound procedures, or final subroutines, the dummy argument shall
+! not be assumed-type.
+!
+! This file contains code that is expected to produce errors.
+
+module m
+
+ ! basic derived type
+ type :: t1
+ real*8 :: xyz (3)
+ end type
+
+ ! derived type with type parameters
+ type t2 (k, l)
+ integer, kind :: k
+ integer, len :: l
+ real(k) :: a(l)
+ end type
+
+ ! derived type with a type-bound procedure
+ type :: t3
+ integer :: xyz(3)
+ contains
+ procedure, pass :: frob => frob_t3
+ end type
+
+ ! derived type with a final subroutine
+ type :: t4
+ integer :: xyz(3)
+ contains
+ final :: final_t4
+ end type
+
+contains
+
+ ! implementation of the type-bound procedure for t3 above
+ subroutine frob_t3 (a)
+ class (t3) :: a
+ a%xyz = 0
+ end subroutine
+
+ ! implementation of the final subroutine for t4 above
+ subroutine final_t4 (a)
+ type (t4) :: a
+ a%xyz = 0
+ end subroutine
+
+ ! useless subroutine with an assumed-type dummy.
+ subroutine s1 (a)
+ type(*) :: a
+ end subroutine
+
+ ! test procedure
+ subroutine testit
+ type(t1) :: a1
+ type(t2(8,20)) :: a2
+ type(t3) :: a3
+ type(t4) :: a4
+
+ call s1 (a1) ! OK
+ call s1 (a2) ! { dg-error "assumed-type dummy" "pr101319" { xfail *-*-* } }
+ call s1 (a3) ! { dg-error "assumed-type dummy" }
+ call s1 (a4) ! { dg-error "assumed-type dummy" }
+ end subroutine
+
+end module
+
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c-interop.exp b/gcc/testsuite/gfortran.dg/c-interop/c-interop.exp
new file mode 100644
index 0000000..3bc2a9f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c-interop.exp
@@ -0,0 +1,57 @@
+# Copyright (C) 2005-2021 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gfortran-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+global gfortran_test_path
+global gfortran_aux_module_flags
+set gfortran_test_path $srcdir/$subdir
+set gfortran_aux_module_flags "-Werror -std=f2018"
+proc dg-compile-aux-modules { args } {
+ global gfortran_test_path
+ global gfortran_aux_module_flags
+ if { [llength $args] != 2 } {
+ error "dg-compile-aux-modules: needs one argument"
+ return
+ }
+
+ set level [info level]
+ if { [info procs dg-save-unknown] != [list] } {
+ rename dg-save-unknown dg-save-unknown-level-$level
+ }
+
+ dg-test $gfortran_test_path/[lindex $args 1] "" $gfortran_aux_module_flags
+ # cleanup-modules is intentionally not invoked here.
+
+ if { [info procs dg-save-unknown-level-$level] != [list] } {
+ rename dg-save-unknown-level-$level dg-save-unknown
+ }
+}
+
+# Main loop.
+gfortran-dg-runtest [lsort \
+ [find $srcdir/$subdir *.\[fF\]{,90,95,03,08} ] ] "" "-Werror"
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c1255-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/c1255-1.f90
new file mode 100644
index 0000000..62fee2c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c1255-1.f90
@@ -0,0 +1,83 @@
+! PR92482
+! { dg-do compile }
+!
+! TS 29113
+! C1255 (R1230) If proc-language-binding-spec is specified for a procedure,
+! each dummy argument shall be an interoperable procedure (15.3.7)
+! or a variable that is interoperable (15.3.5, 15.3.6), assumed shape,
+! assumed rank, assumed type, of assumed character length, or has the
+! ALLOCATABLE or POINTER attribute. If proc-language-binding-spec is
+! specified for a function, the function result shall be an interoperable
+! scalar variable.
+
+module m
+
+ interface
+
+ ! dummy is interoperable procedure
+ subroutine s1 (x) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ interface
+ function x (a, b) bind (c)
+ use ISO_C_BINDING
+ integer(C_INT) :: a, b
+ integer(C_INT) :: x
+ end function
+ end interface
+ end subroutine
+
+ ! dummy is interoperable variable
+ subroutine s2 (x) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT) :: x
+ end subroutine
+
+ ! dummy is assumed-shape array variable
+ subroutine s3 (x) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT) :: x(:)
+ end subroutine
+
+ ! dummy is an assumed-rank array variable
+ subroutine s4 (x) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT) :: x(..)
+ end subroutine
+
+ ! dummy is assumed-type variable
+ subroutine s5 (x) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ type(*) :: x
+ end subroutine
+
+ ! dummy is assumed length character variable
+ subroutine s6 (x) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use ISO_C_BINDING
+ implicit none
+ character(len=*) :: x
+ end subroutine
+
+ ! dummy has allocatable or pointer attribute
+ subroutine s7 (x, y) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT), allocatable :: x
+ integer(C_INT), pointer :: y
+ end subroutine
+
+ ! function result shall be an interoperable scalar variable
+ function f (x) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT) :: x
+ integer(C_INT) :: f
+ end function
+
+ end interface
+end module
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c1255-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/c1255-2.f90
new file mode 100644
index 0000000..0e5505a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c1255-2.f90
@@ -0,0 +1,106 @@
+! { dg-do compile }
+!
+! TS 29113
+! C1255 (R1230) If proc-language-binding-spec is specified for a procedure,
+! each dummy argument shall be an interoperable procedure (15.3.7)
+! or a variable that is interoperable (15.3.5, 15.3.6), assumed shape,
+! assumed rank, assumed type, of assumed character length, or has the
+! ALLOCATABLE or POINTER attribute. If proc-language-binding-spec is
+! specified for a function, the function result shall be an interoperable
+! scalar variable.
+!
+! This file contains code that is expected to produce errors.
+
+
+module m1
+ ! type to use for examples below
+ type t
+ integer :: foo
+ real :: bar
+ end type
+end module
+
+module m2
+
+ interface
+
+ ! dummy is a procedure that is not interoperable
+ subroutine s1 (x) bind (c)
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ interface
+ function x (a, b) bind (c) ! { dg-error "not C interoperable" }
+ use ISO_C_BINDING
+ use m1
+ integer(C_INT) :: a
+ class(t) :: b !
+ integer(C_INT) :: x
+ end function
+ end interface
+ end subroutine
+
+ ! dummy is of a type that is not interoperable
+ subroutine s2 (x) bind (c) ! { dg-error "not C interoperable" }
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ class(t) :: x
+ end subroutine
+
+ ! dummy is an array that is not of interoperable type and not
+ ! assumed-shape or assumed-rank
+ subroutine s3 (x) bind (c) ! { dg-error "not C interoperable" }
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ class(t) :: x(3, 3)
+ end subroutine
+
+ subroutine s4 (n, x) bind (c) ! { dg-error "not C interoperable" }
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ integer(C_INT) :: n
+ class(t) :: x(n)
+ end subroutine
+
+ ! This fails with a bogus error even without C binding.
+ subroutine s5 (x) bind (c) ! { dg-error "not C interoperable" }
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ class(t) :: x(*) ! { dg-bogus "not yet been implemented" "pr46991" }
+ ! { dg-bogus "has no IMPLICIT type" "pr46991" { target "*-*-*" } 68 }
+ end subroutine
+
+ subroutine s5a (x)
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ class(t) :: x(*) ! { dg-bogus "not yet been implemented" "pr46991" }
+ ! { dg-bogus "has no IMPLICIT type" "pr46991" { target "*-*-*" } 76 }
+ end subroutine
+
+ ! function result is not a scalar
+ function f (x) bind (c) ! { dg-error "not C interoperable" }
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ integer(C_INT) :: x
+ type(t) :: f
+ end function
+
+ ! function result is a type that is not interoperable
+ function g (x) bind (c) ! { dg-error "BIND\\(C\\)" }
+ use ISO_C_BINDING
+ use m1
+ implicit none
+ integer(C_INT) :: x
+ integer(C_INT), allocatable :: g
+ end function
+
+ end interface
+
+end module
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c1255a.f90 b/gcc/testsuite/gfortran.dg/c-interop/c1255a.f90
new file mode 100644
index 0000000..470ccac
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c1255a.f90
@@ -0,0 +1,40 @@
+! { dg-do compile }
+!
+! TS 29113
+! C1255a (R1230) A dummy argument of a procedure that has a
+! proc-language-binding-spec shall not have both the OPTIONAL and
+! VALUE attributes.
+!
+! This file contains code that is expected to produce errors.
+
+module m
+
+ interface
+
+ ! This one is OK.
+ subroutine s1 (x, y) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT) :: x
+ integer(C_INT), optional :: y
+ end subroutine
+
+ ! This one is OK too.
+ subroutine s2 (x, y) bind (c)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT) :: x
+ integer(C_INT), value :: y
+ end subroutine
+
+ ! This one is bad.
+ subroutine s3 (x, y) bind (c) ! { dg-error "BIND\\(C\\)" }
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT) :: x
+ integer(C_INT), optional, value :: y
+ end subroutine
+
+ end interface
+
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c407a-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/c407a-1.f90
new file mode 100644
index 0000000..f239a1e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c407a-1.f90
@@ -0,0 +1,55 @@
+! { dg-do compile}
+!
+! TS 29113
+! C407a An assumed-type entity shall be a dummy variable that does not
+! have the ALLOCATABLE, CODIMENSION, INTENT(OUT), POINTER, or VALUE
+! attribute and is not an explicit-shape array.
+!
+! This test file contains tests that are expected to all pass.
+
+! Check basic usage with no attributes.
+
+module m
+ interface
+ subroutine g (a, b)
+ implicit none
+ type(*) :: a
+ integer :: b
+ end subroutine
+ end interface
+end module
+
+subroutine s0 (x)
+ use m
+ implicit none
+ type(*) :: x
+
+ call g (x, 1)
+end subroutine
+
+! Check that other attributes that can normally apply to dummy variables
+! are allowed.
+
+subroutine s1 (a, b, c, d, e, f, g, h)
+ implicit none
+ type(*), asynchronous :: a
+ type(*), contiguous :: b(:,:)
+ type(*), dimension (:) :: c
+ type(*), intent(in) :: d
+ type(*), intent(inout) :: e
+ type(*), optional :: f
+ type(*), target :: g
+ type(*), volatile :: h
+
+end subroutine
+
+! Check that non-explicit-shape arrays are allowed.
+
+subroutine s2 (a, b, c)
+ implicit none
+ type(*) :: a(:) ! assumed-shape
+ type(*) :: b(*) ! assumed-size
+ type(*) :: c(..) ! assumed-rank
+
+end subroutine
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c407a-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/c407a-2.f90
new file mode 100644
index 0000000..9d8824d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c407a-2.f90
@@ -0,0 +1,88 @@
+! { dg-do compile }
+! { dg-additional-options "-fcoarray=single" }
+!
+! TS 29113
+! C407a An assumed-type entity shall be a dummy variable that does not
+! have the ALLOCATABLE, CODIMENSION, INTENT(OUT), POINTER, or VALUE
+! attribute and is not an explicit-shape array.
+!
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+! Check that diagnostics are issued when type(*) is used to declare things
+! that are not dummy variables.
+
+subroutine s0 (a)
+ implicit none
+ integer :: a
+
+ integer :: goodlocal
+ type(*) :: badlocal ! { dg-error "Assumed.type" }
+
+ integer :: goodcommon
+ type(*) :: badcommon ! { dg-error "Assumed.type" }
+ common /frob/ goodcommon, badcommon
+
+ integer :: goodstatic
+ type(*) :: badstatic ! { dg-error "Assumed.type" }
+ save goodstatic, badstatic
+
+ block
+ integer :: goodlocal2
+ type(*) :: badlocal2 ! { dg-error "Assumed.type" }
+ end block
+
+end subroutine
+
+module m
+ integer :: goodmodvar
+ type(*) :: badmodvar ! { dg-error "Assumed.type" }
+ save goodmodvar, badmodvar
+
+ type :: t
+ integer :: goodcomponent
+ type(*) :: badcomponent ! { dg-error "Assumed.type" }
+ end type
+end module
+
+! Check that diagnostics are issued when type(*) is used in combination
+! with the forbidden attributes.
+
+subroutine s1 (a) ! { dg-error "Assumed.type" }
+ implicit none
+ type(*), allocatable :: a
+end subroutine
+
+subroutine s2 (b) ! { dg-error "Assumed.type" }
+ implicit none
+ type(*), codimension[*] :: b(:,:)
+end subroutine
+
+subroutine s3 (c) ! { dg-error "Assumed.type" }
+ implicit none
+ type(*), intent(out) :: c
+end subroutine
+
+subroutine s4 (d) ! { dg-error "Assumed.type" }
+ implicit none
+ type(*), pointer :: d
+end subroutine
+
+subroutine s5 (e) ! { dg-error "Assumed.type" }
+ implicit none
+ type(*), value :: e
+end subroutine
+
+! Check that diagnostics are issued when type(*) is used to declare
+! a dummy variable that is an explicit-shape array.
+
+subroutine s6 (n, f) ! { dg-error "Assumed.type" }
+ implicit none
+ integer n
+ type(*) :: f(n,n)
+end subroutine
+
+subroutine s7 (g) ! { dg-error "Assumed.type" }
+ implicit none
+ type(*) :: g(10)
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c407b-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/c407b-1.f90
new file mode 100644
index 0000000..c9fc2b9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c407b-1.f90
@@ -0,0 +1,107 @@
+! { dg-do compile}
+!
+! TS 29113
+! C407b An assumed-type variable name shall not appear in a designator
+! or expression except as an actual argument corresponding to a dummy
+! argument that is assumed-type, or as the first argument to any of
+! the intrinsic and intrinsic module functions IS_CONTIGUOUS, LBOUND,
+! PRESENT, RANK, SHAPE, SIZE, UBOUND, and C_LOC.
+!
+! This test file contains tests that are expected to all pass.
+
+! Check that passing an assumed-type variable as an actual argument
+! corresponding to an assumed-type dummy works.
+
+module m
+ interface
+ subroutine g (a, b)
+ implicit none
+ type(*) :: a
+ integer :: b
+ end subroutine
+ end interface
+end module
+
+subroutine s0 (x)
+ use m
+ implicit none
+ type(*) :: x
+
+ call g (x, 1)
+end subroutine
+
+! Check that calls to the permitted intrinsic functions work.
+
+function test_is_contiguous (a)
+ implicit none
+ type(*) :: a(*)
+ logical :: test_is_contiguous
+
+ test_is_contiguous = is_contiguous (a)
+end function
+
+function test_lbound (a)
+ implicit none
+ type(*) :: a(:)
+ integer :: test_lbound
+
+ test_lbound = lbound (a, 1)
+end function
+
+function test_present (a)
+ implicit none
+ type(*), optional :: a(*)
+ logical :: test_present
+
+ test_present = present (a)
+end function
+
+function test_rank (a)
+ implicit none
+ type(*) :: a(*)
+ integer :: test_rank
+
+ test_rank = rank (a)
+end function
+
+function test_shape (a)
+ implicit none
+ type(*) :: a(:) ! assumed-shape array so shape intrinsic works
+ integer :: test_shape
+
+ integer :: temp, i
+ integer, dimension (rank (a)) :: ashape
+
+ temp = 1
+ ashape = shape (a)
+ do i = 1, rank (a)
+ temp = temp * ashape (i)
+ end do
+ test_shape = temp
+end function
+
+function test_size (a)
+ implicit none
+ type(*) :: a(:)
+ integer :: test_size
+
+ test_size = size (a)
+end function
+
+function test_ubound (a)
+ implicit none
+ type(*) :: a(:)
+ integer :: test_ubound
+
+ test_ubound = ubound (a, 1)
+end function
+
+function test_c_loc (a)
+ use iso_c_binding
+ implicit none
+ type(*), target :: a(*)
+ type(c_ptr) :: test_c_loc
+
+ test_c_loc = c_loc (a)
+end function
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90
new file mode 100644
index 0000000..3d3cd63
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90
@@ -0,0 +1,150 @@
+! PR 101337
+! { dg-do compile}
+!
+! TS 29113
+! C407b An assumed-type variable name shall not appear in a designator
+! or expression except as an actual argument corresponding to a dummy
+! argument that is assumed-type, or as the first argument to any of
+! the intrinsic and intrinsic module functions IS_CONTIGUOUS, LBOUND,
+! PRESENT, RANK, SHAPE, SIZE, UBOUND, and C_LOC.
+!
+! This file contains tests that are expected to give diagnostics.
+
+! Check that passing an assumed-type variable as an actual argument
+! corresponding to a non-assumed-type dummy gives a diagnostic.
+
+module m
+ interface
+ subroutine f (a, b)
+ implicit none
+ integer :: a
+ integer :: b
+ end subroutine
+ subroutine g (a, b)
+ implicit none
+ type(*) :: a
+ integer :: b
+ end subroutine
+ subroutine h (a, b)
+ implicit none
+ type(*) :: a(*)
+ integer :: b
+ end subroutine
+ end interface
+end module
+
+subroutine s0 (x)
+ use m
+ implicit none
+ type(*) :: x
+
+ call g (x, 1)
+ call f (x, 1) ! { dg-error "Type mismatch" }
+ call h (x, 1) ! { dg-error "Rank mismatch" }
+end subroutine
+
+! Check that you can't use an assumed-type array variable in an array
+! element or section designator.
+
+subroutine s1 (x, y)
+ use m
+ implicit none
+ integer :: x(*)
+ type(*) :: y(*)
+
+ call f (x(1), 1)
+ call g (y(1), 1) ! { dg-error "Assumed.type" }
+ call h (y, 1) ! ok
+ call h (y(1:3:1), 1) ! { dg-error "Assumed.type" }
+end subroutine
+
+! Check that you can't use an assumed-type array variable in other
+! expressions. This is clearly not exhaustive since few operations
+! are even plausible from a type perspective.
+
+subroutine s2 (x, y)
+ implicit none
+ type(*) :: x, y
+ integer :: i
+
+ ! select type
+ select type (x) ! { dg-error "Assumed.type|Selector shall be polymorphic" }
+ type is (integer)
+ i = 0
+ type is (real)
+ i = 1
+ class default
+ i = -1
+ end select
+
+ ! relational operations
+ if (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .eq. y) then ! { dg-error "Assumed.type" }
+ return
+ end if
+ if (.not. (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .ne. y)) then ! { dg-error "Assumed.type" }
+ return
+ end if
+ if (.not. x) then ! { dg-error "Assumed.type" }
+ return
+ end if
+
+ ! assignment
+ x & ! { dg-error "Assumed.type" }
+ = y ! { dg-error "Assumed.type" }
+ i = x ! { dg-error "Assumed.type" }
+ y = i ! { dg-error "Assumed.type" }
+
+ ! arithmetic
+ i = x + 1 ! { dg-error "Assumed.type" }
+ i = -y ! { dg-error "Assumed.type" }
+ i = (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ + y) ! { dg-error "Assumed.type" }
+
+ ! computed go to
+ goto (10, 20, 30), x ! { dg-error "Assumed.type|must be a scalar integer" }
+10 continue
+20 continue
+30 continue
+
+ ! do loops
+ do i = 1, x ! { dg-error "Assumed.type" }
+ continue
+ end do
+ do x = 1, i ! { dg-error "Assumed.type" }
+ continue
+ end do
+
+end subroutine
+
+! Check that calls to disallowed intrinsic functions produce a diagnostic.
+! Again, this isn't exhaustive, there are just too many intrinsics and
+! hardly any of them are plausible.
+
+subroutine s3 (x, y)
+ implicit none
+ type(*) :: x, y
+ integer :: i
+
+ i = bit_size (x) ! { dg-error "Assumed.type" }
+ i = exponent (x) ! { dg-error "Assumed.type" }
+
+ if (extends_type_of (x, & ! { dg-error "Assumed.type" }
+ y)) then ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ return
+ end if
+
+ if (same_type_as (x, & ! { dg-error "Assumed.type" }
+ y)) then ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ return
+ end if
+
+ i = storage_size (x) ! { dg-error "Assumed.type" }
+
+ i = iand (x, & ! { dg-error "Assumed.type" }
+ y) ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+
+ i = kind (x) ! { dg-error "Assumed.type" }
+
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c407c-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/c407c-1.f90
new file mode 100644
index 0000000..e4da66a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c407c-1.f90
@@ -0,0 +1,63 @@
+! PR101333
+! { dg-do compile}
+!
+! TS 29113
+! C407c An assumed-type actual argument that corresponds to an
+! assumed-rank dummy argument shall be assumed-shape or assumed-rank.
+!
+! This constraint is renumbered C711 in the 2018 Fortran standard.
+
+module m
+ interface
+ subroutine g (a, b)
+ implicit none
+ type(*) :: a(..)
+ integer :: b
+ end subroutine
+ end interface
+end module
+
+! Check that assumed-shape works.
+
+subroutine s0 (x)
+ use m
+ implicit none
+ type(*) :: x(:)
+
+ call g (x, 1)
+end subroutine
+
+! Check that assumed-rank works.
+
+subroutine s1 (x)
+ use m
+ implicit none
+ type(*) :: x(..)
+
+ call g (x, 1)
+end subroutine
+
+! Check that assumed-size gives an error.
+
+subroutine s2 (x)
+ use m
+ implicit none
+ type(*) :: x(*)
+
+ call g (x, 1) ! { dg-error "Assumed.type" "pr101333" { xfail *-*-* } }
+end subroutine
+
+! Check that a scalar gives an error.
+subroutine s3 (x)
+ use m
+ implicit none
+ type(*) :: x
+
+ call g (x, 1) ! { dg-error "Assumed.type" "pr101333" { xfail *-*-* } }
+end subroutine
+
+! Explicit-shape assumed-type actual arguments are forbidden implicitly
+! by c407a (C709 in the 2018 standard). They're not allowed as dummy
+! arguments, and assumed-type entities can only be declared as dummy
+! arguments, so there is no other way to construct one to pass as an
+! actual argument.
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c516.f90 b/gcc/testsuite/gfortran.dg/c-interop/c516.f90
new file mode 100644
index 0000000..208eb84
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c516.f90
@@ -0,0 +1,67 @@
+! PR 101320
+! { dg-do compile }
+!
+! TS 29113
+! C516 The ALLOCATABLE or POINTER attribute shall not be specified for
+! a default-initialized dummy argument of a procedure that has a
+! proc-language-binding-spec.
+!
+! This file contains code that is expected to produce errors.
+
+module m1
+
+ type, bind(c) :: t1
+ integer :: a
+ integer :: b
+ end type
+
+
+ type, bind(c) :: t2
+ integer :: a = 0
+ integer :: b = -1
+ end type
+
+end module
+
+module m2
+
+ interface
+
+ ! good, no default initialization, no pointer/allocatable attribute
+ subroutine s1a (x) bind (c)
+ use m1
+ type(t1), optional :: x
+ end subroutine
+
+ ! good, no default initialization
+ subroutine s1b (x) bind (c)
+ use m1
+ type(t1), allocatable, optional :: x
+ end subroutine
+
+ ! good, no default initialization
+ subroutine s1c (x) bind (c)
+ use m1
+ type(t1), pointer, optional :: x
+ end subroutine
+
+ ! good, default initialization but no pointer/allocatable attribute
+ subroutine s2a (x) bind (c)
+ use m1
+ type(t2), optional :: x
+ end subroutine
+
+ ! bad, default initialization + allocatable
+ subroutine s2b (x) bind (c) ! { dg-error "BIND\\(C\\)" "pr101320" { xfail *-*-* } }
+ use m1
+ type(t2), allocatable, optional :: x
+ end subroutine
+
+ ! bad, default initialization + pointer
+ subroutine s2c (x) bind (c) ! { dg-error "BIND\\(C\\)" "pr101320" { xfail *-*-* } }
+ use m1
+ type(t2), pointer, optional :: x
+ end subroutine
+
+ end interface
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c524a.f90 b/gcc/testsuite/gfortran.dg/c-interop/c524a.f90
new file mode 100644
index 0000000..34abb72
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c524a.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+! { dg-additional-options "-fcoarray=single" }
+!
+! TS 29113
+! C524a A coarray shall not be a dummy argument of a procedure that has
+! a proc-language-binding-spec.
+!
+! This file contains code that is expected to produce errors.
+
+module m
+
+ interface
+
+ ! No C binding, this should be OK.
+ subroutine s1 (x)
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT), codimension[*] :: x(:,:)
+ end subroutine
+
+ ! This one is bad.
+ subroutine s2 (x) bind (c) ! { dg-error "BIND\\(C\\)" }
+ use ISO_C_BINDING
+ implicit none
+ integer(C_INT), codimension[*] :: x(:,:)
+ end subroutine
+
+ end interface
+end module
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535a-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535a-1.f90
new file mode 100644
index 0000000..5550cf2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535a-1.f90
@@ -0,0 +1,65 @@
+! { dg-do compile}
+!
+! TS 29113
+! C535a An assumed-rank entity shall be a dummy variable that does not
+! have the CODIMENSION or VALUE attribute.
+! An assumed-rank object may have the CONTIGUOUS attribute.
+!
+! This test file contains tests that are expected to all pass.
+
+! Check basic usage with no attributes.
+
+module m
+ type :: t
+ integer :: i
+ real :: f
+ end type
+end module
+
+subroutine s0 (a, b, c, d)
+ use m
+ implicit none
+ integer :: a(..)
+ real :: b(..)
+ type(t) :: c(..)
+ type(*) :: d(..)
+end subroutine
+
+! Likewise with dimension attribute.
+
+subroutine s1 (a, b, c, d)
+ use m
+ implicit none
+ integer, dimension(..) :: a
+ real, dimension(..) :: b
+ type(t), dimension(..) :: c
+ type(*), dimension(..) :: d
+end subroutine
+
+! Likewise with dimension statement.
+
+subroutine s2 (a, b, c, d)
+ use m
+ implicit none
+ integer :: a
+ real :: b
+ type(t) :: c
+ type(*) :: d
+ dimension a(..), b(..), c(..), d(..)
+end subroutine
+
+! Test that various other attributes are accepted.
+
+subroutine s3 (a, b, c, d, e, f, g, h, i, j)
+ implicit none
+ integer, allocatable :: a(..)
+ integer, asynchronous :: b(..)
+ integer, contiguous :: c(..)
+ integer, intent(in) :: d(..)
+ integer, intent(out) :: e(..)
+ integer, intent(inout) :: f(..)
+ integer, optional :: g(..)
+ integer, pointer :: h(..)
+ integer, target :: i(..)
+ integer, volatile :: j(..)
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535a-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535a-2.f90
new file mode 100644
index 0000000..026be4a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535a-2.f90
@@ -0,0 +1,78 @@
+! { dg-do compile}
+! { dg-additional-options "-fcoarray=single" }
+!
+! TS 29113
+! C535a An assumed-rank entity shall be a dummy variable that does not
+! have the CODIMENSION or VALUE attribute.
+! An assumed-rank object may have the CONTIGUOUS attribute.
+!
+
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+! Check that diagnostics are issued when dimension(..) is used to declare
+! things that are not dummy variables.
+
+subroutine s0 (a)
+ implicit none
+ integer :: a
+
+ integer :: goodlocal
+ integer :: badlocal1(..) ! { dg-error "Assumed.rank" }
+ integer, dimension(..) :: badlocal2 ! { dg-error "Assumed.rank" }
+ integer :: badlocal3 ! { dg-error "Assumed.rank" }
+ dimension badlocal3(..)
+
+ integer :: goodcommon
+ integer :: badcommon1(..) ! { dg-error "Assumed.rank" }
+ integer, dimension(..) :: badcommon2 ! { dg-error "Assumed.rank" }
+ integer :: badcommon3 ! { dg-error "Assumed.rank" }
+ dimension badcommon3(..)
+ common /frob/ goodcommon, badcommon1, badcommon2, badcommon3
+
+ integer :: goodstatic
+ integer :: badstatic1(..) ! { dg-error "Assumed.rank" }
+ integer, dimension(..) :: badstatic2 ! { dg-error "Assumed.rank" }
+ integer :: badstatic3 ! { dg-error "Assumed.rank" }
+ dimension badstatic3(..)
+ save goodstatic, badstatic1, badstatic2, badstatic3
+
+ block
+ integer :: goodblocklocal
+ integer :: badblocklocal1(..) ! { dg-error "Assumed.rank" }
+ integer, dimension(..) :: badblocklocal2 ! { dg-error "Assumed.rank" }
+ integer :: badblocklocal3 ! { dg-error "Assumed.rank" }
+ dimension badblocklocal3(..)
+ end block
+
+end subroutine
+
+module m
+ integer :: goodmodvar
+ integer :: badmodvar1(..) ! { dg-error "Assumed.rank" }
+ integer, dimension(..) :: badmodvar2 ! { dg-error "Assumed.rank" }
+ integer :: badmodvar3 ! { dg-error "Assumed.rank" }
+ dimension badmodvar3(..)
+
+ save goodmodvar, badmodvar1, badmodvar2, badmodvar3
+
+ type :: t
+ integer :: goodcomponent
+ integer :: badcomponent1(..) ! { dg-error "must have an explicit shape" }
+ integer, dimension(..) :: badcomponent2 ! { dg-error "must have an explicit shape" }
+ end type
+end module
+
+! Check that diagnostics are issued when dimension(..) is used in combination
+! with the forbidden attributes.
+
+subroutine s2 (b) ! { dg-error "has no IMPLICIT type" }
+ implicit none
+ integer, codimension[*] :: b(..) ! { dg-error "assumed-rank array" }
+end subroutine
+
+subroutine s5 (e) ! { dg-error "has no IMPLICIT type" }
+ implicit none
+ integer, value :: e(..) ! { dg-error "VALUE attribute conflicts with DIMENSION" }
+end subroutine
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535b-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535b-1.f90
new file mode 100644
index 0000000..3de77b0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535b-1.f90
@@ -0,0 +1,333 @@
+! { dg-do compile}
+! { dg-additional-options "-fcoarray=single" }
+!
+! TS 29113
+! C535b An assumed-rank variable name shall not appear in a designator
+! or expression except as an actual argument corresponding to a dummy
+! argument that is assumed-rank, the argument of the C_LOC function
+! in the ISO_C_BINDING intrinsic module, or the first argument in a
+! reference to an intrinsic inquiry function.
+!
+! This has been renamed C838 in the Fortran 2018 standard, with C_SIZEOF
+! and SELECT_RANK additionally added.
+!
+! This test file contains tests that are expected to all pass.
+
+! Check that passing an assumed-rank variable as an actual argument
+! corresponding to an assumed-rank dummy works.
+
+module m
+ interface
+ subroutine g (a, b)
+ implicit none
+ real :: a(..)
+ integer :: b
+ end subroutine
+ end interface
+end module
+
+subroutine s0 (x)
+ use m
+ implicit none
+ real :: x(..)
+
+ call g (x, 1)
+end subroutine
+
+! Check that calls to the permitted intrinsic functions work.
+
+function test_c_loc (a)
+ use iso_c_binding
+ implicit none
+ integer, target :: a(..)
+ type(c_ptr) :: test_c_loc
+
+ test_c_loc = c_loc (a)
+end function
+
+function test_allocated (a)
+ implicit none
+ integer, allocatable :: a(..)
+ logical :: test_allocated
+
+ test_allocated = allocated (a)
+end function
+
+! 2-argument forms of the associated intrinsic are tested in c535b-3.f90.
+function test_associated (a)
+ implicit none
+ integer, pointer :: a(..)
+ logical :: test_associated
+
+ test_associated = associated (a)
+end function
+
+function test_bit_size (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_bit_size
+
+ test_bit_size = bit_size (a)
+end function
+
+function test_digits (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_digits
+
+ test_digits = digits (a)
+end function
+
+function test_epsilon (a)
+ implicit none
+ real :: a(..)
+ real :: test_epsilon
+
+ test_epsilon = epsilon (a)
+end function
+
+function test_huge (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_huge
+
+ test_huge = huge (a)
+end function
+
+function test_is_contiguous (a)
+ implicit none
+ integer :: a(..)
+ logical :: test_is_contiguous
+
+ test_is_contiguous = is_contiguous (a)
+end function
+
+function test_kind (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_kind
+
+ test_kind = kind (a)
+end function
+
+function test_lbound (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_lbound
+
+ test_lbound = lbound (a, 1)
+end function
+
+function test_len1 (a)
+ implicit none
+ character(len=5) :: a(..)
+ integer :: test_len1
+
+ test_len1 = len (a)
+end function
+
+function test_len2 (a)
+ implicit none
+ character(len=*) :: a(..)
+ integer :: test_len2
+
+ test_len2 = len (a)
+end function
+
+function test_len3 (a)
+ implicit none
+ character(len=5), pointer :: a(..)
+ integer :: test_len3
+
+ test_len3 = len (a)
+end function
+
+function test_len4 (a)
+ implicit none
+ character(len=*), pointer :: a(..)
+ integer :: test_len4
+
+ test_len4 = len (a)
+end function
+
+function test_len5 (a)
+ implicit none
+ character(len=:), pointer :: a(..)
+ integer :: test_len5
+
+ test_len5 = len (a)
+end function
+
+function test_len6 (a)
+ implicit none
+ character(len=5), allocatable :: a(..)
+ integer :: test_len6
+
+ test_len6 = len (a)
+end function
+
+function test_len7 (a)
+ implicit none
+ character(len=*), allocatable :: a(..)
+ integer :: test_len7
+
+ test_len7 = len (a)
+end function
+
+function test_len8 (a)
+ implicit none
+ character(len=:), allocatable :: a(..)
+ integer :: test_len8
+
+ test_len8 = len (a)
+end function
+
+function test_maxexponent (a)
+ implicit none
+ real :: a(..)
+ integer :: test_maxexponent
+
+ test_maxexponent = maxexponent (a)
+end function
+
+function test_minexponent (a)
+ implicit none
+ real :: a(..)
+ integer :: test_minexponent
+
+ test_minexponent = minexponent (a)
+end function
+
+function test_new_line (a)
+ implicit none
+ character :: a(..)
+ character :: test_new_line
+
+ test_new_line = new_line (a)
+end function
+
+function test_precision (a)
+ implicit none
+ real :: a(..)
+ integer :: test_precision
+
+ test_precision = precision (a)
+end function
+
+function test_present (a, b, c)
+ implicit none
+ integer :: a, b
+ integer, optional :: c(..)
+ integer :: test_present
+
+ if (present (c)) then
+ test_present = a
+ else
+ test_present = b
+ end if
+end function
+
+function test_radix (a)
+ implicit none
+ real :: a(..)
+ integer :: test_radix
+
+ test_radix = radix (a)
+end function
+
+function test_range (a)
+ implicit none
+ real :: a(..)
+ integer :: test_range
+
+ test_range = range (a)
+end function
+
+function test_rank (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_rank
+
+ test_rank = rank (a)
+end function
+
+function test_shape (a)
+ implicit none
+ integer :: a(..)
+ logical :: test_shape
+
+ test_shape = (rank (a) .eq. size (shape (a)))
+end function
+
+function test_size (a)
+ implicit none
+ integer :: a(..)
+ logical :: test_size
+
+ test_size = (size (a) .eq. product (shape (a)))
+end function
+
+function test_storage_size (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_storage_size
+
+ test_storage_size = storage_size (a)
+end function
+
+function test_tiny (a)
+ implicit none
+ real :: a(..)
+ real :: test_tiny
+
+ test_tiny = tiny (a)
+end function
+
+function test_ubound (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_ubound
+
+ test_ubound = ubound (a, 1)
+end function
+
+! Note: there are no tests for these inquiry functions that can't
+! take an assumed-rank array argument for other reasons:
+!
+! coshape, lcobound, ucobound: requires CODIMENSION attribute, which is
+! not permitted on an assumed-rank variable.
+!
+! extends_type_of, same_type_as: require a class argument.
+
+
+! F2018 additionally permits the first arg to C_SIZEOF to be
+! assumed-rank (C838).
+
+function test_c_sizeof (a)
+ use iso_c_binding
+ implicit none
+ integer :: a(..)
+ integer :: test_c_sizeof
+
+ test_c_sizeof = c_sizeof (a)
+end function
+
+! F2018 additionally permits an assumed-rank array as the selector
+! in a SELECT RANK construct (C838).
+
+function test_select_rank (a)
+ implicit none
+ integer :: a(..)
+ integer :: test_select_rank
+
+ select rank (a)
+ rank (0)
+ test_select_rank = 0
+ rank (1)
+ test_select_rank = 1
+ rank (2)
+ test_select_rank = 2
+ rank default
+ test_select_rank = -1
+ end select
+end function
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535b-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535b-2.f90
new file mode 100644
index 0000000..7bff14f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535b-2.f90
@@ -0,0 +1,387 @@
+! PR 101334
+! PR 101337
+! { dg-do compile}
+! { dg-additional-options "-fcoarray=single" }
+!
+! TS 29113
+! C535b An assumed-rank variable name shall not appear in a designator
+! or expression except as an actual argument corresponding to a dummy
+! argument that is assumed-rank, the argument of the C_LOC function
+! in the ISO_C_BINDING intrinsic module, or the first argument in a
+! reference to an intrinsic inquiry function.
+!
+! This has been renamed C838 in the Fortran 2018 standard, with C_SIZEOF
+! and SELECT_RANK additionally added.
+!
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+! Check that passing an assumed-rank variable as an actual argument
+! corresponding to a non-assumed-rank dummy gives a diagnostic.
+
+module m
+ interface
+ subroutine f (a, b)
+ implicit none
+ integer :: a
+ integer :: b
+ end subroutine
+ subroutine g (a, b)
+ implicit none
+ integer :: a(..)
+ integer :: b(..)
+ end subroutine
+ subroutine h (a, b)
+ implicit none
+ integer :: a(*)
+ integer :: b(*)
+ end subroutine
+ subroutine i (a, b)
+ implicit none
+ integer :: a(:)
+ integer :: b(:)
+ end subroutine
+ subroutine j (a, b)
+ implicit none
+ integer :: a(3,3)
+ integer :: b(3,3)
+ end subroutine
+ end interface
+end module
+
+subroutine test_calls (x, y)
+ use m
+ implicit none
+ integer :: x(..), y(..)
+
+ ! Make sure each invalid argument produces a diagnostic.
+ ! scalar dummies
+ call f (x, & ! { dg-error "(A|a)ssumed.rank" }
+ y) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ ! assumed-rank dummies
+ call g (x, y) ! OK
+ ! assumed-size dummies
+ call h (x, & ! { dg-error "(A|a)ssumed.rank" "pr101334" { xfail *-*-* } }
+ y) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ ! assumed-shape dummies
+ call i (x, & ! { dg-error "(A|a)ssumed.rank" }
+ y) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ ! fixed-size array dummies
+ call j (x, & ! { dg-error "(A|a)ssumed.rank" "pr101334" { xfail *-*-* } }
+ y) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ ! { dg-bogus "Actual argument contains too few elements" "pr101334" { xfail *-*-* } .-2 }
+end subroutine
+
+! Check that you can't use an assumed-rank array variable in an array
+! element or section designator.
+
+subroutine test_designators (x)
+ use m
+ implicit none
+ integer :: x(..)
+
+ call f (x(1), 1) ! { dg-error "(A|a)ssumed.rank" }
+ call g (x(1:3:1), & ! { dg-error "(A|a)ssumed.rank" }
+ x) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+end subroutine
+
+! Check that you can't use an assumed-rank array variable in elemental
+! expressions. Make sure binary operators produce the error for either or
+! both operands.
+
+subroutine test_expressions (a, b, c, l, m, n, x, y, z, p, q, r, s, i, j)
+ implicit none
+ integer :: a(..), b(..), c(..)
+ logical :: l(..), m(..), n(..)
+ integer :: x(s), y(s), z(s)
+ logical :: p(s), q(s), r(s)
+ integer :: s
+ integer :: i
+ logical :: j
+
+ ! Assignment
+
+ z = x ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a ! { dg-error "(A|a)ssumed.rank" }
+ z = i ! OK
+ c = i ! { dg-error "(A|a)ssumed.rank" }
+
+ r = p ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l ! { dg-error "(A|a)ssumed.rank" }
+ r = j ! OK
+ n = j ! { dg-error "(A|a)ssumed.rank" }
+
+ ! Arithmetic
+
+ z = -x ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = -a ! { dg-error "(A|a)ssumed.rank" }
+ z = -i ! OK
+ c = -i ! { dg-error "(A|a)ssumed.rank" }
+
+ z = x + y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ + b ! { dg-error "(A|a)ssumed.rank" }
+ z = x + i ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a + i ! { dg-error "(A|a)ssumed.rank" }
+ z = i + y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = i + b ! { dg-error "(A|a)ssumed.rank" }
+
+ z = x - y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ - b ! { dg-error "(A|a)ssumed.rank" }
+ z = x - i ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a - i ! { dg-error "(A|a)ssumed.rank" }
+ z = i - y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = i - b ! { dg-error "(A|a)ssumed.rank" }
+
+ z = x * y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ * b ! { dg-error "(A|a)ssumed.rank" }
+ z = x * i ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a * i ! { dg-error "(A|a)ssumed.rank" }
+ z = i * y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = i * b ! { dg-error "(A|a)ssumed.rank" }
+
+ z = x / y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ / b ! { dg-error "(A|a)ssumed.rank" }
+ z = x / i ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a / i ! { dg-error "(A|a)ssumed.rank" }
+ z = i / y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = i / b ! { dg-error "(A|a)ssumed.rank" }
+
+ z = x ** y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ ** b ! { dg-error "(A|a)ssumed.rank" }
+ z = x ** i ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = a ** i ! { dg-error "(A|a)ssumed.rank" }
+ z = i ** y ! OK
+ c & ! { dg-error "(A|a)ssumed.rank" }
+ = i ** b ! { dg-error "(A|a)ssumed.rank" }
+
+ ! Comparisons
+
+ r = x .eq. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .eq. b ! { dg-error "(A|a)ssumed.rank" }
+ r = x .eq. i ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a .eq. i ! { dg-error "(A|a)ssumed.rank" }
+ r = i .eq. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = i .eq. b ! { dg-error "(A|a)ssumed.rank" }
+
+ r = x .ne. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .ne. b ! { dg-error "(A|a)ssumed.rank" }
+ r = x .ne. i ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a .ne. i ! { dg-error "(A|a)ssumed.rank" }
+ r = i .ne. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = i .ne. b ! { dg-error "(A|a)ssumed.rank" }
+
+ r = x .lt. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .lt. b ! { dg-error "(A|a)ssumed.rank" }
+ r = x .lt. i ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a .lt. i ! { dg-error "(A|a)ssumed.rank" }
+ r = i .lt. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = i .lt. b ! { dg-error "(A|a)ssumed.rank" }
+
+ r = x .le. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .le. b ! { dg-error "(A|a)ssumed.rank" }
+ r = x .le. i ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a .le. i ! { dg-error "(A|a)ssumed.rank" }
+ r = i .le. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = i .le. b ! { dg-error "(A|a)ssumed.rank" }
+
+ r = x .gt. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .gt. b ! { dg-error "(A|a)ssumed.rank" }
+ r = x .gt. i ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a .gt. i ! { dg-error "(A|a)ssumed.rank" }
+ r = i .gt. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = i .gt. b ! { dg-error "(A|a)ssumed.rank" }
+
+ r = x .ge. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .ge. b ! { dg-error "(A|a)ssumed.rank" }
+ r = x .ge. i ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = a .ge. i ! { dg-error "(A|a)ssumed.rank" }
+ r = i .ge. y ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = i .ge. b ! { dg-error "(A|a)ssumed.rank" }
+
+ ! Logical operators
+
+ r = .not. p ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = .not. l ! { dg-error "(A|a)ssumed.rank" }
+ r = .not. j ! OK
+ n = .not. j ! { dg-error "(A|a)ssumed.rank" }
+
+ r = p .and. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .and. m ! { dg-error "(A|a)ssumed.rank" }
+ r = p .and. j ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l .and. j ! { dg-error "(A|a)ssumed.rank" }
+ r = j .and. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = j .and. m ! { dg-error "(A|a)ssumed.rank" }
+
+ r = p .or. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .or. m ! { dg-error "(A|a)ssumed.rank" }
+ r = p .or. j ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l .or. j ! { dg-error "(A|a)ssumed.rank" }
+ r = j .or. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = j .or. m ! { dg-error "(A|a)ssumed.rank" }
+
+ r = p .eqv. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .eqv. m ! { dg-error "(A|a)ssumed.rank" }
+ r = p .eqv. j ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l .eqv. j ! { dg-error "(A|a)ssumed.rank" }
+ r = j .eqv. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = j .eqv. m ! { dg-error "(A|a)ssumed.rank" }
+
+ r = p .neqv. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l & ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ .neqv. m ! { dg-error "(A|a)ssumed.rank" }
+ r = p .neqv. j ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = l .neqv. j ! { dg-error "(A|a)ssumed.rank" }
+ r = j .neqv. q ! OK
+ n & ! { dg-error "(A|a)ssumed.rank" }
+ = j .neqv. m ! { dg-error "(A|a)ssumed.rank" }
+
+end subroutine
+
+! Check that calls to disallowed intrinsic functions produce a diagnostic.
+! There are 100+ "elemental" intrinsics defined in the standard, and
+! 25+ "transformational" intrinsics that accept array operands, and that
+! doesn't include intrinsics in the standard modules. To keep the length of
+! this test to something sane, check only a handful of these functions on
+! the theory that related functions are probably implemented similarly and
+! probably share the same argument-processing code.
+
+subroutine test_intrinsics (i1, i2, r1, r2, c1, c2, l1, l2, s1, s2)
+ implicit none
+ integer :: i1(..), i2(..)
+ real :: r1(..), r2(..)
+ complex :: c1(..), c2(..)
+ logical :: l1(..), l2(..)
+ character :: s1(..), s2(..)
+
+ integer :: i
+ real :: r
+ logical :: l
+
+ ! trig, hyperbolic, other math functions
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = atan2 (r1, & ! { dg-error "(A|a)ssumed.rank" }
+ r2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = atan (r2) ! { dg-error "(A|a)ssumed.rank" }
+ c1 & ! { dg-error "(A|a)ssumed.rank" }
+ = atan (c2) ! { dg-error "(A|a)ssumed.rank" }
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = cos (r2) ! { dg-error "(A|a)ssumed.rank" }
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = exp (r2) ! { dg-error "(A|a)ssumed.rank" }
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = sinh (r2) ! { dg-error "(A|a)ssumed.rank" }
+
+ ! bit operations
+ l1 & ! { dg-error "(A|a)ssumed.rank" }
+ = blt (i1, & ! { dg-error "(A|a)ssumed.rank" }
+ i2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ l1 & ! { dg-error "(A|a)ssumed.rank" }
+ = btest (i1, 0) ! { dg-error "(A|a)ssumed.rank" }
+ i1 & ! { dg-error "(A|a)ssumed.rank" }
+ = not (i2) ! { dg-error "(A|a)ssumed.rank" }
+ i1 & ! { dg-error "(A|a)ssumed.rank" }
+ = popcnt (i2) ! { dg-error "(A|a)ssumed.rank" }
+
+ ! type conversions
+ s1 & ! { dg-error "(A|a)ssumed.rank" }
+ = char (i1) ! { dg-error "(A|a)ssumed.rank" }
+ c1 & ! { dg-error "(A|a)ssumed.rank" }
+ = cmplx (r1, & ! { dg-error "(A|a)ssumed.rank" }
+ r2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ i1 & ! { dg-error "(A|a)ssumed.rank" }
+ = floor (r1) ! { dg-error "(A|a)ssumed.rank" }
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = real (c1) ! { dg-error "(A|a)ssumed.rank" }
+
+ ! reductions
+ l = any (l2) ! { dg-error "(A|a)ssumed.rank" }
+ r = dot_product (r1, & ! { dg-error "(A|a)ssumed.rank" }
+ r2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ i = iall (i2, & ! { dg-error "(A|a)ssumed.rank" }
+ l2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+
+ ! string operations
+ s1 & ! { dg-error "(A|a)ssumed.rank" }
+ = adjustr (s2) ! { dg-error "(A|a)ssumed.rank" }
+ i1 & ! { dg-error "(A|a)ssumed.rank" }
+ = index (c1, & ! { dg-error "(A|a)ssumed.rank" }
+ c2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+
+ ! misc
+ i1 & ! { dg-error "(A|a)ssumed.rank" }
+ = cshift (i2, 4) ! { dg-error "(A|a)ssumed.rank" }
+ i = findloc (r1, 0.0) ! { dg-error "(A|a)ssumed.rank" }
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = matmul (r1, & ! { dg-error "(A|a)ssumed.rank" }
+ r2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ r1 & ! { dg-error "(A|a)ssumed.rank" }
+ = reshape (r2, [10, 3]) ! { dg-error "(A|a)ssumed.rank" }
+ i1 & ! { dg-error "(A|a)ssumed.rank" }
+ = sign (i1, & ! { dg-error "(A|a)ssumed.rank" }
+ i2) ! { dg-error "(A|a)ssumed.rank" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ s1 & ! { dg-error "(A|a)ssumed.rank" }
+ = transpose (s2) ! { dg-error "(A|a)ssumed.rank" }
+
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535b-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535b-3.f90
new file mode 100644
index 0000000..6427bd6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535b-3.f90
@@ -0,0 +1,79 @@
+! PR 101334
+! { dg-do compile}
+! { dg-additional-options "-fcoarray=single" }
+!
+! TS 29113
+! C535b An assumed-rank variable name shall not appear in a designator
+! or expression except as an actual argument corresponding to a dummy
+! argument that is assumed-rank, the argument of the C_LOC function
+! in the ISO_C_BINDING intrinsic module, or the first argument in a
+! reference to an intrinsic inquiry function.
+!
+! This has been renamed C838 in the Fortran 2018 standard, with C_SIZEOF
+! and SELECT_RANK additionally added.
+!
+! This tests various forms of the 2-argument associated intrinsic.
+
+function test_associated2 (a, b)
+ implicit none
+ integer, pointer :: a(..)
+ integer, target :: b(..)
+ logical :: test_associated2
+
+ test_associated2 = associated (a, b) ! { dg-error "Assumed.rank" }
+end function
+
+function test_associated3 (a, b)
+ implicit none
+ integer, pointer :: a(..)
+ integer, target :: b
+ logical :: test_associated3
+
+ test_associated3 = associated (a, b) ! { dg-bogus "must be of rank -1" "pr101334" { xfail *-*-* } }
+end function
+
+function test_associated4 (a, b)
+ implicit none
+ integer, pointer :: a(..)
+ integer, target :: b(:)
+ logical :: test_associated4
+
+ test_associated4 = associated (a, b) ! { dg-bogus "must be of rank -1" "pr101334" { xfail *-*-* } }
+end function
+
+function test_associated5 (a, b)
+ implicit none
+ integer, pointer :: a(..)
+ integer, target :: b(20)
+ logical :: test_associated5
+
+ test_associated5 = associated (a, b) ! { dg-bogus "must be of rank -1" "pr101334" { xfail *-*-* } }
+end function
+
+function test_associated6 (a, b)
+ implicit none
+ integer, pointer :: a(..)
+ integer, pointer :: b(..)
+ logical :: test_associated6
+
+ test_associated6 = associated (a, b) ! { dg-error "Assumed.rank" }
+end function
+
+function test_associated7 (a, b)
+ implicit none
+ integer, pointer :: a(..)
+ integer, pointer :: b
+ logical :: test_associated7
+
+ test_associated7 = associated (a, b) ! { dg-bogus "must be of rank -1" "pr101334" { xfail *-*-* } }
+end function
+
+function test_associated8 (a, b)
+ implicit none
+ integer, pointer :: a(..)
+ integer, pointer :: b(:)
+ logical :: test_associated8
+
+ test_associated8 = associated (a, b) ! { dg-bogus "must be of rank -1" "pr101334" { xfail *-*-* } }
+end function
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535c-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535c-1.f90
new file mode 100644
index 0000000..b404713
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535c-1.f90
@@ -0,0 +1,87 @@
+! PR 54753
+! { dg-do compile}
+!
+! TS 29113
+! C535c If an assumed-size or nonallocatable nonpointer assumed-rank
+! array is an actual argument corresponding to a dummy argument that
+! is an INTENT(OUT) assumed-rank array, it shall not be polymorphic, [...].
+!
+! This constraint is numbered C839 in the Fortran 2018 standard.
+!
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+module m
+
+ type :: t1
+ integer :: id
+ real :: xyz(3)
+ end type
+
+contains
+
+ subroutine s1_nonpolymorphic (x, y)
+ type(t1) :: x(..)
+ type(t1), intent(out) :: y(..)
+ end subroutine
+
+ subroutine s1_polymorphic (x, y) ! { dg-bogus "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ class(t1) :: x(..)
+ class(t1), intent(out) :: y(..)
+ end subroutine
+
+ subroutine s1_unlimited_polymorphic (x, y) ! { dg-bogus "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ class(*) :: x(..)
+ class(*), intent(out) :: y(..)
+ end subroutine
+
+ ! These calls should all be OK as they do not involve assumed-size or
+ ! assumed-rank actual arguments.
+ subroutine test_known_size (a1, a2, n)
+ integer :: n
+ type(t1) :: a1(n,n), a2(n)
+
+ call s1_nonpolymorphic (a1, a2)
+ call s1_polymorphic (a1, a2)
+ call s1_unlimited_polymorphic (a1, a2)
+ end subroutine
+
+ ! The calls to the polymorphic functions should be rejected
+ ! with an assumed-size array argument.
+ subroutine test_assumed_size (a1, a2)
+ type(t1) :: a1(*), a2(*)
+
+ call s1_nonpolymorphic (a1, a2)
+ call s1_polymorphic (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ call s1_unlimited_polymorphic (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+ ! These calls should be OK.
+ subroutine test_assumed_rank_pointer (a1, a2)
+ type(t1), pointer :: a1(..), a2(..)
+
+ call s1_nonpolymorphic (a1, a2)
+ call s1_polymorphic (a1, a2)
+ call s1_unlimited_polymorphic (a1, a2)
+ end subroutine
+
+ ! These calls should be OK.
+ subroutine test_assumed_rank_allocatable (a1, a2)
+ type(t1), allocatable :: a1(..), a2(..)
+
+ call s1_nonpolymorphic (a1, a2)
+ call s1_polymorphic (a1, a2)
+ call s1_unlimited_polymorphic (a1, a2)
+ end subroutine
+
+ ! The calls to the polymorphic functions should be rejected
+ ! with a nonallocatable nonpointer assumed-rank actual argument.
+ subroutine test_assumed_rank_plain (a1, a2)
+ type(t1) :: a1(..), a2(..)
+
+ call s1_nonpolymorphic (a1, a2)
+ call s1_polymorphic (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ call s1_unlimited_polymorphic (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535c-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535c-2.f90
new file mode 100644
index 0000000..db15ece
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535c-2.f90
@@ -0,0 +1,74 @@
+! PR 54753
+! { dg-do compile}
+!
+! TS 29113
+! C535c If an assumed-size or nonallocatable nonpointer assumed-rank
+! array is an actual argument corresponding to a dummy argument that
+! is an INTENT(OUT) assumed-rank array, it shall not be [...]
+! finalizable [...].
+!
+! This constraint is numbered C839 in the Fortran 2018 standard.
+!
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+module m
+
+ type :: t1
+ integer :: id
+ real :: xyz(3)
+ contains
+ final :: finalize_t1
+ end type
+
+contains
+
+ subroutine finalize_t1 (obj)
+ type(t1) :: obj
+ end subroutine
+
+ subroutine s1 (x, y)
+ type(t1) :: x(..)
+ type(t1), intent(out) :: y(..)
+ end subroutine
+
+ ! This call should be OK as it does not involve assumed-size or
+ ! assumed-rank actual arguments.
+ subroutine test_known_size (a1, a2, n)
+ integer :: n
+ type(t1) :: a1(n,n), a2(n)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! Calls with an assumed-size array argument should be rejected.
+ subroutine test_assumed_size (a1, a2)
+ type(t1) :: a1(*), a2(*)
+
+ call s1 (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+ ! This call should be OK.
+ subroutine test_assumed_rank_pointer (a1, a2)
+ type(t1), pointer :: a1(..), a2(..)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! This call should be OK.
+ subroutine test_assumed_rank_allocatable (a1, a2)
+ type(t1), allocatable :: a1(..), a2(..)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! The call should be rejected with a nonallocatable nonpointer
+ ! assumed-rank actual argument.
+ subroutine test_assumed_rank_plain (a1, a2)
+ type(t1) :: a1(..), a2(..)
+
+ call s1 (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+end module
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535c-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535c-3.f90
new file mode 100644
index 0000000..5c224b1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535c-3.f90
@@ -0,0 +1,73 @@
+! PR 54753
+! { dg-do compile }
+! { dg-ice "pr54753" }
+!
+! TS 29113
+! C535c If an assumed-size or nonallocatable nonpointer assumed-rank
+! array is an actual argument corresponding to a dummy argument that
+! is an INTENT(OUT) assumed-rank array, it shall not be [...]
+! of a type with an allocatable ultimate component [...].
+!
+! This constraint is numbered C839 in the Fortran 2018 standard.
+!
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+module m
+
+ type :: t1
+ integer :: id
+ real :: xyz(3)
+ character, allocatable :: notes
+ end type
+
+contains
+
+ subroutine finalize_t1 (obj)
+ type(t1) :: obj
+ end subroutine
+
+ subroutine s1 (x, y)
+ type(t1) :: x(..)
+ type(t1), intent(out) :: y(..)
+ end subroutine
+
+ ! This call should be OK as it does not involve assumed-size or
+ ! assumed-rank actual arguments.
+ subroutine test_known_size (a1, a2, n)
+ integer :: n
+ type(t1) :: a1(n,n), a2(n)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! Calls with an assumed-size array argument should be rejected.
+ subroutine test_assumed_size (a1, a2)
+ type(t1) :: a1(*), a2(*)
+
+ call s1 (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+ ! This call should be OK.
+ subroutine test_assumed_rank_pointer (a1, a2)
+ type(t1), pointer :: a1(..), a2(..)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! This call should be OK.
+ subroutine test_assumed_rank_allocatable (a1, a2)
+ type(t1), allocatable :: a1(..), a2(..)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! The call should be rejected with a nonallocatable nonpointer
+ ! assumed-rank actual argument.
+ subroutine test_assumed_rank_plain (a1, a2)
+ type(t1) :: a1(..), a2(..)
+
+ call s1 (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c535c-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/c535c-4.f90
new file mode 100644
index 0000000..ecbb181
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/c535c-4.f90
@@ -0,0 +1,73 @@
+! PR 54753
+! { dg-do compile }
+! { dg-ice "pr54753" }
+!
+! TS 29113
+! C535c If an assumed-size or nonallocatable nonpointer assumed-rank
+! array is an actual argument corresponding to a dummy argument that
+! is an INTENT(OUT) assumed-rank array, it shall not be [...]
+! of a type for which default initialization is specified.
+!
+! This constraint is numbered C839 in the Fortran 2018 standard.
+!
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+module m
+
+ type :: t1
+ integer :: id
+ real :: xyz(3)
+ integer :: tag = -1
+ end type
+
+contains
+
+ subroutine finalize_t1 (obj)
+ type(t1) :: obj
+ end subroutine
+
+ subroutine s1 (x, y)
+ type(t1) :: x(..)
+ type(t1), intent(out) :: y(..)
+ end subroutine
+
+ ! This call should be OK as it does not involve assumed-size or
+ ! assumed-rank actual arguments.
+ subroutine test_known_size (a1, a2, n)
+ integer :: n
+ type(t1) :: a1(n,n), a2(n)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! Calls with an assumed-size array argument should be rejected.
+ subroutine test_assumed_size (a1, a2)
+ type(t1) :: a1(*), a2(*)
+
+ call s1 (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+ ! This call should be OK.
+ subroutine test_assumed_rank_pointer (a1, a2)
+ type(t1), pointer :: a1(..), a2(..)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! This call should be OK.
+ subroutine test_assumed_rank_allocatable (a1, a2)
+ type(t1), allocatable :: a1(..), a2(..)
+
+ call s1 (a1, a2)
+ end subroutine
+
+ ! The call should be rejected with a nonallocatable nonpointer
+ ! assumed-rank actual argument.
+ subroutine test_assumed_rank_plain (a1, a2)
+ type(t1) :: a1(..), a2(..)
+
+ call s1 (a1, a2) ! { dg-error "(A|a)ssumed.rank" "pr54753" { xfail *-*-* } }
+ end subroutine
+
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1-c.c
new file mode 100644
index 0000000..3ff3a8d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1-c.c
@@ -0,0 +1,91 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+extern void ftest (CFI_cdesc_t *a, CFI_cdesc_t *b);
+
+struct m {
+ int i;
+ int j;
+};
+
+#define imax 10
+#define jmax 5
+
+void
+ctest (CFI_cdesc_t *a)
+{
+
+ struct m bdata[imax][jmax];
+ CFI_CDESC_T(2) bdesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ int i, j;
+ CFI_index_t subscripts[2];
+ struct m* mp;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != imax)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != jmax)
+ abort ();
+
+ /* Transpose a's contents into bdata. */
+ for (j = 0; j < jmax; j++)
+ {
+ subscripts[1] = j;
+ for (i = 0; i < imax; i++)
+ {
+ subscripts[0] = i;
+ mp = (struct m *) CFI_address (a, subscripts);
+ if (mp->i != i + 1)
+ abort ();
+ if (mp->j != j + 1)
+ abort ();
+ bdata[i][j].i = mp->i;
+ bdata[i][j].j = mp->j;
+ }
+ }
+
+ /* Fill in bdesc. */
+ subscripts[0] = jmax;
+ subscripts[1] = imax;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, bdata, CFI_attribute_other,
+ CFI_type_struct,
+ sizeof (struct m), 2, subscripts));
+
+ /* Sanity checking to make sure the descriptor has been initialized
+ properly. */
+ dump_CFI_cdesc_t (b);
+ if (b->version != CFI_VERSION)
+ abort ();
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_other)
+ abort ();
+ if (b->dim[0].lower_bound != 0)
+ abort ();
+ if (b->dim[0].extent != jmax)
+ abort ();
+ if (b->dim[1].lower_bound != 0)
+ abort ();
+ if (b->dim[1].extent != imax)
+ abort ();
+
+ /* Call back into Fortran, passing both the a and b arrays. */
+ ftest (a, b);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1.f90
new file mode 100644
index 0000000..f52a631
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-1.f90
@@ -0,0 +1,66 @@
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-1-c.c dump-descriptors.c" }
+!
+! This program checks that building a descriptor for a fixed-size array
+! in C works and that you can use it to call back into a Fortran function
+! declared to have c binding, as an assumed-shape argument.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+subroutine ftest (a, b) bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:), b(:,:)
+ integer :: i, j
+
+ if (size (a,1) .ne. imax) stop 101
+ if (size (a,2) .ne. jmax) stop 102
+ if (size (b,1) .ne. jmax) stop 103
+ if (size (b,2) .ne. imax) stop 104
+
+ do j = 1, jmax
+ do i = 1, imax
+ if (a(i,j)%i .ne. i) stop 201
+ if (a(i,j)%j .ne. j) stop 202
+ if (b(j,i)%i .ne. i) stop 203
+ if (b(j,i)%j .ne. j) stop 204
+ end do
+ end do
+end subroutine
+
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ end subroutine
+ end interface
+
+ type(m) :: aa(imax,jmax)
+ integer :: i, j
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ ! Pass the initialized array to a C function ctest, which will generate its
+ ! transpose and call ftest with it.
+
+ call ctest (aa)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2-c.c
new file mode 100644
index 0000000..a4be5a7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2-c.c
@@ -0,0 +1,91 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+extern void ftest (CFI_cdesc_t *a, CFI_cdesc_t *b);
+
+struct m {
+ int i;
+ int j;
+};
+
+#define imax 10
+#define jmax 5
+
+void
+ctest (CFI_cdesc_t *a)
+{
+
+ struct m bdata[imax][jmax];
+ CFI_CDESC_T(2) bdesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ int i, j;
+ CFI_index_t subscripts[2];
+ struct m* mp;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != imax)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != jmax)
+ abort ();
+
+ /* Transpose a's contents into bdata. */
+ for (j = 0; j < jmax; j++)
+ {
+ subscripts[1] = j;
+ for (i = 0; i < imax; i++)
+ {
+ subscripts[0] = i;
+ mp = (struct m *) CFI_address (a, subscripts);
+ if (mp->i != i + 1)
+ abort ();
+ if (mp->j != j + 1)
+ abort ();
+ bdata[i][j].i = mp->i;
+ bdata[i][j].j = mp->j;
+ }
+ }
+
+ /* Fill in bdesc. */
+ subscripts[0] = jmax;
+ subscripts[1] = imax;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, bdata, CFI_attribute_other,
+ CFI_type_struct,
+ sizeof (struct m), 2, subscripts));
+
+ /* Sanity checking to make sure the descriptor has been initialized
+ properly. */
+ dump_CFI_cdesc_t (b);
+ if (b->version != CFI_VERSION)
+ abort ();
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_other)
+ abort ();
+ if (b->dim[0].lower_bound != 0)
+ abort ();
+ if (b->dim[0].extent != jmax)
+ abort ();
+ if (b->dim[1].lower_bound != 0)
+ abort ();
+ if (b->dim[1].extent != imax)
+ abort ();
+
+ /* Call back into Fortran, passing both the a and b arrays. */
+ ftest (a, b);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2.f90
new file mode 100644
index 0000000..a4231fa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-2.f90
@@ -0,0 +1,82 @@
+! PR 93308
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-2-c.c dump-descriptors.c" }
+!
+! This program checks that building a descriptor for a fixed-size array
+! in C works and that you can use it to call back into a Fortran function
+! declared to have c binding, as an assumed-rank argument.
+!
+! Fixed by
+! https://gcc.gnu.org/pipermail/gcc-patches/2021-June/572725.html
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+subroutine ftest (a, b) bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ type(m) :: a(..), b(..)
+ integer :: i, j
+
+ select rank (a)
+ rank (2)
+ select rank (b)
+ rank (2)
+ ! print *, lbound(a,1), ubound(a,1), lbound(a,2), ubound(a,2)
+ ! print *, lbound(b,1), ubound(b,1), lbound(b,2), ubound(b,2)
+ if (lbound (a,1) .ne. 1 .or. ubound (a,1) .ne. imax) stop 101
+ if (lbound (a,2) .ne. 1 .or. ubound (a,2) .ne. jmax) stop 102
+ if (lbound (b,1) .ne. 1 .or. ubound (b,1) .ne. jmax) stop 103
+ if (lbound (b,2) .ne. 1 .or. ubound (b,2) .ne. imax) stop 104
+ do j = 1, jmax
+ do i = 1, imax
+ print *, a(i,j)%i, a(i,j)%j, b(j,i)%i, b(j,i)%j
+ if (a(i,j)%i .ne. i) stop 105
+ if (a(i,j)%j .ne. j) stop 106
+ if (b(j,i)%i .ne. i) stop 107
+ if (b(j,i)%j .ne. j) stop 108
+ end do
+ end do
+ rank default
+ stop 106
+ end select
+ rank default
+ stop 107
+ end select
+end subroutine
+
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ end subroutine
+ end interface
+
+ type(m) :: aa(imax,jmax)
+ integer :: i, j
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ ! Pass the initialized array to a C function ctest, which will generate its
+ ! transpose and call ftest with it.
+
+ call ctest (aa)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3-c.c
new file mode 100644
index 0000000..b947377
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3-c.c
@@ -0,0 +1,92 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (int imagic, int jmagic);
+extern void ftest (CFI_cdesc_t *a, CFI_cdesc_t *b, int initp);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (int imagic, int jmagic)
+{
+ CFI_CDESC_T(0) adesc;
+ CFI_CDESC_T(0) bdesc;
+ CFI_cdesc_t *a = (CFI_cdesc_t *) &adesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ struct m* mp;
+
+ /* Create the descriptor for a, then sanity-check it. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (a, NULL, CFI_attribute_allocatable,
+ CFI_type_struct,
+ sizeof (struct m), 0, NULL));
+ dump_CFI_cdesc_t (a);
+ if (a->version != CFI_VERSION)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+
+ /* Likewise for b. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ sizeof (struct m), 0, NULL));
+ dump_CFI_cdesc_t (b);
+ if (b->version != CFI_VERSION)
+ abort ();
+ if (b->rank != 0)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+ if (b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+
+ /* Call back into Fortran, passing the unallocated descriptors. */
+ ftest (a, b, 0);
+
+ /* Allocate and initialize both variables, and try again. */
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (a, NULL, NULL, 0));
+ dump_CFI_cdesc_t (a);
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+ ((struct m *)a->base_addr)->i = imagic;
+ ((struct m *)a->base_addr)->j = jmagic;
+
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (b, NULL, NULL, 0));
+ dump_CFI_cdesc_t (b);
+ if (!b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+ ((struct m *)b->base_addr)->i = imagic + 1;
+ ((struct m *)b->base_addr)->j = jmagic + 1;
+
+ ftest (a, b, 1);
+
+ /* Deallocate both objects and try again. */
+ check_CFI_status ("CFI_deallocate", CFI_deallocate (a));
+ if (a->base_addr)
+ abort ();
+ check_CFI_status ("CFI_deallocate", CFI_deallocate (b));
+ if (b->base_addr)
+ abort ();
+ ftest (a, b, 0);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3.f90
new file mode 100644
index 0000000..7a08395
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-3.f90
@@ -0,0 +1,58 @@
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-3-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that building a descriptor for an allocatable
+! or pointer scalar argument in C works and that you can use it to call
+! back into a Fortran function declared to have c binding.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer(C_INT), parameter :: imagic = 42, jmagic = 69
+end module
+
+subroutine ftest (a, b, initp) bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a
+ type(m), pointer :: b
+ integer(C_INT), value :: initp
+
+ if (rank(a) .ne. 0) stop 101
+ if (rank(b) .ne. 0) stop 101
+
+ if (initp .ne. 0 .and. .not. allocated(a)) stop 102
+ if (initp .eq. 0 .and. allocated(a)) stop 103
+ if (initp .ne. 0 .and. .not. associated(b)) stop 104
+ if (initp .eq. 0 .and. associated(b)) stop 105
+
+ if (initp .ne. 0) then
+ if (a%i .ne. imagic) stop 201
+ if (a%j .ne. jmagic) stop 202
+ if (b%i .ne. imagic + 1) stop 203
+ if (b%j .ne. jmagic + 1) stop 204
+ end if
+end subroutine
+
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (i, j) bind (c)
+ use iso_c_binding
+ integer(C_INT), value :: i, j
+ end subroutine
+ end interface
+
+ ! ctest will call ftest with both an unallocated and allocated argument.
+
+ call ctest (imagic, jmagic)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4-c.c
new file mode 100644
index 0000000..b941318
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4-c.c
@@ -0,0 +1,112 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (int imagic, int jmagic);
+extern void ftest (CFI_cdesc_t *a, CFI_cdesc_t *b, int initp);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (int imax, int jmax)
+{
+ CFI_CDESC_T(2) adesc;
+ CFI_CDESC_T(2) bdesc;
+ CFI_cdesc_t *a = (CFI_cdesc_t *) &adesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ struct m* mp;
+ CFI_index_t lower[2], upper[2], subscripts[2];
+ CFI_index_t i, j;
+
+ /* Create the descriptor for a, then sanity-check it. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (a, NULL, CFI_attribute_allocatable,
+ CFI_type_struct,
+ sizeof (struct m), 2, NULL));
+ dump_CFI_cdesc_t (a);
+ if (a->version != CFI_VERSION)
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+
+ /* Likewise for b. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ sizeof (struct m), 2, NULL));
+ dump_CFI_cdesc_t (b);
+ if (b->version != CFI_VERSION)
+ abort ();
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+ if (b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+
+ /* Call back into Fortran, passing the unallocated descriptors. */
+ ftest (a, b, 0);
+
+ /* Allocate and initialize both variables, and try again. */
+ lower[0] = 1;
+ lower[1] = 1;
+ upper[0] = imax;
+ upper[1] = jmax;
+
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (a, lower, upper, 0));
+ dump_CFI_cdesc_t (a);
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+
+ upper[0] = jmax;
+ upper[1] = imax;
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (b, lower, upper, 0));
+ dump_CFI_cdesc_t (b);
+ if (!b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+
+ for (i = 1; i <= imax; i++)
+ for (j = 1; j <= jmax; j++)
+ {
+ subscripts[0] = i;
+ subscripts[1] = j;
+ mp = (struct m *) CFI_address (a, subscripts);
+ mp->i = i;
+ mp->j = j;
+ subscripts[0] = j;
+ subscripts[1] = i;
+ mp = (struct m *) CFI_address (b, subscripts);
+ mp->i = i;
+ mp->j = j;
+ }
+
+ ftest (a, b, 1);
+
+ /* Deallocate both objects and try again. */
+ check_CFI_status ("CFI_deallocate", CFI_deallocate (a));
+ if (a->base_addr)
+ abort ();
+ check_CFI_status ("CFI_deallocate", CFI_deallocate (b));
+ if (b->base_addr)
+ abort ();
+ ftest (a, b, 0);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4.f90
new file mode 100644
index 0000000..c05f2e3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-4.f90
@@ -0,0 +1,73 @@
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-4-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that building a descriptor for an allocatable
+! or pointer array argument in C works and that you can use it to call
+! back into a Fortran function declared to have c binding.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer(C_INT), parameter :: imax=3, jmax=6
+end module
+
+subroutine ftest (a, b, initp) bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:,:)
+ type(m), pointer :: b(:,:)
+ integer(C_INT), value :: initp
+ integer :: i, j
+
+ if (rank(a) .ne. 2) stop 101
+ if (rank(b) .ne. 2) stop 101
+
+ if (initp .ne. 0 .and. .not. allocated(a)) stop 102
+ if (initp .eq. 0 .and. allocated(a)) stop 103
+ if (initp .ne. 0 .and. .not. associated(b)) stop 104
+ if (initp .eq. 0 .and. associated(b)) stop 105
+
+ if (initp .ne. 0) then
+ if (lbound (a, 1) .ne. 1) stop 201
+ if (lbound (a, 2) .ne. 1) stop 202
+ if (lbound (b, 2) .ne. 1) stop 203
+ if (lbound (b, 1) .ne. 1) stop 204
+ if (ubound (a, 1) .ne. imax) stop 205
+ if (ubound (a, 2) .ne. jmax) stop 206
+ if (ubound (b, 2) .ne. imax) stop 207
+ if (ubound (b, 1) .ne. jmax) stop 208
+
+ do i = 1, imax
+ do j = 1, jmax
+ if (a(i,j)%i .ne. i) stop 301
+ if (a(i,j)%j .ne. j) stop 302
+ if (b(j,i)%i .ne. i) stop 303
+ if (b(j,i)%j .ne. j) stop 303
+ end do
+ end do
+
+ end if
+end subroutine
+
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (i, j) bind (c)
+ use iso_c_binding
+ integer(C_INT), value :: i, j
+ end subroutine
+ end interface
+
+ ! ctest will call ftest with both an unallocated and allocated argument.
+
+ call ctest (imax, jmax)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c
new file mode 100644
index 0000000..0cd92e7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (int n);
+extern void ftest (CFI_cdesc_t *a, int n);
+
+void
+ctest (int n)
+{
+ CFI_CDESC_T(0) adesc;
+ CFI_cdesc_t *a = (CFI_cdesc_t *) &adesc;
+ char *adata = (char *) alloca (n);
+
+ /* Fill in adesc. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (a, adata, CFI_attribute_other,
+ CFI_type_char, n, 0, NULL));
+
+ /* Sanity checking to make sure the descriptor has been initialized
+ properly. */
+ dump_CFI_cdesc_t (a);
+ if (a->version != CFI_VERSION)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->elem_len != n)
+ abort ();
+
+ /* Call back into Fortran. */
+ ftest (a, n);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5.f90
new file mode 100644
index 0000000..f178bb8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5.f90
@@ -0,0 +1,31 @@
+! PR92482
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-5-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that building a descriptor for a character object
+! in C works and that you can use it to call back into a Fortran function
+! with an assumed-length dummy that is declared with C binding.
+
+subroutine ftest (a, n) bind (c, name="ftest") ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(kind=C_CHAR, len=*) :: a
+ integer(C_INT), value :: n
+
+ if (len (a) .ne. n) stop 101
+end subroutine
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (n) bind (c)
+ use iso_c_binding
+ integer(C_INT), value :: n
+ end subroutine
+ end interface
+
+ call ctest (42)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6-c.c
new file mode 100644
index 0000000..168087b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6-c.c
@@ -0,0 +1,81 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, int lb1, int lb2, int ub1, int ub2, int step1, int step2);
+extern void ftest (CFI_cdesc_t *b);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (CFI_cdesc_t *a, int lb1, int lb2, int ub1, int ub2,
+ int step1, int step2)
+{
+ CFI_CDESC_T(2) bdesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ CFI_index_t lb[2], ub[2], step[2];
+ int i, j;
+
+ fprintf (stderr, "got new bound info (%d:%d:%d, %d:%d:%d)\n",
+ lb1, ub1, step1, lb2, ub2, step2);
+ lb[0] = lb1 - 1;
+ lb[1] = lb2 - 1;
+ ub[0] = ub1 - 1;
+ ub[1] = ub2 - 1;
+ step[0] = step1;
+ step[1] = step2;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+
+ /* Fill in bdesc. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ sizeof (struct m), 2, NULL));
+ check_CFI_status ("CFI_section",
+ CFI_section (b, a, lb, ub, step));
+
+ /* Sanity checking to make sure the descriptor has been initialized
+ properly. */
+ dump_CFI_cdesc_t (b);
+ if (b->version != CFI_VERSION)
+ abort ();
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+ if (!b->base_addr)
+ abort ();
+ if (CFI_is_contiguous (b))
+ abort ();
+
+ for (j = b->dim[1].lower_bound;
+ j < b->dim[1].lower_bound + b->dim[1].extent;
+ j++)
+ {
+ for (i = b->dim[0].lower_bound;
+ i < b->dim[0].lower_bound + b->dim[0].extent;
+ i++)
+ {
+ CFI_index_t subscripts[2];
+ struct m *mp;
+ subscripts[0] = i;
+ subscripts[1] = j;
+ mp = (struct m *) CFI_address (b, subscripts);
+ fprintf (stderr, "b(%d,%d) = (%d,%d)\n", i, j, mp->i, mp->j);
+ }
+ }
+
+ /* Call back into Fortran. */
+ ftest (b);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6.f90
new file mode 100644
index 0000000..5716494
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-6.f90
@@ -0,0 +1,72 @@
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-6-c.c dump-descriptors.c" }
+!
+! This program tests passing the result of the CFI_section C library
+! routine back to Fortran. Most of the work happens on the C side.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+ integer, parameter :: ilb=2, jlb=1
+ integer, parameter :: iub=8, jub=5
+ integer, parameter :: istep=3, jstep=2
+ integer, parameter :: isize=3, jsize=3
+end module
+
+subroutine ftest (b) bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ type(m), pointer :: b(:,:)
+ integer :: i, j, ii, jj
+
+ if (size (b, 1) .ne. isize) stop 103
+ if (size (b, 2) .ne. jsize) stop 104
+
+ ! ii and jj iterate over the elements of b
+ ! i and j iterate over the original array
+ jj = lbound (b, 2)
+ do j = jlb, jub, jstep
+ ii = lbound (b, 1)
+ do i = ilb, iub, istep
+ if (b (ii, jj)%i .ne. i) stop 203
+ if (b (ii, jj)%j .ne. j) stop 204
+ ii = ii + 1
+ end do
+ jj = jj + 1
+ end do
+end subroutine
+
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (a, lb1, lb2, ub1, ub2, step1, step2) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ integer(C_INT), value :: lb1, lb2, ub1, ub2, step1, step2
+ end subroutine
+ end interface
+
+ type(m), target :: aa(imax,jmax)
+ integer :: i, j
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ ! Pass the initialized array to a C function ctest, which will take
+ ! a section of it and pass it to ftest.
+
+ call ctest (aa, ilb, jlb, iub, jub, istep, jstep)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7-c.c
new file mode 100644
index 0000000..1f23a64
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7-c.c
@@ -0,0 +1,81 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+extern void ftest (CFI_cdesc_t *iarray, CFI_cdesc_t *jarray);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ CFI_CDESC_T(2) idesc;
+ CFI_cdesc_t *iarray = (CFI_cdesc_t *) &idesc;
+ CFI_CDESC_T(2) jdesc;
+ CFI_cdesc_t *jarray = (CFI_cdesc_t *) &jdesc;
+ int i, j;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+
+ /* Fill in the new descriptors. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (iarray, NULL, CFI_attribute_pointer,
+ CFI_type_int,
+ sizeof (int), 2, NULL));
+ check_CFI_status ("CFI_select_part",
+ CFI_select_part (iarray, a, offsetof (struct m, i),
+ sizeof (int)));
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (jarray, NULL, CFI_attribute_pointer,
+ CFI_type_int,
+ sizeof (int), 2, NULL));
+ check_CFI_status ("CFI_select_part",
+ CFI_select_part (jarray, a, offsetof (struct m, j),
+ sizeof (int)));
+
+ /* Sanity checking to make sure the descriptor has been initialized
+ properly. */
+ dump_CFI_cdesc_t (iarray);
+ if (iarray->version != CFI_VERSION)
+ abort ();
+ if (iarray->rank != 2)
+ abort ();
+ if (iarray->attribute != CFI_attribute_pointer)
+ abort ();
+ if (!iarray->base_addr)
+ abort ();
+ if (iarray->dim[0].extent != a->dim[0].extent)
+ abort ();
+ if (iarray->dim[1].extent != a->dim[1].extent)
+ abort ();
+
+ dump_CFI_cdesc_t (jarray);
+ if (jarray->version != CFI_VERSION)
+ abort ();
+ if (jarray->rank != 2)
+ abort ();
+ if (jarray->attribute != CFI_attribute_pointer)
+ abort ();
+ if (!jarray->base_addr)
+ abort ();
+ if (jarray->dim[0].extent != a->dim[0].extent)
+ abort ();
+ if (jarray->dim[1].extent != a->dim[1].extent)
+ abort ();
+
+ /* Call back into Fortran. */
+ ftest (iarray, jarray);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7.f90
new file mode 100644
index 0000000..bc76b0e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-7.f90
@@ -0,0 +1,74 @@
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-7-c.c dump-descriptors.c" }
+!
+! This program tests passing the result of the CFI_select_part C library
+! routine back to Fortran. Most of the work happens on the C side.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+subroutine ftest (iarray, jarray) bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ integer(C_INT), pointer :: iarray(:,:), jarray(:,:)
+
+ integer :: i, j, i1, i2, j1, j2
+
+ ! iarray and jarray must have the same shape as the original array,
+ ! but might be zero-indexed instead of one-indexed.
+ if (size (iarray, 1) .ne. imax) stop 101
+ if (size (iarray, 2) .ne. jmax) stop 102
+ if (size (jarray, 1) .ne. imax) stop 103
+ if (size (jarray, 2) .ne. jmax) stop 104
+
+ j1 = lbound(iarray, 2)
+ j2 = lbound(jarray, 2)
+ do j = 1, jmax
+ i1 = lbound(iarray, 1)
+ i2 = lbound(jarray, 1)
+ do i = 1, imax
+ if (iarray (i1, j1) .ne. i) stop 201
+ if (jarray (i2, j2) .ne. j) stop 202
+ i1 = i1 + 1
+ i2 = i2 + 1
+ end do
+ j1 = j1 + 1
+ j2 = j2 + 1
+ end do
+end subroutine
+
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ end subroutine
+ end interface
+
+ type(m), target :: aa(imax,jmax)
+ integer :: i, j
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ ! Pass the initialized array to a C function ctest, which will split it
+ ! into i and j component arrays and pass them to ftest.
+
+ call ctest (aa)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8-c.c
new file mode 100644
index 0000000..49beee7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8-c.c
@@ -0,0 +1,73 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+extern void ftest1 (CFI_cdesc_t *a, int lb1, int lb2);
+extern void ftest2 (CFI_cdesc_t *a);
+
+struct m {
+ int i;
+ int j;
+};
+
+#define imax 10
+#define jmax 5
+
+void
+ctest (CFI_cdesc_t *a)
+{
+
+ CFI_CDESC_T(2) bdesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ int i, j;
+ CFI_index_t subscripts[2];
+ struct m* mp;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+
+ /* Fill in bdesc. */
+ subscripts[0] = a->dim[0].extent;
+ subscripts[1] = a->dim[1].extent;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ sizeof (struct m), 2, subscripts));
+
+ /* Pass the unassociated pointer descriptor b back to Fortran for
+ checking. */
+ dump_CFI_cdesc_t (b);
+ ftest2 (b);
+
+ /* Point the descriptor b at the input argument array, and check that
+ on the Fortran side. */
+ subscripts[0] = a->dim[0].lower_bound;
+ subscripts[1] = a->dim[1].lower_bound;
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (b, a, subscripts));
+ dump_CFI_cdesc_t (b);
+ ftest1 (b, (int)subscripts[0], (int)subscripts[1]);
+
+ /* Diddle the lower bounds and try again. */
+ subscripts[0] = 42;
+ subscripts[1] = -69;
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (b, b, subscripts));
+ dump_CFI_cdesc_t (b);
+ ftest1 (b, 42, -69);
+
+ /* Disassociate the pointer and check that. */
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (b, NULL, NULL));
+ dump_CFI_cdesc_t (b);
+ ftest2 (b);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8.f90
new file mode 100644
index 0000000..6b35e6e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-8.f90
@@ -0,0 +1,78 @@
+! { dg-do run }
+! { dg-additional-sources "cf-descriptor-8-c.c dump-descriptors.c" }
+!
+! This program tests passing the result of the CFI_setpointer C library
+! function back to Fortran. Most of the work happens on the C side.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+subroutine ftest1 (a, lb1, lb2) bind (c, name="ftest1")
+ use iso_c_binding
+ use mm
+ type(m), pointer :: a(:,:)
+ integer(C_INT), value :: lb1, lb2
+ integer :: i, j, ii, jj
+
+ if (size (a,1) .ne. imax) stop 101
+ if (size (a,2) .ne. jmax) stop 102
+ if (lbound (a, 1) .ne. lb1) stop 103
+ if (lbound (a, 2) .ne. lb2) stop 104
+
+ if (.not. associated (a)) stop 105
+
+ jj = lb2
+ do j = 1, jmax
+ ii = lb1
+ do i = 1, imax
+ if (a(ii,jj)%i .ne. i) stop 201
+ if (a(ii,jj)%j .ne. j) stop 202
+ ii = ii + 1
+ end do
+ jj = jj + 1
+ end do
+end subroutine
+
+subroutine ftest2 (a) bind (c, name="ftest2")
+ use iso_c_binding
+ use mm
+ type(m), pointer :: a(:,:)
+
+ if (associated (a)) stop 301
+end subroutine
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ end subroutine
+ end interface
+
+ type(m), target :: aa(imax,jmax)
+ integer :: i, j
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ ! Pass the initialized array to a C function ctest, which will use it
+ ! as the target of a pointer array with various bounds, calling
+ ! ftest1 and ftest2 to check that CFI_setpointer did the right thing.
+
+ call ctest (aa)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1-c.c
new file mode 100644
index 0000000..366ec2b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1-c.c
@@ -0,0 +1,87 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, CFI_cdesc_t *b);
+extern void ftest2 (CFI_cdesc_t *a, CFI_cdesc_t *b);
+
+struct m {
+ int i;
+ int j;
+};
+
+#define imax 10
+#define jmax 5
+
+void
+ctest (CFI_cdesc_t *a, CFI_cdesc_t *b)
+{
+ CFI_index_t i, j;
+ CFI_index_t s[2];
+ struct m *mpa, *mpb;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != imax)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != jmax)
+ abort ();
+
+ dump_CFI_cdesc_t (b);
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_other)
+ abort ();
+ if (b->dim[0].lower_bound != 0)
+ abort ();
+ if (b->dim[0].extent != jmax)
+ abort ();
+ if (b->dim[1].lower_bound != 0)
+ abort ();
+ if (b->dim[1].extent != imax)
+ abort ();
+
+ /* Call back into Fortran, passing both the a and b arrays. */
+ ftest2 (a, b);
+
+ /* Check that we got a valid b array back. */
+ dump_CFI_cdesc_t (b);
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_other)
+ abort ();
+ if (b->dim[0].lower_bound != 0)
+ abort ();
+ if (b->dim[0].extent != jmax)
+ abort ();
+ if (b->dim[1].lower_bound != 0)
+ abort ();
+ if (b->dim[1].extent != imax)
+ abort ();
+
+ for (j = 0; j < jmax; j++)
+ for (i = 0; i < imax; i++)
+ {
+ s[0] = i;
+ s[1] = j;
+ mpa = (struct m *) CFI_address (a, s);
+ s[0] = j;
+ s[1] = i;
+ mpb = (struct m *) CFI_address (b, s);
+ if (mpa->i != mpb->i)
+ abort ();
+ if (mpa->j != mpb->j)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1.f90
new file mode 100644
index 0000000..05fe26c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-1.f90
@@ -0,0 +1,174 @@
+! { dg-do run }
+! { dg-additional-sources "cf-out-descriptor-1-c.c dump-descriptors.c" }
+!
+! This program checks that calling a Fortran function with C binding and
+! an intent(out) argument works from both C and Fortran. For this
+! test case the argument is an assumed-shape array.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+! frob has regular Fortran binding. It transposes input array argument
+! a into the intent(out) argument b.
+
+subroutine frob (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m), intent(out) :: b(:,:)
+ integer :: i, j
+
+ if (lbound (a, 1) .ne. lbound (b, 2)) stop 101
+ if (lbound (a, 2) .ne. lbound (b, 1)) stop 102
+ if (ubound (a, 1) .ne. ubound (b, 2)) stop 103
+ if (ubound (a, 2) .ne. ubound (b, 1)) stop 104
+
+ do j = lbound (a, 2), ubound (a, 2)
+ do i = lbound (a, 1), ubound (a, 1)
+ b(j,i) = a(i,j)
+ end do
+ end do
+end subroutine
+
+! check also has regular Fortran binding, and two input arguments.
+
+subroutine check (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:), b(:,:)
+ integer :: i, j
+
+ if (lbound (a, 1) .ne. 1 .or. lbound (b, 2) .ne. 1) stop 101
+ if (lbound (a, 2) .ne. 1 .or. lbound (b, 1) .ne. 1) stop 102
+ if (ubound (a, 1) .ne. ubound (b, 2)) stop 103
+ if (ubound (a, 2) .ne. ubound (b, 1)) stop 104
+
+ do j = 1, ubound (a, 2)
+ do i = 1, ubound (a, 1)
+ if (b(j,i)%i .ne. a(i,j)%i) stop 105
+ if (b(j,i)%j .ne. a(i,j)%j) stop 106
+ end do
+ end do
+end subroutine
+
+! ftest1 has C binding and calls frob. This allows us to test intent(out)
+! arguments passed back from Fortran binding to a Fortran function with C
+! binding.
+
+subroutine ftest1 (a, b) bind (c, name="ftest1")
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m), intent(out) :: b(:,:)
+
+ interface
+ subroutine frob (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m), intent(out) :: b(:,:)
+ end subroutine
+ subroutine check (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:), b(:,:)
+ end subroutine
+ end interface
+
+ call frob (a, b)
+ call check (a, b)
+end subroutine
+
+! ftest2 has C binding and calls ftest1. This allows us to test intent(out)
+! arguments passed between two Fortran functions with C binding.
+
+subroutine ftest2 (a, b) bind (c, name="ftest2")
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m), intent(out) :: b(:,:)
+
+ interface
+ subroutine ftest1 (a, b) bind (c, name="ftest1")
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m), intent(out) :: b(:,:)
+ end subroutine
+ subroutine check (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:), b(:,:)
+ end subroutine
+ end interface
+
+ call ftest1 (a, b)
+ call check (a, b)
+end subroutine
+
+! main calls ftest2 directly and also indirectly from a C function ctest.
+! The former allows us to test intent(out) arguments passed back from a
+! Fortran routine with C binding to a regular Fortran routine, and the
+! latter tests passing them back from Fortran to C and C to Fortran.
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ftest2 (a, b) bind (c, name="ftest2")
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m), intent(out) :: b(:,:)
+ end subroutine
+ subroutine ctest (a, b) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m), intent(out) :: b(:,:)
+ end subroutine
+ subroutine check (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:), b(:,:)
+ end subroutine
+ end interface
+
+ type(m) :: aa(imax,jmax), bb(jmax,imax)
+ integer :: i, j
+
+ ! initialize
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ bb(j,i)%i = -1
+ bb(j,i)%j = -2
+ end do
+ end do
+
+ call ftest2 (aa, bb)
+ call check (aa, bb)
+
+ ! initialize again
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ bb(j,i)%i = -1
+ bb(j,i)%j = -2
+ end do
+ end do
+
+ call ctest (aa, bb)
+ call check (aa, bb)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2-c.c
new file mode 100644
index 0000000..366ec2b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2-c.c
@@ -0,0 +1,87 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, CFI_cdesc_t *b);
+extern void ftest2 (CFI_cdesc_t *a, CFI_cdesc_t *b);
+
+struct m {
+ int i;
+ int j;
+};
+
+#define imax 10
+#define jmax 5
+
+void
+ctest (CFI_cdesc_t *a, CFI_cdesc_t *b)
+{
+ CFI_index_t i, j;
+ CFI_index_t s[2];
+ struct m *mpa, *mpb;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != imax)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != jmax)
+ abort ();
+
+ dump_CFI_cdesc_t (b);
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_other)
+ abort ();
+ if (b->dim[0].lower_bound != 0)
+ abort ();
+ if (b->dim[0].extent != jmax)
+ abort ();
+ if (b->dim[1].lower_bound != 0)
+ abort ();
+ if (b->dim[1].extent != imax)
+ abort ();
+
+ /* Call back into Fortran, passing both the a and b arrays. */
+ ftest2 (a, b);
+
+ /* Check that we got a valid b array back. */
+ dump_CFI_cdesc_t (b);
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_other)
+ abort ();
+ if (b->dim[0].lower_bound != 0)
+ abort ();
+ if (b->dim[0].extent != jmax)
+ abort ();
+ if (b->dim[1].lower_bound != 0)
+ abort ();
+ if (b->dim[1].extent != imax)
+ abort ();
+
+ for (j = 0; j < jmax; j++)
+ for (i = 0; i < imax; i++)
+ {
+ s[0] = i;
+ s[1] = j;
+ mpa = (struct m *) CFI_address (a, s);
+ s[0] = j;
+ s[1] = i;
+ mpb = (struct m *) CFI_address (b, s);
+ if (mpa->i != mpb->i)
+ abort ();
+ if (mpa->j != mpb->j)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2.f90
new file mode 100644
index 0000000..3b166f4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-2.f90
@@ -0,0 +1,157 @@
+! { dg-do run }
+! { dg-additional-sources "cf-out-descriptor-2-c.c dump-descriptors.c" }
+!
+! This program checks that calling a Fortran function with C binding and
+! an intent(out) argument works from both C and Fortran. For this
+! test case the argument is an assumed-rank array.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+! The call chains we'll be testing will be
+! main -> ctest -> ftest1
+! main -> ftest2 -> ftest1
+! main -> ftest1
+! where everything has "c" binding except main.
+
+! ftest1 has C binding and transposes a into b.
+
+subroutine ftest1 (a, b) bind (c, name="ftest1")
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m), intent(out) :: b(..)
+
+ select rank (a)
+ rank (2)
+ select rank (b)
+ rank (2)
+ b = transpose (a)
+ rank default
+ stop 101
+ end select
+ rank default
+ stop 102
+ end select
+end subroutine
+
+! ftest2 has C binding and calls ftest1.
+
+subroutine ftest2 (a, b) bind (c, name="ftest2")
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m), intent(out) :: b(..)
+
+ interface
+ subroutine ftest1 (a, b) bind (c, name="ftest1")
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m), intent(out) :: b(..)
+ end subroutine
+ end interface
+
+ call ftest1 (a, b)
+ if (rank (a) .ne. 2) stop 201
+ if (rank (b) .ne. 2) stop 202
+end subroutine
+
+! main calls ftest2 directly and also indirectly from a C function ctest.
+! The former allows us to test intent(out) arguments passed back from a
+! Fortran routine with C binding to a regular Fortran routine, and the
+! latter tests passing them back from Fortran to C and C to Fortran.
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ftest1 (a, b) bind (c, name="ftest2")
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m), intent(out) :: b(..)
+ end subroutine
+ subroutine ftest2 (a, b) bind (c, name="ftest2")
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m), intent(out) :: b(..)
+ end subroutine
+ subroutine ctest (a, b) bind (c, name="ctest")
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m), intent(out) :: b(..)
+ end subroutine
+ end interface
+
+ type(m) :: aa(imax,jmax), bb(jmax,imax)
+ integer :: i, j
+
+ ! initialize
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ bb(j,i)%i = -1
+ bb(j,i)%j = -2
+ end do
+ end do
+
+ ! frob and check
+ call ftest1 (aa, bb)
+ do j = 1, jmax
+ do i = 1, imax
+ if (aa(i,j)%i .ne. bb(j,i)%i) stop 301
+ if (aa(i,j)%j .ne. bb(j,i)%j) stop 302
+ end do
+ end do
+
+ ! initialize again
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ bb(j,i)%i = -1
+ bb(j,i)%j = -2
+ end do
+ end do
+
+ ! frob and check
+ call ftest2 (aa, bb)
+ do j = 1, jmax
+ do i = 1, imax
+ if (aa(i,j)%i .ne. bb(j,i)%i) stop 401
+ if (aa(i,j)%j .ne. bb(j,i)%j) stop 402
+ end do
+ end do
+
+ ! initialize again
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ bb(j,i)%i = -1
+ bb(j,i)%j = -2
+ end do
+ end do
+
+ ! frob and check
+ call ctest (aa, bb)
+ do j = 1, jmax
+ do i = 1, imax
+ if (aa(i,j)%i .ne. bb(j,i)%i) stop 501
+ if (aa(i,j)%j .ne. bb(j,i)%j) stop 502
+ end do
+ end do
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3-c.c
new file mode 100644
index 0000000..b04293e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3-c.c
@@ -0,0 +1,108 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (int imagic, int jmagic);
+extern void frob (CFI_cdesc_t *a, CFI_cdesc_t *aa, CFI_cdesc_t *p);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (int imagic, int jmagic)
+{
+ CFI_CDESC_T(0) adesc;
+ CFI_CDESC_T(0) aadesc;
+ CFI_CDESC_T(0) bdesc;
+ CFI_cdesc_t *a = (CFI_cdesc_t *) &adesc;
+ CFI_cdesc_t *aa = (CFI_cdesc_t *) &aadesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+
+ /* Create and sanity-check descriptors. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (a, NULL, CFI_attribute_allocatable,
+ CFI_type_struct,
+ sizeof (struct m), 0, NULL));
+ dump_CFI_cdesc_t (a);
+ if (a->version != CFI_VERSION)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (aa, NULL, CFI_attribute_allocatable,
+ CFI_type_struct,
+ sizeof (struct m), 0, NULL));
+ dump_CFI_cdesc_t (aa);
+ if (aa->version != CFI_VERSION)
+ abort ();
+ if (aa->rank != 0)
+ abort ();
+ if (aa->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (aa->base_addr)
+ abort ();
+ if (aa->elem_len != sizeof (struct m))
+ abort ();
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (aa, NULL, NULL, 0));
+ ((struct m *)aa->base_addr)->i = 0;
+ ((struct m *)aa->base_addr)->j = 0;
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ sizeof (struct m), 0, NULL));
+ dump_CFI_cdesc_t (b);
+ if (b->version != CFI_VERSION)
+ abort ();
+ if (b->rank != 0)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+ if (b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+
+ /* Call back into Fortran, which will allocate and initialize the
+ objects. */
+ frob (a, aa, b);
+
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+ if (((struct m *)a->base_addr)->i != imagic)
+ abort ();
+ if (((struct m *)a->base_addr)->j != jmagic)
+ abort ();
+
+ if (!aa->base_addr)
+ abort ();
+ if (aa->elem_len != sizeof (struct m))
+ abort ();
+ if (((struct m *)aa->base_addr)->i != imagic)
+ abort ();
+ if (((struct m *)aa->base_addr)->j != jmagic)
+ abort ();
+
+ if (!b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+ if (((struct m *)b->base_addr)->i != imagic)
+ abort ();
+ if (((struct m *)b->base_addr)->j != jmagic)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3.f90
new file mode 100644
index 0000000..5e5f595
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-3.f90
@@ -0,0 +1,134 @@
+! PR 92621 (?)
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "cf-out-descriptor-3-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that calling a Fortran function with C binding and
+! an intent(out) argument works from both C and Fortran. For this
+! test case the argument is an allocatable or pointer scalar.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imagic=-1, jmagic=42
+
+end module
+
+! The call chains being tested here are
+! main -> frob
+! main -> ftest -> frob
+! main -> ctest -> frob
+! where everything other than main has C binding.
+
+! frob allocates and initializes its arguments.
+! There are two allocatable dummies so that we can pass both
+! unallocated (a) and allocated (aa).
+
+subroutine frob (a, aa, p) bind (c, name="frob")
+ use iso_c_binding
+ use mm
+ type(m), intent(out), allocatable :: a, aa
+ type(m), intent(out), pointer :: p
+
+ if (allocated (a)) stop 101
+ allocate (a)
+ a%i = imagic
+ a%j = jmagic
+
+ if (allocated (aa)) stop 102
+ allocate (aa)
+ aa%i = imagic
+ aa%j = jmagic
+
+ ! association status of p is undefined on entry
+ allocate (p)
+ p%i = imagic
+ p%j = jmagic
+end subroutine
+
+subroutine ftest () bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a, aa
+ type(m), pointer :: p
+
+ interface
+ subroutine frob (a, aa, p) bind (c, name="frob")
+ use iso_c_binding
+ use mm
+ type(m), intent(out), allocatable :: a, aa
+ type(m), intent(out), pointer :: p
+ end subroutine
+ end interface
+
+ p => NULL ()
+ allocate (aa)
+ aa%i = 0
+ aa%j = 0
+ call frob (a, aa, p)
+
+ if (.not. allocated (a)) stop 201
+ if (a%i .ne. imagic) stop 202
+ if (a%j .ne. jmagic) stop 203
+
+ if (.not. allocated (aa)) stop 204
+ if (a%i .ne. imagic) stop 205
+ if (a%j .ne. jmagic) stop 206
+
+ if (.not. associated (p)) stop 207
+ if (p%i .ne. imagic) stop 208
+ if (p%j .ne. jmagic) stop 209
+
+end subroutine
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine frob (a, aa, p) bind (c, name="frob")
+ use iso_c_binding
+ use mm
+ type(m), intent(out), allocatable :: a, aa
+ type(m), intent(out), pointer :: p
+ end subroutine
+ subroutine ftest () bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ end subroutine
+ subroutine ctest (ii, jj) bind (c, name="ctest")
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: ii, jj
+ end subroutine
+ end interface
+
+ type(m), allocatable :: a, aa
+ type(m), pointer :: p
+
+ p => NULL ()
+ allocate (aa)
+ aa%i = 0
+ aa%j = 0
+ call frob (a, aa, p)
+
+ if (.not. allocated (a)) stop 201
+ if (a%i .ne. imagic) stop 202
+ if (a%j .ne. jmagic) stop 203
+
+ if (.not. allocated (aa)) stop 204
+ if (a%i .ne. imagic) stop 205
+ if (a%j .ne. jmagic) stop 206
+
+ if (.not. associated (p)) stop 207
+ if (p%i .ne. imagic) stop 208
+ if (p%j .ne. jmagic) stop 209
+
+ call ftest
+ call ctest (imagic, jmagic)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4-c.c
new file mode 100644
index 0000000..bf5db6f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4-c.c
@@ -0,0 +1,175 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (int imax, int jmax);
+extern void frob (CFI_cdesc_t *a, CFI_cdesc_t *aa, CFI_cdesc_t *p);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (int imax, int jmax)
+{
+ CFI_CDESC_T(2) adesc;
+ CFI_CDESC_T(2) aadesc;
+ CFI_CDESC_T(2) bdesc;
+ CFI_cdesc_t *a = (CFI_cdesc_t *) &adesc;
+ CFI_cdesc_t *aa = (CFI_cdesc_t *) &aadesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ CFI_index_t i, j;
+ CFI_index_t s[2];
+ CFI_index_t lb[2], ub[2];
+ struct m* mp;
+
+ /* Create and sanity-check a. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (a, NULL, CFI_attribute_allocatable,
+ CFI_type_struct,
+ sizeof (struct m), 2, NULL));
+ dump_CFI_cdesc_t (a);
+ if (a->version != CFI_VERSION)
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (aa, NULL, CFI_attribute_allocatable,
+ CFI_type_struct,
+ sizeof (struct m), 2, NULL));
+ dump_CFI_cdesc_t (aa);
+ if (aa->version != CFI_VERSION)
+ abort ();
+ if (aa->rank != 2)
+ abort ();
+ if (aa->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (aa->base_addr)
+ abort ();
+ if (aa->elem_len != sizeof (struct m))
+ abort ();
+
+ /* aa is allocated/initialized so that we can confirm that it's
+ magically deallocated when passed as intent(out). */
+ lb[0] = 0;
+ lb[1] = 0;
+ ub[0] = jmax;
+ ub[1] = jmax;
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (aa, lb, ub, 0));
+ for (j = 1; j <= jmax; j++)
+ for (i = 1; i <= imax; i++)
+ {
+ s[0] = j;
+ s[1] = i;
+ mp = (struct m *)CFI_address (aa, s);
+ mp->i = 0;
+ mp->j = 0;
+ }
+
+ /* Likewise create and sanity-check b. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ sizeof (struct m), 2, NULL));
+ dump_CFI_cdesc_t (b);
+ if (b->version != CFI_VERSION)
+ abort ();
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+ if (b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+
+ /* Call back into Fortran, which will allocate and initialize the
+ objects. */
+ frob (a, aa, b);
+
+ dump_CFI_cdesc_t (a);
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof (struct m))
+ abort ();
+ if (a->dim[0].lower_bound != 1)
+ abort ();
+ if (a->dim[0].extent != imax)
+ abort ();
+ if (a->dim[1].lower_bound != 1)
+ abort ();
+ if (a->dim[1].extent != jmax)
+ abort ();
+ for (j = 1; j <= jmax; j++)
+ for (i = 1; i <= imax; i++)
+ {
+ s[0] = i;
+ s[1] = j;
+ mp = (struct m *)CFI_address (a, s);
+ if (mp->i != i)
+ abort ();
+ if (mp->j != j)
+ abort ();
+ }
+
+ dump_CFI_cdesc_t (aa);
+ if (!aa->base_addr)
+ abort ();
+ if (aa->elem_len != sizeof (struct m))
+ abort ();
+ if (aa->dim[0].lower_bound != 1)
+ abort ();
+ if (aa->dim[0].extent != imax)
+ abort ();
+ if (aa->dim[1].lower_bound != 1)
+ abort ();
+ if (aa->dim[1].extent != jmax)
+ abort ();
+ for (j = 1; j <= jmax; j++)
+ for (i = 1; i <= imax; i++)
+ {
+ s[0] = i;
+ s[1] = j;
+ mp = (struct m *)CFI_address (aa, s);
+ if (mp->i != i)
+ abort ();
+ if (mp->j != j)
+ abort ();
+ }
+
+ dump_CFI_cdesc_t (b);
+ if (!b->base_addr)
+ abort ();
+ if (b->elem_len != sizeof (struct m))
+ abort ();
+ if (b->dim[0].lower_bound != 1)
+ abort ();
+ if (b->dim[0].extent != jmax)
+ abort ();
+ if (b->dim[1].lower_bound != 1)
+ abort ();
+ if (b->dim[1].extent != imax)
+ abort ();
+ for (j = 1; j <= jmax; j++)
+ for (i = 1; i <= imax; i++)
+ {
+ s[0] = j;
+ s[1] = i;
+ mp = (struct m *)CFI_address (b, s);
+ if (mp->i != i)
+ abort ();
+ if (mp->j != j)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4.f90
new file mode 100644
index 0000000..082610c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-4.f90
@@ -0,0 +1,207 @@
+! PR 92621 (?)
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "cf-out-descriptor-4-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that calling a Fortran function with C binding and
+! an intent(out) argument works from both C and Fortran. For this
+! test case the argument is an allocatable or pointer array.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=5, jmax=10
+
+end module
+
+! The call chains being tested here are
+! main -> frob
+! main -> ftest -> frob
+! main -> ctest -> frob
+! where everything other than main has C binding.
+
+! frob allocates and initializes its arguments.
+! There are two allocatable dummies so that we can pass both
+! unallocated (a) and allocated (aa).
+
+subroutine frob (a, aa, p) bind (c, name="frob")
+ use iso_c_binding
+ use mm
+ type(m), intent(out), allocatable :: a(:,:), aa(:,:)
+ type(m), intent(out), pointer :: p(:,:)
+ integer :: i, j
+
+ if (allocated (a)) stop 101
+ allocate (a (imax, jmax))
+ do j = 1, jmax
+ do i = 1, imax
+ a(i,j)%i = i
+ a(i,j)%j = j
+ end do
+ end do
+
+ if (allocated (aa)) stop 102
+ allocate (aa (imax, jmax))
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ allocate (p (jmax, imax))
+ do j = 1, jmax
+ do i = 1, imax
+ p(j,i)%i = i
+ p(j,i)%j = j
+ end do
+ end do
+end subroutine
+
+subroutine ftest () bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:,:), aa(:,:)
+ type(m), pointer :: p(:,:)
+
+ integer :: i, j
+
+ interface
+ subroutine frob (a, aa, p) bind (c, name="frob")
+ use iso_c_binding
+ use mm
+ type(m), intent(out), allocatable :: a(:,:), aa(:,:)
+ type(m), intent(out), pointer :: p(:,:)
+ end subroutine
+ end interface
+
+ p => NULL ()
+ if (allocated (a) .or. allocated (aa)) stop 200
+ allocate (aa (jmax, imax))
+ do j = 1, jmax
+ do i = 1, imax
+ aa(j,i)%i = 0
+ aa(j,i)%j = 0
+ end do
+ end do
+ call frob (a, aa, p)
+
+ if (.not. allocated (a)) stop 201
+ if (lbound (a, 1) .ne. 1) stop 202
+ if (lbound (a, 2) .ne. 1) stop 203
+ if (ubound (a, 1) .ne. imax) stop 204
+ if (ubound (a, 2) .ne. jmax) stop 205
+ do j = 1, jmax
+ do i = 1, imax
+ if (a(i,j)%i .ne. i) stop 206
+ if (a(i,j)%j .ne. j) stop 207
+ end do
+ end do
+
+ if (.not. allocated (aa)) stop 211
+ if (lbound (aa, 1) .ne. 1) stop 212
+ if (lbound (aa, 2) .ne. 1) stop 213
+ if (ubound (aa, 1) .ne. imax) stop 214
+ if (ubound (aa, 2) .ne. jmax) stop 215
+ do j = 1, jmax
+ do i = 1, imax
+ if (aa(i,j)%i .ne. i) stop 216
+ if (aa(i,j)%j .ne. j) stop 217
+ end do
+ end do
+
+ if (.not. associated (p)) stop 221
+ if (lbound (p, 1) .ne. 1) stop 222
+ if (lbound (p, 2) .ne. 1) stop 223
+ if (ubound (p, 1) .ne. jmax) stop 224
+ if (ubound (p, 2) .ne. imax) stop 225
+ do j = 1, jmax
+ do i = 1, imax
+ if (p(j,i)%i .ne. i) stop 226
+ if (p(j,i)%j .ne. j) stop 227
+ end do
+ end do
+
+end subroutine
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine frob (a, aa, p) bind (c, name="frob")
+ use iso_c_binding
+ use mm
+ type(m), intent(out), allocatable :: a(:,:), aa(:,:)
+ type(m), intent(out), pointer :: p(:,:)
+ end subroutine
+ subroutine ftest () bind (c, name="ftest")
+ use iso_c_binding
+ use mm
+ end subroutine
+ subroutine ctest (ii, jj) bind (c, name="ctest")
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: ii, jj
+ end subroutine
+ end interface
+
+ type(m), allocatable :: a(:,:), aa(:,:)
+ type(m), pointer :: p(:,:)
+ integer :: i, j
+
+ p => NULL ()
+ if (allocated (a) .or. allocated (aa)) stop 300
+ allocate (aa (jmax, imax))
+ do j = 1, jmax
+ do i = 1, imax
+ aa(j,i)%i = 0
+ aa(j,i)%j = 0
+ end do
+ end do
+ call frob (a, aa, p)
+
+ if (.not. allocated (a)) stop 301
+ if (lbound (a, 1) .ne. 1) stop 302
+ if (lbound (a, 2) .ne. 1) stop 303
+ if (ubound (a, 1) .ne. imax) stop 304
+ if (ubound (a, 2) .ne. jmax) stop 305
+ do j = 1, jmax
+ do i = 1, imax
+ if (a(i,j)%i .ne. i) stop 306
+ if (a(i,j)%j .ne. j) stop 307
+ end do
+ end do
+
+ if (.not. allocated (aa)) stop 311
+ if (lbound (aa, 1) .ne. 1) stop 312
+ if (lbound (aa, 2) .ne. 1) stop 313
+ if (ubound (aa, 1) .ne. imax) stop 314
+ if (ubound (aa, 2) .ne. jmax) stop 315
+ do j = 1, jmax
+ do i = 1, imax
+ if (aa(i,j)%i .ne. i) stop 316
+ if (aa(i,j)%j .ne. j) stop 317
+ end do
+ end do
+
+ if (.not. associated (p)) stop 321
+ if (lbound (p, 1) .ne. 1) stop 322
+ if (lbound (p, 2) .ne. 1) stop 323
+ if (ubound (p, 1) .ne. jmax) stop 324
+ if (ubound (p, 2) .ne. imax) stop 325
+ do j = 1, jmax
+ do i = 1, imax
+ if (p(j,i)%i .ne. i) stop 326
+ if (p(j,i)%j .ne. j) stop 327
+ end do
+ end do
+
+ call ftest
+ call ctest (imax, jmax)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5-c.c
new file mode 100644
index 0000000..e5b37f3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5-c.c
@@ -0,0 +1,31 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, int n);
+extern void ftest (CFI_cdesc_t *a, int n);
+
+void
+ctest (CFI_cdesc_t *a, int n)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* The actual argument object on the Fortran side has length n and
+ was passed as character(len=*).
+ Make sure that matches what's in the descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != n)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (a->type != CFI_type_char)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ ftest (a, n);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5.f90
new file mode 100644
index 0000000..ff1e31d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-5.f90
@@ -0,0 +1,48 @@
+! PR92482
+! { dg-do run }
+! { dg-additional-sources "cf-out-descriptor-5-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks use of an assumed-length character dummy argument
+! as an intent(out) parameter in subroutines with C binding.
+
+subroutine ftest (a, n) bind (c, name="ftest") ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(kind=C_CHAR, len=*), intent(out) :: a
+ integer(C_INT), value :: n
+
+ if (len (a) .ne. n) stop 101
+ a = 'abcdefghijklmnopqrstuvwxyz'
+end subroutine
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a, n) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(kind=C_CHAR, len=*), intent(out) :: a
+ integer(C_INT), value :: n
+ end subroutine
+
+ subroutine ftest (a, n) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(kind=C_CHAR, len=*), intent(out) :: a
+ integer(C_INT), value :: n
+ end subroutine
+ end interface
+
+ character(kind=C_CHAR, len=42) :: aa
+
+ ! call ftest directly
+ aa = '12345678910'
+ call ftest (aa, 42)
+ print *, aa
+
+ ! ctest calls ftest indirectly
+ aa = '12345678910'
+ call ctest (aa, 42)
+ print *, aa
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6-c.c
new file mode 100644
index 0000000..f8724b9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6-c.c
@@ -0,0 +1,42 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, int n);
+extern void ftest (CFI_cdesc_t *a, int n);
+
+void
+ctest (CFI_cdesc_t *a, int n)
+{
+ int i;
+ CFI_index_t s[1];
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != -1)
+ abort ();
+
+ ftest (a, n);
+
+ for (i = 0; i < n; i++)
+ {
+ s[0] = i;
+ if (*((int *)CFI_address (a, s)) != i + 1)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6.f90 b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6.f90
new file mode 100644
index 0000000..b1a8c53
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/cf-out-descriptor-6.f90
@@ -0,0 +1,115 @@
+! Reported as pr94070.
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "cf-out-descriptor-6-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks passing an assumed-size array as an intent(out)
+! argument to a bind (c) Fortran function from both C and Fortran.
+
+! Assumed-size arrays are not passed by descriptor. What we'll do
+! for this test function is pass the assumed-size array as the actual
+! argument corresponding to an assumed-rank dummy. This is supposed to
+! fill in the descriptor with information about the array present at
+! the call site.
+
+subroutine ftest (a, n) bind (c, name="ftest")
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(..)
+ integer(C_INT), value :: n
+ integer :: i
+
+ ! TS 29113
+ ! 6.4.2 SIZE
+ ! (1) for an assumed-rank object that is associated with an
+ ! assumed-size array, the result has the value −1 if DIM is
+ ! present and equal to the rank of ARRAY
+ if (rank (a) .ne. 1) stop 102
+ if (size (a, rank (a)) .ne. -1) stop 100
+ if (lbound (a, rank (a)) .ne. 1) stop 101
+
+ select rank (a)
+ rank (*)
+ do i = 1, n
+ a(i) = i
+ end do
+ rank default
+ stop 102
+ end select
+end subroutine
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a, n) bind (c, name="ctest")
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(..)
+ integer(C_INT), value :: n
+ end subroutine
+ subroutine ftest (a, n) bind (c, name="ftest")
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(..)
+ integer(C_INT), value :: n
+ end subroutine
+ end interface
+
+ integer(C_INT), target :: aa(10)
+
+ ! To get an assumed-size array descriptor, we have to first pass the
+ ! fixed-size array to a Fortran function with an assumed-size dummy,
+ call ftest1 (aa, 10) ! calls ftest
+ call ftest2 (aa, 10) ! has c binding, calls ftest
+ call ftest3 (aa, 10) ! calls ctest -> ftest
+ call ftest4 (aa, 10) ! has c binding, calls ctest -> ftest
+
+contains
+
+ subroutine ftest1 (a, n)
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(*)
+ integer(C_INT), value :: n
+ integer :: i
+ a(1:n) = 0
+ call ftest (a, n)
+ do i = 1, n
+ if (a (i) .ne. i) stop 200
+ end do
+ end subroutine
+
+ subroutine ftest2 (a, n) bind (c)
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(*)
+ integer(C_INT), value :: n
+ integer :: i
+ a(1:n) = 0
+ call ftest (a, n)
+ do i = 1, n
+ if (a (i) .ne. i) stop 201
+ end do
+ end subroutine
+
+ subroutine ftest3 (a, n)
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(*)
+ integer(C_INT), value :: n
+ integer :: i
+ a(1:n) = 0
+ call ctest (a, n)
+ do i = 1, n
+ if (a (i) .ne. i) stop 202
+ end do
+ end subroutine
+
+ subroutine ftest4 (a, n) bind (c)
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(*)
+ integer(C_INT), value :: n
+ integer :: i
+ a(1:n) = 0
+ call ctest (a, n)
+ do i = 1, n
+ if (a (i) .ne. i) stop 203
+ end do
+ end subroutine
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/contiguous-1-c.c b/gcc/testsuite/gfortran.dg/c-interop/contiguous-1-c.c
new file mode 100644
index 0000000..6b30da4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/contiguous-1-c.c
@@ -0,0 +1,56 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest1 (CFI_cdesc_t *a);
+extern void ctest2 (CFI_cdesc_t *a);
+
+static void
+ctest (CFI_cdesc_t *a)
+{
+ int i;
+ int *p;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* Make sure we got a valid descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].sm != sizeof(int))
+ abort ();
+ if (!CFI_is_contiguous (a))
+ abort ();
+
+ /* Negate the elements of the array. */
+ p = (int *)a->base_addr;
+ for (i = 0; i < a->dim[0].extent; i++)
+ p[i] = -p[i];
+}
+
+
+/* The two entry points are declared differently on the C side, but both
+ should do the same thing. */
+
+void
+ctest1 (CFI_cdesc_t *a)
+{
+ ctest (a);
+}
+
+void
+ctest2 (CFI_cdesc_t *a)
+{
+ ctest (a);
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/contiguous-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/contiguous-1.f90
new file mode 100644
index 0000000..fe1c982
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/contiguous-1.f90
@@ -0,0 +1,67 @@
+! { dg-do run }
+! { dg-additional-sources "contiguous-1-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! TS 29113
+! 8.7 In an invocation of an interoperable procedure whose Fortran
+! interface has an assumed-shape or assumed-rank dummy argument with the
+! CONTIGUOUS attribute, the associated effective argument may be an
+! array that is not contiguous or the address of a C descriptor for such
+! an array. If the procedure is invoked from Fortran or the procedure is
+! a Fortran procedure, the Fortran processor will handle the difference
+! in contiguity. If the procedure is invoked from C and the procedure is
+! a C procedure, the C code within the procedure shall be prepared to
+! handle the situation of receiving a discontiguous argument.
+!
+! This program tests the cases where Fortran code passes a non-contiguous
+! array section to a C function whose interface has the contiguous
+! attribute.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ ! ctest1 and ctest2 both negate the elements of their input array.
+ subroutine ctest1 (a) bind (c)
+ use iso_c_binding
+ integer(C_INT), contiguous :: a(:)
+ end subroutine
+ subroutine ctest2 (a) bind (c)
+ use iso_c_binding
+ integer(C_INT), contiguous :: a(..)
+ end subroutine
+ end interface
+
+ integer(C_INT) :: aa(32)
+ integer :: i
+
+ ! assumed-shape
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ctest1 (aa(4:12:2))
+ do i = 1, 32
+ if (i .ge. 4 .and. i .le. 12 .and. mod (i-4,2) .eq. 0) then
+ if (aa (i) .ne. -i) stop 101
+ else
+ if (aa (i) .ne. i) stop 102
+ end if
+ end do
+
+ ! assumed-rank
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ctest2 (aa(7:19:3))
+ do i = 1, 32
+ if (i .ge. 7 .and. i .le. 19 .and. mod (i-7,3) .eq. 0) then
+ if (aa (i) .ne. -i) stop 201
+ else
+ if (aa (i) .ne. i) stop 202
+ end if
+ end do
+
+end program
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/contiguous-2-c.c b/gcc/testsuite/gfortran.dg/c-interop/contiguous-2-c.c
new file mode 100644
index 0000000..5a8f3d6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/contiguous-2-c.c
@@ -0,0 +1,113 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest1 (CFI_cdesc_t *a);
+extern void ctest2 (CFI_cdesc_t *a);
+extern void ftest1 (CFI_cdesc_t *a, int first, int last, int step);
+extern void ftest2 (CFI_cdesc_t *a, int first, int last, int step);
+
+#if 0
+static void
+dump_array (CFI_cdesc_t *a, const char *name, const char *note)
+{
+ int i;
+
+ fprintf (stderr, "%s\n", note);
+ for (i = 0; i < a->dim[0].extent; i++)
+ {
+ int j = i + a->dim[0].lower_bound;
+ int elt;
+ CFI_index_t sub[1];
+ sub[0] = j;
+ elt = *((int *) CFI_address (a, sub));
+ fprintf (stderr, "%s[%d] = %d\n", name, j, elt);
+ }
+ fprintf (stderr, "\n");
+}
+#else
+#define dump_array(a, name, note)
+#endif
+
+static void
+ctest (CFI_cdesc_t *a, int lb, int ub, int s,
+ void (*fn) (CFI_cdesc_t *, int, int, int))
+{
+ CFI_CDESC_T(1) bdesc;
+ CFI_cdesc_t *b = (CFI_cdesc_t *) &bdesc;
+ CFI_index_t lb_array[1], ub_array[1], s_array[1];
+ int i;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* Make sure we got a valid descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+
+ /* Create an array section and pass it to fn. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (b, NULL, CFI_attribute_other,
+ CFI_type_int,
+ sizeof (int), 1, NULL));
+ lb_array[0] = lb - 1 + a->dim[0].lower_bound;
+ ub_array[0] = ub - 1 + a->dim[0].lower_bound;
+ s_array[0] = s;
+ check_CFI_status ("CFI_section",
+ CFI_section (b, a, lb_array, ub_array, s_array));
+ dump_CFI_cdesc_t (b);
+ dump_array (b, "b", "b after CFI_section");
+
+ /* Pass it to the Fortran function fn. */
+ if (CFI_is_contiguous (b))
+ abort ();
+ (*fn) (b, lb, ub, s);
+ dump_CFI_cdesc_t (b);
+ dump_array (b, "b", "b after calling Fortran fn");
+
+ /* fn is supposed to negate the elements of the array section it
+ receives. Check that the original array has been updated. */
+ dump_array (a, "a", "a after calling Fortran fn");
+ for (i = 0; i < a->dim[0].extent; i++)
+ {
+ int elt;
+ int j = i + a->dim[0].lower_bound;
+ CFI_index_t sub[1];
+ sub[0] = j;
+ elt = *((int *) CFI_address (a, sub));
+ if (i + 1 >= lb && i + 1 <= ub && (i + 1 - lb) % s == 0)
+ {
+ if (elt != - (i + 1))
+ abort ();
+ }
+ else if (elt != (i + 1))
+ abort ();
+ }
+}
+
+
+/* Entry points for the Fortran side. */
+
+void
+ctest1 (CFI_cdesc_t *a)
+{
+ ctest (a, 5, 13, 2, ftest1);
+}
+
+void
+ctest2 (CFI_cdesc_t *a)
+{
+ ctest (a, 8, 20, 3, ftest2);
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/contiguous-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/contiguous-2.f90
new file mode 100644
index 0000000..bb8ba20
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/contiguous-2.f90
@@ -0,0 +1,152 @@
+! PR 101304
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "contiguous-2-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! TS 29113
+! 8.7 In an invocation of an interoperable procedure whose Fortran
+! interface has an assumed-shape or assumed-rank dummy argument with the
+! CONTIGUOUS attribute, the associated effective argument may be an
+! array that is not contiguous or the address of a C descriptor for such
+! an array. If the procedure is invoked from Fortran or the procedure is
+! a Fortran procedure, the Fortran processor will handle the difference
+! in contiguity. If the procedure is invoked from C and the procedure is
+! a C procedure, the C code within the procedure shall be prepared to
+! handle the situation of receiving a discontiguous argument.
+!
+! The wording is different in the 2018 standard, but the intent is more
+! or less the same:
+!
+! When an interoperable Fortran procedure that is invoked from C has a
+! dummy argument with the CONTIGUOUS attribute or that is an assumed-length
+! CHARACTER explicit-shape or assumed-size array, and the actual argument
+! is the address of a C descriptor for a discontiguous object, the Fortran
+! processor shall handle the difference in contiguity.
+!
+! This program tests the cases where a Fortran procedure with C binding and
+! a dummy array argument with the contiguous attribute is invoked from
+! both C or Fortran.
+
+! ftest1 and ftest2 both negate the elements of their input array;
+! this allows testing that modifications to the array contents get
+! propagated back to the base array.
+
+module m
+
+ contains
+
+ subroutine ftest1 (a, first, last, step) bind (c)
+ use iso_c_binding
+ integer(C_INT), contiguous :: a(:)
+ integer(C_INT), value :: first, last, step
+ integer :: i, ival
+
+ ! Sanity checking that we got a contiguous array. The direct call
+ ! to is_contiguous might be optimized away, but the indirect one
+ ! in check_contiguous shouldn't be.
+ ! FIXME: is this correct? "the Fortran processor will handle the
+ ! difference in contiguity" may not mean that it's required to make
+ ! the array contiguous, just that it can access it correctly?
+ if (.not. is_contiguous (a)) stop 301
+ call check_contiguous (a)
+
+ ! Sanity checking that we got the right input array contents.
+ ! print *, 'a on entry to ftest1'
+ ! do i = lbound(a, 1), ubound(a, 1)
+ ! print *, 'a(', i, ') = ', a(i)
+ ! end do
+ ival = first
+ do i = lbound(a, 1), ubound(a, 1)
+ if (a (i) .ne. ival) then
+ print *, 'a(', i, ') = ', a(i), ' expected ', ival
+ stop 302
+ end if
+ a(i) = - a(i)
+ ival = ival + step
+ end do
+ end subroutine
+
+ subroutine ftest2 (a, first, last, step) bind (c)
+ use iso_c_binding
+
+ integer(C_INT), contiguous :: a(..)
+ integer(C_INT), value :: first, last, step
+
+ select rank (a)
+ rank (1)
+ call ftest1 (a(:), first, last, step)
+ rank default
+ stop 303
+ end select
+ end subroutine
+
+ subroutine check_contiguous (a)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ if (.not. is_contiguous (a)) stop 304
+ end subroutine
+
+end module
+
+
+program testit
+ use iso_c_binding
+ use m
+ implicit none
+
+ interface
+ subroutine ctest1 (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(:)
+ end subroutine
+ subroutine ctest2 (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ end subroutine
+ end interface
+
+ integer(C_INT) :: aa(32)
+ integer :: i
+
+ ! assumed-shape, called from Fortran
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ftest1 (aa(4:12:2), 4, 12, 2)
+ do i = 1, 32
+ if (i .ge. 4 .and. i .le. 12 .and. mod (i-4,2) .eq. 0) then
+ if (aa (i) .ne. -i) stop 101
+ else
+ if (aa (i) .ne. i) stop 102
+ end if
+ end do
+
+ ! assumed-shape, called from C code which will use the C interface
+ ! to create a non-contiguous array section and pass it to ftest1.
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ctest1 (aa)
+
+ ! assumed-rank, called from Fortran
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ftest2 (aa(7:19:3), 7, 19, 3)
+ do i = 1, 32
+ if (i .ge. 7 .and. i .le. 19 .and. mod (i-7,3) .eq. 0) then
+ if (aa (i) .ne. -i) stop 201
+ else
+ if (aa (i) .ne. i) stop 202
+ end if
+ end do
+
+ ! assumed-rank, called from C code which will use the C interface
+ ! to create a non-contiguous array section and pass it to ftest2.
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ctest2 (aa)
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/contiguous-3-c.c b/gcc/testsuite/gfortran.dg/c-interop/contiguous-3-c.c
new file mode 100644
index 0000000..b124476
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/contiguous-3-c.c
@@ -0,0 +1,80 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest1 (CFI_cdesc_t *a, int first, int last, int step);
+extern void ctest2 (CFI_cdesc_t *a, int first, int last, int step);
+extern void ftest1 (CFI_cdesc_t *a, int first, int last, int step);
+extern void ftest2 (CFI_cdesc_t *a, int first, int last, int step);
+
+#if 0
+static void
+dump_array (CFI_cdesc_t *a, const char *name, const char *note)
+{
+ int i;
+
+ fprintf (stderr, "%s\n", note);
+ for (i = 0; i < a->dim[0].extent; i++)
+ {
+ int j = i + a->dim[0].lower_bound;
+ int elt;
+ CFI_index_t sub[1];
+ sub[0] = j;
+ elt = *((int *) CFI_address (a, sub));
+ fprintf (stderr, "%s[%d] = %d\n", name, j, elt);
+ }
+ fprintf (stderr, "\n");
+}
+#else
+#define dump_array(a, name, note)
+#endif
+
+static void
+ctest (CFI_cdesc_t *a, int first, int last, int step,
+ void (*fn) (CFI_cdesc_t *, int, int, int))
+{
+ int i;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+ dump_array (a, "a", "a on input to ctest");
+
+ /* Make sure we got a valid descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+
+ /* Pass it to the Fortran function fn. */
+ (*fn) (a, first, last, step);
+ dump_CFI_cdesc_t (a);
+ dump_array (a, "a", "a after calling Fortran fn");
+}
+
+/* Entry points for the Fortran side.
+ Note that the Fortran code has already created the array section
+ and these functions were declared without the CONTIGUOUS attribute
+ so they receive a non-contiguous array. The magic is supposed to
+ happen when we pass them back into a Fortran function declared with
+ the CONTIGUOUS attribute. */
+
+void
+ctest1 (CFI_cdesc_t *a, int first, int last, int step)
+{
+ ctest (a, first, last, step, ftest1);
+}
+
+void
+ctest2 (CFI_cdesc_t *a, int first, int last, int step)
+{
+ ctest (a, first, last, step, ftest2);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/contiguous-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/contiguous-3.f90
new file mode 100644
index 0000000..9a6d66b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/contiguous-3.f90
@@ -0,0 +1,171 @@
+! PR 101304
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "contiguous-3-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! TS 29113
+! 8.7 In an invocation of an interoperable procedure whose Fortran
+! interface has an assumed-shape or assumed-rank dummy argument with the
+! CONTIGUOUS attribute, the associated effective argument may be an
+! array that is not contiguous or the address of a C descriptor for such
+! an array. If the procedure is invoked from Fortran or the procedure is
+! a Fortran procedure, the Fortran processor will handle the difference
+! in contiguity. If the procedure is invoked from C and the procedure is
+! a C procedure, the C code within the procedure shall be prepared to
+! handle the situation of receiving a discontiguous argument.
+!
+! The wording is different in the 2018 standard, but the intent is more
+! or less the same:
+!
+! When an interoperable Fortran procedure that is invoked from C has a
+! dummy argument with the CONTIGUOUS attribute or that is an assumed-length
+! CHARACTER explicit-shape or assumed-size array, and the actual argument
+! is the address of a C descriptor for a discontiguous object, the Fortran
+! processor shall handle the difference in contiguity.
+!
+! This program tests the cases where a Fortran procedure with C binding and
+! a dummy array argument with the contiguous attribute is invoked from
+! both C or Fortran. It is similar to contiguous-2.f90 but here the array
+! sections are created in Fortran even in the called-from-C case, rather
+! than by calling CFI_section.
+
+! ftest1 and ftest2 both negate the elements of their input array;
+! this allows testing that modifications to the array contents get
+! propagated back to the base array.
+
+module m
+
+ contains
+
+ subroutine ftest1 (a, first, last, step) bind (c)
+ use iso_c_binding
+ integer(C_INT), contiguous :: a(:)
+ integer(C_INT), value :: first, last, step
+ integer :: i, ival
+
+ ! Sanity checking that we got a contiguous array. The direct call
+ ! to is_contiguous might be optimized away, but the indirect one
+ ! in check_contiguous shouldn't be.
+ ! FIXME: is this correct? "the Fortran processor will handle the
+ ! difference in contiguity" may not mean that it's required to make
+ ! the array contiguous, just that it can access it correctly?
+ if (.not. is_contiguous (a)) stop 301
+ call check_contiguous (a)
+
+ ! Sanity checking that we got the right input array contents.
+ ! print *, 'a on entry to ftest1'
+ ! do i = lbound(a, 1), ubound(a, 1)
+ ! print *, 'a(', i, ') = ', a(i)
+ ! end do
+ ival = first
+ do i = lbound(a, 1), ubound(a, 1)
+ if (a (i) .ne. ival) then
+ print *, 'a(', i, ') = ', a(i), ' expected ', ival
+ stop 302
+ end if
+ a(i) = - a(i)
+ ival = ival + step
+ end do
+ end subroutine
+
+ subroutine ftest2 (a, first, last, step) bind (c)
+ use iso_c_binding
+
+ integer(C_INT), contiguous :: a(..)
+ integer(C_INT), value :: first, last, step
+
+ select rank (a)
+ rank (1)
+ call ftest1 (a(:), first, last, step)
+ rank default
+ stop 303
+ end select
+ end subroutine
+
+ subroutine check_contiguous (a)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ if (.not. is_contiguous (a)) stop 304
+ end subroutine
+
+end module
+
+
+program testit
+ use iso_c_binding
+ use m
+ implicit none
+
+ ! Note ctest1 and ctest2 do not have the contiguous attribute on a.
+ interface
+ subroutine ctest1 (a, first, last, step) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(:)
+ integer(C_INT), value :: first, last, step
+ end subroutine
+ subroutine ctest2 (a, first, last, step) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ integer(C_INT), value :: first, last, step
+ end subroutine
+ end interface
+
+ integer(C_INT) :: aa(32)
+ integer :: i
+
+ ! assumed-shape, called from Fortran
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ftest1 (aa(4:12:2), 4, 12, 2)
+ do i = 1, 32
+ if (i .ge. 4 .and. i .le. 12 .and. mod (i-4,2) .eq. 0) then
+ if (aa (i) .ne. -i) stop 101
+ else
+ if (aa (i) .ne. i) stop 102
+ end if
+ end do
+
+ ! assumed-shape, called indirectly from C code, using an array
+ ! section created in Fortran instead of by CFI_section
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ctest1 (aa(5:13:2), 5, 13, 2)
+ do i = 1, 32
+ if (i .ge. 5 .and. i .le. 13 .and. mod (i-5,2) .eq. 0) then
+ if (aa (i) .ne. -i) stop 103
+ else
+ if (aa (i) .ne. i) stop 104
+ end if
+ end do
+
+ ! assumed-rank, called from Fortran
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ftest2 (aa(7:19:3), 7, 19, 3)
+ do i = 1, 32
+ if (i .ge. 7 .and. i .le. 19 .and. mod (i-7,3) .eq. 0) then
+ if (aa (i) .ne. -i) stop 201
+ else
+ if (aa (i) .ne. i) stop 202
+ end if
+ end do
+
+ ! assumed-rank, called indirectly from C code, using an array
+ ! section created in Fortran instead of by CFI_section
+ do i = 1, 32
+ aa(i) = i
+ end do
+ call ctest2 (aa(8:20:3), 8, 20, 3)
+ do i = 1, 32
+ if (i .ge. 8 .and. i .le. 20 .and. mod (i-8,3) .eq. 0) then
+ if (aa (i) .ne. -i) stop 203
+ else
+ if (aa (i) .ne. i) stop 204
+ end if
+ end do
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/deferred-character-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/deferred-character-1.f90
new file mode 100644
index 0000000..bd6d9cb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/deferred-character-1.f90
@@ -0,0 +1,76 @@
+! PR92482
+! { dg-do compile}
+!
+! TS 29113
+! 8.7 Interoperability of procedures and procedure interfaces
+!
+! If a dummy argument in an interoperable interface is of type
+! CHARACTER and is allocatable or a pointer, its character length shall
+! be deferred.
+!
+! This test checks that this error is diagnosed and is supposed to fail.
+
+module m
+ use iso_c_binding
+
+ interface
+
+ ! These are supposed to be OK
+ subroutine good1 (x, n) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character (kind=C_CHAR, len=:), allocatable :: x
+ integer(C_INT), value :: n
+ end subroutine
+ subroutine good2 (x, n) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character (kind=C_CHAR, len=:), pointer :: x
+ integer(C_INT), value :: n
+ end subroutine
+
+ ! These are supposed to fail.
+ subroutine bad1 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR, len=*), allocatable :: x
+ integer(C_INT), value :: n
+ end subroutine
+ subroutine bad2 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR, len=*), pointer :: x
+ integer(C_INT), value :: n
+ end subroutine
+
+ subroutine bad3 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR, len=80), allocatable :: x
+ integer(C_INT), value :: n
+ end subroutine
+ subroutine bad4 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR, len=80), pointer :: x
+ integer(C_INT), value :: n
+ end subroutine
+
+ subroutine bad5 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR, len=1), allocatable :: x
+ integer(C_INT), value :: n
+ end subroutine
+ subroutine bad6 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR, len=1), pointer :: x
+ integer(C_INT), value :: n
+ end subroutine
+
+ subroutine bad7 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR), allocatable :: x
+ integer(C_INT), value :: n
+ end subroutine
+ subroutine bad8 (x, n) bind (c) ! { dg-error "must have deferred length" }
+ use iso_c_binding
+ character (kind=C_CHAR), pointer :: x
+ integer(C_INT), value :: n
+ end subroutine
+ end interface
+
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f90
new file mode 100644
index 0000000..9fd046d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f90
@@ -0,0 +1,55 @@
+! PR 92482
+! { dg-do execute}
+!
+! TS 29113
+! 8.7 Interoperability of procedures and procedure interfaces
+!
+! If a dummy argument in an interoperable interface is of type
+! CHARACTER and is allocatable or a pointer, its character length shall
+! be deferred.
+
+program testit
+ use iso_c_binding
+
+ character (kind=C_CHAR, len=:), allocatable :: aa
+ character (kind=C_CHAR, len=:), pointer :: pp
+
+
+ pp => NULL ()
+
+ call frobf (aa, pp)
+ if (.not. allocated (aa)) stop 101
+ if (aa .ne. 'foo') stop 102
+ if (.not. associated (pp)) stop 103
+ if (pp .ne. 'bar') stop 104
+
+ pp => NULL ()
+
+ call frobc (aa, pp)
+ if (.not. allocated (aa)) stop 101
+ if (aa .ne. 'frog') stop 102
+ if (.not. associated (pp)) stop 103
+ if (pp .ne. 'toad') stop 104
+
+
+ contains
+
+ subroutine frobf (a, p)
+ use iso_c_binding
+ character (kind=C_CHAR, len=:), allocatable :: a
+ character (kind=C_CHAR, len=:), pointer :: p
+ allocate (character(len=3) :: p)
+ a = 'foo'
+ p = 'bar'
+ end subroutine
+
+ subroutine frobc (a, p) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character (kind=C_CHAR, len=:), allocatable :: a
+ character (kind=C_CHAR, len=:), pointer :: p
+ allocate (character(len=4) :: p)
+ a = 'frog'
+ p = 'toad'
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.c b/gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.c
new file mode 100644
index 0000000..47e84e2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.c
@@ -0,0 +1,195 @@
+/* This file contains some useful routines for debugging problems with C
+ descriptors. Compiling it also acts as a test that the implementation of
+ ISO_Fortran_binding.h provides all the types and constants specified in
+ TS29113. */
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include "dump-descriptors.h"
+
+void
+dump_CFI_cdesc_t (CFI_cdesc_t *d)
+{
+ fprintf (stderr, "<CFI_cdesc_t base_addr=%p elem_len=%ld version=%d",
+ d->base_addr, (long)(d->elem_len), d->version);
+ fprintf (stderr, "\n rank=");
+ dump_CFI_rank_t (d->rank);
+ fprintf (stderr, " type=");
+ dump_CFI_type_t (d->type);
+ fprintf (stderr, " attribute=");
+ dump_CFI_attribute_t (d->attribute);
+
+ /* Dimension info may not be initialized if it's an allocatable
+ or pointer descriptor with a null base_addr. */
+ if (d->rank > 0 && d->base_addr)
+ {
+ CFI_rank_t i;
+ for (i = 0; i < d->rank; i++)
+ {
+ if (i == 0)
+ fprintf (stderr, "\n dim=[");
+ else
+ fprintf (stderr, ",\n ");
+ dump_CFI_dim_t (d->dim + i);
+ }
+ fprintf (stderr, "]");
+ }
+ fprintf (stderr, ">\n");
+}
+
+void
+dump_CFI_dim_t (CFI_dim_t *d)
+{
+ fprintf (stderr, "<CFI_dim_t lower_bound=");
+ dump_CFI_index_t (d->lower_bound);
+ fprintf (stderr, " extent=");
+ dump_CFI_index_t (d->extent);
+ fprintf (stderr, " sm=");
+ dump_CFI_index_t (d->sm);
+ fprintf (stderr, ">");
+}
+
+void
+dump_CFI_attribute_t (CFI_attribute_t a)
+{
+ switch (a)
+ {
+ case CFI_attribute_pointer:
+ fprintf (stderr, "CFI_attribute_pointer");
+ break;
+ case CFI_attribute_allocatable:
+ fprintf (stderr, "CFI_attribute_allocatable");
+ break;
+ case CFI_attribute_other:
+ fprintf (stderr, "CFI_attribute_other");
+ break;
+ default:
+ fprintf (stderr, "unknown(%d)", (int)a);
+ break;
+ }
+}
+
+void
+dump_CFI_index_t (CFI_index_t i)
+{
+ fprintf (stderr, "%ld", (long)i);
+}
+
+void
+dump_CFI_rank_t (CFI_rank_t r)
+{
+ fprintf (stderr, "%d", (int)r);
+}
+
+/* We can't use a switch statement to dispatch CFI_type_t because
+ the type name macros may not be unique. Iterate over a table
+ instead. */
+
+struct type_name_map {
+ CFI_type_t t;
+ const char *n;
+};
+
+struct type_name_map type_names[] =
+{
+ { CFI_type_signed_char, "CFI_type_signed_char" },
+ { CFI_type_short, "CFI_type_short" },
+ { CFI_type_int, "CFI_type_int" },
+ { CFI_type_long, "CFI_type_long" },
+ { CFI_type_long_long, "CFI_type_long_long" },
+ { CFI_type_size_t, "CFI_type_size_t" },
+ { CFI_type_int8_t, "CFI_type_int8_t" },
+ { CFI_type_int16_t, "CFI_type_int16_t" },
+ { CFI_type_int32_t, "CFI_type_int32_t" },
+ { CFI_type_int64_t, "CFI_type_int64_t" },
+ { CFI_type_int_least8_t, "CFI_type_int_least8_t" },
+ { CFI_type_int_least16_t, "CFI_type_int_least16_t" },
+ { CFI_type_int_least32_t, "CFI_type_int_least32_t" },
+ { CFI_type_int_least64_t, "CFI_type_int_least64_t" },
+ { CFI_type_int_fast8_t, "CFI_type_int_fast8_t" },
+ { CFI_type_int_fast16_t, "CFI_type_int_fast16_t" },
+ { CFI_type_int_fast32_t, "CFI_type_int_fast32_t" },
+ { CFI_type_int_fast64_t, "CFI_type_int_fast64_t" },
+ { CFI_type_intmax_t, "CFI_type_intmax_t" },
+ { CFI_type_intptr_t, "CFI_type_intptr_t" },
+ { CFI_type_ptrdiff_t, "CFI_type_ptrdiff_t" },
+ { CFI_type_float, "CFI_type_float" },
+ { CFI_type_double, "CFI_type_double" },
+ { CFI_type_long_double, "CFI_type_long_double" },
+ { CFI_type_float_Complex, "CFI_type_float_Complex" },
+ { CFI_type_double_Complex, "CFI_type_double_Complex" },
+ { CFI_type_long_double_Complex, "CFI_type_long_double_Complex" },
+ { CFI_type_Bool, "CFI_type_Bool" },
+ { CFI_type_char, "CFI_type_char" },
+ { CFI_type_cptr, "CFI_type_cptr" },
+ { CFI_type_struct, "CFI_type_struct" },
+ { CFI_type_other, "CFI_type_other" },
+ /* Extension types */
+ { CFI_type_int128_t, "CFI_type_int128_t" },
+ { CFI_type_int_least128_t, "CFI_type_int_least128_t" },
+ { CFI_type_int_fast128_t, "CFI_type_int_fast128_t" },
+ { CFI_type_ucs4_char, "CFI_type_ucs4_char" },
+ { CFI_type_float128, "CFI_type_float128" },
+ { CFI_type_float128_Complex, "CFI_type_float128_Complex" },
+ { CFI_type_cfunptr, "CFI_type_cfunptr" }
+};
+
+void
+dump_CFI_type_t (CFI_type_t t)
+{
+ int i;
+ for (i = 0; i < sizeof (type_names) / sizeof (struct type_name_map); i++)
+ if (type_names[i].t == t)
+ {
+ fprintf (stderr, "%s", type_names[i].n);
+ return;
+ }
+ fprintf (stderr, "unknown(%d)", (int)t);
+}
+
+void
+check_CFI_status (const char *fn, int code)
+{
+ const char *msg;
+ switch (code)
+ {
+ case CFI_SUCCESS:
+ return;
+ case CFI_ERROR_BASE_ADDR_NULL:
+ msg = "CFI_ERROR_BASE_ADDR_NULL";
+ break;
+ case CFI_ERROR_BASE_ADDR_NOT_NULL:
+ msg = "CFI_ERROR_BASE_ADDR_NOT_NULL";
+ break;
+ case CFI_INVALID_ELEM_LEN:
+ msg = "CFI_INVALID_ELEM_LEN";
+ break;
+ case CFI_INVALID_RANK:
+ msg = "CFI_INVALID_RANK";
+ break;
+ case CFI_INVALID_TYPE:
+ msg = "CFI_INVALID_TYPE";
+ break;
+ case CFI_INVALID_ATTRIBUTE:
+ msg = "CFI_INVALID_ATTRIBUTE";
+ break;
+ case CFI_INVALID_EXTENT:
+ msg = "CFI_INVALID_EXTENT";
+ break;
+ case CFI_INVALID_DESCRIPTOR:
+ msg = "CFI_INVALID_DESCRIPTOR";
+ break;
+ case CFI_ERROR_MEM_ALLOCATION:
+ msg = "CFI_ERROR_MEM_ALLOCATION";
+ break;
+ case CFI_ERROR_OUT_OF_BOUNDS:
+ msg = "CFI_ERROR_OUT_OF_BOUNDS";
+ break;
+ default:
+ msg = "unknown error";
+ break;
+ }
+ fprintf (stderr, "%s returned %s\n", fn, msg);
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.h b/gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.h
new file mode 100644
index 0000000..52375a9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/dump-descriptors.h
@@ -0,0 +1,12 @@
+/* Definitions of functions in dump-descriptors.c. */
+
+#include "ISO_Fortran_binding.h"
+
+extern void dump_CFI_cdesc_t (CFI_cdesc_t *d);
+extern void dump_CFI_dim_t (CFI_dim_t *d);
+extern void dump_CFI_attribute_t (CFI_attribute_t a);
+extern void dump_CFI_index_t (CFI_index_t i);
+extern void dump_CFI_rank_t (CFI_rank_t r);
+extern void dump_CFI_type_t (CFI_type_t t);
+
+void check_CFI_status (const char *fn, int code);
diff --git a/gcc/testsuite/gfortran.dg/c-interop/establish-c.c b/gcc/testsuite/gfortran.dg/c-interop/establish-c.c
new file mode 100644
index 0000000..9e7900d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/establish-c.c
@@ -0,0 +1,134 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+/* For simplicity, point descriptors at a static buffer. BUFSIZE should
+ be large enough for any of the standard types and we'll use DIM0 and DIM1
+ for array dimensions. */
+#define BUFSIZE 64
+#define DIM0 3
+#define DIM1 10
+#define ARRAYBUFSIZE BUFSIZE * DIM0 * DIM1
+static char *buf[ARRAYBUFSIZE] __attribute__ ((aligned (8)));
+static CFI_index_t extents[] = {DIM0, DIM1};
+
+/* Magic number to use for elem_len field. */
+#define MAGIC_ELEM_LEN 20
+
+struct tc_info
+{
+ CFI_type_t typecode;
+ char *name;
+ size_t size;
+};
+
+static struct tc_info tc_table[] =
+{
+ { CFI_type_signed_char, "CFI_type_signed_char", sizeof (signed char) },
+ { CFI_type_short, "CFI_type_short", sizeof (short) },
+ { CFI_type_int, "CFI_type_int", sizeof (int) },
+ { CFI_type_long, "CFI_type_long", sizeof (long) },
+ { CFI_type_long_long, "CFI_type_long_long", sizeof (long long) },
+ { CFI_type_size_t, "CFI_type_size_t", sizeof (size_t) },
+ { CFI_type_int8_t, "CFI_type_int8_t", sizeof (int8_t) },
+ { CFI_type_int16_t, "CFI_type_int16_t", sizeof (int16_t) },
+ { CFI_type_int32_t, "CFI_type_int32_t", sizeof (int32_t) },
+ { CFI_type_int64_t, "CFI_type_int64_t", sizeof (int64_t) },
+ { CFI_type_int_least8_t, "CFI_type_int_least8_t", sizeof (int_least8_t) },
+ { CFI_type_int_least16_t, "CFI_type_int_least16_t", sizeof (int_least16_t) },
+ { CFI_type_int_least32_t, "CFI_type_int_least32_t", sizeof (int_least32_t) },
+ { CFI_type_int_least64_t, "CFI_type_int_least64_t", sizeof (int_least64_t) },
+ { CFI_type_int_fast8_t, "CFI_type_int_fast8_t", sizeof (int_fast8_t) },
+ { CFI_type_int_fast16_t, "CFI_type_int_fast16_t", sizeof (int_fast16_t) },
+ { CFI_type_int_fast32_t, "CFI_type_int_fast32_t", sizeof (int_fast32_t) },
+ { CFI_type_int_fast64_t, "CFI_type_int_fast64_t", sizeof (int_fast64_t) },
+ { CFI_type_intmax_t, "CFI_type_intmax_t", sizeof (intmax_t) },
+ { CFI_type_intptr_t, "CFI_type_intptr_t", sizeof (intptr_t) },
+ { CFI_type_ptrdiff_t, "CFI_type_ptrdiff_t", sizeof (ptrdiff_t) },
+ { CFI_type_float, "CFI_type_float", sizeof (float) },
+ { CFI_type_double, "CFI_type_double", sizeof (double) },
+ { CFI_type_long_double, "CFI_type_long_double", sizeof (long double) },
+ { CFI_type_float_Complex, "CFI_type_float_Complex",
+ sizeof (float _Complex) },
+ { CFI_type_double_Complex, "CFI_type_double_Complex",
+ sizeof (double _Complex) },
+ { CFI_type_long_double_Complex, "CFI_type_long_double_Complex",
+ sizeof (long double _Complex) },
+ { CFI_type_Bool, "CFI_type_Bool", sizeof (_Bool) },
+ { CFI_type_char, "CFI_type_char", sizeof (char) },
+ { CFI_type_cptr, "CFI_type_cptr", sizeof (void *) },
+ { CFI_type_struct, "CFI_type_struct", 0 },
+ { CFI_type_other, "CFI_type_other", -1 }
+};
+
+int
+test_array (struct tc_info *tc, void *ptr, CFI_attribute_t attr)
+{
+ CFI_CDESC_T(2) desc;
+ CFI_cdesc_t *a = (CFI_cdesc_t *) &desc;
+ int bad = 0;
+ size_t elem_len;
+
+ /* Initialize the descriptor to garbage values so we can confirm it's
+ properly initialized with good ones later. */
+ memset (a, -1, sizeof(desc));
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (a, ptr, attr, tc->typecode,
+ MAGIC_ELEM_LEN, 2, extents));
+
+ /* elem_len is ignored unless type is CFI type struct, CFI type other,
+ or a character type. */
+ if (tc->typecode == CFI_type_char
+ || tc->typecode == CFI_type_struct
+ || tc->typecode == CFI_type_other)
+ elem_len = MAGIC_ELEM_LEN;
+ else
+ elem_len = tc->size;
+
+ if (a->elem_len != elem_len
+ || a->base_addr != ptr
+ || a->type != tc->typecode
+ || a->version != CFI_VERSION
+ || a->attribute != attr
+ || a->rank != 2
+ || (ptr &&
+ /* extents parameter is ignored if ptr is null */
+ (a->dim[0].lower_bound != 0
+ || a->dim[0].extent != DIM0
+ || a->dim[0].sm != elem_len
+ || a->dim[1].lower_bound != 0
+ || a->dim[1].extent != DIM1
+ || a->dim[1].sm != elem_len*DIM0)))
+ {
+ fprintf (stderr, "Bad array descriptor for %s:\n", tc->name);
+ dump_CFI_cdesc_t (a);
+ return 1;
+ }
+ return 0;
+}
+
+/* External entry point. */
+extern void ctest_establish (void);
+
+void
+ctest_establish (void)
+{
+ int ncodes = sizeof (tc_table) / sizeof (struct tc_info);
+ int i;
+ int bad = 0;
+
+ for (i = 0; i < ncodes; i++)
+ {
+ bad += test_array (&tc_table[i], (void *)buf, CFI_attribute_other);
+ bad += test_array (&tc_table[i], NULL, CFI_attribute_allocatable);
+ bad += test_array (&tc_table[i], (void *)buf, CFI_attribute_pointer);
+ }
+ if (bad)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/establish-errors-c.c b/gcc/testsuite/gfortran.dg/c-interop/establish-errors-c.c
new file mode 100644
index 0000000..8097655
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/establish-errors-c.c
@@ -0,0 +1,120 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+/* For simplicity, point descriptors at a static buffer. BUFSIZE should
+ be large enough for any of the standard types and we'll use DIM0 and DIM1
+ for array dimensions. */
+#define BUFSIZE 64
+#define DIM0 3
+#define DIM1 10
+#define ARRAYBUFSIZE BUFSIZE * DIM0 * DIM1
+static char *buf[ARRAYBUFSIZE] __attribute__ ((aligned (8)));
+static CFI_index_t extents[] = {DIM0, DIM1};
+
+/* Magic number to use for elem_len field. */
+#define MAGIC_ELEM_LEN 20
+
+
+/* External entry point. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ int bad = 0;
+ int status;
+ CFI_CDESC_T(2) desc;
+ CFI_cdesc_t *a = (CFI_cdesc_t *) &desc;
+
+ /* If the attribute argument is CFI_attribute_allocatable,
+ base_addr shall be a null pointer. */
+ status = CFI_establish (a, (void *)buf, CFI_attribute_allocatable,
+ CFI_type_int, 0, 2, extents);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for non-null pointer with CFI_attribute_allocatable\n");
+ bad ++;
+ }
+
+ /* type shall have the value of one of the type codes in Table 18.4,
+ or have a positive value corresponding to an interoperable C type. */
+ status = CFI_establish (a, (void *)buf, CFI_attribute_other,
+ CFI_type_other - 1, 0, 2, extents);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for invalid negative type code\n");
+ bad ++;
+ }
+
+ /* If the type is CFI_type_struct, CFI_type_other, or a Fortran
+ character type, elem_len shall be greater than zero and equal to
+ the storage size in bytes of an element of the object. */
+ status = CFI_establish (a, (void *)buf, CFI_attribute_other,
+ CFI_type_struct, 0, 2, extents);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for invalid size with CFI_type_struct\n");
+ bad ++;
+ }
+
+ status = CFI_establish (a, (void *)buf, CFI_attribute_other,
+ CFI_type_char, 0, 2, extents);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for invalid size with CFI_type_char\n");
+ bad ++;
+ }
+
+ /* Rank shall be between 0 and CFI_MAX_RANK inclusive. */
+ status = CFI_establish (a, NULL, CFI_attribute_allocatable,
+ CFI_type_int, 0, -1, extents);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for negative rank\n");
+ bad ++;
+ }
+ status = CFI_establish (a, NULL, CFI_attribute_allocatable,
+ CFI_type_int, 0, CFI_MAX_RANK + 1, extents);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for rank > CFI_MAX_RANK\n");
+ bad ++;
+ }
+
+ /* extents is ignored if the rank r is zero or if base_addr is a
+ null pointer. Otherwise, it shall be the address of an array... */
+ status = CFI_establish (a, (void *)buf, CFI_attribute_other,
+ CFI_type_int, 0, 2, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for null extents\n");
+ bad ++;
+ }
+
+ /* Extents shall all be nonnegative. */
+ extents[1] = -extents[1];
+ status = CFI_establish (a, (void *)buf, CFI_attribute_other,
+ CFI_type_int, 0, 2, extents);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for negative extents\n");
+ bad ++;
+ }
+
+ if (bad)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90
new file mode 100644
index 0000000..307a266
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90
@@ -0,0 +1,30 @@
+! PR101317
+! { dg-do run }
+! { dg-additional-sources "establish-errors-c.c dump-descriptors.c" }
+! { dg-additional-options "-Wno-error -fcheck=all" }
+! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+!
+! This program tests that the CFI_establish function properly detects
+! invalid arguments. All the interesting things happen in the
+! corresponding C code.
+!
+! The situation here seems to be that while TS29113 defines error codes
+! for CFI_establish, it doesn't actually require the implementation to detect
+! those errors by saying the arguments "shall be" such-and-such, e.g. it is
+! undefined behavior if they are not. In gfortran you can enable some
+! run-time checking by building with -fcheck=all.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+
+ subroutine ctest () bind (c)
+ end subroutine
+
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/establish.f90 b/gcc/testsuite/gfortran.dg/c-interop/establish.f90
new file mode 100644
index 0000000..5b263ab
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/establish.f90
@@ -0,0 +1,35 @@
+! PR 101305
+! { dg-do run }
+! { dg-additional-sources "establish-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests the CFI_establish function. All the interesting
+! things happen in the corresponding C code.
+
+! Eventually we might want to make the C code pass the descriptors back to
+! C-callable Fortran functions, but for now it just checks them internally.
+
+module mm
+ use iso_c_binding
+
+ type, bind (c) :: s
+ integer(C_INT) :: i, j
+ end type
+end module
+
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+
+ subroutine ctest_establish () bind (c)
+ end subroutine
+
+ end interface
+
+ call ctest_establish ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/explicit-interface.f90 b/gcc/testsuite/gfortran.dg/c-interop/explicit-interface.f90
new file mode 100644
index 0000000..a7eda82
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/explicit-interface.f90
@@ -0,0 +1,60 @@
+! { dg-do compile }
+!
+! TS 29113
+! 6.2 Explicit interface
+!
+! Additionally to the rules of subclause 12.4.2.2 of ISO/IEC 1539-1:2010,
+! a procedure shall have an explicit interface if it has a dummy argument
+! that is assumed-rank.
+!
+! NOTE 6.1
+! An explicit interface is also required for a procedure if it has a
+! dummy argument that is assumed-type because an assumed-type dummy
+! argument is polymorphic.
+!
+! This file contains code that is expected to produce errors.
+
+module m1
+
+ interface
+
+ subroutine s1 (a)
+ integer :: a(..)
+ end subroutine
+
+ subroutine s2 (b)
+ type(*) :: b
+ end subroutine
+
+ end interface
+
+end module
+
+module m2
+
+ contains
+
+ ! This subroutine has an explicit interface, and so do the things
+ ! it calls.
+ subroutine good (a, b)
+ use m1
+ integer :: a(..)
+ type (*) :: b
+
+ call s1 (a)
+ call s2 (b)
+ end subroutine
+
+ ! This subroutine has an explicit interface, but the things it calls don't.
+ subroutine bad (a, b)
+ use m1
+ integer :: a(..)
+ type (*) :: b
+ external :: s3, s4
+
+ call s3 (a) ! { dg-error "Assumed-rank argument" }
+ call s4 (b) ! { dg-error "Assumed-type argument" }
+ end subroutine
+
+end module
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1-c.c
new file mode 100644
index 0000000..674f0bd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1-c.c
@@ -0,0 +1,46 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* The actual argument on the Fortran side was declared as
+ integer(C_INT) :: aa(10,-1:3)
+ Make sure that matches what's in the descriptor. Note that per
+ section 18.5.3 in the 2018 standard, for a nonallocatable nonpointer
+ array, the array dimensions in the descriptor reflect the shape of
+ the array rather than the actual bounds; the lower_bound is required
+ to be zero. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != 10)
+ abort ();
+ if (a->dim[0].sm != sizeof(int))
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != 5)
+ abort ();
+ if (a->dim[1].sm != a->dim[0].extent * sizeof(int))
+ abort ();
+ if (!CFI_is_contiguous (a))
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1.f90
new file mode 100644
index 0000000..9a540ee
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-1.f90
@@ -0,0 +1,34 @@
+! { dg-do run }
+! { dg-additional-sources "fc-descriptor-1-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This checks that a C function declared to have an assumed-shape array
+! argument can be called from Fortran and receives a correct descriptor.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(:,:)
+ end subroutine
+ end interface
+
+ integer(C_INT) :: aa(10,-1:3)
+
+ ! Test both passing the fixed-size array directly to the function
+ ! with a C interface, and indirectly via a Fortran function with an
+ ! assumed-shape dummy argument.
+ call ctest (aa)
+ call ftest (aa)
+
+contains
+ subroutine ftest (a)
+ use iso_c_binding
+ integer(C_INT) :: a(:,:)
+ call ctest (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2-c.c
new file mode 100644
index 0000000..5ce0bfe
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2-c.c
@@ -0,0 +1,68 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, int n);
+
+void
+ctest (CFI_cdesc_t *a, int n)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(float))
+ abort ();
+ if (a->type != CFI_type_float)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+
+ if (n == 1)
+ {
+ /* The actual argument on the Fortran side was declared as
+ real(C_FLOAT):: aa(100) */
+ if (a->rank != 1)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != 100)
+ abort ();
+ if (a->dim[0].sm != sizeof(float))
+ abort ();
+ if (!CFI_is_contiguous (a))
+ abort ();
+ }
+ else if (n == 3)
+ {
+ /* The actual argument on the Fortran side was declared as
+ real(C_FLOAT) :: bb(3,4,5) */
+ if (a->rank != 3)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != 3)
+ abort ();
+ if (a->dim[0].sm != sizeof(float))
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != 4)
+ abort ();
+ if (a->dim[1].sm != a->dim[0].sm * a->dim[0].extent)
+ abort ();
+ if (a->dim[2].lower_bound != 0)
+ abort ();
+ if (a->dim[2].extent != 5)
+ abort ();
+ if (a->dim[2].sm != a->dim[1].sm * a->dim[1].extent)
+ abort ();
+ if (!CFI_is_contiguous (a))
+ abort ();
+ }
+ else
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2.f90
new file mode 100644
index 0000000..ec90735
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-2.f90
@@ -0,0 +1,40 @@
+! { dg-do run }
+! { dg-additional-sources "fc-descriptor-2-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that a C function declared to take an assumed-rank
+! array argument can be called from Fortran, and receives a correct
+! descriptor.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a, n) bind (c)
+ use iso_c_binding
+ real(C_FLOAT) :: a(..)
+ integer(C_INT), value :: n
+ end subroutine
+ end interface
+
+ real(C_FLOAT) :: aa(100)
+ real(C_FLOAT) :: bb(3,4,5)
+
+ ! Test both passing the fixed-size array directly to the function
+ ! with a C interface, and indirectly via a Fortran function with an
+ ! assumed-rank dummy argument.
+ call ctest (aa, 1)
+ call ctest (bb, 3)
+ call ftest (aa, 1)
+ call ftest (bb, 3)
+
+contains
+ subroutine ftest (a, n)
+ use iso_c_binding
+ real(C_FLOAT) :: a(..)
+ integer, value :: n
+ call ctest (a, n)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3-c.c
new file mode 100644
index 0000000..a432ee4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3-c.c
@@ -0,0 +1,42 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, CFI_cdesc_t *b, int initp);
+
+void
+ctest (CFI_cdesc_t *a, CFI_cdesc_t *b, int initp)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+ dump_CFI_cdesc_t (b);
+
+ /* Make sure the descriptors match what we are expecting. a is an
+ allocatable derived type object, b is a pointer which points at a
+ if initp is true. */
+ if (initp && !a->base_addr)
+ abort ();
+ else if (!initp && a->base_addr)
+ abort ();
+ if (a->base_addr != b->base_addr)
+ abort ();
+
+ if (a->rank != 0)
+ abort ();
+ if (b->rank != 0)
+ abort ();
+ if (a->type != CFI_type_struct)
+ abort ();
+ if (b->type != CFI_type_struct)
+ abort ();
+ if (a->elem_len != 3 * 3 * sizeof(double))
+ abort ();
+ if (b->elem_len != 3 * 3 * sizeof(double))
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3.f90
new file mode 100644
index 0000000..174d1e7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-3.f90
@@ -0,0 +1,37 @@
+! PR 101308
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "fc-descriptor-3-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that pointer and allocatable scalar arguments are
+! correctly passed by descriptor from Fortran code into C.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ type, bind (c) :: m
+ real(C_DOUBLE) :: a(3, 3)
+ end type
+
+ interface
+ subroutine ctest (a, b, initp) bind (c)
+ use iso_c_binding
+ import m
+ type(m), allocatable :: a
+ type(m), pointer :: b
+ integer(C_INT), value :: initp
+ end subroutine
+ end interface
+
+ type (m), allocatable, target :: aa
+ type (m), pointer :: bb
+
+ ! Test both before and after allocation/pointer initialization.
+ bb => null()
+ call ctest (aa, bb, 0)
+ allocate (aa)
+ bb => aa
+ call ctest (aa, bb, 1)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4-c.c
new file mode 100644
index 0000000..579e66d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4-c.c
@@ -0,0 +1,57 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, CFI_cdesc_t *b, int initp);
+
+void
+ctest (CFI_cdesc_t *a, CFI_cdesc_t *b, int initp)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+ dump_CFI_cdesc_t (b);
+
+ /* Make sure the descriptors match what we are expecting. a is an
+ allocatable derived type object, b is a pointer which points at a
+ if initp is true. */
+ if (initp && !a->base_addr)
+ abort ();
+ else if (!initp && a->base_addr)
+ abort ();
+ if (a->base_addr != b->base_addr)
+ abort ();
+
+ if (a->type != CFI_type_struct)
+ abort ();
+ if (b->type != CFI_type_struct)
+ abort ();
+ if (a->elem_len != 3 * 3 * sizeof(double))
+ abort ();
+ if (b->elem_len != 3 * 3 * sizeof(double))
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+
+ if (initp)
+ /* The actual array is allocated with
+ allocate (aa(3:7))
+ Per 8.3.3 of TS29113, the lower_bound must reflect that. */
+ {
+ if (a->rank != 1)
+ abort ();
+ if (b->rank != 1)
+ abort ();
+ if (a->dim[0].lower_bound != 3)
+ abort ();
+ if (b->dim[0].lower_bound != 3)
+ abort ();
+ if (a->dim[0].extent != 5)
+ abort ();
+ if (b->dim[0].extent != 5)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4.f90
new file mode 100644
index 0000000..db73daf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-4.f90
@@ -0,0 +1,36 @@
+! { dg-do run }
+! { dg-additional-sources "fc-descriptor-4-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that pointer and allocatable array arguments are
+! correctly passed by descriptor from Fortran code into C.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ type, bind (c) :: m
+ real(C_DOUBLE) :: a(3, 3)
+ end type
+
+ interface
+ subroutine ctest (a, b, initp) bind (c)
+ use iso_c_binding
+ import m
+ type(m), allocatable :: a(:)
+ type(m), pointer :: b(:)
+ integer(C_INT), value :: initp
+ end subroutine
+ end interface
+
+ type (m), allocatable, target :: aa(:)
+ type (m), pointer :: bb(:)
+
+ ! Test both before and after allocation/pointer initialization.
+ bb => NULL ()
+ call ctest (aa, bb, 0)
+ allocate (aa(3:7))
+ bb => aa
+ call ctest (aa, bb, 1)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5-c.c
new file mode 100644
index 0000000..6f27185
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5-c.c
@@ -0,0 +1,28 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* The actual argument on the Fortran side was declared as
+ character(len=20) :: aa
+ Make sure that matches what's in the descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != 20)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (a->type != CFI_type_char)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5.f90
new file mode 100644
index 0000000..5ac406f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-5.f90
@@ -0,0 +1,35 @@
+! PR92482
+! { dg-do run }
+! { dg-additional-sources "fc-descriptor-5-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests it works to call a C function from Fortran with
+! an assumed length character dummy.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(len=*,kind=C_CHAR) :: a
+ end subroutine
+ end interface
+
+ character(len=20,kind=C_CHAR) :: aa
+
+ ! Test both passing the fixed-length string directly to the function
+ ! with a C interface, and indirectly via a Fortran function with an
+ ! assumed-length dummy argument.
+ call ctest (aa)
+ call ftest (aa)
+
+contains
+ subroutine ftest (a)
+ use iso_c_binding
+ character(len=*,kind=C_CHAR) :: a
+ call ctest (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6-c.c
new file mode 100644
index 0000000..875dbb8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6-c.c
@@ -0,0 +1,51 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* The actual argument on the Fortran side was declared as
+ integer(C_INT) :: aa(10,5:8)
+ but was passed via other functions that variously describe it as
+ having size (10,*), (10,1:*), or (10,5:*). But, the spec says:
+
+ For a C descriptor of a nonallocatable nonpointer object, the
+ value of the lower_bound member of each element of the dim member
+ of the descriptor is zero.
+
+ In a C descriptor of an assumed-size array, the extent member of
+ the last element of the dim member has the value −1. */
+
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != 10)
+ abort ();
+ if (a->dim[0].sm != sizeof(int))
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != -1)
+ abort ();
+ if (a->dim[1].sm != a->dim[0].extent * sizeof(int))
+ abort ();
+}
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6.f90
new file mode 100644
index 0000000..8c544d1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-6.f90
@@ -0,0 +1,50 @@
+! Reported as pr94070.
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "fc-descriptor-6-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that an assumed-size array argument can be passed
+! to a C function via a descriptor, and that the argument descriptor
+! received by C correctly identifies it as assumed-size.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ ! Assumed-size arrays are not passed by descriptor. What we'll do
+ ! for this test function is bind an assumed-rank dummy
+ ! to the assumed-size array. This is supposed to fill in the descriptor
+ ! with information about the array present at the call site.
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ end subroutine
+ end interface
+
+ integer(C_INT), target :: aa(10,5:8)
+
+ ! To get an assumed-size array descriptor, we have to first pass the
+ ! fixed-size array to a Fortran function with an assumed-size dummy,
+ call ftest1 (aa)
+ call ftest2 (aa)
+ call ftest3 (aa)
+
+contains
+ subroutine ftest1 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,*)
+ call ctest (a)
+ end subroutine
+ subroutine ftest2 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,5:*)
+ call ctest (a)
+ end subroutine
+ subroutine ftest3 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,1:*)
+ call ctest (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7-c.c
new file mode 100644
index 0000000..81d826f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7-c.c
@@ -0,0 +1,46 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* We expect to get an array of shape (5,10) that may not be
+ contiguous. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != 5)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != 10)
+ abort ();
+
+ /* There shall be an ordering of the dimensions such that the absolute
+ value of the sm member of the first dimension is not less than the
+ elem_len member of the C descriptor and the absolute value of the sm
+ member of each subsequent dimension is not less than the absolute
+ value of the sm member of the previous dimension multiplied
+ by the extent of the previous dimension. */
+ if (abs (a->dim[0].sm) < a->elem_len)
+ abort ();
+ if (abs (a->dim[1].sm) < abs (a->dim[0].sm) * a->dim[0].extent)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7.f90
new file mode 100644
index 0000000..5be72e7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-7.f90
@@ -0,0 +1,37 @@
+! PR 101309
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "fc-descriptor-7-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests passing arrays that may not be contiguous through
+! descriptors to C functions as assumed-shape arguments.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ integer(C_INT), intent (in) :: a(:,:)
+ end subroutine
+ end interface
+
+ integer(C_INT), target :: aa(10,5)
+ integer(C_INT), target :: bb(10,10)
+
+ ! Test both calling the C function directly, and via another function
+ ! that takes an assumed-shape argument.
+ call ctest (transpose (aa))
+ call ftest (transpose (aa))
+ call ctest (bb(2:10:2, :))
+ call ftest (bb(2:10:2, :))
+
+contains
+ subroutine ftest (a)
+ use iso_c_binding
+ integer(C_INT), intent(in) :: a(:,:)
+ call ctest (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8-c.c
new file mode 100644
index 0000000..8adf8e3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8-c.c
@@ -0,0 +1,20 @@
+/* TS29113 8.3.1: ISO_Fortran_binding.h may be included more than once. */
+
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+#include <ISO_Fortran_binding.h>
+
+extern void ctest (CFI_cdesc_t *a);
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->version != CFI_VERSION)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8.f90
new file mode 100644
index 0000000..42345ad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-8.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+! { dg-additional-sources "fc-descriptor-8-c.c dump-descriptors.c" }
+!
+! Check that C descriptors have the version field set correctly.
+! This program is just a stub to create a descriptor and pass it to the
+! C function, which does the actual test.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(:,:)
+ end subroutine
+ end interface
+
+ integer(C_INT) :: aa(10,-1:3)
+ call ctest (aa)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9-c.c
new file mode 100644
index 0000000..05e6581
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9-c.c
@@ -0,0 +1,42 @@
+/* 8.3.1: ISO_Fortran_binding.h may be included more than once. */
+
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+
+struct descriptor_fixed_part {
+ void *base_addr;
+ size_t elem_len;
+ int version;
+};
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ struct descriptor_fixed_part *f = (struct descriptor_fixed_part *) a;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* The first three members of the structure shall be base_addr,
+ elem_len, and version in that order. */
+ if (&(a->base_addr) != &(f->base_addr))
+ abort ();
+ if (&(a->elem_len) != &(f->elem_len))
+ abort ();
+ if (&(a->version) != &(f->version))
+ abort ();
+
+ /* The final member shall be dim, with the other members after version
+ and before dim in any order. */
+ if ((void *)&(a->rank) >= (void *)a->dim)
+ abort ();
+ if ((void *)&(a->type) >= (void *)a->dim)
+ abort ();
+ if ((void *)&(a->attribute) >= (void *)a->dim)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9.f90
new file mode 100644
index 0000000..e54f677
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-descriptor-9.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! { dg-additional-sources "fc-descriptor-9-c.c dump-descriptors.c" }
+!
+! Check that C descriptors follow the layout restrictions described in
+! section 8.3.3 of TS29113.
+! This program is just a stub to create a descriptor and pass it to the
+! C function, which does the actual test.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(:,:)
+ end subroutine
+ end interface
+
+ integer(C_INT) :: aa(10,-1:3)
+ call ctest (aa)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1-c.c
new file mode 100644
index 0000000..18b37e1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1-c.c
@@ -0,0 +1,52 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (int imax, int jmax, CFI_cdesc_t *a);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (int imax, int jmax, CFI_cdesc_t *a)
+{
+
+ int i, j;
+ CFI_index_t subscripts[2];
+ struct m* mp;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != imax)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != jmax)
+ abort ();
+
+ /* Fill in the contents of a. a is zero-based but we want the ->i and ->j
+ members of each element to be numbered starting from 1. */
+ for (j = 0; j < jmax; j++)
+ {
+ subscripts[1] = j;
+ for (i = 0; i < imax; i++)
+ {
+ subscripts[0] = i;
+ mp = (struct m *) CFI_address (a, subscripts);
+ mp->i = i + 1;
+ mp->j = j + 1;
+ }
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1.f90
new file mode 100644
index 0000000..d0c30b5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-1.f90
@@ -0,0 +1,66 @@
+! { dg-do run }
+! { dg-additional-sources "fc-out-descriptor-1-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that passing a fixed-size array as an intent(out)
+! assumed-shape argument to a C function called from Fortran works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (ii, jj, a) bind (c)
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: ii, jj
+ type(m), intent(out) :: a(:,:)
+ end subroutine
+ end interface
+
+ type(m) :: aa(imax,jmax)
+ integer :: i, j
+
+ ! initialize the array to all zeros; ctest will overwrite it.
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = 0
+ aa(i,j)%j = 0
+ end do
+ end do
+
+ call ctest (imax, jmax, aa)
+ call verify (aa)
+
+contains
+subroutine verify (a)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ integer :: i, j
+
+ if (rank (a) .ne. 2) stop 100
+ if (lbound (a, 1) .ne. 1) stop 101
+ if (lbound (a, 2) .ne. 1) stop 102
+ if (ubound (a, 1) .ne. imax) stop 103
+ if (ubound (a, 2) .ne. jmax) stop 104
+
+ do j = 1, jmax
+ do i = 1, imax
+ if (a(i,j)%i .ne. i) stop 201
+ if (a(i,j)%j .ne. j) stop 202
+ end do
+ end do
+end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2-c.c
new file mode 100644
index 0000000..18b37e1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2-c.c
@@ -0,0 +1,52 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (int imax, int jmax, CFI_cdesc_t *a);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest (int imax, int jmax, CFI_cdesc_t *a)
+{
+
+ int i, j;
+ CFI_index_t subscripts[2];
+ struct m* mp;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != imax)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != jmax)
+ abort ();
+
+ /* Fill in the contents of a. a is zero-based but we want the ->i and ->j
+ members of each element to be numbered starting from 1. */
+ for (j = 0; j < jmax; j++)
+ {
+ subscripts[1] = j;
+ for (i = 0; i < imax; i++)
+ {
+ subscripts[0] = i;
+ mp = (struct m *) CFI_address (a, subscripts);
+ mp->i = i + 1;
+ mp->j = j + 1;
+ }
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2.f90
new file mode 100644
index 0000000..87cfb6e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-2.f90
@@ -0,0 +1,66 @@
+! { dg-do run }
+! { dg-additional-sources "fc-out-descriptor-2-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that passing a fixed-size array as an intent(out)
+! assumed-rank argument to a C function called from Fortran works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (ii, jj, a) bind (c)
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: ii, jj
+ type(m), intent(out) :: a(..)
+ end subroutine
+ end interface
+
+ type(m) :: aa(imax,jmax)
+ integer :: i, j
+
+ ! initialize the array to all zeros; ctest will overwrite it.
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = 0
+ aa(i,j)%j = 0
+ end do
+ end do
+
+ call ctest (imax, jmax, aa)
+ call verify (aa)
+
+contains
+subroutine verify (a)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ integer :: i, j
+
+ if (rank (a) .ne. 2) stop 100
+ if (lbound (a, 1) .ne. 1) stop 101
+ if (lbound (a, 2) .ne. 1) stop 102
+ if (ubound (a, 1) .ne. imax) stop 103
+ if (ubound (a, 2) .ne. jmax) stop 104
+
+ do j = 1, jmax
+ do i = 1, imax
+ if (a(i,j)%i .ne. i) stop 201
+ if (a(i,j)%j .ne. j) stop 202
+ end do
+ end do
+end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3-c.c
new file mode 100644
index 0000000..7de226e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3-c.c
@@ -0,0 +1,71 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest1 (int iinit, int jinit, CFI_cdesc_t *p);
+extern void ctest2 (int iinit, int jinit, CFI_cdesc_t *a);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest1 (int iinit, int jinit, CFI_cdesc_t *p)
+{
+ struct m *mp;
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (p);
+
+ if (p->rank != 0)
+ abort ();
+ if (p->attribute != CFI_attribute_pointer)
+ abort ();
+ if (p->type != CFI_type_struct)
+ abort ();
+
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (p, NULL, NULL, sizeof (struct m)));
+
+ if (p->base_addr == NULL)
+ abort ();
+
+ mp = (struct m *) CFI_address (p, NULL);
+ mp->i = iinit;
+ mp->j = jinit;
+}
+
+
+void
+ctest2 (int iinit, int jinit, CFI_cdesc_t *a)
+{
+ struct m *mp;
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 0)
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (a->type != CFI_type_struct)
+ abort ();
+
+ /* The intent(out) allocatable array is supposed to be deallocated
+ automatically on entry, if it was previously allocated. */
+ if (a->base_addr)
+ abort ();
+
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (a, NULL, NULL, sizeof (struct m)));
+
+ if (a->base_addr == NULL)
+ abort ();
+
+ mp = (struct m *) CFI_address (a, NULL);
+ mp->i = iinit;
+ mp->j = jinit;
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3.f90
new file mode 100644
index 0000000..c555ada
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-3.f90
@@ -0,0 +1,59 @@
+! PR 101308
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "fc-out-descriptor-3-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that passing an allocatable or pointer scalar
+! as an intent(out) argument to a C function called from Fortran works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer(C_INT), parameter :: iinit = 42, jinit = 12345
+
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest1 (ii, jj, p) bind (c)
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: ii, jj
+ type(m), intent(out), pointer :: p
+ end subroutine
+ subroutine ctest2 (ii, jj, a) bind (c)
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: ii, jj
+ type(m), intent(out), allocatable :: a
+ end subroutine
+ end interface
+
+ type(m), pointer :: p
+ type(m), allocatable :: a
+
+ ! The association status of the intent(out) pointer argument is supposed
+ ! to become undefined on entry to the called procedure.
+ p => NULL ()
+ call ctest1 (iinit, jinit, p)
+ if (.not. associated (p)) stop 101
+ if (p%i .ne. iinit) stop 102
+ if (p%j .ne. jinit) stop 103
+
+ ! The intent(out) argument is supposed to be deallocated automatically
+ ! on entry to the called function.
+ allocate (a)
+ a%i = 0
+ a%j = 0
+ call ctest2 (iinit, jinit, a)
+ if (.not. allocated (a)) stop 201
+ if (a%i .ne. iinit) stop 202
+ if (a%j .ne. jinit) stop 203
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4-c.c
new file mode 100644
index 0000000..6e1324b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4-c.c
@@ -0,0 +1,96 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest1 (int imin, int imax, int jmin, int jmax, CFI_cdesc_t *p);
+extern void ctest2 (int imin, int imax, int jmin, int jmax, CFI_cdesc_t *a);
+
+struct m {
+ int i;
+ int j;
+};
+
+void
+ctest1 (int imin, int imax, int jmin, int jmax, CFI_cdesc_t *p)
+{
+ struct m *mp;
+ int i, j;
+ CFI_index_t lb[2], ub[2], s[2];
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (p);
+
+ if (p->rank != 2)
+ abort ();
+ if (p->attribute != CFI_attribute_pointer)
+ abort ();
+ if (p->type != CFI_type_struct)
+ abort ();
+
+ lb[0] = imin;
+ lb[1] = jmin;
+ ub[0] = imax;
+ ub[1] = jmax;
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (p, lb, ub, sizeof (struct m)));
+
+ if (p->base_addr == NULL)
+ abort ();
+
+ for (j = jmin; j <= jmax; j++)
+ for (i = imin; i <= imax; i++)
+ {
+ s[0] = i;
+ s[1] = j;
+ mp = (struct m *) CFI_address (p, s);
+ mp->i = i;
+ mp->j = j;
+ }
+}
+
+void
+ctest2 (int imin, int imax, int jmin, int jmax, CFI_cdesc_t *a)
+{
+ struct m *mp;
+ int i, j;
+ CFI_index_t lb[2], ub[2], s[2];
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_allocatable)
+ abort ();
+ if (a->type != CFI_type_struct)
+ abort ();
+
+ /* Intent(out) argument is supposed to be deallocated automatically
+ on entry. */
+ if (a->base_addr)
+ abort ();
+
+ lb[0] = imin;
+ lb[1] = jmin;
+ ub[0] = imax;
+ ub[1] = jmax;
+ check_CFI_status ("CFI_allocate",
+ CFI_allocate (a, lb, ub, sizeof (struct m)));
+
+ if (a->base_addr == NULL)
+ abort ();
+
+ for (j = jmin; j <= jmax; j++)
+ for (i = imin; i <= imax; i++)
+ {
+ s[0] = i;
+ s[1] = j;
+ mp = (struct m *) CFI_address (a, s);
+ mp->i = i;
+ mp->j = j;
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4.f90
new file mode 100644
index 0000000..b4f6654
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-4.f90
@@ -0,0 +1,75 @@
+! PR 92621 (?)
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "fc-out-descriptor-4-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that passing an allocatable or pointer array
+! as an intent(out) argument to a C function called from Fortran works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer(C_INT), parameter :: imin = 5, imax = 10, jmin = -10, jmax = -1
+
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest1 (i0, ii, j0, jj, p) bind (c)
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: i0, ii, j0, jj
+ type(m), intent(out), pointer :: p(:,:)
+ end subroutine
+ subroutine ctest2 (i0, ii, j0, jj, a) bind (c)
+ use iso_c_binding
+ use mm
+ integer(C_INT), value :: i0, ii, j0, jj
+ type(m), intent(out), allocatable :: a(:,:)
+ end subroutine
+ end interface
+
+ type(m), pointer :: p(:,:)
+ type(m), allocatable :: a(:,:)
+ integer :: i, j
+
+ p => NULL ()
+ call ctest1 (imin, imax, jmin, jmax, p)
+ if (.not. associated (p)) stop 101
+ if (rank(p) .ne. 2) stop 102
+ if (lbound (p, 1) .ne. imin) stop 103
+ if (ubound (p, 1) .ne. imax) stop 104
+ if (lbound (p, 2) .ne. jmin) stop 105
+ if (ubound (p, 2) .ne. jmax) stop 106
+ do j = jmin, jmax
+ do i = imin, imax
+ if (p(i,j)%i .ne. i) stop 107
+ if (p(i,j)%j .ne. j) stop 108
+ end do
+ end do
+
+ ! The intent(out) argument is supposed to be deallocated automatically
+ ! on entry to the called function.
+ allocate (a (jmin:jmax,imin:imax))
+ if (.not. allocated (a)) stop 201
+ call ctest2 (imin, imax, jmin, jmax, a)
+ if (.not. allocated (a)) stop 201
+ if (rank(a) .ne. 2) stop 202
+ if (lbound (a, 1) .ne. imin) stop 203
+ if (ubound (a, 1) .ne. imax) stop 204
+ if (lbound (a, 2) .ne. jmin) stop 205
+ if (ubound (a, 2) .ne. jmax) stop 206
+ do j = jmin, jmax
+ do i = imin, imax
+ if (a(i,j)%i .ne. i) stop 207
+ if (a(i,j)%j .ne. j) stop 208
+ end do
+ end do
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5-c.c
new file mode 100644
index 0000000..337bc22
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5-c.c
@@ -0,0 +1,30 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* The character object passed as the argument was declared on the
+ Fortran side as character(len=26) :: aa
+ Make sure that matches what's in the descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != 26)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (a->type != CFI_type_char)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ strncpy ((char *)a->base_addr, "0123456789", 10);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5.f90
new file mode 100644
index 0000000..836683b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5.f90
@@ -0,0 +1,35 @@
+! PR92482
+! { dg-do run }
+! { dg-additional-sources "fc-out-descriptor-5-c.c dump-descriptors.c" }
+!
+! This program checks that you can call a C function declared with an
+! assumed-length character dummy from Fortran.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(len=*,kind=C_CHAR), intent(out) :: a
+ end subroutine
+ end interface
+
+ character(len=26,kind=C_CHAR) :: aa
+ aa = 'abcdefghijklmnopqrstuvwxyz'
+
+ ! Test both passing the fixed-length-string directly to the function
+ ! with a C interface, and indirectly via a Fortran function with an
+ ! assumed-length dummy argument.
+ call ctest (aa)
+ call ftest (aa)
+
+contains
+ subroutine ftest (a) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(len=*,kind=C_CHAR), intent(out) :: a
+ call ctest (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6-c.c
new file mode 100644
index 0000000..2711a98
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6-c.c
@@ -0,0 +1,50 @@
+#include <stdlib.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a);
+
+void
+ctest (CFI_cdesc_t *a)
+{
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ dump_CFI_cdesc_t (a);
+
+ /* The actual argument on the Fortran side was declared as
+ integer(C_INT) :: aa(10,5:8)
+ but was passed via other functions that variously describe it as
+ having size (10,*), (10,1:*), or (10,5:*) before calling this function
+ with an assumed-rank array dummy. But, the spec says:
+
+ For a C descriptor of a nonallocatable nonpointer object, the
+ value of the lower_bound member of each element of the dim member
+ of the descriptor is zero.
+
+ In a C descriptor of an assumed-size array, the extent member of
+ the last element of the dim member has the value −1. */
+
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != 10)
+ abort ();
+ if (a->dim[0].sm != sizeof(int))
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != -1)
+ abort ();
+ if (a->dim[1].sm != a->dim[0].extent * sizeof(int))
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6.f90
new file mode 100644
index 0000000..d0c3904
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-6.f90
@@ -0,0 +1,49 @@
+! Reported as pr94070.
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "fc-out-descriptor-6-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks passing an assumed-size array argument via descriptor
+! from Fortran to C.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ ! Assumed-size arrays are not passed by descriptor. What we'll do
+ ! for this test function is bind an assumed-rank dummy to an
+ ! assumed-size array. This is supposed to fill in the descriptor
+ ! with information about the array present at the call site.
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ integer(C_INT), intent(out) :: a(..)
+ end subroutine
+ end interface
+
+ integer(C_INT), target :: aa(10,5:8)
+
+ ! To get an assumed-size array descriptor, we have to first pass the
+ ! fixed-size array to a Fortran function with an assumed-size dummy.
+ call ftest1 (aa)
+ call ftest2 (aa)
+ call ftest3 (aa)
+
+contains
+ subroutine ftest1 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,*)
+ call ctest (a)
+ end subroutine
+ subroutine ftest2 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,5:*)
+ call ctest (a)
+ end subroutine
+ subroutine ftest3 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,1:*)
+ call ctest (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7-c.c b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7-c.c
new file mode 100644
index 0000000..be9fc92
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7-c.c
@@ -0,0 +1,136 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+struct m {
+ int i;
+ int j;
+};
+
+extern void ctest (CFI_cdesc_t *a, int lb1, int ub1, int s1,
+ int lb2, int ub2, int s2, CFI_cdesc_t *b);
+
+/* Check array b against the section of array a defined by the given
+ bounds. */
+static void
+check_array (CFI_cdesc_t *a, CFI_cdesc_t *b,
+ int lb1, int ub1, int s1, int lb2, int ub2, int s2)
+{
+ int bad = 0;
+ int i, ii, j, jj;
+ CFI_index_t sub[2];
+ struct m *ap, *bp;
+
+ for (j = lb2, jj = b->dim[1].lower_bound; j <= ub2; jj++, j += s2)
+ for (i = lb1, ii = b->dim[0].lower_bound; i <= ub1; ii++, i += s1)
+ {
+ sub[0] = i;
+ sub[1] = j;
+ ap = (struct m *) CFI_address (a, sub);
+ sub[0] = ii;
+ sub[1] = jj;
+ bp = (struct m *) CFI_address (b, sub);
+#if 0
+ fprintf (stderr, "b(%d,%d) = (%d,%d) expecting (%d,%d)\n",
+ ii, jj, bp->i, bp->j, ap->i, ap->j);
+#endif
+ if (ap->i != bp->i || ap->j != bp->j)
+ bad = 1;
+ }
+ if (bad)
+ abort ();
+}
+
+void
+ctest (CFI_cdesc_t *a, int lb1, int ub1, int s1,
+ int lb2, int ub2, int s2, CFI_cdesc_t *b)
+{
+ CFI_index_t lb[2], ub[2], s[2];
+ CFI_index_t i, j;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ fprintf (stderr, "input arrays\n");
+ dump_CFI_cdesc_t (a);
+ dump_CFI_cdesc_t (b);
+
+ /* We expect to get a zero-based input array of shape (10,5). */
+ if (a->rank != 2)
+ abort ();
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->type != CFI_type_struct)
+ abort ();
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ if (a->dim[0].extent != 10)
+ abort ();
+ if (a->dim[1].lower_bound != 0)
+ abort ();
+ if (a->dim[1].extent != 5)
+ abort ();
+
+ /* The output descriptor has to agree with the input descriptor. */
+ if (b->rank != 2)
+ abort ();
+ if (b->attribute != CFI_attribute_pointer)
+ abort ();
+ if (b->type != CFI_type_struct)
+ abort ();
+ if (b->elem_len != a->elem_len)
+ abort ();
+
+ /* Point b at a, keeping the 0-based bounds. */
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (b, a, NULL));
+ fprintf (stderr, "After initializing b\n");
+ dump_CFI_cdesc_t (b);
+ if (b->dim[0].lower_bound != 0)
+ abort ();
+ if (b->dim[1].lower_bound != 0)
+ abort ();
+ check_array (a, b,
+ a->dim[0].lower_bound,
+ a->dim[0].lower_bound + a->dim[0].extent - 1,
+ 1,
+ a->dim[1].lower_bound,
+ a->dim[1].lower_bound + a->dim[1].extent - 1,
+ 1);
+
+ /* Take a section of the array. The bounds passed in to this function
+ assume the array is 1-based in both dimensions, so subtract 1. */
+ lb[0] = b->dim[0].lower_bound + lb1 - 1;
+ lb[1] = b->dim[1].lower_bound + lb2 - 1;
+ ub[0] = b->dim[0].lower_bound + ub1 - 1;
+ ub[1] = b->dim[1].lower_bound + ub2 - 1;
+ s[0] = s1;
+ s[1] = s2;
+ check_CFI_status ("CFI_section",
+ CFI_section (b, b, lb, ub, s));
+ fprintf (stderr, "After CFI_section\n");
+ dump_CFI_cdesc_t (b);
+ check_array (a, b,
+ a->dim[0].lower_bound + lb1 - 1,
+ a->dim[0].lower_bound + ub1 - 1,
+ s1,
+ a->dim[1].lower_bound + lb2 - 1,
+ a->dim[1].lower_bound + ub2 - 1,
+ s2);
+
+ /* Adjust b to be 1-based. */
+ lb[0] = 1;
+ lb[1] = 1;
+ fprintf (stderr, "After rebasing b again\n");
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (b, b, lb));
+ dump_CFI_cdesc_t (b);
+ check_array (a, b,
+ a->dim[0].lower_bound + lb1 - 1,
+ a->dim[0].lower_bound + ub1 - 1,
+ s1,
+ a->dim[1].lower_bound + lb2 - 1,
+ a->dim[1].lower_bound + ub2 - 1,
+ s2);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7.f90 b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7.f90
new file mode 100644
index 0000000..209f96f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-7.f90
@@ -0,0 +1,71 @@
+! PR 101310
+! { dg-do run }
+! { dg-additional-sources "fc-out-descriptor-7-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program checks that returning a noncontiguous array as an intent(out)
+! argument to a C function called from Fortran works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer(C_INT), parameter :: imax = 10, jmax=5
+
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ ! ctest points b at a section of array a defined by the
+ ! indicated bounds and steps. The returned array is 1-based.
+ subroutine ctest (a, lb1, ub1, s1, lb2, ub2, s2, b) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), target :: a(:,:)
+ integer(C_INT), value :: lb1, ub1, s1, lb2, ub2, s2
+ type(m), intent(out), pointer :: b(:,:)
+ end subroutine
+ end interface
+
+ type(m), target :: a(imax, jmax)
+ type(m), pointer :: b(:,:)
+ integer :: i, j, ii, jj
+
+ do j = 1, jmax
+ do i = 1, imax
+ a(i,j)%i = i
+ a(i,j)%j = j
+ end do
+ end do
+
+ b => NULL ()
+ ! resulting array is 1-based and has shape (3,3)
+ call ctest (a, 2, 8, 3, 1, 5, 2, b)
+ if (.not. associated (b)) stop 101
+ if (rank(b) .ne. 2) stop 102
+ if (lbound (b, 1) .ne. 1) stop 103
+ if (ubound (b, 1) .ne. 3) stop 104
+ if (lbound (b, 2) .ne. 1) stop 105
+ if (ubound (b, 2) .ne. 3) stop 106
+
+ ! check that the returned array b contains the expected elements
+ ! from array a.
+ jj = lbound (b, 2)
+ do j = 1, 5, 2
+ ii = lbound (b, 1)
+ do i = 2, 8, 3
+ if (b(ii,jj)%i .ne. i) stop 107
+ if (b(ii,jj)%j .ne. j) stop 108
+ ii = ii + 1
+ end do
+ jj = jj + 1
+ end do
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-1.f90
new file mode 100644
index 0000000..d429001
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-1.f90
@@ -0,0 +1,123 @@
+! { dg-do run }
+!
+! This program checks that passing arrays as assumed-shape dummies to
+! and from Fortran functions with C binding works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ type(m) :: aa(imax,jmax)
+ integer :: i, j
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ call testc (aa)
+ call testf (aa)
+
+contains
+
+ ! C binding version
+
+ subroutine checkc (a, b) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:), b(:,:)
+ integer :: i, j
+
+ if (size (a,1) .ne. imax) stop 101
+ if (size (a,2) .ne. jmax) stop 102
+ if (size (b,1) .ne. jmax) stop 103
+ if (size (b,2) .ne. imax) stop 104
+
+ do j = 1, jmax
+ do i = 1, imax
+ if (a(i,j)%i .ne. i) stop 105
+ if (a(i,j)%j .ne. j) stop 106
+ if (b(j,i)%i .ne. i) stop 107
+ if (b(j,i)%j .ne. j) stop 108
+ end do
+ end do
+ end subroutine
+
+ ! Fortran binding version
+ subroutine checkf (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:), b(:,:)
+ integer :: i, j
+
+ if (size (a,1) .ne. imax) stop 201
+ if (size (a,2) .ne. jmax) stop 202
+ if (size (b,1) .ne. jmax) stop 203
+ if (size (b,2) .ne. imax) stop 204
+
+ do j = 1, jmax
+ do i = 1, imax
+ if (a(i,j)%i .ne. i) stop 205
+ if (a(i,j)%j .ne. j) stop 206
+ if (b(j,i)%i .ne. i) stop 207
+ if (b(j,i)%j .ne. j) stop 208
+ end do
+ end do
+ end subroutine
+
+ ! C binding version
+ subroutine testc (a) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m) :: b(jmax, imax)
+ integer :: i, j
+
+ if (size (a,1) .ne. imax) stop 301
+ if (size (a,2) .ne. jmax) stop 302
+ do j = 1, jmax
+ do i = 1, imax
+ b(j,i)%i = a(i,j)%i
+ b(j,i)%j = a(i,j)%j
+ end do
+ end do
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, b)
+ call checkf (a, b)
+ end subroutine
+
+ ! Fortran binding version
+ subroutine testf (a)
+ use iso_c_binding
+ use mm
+ type(m) :: a(:,:)
+ type(m) :: b(jmax, imax)
+ integer :: i, j
+
+ if (size (a,1) .ne. imax) stop 401
+ if (size (a,2) .ne. jmax) stop 402
+ do j = 1, jmax
+ do i = 1, imax
+ b(j,i)%i = a(i,j)%i
+ b(j,i)%j = a(i,j)%j
+ end do
+ end do
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, b)
+ call checkf (a, b)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-2.f90
new file mode 100644
index 0000000..d9b4957
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-2.f90
@@ -0,0 +1,97 @@
+! { dg-do run }
+!
+! This program checks that passing arrays as assumed-rank dummies to
+! and from Fortran functions with C binding works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imax=10, jmax=5
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ type(m) :: aa(imax,jmax)
+ integer :: i, j
+ do j = 1, jmax
+ do i = 1, imax
+ aa(i,j)%i = i
+ aa(i,j)%j = j
+ end do
+ end do
+
+ call testc (aa)
+ call testf (aa)
+
+contains
+
+ ! C binding version
+
+ subroutine checkc (a, b) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(..), b(..)
+
+ if (rank (a) .ne. 2) stop 101
+ if (rank (b) .ne. 2) stop 102
+ if (size (a,1) .ne. imax) stop 103
+ if (size (a,2) .ne. jmax) stop 104
+ if (size (b,1) .ne. jmax) stop 105
+ if (size (b,2) .ne. imax) stop 106
+
+ end subroutine
+
+ ! Fortran binding version
+ subroutine checkf (a, b)
+ use iso_c_binding
+ use mm
+ type(m) :: a(..), b(..)
+
+ if (rank (a) .ne. 2) stop 201
+ if (rank (b) .ne. 2) stop 202
+ if (size (a,1) .ne. imax) stop 203
+ if (size (a,2) .ne. jmax) stop 204
+ if (size (b,1) .ne. jmax) stop 205
+ if (size (b,2) .ne. imax) stop 206
+
+ end subroutine
+
+ ! C binding version
+ subroutine testc (a) bind (c)
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m) :: b(jmax, imax)
+
+ if (rank (a) .ne. 2) stop 301
+ if (size (a,1) .ne. imax) stop 302
+ if (size (a,2) .ne. jmax) stop 303
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, b)
+ call checkf (a, b)
+ end subroutine
+
+ ! Fortran binding version
+ subroutine testf (a)
+ use iso_c_binding
+ use mm
+ type(m) :: a(..)
+ type(m) :: b(jmax, imax)
+
+ if (rank (a) .ne. 2) stop 401
+ if (size (a,1) .ne. imax) stop 402
+ if (size (a,2) .ne. jmax) stop 403
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, b)
+ call checkf (a, b)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-3.f90
new file mode 100644
index 0000000..13ec851
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-3.f90
@@ -0,0 +1,148 @@
+! { dg-do run }
+!
+! This program checks that passing allocatable and pointer scalars to
+! and from Fortran functions with C binding works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+
+ integer, parameter :: imagic=-1, jmagic=42
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ type(m), allocatable :: a
+ type(m), target :: t
+ type(m), pointer :: p
+
+ p => NULL()
+
+ call testc (a, t, p)
+ call testf (a, t, p)
+
+contains
+
+ ! C binding version
+
+ subroutine checkc (a, t, p, initp) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a
+ type(m), target :: t
+ type(m), pointer :: p
+ logical, value :: initp
+
+ if (initp) then
+ if (.not. allocated (a)) stop 101
+ if (a%i .ne. imagic) stop 102
+ if (a%j .ne. jmagic) stop 103
+ if (.not. associated (p)) stop 104
+ if (.not. associated (p, t)) stop 105
+ if (p%i .ne. imagic) stop 106
+ if (p%j .ne. jmagic) stop 107
+ else
+ if (allocated (a)) stop 108
+ if (associated (p)) stop 109
+ end if
+
+ if (rank (a) .ne. 0) stop 110
+ if (rank (t) .ne. 0) stop 111
+ if (rank (p) .ne. 0) stop 112
+
+ end subroutine
+
+ ! Fortran binding version
+ subroutine checkf (a, t, p, initp)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a
+ type(m), target :: t
+ type(m), pointer :: p
+ logical, value :: initp
+
+ if (initp) then
+ if (.not. allocated (a)) stop 201
+ if (a%i .ne. imagic) stop 202
+ if (a%j .ne. jmagic) stop 203
+ if (.not. associated (p)) stop 204
+ if (.not. associated (p, t)) stop 205
+ if (p%i .ne. imagic) stop 206
+ if (p%j .ne. jmagic) stop 207
+ else
+ if (allocated (a)) stop 208
+ if (associated (p)) stop 209
+ end if
+
+ if (rank (a) .ne. 0) stop 210
+ if (rank (t) .ne. 0) stop 211
+ if (rank (p) .ne. 0) stop 212
+
+ end subroutine
+
+ ! C binding version
+ subroutine testc (a, t, p) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a
+ type(m), target :: t
+ type(m), pointer :: p
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ ! Allocate/associate and check again.
+ allocate (a)
+ a%i = imagic
+ a%j = jmagic
+ p => t
+ t%i = imagic
+ t%j = jmagic
+ call checkc (a, t, p, .true.)
+ call checkf (a, t, p, .true.)
+
+ ! Reset and check a third time.
+ deallocate (a)
+ p => NULL ()
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ end subroutine
+
+ ! Fortran binding version
+ subroutine testf (a, t, p)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a
+ type(m), target :: t
+ type(m), pointer :: p
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ ! Allocate/associate and check again.
+ allocate (a)
+ a%i = imagic
+ a%j = jmagic
+ p => t
+ t%i = imagic
+ t%j = jmagic
+ call checkc (a, t, p, .true.)
+ call checkf (a, t, p, .true.)
+
+ ! Reset and check a third time.
+ deallocate (a)
+ p => NULL ()
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-4.f90
new file mode 100644
index 0000000..fd15d06
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-4.f90
@@ -0,0 +1,198 @@
+! { dg-do run }
+!
+! This program checks that passing allocatable and pointer arrays to
+! and from Fortran functions with C binding works.
+
+module mm
+ use iso_c_binding
+ type, bind (c) :: m
+ integer(C_INT) :: i, j
+ end type
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ type(m), allocatable :: a(:)
+ type(m), target :: t(3,10)
+ type(m), pointer :: p(:,:)
+
+ p => NULL()
+
+ call testc (a, t, p)
+ call testf (a, t, p)
+
+contains
+
+ ! C binding version
+
+ subroutine checkc (a, t, p, initp) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:)
+ type(m), target :: t(3,10)
+ type(m), pointer :: p(:,:)
+ logical, value :: initp
+ integer :: i, j
+
+ if (rank (a) .ne. 1) stop 101
+ if (rank (t) .ne. 2) stop 102
+ if (rank (p) .ne. 2) stop 103
+
+ if (initp) then
+ if (.not. allocated (a)) stop 104
+ if (.not. associated (p)) stop 105
+ if (.not. associated (p, t)) stop 106
+ if (size (a, 1) .ne. 5) stop 107
+ if (size (p, 1) .ne. 3) stop 108
+ if (size (p, 2) .ne. 10) stop 109
+ else
+ if (allocated (a)) stop 121
+ if (associated (p)) stop 122
+ end if
+
+ end subroutine
+
+ ! Fortran binding version
+ subroutine checkf (a, t, p, initp)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:)
+ type(m), target :: t(3,10)
+ type(m), pointer :: p(:,:)
+ logical, value :: initp
+ integer :: i, j
+
+ if (rank (a) .ne. 1) stop 201
+ if (rank (t) .ne. 2) stop 202
+ if (rank (p) .ne. 2) stop 203
+
+ if (initp) then
+ if (.not. allocated (a)) stop 204
+ if (.not. associated (p)) stop 205
+ if (.not. associated (p, t)) stop 206
+ if (size (a, 1) .ne. 5) stop 207
+ if (size (p, 1) .ne. 3) stop 208
+ if (size (p, 2) .ne. 10) stop 209
+ else
+ if (allocated (a)) stop 221
+ if (associated (p)) stop 222
+ end if
+
+ end subroutine
+
+ ! C binding version
+ subroutine allocatec (a, t, p) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:)
+ type(m), target :: t(3,10)
+ type(m), pointer :: p(:,:)
+
+ allocate (a(10:20))
+ p => t
+ end subroutine
+
+ ! Fortran binding version
+ subroutine allocatef (a, t, p) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:)
+ type(m), target :: t(3,10)
+ type(m), pointer :: p(:,:)
+
+ allocate (a(5:15))
+ p => t
+ end subroutine
+
+ ! C binding version
+ subroutine testc (a, t, p) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:)
+ type(m), target :: t(3,10)
+ type(m), pointer :: p(:,:)
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ ! Allocate/associate and check again.
+ allocate (a(5))
+ p => t
+ call checkc (a, t, p, .true.)
+ call checkf (a, t, p, .true.)
+
+ ! Reset and check a third time.
+ deallocate (a)
+ p => NULL ()
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ ! Allocate/associate inside a function with Fortran binding.
+ call allocatef (a, t, p)
+ if (.not. allocated (a)) stop 301
+ if (.not. associated (p)) stop 302
+ if (lbound (a, 1) .ne. 5) stop 303
+ if (ubound (a, 1) .ne. 15) stop 304
+ deallocate (a)
+ p => NULL ()
+
+ ! Allocate/associate inside a function with C binding.
+ call allocatec (a, t, p)
+ if (.not. allocated (a)) stop 311
+ if (.not. associated (p)) stop 312
+ if (lbound (a, 1) .ne. 10) stop 313
+ if (ubound (a, 1) .ne. 20) stop 314
+ deallocate (a)
+ p => NULL ()
+
+ end subroutine
+
+ ! Fortran binding version
+ subroutine testf (a, t, p)
+ use iso_c_binding
+ use mm
+ type(m), allocatable :: a(:)
+ type(m), target :: t(3,10)
+ type(m), pointer :: p(:,:)
+
+ ! Call both the C and Fortran binding check functions
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ ! Allocate/associate and check again.
+ allocate (a(5))
+ p => t
+ call checkc (a, t, p, .true.)
+ call checkf (a, t, p, .true.)
+
+ ! Reset and check a third time.
+ deallocate (a)
+ p => NULL ()
+ call checkc (a, t, p, .false.)
+ call checkf (a, t, p, .false.)
+
+ ! Allocate/associate inside a function with Fortran binding.
+ call allocatef (a, t, p)
+ if (.not. allocated (a)) stop 401
+ if (.not. associated (p)) stop 402
+ if (lbound (a, 1) .ne. 5) stop 403
+ if (ubound (a, 1) .ne. 15) stop 404
+ deallocate (a)
+ p => NULL ()
+
+ ! Allocate/associate inside a function with C binding.
+ call allocatec (a, t, p)
+ if (.not. allocated (a)) stop 411
+ if (.not. associated (p)) stop 412
+ if (lbound (a, 1) .ne. 10) stop 413
+ if (ubound (a, 1) .ne. 20) stop 414
+ deallocate (a)
+ p => NULL ()
+
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-5.f90 b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-5.f90
new file mode 100644
index 0000000..2420b7d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-5.f90
@@ -0,0 +1,61 @@
+! PR92482
+! { dg-do run }
+!
+! This program checks that passing arrays as assumed-length character
+! dummies to and from Fortran functions with C binding works.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ character(len=26,kind=C_CHAR) :: aa
+
+ call testc (aa)
+ call testf (aa)
+
+contains
+
+ ! C binding version
+
+ subroutine checkc (a) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(len=*,kind=C_CHAR) :: a
+
+ if (rank (a) .ne. 0) stop 101
+ if (len (a) .ne. 26) stop 102
+ if (a .ne. 'abcdefghijklmnopqrstuvwxyz') stop 103
+ end subroutine
+
+ ! Fortran binding version
+ subroutine checkf (a)
+ use iso_c_binding
+ character(len=*,kind=C_CHAR) :: a
+
+ if (rank (a) .ne. 0) stop 201
+ if (len (a) .ne. 26) stop 202
+ if (a .ne. 'abcdefghijklmnopqrstuvwxyz') stop 203
+ end subroutine
+
+ ! C binding version
+ subroutine testc (a) bind (c) ! { dg-bogus "Sorry" "pr92482" { xfail *-*-* } }
+ use iso_c_binding
+ character(len=*,kind=C_CHAR) :: a
+
+ ! Call both the C and Fortran binding check functions
+ a = 'abcdefghijklmnopqrstuvwxyz'
+ call checkc (a)
+ call checkf (a)
+ end subroutine
+
+ ! Fortran binding version
+ subroutine testf (a)
+ use iso_c_binding
+ character(len=*,kind=C_CHAR) :: a
+
+ ! Call both the C and Fortran binding check functions
+ a = 'abcdefghijklmnopqrstuvwxyz'
+ call checkc (a)
+ call checkf (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-6.f90 b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-6.f90
new file mode 100644
index 0000000..8b1167e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-6.f90
@@ -0,0 +1,71 @@
+! Reported as pr94070.
+! { dg-do run { xfail *-*-* } }
+!
+! This program checks that passing assumed-size arrays to
+! and from Fortran functions with C binding works.
+!
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ ! Assumed-size arrays are not passed by descriptor. What we'll do
+ ! for this test function is bind an assumed-rank dummy
+ ! to the assumed-size array. This is supposed to fill in the descriptor
+ ! with information about the array present at the call site.
+ interface
+ subroutine ctest (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ end subroutine
+ end interface
+
+ integer(C_INT), target :: aa(10,5:8)
+
+ ! To get an assumed-size array descriptor, we have to first pass the
+ ! fixed-size array to a Fortran function with an assumed-size dummy,
+ call ftest1 (aa)
+ call ftest2 (aa)
+ call ftest3 (aa)
+
+contains
+ subroutine ftest1 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,*)
+ call testf (a)
+ call testc (a)
+ end subroutine
+ subroutine ftest2 (a)
+ use iso_c_binding
+ integer(C_INT) :: a(10,5:*)
+ call testf (a)
+ call testc (a)
+ end subroutine
+ subroutine ftest3 (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(10,1:*)
+ call testf (a)
+ call testc (a)
+ end subroutine
+
+ subroutine testf (a)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ if (rank (a) .ne. 2) stop 101
+ print *, size (a, 1), size (a, 2)
+ if (size (a, 1) .ne. 10) stop 102
+ if (size (a, 2) .ne. -1) stop 103
+ if (any (lbound (a) .eq. 0)) stop 104
+ end subroutine
+
+ subroutine testc (a) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(..)
+ if (rank (a) .ne. 2) stop 201
+ print *, size (a, 1), size (a, 2)
+ if (size (a, 1) .ne. 10) stop 202
+ if (size (a, 2) .ne. -1) stop 203
+ if (any (lbound (a) .eq. 0)) stop 204
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-7.f90 b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-7.f90
new file mode 100644
index 0000000..3d3c772
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ff-descriptor-7.f90
@@ -0,0 +1,89 @@
+! { dg-do run }
+!
+! Test that arrays that may not be contiguous can be passed both ways
+! between Fortran subroutines with C and Fortran binding conventions.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ integer(C_INT), target :: aa(10,5)
+ integer(C_INT), target :: bb(10,10)
+
+ integer :: i, j, n
+
+ ! Test both C and Fortran binding.
+ n = 0
+ do j = 1, 10
+ do i = 1, 5
+ aa(j,i) = n
+ n = n + 1
+ end do
+ end do
+ call testc (transpose (aa))
+ call testf (transpose (aa))
+
+ bb = -1
+ n = 0
+ do j = 1, 10
+ do i = 2, 10, 2
+ bb(i,j) = n
+ n = n + 1
+ end do
+ end do
+ call testc (bb(2:10:2, :))
+ call testf (bb(2:10:2, :))
+
+contains
+
+ subroutine testc (a) bind (c)
+ use iso_c_binding
+ integer(C_INT), intent(in) :: a(:,:)
+ call checkc (a)
+ call checkf (a)
+ end subroutine
+
+ subroutine testf (a)
+ use iso_c_binding
+ integer(C_INT), intent(in) :: a(:,:)
+ call checkc (a)
+ call checkf (a)
+ end subroutine
+
+ subroutine checkc (a) bind (c)
+ use iso_c_binding
+ integer(C_INT), intent(in) :: a(:,:)
+ integer :: i, j, n
+
+ if (rank (a) .ne. 2) stop 101
+ if (size (a, 1) .ne. 5) stop 102
+ if (size (a, 2) .ne. 10) stop 103
+
+ n = 0
+ do j = 1, 10
+ do i = 1, 5
+ if (a(i,j) .ne. n) stop 104
+ n = n + 1
+ end do
+ end do
+ end subroutine
+
+ subroutine checkf (a)
+ use iso_c_binding
+ integer(C_INT), intent(in) :: a(:,:)
+ integer :: i, j, n
+
+ if (rank (a) .ne. 2) stop 101
+ if (size (a, 1) .ne. 5) stop 102
+ if (size (a, 2) .ne. 10) stop 103
+
+ n = 0
+ do j = 1, 10
+ do i = 1, 5
+ if (a(i,j) .ne. n) stop 104
+ n = n + 1
+ end do
+ end do
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/note-5-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/note-5-3.f90
new file mode 100644
index 0000000..253f0ef
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/note-5-3.f90
@@ -0,0 +1,55 @@
+! { dg-do run }
+!
+! TS 29113
+! NOTE 5.3
+! The intrinsic inquiry function RANK can be used to inquire about the
+! rank of a data object. The rank of an assumed-rank object is zero if
+! the rank of the corresponding actual argument is zero.
+
+program test
+
+ integer :: scalar, array_1d(10), array_2d(3, 3)
+
+ call testit (scalar, array_1d, array_2d)
+
+contains
+
+ function test_rank (a)
+ integer :: test_rank
+ integer :: a(..)
+
+ test_rank = rank (a)
+ end function
+
+ subroutine testit (a0, a1, a2)
+ integer :: a0(..), a1(..), a2(..)
+
+ integer, target :: b0, b1(10), b2(3, 3)
+ integer, allocatable :: c0, c1(:), c2(:,:)
+ integer, pointer :: d0, d1(:), d2(:,:)
+
+ ! array descriptor passed from caller through testit to test_rank
+ if (test_rank (a0) .ne. 0) stop 100
+ if (test_rank (a1) .ne. 1) stop 101
+ if (test_rank (a2) .ne. 2) stop 102
+
+ ! array descriptor created locally here, fixed size
+ if (test_rank (b0) .ne. 0) stop 200
+ if (test_rank (b1) .ne. 1) stop 201
+ if (test_rank (b2) .ne. 2) stop 202
+
+ ! allocatable arrays don't actually have to be allocated.
+ if (test_rank (c0) .ne. 0) stop 300
+ if (test_rank (c1) .ne. 1) stop 301
+ if (test_rank (c2) .ne. 2) stop 302
+
+ ! pointer arrays do need to point at something.
+ d0 => b0
+ d1 => b1
+ d2 => b2
+ if (test_rank (d0) .ne. 0) stop 400
+ if (test_rank (d1) .ne. 1) stop 401
+ if (test_rank (d2) .ne. 2) stop 402
+
+ end subroutine
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/note-5-4-c.c b/gcc/testsuite/gfortran.dg/c-interop/note-5-4-c.c
new file mode 100644
index 0000000..ab27846
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/note-5-4-c.c
@@ -0,0 +1,10 @@
+#include <ISO_Fortran_binding.h>
+
+extern int test_rank (CFI_cdesc_t *a);
+
+int test_rank (CFI_cdesc_t *a)
+{
+ if (!a)
+ return -1; /* Should not happen. */
+ return a->rank;
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/note-5-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/note-5-4.f90
new file mode 100644
index 0000000..9f3fc8e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/note-5-4.f90
@@ -0,0 +1,63 @@
+! { dg-do run }
+! { dg-additional-sources note-5-4-c.c }
+!
+! TS 29113
+! NOTE 5.4
+! Assumed rank is an attribute of a Fortran dummy argument. When a C
+! function is invoked with an actual argument that corresponds to an
+! assumed-rank dummy argument in a Fortran interface for that C function,
+! the corresponding formal parameter is the address of a descriptor of
+! type CFI_cdesc_t (8.7). The rank member of the descriptor provides the
+! rank of the actual argument. The C function should therefore be able
+! to handle any rank. On each invocation, the rank is available to it.
+
+program test
+
+ interface
+ function test_rank (a) bind (c, name="test_rank")
+ integer :: test_rank
+ integer :: a(..)
+ end function
+ end interface
+
+ integer :: scalar, array_1d(10), array_2d(3, 3)
+
+ call testit (scalar, array_1d, array_2d)
+
+contains
+
+ subroutine testit (a0, a1, a2)
+ integer :: a0(..), a1(..), a2(..)
+
+ integer, target :: b0, b1(10), b2(3, 3)
+ integer, allocatable :: c0, c1(:), c2(:,:)
+ integer, pointer :: d0, d1(:), d2(:,:)
+
+ ! array descriptor passed from caller through testit to test_rank
+ if (test_rank (a0) .ne. 0) stop 100
+ if (test_rank (a1) .ne. 1) stop 101
+ if (test_rank (a2) .ne. 2) stop 102
+
+ ! array descriptor created locally here, fixed size
+ if (test_rank (b0) .ne. 0) stop 200
+ if (test_rank (b1) .ne. 1) stop 201
+ if (test_rank (b2) .ne. 2) stop 202
+
+ ! allocatables
+ allocate (c0)
+ allocate (c1 (10))
+ allocate (c2 (3, 3))
+ if (test_rank (c0) .ne. 0) stop 300
+ if (test_rank (c1) .ne. 1) stop 301
+ if (test_rank (c2) .ne. 2) stop 302
+
+ ! pointers
+ d0 => b0
+ d1 => b1
+ d2 => b2
+ if (test_rank (d0) .ne. 0) stop 400
+ if (test_rank (d1) .ne. 1) stop 401
+ if (test_rank (d2) .ne. 2) stop 402
+
+ end subroutine
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/optional-c.c b/gcc/testsuite/gfortran.dg/c-interop/optional-c.c
new file mode 100644
index 0000000..9612d28
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/optional-c.c
@@ -0,0 +1,82 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ftest (int n, CFI_cdesc_t *a, int *b, char *c, double *d);
+extern void ctest1 (CFI_cdesc_t *a, int *b, char *c, double *d);
+extern void ctest2 (int n, CFI_cdesc_t *a, int *b, char *c, double *d);
+
+static void *aa;
+static int *bb;
+static char *cc;
+static double *dd;
+
+extern void
+ctest1 (CFI_cdesc_t *a, int *b, char *c, double *d)
+{
+ /* Cache all the pointer arguments for later use by ctest2. */
+ aa = a->base_addr;
+ bb = b;
+ cc = c;
+ dd = d;
+
+ /* Test calling back into Fortran. */
+ ftest (0, NULL, NULL, NULL, NULL);
+ ftest (1, a, NULL, NULL, NULL);
+ ftest (2, a, b, NULL, NULL);
+ ftest (3, a, b, c, NULL);
+ ftest (4, a, b, c, d);
+}
+
+extern void
+ctest2 (int n, CFI_cdesc_t *a, int *b, char *c, double *d)
+{
+ if (n >= 1)
+ {
+ if (!a)
+ abort ();
+ if (a->base_addr != aa)
+ abort ();
+ }
+ else
+ if (a)
+ abort ();
+
+ if (n >= 2)
+ {
+ if (!b)
+ abort ();
+ if (*b != *bb)
+ abort ();
+ }
+ else
+ if (b)
+ abort ();
+
+ if (n >= 3)
+ {
+ if (!c)
+ abort ();
+ if (*c != *cc)
+ abort ();
+ }
+ else
+ if (c)
+ abort ();
+
+ if (n >= 4)
+ {
+ if (!d)
+ abort ();
+ if (*d != *dd)
+ abort ();
+ }
+ else
+ if (d)
+ abort ();
+
+}
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/optional.f90 b/gcc/testsuite/gfortran.dg/c-interop/optional.f90
new file mode 100644
index 0000000..2a30410
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/optional.f90
@@ -0,0 +1,114 @@
+! { dg-do run }
+! { dg-additional-sources "optional-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! TS 29113
+! 8.7 An absent actual argument in a reference to an interoperable
+! procedure is indicated by a corresponding formal parameter with the
+! value of a null pointer. An absent optional dummy argument in a
+! reference to an interoperable procedure from a C function is indicated
+! by a corresponding argument with the value of a null pointer.
+
+module m
+ use iso_c_binding
+ integer(C_INT) :: aa(32)
+ integer(C_INT) :: bb
+ character(C_CHAR) :: cc
+ real(C_DOUBLE) :: dd
+end module
+
+subroutine ftest (n, a, b, c, d) bind (c)
+ use iso_c_binding
+ use m
+ implicit none
+ integer(C_INT), value :: n
+ integer(C_INT), optional :: a(:)
+ integer(C_INT), optional :: b
+ character(C_CHAR), optional :: c
+ real(C_DOUBLE), optional :: d
+
+ if (n .ge. 1) then
+ if (.not. present (a)) stop 101
+ if (any (a .ne. aa)) stop 201
+ else
+ if (present (a)) stop 301
+ end if
+
+ if (n .ge. 2) then
+ if (.not. present (b)) stop 102
+ if (b .ne. bb) stop 201
+ else
+ if (present (b)) stop 302
+ end if
+
+ if (n .ge. 3) then
+ if (.not. present (c)) stop 103
+ if (c .ne. cc) stop 201
+ else
+ if (present (c)) stop 303
+ end if
+
+ if (n .ge. 4) then
+ if (.not. present (d)) stop 104
+ if (d .ne. dd) stop 201
+ else
+ if (present (d)) stop 304
+ end if
+end subroutine
+
+program testit
+ use iso_c_binding
+ use m
+ implicit none
+
+ interface
+ subroutine ctest1 (a, b, c, d) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: a(:)
+ integer(C_INT) :: b
+ character(C_CHAR) :: c
+ real(C_DOUBLE) :: d
+ end subroutine
+ subroutine ctest2 (n, a, b, c, d) bind (c)
+ use iso_c_binding
+ integer(C_INT), value :: n
+ integer(C_INT), optional :: a(:)
+ integer(C_INT), optional :: b
+ character(C_CHAR), optional :: c
+ real(C_DOUBLE), optional :: d
+ end subroutine
+ subroutine ftest (n, a, b, c, d) bind (c)
+ use iso_c_binding
+ integer(C_INT), value :: n
+ integer(C_INT), optional :: a(:)
+ integer(C_INT), optional :: b
+ character(C_CHAR), optional :: c
+ real(C_DOUBLE), optional :: d
+ end subroutine
+ end interface
+
+
+ ! Initialize the variables above.
+ integer :: i
+ do i = 1, 32
+ aa(i) = i
+ end do
+ bb = 42
+ cc = '$'
+ dd = acos(-1.D0)
+
+ call ftest (0)
+ call ftest (1, aa)
+ call ftest (2, aa, bb)
+ call ftest (3, aa, bb, cc)
+ call ftest (4, aa, bb, cc, dd)
+
+ call ctest1 (aa, bb, cc, dd)
+ call ctest2 (0)
+ call ctest2 (1, aa)
+ call ctest2 (2, aa, bb)
+ call ctest2 (3, aa, bb, cc)
+ call ctest2 (4, aa, bb, cc, dd)
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/rank-class.f90 b/gcc/testsuite/gfortran.dg/c-interop/rank-class.f90
new file mode 100644
index 0000000..bbf1839
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/rank-class.f90
@@ -0,0 +1,88 @@
+! { dg-do run }
+!
+! TS 29113
+! 7.2 RANK (A)
+! Description. Rank of a data object.
+! Class. Inquiry function.
+! Argument.
+! A shall be a scalar or array of any type.
+! Result Characteristics. Default integer scalar.
+! Result Value. The result is the rank of A.
+
+module m
+
+ type :: base
+ integer :: a, b
+ end type
+
+ type, extends (base) :: derived
+ integer :: c
+ end type
+end module
+
+program test
+ use m
+
+ ! Define some arrays for testing.
+ type(derived), target :: x1(5)
+ type(derived) :: y1(0:9)
+ type(derived), pointer :: p1(:)
+ type(derived), allocatable :: a1(:)
+ type(derived), target :: x3(2,3,4)
+ type(derived) :: y3(0:1,-3:-1,4)
+ type(derived), pointer :: p3(:,:,:)
+ type(derived), allocatable :: a3(:,:,:)
+ type(derived) :: x
+
+ ! Test the 1-dimensional arrays.
+ if (rank (x1) .ne. 1) stop 201
+ call testit (x1, 1)
+ if (rank (y1) .ne. 1) stop 202
+ call testit (y1, 1)
+ if (rank (p1) .ne. 1) stop 203
+ p1 => x1
+ call testit (p1, 1)
+ if (rank (p1) .ne. 1) stop 204
+ if (rank (a1) .ne. 1) stop 205
+ allocate (a1(5))
+ if (rank (a1) .ne. 1) stop 206
+ call testit (a1, 1)
+
+ ! Test the multi-dimensional arrays.
+ if (rank (x3) .ne. 3) stop 207
+ call testit (x3, 3)
+ if (rank (y3) .ne. 3) stop 208
+ if (rank (p3) .ne. 3) stop 209
+ p3 => x3
+ call testit (p3, 3)
+ if (rank (p3) .ne. 3) stop 210
+ if (rank (a3) .ne. 3) stop 211
+ allocate (a3(2,3,4))
+ call testit (a3, 3)
+ if (rank (a3) .ne. 3) stop 212
+
+ ! Test scalars.
+ if (rank (x) .ne. 0) stop 213
+ call testit (x, 0)
+ call test0 (x)
+ if (rank (x1(1)) .ne. 0) stop 215
+ call test0 (x1(1))
+
+contains
+
+ subroutine testit (a, r)
+ use m
+ class(base) :: a(..)
+ integer :: r
+
+ if (r .ne. rank(a)) stop 101
+ end subroutine
+
+ subroutine test0 (a)
+ use m
+ class(base) :: a(..)
+ if (rank (a) .ne. 0) stop 103
+ call testit (a, 0)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/rank.f90 b/gcc/testsuite/gfortran.dg/c-interop/rank.f90
new file mode 100644
index 0000000..9bae575
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/rank.f90
@@ -0,0 +1,99 @@
+! { dg-do run }
+!
+! TS 29113
+! 7.2 RANK (A)
+! Description. Rank of a data object.
+! Class. Inquiry function.
+! Argument.
+! A shall be a scalar or array of any type.
+! Result Characteristics. Default integer scalar.
+! Result Value. The result is the rank of A.
+
+program test
+
+ ! Define some arrays for testing.
+ integer, target :: x1(5)
+ integer :: y1(0:9)
+ integer, pointer :: p1(:)
+ integer, allocatable :: a1(:)
+ integer, target :: x3(2,3,4)
+ integer :: y3(0:1,-3:-1,4)
+ integer, pointer :: p3(:,:,:)
+ integer, allocatable :: a3(:,:,:)
+ integer :: x
+
+ ! Test the 1-dimensional arrays.
+ if (rank (x1) .ne. 1) stop 201
+ call testit (x1, 1)
+ call test1 (x1)
+ if (rank (y1) .ne. 1) stop 202
+ call testit (y1, 1)
+ call test1 (y1)
+ if (rank (p1) .ne. 1) stop 203
+ p1 => x1
+ call testit (p1, 1)
+ if (rank (p1) .ne. 1) stop 204
+ call test1 (p1)
+ if (rank (a1) .ne. 1) stop 205
+ allocate (a1(5))
+ if (rank (a1) .ne. 1) stop 206
+ call testit (a1, 1)
+ call test1 (a1)
+
+ ! Test the multi-dimensional arrays.
+ if (rank (x3) .ne. 3) stop 207
+ call testit (x3, 3)
+ call test1 (x3)
+ call test3 (x3, 1, 2, 1, 3)
+ if (rank (y3) .ne. 3) stop 208
+ call test3 (y3, 0, 1, -3, -1)
+ if (rank (p3) .ne. 3) stop 209
+ p3 => x3
+ call testit (p3, 3)
+ call test1 (p3)
+ if (rank (p3) .ne. 3) stop 210
+ call test3 (p3, 1, 2, 1, 3)
+ if (rank (a3) .ne. 3) stop 211
+ allocate (a3(2,3,4))
+ call testit (a3, 3)
+ call test1 (a3)
+ if (rank (a3) .ne. 3) stop 212
+ call test3 (a3, 1, 2, 1, 3)
+
+ ! Test scalars.
+ if (rank (x) .ne. 0) stop 213
+ call testit (x, 0)
+ call test0 (x)
+ if (rank (-1) .ne. 0) stop 214
+ call test0 (-1)
+ if (rank (x1(1)) .ne. 0) stop 215
+ call test0 (x1(1))
+
+contains
+
+ subroutine testit (a, r)
+ integer :: a(..)
+ integer :: r
+
+ if (r .ne. rank(a)) stop 101
+ end subroutine
+
+ subroutine test0 (a)
+ integer :: a(..)
+ if (rank (a) .ne. 0) stop 103
+ call testit (a, 0)
+ end subroutine
+
+ subroutine test1 (a)
+ integer :: a(*)
+ call testit (a, 1)
+ end subroutine
+
+ subroutine test3 (a, l1, u1, l2, u2)
+ implicit none
+ integer :: l1, u1, l2, u2
+ integer :: a(l1:u1, l2:u2, *)
+ call testit (a, 3)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-1.f90
new file mode 100644
index 0000000..d2155ec
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-1.f90
@@ -0,0 +1,41 @@
+! { dg-do compile}
+!
+! TS 29113
+! 8.1 Removed restrictions on ISO_C_BINDING module procedures
+!
+! The subroutine C_F_POINTER from the intrinsic module ISO_C_BINDING has
+! the restriction in ISO/IEC 1539- 1:2010 that if FPTR is an array, it
+! shall be of interoperable type.
+!
+! [...]
+!
+! These restrictions are removed.
+
+module m
+ use ISO_C_BINDING
+ implicit none
+
+ ! An obvious example of a type that isn't interoperable is a
+ ! derived type without a bind(c) clause.
+
+ integer :: buflen
+ parameter (buflen=256)
+
+ type :: packet
+ integer :: size
+ integer(1) :: buf(buflen)
+ end type
+
+contains
+
+ subroutine test (ptr, n, packets)
+ type(C_PTR), intent(in) :: ptr
+ integer, intent(in) :: n
+ type(packet), pointer, intent(out) :: packets(:)
+
+ integer :: s(1)
+ s(1) = n
+
+ call c_f_pointer (ptr, packets, s)
+ end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-2.f90
new file mode 100644
index 0000000..3c49de3715
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-2.f90
@@ -0,0 +1,35 @@
+! { dg-do compile}
+!
+! TS 29113
+! 8.1 Removed restrictions on ISO_C_BINDING module procedures
+!
+! The function C_F_PROCPOINTER from the intrinsic module ISO_C_BINDING
+! has the restriction in ISO/IEC 1539-1:2010 that CPTR and FPTR shall
+! not be the C address and interface of a noninteroperable Fortran
+! procedure.
+!
+! [...]
+!
+! These restrictions are removed.
+
+module m
+ use ISO_C_BINDING
+ implicit none
+
+ ! Declare a non-interoperable Fortran procedure interface.
+ abstract interface
+ function foo (x, y)
+ integer :: foo
+ integer, intent (in) :: x, y
+ end function
+ end interface
+
+contains
+
+ subroutine test (cptr, fptr)
+ type(C_FUNPTR), intent(in) :: cptr
+ procedure (foo), pointer, intent(out) :: fptr
+
+ call c_f_procpointer (cptr, fptr)
+ end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-3.f90
new file mode 100644
index 0000000..b429e80
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-3.f90
@@ -0,0 +1,37 @@
+! { dg-do compile}
+!
+! TS 29113
+! 8.1 Removed restrictions on ISO_C_BINDING module procedures
+!
+! The function C_LOC from the intrinsic module ISO_C_BINDING has the
+! restriction in ISO/IEC 1539-1:2010 that if X is an array, it shall
+! be of interoperable type.
+!
+! [...]
+!
+! These restrictions are removed.
+
+module m
+ use ISO_C_BINDING
+ implicit none
+
+ ! An obvious example of a type that isn't interoperable is a
+ ! derived type without a bind(c) clause.
+
+ integer :: buflen
+ parameter (buflen=256)
+
+ type :: packet
+ integer :: size
+ integer(1) :: buf(buflen)
+ end type
+
+contains
+
+ subroutine test (packets, ptr)
+ type(packet), pointer, intent(in) :: packets(:)
+ type(C_PTR), intent(out) :: ptr
+
+ ptr = c_loc (packets)
+ end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-4.f90
new file mode 100644
index 0000000..b44defd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-4.f90
@@ -0,0 +1,34 @@
+! { dg-do compile}
+!
+! TS 29113
+! 8.1 Removed restrictions on ISO_C_BINDING module procedures
+!
+! [...]
+!
+! The function C_FUNLOC from the intrinsic module ISO_C_BINDING has
+! the restriction in ISO/IEC 1539-1:2010 that its argument shall be
+! interoperable.
+!
+! These restrictions are removed.
+
+module m
+ use ISO_C_BINDING
+ implicit none
+
+ ! Declare a non-interoperable Fortran procedure interface.
+ abstract interface
+ function foo (x, y)
+ integer :: foo
+ integer, intent (in) :: x, y
+ end function
+ end interface
+
+contains
+
+ subroutine test (fptr, cptr)
+ procedure (foo), pointer, intent(in) :: fptr
+ type(C_FUNPTR), intent(out) :: cptr
+
+ cptr = c_funloc (fptr)
+ end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-1-c.c b/gcc/testsuite/gfortran.dg/c-interop/section-1-c.c
new file mode 100644
index 0000000..7da86a4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-1-c.c
@@ -0,0 +1,135 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *a, int lb, int ub, int s, CFI_cdesc_t *r);
+
+/* Take a section of array A. OFF is the start index of A on the Fortran
+ side and the bounds LB and UB for the section to take are relative to
+ that base index. Store the result in R, which is supposed to be a pointer
+ array with lower bound 1. */
+
+void
+ctest (CFI_cdesc_t *a, int lb, int ub, int s, CFI_cdesc_t *r)
+{
+ CFI_index_t lb_array[1], ub_array[1], s_array[1];
+ CFI_index_t i, o;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ fprintf (stderr, "\n%s: lb=%d ub=%d s=%d\n",
+ (a->attribute == CFI_attribute_other) ? "non-pointer" : "pointer",
+ lb, ub, s);
+ dump_CFI_cdesc_t (a);
+ dump_CFI_cdesc_t (r);
+
+ /* Make sure we got a valid input descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(int))
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (a->type != CFI_type_int)
+ abort ();
+ if (a->attribute == CFI_attribute_other)
+ {
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ /* Adjust the 1-based bounds. */
+ lb = lb - 1;
+ ub = ub - 1;
+ }
+ /* For pointer arrays, the bounds use the same indexing as the lower
+ bound in the array descriptor. */
+
+ /* Make sure we got a valid output descriptor. */
+ if (r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(int))
+ abort ();
+ if (r->rank != 1)
+ abort ();
+ if (r->type != CFI_type_int)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+
+ /* Create an array section. */
+ lb_array[0] = lb;
+ ub_array[0] = ub;
+ s_array[0] = s;
+
+ check_CFI_status ("CFI_section",
+ CFI_section (r, a, lb_array, ub_array, s_array));
+
+ /* Check that the output descriptor is correct. */
+ dump_CFI_cdesc_t (r);
+ if (!r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(int))
+ abort ();
+ if (r->rank != 1)
+ abort ();
+ if (r->type != CFI_type_int)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+
+ /* Check the contents of the output array. */
+#if 0
+ for (o = r->dim[0].lower_bound, i = lb;
+ (s > 0 ? i <= ub : i >= ub);
+ o++, i += s)
+ {
+ int *input = (int *) CFI_address (a, &i);
+ int *output = (int *) CFI_address (r, &o);
+ fprintf (stderr, "a(%d) = %d, r(%d) = %d\n",
+ (int)i, *input, (int)o, *output);
+ }
+#endif
+ for (o = r->dim[0].lower_bound, i = lb;
+ (s > 0 ? i <= ub : i >= ub);
+ o++, i += s)
+ {
+ int *input = (int *) CFI_address (a, &i);
+ int *output = (int *) CFI_address (r, &o);
+ if (*input != *output)
+ abort ();
+ }
+
+ /* Force the output array to be 1-based. */
+ lb_array[0] = 1;
+ check_CFI_status ("CFI_setpointer", CFI_setpointer (r, r, lb_array));
+ /* Check that the output descriptor is correct. */
+ dump_CFI_cdesc_t (r);
+ if (!r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(int))
+ abort ();
+ if (r->rank != 1)
+ abort ();
+ if (r->type != CFI_type_int)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+ if (r->dim[0].lower_bound != 1)
+ abort ();
+
+ /* Check the contents of the output array again. */
+ for (o = r->dim[0].lower_bound, i = lb;
+ (s > 0 ? i <= ub : i >= ub);
+ o++, i += s)
+ {
+ int *input = (int *) CFI_address (a, &i);
+ int *output = (int *) CFI_address (r, &o);
+ if (*input != *output)
+ abort ();
+ }
+
+}
+
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-1.f90
new file mode 100644
index 0000000..4e54116
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-1.f90
@@ -0,0 +1,71 @@
+! { dg-do run }
+! { dg-additional-sources "section-1-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests basic use of the CFI_section C library function on
+! a 1-dimensional non-pointer/non-allocatable array, passed as an
+! assumed-shape dummy.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (a, lb, ub, s, r) bind (c)
+ use iso_c_binding
+ integer(C_INT), target :: a(:)
+ integer(C_INT), value :: lb, ub, s
+ integer(C_INT), pointer, intent(out) :: r(:)
+ end subroutine
+
+ end interface
+
+ integer(C_INT), target :: aa(32)
+ integer :: i
+
+ ! Initialize the test array by numbering its elements.
+ do i = 1, 32
+ aa(i) = i
+ end do
+
+ ! Try some cases with non-pointer input arrays.
+ call test (aa, 1, 32, 5, 13, 2) ! basic test
+ call test (aa, 4, 35, 5, 13, 2) ! non-default lower bound
+ call test (aa, 1, 32, 32, 16, -2) ! negative step
+
+contains
+
+ ! Test function for non-pointer array AA.
+ ! LO and HI are the bounds for the entire array.
+ ! LB, UB, and S describe the section to take, and use the
+ ! same indexing as LO and HI.
+ subroutine test (aa, lo, hi, lb, ub, s)
+ integer :: aa(lo:hi)
+ integer :: lo, hi, lb, ub, s
+
+ integer(C_INT), pointer :: rr(:)
+ integer :: i, o
+
+ ! Call the C function to put a section in rr.
+ ! The C function expects the section bounds to be 1-based.
+ nullify (rr)
+ call ctest (aa, lb - lo + 1, ub - lo + 1, s, rr)
+
+ ! Make sure the original array has not been modified.
+ do i = lo, hi
+ if (aa(i) .ne. i - lo + 1) stop 103
+ end do
+
+ ! Make sure the output array has the expected bounds and elements.
+ if (.not. associated (rr)) stop 111
+ if (lbound (rr, 1) .ne. 1) stop 112
+ if (ubound (rr, 1) .ne. (ub - lb)/s + 1) stop 113
+ o = 1
+ do i = lb, ub, s
+ if (rr(o) .ne. i - lo + 1) stop 114
+ o = o + 1
+ end do
+ end subroutine
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-1p.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-1p.f90
new file mode 100644
index 0000000..e483126
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-1p.f90
@@ -0,0 +1,75 @@
+! PR 101310
+! { dg-do run }
+! { dg-additional-sources "section-1-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests basic use of the CFI_section C library function on
+! a 1-dimensional pointer array.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest (p, lb, ub, s, r) bind (c)
+ use iso_c_binding
+ integer(C_INT), pointer :: p(:)
+ integer(C_INT), value :: lb, ub, s
+ integer(C_INT), pointer, intent(out) :: r(:)
+ end subroutine
+
+ end interface
+
+ integer(C_INT), target :: aa(32)
+ integer :: i
+
+ ! Initialize the test array by numbering its elements.
+ do i = 1, 32
+ aa(i) = i
+ end do
+
+ call test_p (aa, 0, 31, 15, 24, 3) ! zero lower bound
+ call test_p (aa, 1, 32, 16, 25, 3) ! non-zero lower bound
+ call test_p (aa, 4, 35, 16, 25, 3) ! some other lower bound
+ call test_p (aa, 1, 32, 32, 16, -2) ! negative step
+ stop
+
+contains
+
+ ! Test function for non-pointer array AA.
+ ! LO and HI are the bounds for the entire array.
+ ! LB, UB, and S describe the section to take, and use the
+ ! same indexing as LO and HI.
+ subroutine test_p (aa, lo, hi, lb, ub, s)
+ integer, target :: aa(1:hi-lo+1)
+ integer :: lo, hi, lb, ub, s
+
+ integer(C_INT), pointer :: pp(:), rr(:)
+ integer :: i, o
+
+ pp(lo:hi) => aa
+ if (lbound (pp, 1) .ne. lo) stop 121
+ if (ubound (pp, 1) .ne. hi) stop 122
+ nullify (rr)
+ call ctest (pp, lb, ub, s, rr)
+
+ ! Make sure the input pointer array has not been modified.
+ if (lbound (pp, 1) .ne. lo) stop 144
+ if (ubound (pp, 1) .ne. hi) stop 145
+ do i = lo, hi
+ if (pp(i) .ne. i - lo + 1) stop 146
+ end do
+
+ ! Make sure the output array has the expected bounds and elements.
+ if (.not. associated (rr)) stop 151
+ if (lbound (rr, 1) .ne. 1) stop 152
+ if (ubound (rr, 1) .ne. (ub - lb)/s + 1) stop 153
+ o = 1
+ do i = lb, ub, s
+ if (rr(o) .ne. i - lo + 1) stop 154
+ o = o + 1
+ end do
+ end subroutine
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-2-c.c b/gcc/testsuite/gfortran.dg/c-interop/section-2-c.c
new file mode 100644
index 0000000..f1ff1271
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-2-c.c
@@ -0,0 +1,175 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+struct m {
+ int x, y;
+};
+
+extern void ctest (CFI_cdesc_t *a, int lb0, int lb1,
+ int ub0, int ub1, int s0, int s1, CFI_cdesc_t *r);
+
+/* Take a section of array A. OFF is the start index of A on the Fortran
+ side and the bounds LB and UB for the section to take are relative to
+ that base index. Store the result in R, which is supposed to be a pointer
+ array with lower bound 1. */
+
+void
+ctest (CFI_cdesc_t *a, int lb0, int lb1,
+ int ub0, int ub1, int s0, int s1, CFI_cdesc_t *r)
+{
+ CFI_index_t lb_array[2], ub_array[2], s_array[2];
+ int i0, i1, o0, o1;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ fprintf (stderr, "\n%s: lb0=%d lb1=%d ub0=%d ub1=%d s0=%d s1=%d\n",
+ (a->attribute == CFI_attribute_other) ? "non-pointer" : "pointer",
+ lb0, lb1, ub0, ub1, s0, s1);
+ if (lb0 == ub0 || lb1 == ub1)
+ abort ();
+ dump_CFI_cdesc_t (a);
+ dump_CFI_cdesc_t (r);
+
+ /* Make sure we got a valid input descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(struct m))
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->type != CFI_type_struct)
+ abort ();
+ if (a->attribute == CFI_attribute_other)
+ {
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ /* Adjust the 1-based bounds. */
+ lb0 = lb0 - 1;
+ lb1 = lb1 - 1;
+ ub0 = ub0 - 1;
+ ub1 = ub1 - 1;
+ }
+ /* For pointer arrays, the bounds use the same indexing as the lower
+ bound in the array descriptor. */
+
+ /* Make sure we got a valid output descriptor. */
+ if (r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(struct m))
+ abort ();
+ if (r->rank != 2)
+ abort ();
+ if (r->type != CFI_type_struct)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+
+ /* Create an array section. */
+ lb_array[0] = lb0;
+ lb_array[1] = lb1;
+ ub_array[0] = ub0;
+ ub_array[1] = ub1;
+ s_array[0] = s0;
+ s_array[1] = s1;
+
+ check_CFI_status ("CFI_section",
+ CFI_section (r, a, lb_array, ub_array, s_array));
+
+ /* Check that the output descriptor is correct. */
+ dump_CFI_cdesc_t (r);
+ if (!r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(struct m))
+ abort ();
+ if (r->rank != 2)
+ abort ();
+ if (r->type != CFI_type_struct)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+
+ /* Check the contents of the output array. */
+#if 0
+ for (o1 = r->dim[1].lower_bound, i1 = lb1;
+ (s1 > 0 ? i1 <= ub1 : i1 >= ub1);
+ o1++, i1 += s1)
+ for (o0 = r->dim[0].lower_bound, i0 = lb0;
+ (s0 > 0 ? i0 <= ub0 : i0 >= ub0);
+ o0++, i0 += s0)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = i0;
+ index[1] = i1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o0;
+ index[1] = o1;
+ output = (struct m *) CFI_address (r, index);
+ fprintf (stderr, "a(%d,%d) = (%d,%d), r(%d,%d) = (%d,%d)\n",
+ i0, i1, input->x, input->y, o0, o1, output->x, output->y);
+ }
+#endif
+ for (o1 = r->dim[1].lower_bound, i1 = lb1;
+ (s1 > 0 ? i1 <= ub1 : i1 >= ub1);
+ o1++, i1 += s1)
+ for (o0 = r->dim[0].lower_bound, i0 = lb0;
+ (s0 > 0 ? i0 <= ub0 : i0 >= ub0);
+ o0++, i0 += s0)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = i0;
+ index[1] = i1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o0;
+ index[1] = o1;
+ output = (struct m *) CFI_address (r, index);
+ if (input->x != output->x || input->y != output->y)
+ abort ();
+ }
+
+ /* Force the output array to be 1-based. */
+ lb_array[0] = 1;
+ lb_array[1] = 1;
+ check_CFI_status ("CFI_setpointer", CFI_setpointer (r, r, lb_array));
+ /* Check that the output descriptor is correct. */
+ dump_CFI_cdesc_t (r);
+ if (!r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(struct m))
+ abort ();
+ if (r->rank != 2)
+ abort ();
+ if (r->type != CFI_type_struct)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+ if (r->dim[0].lower_bound != 1)
+ abort ();
+
+ /* Check the contents of the output array again. */
+ for (o1 = r->dim[1].lower_bound, i1 = lb1;
+ (s1 > 0 ? i1 <= ub1 : i1 >= ub1);
+ o1++, i1 += s1)
+ for (o0 = r->dim[0].lower_bound, i0 = lb0;
+ (s0 > 0 ? i0 <= ub0 : i0 >= ub0);
+ o0++, i0 += s0)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = i0;
+ index[1] = i1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o0;
+ index[1] = o1;
+ output = (struct m *) CFI_address (r, index);
+ if (input->x != output->x || input->y != output->y)
+ abort ();
+ }
+}
+
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-2.f90
new file mode 100644
index 0000000..73ad9ec
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-2.f90
@@ -0,0 +1,102 @@
+! { dg-do run }
+! { dg-additional-sources "section-2-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests basic use of the CFI_section C library function on
+! a 2-dimensional non-pointer array.
+
+module mm
+ use ISO_C_BINDING
+ type, bind (c) :: m
+ integer(C_INT) :: x, y
+ end type
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (a, lb0, lb1, ub0, ub1, s0, s1, r) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), target :: a(:,:)
+ integer(C_INT), value :: lb0, lb1, ub0, ub1, s0, s1
+ type(m), pointer, intent(out) :: r(:,:)
+ end subroutine
+
+ end interface
+
+ type(m), target :: aa(10, 20)
+ integer :: i0, i1
+
+ ! Initialize the test array by numbering its elements.
+ do i1 = 1, 20
+ do i0 = 1, 10
+ aa(i0, i1)%x = i0
+ aa(i0, i1)%y = i1
+ end do
+ end do
+
+ call test (aa, 4, 3, 10, 15, 2, 3) ! basic test
+ call test (aa, 10, 15, 4, 3, -2, -3) ! negative step
+ stop
+
+contains
+
+ ! Test function for non-pointer array AA.
+ ! LB, UB, and S describe the section to take.
+ subroutine test (aa, lb0, lb1, ub0, ub1, s0, s1)
+ use mm
+ type(m) :: aa(10,20)
+ integer :: lb0, lb1, ub0, ub1, s0, s1
+
+ type(m), pointer :: rr(:,:)
+ integer :: i0, i1, o0, o1
+ integer, parameter :: hi0 = 10
+ integer, parameter :: hi1 = 20
+
+ ! Make sure the original array is OK.
+ do i1 = 1, hi1
+ do i0 = 1, hi0
+ if (aa(i0,i1)%x .ne. i0) stop 101
+ if (aa(i0,i1)%y .ne. i1) stop 101
+ end do
+ end do
+
+ ! Call the C function to put a section in rr.
+ ! The C function expects the section bounds to be 1-based.
+ nullify (rr)
+ call ctest (aa, lb0, lb1, ub0, ub1, s0, s1, rr)
+
+ ! Make sure the original array has not been modified.
+ do i1 = 1, hi1
+ do i0 = 1, hi0
+ if (aa(i0,i1)%x .ne. i0) stop 103
+ if (aa(i0,i1)%y .ne. i1) stop 103
+ end do
+ end do
+
+ ! Make sure the output array has the expected bounds and elements.
+ if (.not. associated (rr)) stop 111
+ if (lbound (rr, 1) .ne. 1) stop 112
+ if (lbound (rr, 2) .ne. 1) stop 112
+ if (ubound (rr, 1) .ne. (ub0 - lb0)/s0 + 1) stop 113
+ if (ubound (rr, 2) .ne. (ub1 - lb1)/s1 + 1) stop 113
+ o1 = 1
+ do i1 = lb1, ub1, s1
+ o0 = 1
+ do i0 = lb0, ub0, s0
+ ! print 999, o0, o1, rr(o0,o1)%x, rr(o0,01)%y
+ ! 999 format ('rr(', i3, ',', i3, ') = (', i3, ',', i3, ')')
+ if (rr(o0,o1)%x .ne. i0) stop 114
+ if (rr(o0,o1)%y .ne. i1) stop 114
+ o0 = o0 + 1
+ end do
+ o1 = o1 + 1
+ end do
+ end subroutine
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-2p.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-2p.f90
new file mode 100644
index 0000000..f8a1745
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-2p.f90
@@ -0,0 +1,104 @@
+! PR 101310
+! { dg-do run }
+! { dg-additional-sources "section-2-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests basic use of the CFI_section C library function on
+! a 2-dimensional pointer array.
+
+module mm
+ use ISO_C_BINDING
+ type, bind (c) :: m
+ integer(C_INT) :: x, y
+ end type
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (p, lb0, lb1, ub0, ub1, s0, s1, r) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), pointer :: p(:,:)
+ integer(C_INT), value :: lb0, lb1, ub0, ub1, s0, s1
+ type(m), pointer, intent(out) :: r(:,:)
+ end subroutine
+
+ end interface
+
+ type(m), target :: aa(10, 20)
+ integer :: i0, i1
+
+ ! Initialize the test array by numbering its elements.
+ do i1 = 1, 20
+ do i0 = 1, 10
+ aa(i0, i1)%x = i0
+ aa(i0, i1)%y = i1
+ end do
+ end do
+
+ call test (aa, 0, 0, 3, 2, 9, 14, 2, 3) ! zero lower bound
+ call test (aa, 1, 1, 4, 3, 10, 15, 2, 3) ! lower bound 1
+ call test (aa, 6, 11, 9, 13, 15, 25, 2, 3) ! other lower bound
+ call test (aa, 1, 1, 10, 15, 4, 3, -2, -3) ! negative step
+ stop
+
+contains
+
+ ! Test function for pointer array AA.
+ ! The bounds of the array are adjusted so it is based at (LO0,LO1).
+ ! LB, UB, and S describe the section of the adjusted array to take.
+ subroutine test (aa, lo0, lo1, lb0, lb1, ub0, ub1, s0, s1)
+ use mm
+ type(m), target :: aa(1:10, 1:20)
+ integer :: lo0, lo1, lb0, lb1, ub0, ub1, s0, s1
+
+ type(m), pointer :: pp(:,:), rr(:,:)
+ integer :: i0, i1, o0, o1
+ integer :: hi0, hi1
+ hi0 = lo0 + 10 - 1
+ hi1 = lo1 + 20 - 1
+
+ pp(lo0:,lo1:) => aa
+ if (lbound (pp, 1) .ne. lo0) stop 121
+ if (lbound (pp, 2) .ne. lo1) stop 121
+ if (ubound (pp, 1) .ne. hi0) stop 122
+ if (ubound (pp, 2) .ne. hi1) stop 122
+ nullify (rr)
+ call ctest (pp, lb0, lb1, ub0, ub1, s0, s1, rr)
+
+ ! Make sure the input pointer array has not been modified.
+ if (lbound (pp, 1) .ne. lo0) stop 131
+ if (ubound (pp, 1) .ne. hi0) stop 132
+ if (lbound (pp, 2) .ne. lo1) stop 133
+ if (ubound (pp, 2) .ne. hi1) stop 134
+ do i1 = lo1, hi1
+ do i0 = lo0, hi0
+ if (pp(i0,i1)%x .ne. i0 - lo0 + 1) stop 135
+ if (pp(i0,i1)%y .ne. i1 - lo1 + 1) stop 136
+ end do
+ end do
+
+ ! Make sure the output array has the expected bounds and elements.
+ if (.not. associated (rr)) stop 141
+ if (lbound (rr, 1) .ne. 1) stop 142
+ if (lbound (rr, 2) .ne. 1) stop 142
+ if (ubound (rr, 1) .ne. (ub0 - lb0)/s0 + 1) stop 143
+ if (ubound (rr, 2) .ne. (ub1 - lb1)/s1 + 1) stop 143
+ o1 = 1
+ do i1 = lb1, ub1, s1
+ o0 = 1
+ do i0 = lb0, ub0, s0
+ if (rr(o0,o1)%x .ne. i0 - lo0 + 1) stop 144
+ if (rr(o0,o1)%y .ne. i1 - lo1 + 1) stop 144
+ o0 = o0 + 1
+ end do
+ o1 = o1 + 1
+ end do
+ end subroutine
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-3-c.c b/gcc/testsuite/gfortran.dg/c-interop/section-3-c.c
new file mode 100644
index 0000000..819b58f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-3-c.c
@@ -0,0 +1,235 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+struct m {
+ int x, y;
+};
+
+extern void ctest (CFI_cdesc_t *a, int lb0, int lb1,
+ int ub0, int ub1, int s0, int s1, CFI_cdesc_t *r);
+
+/* Take a section of array A. OFF is the start index of A on the Fortran
+ side and the bounds LB and UB for the section to take are relative to
+ that base index. Store the result in R, which is supposed to be a pointer
+ array with lower bound 1. */
+
+void
+ctest (CFI_cdesc_t *a, int lb0, int lb1,
+ int ub0, int ub1, int s0, int s1, CFI_cdesc_t *r)
+{
+ CFI_index_t lb_array[2], ub_array[2], s_array[2];
+ int i0, i1, o0, o1;
+
+ /* Dump the descriptor contents to test that we can access the fields
+ correctly, etc. */
+ fprintf (stderr, "\n%s: lb0=%d lb1=%d ub0=%d ub1=%d s0=%d s1=%d\n",
+ (a->attribute == CFI_attribute_other) ? "non-pointer" : "pointer",
+ lb0, lb1, ub0, ub1, s0, s1);
+ if (! (lb0 == ub0 || lb1 == ub1))
+ abort ();
+ dump_CFI_cdesc_t (a);
+ dump_CFI_cdesc_t (r);
+
+ /* Make sure we got a valid input descriptor. */
+ if (!a->base_addr)
+ abort ();
+ if (a->elem_len != sizeof(struct m))
+ abort ();
+ if (a->rank != 2)
+ abort ();
+ if (a->type != CFI_type_struct)
+ abort ();
+ if (a->attribute == CFI_attribute_other)
+ {
+ if (a->dim[0].lower_bound != 0)
+ abort ();
+ /* Adjust the 1-based bounds. */
+ lb0 = lb0 - 1;
+ lb1 = lb1 - 1;
+ ub0 = ub0 - 1;
+ ub1 = ub1 - 1;
+ }
+ /* For pointer arrays, the bounds use the same indexing as the lower
+ bound in the array descriptor. */
+
+ /* Make sure we got a valid output descriptor. */
+ if (r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(struct m))
+ abort ();
+ if (r->rank != 1)
+ abort ();
+ if (r->type != CFI_type_struct)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+
+ /* Create an array section. */
+ lb_array[0] = lb0;
+ lb_array[1] = lb1;
+ ub_array[0] = ub0;
+ ub_array[1] = ub1;
+ s_array[0] = s0;
+ s_array[1] = s1;
+
+ check_CFI_status ("CFI_section",
+ CFI_section (r, a, lb_array, ub_array, s_array));
+
+ /* Check that the output descriptor is correct. */
+ dump_CFI_cdesc_t (r);
+ if (!r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(struct m))
+ abort ();
+ if (r->rank != 1)
+ abort ();
+ if (r->type != CFI_type_struct)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+
+ /* Check the contents of the output array. */
+#if 0
+ if (lb1 == ub1)
+ {
+ /* Output is 1-d array that varies in dimension 0. */
+ for (o0 = r->dim[0].lower_bound, i0 = lb0;
+ (s0 > 0 ? i0 <= ub0 : i0 >= ub0);
+ o0++, i0 += s0)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = i0;
+ index[1] = lb1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o0;
+ output = (struct m *) CFI_address (r, index);
+ fprintf (stderr, "a(%d,%d) = (%d,%d), r(%d) = (%d,%d)\n",
+ i0, lb1, input->x, input->y, o0, output->x, output->y);
+ }
+ }
+ else if (lb0 == ub0)
+ {
+ /* Output is 1-d array that varies in dimension 1. */
+ for (o1 = r->dim[0].lower_bound, i1 = lb1;
+ (s1 > 0 ? i1 <= ub1 : i1 >= ub1);
+ o1++, i1 += s1)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = lb0;
+ index[1] = i1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o1;
+ output = (struct m *) CFI_address (r, index);
+ fprintf (stderr, "a(%d,%d) = (%d,%d), r(%d) = (%d,%d)\n",
+ lb0, i1, input->x, input->y, o1, output->x, output->y);
+ }
+ }
+ else
+ abort ();
+#endif
+ if (lb1 == ub1)
+ {
+ /* Output is 1-d array that varies in dimension 0. */
+ for (o0 = r->dim[0].lower_bound, i0 = lb0;
+ (s0 > 0 ? i0 <= ub0 : i0 >= ub0);
+ o0++, i0 += s0)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = i0;
+ index[1] = lb1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o0;
+ output = (struct m *) CFI_address (r, index);
+ if (input->x != output->x || input->y != output->y)
+ abort ();
+ }
+ }
+ else if (lb0 == ub0)
+ {
+ /* Output is 1-d array that varies in dimension 1. */
+ for (o1 = r->dim[0].lower_bound, i1 = lb1;
+ (s1 > 0 ? i1 <= ub1 : i1 >= ub1);
+ o1++, i1 += s1)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = lb0;
+ index[1] = i1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o1;
+ output = (struct m *) CFI_address (r, index);
+ if (input->x != output->x || input->y != output->y)
+ abort ();
+ }
+ }
+ else
+ abort ();
+
+ /* Force the output array to be 1-based. */
+ lb_array[0] = 1;
+ lb_array[1] = 1;
+ check_CFI_status ("CFI_setpointer", CFI_setpointer (r, r, lb_array));
+ /* Check that the output descriptor is correct. */
+ dump_CFI_cdesc_t (r);
+ if (!r->base_addr)
+ abort ();
+ if (r->elem_len != sizeof(struct m))
+ abort ();
+ if (r->rank != 1)
+ abort ();
+ if (r->type != CFI_type_struct)
+ abort ();
+ if (r->attribute != CFI_attribute_pointer)
+ abort ();
+ if (r->dim[0].lower_bound != 1)
+ abort ();
+
+ /* Check the contents of the output array again. */
+ if (lb1 == ub1)
+ {
+ /* Output is 1-d array that varies in dimension 0. */
+ for (o0 = r->dim[0].lower_bound, i0 = lb0;
+ (s0 > 0 ? i0 <= ub0 : i0 >= ub0);
+ o0++, i0 += s0)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = i0;
+ index[1] = lb1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o0;
+ output = (struct m *) CFI_address (r, index);
+ if (input->x != output->x || input->y != output->y)
+ abort ();
+ }
+ }
+ else if (lb0 == ub0)
+ {
+ /* Output is 1-d array that varies in dimension 1. */
+ for (o1 = r->dim[0].lower_bound, i1 = lb1;
+ (s1 > 0 ? i1 <= ub1 : i1 >= ub1);
+ o1++, i1 += s1)
+ {
+ CFI_index_t index[2];
+ struct m *input, *output;
+ index[0] = lb0;
+ index[1] = i1;
+ input = (struct m *) CFI_address (a, index);
+ index[0] = o1;
+ output = (struct m *) CFI_address (r, index);
+ if (input->x != output->x || input->y != output->y)
+ abort ();
+ }
+ }
+ else
+ abort ();
+}
+
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-3.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-3.f90
new file mode 100644
index 0000000..c690c50
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-3.f90
@@ -0,0 +1,103 @@
+! PR 101310
+! { dg-do run }
+! { dg-additional-sources "section-3-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests basic use of the CFI_section C library function to
+! take a slice of a 2-dimensional non-pointer array.
+
+module mm
+ use ISO_C_BINDING
+ type, bind (c) :: m
+ integer(C_INT) :: x, y
+ end type
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (a, lb0, lb1, ub0, ub1, s0, s1, r) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), target :: a(:,:)
+ integer(C_INT), value :: lb0, lb1, ub0, ub1, s0, s1
+ type(m), pointer, intent(out) :: r(:)
+ end subroutine
+
+ end interface
+
+ type(m), target :: aa(10, 20)
+ integer :: i0, i1
+
+ ! Initialize the test array by numbering its elements.
+ do i1 = 1, 20
+ do i0 = 1, 10
+ aa(i0, i1)%x = i0
+ aa(i0, i1)%y = i1
+ end do
+ end do
+
+ call test (aa, 3, 1, 3, 20, 0, 1) ! full slice 0
+ call test (aa, 1, 8, 10, 8, 1, 0) ! full slice 1
+ call test (aa, 3, 5, 3, 14, 0, 3) ! partial slice 0
+ call test (aa, 2, 8, 10, 8, 2, 0) ! partial slice 1
+ call test (aa, 3, 14, 3, 5, 0, -3) ! backwards slice 0
+ call test (aa, 10, 8, 2, 8, -2, 0) ! backwards slice 1
+
+contains
+
+ ! Test function for non-pointer array AA.
+ ! LB, UB, and S describe the section to take.
+ subroutine test (aa, lb0, lb1, ub0, ub1, s0, s1)
+ use mm
+ type(m) :: aa(10,20)
+ integer :: lb0, lb1, ub0, ub1, s0, s1
+
+ type(m), pointer :: rr(:)
+ integer :: i0, i1, o0, o1
+ integer, parameter :: hi0 = 10
+ integer, parameter :: hi1 = 20
+
+ ! Check the bounds actually specify a "slice" rather than a subarray.
+ if (lb0 .ne. ub0 .and. lb1 .ne. ub1) stop 100
+
+ ! Call the C function to put a section in rr.
+ ! The C function expects the section bounds to be 1-based.
+ nullify (rr)
+ call ctest (aa, lb0, lb1, ub0, ub1, s0, s1, rr)
+
+ ! Make sure the original array has not been modified.
+ do i1 = 1, hi1
+ do i0 = 1, hi0
+ if (aa(i0,i1)%x .ne. i0) stop 103
+ if (aa(i0,i1)%y .ne. i1) stop 103
+ end do
+ end do
+
+ ! Make sure the output array has the expected bounds and elements.
+ if (.not. associated (rr)) stop 111
+ if (lbound (rr, 1) .ne. 1) stop 112
+ if (ub0 .eq. lb0) then
+ if (ubound (rr, 1) .ne. (ub1 - lb1)/s1 + 1) stop 113
+ o1 = 1
+ do i1 = lb1, ub1, s1
+ if (rr(o1)%x .ne. lb0) stop 114
+ if (rr(o1)%y .ne. i1) stop 114
+ o1 = o1 + 1
+ end do
+ else
+ if (ubound (rr, 1) .ne. (ub0 - lb0)/s0 + 1) stop 113
+ o0 = 1
+ do i0 = lb0, ub0, s0
+ if (rr(o0)%x .ne. i0) stop 114
+ if (rr(o0)%y .ne. lb1) stop 114
+ o0 = o0 + 1
+ end do
+ end if
+ end subroutine
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-3p.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-3p.f90
new file mode 100644
index 0000000..9562b03
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-3p.f90
@@ -0,0 +1,127 @@
+! PR 101310
+! { dg-do run }
+! { dg-additional-sources "section-3-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests basic use of the CFI_section C library function to
+! take a slice of a 2-dimensional pointer array.
+
+module mm
+ use ISO_C_BINDING
+ type, bind (c) :: m
+ integer(C_INT) :: x, y
+ end type
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+ subroutine ctest (p, lb0, lb1, ub0, ub1, s0, s1, r) bind (c)
+ use iso_c_binding
+ use mm
+ type(m), pointer :: p(:,:)
+ integer(C_INT), value :: lb0, lb1, ub0, ub1, s0, s1
+ type(m), pointer, intent(out) :: r(:)
+ end subroutine
+
+ end interface
+
+ type(m), target :: aa(10, 20)
+ integer :: i0, i1
+
+ ! Initialize the test array by numbering its elements.
+ do i1 = 1, 20
+ do i0 = 1, 10
+ aa(i0, i1)%x = i0
+ aa(i0, i1)%y = i1
+ end do
+ end do
+
+ ! Zero lower bound
+ call test (aa, 0, 0, 2, 0, 2, 19, 0, 1) ! full slice 0
+ call test (aa, 0, 0, 0, 7, 9, 7, 1, 0) ! full slice 1
+ call test (aa, 0, 0, 2, 4, 2, 13, 0, 3) ! partial slice 0
+ call test (aa, 0, 0, 1, 7, 9, 7, 2, 0) ! partial slice 1
+ call test (aa, 0, 0, 2, 13, 2, 4, 0, -3) ! backwards slice 0
+ call test (aa, 0, 0, 9, 7, 1, 7, -2, 0) ! backwards slice 1
+
+ ! Lower bound 1
+ call test (aa, 1, 1, 3, 1, 3, 20, 0, 1) ! full slice 0
+ call test (aa, 1, 1, 1, 8, 10, 8, 1, 0) ! full slice 1
+ call test (aa, 1, 1, 3, 5, 3, 14, 0, 3) ! partial slice 0
+ call test (aa, 1, 1, 2, 8, 10, 8, 2, 0) ! partial slice 1
+ call test (aa, 1, 1, 3, 14, 3, 5, 0, -3) ! backwards slice 0
+ call test (aa, 1, 1, 10, 8, 2, 8, -2, 0) ! backwards slice 1
+
+ ! Some other lower bound
+ call test (aa, 2, 3, 4, 3, 4, 22, 0, 1) ! full slice 0
+ call test (aa, 2, 3, 2, 10, 11, 10, 1, 0) ! full slice 1
+ call test (aa, 2, 3, 4, 7, 4, 16, 0, 3) ! partial slice 0
+ call test (aa, 2, 3, 3, 10, 11, 10, 2, 0) ! partial slice 1
+ call test (aa, 2, 3, 4, 16, 4, 7, 0, -3) ! backwards slice 0
+ call test (aa, 2, 3, 11, 10, 3, 10, -2, 0) ! backwards slice 1
+
+contains
+
+ subroutine test (aa, lo0, lo1, lb0, lb1, ub0, ub1, s0, s1)
+ use mm
+ type(m), target :: aa(10,20)
+ integer :: lo0, lo1, lb0, lb1, ub0, ub1, s0, s1
+
+ type(m), pointer :: pp(:,:), rr(:)
+ integer :: i0, i1, o0, o1
+
+ integer :: hi0, hi1
+ hi0 = lo0 + 10 - 1
+ hi1 = lo1 + 20 - 1
+
+ ! Check the bounds actually specify a "slice" rather than a subarray.
+ if (lb0 .ne. ub0 .and. lb1 .ne. ub1) stop 100
+
+ pp(lo0:,lo1:) => aa
+ if (lbound (pp, 1) .ne. lo0) stop 121
+ if (lbound (pp, 2) .ne. lo1) stop 121
+ if (ubound (pp, 1) .ne. hi0) stop 122
+ if (ubound (pp, 2) .ne. hi1) stop 122
+ nullify (rr)
+ call ctest (pp, lb0, lb1, ub0, ub1, s0, s1, rr)
+
+ ! Make sure the input pointer array has not been modified.
+ if (lbound (pp, 1) .ne. lo0) stop 131
+ if (ubound (pp, 1) .ne. hi0) stop 132
+ if (lbound (pp, 2) .ne. lo1) stop 133
+ if (ubound (pp, 2) .ne. hi1) stop 134
+ do i1 = lo1, hi1
+ do i0 = lo0, hi0
+ if (pp(i0,i1)%x .ne. i0 - lo0 + 1) stop 135
+ if (pp(i0,i1)%y .ne. i1 - lo1 + 1) stop 136
+ end do
+ end do
+
+ ! Make sure the output array has the expected bounds and elements.
+ if (.not. associated (rr)) stop 111
+ if (lbound (rr, 1) .ne. 1) stop 112
+ if (ub0 .eq. lb0) then
+ if (ubound (rr, 1) .ne. (ub1 - lb1)/s1 + 1) stop 113
+ o1 = 1
+ do i1 = lb1, ub1, s1
+ if (rr(o1)%x .ne. lb0 - lo0 + 1) stop 114
+ if (rr(o1)%y .ne. i1 - lo1 + 1) stop 114
+ o1 = o1 + 1
+ end do
+ else
+ if (ubound (rr, 1) .ne. (ub0 - lb0)/s0 + 1) stop 113
+ o0 = 1
+ do i0 = lb0, ub0, s0
+ if (rr(o0)%x .ne. i0 - lo0 + 1) stop 114
+ if (rr(o0)%y .ne. lb1 - lo1 + 1) stop 114
+ o0 = o0 + 1
+ end do
+ end if
+ end subroutine
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-4-c.c b/gcc/testsuite/gfortran.dg/c-interop/section-4-c.c
new file mode 100644
index 0000000..07248a5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-4-c.c
@@ -0,0 +1,101 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+struct m {
+ int i, j, k, l;
+};
+
+extern void ctest (void);
+
+#define IMAX 6
+#define JMAX 8
+#define KMAX 10
+#define LMAX 12
+
+static struct m buffer[LMAX][KMAX][JMAX][IMAX];
+
+static void
+check_element (struct m *mp, int i, int j, int k, int l)
+{
+#if 0
+ fprintf (stderr, "expected (%d, %d, %d, %d), got (%d, %d, %d, %d)\n",
+ i, j, k, l, mp->i, mp->j, mp->k, mp->l);
+#endif
+ if (mp->i != i || mp->j != j || mp->k != k || mp->l != l)
+ abort ();
+}
+
+void
+ctest (void)
+{
+ CFI_CDESC_T(4) sdesc;
+ CFI_cdesc_t *source = (CFI_cdesc_t *) &sdesc;
+ CFI_CDESC_T(4) rdesc;
+ CFI_cdesc_t *result = (CFI_cdesc_t *) &rdesc;
+ CFI_index_t extents[4] = { IMAX, JMAX, KMAX, LMAX };
+ CFI_index_t lb[4], ub[4], s[4];
+ int i, j, k, l;
+ int ii, jj, kk, ll;
+
+ /* Initialize the buffer to uniquely label each element. */
+ for (i = 0; i < IMAX; i++)
+ for (j = 0; j < JMAX; j++)
+ for (k = 0; k < KMAX; k++)
+ for (l = 0; l < LMAX; l++)
+ {
+ buffer[l][k][j][i].i = i;
+ buffer[l][k][j][i].j = j;
+ buffer[l][k][j][i].k = k;
+ buffer[l][k][j][i].l = l;
+ }
+
+ /* Establish the source array. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)buffer,
+ CFI_attribute_pointer, CFI_type_struct,
+ sizeof (struct m), 4, extents));
+
+ /* Try taking a degenerate section (single element). */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL,
+ CFI_attribute_pointer, CFI_type_struct,
+ sizeof (struct m), 0, NULL));
+ lb[0] = 3; lb[1] = 4; lb[2] = 5; lb[3] = 6;
+ ub[0] = 3; ub[1] = 4; ub[2] = 5; ub[3] = 6;
+ s[0] = 0; s[1] = 0; s[2] = 0; s[3] = 0;
+ check_CFI_status ("CFI_section",
+ CFI_section (result, source, lb, ub, s));
+ dump_CFI_cdesc_t (result);
+ check_element ((struct m *)result->base_addr, 3, 4, 5, 6);
+
+ /* Try taking a 2d chunk out of the 4d array. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL,
+ CFI_attribute_pointer, CFI_type_struct,
+ sizeof (struct m), 2, NULL));
+ lb[0] = 1; lb[1] = 2; lb[2] = 3; lb[3] = 4;
+ ub[0] = 1; ub[1] = JMAX - 2; ub[2] = 3; ub[3] = LMAX - 2;
+ s[0] = 0; s[1] = 2; s[2] = 0; s[3] = 3;
+ check_CFI_status ("CFI_section",
+ CFI_section (result, source, lb, ub, s));
+ dump_CFI_cdesc_t (result);
+
+ i = lb[0];
+ k = lb[2];
+ for (j = lb[1], jj = result->dim[0].lower_bound;
+ j <= ub[1];
+ j += s[1], jj++)
+ for (l = lb[3], ll = result->dim[1].lower_bound;
+ l <= ub[3];
+ l += s[3], ll++)
+ {
+ CFI_index_t subscripts[2];
+ subscripts[0] = jj;
+ subscripts[1] = ll;
+ check_element ((struct m *) CFI_address (result, subscripts),
+ i, j, k, l);
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-4.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-4.f90
new file mode 100644
index 0000000..2300e61
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-4.f90
@@ -0,0 +1,23 @@
+! PR 101310
+! { dg-do run }
+! { dg-additional-sources "section-4-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests various scenarios with using CFI_section to extract
+! a section with rank less than the source array. Everything interesting
+! happens on the C side.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ use iso_c_binding
+ end subroutine
+
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-errors-c.c b/gcc/testsuite/gfortran.dg/c-interop/section-errors-c.c
new file mode 100644
index 0000000..67be7d5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-errors-c.c
@@ -0,0 +1,149 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+/* For simplicity, point descriptors at a static buffer. */
+#define BUFSIZE 256
+static char *buf[BUFSIZE] __attribute__ ((aligned (8)));
+static CFI_index_t extents[] = {10};
+
+/* External entry point. The arguments are descriptors for input arrays;
+ we'll construct new descriptors for the outputs of CFI_section. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ int bad = 0;
+ int status;
+ CFI_CDESC_T(1) sdesc;
+ CFI_cdesc_t *source = (CFI_cdesc_t *) &sdesc;
+ CFI_CDESC_T(3) rdesc;
+ CFI_cdesc_t *result = (CFI_cdesc_t *) &rdesc;
+ CFI_index_t lb = 2;
+ CFI_index_t ub = 8;
+ CFI_index_t step = 2;
+ CFI_index_t zstep = 0;
+
+ /* Use a 1-d integer source array for the first few tests. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)buf, CFI_attribute_other,
+ CFI_type_int, 0, 1, extents));
+
+ /* result shall be the address of a C descriptor with rank equal
+ to the rank of source minus the number of zero strides. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 0, NULL));
+ status = CFI_section (result, source, &lb, &ub, &step);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for rank mismatch (too small)\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 1, NULL));
+ status = CFI_section (result, source, &lb, &lb, &zstep);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for rank mismatch (zero stride)\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 3, NULL));
+ status = CFI_section (result, source, &lb, &ub, &step);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for rank mismatch (too large)\n");
+ bad ++;
+ }
+
+ /* The attribute member [of result] shall have the value
+ CFI_attribute_other or CFI_attribute_pointer. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_allocatable,
+ CFI_type_int, 0, 1, NULL));
+ status = CFI_section (result, source, &lb, &ub, &step);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_attribute_allocatable result\n");
+ bad ++;
+ }
+
+ /* source shall be the address of a C descriptor that describes a
+ nonallocatable nonpointer array, an allocated allocatable array,
+ or an associated array pointer. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, NULL, CFI_attribute_allocatable,
+ CFI_type_int, 0, 1, NULL));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 1, NULL));
+ status = CFI_section (result, source, &lb, &ub, &step);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for unallocated allocatable source array\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 1, NULL));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 1, NULL));
+ status = CFI_section (result, source, &lb, &ub, &step);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for unassociated pointer source array\n");
+ bad ++;
+ }
+
+ /* The corresponding values of the elem_len and type members shall
+ be the same in the C descriptors with the addresses source
+ and result. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)buf, CFI_attribute_other,
+ CFI_type_struct,
+ sizeof(int), 1, extents));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ 2*sizeof (int), 1, NULL));
+ status = CFI_section (result, source, &lb, &ub, &step);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for elem_len mismatch\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 1, NULL));
+ status = CFI_section (result, source, &lb, &ub, &step);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for type mismatch\n");
+ bad ++;
+ }
+
+ if (bad)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90
new file mode 100644
index 0000000..28328b7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+! { dg-additional-sources "section-errors-c.c dump-descriptors.c" }
+! { dg-additional-options "-Wno-error -fcheck=all" }
+! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+!
+! This program tests that the CFI_section function properly detects
+! invalid arguments. All the interesting things happen in the
+! corresponding C code.
+!
+! The situation here seems to be that while TS29113 defines error codes
+! for CFI_section, it doesn't actually require the implementation to detect
+! those errors by saying the arguments "shall be" such-and-such, e.g. it is
+! undefined behavior if they are not. In gfortran you can enable some
+! run-time checking by building with -fcheck=all.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ end subroutine
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/select-c.c b/gcc/testsuite/gfortran.dg/c-interop/select-c.c
new file mode 100644
index 0000000..663ac0d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/select-c.c
@@ -0,0 +1,138 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+/* Declare some source arrays. */
+struct ss {
+ char c[4];
+ signed char b[4];
+ int i, j, k;
+} s[10][5][3];
+
+char c[10][16];
+
+double _Complex dc[10];
+
+CFI_index_t extents3[] = {3,5,10};
+CFI_index_t extents1[] = {10};
+
+/* External entry point. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ CFI_CDESC_T(3) sdesc;
+ CFI_cdesc_t *source = (CFI_cdesc_t *) &sdesc;
+ CFI_CDESC_T(3) rdesc;
+ CFI_cdesc_t *result = (CFI_cdesc_t *) &rdesc;
+ size_t offset;
+
+ /* Extract an array of structure elements. */
+ offset = offsetof (struct ss, j);
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)s, CFI_attribute_other,
+ CFI_type_struct,
+ sizeof (struct ss), 3, extents3));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 3, NULL));
+ check_CFI_status ("CFI_select_part",
+ CFI_select_part (result, source, offset, 0));
+ dump_CFI_cdesc_t (source);
+ dump_CFI_cdesc_t (result);
+
+ if (result->elem_len != sizeof (int))
+ abort ();
+ if (result->base_addr != source->base_addr + offset)
+ abort ();
+ if (result->dim[0].extent != source->dim[0].extent)
+ abort ();
+ if (result->dim[0].sm != source->dim[0].sm)
+ abort ();
+ if (result->dim[1].extent != source->dim[1].extent)
+ abort ();
+ if (result->dim[1].sm != source->dim[1].sm)
+ abort ();
+ if (result->dim[2].extent != source->dim[2].extent)
+ abort ();
+ if (result->dim[2].sm != source->dim[2].sm)
+ abort ();
+
+ /* Check that we use the given elem_size for char but not for
+ signed char, which is considered an integer type instead of a Fortran
+ character type. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_char, 4, 3, NULL));
+ if (result->elem_len != 4)
+ abort ();
+ offset = offsetof (struct ss, c);
+ check_CFI_status ("CFI_select_part",
+ CFI_select_part (result, source, offset, 4));
+ if (result->elem_len != 4)
+ abort ();
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_signed_char, 4, 3, NULL));
+ if (result->elem_len != sizeof (signed char))
+ abort ();
+ offset = offsetof (struct ss, c);
+ check_CFI_status ("CFI_select_part",
+ CFI_select_part (result, source, offset, 4));
+ if (result->elem_len != sizeof (signed char))
+ abort ();
+
+ /* Extract an array of character substrings. */
+ offset = 2;
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)c, CFI_attribute_other,
+ CFI_type_char, 16, 1, extents1));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_char, 8, 1, NULL));
+ check_CFI_status ("CFI_select_part",
+ CFI_select_part (result, source, offset, 8));
+ dump_CFI_cdesc_t (source);
+ dump_CFI_cdesc_t (result);
+
+ if (result->elem_len != 8)
+ abort ();
+ if (result->base_addr != source->base_addr + offset)
+ abort ();
+ if (result->dim[0].extent != source->dim[0].extent)
+ abort ();
+ if (result->dim[0].sm != source->dim[0].sm)
+ abort ();
+
+ /* Extract an array the imaginary parts of complex numbers.
+ Note that the use of __imag__ to obtain the imaginary part as
+ an lvalue is a GCC extension. */
+ offset = (void *)&(__imag__ dc[0]) - (void *)&(dc[0]);
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)dc, CFI_attribute_other,
+ CFI_type_double_Complex,
+ 0, 1, extents1));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_double, 0, 1, NULL));
+ check_CFI_status ("CFI_select_part",
+ CFI_select_part (result, source, offset, 0));
+ dump_CFI_cdesc_t (source);
+ dump_CFI_cdesc_t (result);
+
+ if (result->elem_len != sizeof (double))
+ abort ();
+ if (result->base_addr != source->base_addr + offset)
+ abort ();
+ if (result->dim[0].extent != source->dim[0].extent)
+ abort ();
+ if (result->dim[0].sm != source->dim[0].sm)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/select-errors-c.c b/gcc/testsuite/gfortran.dg/c-interop/select-errors-c.c
new file mode 100644
index 0000000..7eb815e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/select-errors-c.c
@@ -0,0 +1,125 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+/* Source is an array of structs. */
+struct ss {
+ int i, j;
+ char c[16];
+ double _Complex dc;
+} s[10];
+
+CFI_index_t extents[] = {10};
+
+/* External entry point. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ int bad = 0;
+ int status;
+ CFI_CDESC_T(1) sdesc;
+ CFI_cdesc_t *source = (CFI_cdesc_t *) &sdesc;
+ CFI_CDESC_T(3) rdesc;
+ CFI_cdesc_t *result = (CFI_cdesc_t *) &rdesc;
+
+ /* Create a descriptor for the source array. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)s, CFI_attribute_other,
+ CFI_type_struct,
+ sizeof (struct ss), 1, extents));
+
+ /* The attribute member of result shall have the value
+ CFI_attribute_other or CFI_attribute_pointer. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_allocatable,
+ CFI_type_int, 0, 1, NULL));
+ status = CFI_select_part (result, source, offsetof (struct ss, j), 0);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_attribute_allocatable result\n");
+ bad ++;
+ }
+
+ /* The rank member of the result C descriptor shall have the same value
+ as the rank member of the C descriptor at the address specified
+ by source. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 0, NULL));
+ status = CFI_select_part (result, source, offsetof (struct ss, j), 0);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for rank mismatch (too small)\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 3, NULL));
+ status = CFI_select_part (result, source, offsetof (struct ss, j), 0);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for rank mismatch (too large)\n");
+ bad ++;
+ }
+
+ /* The value of displacement shall be between 0 and source->elem_len - 1
+ inclusive. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 1, NULL));
+ status = CFI_select_part (result, source, -8, 0);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for negative displacement\n");
+ bad ++;
+ }
+ status = CFI_select_part (result, source, source->elem_len, 0);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for too-large displacement\n");
+ bad ++;
+ }
+
+ /* source shall be the address of a C descriptor for a nonallocatable
+ nonpointer array, an allocated allocatable array, or an associated
+ array pointer. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, NULL, CFI_attribute_allocatable,
+ CFI_type_struct,
+ sizeof (struct ss), 1, NULL));
+ status = CFI_select_part (result, source, offsetof (struct ss, j), 0);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for unallocated allocatable source array\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, NULL, CFI_attribute_pointer,
+ CFI_type_struct,
+ sizeof (struct ss), 1, NULL));
+ status = CFI_select_part (result, source, offsetof (struct ss, j), 0);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for unassociated pointer source array\n");
+ bad ++;
+ }
+
+ if (bad)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90
new file mode 100644
index 0000000..b719c9e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+! { dg-additional-sources "select-errors-c.c dump-descriptors.c" }
+! { dg-additional-options "-Wno-error -fcheck=all" }
+! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+!
+! This program tests that the CFI_select_part function properly detects
+! invalid arguments. All the interesting things happen in the
+! corresponding C code.
+!
+! The situation here seems to be that while TS29113 defines error codes for
+! CFI_select_part, it doesn't actually require the implementation to detect
+! those errors by saying the arguments "shall be" such-and-such, e.g. it is
+! undefined behavior if they are not. In gfortran you can enable some
+! run-time checking by building with -fcheck=all.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ end subroutine
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/select.f90 b/gcc/testsuite/gfortran.dg/c-interop/select.f90
new file mode 100644
index 0000000..133385e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/select.f90
@@ -0,0 +1,18 @@
+! { dg-do run }
+! { dg-additional-sources "select-c.c dump-descriptors.c" }
+!
+! This program tests the CFI_select_part function. All the interesting
+! things happen in the corresponding C code.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ end subroutine
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/setpointer-c.c b/gcc/testsuite/gfortran.dg/c-interop/setpointer-c.c
new file mode 100644
index 0000000..249cb2b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/setpointer-c.c
@@ -0,0 +1,78 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+static int a[10][5][3];
+static CFI_index_t extents[] = {3, 5, 10};
+static CFI_index_t lb1[] = {1, 2, 3};
+static CFI_index_t lb2[] = {0, 1, -10};
+
+/* External entry point. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ CFI_CDESC_T(3) sdesc;
+ CFI_cdesc_t *source = (CFI_cdesc_t *) &sdesc;
+ CFI_CDESC_T(3) rdesc;
+ CFI_cdesc_t *result = (CFI_cdesc_t *) &rdesc;
+
+ /* Create descriptors. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)a, CFI_attribute_pointer,
+ CFI_type_int, 0, 3, extents));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 3, NULL));
+
+ /* Use setpointer to adjust the bounds of source in place. */
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (source, source, lb1));
+ dump_CFI_cdesc_t (source);
+ if (source->dim[0].lower_bound != lb1[0])
+ abort ();
+ if (source->dim[1].lower_bound != lb1[1])
+ abort ();
+ if (source->dim[2].lower_bound != lb1[2])
+ abort ();
+
+ /* Use setpointer to copy the pointer and bounds from source. */
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (result, source, NULL));
+ dump_CFI_cdesc_t (result);
+ if (result->base_addr != source->base_addr)
+ abort ();
+ if (result->dim[0].lower_bound != source->dim[0].lower_bound)
+ abort ();
+ if (result->dim[1].lower_bound != source->dim[1].lower_bound)
+ abort ();
+ if (result->dim[2].lower_bound != source->dim[2].lower_bound)
+ abort ();
+
+ /* Use setpointer to nullify result. */
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (result, NULL, NULL));
+ dump_CFI_cdesc_t (result);
+ if (result->base_addr)
+ abort ();
+
+ /* Use setpointer to copy the pointer from source, but use
+ different bounds. */
+ check_CFI_status ("CFI_setpointer",
+ CFI_setpointer (result, source, lb2));
+ dump_CFI_cdesc_t (source);
+ if (result->base_addr != source->base_addr)
+ abort ();
+ if (result->dim[0].lower_bound != lb2[0])
+ abort ();
+ if (result->dim[1].lower_bound != lb2[1])
+ abort ();
+ if (result->dim[2].lower_bound != lb2[2])
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors-c.c b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors-c.c
new file mode 100644
index 0000000..7931e1e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors-c.c
@@ -0,0 +1,127 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+static int a[10][5][3];
+static CFI_index_t extents[] = {3, 5, 10};
+
+/* External entry point. */
+extern void ctest (void);
+
+void
+ctest (void)
+{
+ int bad = 0;
+ int status;
+ CFI_CDESC_T(3) sdesc;
+ CFI_cdesc_t *source = (CFI_cdesc_t *) &sdesc;
+ CFI_CDESC_T(3) rdesc;
+ CFI_cdesc_t *result = (CFI_cdesc_t *) &rdesc;
+
+ /* result shall be the address of a C descriptor for a Fortran pointer. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)a, CFI_attribute_other,
+ CFI_type_int, 0, 3, extents));
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_allocatable,
+ CFI_type_int, 0, 3, NULL));
+ status = CFI_setpointer (result, source, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_attribute_allocatable result\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_other,
+ CFI_type_int, 0, 3, NULL));
+ status = CFI_setpointer (result, source, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for CFI_attribute_other result\n");
+ bad ++;
+ }
+
+ /* source shall be a null pointer or the address of a C descriptor
+ for an allocated allocatable object, a data pointer object, or a
+ nonallocatable nonpointer data object that is not an
+ assumed-size array. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 3, NULL));
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, NULL, CFI_attribute_allocatable,
+ CFI_type_int, 0, 3, NULL));
+ status = CFI_setpointer (result, source, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for unallocated allocatable source\n");
+ bad ++;
+ }
+
+ /* CFI_establish rejects negative extents, so we can't use it to make
+ an assumed-size array, so hack the descriptor by hand. Yuck. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)a, CFI_attribute_other,
+ CFI_type_int, 0, 3, extents));
+ source->dim[2].extent = -1;
+ status = CFI_setpointer (result, source, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for assumed-size source array\n");
+ bad ++;
+ }
+
+ /* If source is not a null pointer, the corresponding values of the
+ elem_len, rank, and type members shall be the same in the C
+ descriptors with the addresses source and result. */
+ check_CFI_status ("CFI_establish",
+ CFI_establish (source, (void *)a, CFI_attribute_other,
+ CFI_type_char, sizeof(int), 3, extents));
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_char, 1, 3, NULL));
+ status = CFI_setpointer (result, source, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for elem_len mismatch\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_char, sizeof(int), 1, NULL));
+ status = CFI_setpointer (result, source, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for rank mismatch\n");
+ bad ++;
+ }
+
+ check_CFI_status ("CFI_establish",
+ CFI_establish (result, NULL, CFI_attribute_pointer,
+ CFI_type_int, 0, 3, NULL));
+ status = CFI_setpointer (result, source, NULL);
+ if (status == CFI_SUCCESS)
+ {
+ fprintf (stderr,
+ "no error for type mismatch\n");
+ bad ++;
+ }
+
+ if (bad)
+ abort ();
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90
new file mode 100644
index 0000000..84a01ce
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90
@@ -0,0 +1,28 @@
+! PR 101317
+! { dg-do run }
+! { dg-additional-sources "setpointer-errors-c.c dump-descriptors.c" }
+! { dg-additional-options "-Wno-error -fcheck=all" }
+! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+!
+! This program tests that the CFI_setpointer function properly detects
+! invalid arguments. All the interesting things happen in the
+! corresponding C code.
+!
+! The situation here seems to be that while TS29113 defines error codes for
+! CFI_setpointer, it doesn't actually require the implementation to detect
+! those errors by saying the arguments "shall be" such-and-such, e.g. it is
+! undefined behavior if they are not. In gfortran you can enable some
+! run-time checking by building with -fcheck=all.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ end subroutine
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/setpointer.f90 b/gcc/testsuite/gfortran.dg/c-interop/setpointer.f90
new file mode 100644
index 0000000..57ef183
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/setpointer.f90
@@ -0,0 +1,18 @@
+! { dg-do run }
+! { dg-additional-sources "setpointer-c.c dump-descriptors.c" }
+!
+! This program tests the CFI_setpointer function. All the interesting
+! things happen in the corresponding C code.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+ subroutine ctest () bind (c)
+ end subroutine
+ end interface
+
+ call ctest ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/shape.f90 b/gcc/testsuite/gfortran.dg/c-interop/shape.f90
new file mode 100644
index 0000000..dd790bb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/shape.f90
@@ -0,0 +1,77 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.4.1 SHAPE
+!
+! The description of the intrinsic function SHAPE in ISO/IEC 1539-1:2010
+! is changed for an assumed-rank array that is associated with an
+! assumed-size array; an assumed-size array has no shape, but in this
+! case the result has a value equal to
+! [ (SIZE (ARRAY, I, KIND), I=1,RANK (ARRAY)) ]
+! with KIND omitted from SIZE if it was omitted from SHAPE.
+!
+! The idea here is that the main program passes some arrays to a test
+! subroutine with an assumed-size dummy, which in turn passes that to a
+! subroutine with an assumed-rank dummy.
+
+program test
+
+ ! Define some arrays for testing.
+ integer, target :: x1(5)
+ integer :: y1(0:9)
+ integer, pointer :: p1(:)
+ integer, allocatable :: a1(:)
+ integer, target :: x3(2,3,4)
+ integer :: y3(0:1,-3:-1,4)
+ integer, pointer :: p3(:,:,:)
+ integer, allocatable :: a3(:,:,:)
+
+ ! Test the 1-dimensional arrays.
+ call test1 (x1)
+ call test1 (y1)
+ p1 => x1
+ call test1 (p1)
+ allocate (a1(5))
+ call test1 (a1)
+
+ ! Test the multi-dimensional arrays.
+ call test3 (x3, 1, 2, 1, 3)
+ call test3 (y3, 0, 1, -3, -1)
+ p3 => x3
+ call test3 (p3, 1, 2, 1, 3)
+ allocate (a3(2,3,4))
+ call test3 (a3, 1, 2, 1, 3)
+
+contains
+
+ subroutine testit (a)
+ integer :: a(..)
+
+ integer :: r
+ r = rank(a)
+
+ block
+ integer :: s(r)
+ s = shape(a)
+ do i = 1, r
+ if (s(i) .ne. size(a,i)) stop 101
+ end do
+ end block
+
+ end subroutine
+
+ subroutine test1 (a)
+ integer :: a(*)
+
+ call testit (a)
+ end subroutine
+
+ subroutine test3 (a, l1, u1, l2, u2)
+ implicit none
+ integer :: l1, u1, l2, u2
+ integer :: a(l1:u1, l2:u2, *)
+
+ call testit (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/size.f90 b/gcc/testsuite/gfortran.dg/c-interop/size.f90
new file mode 100644
index 0000000..6c66997
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/size.f90
@@ -0,0 +1,106 @@
+! Reported as pr94070.
+! { dg-do run { xfail *-*-* } }
+!
+! TS 29113
+! 6.4.2 SIZE
+!
+! The description of the intrinsic function SIZE in ISO/IEC 1539-1:2010
+! is changed in the following cases:
+!
+! (1) for an assumed-rank object that is associated with an assumed-size
+! array, the result has the value −1 if DIM is present and equal to the
+! rank of ARRAY, and a negative value that is equal to
+! PRODUCT ( [ (SIZE (ARRAY, I, KIND), I=1, RANK (ARRAY)) ] )
+! if DIM is not present;
+!
+! (2) for an assumed-rank object that is associated with a scalar, the
+! result has the value 1.
+!
+! The idea here is that the main program passes some arrays to a test
+! subroutine with an assumed-size dummy, which in turn passes that to a
+! subroutine with an assumed-rank dummy.
+
+program test
+
+ ! Define some arrays for testing.
+ integer, target :: x1(5)
+ integer :: y1(0:9)
+ integer, pointer :: p1(:)
+ integer, allocatable :: a1(:)
+ integer, target :: x3(2,3,4)
+ integer :: y3(0:1,-3:-1,4)
+ integer, pointer :: p3(:,:,:)
+ integer, allocatable :: a3(:,:,:)
+ integer :: x
+
+ ! Test the 1-dimensional arrays.
+ call test1 (x1)
+ call test1 (y1)
+ p1 => x1
+ call test1 (p1)
+ allocate (a1(5))
+ call test1 (a1)
+
+ ! Test the multi-dimensional arrays.
+ call test3 (x3, 1, 2, 1, 3)
+ call test3 (y3, 0, 1, -3, -1)
+ p3 => x3
+ call test3 (p3, 1, 2, 1, 3)
+ allocate (a3(2,3,4))
+ call test3 (a3, 1, 2, 1, 3)
+
+ ! Test scalars.
+ call test0 (x)
+ call test0 (-1)
+ call test0 (x1(1))
+
+contains
+
+ subroutine testit (a, r, sizes)
+ integer :: a(..)
+ integer :: r
+ integer :: sizes(r)
+
+ integer :: totalsize, thissize
+ totalsize = 1
+
+ if (r .ne. rank(a)) stop 101
+
+ do i = 1, r
+ thissize = size (a, i)
+ print *, 'got size ', thissize, ' expected ', sizes(i)
+ if (thissize .ne. sizes(i)) stop 102
+ totalsize = totalsize * thissize
+ end do
+
+ if (size(a) .ne. totalsize) stop 103
+ end subroutine
+
+ subroutine test0 (a)
+ integer :: a(..)
+
+ if (size (a) .ne. 1) stop 103
+ end subroutine
+
+ subroutine test1 (a)
+ integer :: a(*)
+
+ integer :: sizes(1)
+ sizes(1) = -1
+ call testit (a, 1, sizes)
+ end subroutine
+
+ subroutine test3 (a, l1, u1, l2, u2)
+ implicit none
+ integer :: l1, u1, l2, u2
+ integer :: a(l1:u1, l2:u2, *)
+
+ integer :: sizes(3)
+ sizes(1) = u1 - l1 + 1
+ sizes(2) = u2 - l2 + 1
+ sizes(3) = -1
+
+ call testit (a, 3, sizes)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/tkr.f90 b/gcc/testsuite/gfortran.dg/c-interop/tkr.f90
new file mode 100644
index 0000000..c0c0d7e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/tkr.f90
@@ -0,0 +1,46 @@
+! { dg-do compile}
+!
+! TS 29113
+! The definition of TKR compatible in paragraph 2 of subclause 12.4.3.4.5
+! of ISO/IEC 1539-1:2010 is changed to:
+!
+! A dummy argument is type, kind, and rank compatible, or TKR compatible,
+! with another dummy argument if the first is type compatible with the
+! second, the kind type parameters of the first have the same values as
+! the corresponding kind type parameters of the second, and both have the
+! same rank or either is assumed-rank.
+!
+! This test file contains tests that are expected to issue diagnostics
+! for invalid code.
+
+module m
+
+interface foo
+ subroutine foo_1 (x) ! { dg-error "Ambiguous interfaces" }
+ integer :: x(..)
+ end subroutine
+ subroutine foo_2 (x) ! { dg-error "Ambiguous interfaces" }
+ integer :: x(:, :)
+ end subroutine
+end interface
+
+interface bar
+ subroutine bar_1 (x) ! { dg-error "Ambiguous interfaces" }
+ integer :: x(..)
+ end subroutine
+ subroutine bar_2 (x) ! { dg-error "Ambiguous interfaces" }
+ integer :: x(..)
+ end subroutine
+end interface
+
+interface baz
+ subroutine baz_1 (x) ! { dg-error "Ambiguous interfaces" }
+ integer :: x
+ end subroutine
+ subroutine baz_2 (x) ! { dg-error "Ambiguous interfaces" }
+ integer :: x(..)
+ end subroutine
+end interface
+
+end module
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic-c.c
new file mode 100644
index 0000000..34bf218
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic-c.c
@@ -0,0 +1,169 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest_int1 (CFI_cdesc_t *arg_int,
+ CFI_cdesc_t *arg_short,
+ CFI_cdesc_t *arg_long,
+ CFI_cdesc_t *arg_long_long,
+ CFI_cdesc_t *arg_signed_char);
+
+extern void ctest_int2 (CFI_cdesc_t *arg_int8,
+ CFI_cdesc_t *arg_int16,
+ CFI_cdesc_t *arg_int32,
+ CFI_cdesc_t *arg_int64);
+
+extern void ctest_int3 (CFI_cdesc_t *arg_least8,
+ CFI_cdesc_t *arg_least16,
+ CFI_cdesc_t *arg_least32,
+ CFI_cdesc_t *arg_least64);
+
+extern void ctest_int4 (CFI_cdesc_t *arg_fast8,
+ CFI_cdesc_t *arg_fast16,
+ CFI_cdesc_t *arg_fast32,
+ CFI_cdesc_t *arg_fast64);
+
+extern void ctest_int5 (CFI_cdesc_t *arg_size,
+ CFI_cdesc_t *arg_intmax,
+ CFI_cdesc_t *arg_intptr,
+ CFI_cdesc_t *arg_ptrdiff);
+
+extern void ctest_real (CFI_cdesc_t *arg_float,
+ CFI_cdesc_t *arg_double);
+
+extern void ctest_complex (CFI_cdesc_t *arg_float_complex,
+ CFI_cdesc_t *arg_double_complex);
+
+extern void ctest_misc (CFI_cdesc_t *arg_bool,
+ CFI_cdesc_t *arg_cptr,
+ CFI_cdesc_t *arg_cfunptr,
+ CFI_cdesc_t *arg_struct);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->base_addr == NULL)
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+
+/* Test that the basic integer types correspond correctly. */
+void
+ctest_int1 (CFI_cdesc_t *arg_int,
+ CFI_cdesc_t *arg_short,
+ CFI_cdesc_t *arg_long,
+ CFI_cdesc_t *arg_long_long,
+ CFI_cdesc_t *arg_signed_char)
+{
+ check (arg_int, sizeof (int), CFI_type_int);
+ check (arg_short, sizeof (short), CFI_type_short);
+ check (arg_long, sizeof (long), CFI_type_long);
+ check (arg_long_long, sizeof (long long int), CFI_type_long_long);
+ check (arg_signed_char, sizeof (signed char), CFI_type_signed_char);
+}
+
+/* Test the integer types of explicit sizes. */
+void
+ctest_int2 (CFI_cdesc_t *arg_int8,
+ CFI_cdesc_t *arg_int16,
+ CFI_cdesc_t *arg_int32,
+ CFI_cdesc_t *arg_int64)
+{
+ check (arg_int8, sizeof (int8_t), CFI_type_int8_t);
+ check (arg_int16, sizeof (int16_t), CFI_type_int16_t);
+ check (arg_int32, sizeof (int32_t), CFI_type_int32_t);
+ check (arg_int64, sizeof (int64_t), CFI_type_int64_t);
+}
+
+/* Check the int_least*_t types. */
+
+void
+ctest_int3 (CFI_cdesc_t *arg_least8,
+ CFI_cdesc_t *arg_least16,
+ CFI_cdesc_t *arg_least32,
+ CFI_cdesc_t *arg_least64)
+{
+ check (arg_least8, sizeof (int_least8_t), CFI_type_int_least8_t);
+ check (arg_least16, sizeof (int_least16_t), CFI_type_int_least16_t);
+ check (arg_least32, sizeof (int_least32_t), CFI_type_int_least32_t);
+ check (arg_least64, sizeof (int_least64_t), CFI_type_int_least64_t);
+}
+
+/* Check the int_fast*_t types. */
+void
+ctest_int4 (CFI_cdesc_t *arg_fast8,
+ CFI_cdesc_t *arg_fast16,
+ CFI_cdesc_t *arg_fast32,
+ CFI_cdesc_t *arg_fast64)
+{
+ check (arg_fast8, sizeof (int_fast8_t), CFI_type_int_fast8_t);
+ check (arg_fast16, sizeof (int_fast16_t), CFI_type_int_fast16_t);
+ check (arg_fast32, sizeof (int_fast32_t), CFI_type_int_fast32_t);
+ check (arg_fast64, sizeof (int_fast64_t), CFI_type_int_fast64_t);
+}
+
+/* Check the "purposeful" integer types. */
+void
+ctest_int5 (CFI_cdesc_t *arg_size,
+ CFI_cdesc_t *arg_intmax,
+ CFI_cdesc_t *arg_intptr,
+ CFI_cdesc_t *arg_ptrdiff)
+{
+ check (arg_size, sizeof (size_t), CFI_type_size_t);
+ check (arg_intmax, sizeof (intmax_t), CFI_type_intmax_t);
+ check (arg_intptr, sizeof (intptr_t), CFI_type_intptr_t);
+ check (arg_ptrdiff, sizeof (ptrdiff_t), CFI_type_ptrdiff_t);
+}
+
+/* Check the floating-point types. */
+void
+ctest_real (CFI_cdesc_t *arg_float,
+ CFI_cdesc_t *arg_double)
+{
+ check (arg_float, sizeof (float), CFI_type_float);
+ check (arg_double, sizeof (double), CFI_type_double);
+}
+
+/* Likewise for the complex types. */
+void
+ctest_complex (CFI_cdesc_t *arg_float_complex,
+ CFI_cdesc_t *arg_double_complex)
+{
+ check (arg_float_complex, sizeof (float _Complex),
+ CFI_type_float_Complex);
+ check (arg_double_complex, sizeof (double _Complex),
+ CFI_type_double_Complex);
+}
+
+/* Misc types. */
+void
+ctest_misc (CFI_cdesc_t *arg_bool,
+ CFI_cdesc_t *arg_cptr,
+ CFI_cdesc_t *arg_cfunptr,
+ CFI_cdesc_t *arg_struct)
+{
+ struct m
+ {
+ int i, j;
+ };
+
+ check (arg_bool, sizeof (_Bool), CFI_type_Bool);
+ check (arg_cptr, sizeof (void *), CFI_type_cptr);
+ check (arg_cfunptr, sizeof (void (*)(void)), CFI_type_cfunptr);
+ check (arg_struct, sizeof (struct m), CFI_type_struct);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic.f90
new file mode 100644
index 0000000..a91a6e8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-basic.f90
@@ -0,0 +1,151 @@
+! PR 101305
+! PR 100917
+! { dg-do run }
+! { dg-additional-sources "typecodes-array-basic-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that kind constants in the ISO_C_BINDING
+! module result in the right type field in arguments passed by descriptor,
+! also matching the size of the corresponding C type. We use
+! assumed-rank arrays to force the use of a descriptor.
+!
+! Some types are tested in their own testcases to allow conditionalization
+! for target-specific support or xfailing to track bugs.
+
+module mm
+ use iso_c_binding
+
+ type, bind (c) :: s
+ integer(C_INT) :: i, j
+ end type
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+
+ subroutine ctest_int1 (arg_int, arg_short, arg_long, arg_long_long, &
+ arg_signed_char) bind (c)
+ use iso_c_binding
+ integer(C_INT) :: arg_int(:)
+ integer(C_SHORT) :: arg_short(:)
+ integer(C_LONG) :: arg_long(:)
+ integer(C_LONG_LONG) :: arg_long_long(:)
+ integer(C_SIGNED_CHAR) :: arg_signed_char(:)
+ end subroutine
+
+ subroutine ctest_int2 (arg_int8, arg_int16, arg_int32, arg_int64) bind (c)
+ use iso_c_binding
+ integer(C_INT8_T) :: arg_int8(:)
+ integer(C_INT16_T) :: arg_int16(:)
+ integer(C_INT32_T) :: arg_int32(:)
+ integer(C_INT64_T) :: arg_int64(:)
+ end subroutine
+
+ subroutine ctest_int3 (arg_least8, arg_least16, arg_least32, &
+ arg_least64) bind (c)
+ use iso_c_binding
+ integer(C_INT_LEAST8_T) :: arg_least8(:)
+ integer(C_INT_LEAST16_T) :: arg_least16(:)
+ integer(C_INT_LEAST32_T) :: arg_least32(:)
+ integer(C_INT_LEAST64_T) :: arg_least64(:)
+ end subroutine
+
+ subroutine ctest_int4 (arg_fast8, arg_fast16, arg_fast32, &
+ arg_fast64) bind (c)
+ use iso_c_binding
+ integer(C_INT_FAST8_T) :: arg_fast8(:)
+ integer(C_INT_FAST16_T) :: arg_fast16(:)
+ integer(C_INT_FAST32_T) :: arg_fast32(:)
+ integer(C_INT_FAST64_T) :: arg_fast64(:)
+ end subroutine
+
+ subroutine ctest_int5 (arg_size, arg_intmax, arg_intptr, &
+ arg_ptrdiff) bind (c)
+ use iso_c_binding
+ integer(C_SIZE_T) :: arg_size(:)
+ integer(C_INTMAX_T) :: arg_intmax(:)
+ integer(C_INTPTR_T) :: arg_intptr(:)
+ integer(C_PTRDIFF_T) :: arg_ptrdiff(:)
+ end subroutine
+
+ subroutine ctest_real (arg_float, arg_double) bind (c)
+ use iso_c_binding
+ real(C_FLOAT) :: arg_float(:)
+ real(C_DOUBLE) :: arg_double(:)
+ end subroutine
+
+ subroutine ctest_complex (arg_float_complex, arg_double_complex) &
+ bind (c)
+ use iso_c_binding
+ complex(C_FLOAT_COMPLEX) :: arg_float_complex(:)
+ complex(C_DOUBLE_COMPLEX) :: arg_double_complex(:)
+ end subroutine
+
+ subroutine ctest_misc (arg_bool, arg_cptr, arg_cfunptr, &
+ arg_struct) bind (c)
+ use iso_c_binding
+ use mm
+ logical(C_BOOL) :: arg_bool(:)
+ type(C_PTR) :: arg_cptr(:)
+ type(C_FUNPTR) :: arg_cfunptr(:)
+ type(s) :: arg_struct(:)
+ end subroutine
+
+ end interface
+
+ integer(C_INT) :: var_int(4)
+ integer(C_SHORT) :: var_short(4)
+ integer(C_LONG) :: var_long(4)
+ integer(C_LONG_LONG) :: var_long_long(4)
+ integer(C_SIGNED_CHAR) :: var_signed_char(4)
+ integer(C_INT8_T) :: var_int8(4)
+ integer(C_INT16_T) :: var_int16(4)
+ integer(C_INT32_T) :: var_int32(4)
+ integer(C_INT64_T) :: var_int64(4)
+ integer(C_INT_LEAST8_T) :: var_least8(4)
+ integer(C_INT_LEAST16_T) :: var_least16(4)
+ integer(C_INT_LEAST32_T) :: var_least32(4)
+ integer(C_INT_LEAST64_T) :: var_least64(4)
+ integer(C_INT_FAST8_T) :: var_fast8(4)
+ integer(C_INT_FAST16_T) :: var_fast16(4)
+ integer(C_INT_FAST32_T) :: var_fast32(4)
+ integer(C_INT_FAST64_T) :: var_fast64(4)
+ integer(C_SIZE_T) :: var_size(4)
+ integer(C_INTMAX_T) :: var_intmax(4)
+ integer(C_INTPTR_T) :: var_intptr(4)
+ integer(C_PTRDIFF_T) :: var_ptrdiff(4)
+ real(C_FLOAT) :: var_float(4)
+ real(C_DOUBLE) :: var_double(4)
+ complex(C_FLOAT_COMPLEX) :: var_float_complex(4)
+ complex(C_DOUBLE_COMPLEX) :: var_double_complex(4)
+ logical(C_BOOL) :: var_bool(4)
+ type(C_PTR) :: var_cptr(4)
+ type(C_FUNPTR) :: var_cfunptr(4)
+ type(s) :: var_struct(4)
+
+ call ctest_int1 (var_int, var_short, var_long, var_long_long, &
+ var_signed_char)
+
+ call ctest_int2 (var_int8, var_int16, var_int32, var_int64)
+
+ call ctest_int3 (var_least8, var_least16, var_least32, var_least64)
+
+ call ctest_int4 (var_fast8, var_fast16, var_fast32, var_fast64)
+
+ call ctest_int5 (var_size, var_intmax, var_intptr, var_ptrdiff)
+
+ call ctest_real (var_float, var_double)
+
+ call ctest_complex (var_float_complex, var_double_complex)
+
+ call ctest_misc (var_bool, var_cptr, var_cfunptr, var_struct)
+
+ ! FIXME: how do you pass something that corresponds to CFI_type_other?
+ ! The Fortran front end complains if you try to pass something that
+ ! isn't interoperable, such as a derived type object without bind(c).
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char-c.c
new file mode 100644
index 0000000..c69d224
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char-c.c
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest_1 (CFI_cdesc_t *arg_char, CFI_cdesc_t *arg_ucs4);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->base_addr == NULL)
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+void
+ctest_1 (CFI_cdesc_t *arg_char, CFI_cdesc_t *arg_ucs4)
+{
+ check (arg_char, 1, CFI_type_char);
+ check (arg_ucs4, 4, CFI_type_ucs4_char);
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char.f90
new file mode 100644
index 0000000..ede9fb6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char.f90
@@ -0,0 +1,37 @@
+! PR 101305
+! PR 92482
+! { dg-do run }
+! { dg-additional-sources "typecodes-array-char-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that the character kind constants provided by
+! gfortran's ISO_C_BINDING module result in the right type field in
+! arguments passed by descriptor, also matching the size of the corresponding
+! C type. We use assumed-shape arrays to force the use of a descriptor.
+!
+! FIXME: because of PR92482, we can only test len=1 characters. This
+! test should be extended once that bug is fixed.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ integer, parameter :: ucs4 = selected_char_kind ('ISO_10646')
+
+ interface
+
+ subroutine ctest_1 (arg_cchar, arg_ucs4) bind (c)
+ use iso_c_binding
+ integer, parameter :: ucs4 = selected_char_kind ('ISO_10646')
+ character(kind=C_CHAR) :: arg_cchar(:)
+ character(kind=ucs4) :: arg_ucs4(:)
+ end subroutine
+
+ end interface
+
+ character(kind=C_CHAR) :: var_cchar(4)
+ character(kind=ucs4) :: var_ucs4(4)
+
+ call ctest_1 (var_cchar, var_ucs4)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128-c.c
new file mode 100644
index 0000000..d081feb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128-c.c
@@ -0,0 +1,38 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *arg_float128,
+ CFI_cdesc_t *arg_complex128);
+
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->base_addr == NULL)
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+void
+ctest (CFI_cdesc_t *arg_float128,
+ CFI_cdesc_t *arg_complex128)
+{
+ check (arg_float128, sizeof (__float128), CFI_type_float128);
+ check (arg_complex128, sizeof (__float128) * 2,
+ CFI_type_float128_Complex);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128.f90
new file mode 100644
index 0000000..907877b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-float128.f90
@@ -0,0 +1,34 @@
+! PR 101305
+! PR 100914
+! PR 100917
+! Fails on x86 targets where sizeof(long double) == 16 (PR100917).
+! { dg-do run { xfail { { x86_64*-*-* i?86*-*-* } && longdouble128 } } }
+! { dg-require-effective-target fortran_real_c_float128 }
+! { dg-additional-sources "typecodes-array-float128-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that the vendor extension kind constants provided by
+! gfortran's ISO_C_BINDING module result in the right type field in
+! arguments passed by descriptor, also matching the size of the corresponding
+! C type. We use assumed-shape arrays to force the use of a descriptor.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+
+ subroutine ctest (arg_float128, arg_complex128) bind (c)
+ use iso_c_binding
+ real(C_FLOAT128) :: arg_float128(:)
+ complex(C_FLOAT128_COMPLEX) :: arg_complex128(:)
+ end subroutine
+
+ end interface
+
+ real(C_FLOAT128) :: var_float128(4)
+ complex(C_FLOAT128_COMPLEX) :: var_complex128(4)
+
+ call ctest (var_float128, var_complex128)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128-c.c
new file mode 100644
index 0000000..f6f8c75
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128-c.c
@@ -0,0 +1,40 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *arg_int128,
+ CFI_cdesc_t *arg_least128,
+ CFI_cdesc_t *arg_fast128);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->base_addr == NULL)
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+void
+ctest (CFI_cdesc_t *arg_int128,
+ CFI_cdesc_t *arg_least128,
+ CFI_cdesc_t *arg_fast128)
+{
+ check (arg_int128, sizeof (__int128), CFI_type_int128_t);
+ check (arg_least128, sizeof (__int128), CFI_type_int_least128_t);
+ check (arg_fast128, sizeof (__int128), CFI_type_int_fast128_t);
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128.f90
new file mode 100644
index 0000000..671c544
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-int128.f90
@@ -0,0 +1,33 @@
+! PR 101305
+! { dg-do run }
+! { dg-require-effective-target fortran_integer_16 }
+! { dg-additional-sources "typecodes-array-int128-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that 128-bit integer kind constants provided by
+! gfortran's ISO_C_BINDING module result in the right type field in
+! arguments passed by descriptor, also matching the size of the corresponding
+! C type. We use assumed-shape arrays to force the use of a descriptor.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+
+ subroutine ctest (arg_int128, arg_least128, arg_fast128) bind (c)
+ use iso_c_binding
+ integer(C_INT128_T) :: arg_int128(:)
+ integer(C_INT_LEAST128_T) :: arg_least128(:)
+ integer(C_INT_FAST128_T) :: arg_fast128(:)
+ end subroutine
+
+ end interface
+
+ integer(C_INT128_T) :: var_int128(4)
+ integer(C_INT_LEAST128_T) :: var_least128(4)
+ integer(C_INT_FAST128_T) :: var_fast128(4)
+
+ call ctest (var_int128, var_least128, var_fast128)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble-c.c
new file mode 100644
index 0000000..e47e4e3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble-c.c
@@ -0,0 +1,37 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *arg_long_double,
+ CFI_cdesc_t *arg_long_double_complex);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_other)
+ abort ();
+ if (a->base_addr == NULL)
+ abort ();
+ if (a->rank != 1)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+void
+ctest (CFI_cdesc_t *arg_long_double,
+ CFI_cdesc_t *arg_long_double_complex)
+{
+ check (arg_long_double, sizeof (long double), CFI_type_long_double);
+ check (arg_long_double_complex, sizeof (long double _Complex),
+ CFI_type_long_double_Complex);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble.f90
new file mode 100644
index 0000000..100071f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-array-longdouble.f90
@@ -0,0 +1,32 @@
+! PR 101305
+! PR 100917
+! { dg-do run }
+! { dg-additional-sources "typecodes-array-longdouble-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that long double kind constants in the ISO_C_BINDING
+! module result in the right type field in arguments passed by descriptor,
+! also matching the size of the corresponding C type. We use
+! assumed-rank arrays to force the use of a descriptor.
+
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+
+ subroutine ctest (arg_long_double, arg_long_double_complex) bind (c)
+ use iso_c_binding
+ real(C_LONG_DOUBLE) :: arg_long_double(:)
+ complex(C_LONG_DOUBLE_COMPLEX) :: arg_long_double_complex(:)
+ end subroutine
+
+ end interface
+
+ real(C_LONG_DOUBLE) :: var_long_double(4)
+ complex(C_LONG_DOUBLE_COMPLEX) :: var_long_double_complex(4)
+
+ call ctest (var_long_double, var_long_double_complex)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity-c.c
new file mode 100644
index 0000000..a1d044b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity-c.c
@@ -0,0 +1,179 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+
+extern void ctest_typecodes (void);
+
+/* Do sanity checking on the CFI_type_* macros. In particular, make sure
+ that if two type codes have the same value, they represent objects of the
+ same size. */
+
+struct tc_info
+{
+ CFI_type_t typecode;
+ char *name;
+ size_t size;
+ int extension;
+};
+
+static struct tc_info tc_table[] =
+{
+ /* Extension types.
+ Note there is no portable C equivalent type for CFI_type_ucs4_char type
+ (4-byte Unicode characters), and GCC rejects "__float128 _Complex",
+ so this is kind of hacky... */
+#if CFI_type_int128_t > 0
+ { CFI_type_int128_t, "CFI_type_int128_t",
+ sizeof (__int128), 1 },
+ { CFI_type_int_least128_t, "CFI_type_int_least128_t",
+ sizeof (__int128), 1 },
+ { CFI_type_int_fast128_t, "CFI_type_int_fast128_t",
+ sizeof (__int128), 1 },
+#endif
+#if CFI_type_ucs4_char > 0
+ { CFI_type_ucs4_char, "CFI_type_ucs4_char", 4, 1 },
+#endif
+#if CFI_type_float128 > 0
+ { CFI_type_float128, "CFI_type_float128",
+ sizeof (__float128), 1 },
+ { CFI_type_float128_Complex, "CFI_type_float128_Complex",
+ sizeof (__float128) * 2, 1 },
+#endif
+#if CFI_type_cfunptr > 0
+ { CFI_type_cfunptr, "CFI_type_cfunptr",
+ sizeof (void (*)(void)), 1 },
+#endif
+
+ /* Standard types. */
+ { CFI_type_signed_char, "CFI_type_signed_char",
+ sizeof (signed char), 0, },
+ { CFI_type_short, "CFI_type_short",
+ sizeof (short), 0 },
+ { CFI_type_int, "CFI_type_int",
+ sizeof (int), 0 },
+ { CFI_type_long, "CFI_type_long",
+ sizeof (long), 0 },
+ { CFI_type_long_long, "CFI_type_long_long",
+ sizeof (long long), 0 },
+ { CFI_type_size_t, "CFI_type_size_t",
+ sizeof (size_t), 0 },
+ { CFI_type_int8_t, "CFI_type_int8_t",
+ sizeof (int8_t), 0 },
+ { CFI_type_int16_t, "CFI_type_int16_t",
+ sizeof (int16_t), 0 },
+ { CFI_type_int32_t, "CFI_type_int32_t",
+ sizeof (int32_t), 0 },
+ { CFI_type_int64_t, "CFI_type_int64_t",
+ sizeof (int64_t), 0 },
+ { CFI_type_int_least8_t, "CFI_type_int_least8_t",
+ sizeof (int_least8_t), 0 },
+ { CFI_type_int_least16_t, "CFI_type_int_least16_t",
+ sizeof (int_least16_t), 0 },
+ { CFI_type_int_least32_t, "CFI_type_int_least32_t",
+ sizeof (int_least32_t), 0 },
+ { CFI_type_int_least64_t, "CFI_type_int_least64_t",
+ sizeof (int_least64_t), 0 },
+ { CFI_type_int_fast8_t, "CFI_type_int_fast8_t",
+ sizeof (int_fast8_t), 0 },
+ { CFI_type_int_fast16_t, "CFI_type_int_fast16_t",
+ sizeof (int_fast16_t), 0 },
+ { CFI_type_int_fast32_t, "CFI_type_int_fast32_t",
+ sizeof (int_fast32_t), 0 },
+ { CFI_type_int_fast64_t, "CFI_type_int_fast64_t",
+ sizeof (int_fast64_t), 0 },
+ { CFI_type_intmax_t, "CFI_type_intmax_t",
+ sizeof (intmax_t), 0 },
+ { CFI_type_intptr_t, "CFI_type_intptr_t",
+ sizeof (intptr_t), 0 },
+ { CFI_type_ptrdiff_t, "CFI_type_ptrdiff_t",
+ sizeof (ptrdiff_t), 0 },
+ { CFI_type_float, "CFI_type_float",
+ sizeof (float), 0 },
+ { CFI_type_double, "CFI_type_double",
+ sizeof (double), 0 },
+ { CFI_type_long_double, "CFI_type_long_double",
+ sizeof (long double), 0 },
+ { CFI_type_float_Complex, "CFI_type_float_Complex",
+ sizeof (float _Complex), 0 },
+ { CFI_type_double_Complex, "CFI_type_double_Complex",
+ sizeof (double _Complex), 0 },
+ { CFI_type_long_double_Complex, "CFI_type_long_double_Complex",
+ sizeof (long double _Complex), 0 },
+ { CFI_type_Bool, "CFI_type_Bool",
+ sizeof (_Bool), 0 },
+ { CFI_type_char, "CFI_type_char",
+ sizeof (char), 0 },
+ { CFI_type_cptr, "CFI_type_cptr",
+ sizeof (void *), 0 },
+ { CFI_type_struct, "CFI_type_struct", 0, 0 },
+ { CFI_type_other, "CFI_type_other", -1, 0, }
+};
+
+void
+ctest_typecodes (void)
+{
+ int ncodes = sizeof (tc_table) / sizeof (struct tc_info);
+ int i, j;
+ int bad = 0;
+
+ for (i = 0; i < ncodes; i++)
+ for (j = i + 1; j < ncodes; j++)
+ if (tc_table[i].typecode == tc_table[j].typecode
+ && tc_table[i].typecode > 0
+ && (tc_table[i].size != tc_table[j].size))
+ {
+ fprintf (stderr,
+ "type codes have the same value %d but different sizes\n",
+ (int) tc_table[i].typecode);
+ fprintf (stderr, " %s size %d\n",
+ tc_table[i].name, (int) tc_table[i].size);
+ fprintf (stderr, " %s size %d\n",
+ tc_table[j].name, (int) tc_table[j].size);
+ bad = 1;
+ }
+
+ /* TS29113 Section 8.3.4: The value for CFI_type_other shall be negative
+ and distinct from all other type specifiers. If a C type is not
+ interoperable with a Fortran type and kind supported by the
+ Fortran processor, its macro shall evaluate to a negative value.
+ Otherwise, the value for an intrinsic type shall be positive.
+
+ In the case of GCC, we expect that all the standard intrinsic
+ types are supported by both Fortran and C, so they should all be
+ positive except for CFI_type_other. Non-standard ones may have a
+ value -2. */
+
+ for (i = 0; i < ncodes; i++)
+ {
+ if (tc_table[i].typecode == CFI_type_other)
+ {
+ if (tc_table[i].typecode >= 0)
+ {
+ fprintf (stderr, "%s value %d is not negative\n",
+ tc_table[i].name, (int)tc_table[i].typecode);
+ bad = 1;
+ }
+ if (strcmp (tc_table[i].name, "CFI_type_other"))
+ {
+ fprintf (stderr, "%s has the same value %d as CFI_type_other\n",
+ tc_table[i].name, (int)CFI_type_other);
+ bad = 1;
+ }
+ }
+ else if (tc_table[i].typecode == -2 && tc_table[i].extension)
+ /* Unsupported extension type on this target; this is OK */
+ ;
+ else if (tc_table[i].typecode <= 0)
+ {
+ fprintf (stderr, "%s value %d is not positive\n",
+ tc_table[i].name, (int)tc_table[i].typecode);
+ bad = 1;
+ }
+ }
+
+ if (bad)
+ abort ();
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity.f90
new file mode 100644
index 0000000..7dcc62d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-sanity.f90
@@ -0,0 +1,24 @@
+! PR 101305
+! { dg-do run }
+! { dg-additional-sources "typecodes-sanity-c.c" }
+! { dg-additional-options "-g" }
+!
+! This program does sanity checking on the CFI_type_* macros. All
+! of the interesting things happen on the C side.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ integer, parameter :: ucs4 = selected_char_kind ('ISO_10646')
+
+ interface
+
+ subroutine ctest_typecodes () bind (c)
+ end subroutine
+
+ end interface
+
+ call ctest_typecodes ()
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic-c.c
new file mode 100644
index 0000000..fe1a10a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic-c.c
@@ -0,0 +1,168 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest_int1 (CFI_cdesc_t *arg_int,
+ CFI_cdesc_t *arg_short,
+ CFI_cdesc_t *arg_long,
+ CFI_cdesc_t *arg_long_long,
+ CFI_cdesc_t *arg_signed_char);
+
+extern void ctest_int2 (CFI_cdesc_t *arg_int8,
+ CFI_cdesc_t *arg_int16,
+ CFI_cdesc_t *arg_int32,
+ CFI_cdesc_t *arg_int64);
+
+extern void ctest_int3 (CFI_cdesc_t *arg_least8,
+ CFI_cdesc_t *arg_least16,
+ CFI_cdesc_t *arg_least32,
+ CFI_cdesc_t *arg_least64);
+
+extern void ctest_int4 (CFI_cdesc_t *arg_fast8,
+ CFI_cdesc_t *arg_fast16,
+ CFI_cdesc_t *arg_fast32,
+ CFI_cdesc_t *arg_fast64);
+
+extern void ctest_int5 (CFI_cdesc_t *arg_size,
+ CFI_cdesc_t *arg_intmax,
+ CFI_cdesc_t *arg_intptr,
+ CFI_cdesc_t *arg_ptrdiff);
+
+extern void ctest_real (CFI_cdesc_t *arg_float,
+ CFI_cdesc_t *arg_double);
+
+extern void ctest_complex (CFI_cdesc_t *arg_float_complex,
+ CFI_cdesc_t *arg_double_complex);
+
+extern void ctest_misc (CFI_cdesc_t *arg_bool,
+ CFI_cdesc_t *arg_cptr,
+ CFI_cdesc_t *arg_cfunptr,
+ CFI_cdesc_t *arg_struct);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_pointer)
+ abort ();
+ if (a->base_addr != NULL)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+
+/* Test that the basic integer types correspond correctly. */
+void
+ctest_int1 (CFI_cdesc_t *arg_int,
+ CFI_cdesc_t *arg_short,
+ CFI_cdesc_t *arg_long,
+ CFI_cdesc_t *arg_long_long,
+ CFI_cdesc_t *arg_signed_char)
+{
+ check (arg_int, sizeof (int), CFI_type_int);
+ check (arg_short, sizeof (short), CFI_type_short);
+ check (arg_long, sizeof (long), CFI_type_long);
+ check (arg_long_long, sizeof (long long int), CFI_type_long_long);
+ check (arg_signed_char, sizeof (signed char), CFI_type_signed_char);
+}
+
+/* Test the integer types of explicit sizes. */
+void
+ctest_int2 (CFI_cdesc_t *arg_int8,
+ CFI_cdesc_t *arg_int16,
+ CFI_cdesc_t *arg_int32,
+ CFI_cdesc_t *arg_int64)
+{
+ check (arg_int8, sizeof (int8_t), CFI_type_int8_t);
+ check (arg_int16, sizeof (int16_t), CFI_type_int16_t);
+ check (arg_int32, sizeof (int32_t), CFI_type_int32_t);
+ check (arg_int64, sizeof (int64_t), CFI_type_int64_t);
+}
+
+/* Check the int_least*_t types. */
+
+void
+ctest_int3 (CFI_cdesc_t *arg_least8,
+ CFI_cdesc_t *arg_least16,
+ CFI_cdesc_t *arg_least32,
+ CFI_cdesc_t *arg_least64)
+{
+ check (arg_least8, sizeof (int_least8_t), CFI_type_int_least8_t);
+ check (arg_least16, sizeof (int_least16_t), CFI_type_int_least16_t);
+ check (arg_least32, sizeof (int_least32_t), CFI_type_int_least32_t);
+ check (arg_least64, sizeof (int_least64_t), CFI_type_int_least64_t);
+}
+
+/* Check the int_fast*_t types. */
+void
+ctest_int4 (CFI_cdesc_t *arg_fast8,
+ CFI_cdesc_t *arg_fast16,
+ CFI_cdesc_t *arg_fast32,
+ CFI_cdesc_t *arg_fast64)
+{
+ check (arg_fast8, sizeof (int_fast8_t), CFI_type_int_fast8_t);
+ check (arg_fast16, sizeof (int_fast16_t), CFI_type_int_fast16_t);
+ check (arg_fast32, sizeof (int_fast32_t), CFI_type_int_fast32_t);
+ check (arg_fast64, sizeof (int_fast64_t), CFI_type_int_fast64_t);
+}
+
+/* Check the "purposeful" integer types. */
+void
+ctest_int5 (CFI_cdesc_t *arg_size,
+ CFI_cdesc_t *arg_intmax,
+ CFI_cdesc_t *arg_intptr,
+ CFI_cdesc_t *arg_ptrdiff)
+{
+ check (arg_size, sizeof (size_t), CFI_type_size_t);
+ check (arg_intmax, sizeof (intmax_t), CFI_type_intmax_t);
+ check (arg_intptr, sizeof (intptr_t), CFI_type_intptr_t);
+ check (arg_ptrdiff, sizeof (ptrdiff_t), CFI_type_ptrdiff_t);
+}
+
+/* Check the floating-point types. */
+void
+ctest_real (CFI_cdesc_t *arg_float,
+ CFI_cdesc_t *arg_double)
+{
+ check (arg_float, sizeof (float), CFI_type_float);
+ check (arg_double, sizeof (double), CFI_type_double);
+}
+
+/* Likewise for the complex types. */
+void
+ctest_complex (CFI_cdesc_t *arg_float_complex,
+ CFI_cdesc_t *arg_double_complex)
+{
+ check (arg_float_complex, sizeof (float _Complex),
+ CFI_type_float_Complex);
+ check (arg_double_complex, sizeof (double _Complex),
+ CFI_type_double_Complex);
+}
+
+/* Misc types. */
+void
+ctest_misc (CFI_cdesc_t *arg_bool,
+ CFI_cdesc_t *arg_cptr,
+ CFI_cdesc_t *arg_cfunptr,
+ CFI_cdesc_t *arg_struct)
+{
+ struct m
+ {
+ int i, j;
+ };
+
+ check (arg_bool, sizeof (_Bool), CFI_type_Bool);
+ check (arg_cptr, sizeof (void *), CFI_type_cptr);
+ check (arg_struct, sizeof (struct m), CFI_type_struct);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic.f90
new file mode 100644
index 0000000..5f74468
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-basic.f90
@@ -0,0 +1,160 @@
+! PR 101305
+! PR 100917
+! xfailed due to PR 101308
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "typecodes-scalar-basic-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that kind constants in the ISO_C_BINDING
+! module result in the right type field in arguments passed by descriptor,
+! also matching the size of the corresponding C type. We use pointers
+! to force the use of a descriptor.
+!
+! Some types are tested in their own testcases to allow conditionalization
+! for target-specific support or xfailing to track bugs.
+
+module mm
+ use iso_c_binding
+
+ type, bind (c) :: s
+ integer(C_INT) :: i, j
+ end type
+end module
+
+program testit
+ use iso_c_binding
+ use mm
+ implicit none
+
+ interface
+
+ subroutine ctest_int1 (arg_int, arg_short, arg_long, arg_long_long, &
+ arg_signed_char) bind (c)
+ use iso_c_binding
+ integer(C_INT), pointer :: arg_int
+ integer(C_SHORT), pointer :: arg_short
+ integer(C_LONG), pointer :: arg_long
+ integer(C_LONG_LONG), pointer :: arg_long_long
+ integer(C_SIGNED_CHAR), pointer :: arg_signed_char
+ end subroutine
+
+ subroutine ctest_int2 (arg_int8, arg_int16, arg_int32, arg_int64) bind (c)
+ use iso_c_binding
+ integer(C_INT8_T), pointer :: arg_int8
+ integer(C_INT16_T), pointer :: arg_int16
+ integer(C_INT32_T), pointer :: arg_int32
+ integer(C_INT64_T), pointer :: arg_int64
+ end subroutine
+
+ subroutine ctest_int3 (arg_least8, arg_least16, arg_least32, &
+ arg_least64) bind (c)
+ use iso_c_binding
+ integer(C_INT_LEAST8_T), pointer :: arg_least8
+ integer(C_INT_LEAST16_T), pointer :: arg_least16
+ integer(C_INT_LEAST32_T), pointer :: arg_least32
+ integer(C_INT_LEAST64_T), pointer :: arg_least64
+ end subroutine
+
+ subroutine ctest_int4 (arg_fast8, arg_fast16, arg_fast32, &
+ arg_fast64) bind (c)
+ use iso_c_binding
+ integer(C_INT_FAST8_T), pointer :: arg_fast8
+ integer(C_INT_FAST16_T), pointer :: arg_fast16
+ integer(C_INT_FAST32_T), pointer :: arg_fast32
+ integer(C_INT_FAST64_T), pointer :: arg_fast64
+ end subroutine
+
+ subroutine ctest_int5 (arg_size, arg_intmax, arg_intptr, &
+ arg_ptrdiff) bind (c)
+ use iso_c_binding
+ integer(C_SIZE_T), pointer :: arg_size
+ integer(C_INTMAX_T), pointer :: arg_intmax
+ integer(C_INTPTR_T), pointer :: arg_intptr
+ integer(C_PTRDIFF_T), pointer :: arg_ptrdiff
+ end subroutine
+
+ subroutine ctest_real (arg_float, arg_double) bind (c)
+ use iso_c_binding
+ real(C_FLOAT), pointer :: arg_float
+ real(C_DOUBLE), pointer :: arg_double
+ end subroutine
+
+ subroutine ctest_complex (arg_float_complex, arg_double_complex) &
+ bind (c)
+ use iso_c_binding
+ complex(C_FLOAT_COMPLEX), pointer :: arg_float_complex
+ complex(C_DOUBLE_COMPLEX), pointer :: arg_double_complex
+ end subroutine
+
+ subroutine ctest_misc (arg_bool, arg_cptr, arg_cfunptr, arg_struct) &
+ bind (c)
+ use iso_c_binding
+ use mm
+ logical(C_BOOL), pointer :: arg_bool
+ type(C_PTR), pointer :: arg_cptr
+ type(C_FUNPTR), pointer :: arg_cfunptr
+ type(s), pointer :: arg_struct
+ end subroutine
+
+ end interface
+
+ integer(C_INT), pointer :: var_int
+ integer(C_SHORT), pointer :: var_short
+ integer(C_LONG), pointer :: var_long
+ integer(C_LONG_LONG), pointer :: var_long_long
+ integer(C_SIGNED_CHAR), pointer :: var_signed_char
+ integer(C_INT8_T), pointer :: var_int8
+ integer(C_INT16_T), pointer :: var_int16
+ integer(C_INT32_T), pointer :: var_int32
+ integer(C_INT64_T), pointer :: var_int64
+ integer(C_INT_LEAST8_T), pointer :: var_least8
+ integer(C_INT_LEAST16_T), pointer :: var_least16
+ integer(C_INT_LEAST32_T), pointer :: var_least32
+ integer(C_INT_LEAST64_T), pointer :: var_least64
+ integer(C_INT_FAST8_T), pointer :: var_fast8
+ integer(C_INT_FAST16_T), pointer :: var_fast16
+ integer(C_INT_FAST32_T), pointer :: var_fast32
+ integer(C_INT_FAST64_T), pointer :: var_fast64
+ integer(C_SIZE_T), pointer :: var_size
+ integer(C_INTMAX_T), pointer :: var_intmax
+ integer(C_INTPTR_T), pointer :: var_intptr
+ integer(C_PTRDIFF_T), pointer :: var_ptrdiff
+ real(C_FLOAT), pointer :: var_float
+ real(C_DOUBLE), pointer :: var_double
+ complex(C_FLOAT_COMPLEX), pointer :: var_float_complex
+ complex(C_DOUBLE_COMPLEX), pointer :: var_double_complex
+ logical(C_BOOL), pointer :: var_bool
+ type(C_PTR), pointer :: var_cptr
+ type(C_FUNPTR), pointer :: var_cfunptr
+ type(s), pointer :: var_struct
+
+ nullify (var_int, var_short, var_long, var_long_long, var_signed_char)
+ call ctest_int1 (var_int, var_short, var_long, var_long_long, &
+ var_signed_char)
+
+ nullify (var_int8, var_int16, var_int32, var_int64)
+ call ctest_int2 (var_int8, var_int16, var_int32, var_int64)
+
+ nullify (var_least8, var_least16, var_least32, var_least64)
+ call ctest_int3 (var_least8, var_least16, var_least32, var_least64)
+
+ nullify (var_fast8, var_fast16, var_fast32, var_fast64)
+ call ctest_int4 (var_fast8, var_fast16, var_fast32, var_fast64)
+
+ nullify (var_size, var_intmax, var_intptr, var_ptrdiff)
+ call ctest_int5 (var_size, var_intmax, var_intptr, var_ptrdiff)
+
+ nullify (var_float, var_double)
+ call ctest_real (var_float, var_double)
+
+ nullify (var_float_complex, var_double_complex)
+ call ctest_complex (var_float_complex, var_double_complex)
+
+ nullify (var_bool, var_cptr, var_cfunptr, var_struct)
+ call ctest_misc (var_bool, var_cptr, var_cfunptr, var_struct)
+
+ ! FIXME: how do you pass something that corresponds to CFI_type_other?
+ ! The Fortran front end complains if you try to pass something that
+ ! isn't interoperable, such as a derived type object without bind(c).
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128-c.c
new file mode 100644
index 0000000..f1833aa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128-c.c
@@ -0,0 +1,38 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *arg_float128,
+ CFI_cdesc_t *arg_complex128);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_pointer)
+ abort ();
+ if (a->base_addr != NULL)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+void
+ctest (CFI_cdesc_t *arg_float128,
+ CFI_cdesc_t *arg_complex128)
+{
+ check (arg_float128, sizeof (__float128), CFI_type_float128);
+ check (arg_complex128, sizeof (__float128) * 2,
+ CFI_type_float128_Complex);
+}
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128.f90
new file mode 100644
index 0000000..edf9145
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-float128.f90
@@ -0,0 +1,34 @@
+! xfailed due to PR 101308
+! PR 101305
+! PR 100914
+! { dg-do run { xfail *-*-* } }
+! { dg-require-effective-target fortran_real_c_float128 }
+! { dg-additional-sources "typecodes-scalar-float128-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that the vendor extension kind constants provided by
+! gfortran's ISO_C_BINDING module result in the right type field in
+! arguments passed by descriptor,also matching the size of the corresponding
+! C type. We use pointers to force the use of a descriptor.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+
+ subroutine ctest (arg_float128, arg_complex128) bind (c)
+ use iso_c_binding
+ real(C_FLOAT128), pointer :: arg_float128
+ complex(C_FLOAT128_COMPLEX), pointer :: arg_complex128
+ end subroutine
+
+ end interface
+
+ real(C_FLOAT128), pointer :: var_float128
+ complex(C_FLOAT128_COMPLEX), pointer :: var_complex128
+
+ nullify (var_float128, var_complex128)
+ call ctest (var_float128, var_complex128)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128-c.c
new file mode 100644
index 0000000..db07108
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128-c.c
@@ -0,0 +1,41 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *arg_int128,
+ CFI_cdesc_t *arg_least128,
+ CFI_cdesc_t *arg_fast128);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_pointer)
+ abort ();
+ if (a->base_addr != NULL)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+void
+ctest (CFI_cdesc_t *arg_int128,
+ CFI_cdesc_t *arg_least128,
+ CFI_cdesc_t *arg_fast128)
+{
+ check (arg_int128, sizeof (__int128), CFI_type_int128_t);
+ check (arg_least128, sizeof (__int128), CFI_type_int_least128_t);
+ check (arg_fast128, sizeof (__int128), CFI_type_int_fast128_t);
+}
+
+
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128.f90
new file mode 100644
index 0000000..5f3c7e1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-int128.f90
@@ -0,0 +1,35 @@
+! PR 101305
+! xfailed due to PR 101308
+! { dg-do run { xfail *-*-* } }
+! { dg-require-effective-target fortran_integer_16 }
+! { dg-additional-sources "typecodes-scalar-int128-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that 128-bit integer kind constants provided by
+! gfortran's ISO_C_BINDING module result in the right type field in
+! arguments passed by descriptor, also matching the size of the corresponding
+! C type. We use pointers to force the use of a descriptor.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+
+ subroutine ctest (arg_int128, arg_least128, arg_fast128) bind (c)
+ use iso_c_binding
+ integer(C_INT128_T), pointer :: arg_int128
+ integer(C_INT_LEAST128_T), pointer :: arg_least128
+ integer(C_INT_FAST128_T), pointer :: arg_fast128
+ end subroutine
+
+ end interface
+
+ integer(C_INT128_T), pointer :: var_int128
+ integer(C_INT_LEAST128_T), pointer :: var_least128
+ integer(C_INT_FAST128_T), pointer :: var_fast128
+
+ nullify (var_int128, var_least128, var_fast128)
+ call ctest (var_int128, var_least128, var_fast128)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble-c.c b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble-c.c
new file mode 100644
index 0000000..a52122f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble-c.c
@@ -0,0 +1,37 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <ISO_Fortran_binding.h>
+#include "dump-descriptors.h"
+
+extern void ctest (CFI_cdesc_t *arg_long_double,
+ CFI_cdesc_t *arg_long_double_complex);
+
+/* Sanity check the type info in the descriptor a. */
+
+static void
+check (CFI_cdesc_t *a, size_t size, int typecode)
+{
+ dump_CFI_cdesc_t (a);
+ if (a->attribute != CFI_attribute_pointer)
+ abort ();
+ if (a->base_addr != NULL)
+ abort ();
+ if (a->rank != 0)
+ abort ();
+ if (size && a->elem_len != size)
+ abort ();
+ if (a->type != typecode)
+ abort ();
+}
+
+void
+ctest (CFI_cdesc_t *arg_long_double,
+ CFI_cdesc_t *arg_long_double_complex)
+{
+ check (arg_long_double, sizeof (long double), CFI_type_long_double);
+ check (arg_long_double_complex, sizeof (long double _Complex),
+ CFI_type_long_double_Complex);
+}
diff --git a/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble.f90 b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble.f90
new file mode 100644
index 0000000..c32e012
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/typecodes-scalar-longdouble.f90
@@ -0,0 +1,33 @@
+! xfailed due to PR 101308
+! PR 101305
+! PR 100917
+! { dg-do run { xfail *-*-* } }
+! { dg-additional-sources "typecodes-scalar-longdouble-c.c dump-descriptors.c" }
+! { dg-additional-options "-g" }
+!
+! This program tests that long double kind constants in the ISO_C_BINDING
+! module result in the right type field in arguments passed by descriptor,
+! also matching the size of the corresponding C type. We use pointers
+! to force the use of a descriptor.
+
+program testit
+ use iso_c_binding
+ implicit none
+
+ interface
+
+ subroutine ctest (arg_long_double, arg_long_double_complex) bind (c)
+ use iso_c_binding
+ real(C_LONG_DOUBLE), pointer :: arg_long_double
+ complex(C_LONG_DOUBLE_COMPLEX), pointer :: arg_long_double_complex
+ end subroutine
+
+ end interface
+
+ real(C_LONG_DOUBLE), pointer :: var_long_double
+ complex(C_LONG_DOUBLE_COMPLEX), pointer :: var_long_double_complex
+
+ nullify (var_long_double, var_long_double_complex)
+ call ctest (var_long_double, var_long_double_complex)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/c-interop/ubound.f90 b/gcc/testsuite/gfortran.dg/c-interop/ubound.f90
new file mode 100644
index 0000000..37e073f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/ubound.f90
@@ -0,0 +1,129 @@
+! { dg-do run }
+!
+! TS 29113
+! 6.4.3 UBOUND
+!
+! The description of the intrinsic function UBOUND in ISO/IEC
+! 1539-1:2010 is changed for an assumed-rank object that is associated
+! with an assumed-size array; the result of UBOUND (ARRAY, RANK(ARRAY),
+! KIND) has a value equal to LBOUND (ARRAY, RANK (ARRAY), KIND) −2 with
+! KIND omitted from LBOUND if it was omitted from UBOUND.
+!
+! NOTE 6.2
+! If LBOUND or UBOUND is invoked for an assumed-rank object that is
+! associated with a scalar and DIM is absent, the result is a zero-sized
+! array. LBOUND or UBOUND cannot be invoked for an assumed-rank object
+! that is associated with a scalar if DIM is present because the rank of
+! a scalar is zero and DIM must be ≥ 1.
+!
+! The idea here is that the main program passes some arrays to a test
+! subroutine with an assumed-size dummy, which in turn passes that to a
+! subroutine with an assumed-rank dummy.
+
+program test
+
+ ! Define some arrays for testing.
+ integer, target :: x1(5)
+ integer :: y1(0:9)
+ integer, pointer :: p1(:)
+ integer, allocatable :: a1(:)
+ integer, target :: x3(2,3,4)
+ integer :: y3(0:1,-3:-1,4)
+ integer, pointer :: p3(:,:,:)
+ integer, allocatable :: a3(:,:,:)
+ integer :: x
+
+ ! Test the 1-dimensional arrays.
+ call test1 (x1)
+ call testit2(x1, shape(x1))
+ call test1 (y1)
+ call testit2(y1, shape(y1))
+ p1 => x1
+ call testit2(p1, shape(p1))
+ call testit2p(p1, lbound(p1), shape(p1))
+ call test1 (p1)
+ p1(77:) => x1
+ call testit2p(p1, [77], shape(p1))
+ allocate (a1(5))
+ call testit2(a1, shape(a1))
+ call testit2a(a1, lbound(a1), shape(a1))
+ call test1 (a1)
+ deallocate(a1)
+ allocate (a1(-38:5))
+ call test1 (a1)
+ call testit2(a1, shape(a1))
+ call testit2a(a1, [-38], shape(a1))
+
+ ! Test the multi-dimensional arrays.
+ call test3 (x3, 1, 2, 1, 3)
+ call test3 (y3, 0, 1, -3, -1)
+ p3 => x3
+ call test3 (p3, 1, 2, 1, 3)
+ allocate (a3(2,3,4))
+ call test3 (a3, 1, 2, 1, 3)
+
+ ! Test some scalars.
+ call test0 (x)
+ call test0 (-1)
+ call test0 (x1(1))
+
+contains
+
+ subroutine testit (a)
+ integer :: a(..)
+ integer :: r
+ r = rank(a)
+ if (any (lbound (a) .ne. 1)) stop 101
+ if (ubound (a, r) .ne. -1) stop 102
+ end subroutine
+
+ subroutine testit2(a, shape)
+ integer :: a(..)
+ integer :: shape(:)
+ if (rank(a) /= size(shape)) stop 111
+ if (any (lbound(a) /= 1)) stop 112
+ if (any (ubound(a) /= shape)) stop 113
+ end subroutine
+
+ subroutine testit2a(a,lbound2, shape2)
+ integer, allocatable :: a(..)
+ integer :: lbound2(:), shape2(:)
+ if (rank(a) /= size(shape2)) stop 121
+ if (any (lbound(a) /= lbound2)) stop 122
+ if (any (ubound(a) /= lbound2 + shape2 - 1)) stop 123
+ if (any (shape(a) /= shape2)) stop 124
+ if (sum (shape(a)) /= size(a)) stop 125
+ end subroutine
+
+ subroutine testit2p(a, lbound2, shape2)
+ integer, pointer :: a(..)
+ integer :: lbound2(:), shape2(:)
+ if (rank(a) /= size(shape2)) stop 131
+ if (any (lbound(a) /= lbound2)) stop 132
+ if (any (ubound(a) /= lbound2 + shape2 - 1)) stop 133
+ if (any (shape(a) /= shape2)) stop 134
+ if (sum (shape(a)) /= size(a)) stop 135
+ end subroutine
+
+ subroutine test0 (a)
+ integer :: a(..)
+ if (rank (a) .ne. 0) stop 141
+ if (size (lbound (a)) .ne. 0) stop 142
+ if (size (ubound (a)) .ne. 0) stop 143
+ end subroutine
+
+ subroutine test1 (a)
+ integer :: a(*)
+
+ call testit (a)
+ end subroutine
+
+ subroutine test3 (a, l1, u1, l2, u2)
+ implicit none
+ integer :: l1, u1, l2, u2
+ integer :: a(l1:u1, l2:u2, *)
+
+ call testit (a)
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/char4-subscript.f90 b/gcc/testsuite/gfortran.dg/char4-subscript.f90
index fd1cf69..b4e2d11 100644
--- a/gcc/testsuite/gfortran.dg/char4-subscript.f90
+++ b/gcc/testsuite/gfortran.dg/char4-subscript.f90
@@ -22,7 +22,7 @@ if (ichar(var%str2(5:5)) /= int(Z'1F608')) stop 2
deallocate(var%str2)
end
-! Note: the last '\x00' is regarded as string terminator, hence, the tailing \0 byte is not in the dump
+! Note: the last '\x00' is regarded as string terminator, hence, the trailing \0 byte is not in the dump
! { dg-final { scan-tree-dump { \(\*var\.str2\)\[1\]{lb: 1 sz: 4} = "(d\\x00\\x00|\\x00\\x00\\x00d)"\[1\]{lb: 1 sz: 4};} "original" } }
! { dg-final { scan-tree-dump { __builtin_memmove \(\(void \*\) &\(\*var.str2\)\[2\]{lb: 1 sz: 4}, \(void \*\) &"(e\\x00\\x00\\x00f\\x00\\x00|\\x00\\x00\\x00e\\x00\\x00\\x00f)"\[1\]{lb: 1 sz: 4}, 8\);} "original" } }
diff --git a/gcc/testsuite/gfortran.dg/character_workout_1.f90 b/gcc/testsuite/gfortran.dg/character_workout_1.f90
new file mode 100644
index 0000000..98133b4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/character_workout_1.f90
@@ -0,0 +1,689 @@
+! { dg-do run }
+!
+! Tests fix for PR100120/100816/100818/100819/100821
+!
+
+program main_p
+
+ implicit none
+
+ integer, parameter :: k = 1
+ integer, parameter :: n = 11
+ integer, parameter :: m = 7
+ integer, parameter :: l = 3
+ integer, parameter :: u = 5
+ integer, parameter :: e = u-l+1
+ integer, parameter :: c = 61
+
+ character(kind=k), target :: c1(n)
+ character(len=m, kind=k), target :: cm(n)
+ !
+ character(kind=k), pointer :: s1
+ character(len=m, kind=k), pointer :: sm
+ character(len=e, kind=k), pointer :: se
+ character(len=:, kind=k), pointer :: sd
+ !
+ character(kind=k), pointer :: p1(:)
+ character(len=m, kind=k), pointer :: pm(:)
+ character(len=e, kind=k), pointer :: pe(:)
+ character(len=:, kind=k), pointer :: pd(:)
+
+ class(*), pointer :: su
+ class(*), pointer :: pu(:)
+
+ integer :: i, j
+
+ nullify(s1, sm, se, sd, su)
+ nullify(p1, pm, pe, pd, pu)
+ c1 = [(char(i+c, kind=k), i=1,n)]
+ do i = 1, n
+ do j = 1, m
+ cm(i)(j:j) = char(i*m+j+c-m, kind=k)
+ end do
+ end do
+
+ s1 => c1(n)
+ if(.not.associated(s1)) stop 1
+ if(.not.associated(s1, c1(n))) stop 2
+ if(len(s1)/=1) stop 3
+ if(s1/=c1(n)) stop 4
+ call schar_c1(s1)
+ call schar_a1(s1)
+ p1 => c1
+ if(.not.associated(p1)) stop 5
+ if(.not.associated(p1, c1)) stop 6
+ if(len(p1)/=1) stop 7
+ if(any(p1/=c1)) stop 8
+ call achar_c1(p1)
+ call achar_a1(p1)
+ !
+ sm => cm(n)
+ if(.not.associated(sm)) stop 9
+ if(.not.associated(sm, cm(n))) stop 10
+ if(len(sm)/=m) stop 11
+ if(sm/=cm(n)) stop 12
+ call schar_cm(sm)
+ call schar_am(sm)
+ pm => cm
+ if(.not.associated(pm)) stop 13
+ if(.not.associated(pm, cm)) stop 14
+ if(len(pm)/=m) stop 15
+ if(any(pm/=cm)) stop 16
+ call achar_cm(pm)
+ call achar_am(pm)
+ !
+ se => cm(n)(l:u)
+ if(.not.associated(se)) stop 17
+ if(.not.associated(se, cm(n)(l:u))) stop 18
+ if(len(se)/=e) stop 19
+ if(se/=cm(n)(l:u)) stop 20
+ call schar_ce(se)
+ call schar_ae(se)
+ pe => cm(:)(l:u)
+ if(.not.associated(pe)) stop 21
+ if(.not.associated(pe, cm(:)(l:u))) stop 22
+ if(len(pe)/=e) stop 23
+ if(any(pe/=cm(:)(l:u))) stop 24
+ call achar_ce(pe)
+ call achar_ae(pe)
+ !
+ sd => c1(n)
+ if(.not.associated(sd)) stop 25
+ if(.not.associated(sd, c1(n))) stop 26
+ if(len(sd)/=1) stop 27
+ if(sd/=c1(n)) stop 28
+ call schar_d1(sd)
+ pd => c1
+ if(.not.associated(pd)) stop 29
+ if(.not.associated(pd, c1)) stop 30
+ if(len(pd)/=1) stop 31
+ if(any(pd/=c1)) stop 32
+ call achar_d1(pd)
+ !
+ sd => cm(n)
+ if(.not.associated(sd)) stop 33
+ if(.not.associated(sd, cm(n))) stop 34
+ if(len(sd)/=m) stop 35
+ if(sd/=cm(n)) stop 36
+ call schar_dm(sd)
+ pd => cm
+ if(.not.associated(pd)) stop 37
+ if(.not.associated(pd, cm)) stop 38
+ if(len(pd)/=m) stop 39
+ if(any(pd/=cm)) stop 40
+ call achar_dm(pd)
+ !
+ sd => cm(n)(l:u)
+ if(.not.associated(sd)) stop 41
+ if(.not.associated(sd, cm(n)(l:u))) stop 42
+ if(len(sd)/=e) stop 43
+ if(sd/=cm(n)(l:u)) stop 44
+ call schar_de(sd)
+ pd => cm(:)(l:u)
+ if(.not.associated(pd)) stop 45
+ if(.not.associated(pd, cm(:)(l:u))) stop 46
+ if(len(pd)/=e) stop 47
+ if(any(pd/=cm(:)(l:u))) stop 48
+ call achar_de(pd)
+ !
+ sd => c1(n)
+ s1 => sd
+ if(.not.associated(s1)) stop 49
+ if(.not.associated(s1, c1(n))) stop 50
+ if(len(s1)/=1) stop 51
+ if(s1/=c1(n)) stop 52
+ call schar_c1(s1)
+ call schar_a1(s1)
+ pd => c1
+ s1 => pd(n)
+ if(.not.associated(s1)) stop 53
+ if(.not.associated(s1, c1(n))) stop 54
+ if(len(s1)/=1) stop 55
+ if(s1/=c1(n)) stop 56
+ call schar_c1(s1)
+ call schar_a1(s1)
+ pd => c1
+ p1 => pd
+ if(.not.associated(p1)) stop 57
+ if(.not.associated(p1, c1)) stop 58
+ if(len(p1)/=1) stop 59
+ if(any(p1/=c1)) stop 60
+ call achar_c1(p1)
+ call achar_a1(p1)
+ !
+ sd => cm(n)
+ sm => sd
+ if(.not.associated(sm)) stop 61
+ if(.not.associated(sm, cm(n))) stop 62
+ if(len(sm)/=m) stop 63
+ if(sm/=cm(n)) stop 64
+ call schar_cm(sm)
+ call schar_am(sm)
+ pd => cm
+ sm => pd(n)
+ if(.not.associated(sm)) stop 65
+ if(.not.associated(sm, cm(n))) stop 66
+ if(len(sm)/=m) stop 67
+ if(sm/=cm(n)) stop 68
+ call schar_cm(sm)
+ call schar_am(sm)
+ pd => cm
+ pm => pd
+ if(.not.associated(pm)) stop 69
+ if(.not.associated(pm, cm)) stop 70
+ if(len(pm)/=m) stop 71
+ if(any(pm/=cm)) stop 72
+ call achar_cm(pm)
+ call achar_am(pm)
+ !
+ sd => cm(n)(l:u)
+ se => sd
+ if(.not.associated(se)) stop 73
+ if(.not.associated(se, cm(n)(l:u))) stop 74
+ if(len(se)/=e) stop 75
+ if(se/=cm(n)(l:u)) stop 76
+ call schar_ce(se)
+ call schar_ae(se)
+ pd => cm(:)(l:u)
+ pe => pd
+ if(.not.associated(pe)) stop 77
+ if(.not.associated(pe, cm(:)(l:u))) stop 78
+ if(len(pe)/=e) stop 79
+ if(any(pe/=cm(:)(l:u))) stop 80
+ call achar_ce(pe)
+ call achar_ae(pe)
+ !
+ su => c1(n)
+ if(.not.associated(su)) stop 81
+ if(.not.associated(su, c1(n))) stop 82
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=1) stop 83
+ if(su/=c1(n)) stop 84
+ class default
+ stop 85
+ end select
+ call schar_u1(su)
+ pu => c1
+ if(.not.associated(pu)) stop 86
+ if(.not.associated(pu, c1)) stop 87
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=1) stop 88
+ if(any(pu/=c1)) stop 89
+ class default
+ stop 90
+ end select
+ call achar_u1(pu)
+ !
+ su => cm(n)
+ if(.not.associated(su)) stop 91
+ if(.not.associated(su)) stop 92
+ if(.not.associated(su, cm(n))) stop 93
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=m) stop 94
+ if(su/=cm(n)) stop 95
+ class default
+ stop 96
+ end select
+ call schar_um(su)
+ pu => cm
+ if(.not.associated(pu)) stop 97
+ if(.not.associated(pu, cm)) stop 98
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=m) stop 99
+ if(any(pu/=cm)) stop 100
+ class default
+ stop 101
+ end select
+ call achar_um(pu)
+ !
+ su => cm(n)(l:u)
+ if(.not.associated(su)) stop 102
+ if(.not.associated(su, cm(n)(l:u))) stop 103
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 104
+ if(su/=cm(n)(l:u)) stop 105
+ class default
+ stop 106
+ end select
+ call schar_ue(su)
+ pu => cm(:)(l:u)
+ if(.not.associated(pu)) stop 107
+ if(.not.associated(pu, cm(:)(l:u))) stop 108
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=e) stop 109
+ if(any(pu/=cm(:)(l:u))) stop 110
+ class default
+ stop 111
+ end select
+ call achar_ue(pu)
+ !
+ sd => c1(n)
+ su => sd
+ if(.not.associated(su)) stop 112
+ if(.not.associated(su, c1(n))) stop 113
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=1) stop 114
+ if(su/=c1(n)) stop 115
+ class default
+ stop 116
+ end select
+ call schar_u1(su)
+ pd => c1
+ su => pd(n)
+ if(.not.associated(su)) stop 117
+ if(.not.associated(su, c1(n))) stop 118
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=1) stop 119
+ if(su/=c1(n)) stop 120
+ class default
+ stop 121
+ end select
+ call schar_u1(su)
+ pd => c1
+ pu => pd
+ if(.not.associated(pu)) stop 122
+ if(.not.associated(pu, c1)) stop 123
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=1) stop 124
+ if(any(pu/=c1)) stop 125
+ class default
+ stop 126
+ end select
+ call achar_u1(pu)
+ !
+ sd => cm(n)
+ su => sd
+ if(.not.associated(su)) stop 127
+ if(.not.associated(su, cm(n))) stop 128
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=m) stop 129
+ if(su/=cm(n)) stop 130
+ class default
+ stop 131
+ end select
+ call schar_um(su)
+ pd => cm
+ su => pd(n)
+ if(.not.associated(su)) stop 132
+ if(.not.associated(su, cm(n))) stop 133
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=m) stop 134
+ if(su/=cm(n)) stop 135
+ class default
+ stop 136
+ end select
+ call schar_um(su)
+ pd => cm
+ pu => pd
+ if(.not.associated(pu)) stop 137
+ if(.not.associated(pu, cm)) stop 138
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=m) stop 139
+ if(any(pu/=cm)) stop 140
+ class default
+ stop 141
+ end select
+ call achar_um(pu)
+ !
+ sd => cm(n)(l:u)
+ su => sd
+ if(.not.associated(su)) stop 142
+ if(.not.associated(su, cm(n)(l:u))) stop 143
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 144
+ if(su/=cm(n)(l:u)) stop 145
+ class default
+ stop 146
+ end select
+ call schar_ue(su)
+ pd => cm(:)(l:u)
+ su => pd(n)
+ if(.not.associated(su)) stop 147
+ if(.not.associated(su, cm(n)(l:u))) stop 148
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 149
+ if(su/=cm(n)(l:u)) stop 150
+ class default
+ stop 151
+ end select
+ call schar_ue(su)
+ pd => cm(:)(l:u)
+ pu => pd
+ if(.not.associated(pu)) stop 152
+ if(.not.associated(pu, cm(:)(l:u))) stop 153
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=e) stop 154
+ if(any(pu/=cm(:)(l:u))) stop 155
+ class default
+ stop 156
+ end select
+ call achar_ue(pu)
+ !
+ sd => cm(n)
+ su => sd(l:u)
+ if(.not.associated(su)) stop 157
+ if(.not.associated(su, cm(n)(l:u))) stop 158
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 159
+ if(su/=cm(n)(l:u)) stop 160
+ class default
+ stop 161
+ end select
+ call schar_ue(su)
+ pd => cm(:)
+ su => pd(n)(l:u)
+ if(.not.associated(su)) stop 162
+ if(.not.associated(su, cm(n)(l:u))) stop 163
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 164
+ if(su/=cm(n)(l:u)) stop 165
+ class default
+ stop 166
+ end select
+ call schar_ue(su)
+ pd => cm
+ pu => pd(:)(l:u)
+ if(.not.associated(pu)) stop 167
+ if(.not.associated(pu, cm(:)(l:u))) stop 168
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=e) stop 169
+ if(any(pu/=cm(:)(l:u))) stop 170
+ class default
+ stop 171
+ end select
+ call achar_ue(pu)
+ !
+ stop
+
+contains
+
+ subroutine schar_c1(a)
+ character(kind=k), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 172
+ if(.not.associated(a, c1(n))) stop 173
+ if(len(a)/=1) stop 174
+ if(a/=c1(n)) stop 175
+ return
+ end subroutine schar_c1
+
+ subroutine achar_c1(a)
+ character(kind=k), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 176
+ if(.not.associated(a, c1)) stop 177
+ if(len(a)/=1) stop 178
+ if(any(a/=c1)) stop 179
+ return
+ end subroutine achar_c1
+
+ subroutine schar_cm(a)
+ character(kind=k, len=m), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 180
+ if(.not.associated(a, cm(n))) stop 181
+ if(len(a)/=m) stop 182
+ if(a/=cm(n)) stop 183
+ return
+ end subroutine schar_cm
+
+ subroutine achar_cm(a)
+ character(kind=k, len=m), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 184
+ if(.not.associated(a, cm)) stop 185
+ if(len(a)/=m) stop 186
+ if(any(a/=cm)) stop 187
+ return
+ end subroutine achar_cm
+
+ subroutine schar_ce(a)
+ character(kind=k, len=e), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 188
+ if(.not.associated(a, cm(n)(l:u))) stop 189
+ if(len(a)/=e) stop 190
+ if(a/=cm(n)(l:u)) stop 191
+ return
+ end subroutine schar_ce
+
+ subroutine achar_ce(a)
+ character(kind=k, len=e), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 192
+ if(.not.associated(a, cm(:)(l:u))) stop 193
+ if(len(a)/=e) stop 194
+ if(any(a/=cm(:)(l:u))) stop 195
+ return
+ end subroutine achar_ce
+
+ subroutine schar_a1(a)
+ character(kind=k, len=*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 196
+ if(.not.associated(a, c1(n))) stop 197
+ if(len(a)/=1) stop 198
+ if(a/=c1(n)) stop 199
+ return
+ end subroutine schar_a1
+
+ subroutine achar_a1(a)
+ character(kind=k, len=*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 200
+ if(.not.associated(a, c1)) stop 201
+ if(len(a)/=1) stop 202
+ if(any(a/=c1)) stop 203
+ return
+ end subroutine achar_a1
+
+ subroutine schar_am(a)
+ character(kind=k, len=*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 204
+ if(.not.associated(a, cm(n))) stop 205
+ if(len(a)/=m) stop 206
+ if(a/=cm(n)) stop 207
+ return
+ end subroutine schar_am
+
+ subroutine achar_am(a)
+ character(kind=k, len=*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 208
+ if(.not.associated(a, cm)) stop 209
+ if(len(a)/=m) stop 210
+ if(any(a/=cm)) stop 211
+ return
+ end subroutine achar_am
+
+ subroutine schar_ae(a)
+ character(kind=k, len=*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 212
+ if(.not.associated(a, cm(n)(l:u))) stop 213
+ if(len(a)/=e) stop 214
+ if(a/=cm(n)(l:u)) stop 215
+ return
+ end subroutine schar_ae
+
+ subroutine achar_ae(a)
+ character(kind=k, len=*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 216
+ if(.not.associated(a, cm(:)(l:u))) stop 217
+ if(len(a)/=e) stop 218
+ if(any(a/=cm(:)(l:u))) stop 219
+ return
+ end subroutine achar_ae
+
+ subroutine schar_d1(a)
+ character(kind=k, len=:), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 220
+ if(.not.associated(a, c1(n))) stop 221
+ if(len(a)/=1) stop 222
+ if(a/=c1(n)) stop 223
+ return
+ end subroutine schar_d1
+
+ subroutine achar_d1(a)
+ character(kind=k, len=:), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 224
+ if(.not.associated(a, c1)) stop 225
+ if(len(a)/=1) stop 226
+ if(any(a/=c1)) stop 227
+ return
+ end subroutine achar_d1
+
+ subroutine schar_dm(a)
+ character(kind=k, len=:), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 228
+ if(.not.associated(a, cm(n))) stop 229
+ if(len(a)/=m) stop 230
+ if(a/=cm(n)) stop 231
+ return
+ end subroutine schar_dm
+
+ subroutine achar_dm(a)
+ character(kind=k, len=:), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 232
+ if(.not.associated(a, cm)) stop 233
+ if(len(a)/=m) stop 234
+ if(any(a/=cm)) stop 235
+ return
+ end subroutine achar_dm
+
+ subroutine schar_de(a)
+ character(kind=k, len=:), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 236
+ if(.not.associated(a, cm(n)(l:u))) stop 237
+ if(len(a)/=e) stop 238
+ if(a/=cm(n)(l:u)) stop 239
+ return
+ end subroutine schar_de
+
+ subroutine achar_de(a)
+ character(kind=k, len=:), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 240
+ if(.not.associated(a, cm(:)(l:u))) stop 241
+ if(len(a)/=e) stop 242
+ if(any(a/=cm(:)(l:u))) stop 243
+ return
+ end subroutine achar_de
+
+ subroutine schar_u1(a)
+ class(*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 244
+ if(.not.associated(a, c1(n))) stop 245
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=1) stop 246
+ if(a/=c1(n)) stop 247
+ class default
+ stop 248
+ end select
+ return
+ end subroutine schar_u1
+
+ subroutine achar_u1(a)
+ class(*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 249
+ if(.not.associated(a, c1)) stop 250
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=1) stop 251
+ if(any(a/=c1)) stop 252
+ class default
+ stop 253
+ end select
+ return
+ end subroutine achar_u1
+
+ subroutine schar_um(a)
+ class(*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 254
+ if(.not.associated(a)) stop 255
+ if(.not.associated(a, cm(n))) stop 256
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=m) stop 257
+ if(a/=cm(n)) stop 258
+ class default
+ stop 259
+ end select
+ return
+ end subroutine schar_um
+
+ subroutine achar_um(a)
+ class(*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 260
+ if(.not.associated(a, cm)) stop 261
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=m) stop 262
+ if(any(a/=cm)) stop 263
+ class default
+ stop 264
+ end select
+ return
+ end subroutine achar_um
+
+ subroutine schar_ue(a)
+ class(*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 265
+ if(.not.associated(a, cm(n)(l:u))) stop 266
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=e) stop 267
+ if(a/=cm(n)(l:u)) stop 268
+ class default
+ stop 269
+ end select
+ return
+ end subroutine schar_ue
+
+ subroutine achar_ue(a)
+ class(*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 270
+ if(.not.associated(a, cm(:)(l:u))) stop 271
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=e) stop 272
+ if(any(a/=cm(:)(l:u))) stop 273
+ class default
+ stop 274
+ end select
+ return
+ end subroutine achar_ue
+
+end program main_p
diff --git a/gcc/testsuite/gfortran.dg/character_workout_4.f90 b/gcc/testsuite/gfortran.dg/character_workout_4.f90
new file mode 100644
index 0000000..993c742
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/character_workout_4.f90
@@ -0,0 +1,689 @@
+! { dg-do run }
+!
+! Tests fix for PR100120/100816/100818/100819/100821
+!
+
+program main_p
+
+ implicit none
+
+ integer, parameter :: k = 4
+ integer, parameter :: n = 11
+ integer, parameter :: m = 7
+ integer, parameter :: l = 3
+ integer, parameter :: u = 5
+ integer, parameter :: e = u-l+1
+ integer, parameter :: c = int(z"FF00")
+
+ character(kind=k), target :: c1(n)
+ character(len=m, kind=k), target :: cm(n)
+ !
+ character(kind=k), pointer :: s1
+ character(len=m, kind=k), pointer :: sm
+ character(len=e, kind=k), pointer :: se
+ character(len=:, kind=k), pointer :: sd
+ !
+ character(kind=k), pointer :: p1(:)
+ character(len=m, kind=k), pointer :: pm(:)
+ character(len=e, kind=k), pointer :: pe(:)
+ character(len=:, kind=k), pointer :: pd(:)
+
+ class(*), pointer :: su
+ class(*), pointer :: pu(:)
+
+ integer :: i, j
+
+ nullify(s1, sm, se, sd, su)
+ nullify(p1, pm, pe, pd, pu)
+ c1 = [(char(i+c, kind=k), i=1,n)]
+ do i = 1, n
+ do j = 1, m
+ cm(i)(j:j) = char(i*m+j+c-m, kind=k)
+ end do
+ end do
+
+ s1 => c1(n)
+ if(.not.associated(s1)) stop 1
+ if(.not.associated(s1, c1(n))) stop 2
+ if(len(s1)/=1) stop 3
+ if(s1/=c1(n)) stop 4
+ call schar_c1(s1)
+ call schar_a1(s1)
+ p1 => c1
+ if(.not.associated(p1)) stop 5
+ if(.not.associated(p1, c1)) stop 6
+ if(len(p1)/=1) stop 7
+ if(any(p1/=c1)) stop 8
+ call achar_c1(p1)
+ call achar_a1(p1)
+ !
+ sm => cm(n)
+ if(.not.associated(sm)) stop 9
+ if(.not.associated(sm, cm(n))) stop 10
+ if(len(sm)/=m) stop 11
+ if(sm/=cm(n)) stop 12
+ call schar_cm(sm)
+ call schar_am(sm)
+ pm => cm
+ if(.not.associated(pm)) stop 13
+ if(.not.associated(pm, cm)) stop 14
+ if(len(pm)/=m) stop 15
+ if(any(pm/=cm)) stop 16
+ call achar_cm(pm)
+ call achar_am(pm)
+ !
+ se => cm(n)(l:u)
+ if(.not.associated(se)) stop 17
+ if(.not.associated(se, cm(n)(l:u))) stop 18
+ if(len(se)/=e) stop 19
+ if(se/=cm(n)(l:u)) stop 20
+ call schar_ce(se)
+ call schar_ae(se)
+ pe => cm(:)(l:u)
+ if(.not.associated(pe)) stop 21
+ if(.not.associated(pe, cm(:)(l:u))) stop 22
+ if(len(pe)/=e) stop 23
+ if(any(pe/=cm(:)(l:u))) stop 24
+ call achar_ce(pe)
+ call achar_ae(pe)
+ !
+ sd => c1(n)
+ if(.not.associated(sd)) stop 25
+ if(.not.associated(sd, c1(n))) stop 26
+ if(len(sd)/=1) stop 27
+ if(sd/=c1(n)) stop 28
+ call schar_d1(sd)
+ pd => c1
+ if(.not.associated(pd)) stop 29
+ if(.not.associated(pd, c1)) stop 30
+ if(len(pd)/=1) stop 31
+ if(any(pd/=c1)) stop 32
+ call achar_d1(pd)
+ !
+ sd => cm(n)
+ if(.not.associated(sd)) stop 33
+ if(.not.associated(sd, cm(n))) stop 34
+ if(len(sd)/=m) stop 35
+ if(sd/=cm(n)) stop 36
+ call schar_dm(sd)
+ pd => cm
+ if(.not.associated(pd)) stop 37
+ if(.not.associated(pd, cm)) stop 38
+ if(len(pd)/=m) stop 39
+ if(any(pd/=cm)) stop 40
+ call achar_dm(pd)
+ !
+ sd => cm(n)(l:u)
+ if(.not.associated(sd)) stop 41
+ if(.not.associated(sd, cm(n)(l:u))) stop 42
+ if(len(sd)/=e) stop 43
+ if(sd/=cm(n)(l:u)) stop 44
+ call schar_de(sd)
+ pd => cm(:)(l:u)
+ if(.not.associated(pd)) stop 45
+ if(.not.associated(pd, cm(:)(l:u))) stop 46
+ if(len(pd)/=e) stop 47
+ if(any(pd/=cm(:)(l:u))) stop 48
+ call achar_de(pd)
+ !
+ sd => c1(n)
+ s1 => sd
+ if(.not.associated(s1)) stop 49
+ if(.not.associated(s1, c1(n))) stop 50
+ if(len(s1)/=1) stop 51
+ if(s1/=c1(n)) stop 52
+ call schar_c1(s1)
+ call schar_a1(s1)
+ pd => c1
+ s1 => pd(n)
+ if(.not.associated(s1)) stop 53
+ if(.not.associated(s1, c1(n))) stop 54
+ if(len(s1)/=1) stop 55
+ if(s1/=c1(n)) stop 56
+ call schar_c1(s1)
+ call schar_a1(s1)
+ pd => c1
+ p1 => pd
+ if(.not.associated(p1)) stop 57
+ if(.not.associated(p1, c1)) stop 58
+ if(len(p1)/=1) stop 59
+ if(any(p1/=c1)) stop 60
+ call achar_c1(p1)
+ call achar_a1(p1)
+ !
+ sd => cm(n)
+ sm => sd
+ if(.not.associated(sm)) stop 61
+ if(.not.associated(sm, cm(n))) stop 62
+ if(len(sm)/=m) stop 63
+ if(sm/=cm(n)) stop 64
+ call schar_cm(sm)
+ call schar_am(sm)
+ pd => cm
+ sm => pd(n)
+ if(.not.associated(sm)) stop 65
+ if(.not.associated(sm, cm(n))) stop 66
+ if(len(sm)/=m) stop 67
+ if(sm/=cm(n)) stop 68
+ call schar_cm(sm)
+ call schar_am(sm)
+ pd => cm
+ pm => pd
+ if(.not.associated(pm)) stop 69
+ if(.not.associated(pm, cm)) stop 70
+ if(len(pm)/=m) stop 71
+ if(any(pm/=cm)) stop 72
+ call achar_cm(pm)
+ call achar_am(pm)
+ !
+ sd => cm(n)(l:u)
+ se => sd
+ if(.not.associated(se)) stop 73
+ if(.not.associated(se, cm(n)(l:u))) stop 74
+ if(len(se)/=e) stop 75
+ if(se/=cm(n)(l:u)) stop 76
+ call schar_ce(se)
+ call schar_ae(se)
+ pd => cm(:)(l:u)
+ pe => pd
+ if(.not.associated(pe)) stop 77
+ if(.not.associated(pe, cm(:)(l:u))) stop 78
+ if(len(pe)/=e) stop 79
+ if(any(pe/=cm(:)(l:u))) stop 80
+ call achar_ce(pe)
+ call achar_ae(pe)
+ !
+ su => c1(n)
+ if(.not.associated(su)) stop 81
+ if(.not.associated(su, c1(n))) stop 82
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=1) stop 83
+ if(su/=c1(n)) stop 84
+ class default
+ stop 85
+ end select
+ call schar_u1(su)
+ pu => c1
+ if(.not.associated(pu)) stop 86
+ if(.not.associated(pu, c1)) stop 87
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=1) stop 88
+ if(any(pu/=c1)) stop 89
+ class default
+ stop 90
+ end select
+ call achar_u1(pu)
+ !
+ su => cm(n)
+ if(.not.associated(su)) stop 91
+ if(.not.associated(su)) stop 92
+ if(.not.associated(su, cm(n))) stop 93
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=m) stop 94
+ if(su/=cm(n)) stop 95
+ class default
+ stop 96
+ end select
+ call schar_um(su)
+ pu => cm
+ if(.not.associated(pu)) stop 97
+ if(.not.associated(pu, cm)) stop 98
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=m) stop 99
+ if(any(pu/=cm)) stop 100
+ class default
+ stop 101
+ end select
+ call achar_um(pu)
+ !
+ su => cm(n)(l:u)
+ if(.not.associated(su)) stop 102
+ if(.not.associated(su, cm(n)(l:u))) stop 103
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 104
+ if(su/=cm(n)(l:u)) stop 105
+ class default
+ stop 106
+ end select
+ call schar_ue(su)
+ pu => cm(:)(l:u)
+ if(.not.associated(pu)) stop 107
+ if(.not.associated(pu, cm(:)(l:u))) stop 108
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=e) stop 109
+ if(any(pu/=cm(:)(l:u))) stop 110
+ class default
+ stop 111
+ end select
+ call achar_ue(pu)
+ !
+ sd => c1(n)
+ su => sd
+ if(.not.associated(su)) stop 112
+ if(.not.associated(su, c1(n))) stop 113
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=1) stop 114
+ if(su/=c1(n)) stop 115
+ class default
+ stop 116
+ end select
+ call schar_u1(su)
+ pd => c1
+ su => pd(n)
+ if(.not.associated(su)) stop 117
+ if(.not.associated(su, c1(n))) stop 118
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=1) stop 119
+ if(su/=c1(n)) stop 120
+ class default
+ stop 121
+ end select
+ call schar_u1(su)
+ pd => c1
+ pu => pd
+ if(.not.associated(pu)) stop 122
+ if(.not.associated(pu, c1)) stop 123
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=1) stop 124
+ if(any(pu/=c1)) stop 125
+ class default
+ stop 126
+ end select
+ call achar_u1(pu)
+ !
+ sd => cm(n)
+ su => sd
+ if(.not.associated(su)) stop 127
+ if(.not.associated(su, cm(n))) stop 128
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=m) stop 129
+ if(su/=cm(n)) stop 130
+ class default
+ stop 131
+ end select
+ call schar_um(su)
+ pd => cm
+ su => pd(n)
+ if(.not.associated(su)) stop 132
+ if(.not.associated(su, cm(n))) stop 133
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=m) stop 134
+ if(su/=cm(n)) stop 135
+ class default
+ stop 136
+ end select
+ call schar_um(su)
+ pd => cm
+ pu => pd
+ if(.not.associated(pu)) stop 137
+ if(.not.associated(pu, cm)) stop 138
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=m) stop 139
+ if(any(pu/=cm)) stop 140
+ class default
+ stop 141
+ end select
+ call achar_um(pu)
+ !
+ sd => cm(n)(l:u)
+ su => sd
+ if(.not.associated(su)) stop 142
+ if(.not.associated(su, cm(n)(l:u))) stop 143
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 144
+ if(su/=cm(n)(l:u)) stop 145
+ class default
+ stop 146
+ end select
+ call schar_ue(su)
+ pd => cm(:)(l:u)
+ su => pd(n)
+ if(.not.associated(su)) stop 147
+ if(.not.associated(su, cm(n)(l:u))) stop 148
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 149
+ if(su/=cm(n)(l:u)) stop 150
+ class default
+ stop 151
+ end select
+ call schar_ue(su)
+ pd => cm(:)(l:u)
+ pu => pd
+ if(.not.associated(pu)) stop 152
+ if(.not.associated(pu, cm(:)(l:u))) stop 153
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=e) stop 154
+ if(any(pu/=cm(:)(l:u))) stop 155
+ class default
+ stop 156
+ end select
+ call achar_ue(pu)
+ !
+ sd => cm(n)
+ su => sd(l:u)
+ if(.not.associated(su)) stop 157
+ if(.not.associated(su, cm(n)(l:u))) stop 158
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 159
+ if(su/=cm(n)(l:u)) stop 160
+ class default
+ stop 161
+ end select
+ call schar_ue(su)
+ pd => cm(:)
+ su => pd(n)(l:u)
+ if(.not.associated(su)) stop 162
+ if(.not.associated(su, cm(n)(l:u))) stop 163
+ select type(su)
+ type is(character(len=*, kind=k))
+ if(len(su)/=e) stop 164
+ if(su/=cm(n)(l:u)) stop 165
+ class default
+ stop 166
+ end select
+ call schar_ue(su)
+ pd => cm
+ pu => pd(:)(l:u)
+ if(.not.associated(pu)) stop 167
+ if(.not.associated(pu, cm(:)(l:u))) stop 168
+ select type(pu)
+ type is(character(len=*, kind=k))
+ if(len(pu)/=e) stop 169
+ if(any(pu/=cm(:)(l:u))) stop 170
+ class default
+ stop 171
+ end select
+ call achar_ue(pu)
+ !
+ stop
+
+contains
+
+ subroutine schar_c1(a)
+ character(kind=k), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 172
+ if(.not.associated(a, c1(n))) stop 173
+ if(len(a)/=1) stop 174
+ if(a/=c1(n)) stop 175
+ return
+ end subroutine schar_c1
+
+ subroutine achar_c1(a)
+ character(kind=k), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 176
+ if(.not.associated(a, c1)) stop 177
+ if(len(a)/=1) stop 178
+ if(any(a/=c1)) stop 179
+ return
+ end subroutine achar_c1
+
+ subroutine schar_cm(a)
+ character(kind=k, len=m), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 180
+ if(.not.associated(a, cm(n))) stop 181
+ if(len(a)/=m) stop 182
+ if(a/=cm(n)) stop 183
+ return
+ end subroutine schar_cm
+
+ subroutine achar_cm(a)
+ character(kind=k, len=m), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 184
+ if(.not.associated(a, cm)) stop 185
+ if(len(a)/=m) stop 186
+ if(any(a/=cm)) stop 187
+ return
+ end subroutine achar_cm
+
+ subroutine schar_ce(a)
+ character(kind=k, len=e), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 188
+ if(.not.associated(a, cm(n)(l:u))) stop 189
+ if(len(a)/=e) stop 190
+ if(a/=cm(n)(l:u)) stop 191
+ return
+ end subroutine schar_ce
+
+ subroutine achar_ce(a)
+ character(kind=k, len=e), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 192
+ if(.not.associated(a, cm(:)(l:u))) stop 193
+ if(len(a)/=e) stop 194
+ if(any(a/=cm(:)(l:u))) stop 195
+ return
+ end subroutine achar_ce
+
+ subroutine schar_a1(a)
+ character(kind=k, len=*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 196
+ if(.not.associated(a, c1(n))) stop 197
+ if(len(a)/=1) stop 198
+ if(a/=c1(n)) stop 199
+ return
+ end subroutine schar_a1
+
+ subroutine achar_a1(a)
+ character(kind=k, len=*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 200
+ if(.not.associated(a, c1)) stop 201
+ if(len(a)/=1) stop 202
+ if(any(a/=c1)) stop 203
+ return
+ end subroutine achar_a1
+
+ subroutine schar_am(a)
+ character(kind=k, len=*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 204
+ if(.not.associated(a, cm(n))) stop 205
+ if(len(a)/=m) stop 206
+ if(a/=cm(n)) stop 207
+ return
+ end subroutine schar_am
+
+ subroutine achar_am(a)
+ character(kind=k, len=*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 208
+ if(.not.associated(a, cm)) stop 209
+ if(len(a)/=m) stop 210
+ if(any(a/=cm)) stop 211
+ return
+ end subroutine achar_am
+
+ subroutine schar_ae(a)
+ character(kind=k, len=*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 212
+ if(.not.associated(a, cm(n)(l:u))) stop 213
+ if(len(a)/=e) stop 214
+ if(a/=cm(n)(l:u)) stop 215
+ return
+ end subroutine schar_ae
+
+ subroutine achar_ae(a)
+ character(kind=k, len=*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 216
+ if(.not.associated(a, cm(:)(l:u))) stop 217
+ if(len(a)/=e) stop 218
+ if(any(a/=cm(:)(l:u))) stop 219
+ return
+ end subroutine achar_ae
+
+ subroutine schar_d1(a)
+ character(kind=k, len=:), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 220
+ if(.not.associated(a, c1(n))) stop 221
+ if(len(a)/=1) stop 222
+ if(a/=c1(n)) stop 223
+ return
+ end subroutine schar_d1
+
+ subroutine achar_d1(a)
+ character(kind=k, len=:), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 224
+ if(.not.associated(a, c1)) stop 225
+ if(len(a)/=1) stop 226
+ if(any(a/=c1)) stop 227
+ return
+ end subroutine achar_d1
+
+ subroutine schar_dm(a)
+ character(kind=k, len=:), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 228
+ if(.not.associated(a, cm(n))) stop 229
+ if(len(a)/=m) stop 230
+ if(a/=cm(n)) stop 231
+ return
+ end subroutine schar_dm
+
+ subroutine achar_dm(a)
+ character(kind=k, len=:), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 232
+ if(.not.associated(a, cm)) stop 233
+ if(len(a)/=m) stop 234
+ if(any(a/=cm)) stop 235
+ return
+ end subroutine achar_dm
+
+ subroutine schar_de(a)
+ character(kind=k, len=:), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 236
+ if(.not.associated(a, cm(n)(l:u))) stop 237
+ if(len(a)/=e) stop 238
+ if(a/=cm(n)(l:u)) stop 239
+ return
+ end subroutine schar_de
+
+ subroutine achar_de(a)
+ character(kind=k, len=:), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 240
+ if(.not.associated(a, cm(:)(l:u))) stop 241
+ if(len(a)/=e) stop 242
+ if(any(a/=cm(:)(l:u))) stop 243
+ return
+ end subroutine achar_de
+
+ subroutine schar_u1(a)
+ class(*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 244
+ if(.not.associated(a, c1(n))) stop 245
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=1) stop 246
+ if(a/=c1(n)) stop 247
+ class default
+ stop 248
+ end select
+ return
+ end subroutine schar_u1
+
+ subroutine achar_u1(a)
+ class(*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 249
+ if(.not.associated(a, c1)) stop 250
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=1) stop 251
+ if(any(a/=c1)) stop 252
+ class default
+ stop 253
+ end select
+ return
+ end subroutine achar_u1
+
+ subroutine schar_um(a)
+ class(*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 254
+ if(.not.associated(a)) stop 255
+ if(.not.associated(a, cm(n))) stop 256
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=m) stop 257
+ if(a/=cm(n)) stop 258
+ class default
+ stop 259
+ end select
+ return
+ end subroutine schar_um
+
+ subroutine achar_um(a)
+ class(*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 260
+ if(.not.associated(a, cm)) stop 261
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=m) stop 262
+ if(any(a/=cm)) stop 263
+ class default
+ stop 264
+ end select
+ return
+ end subroutine achar_um
+
+ subroutine schar_ue(a)
+ class(*), pointer, intent(in) :: a
+
+ if(.not.associated(a)) stop 265
+ if(.not.associated(a, cm(n)(l:u))) stop 266
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=e) stop 267
+ if(a/=cm(n)(l:u)) stop 268
+ class default
+ stop 269
+ end select
+ return
+ end subroutine schar_ue
+
+ subroutine achar_ue(a)
+ class(*), pointer, intent(in) :: a(:)
+
+ if(.not.associated(a)) stop 270
+ if(.not.associated(a, cm(:)(l:u))) stop 271
+ select type(a)
+ type is(character(len=*, kind=k))
+ if(len(a)/=e) stop 272
+ if(any(a/=cm(:)(l:u))) stop 273
+ class default
+ stop 274
+ end select
+ return
+ end subroutine achar_ue
+
+end program main_p
diff --git a/gcc/testsuite/gfortran.dg/class_dummy_6.f90 b/gcc/testsuite/gfortran.dg/class_dummy_6.f90
new file mode 100644
index 0000000..79f6e86
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_dummy_6.f90
@@ -0,0 +1,65 @@
+! { dg-do run }
+!
+! Test the fix for PR99819 - explicit shape class arrays in different
+! procedures caused an ICE.
+!
+! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+program p
+ type t
+ integer :: i
+ end type
+ class(t), allocatable :: dum1(:), dum2(:), dum3(:,:)
+
+ allocate (t :: dum1(3), dum2(10), dum3(2,5))
+ dum2%i = [1,2,3,4,5,6,7,8,9,10]
+ dum3%i = reshape ([1,2,3,4,5,6,7,8,9,10],[2,5])
+
+! Somewhat elaborated versions of the PR procedures.
+ if (f (dum1, dum2, dum3) .ne. 10) stop 1
+ if (g (dum1) .ne. 3) stop 2
+
+! Test the original versions of the procedures.
+ if (f_original (dum1, dum2) .ne. 3) stop 3
+ if (g_original (dum2) .ne. 10) stop 4
+
+contains
+ integer function f(x, y, z)
+ class(t) :: x(:)
+ class(t) :: y(size( x))
+ class(t) :: z(2,*)
+ if (size (y) .ne. 3) stop 5
+ if (size (z) .ne. 0) stop 6
+ select type (y)
+ type is (t)
+ f = 1
+ if (any (y%i .ne. [1,2,3])) stop 7
+ class default
+ f = 0
+ end select
+ select type (z)
+ type is (t)
+ f = f*10
+ if (any (z(1,1:4)%i .ne. [1,3,5,7])) stop 8
+ class default
+ f = 0
+ end select
+ end
+ integer function g(z)
+ class(t) :: z(:)
+ type(t) :: u(size(z))
+ g = size (u)
+ end
+
+ integer function f_original(x, y)
+ class(t) :: x(:)
+ class(*) :: y(size (x))
+ f_original = size (y)
+ end
+
+ integer function g_original(z)
+ class(*) :: z(:)
+ type(t) :: u(size(z))
+ g_original = size (u)
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/class_dummy_7.f90 b/gcc/testsuite/gfortran.dg/class_dummy_7.f90
new file mode 100644
index 0000000..107a4ab
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_dummy_7.f90
@@ -0,0 +1,60 @@
+! { dg-do run }
+!
+! Test the fix for PR46991 - enable class assumed size arrays
+!
+! Reported by Tobias Burnus <burnus@gcc.gnu.org>
+! from http://j3-fortran.org/pipermail/j3/2010-December/004084.html
+! submitted by Robert Corbett.
+!
+ MODULE TYPES
+ PRIVATE
+ PUBLIC REC, REC2
+
+ TYPE REC
+ INTEGER A
+ END TYPE
+
+ TYPE, EXTENDS(REC) :: REC2
+ INTEGER B
+ END TYPE
+ END
+
+ SUBROUTINE SUB1(A, N)
+ USE TYPES
+ CLASS(REC), INTENT(IN) :: A(*)
+ INTERFACE
+ SUBROUTINE SUB2(A, N, IARRAY)
+ USE TYPES
+ TYPE(REC) A(*)
+ INTEGER :: N, IARRAY(N)
+ END
+ END INTERFACE
+
+ CALL SUB2(A, N,[1,2,2,3,3,4,4,5,5,6])
+ select type (B => A(1:N))
+ type is (REC2)
+ call SUB2(B%REC,N,[1,2,3,4,5,6,7,8,9,10])
+ end select
+
+ END
+
+ SUBROUTINE SUB2(A, N, IARRAY)
+ USE TYPES
+ TYPE(REC) A(*)
+ INTEGER :: N, IARRAY(N)
+ if (any (A(:N)%A .ne. IARRAY(:N))) stop 1
+ END
+
+ PROGRAM MAIN
+ USE TYPES
+ CLASS(REC), ALLOCATABLE :: A(:)
+ INTERFACE
+ SUBROUTINE SUB1(A, N)
+ USE TYPES
+ CLASS(REC), INTENT(IN) :: A(*)
+ END SUBROUTINE
+ END INTERFACE
+
+ A = [ (REC2(I, I+1), I = 1, 10) ]
+ CALL SUB1(A, 10)
+ END
diff --git a/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 b/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90
new file mode 100644
index 0000000..3526374
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+!
+! PR fortran/99817
+!
+! Contributed by G. Steinmetz
+!
+subroutine s1 (x)
+ character(*) :: x(*)[*]
+end
+
+subroutine s2 (x)
+ character(*), dimension(*), codimension[*] :: x
+ integer :: i
+ i = len(x)
+end
+
+subroutine s3 (x, y)
+ character(*), dimension(:) :: x[*]
+ character(*) :: y
+end
+
+subroutine s4 (x, y, z)
+ character(*), dimension(:) :: x[2, *]
+ character(*), dimension(*) :: y
+ character(*) :: z
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray_3.f90 b/gcc/testsuite/gfortran.dg/coarray_3.f90
index d152ce1..1c294cd 100644
--- a/gcc/testsuite/gfortran.dg/coarray_3.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_3.f90
@@ -11,11 +11,11 @@ character(len=30) :: str(2)
critical fkl ! { dg-error "Syntax error in CRITICAL" }
end critical fkl ! { dg-error "Expecting END PROGRAM" }
-sync all (stat=1) ! { dg-error "Syntax error in SYNC ALL" }
+sync all (stat=1) ! { dg-error "Non-variable expression" }
sync all ( stat = n,stat=k) ! { dg-error "Redundant STAT" }
sync memory (errmsg=str) ! { dg-error "must be a scalar CHARACTER variable" }
sync memory (errmsg=n) ! { dg-error "must be a scalar CHARACTER variable" }
-sync images (*, stat=1.0) ! { dg-error "Syntax error in SYNC IMAGES" }
+sync images (*, stat=1.0) ! { dg-error "must be a scalar INTEGER variable" }
sync images (-1) ! { dg-error "must between 1 and num_images" }
sync images (1)
sync images ( [ 1 ])
diff --git a/gcc/testsuite/gfortran.dg/coarray_48.f90 b/gcc/testsuite/gfortran.dg/coarray_48.f90
new file mode 100644
index 0000000..adec014
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_48.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+!
+! Fix for P99818 in which wrong code caused an ICE.
+!
+! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+module m
+ type t
+ integer :: a
+ contains
+ procedure :: s
+ end type
+contains
+ subroutine s(x)
+ class(t) :: x[*]
+ end
+end
+program p
+ use m
+ associate (y => t(1))
+ call y%s ! { dg-error "must be a coarray" }
+ end associate
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray_collectives_17.f90 b/gcc/testsuite/gfortran.dg/coarray_collectives_17.f90
new file mode 100644
index 0000000..84a6645
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_collectives_17.f90
@@ -0,0 +1,42 @@
+! { dg-do run }
+! { dg-options "-fcoarray=single" }
+!
+! PR 100337
+! Test case inspired by code submitted by Brad Richardson
+
+program main
+ implicit none
+
+ integer, parameter :: MESSAGE = 42
+ integer :: result
+
+ call myco_broadcast(MESSAGE, result, 1)
+
+ if (result /= MESSAGE) error stop 1
+contains
+ subroutine myco_broadcast(m, r, source_image, stat, errmsg)
+ integer, intent(in) :: m
+ integer, intent(out) :: r
+ integer, intent(in) :: source_image
+ integer, intent(out), optional :: stat
+ character(len=*), intent(inout), optional :: errmsg
+
+ integer :: data_length
+
+ data_length = 1
+
+ call co_broadcast(data_length, source_image, stat, errmsg)
+
+ if (present(stat)) then
+ if (stat /= 0) return
+ end if
+
+ if (this_image() == source_image) then
+ r = m
+ end if
+
+ call co_broadcast(r, source_image, stat, errmsg)
+ end subroutine
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/coarray_sync.f90 b/gcc/testsuite/gfortran.dg/coarray_sync.f90
new file mode 100644
index 0000000..f3d6be1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_sync.f90
@@ -0,0 +1,44 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+! PR fortran/99351 - ICE in gfc_finish_var_decl, at fortran/trans-decl.c:695
+
+module m
+ character(3), parameter :: c = 'abc'
+ integer, parameter :: s = 42
+ integer, target :: i
+ character(:), allocatable :: a
+ target :: a
+contains
+ subroutine s1
+ allocate (character(42) :: a)
+ sync all (stat=i)
+ sync all (stat=f())
+ sync all (errmsg=a)
+ sync all (errmsg=p())
+ sync all (stat=a%len) ! { dg-error "variable definition context" }
+ sync all (stat=s) ! { dg-error "variable definition context" }
+ sync all (errmsg=c) ! { dg-error "variable definition context" }
+ end
+ subroutine s2
+ sync images (*, stat=i)
+ sync images (*, errmsg=a)
+ sync images (*, stat=a%len) ! { dg-error "variable definition context" }
+ sync images (*, stat=s) ! { dg-error "variable definition context" }
+ sync images (*, errmsg=c) ! { dg-error "variable definition context" }
+ end
+ subroutine s3
+ sync memory (stat=i,errmsg=p())
+ sync memory (stat=f(),errmsg=a)
+ sync memory (stat=a%len) ! { dg-error "variable definition context" }
+ sync memory (stat=s) ! { dg-error "variable definition context" }
+ sync memory (errmsg=c) ! { dg-error "variable definition context" }
+ end
+ integer function f()
+ pointer :: f
+ f => i
+ end function f
+ function p()
+ character(:), pointer :: p
+ p => a
+ end function p
+end
diff --git a/gcc/testsuite/gfortran.dg/entry_24.f90 b/gcc/testsuite/gfortran.dg/entry_24.f90
new file mode 100644
index 0000000..9773597
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/entry_24.f90
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! PR fortran/87737 - improve check on function entry characteristics
+
+function f() ! { dg-error "mismatched characteristics" }
+ character(:), allocatable :: f
+ character(1) :: g
+ f = 'f'
+ return
+entry g()
+ g = 'g'
+end
+
+function f2() ! { dg-error "mismatched characteristics" }
+ character(1) :: f2
+ character(1), allocatable :: g2
+ f2 = 'f'
+ return
+entry g2()
+ g2 = 'g'
+end
diff --git a/gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90 b/gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90
new file mode 100644
index 0000000..3b3c260
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/101084
+
+program p
+ integer, parameter :: a(0) = 1
+ print int(a) ! { dg-error "Non-character non-Hollerith in FORMAT tag" }
+end
diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90
new file mode 100644
index 0000000..e1c6830
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90
@@ -0,0 +1,11 @@
+! PR fortran/100642
+! Contributed by G. Steinmetz
+program p
+ !use omp_lib, only: omp_depend_kind
+ use iso_c_binding, only: c_intptr_t
+ integer, parameter :: omp_depend_kind = 2*c_intptr_t
+ integer(omp_depend_kind) :: a, b
+ !$acc data
+ !$omp depobj(b) depend(out:a) ! { dg-error "The !\\\$OMP DEPOBJ directive cannot be specified within a !\\\$ACC DATA region" }
+ !$acc end data
+end
diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/mixed-1.f b/gcc/testsuite/gfortran.dg/goacc-gomp/mixed-1.f
new file mode 100644
index 0000000..2e12f17
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc-gomp/mixed-1.f
@@ -0,0 +1,23 @@
+! { dg-additional-options "-fdump-tree-original" }
+
+ ! OMP PARALLEL gets parsed and is properly handled
+ ! But ACC& gives an error
+ ! [Before: an error is printed but OMP parses 'parallel loop ...']
+ subroutine one
+ implicit none
+ integer i
+!$omp parallel
+!$acc& loop independent ! { dg-error "Wrong OpenMP continuation at .1.: expected !.OMP, got !.ACC" }
+ do i = 1, 5
+ end do
+!$omp end parallel
+ end
+
+ ! [Before: Bogus 'Wrong OpenMP continuation' as it was read as continuation line!]
+ subroutine two
+!$omp parallel
+!$acc loop independent ! { dg-error "The !.ACC LOOP directive cannot be specified within a !.OMP PARALLEL region" }
+ do i = 1, 5
+ end do
+!$omp end parallel
+ end
diff --git a/gcc/testsuite/gfortran.dg/goacc/asyncwait-1.f95 b/gcc/testsuite/gfortran.dg/goacc/asyncwait-1.f95
index c8a72fa..f67dd9c 100644
--- a/gcc/testsuite/gfortran.dg/goacc/asyncwait-1.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/asyncwait-1.f95
@@ -53,7 +53,7 @@ program asyncwait
end do
!$acc end parallel ! { dg-error "Unexpected \\\!\\\$ACC END PARALLEL" }
- !$acc parallel copyin (a(1:N)) copy (b(1:N)) async (*) ! { dg-error "Invalid character in name at" }
+ !$acc parallel copyin (a(1:N)) copy (b(1:N)) async (*) ! { dg-error "Invalid character in name" }
do i = 1, N
b(i) = a(i)
end do
diff --git a/gcc/testsuite/gfortran.dg/goacc/attach-descriptor.f90 b/gcc/testsuite/gfortran.dg/goacc/attach-descriptor.f90
index 373bdcb..8c2ee4a 100644
--- a/gcc/testsuite/gfortran.dg/goacc/attach-descriptor.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/attach-descriptor.f90
@@ -12,11 +12,11 @@ program att
!$acc enter data attach(myvar%arr2, myptr)
! { dg-final { scan-tree-dump-times "(?n)#pragma acc enter data map\\(attach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(attach:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) myptr\\.data \\\[bias: 0\\\]\\);$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(attach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(attach:myptr\\.data \\\[bias: 0\\\]\\)$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_data map\\(attach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(attach:myptr\\.data \\\[bias: 0\\\]\\)$" 1 "gimple" } }
!$acc exit data detach(myvar%arr2, myptr)
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(detach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(detach:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) myptr\\.data \\\[bias: 0\\\]\\);$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(detach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(detach:myptr\\.data \\\[bias: 0\\\]\\)$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(detach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(detach:myptr\\.data \\\[bias: 0\\\]\\)$" 1 "gimple" } }
! Test valid usage and processing of the finalize clause.
!$acc exit data detach(myvar%arr2, myptr) finalize
@@ -24,6 +24,6 @@ program att
! For array-descriptor detaches, we no longer generate a "release" mapping
! for the pointed-to data for gimplify.c to turn into "delete". Make sure
! the mapping still isn't there.
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(force_detach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(force_detach:myptr\\.data \\\[bias: 0\\\]\\) finalize$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(force_detach:myvar\\.arr2 \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(force_detach:myptr\\.data \\\[bias: 0\\\]\\) finalize$" 1 "gimple" } }
end program att
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95
index 6cca3d6..3fb48b3 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95
@@ -5,7 +5,10 @@
! { dg-additional-options "-fopt-info-optimized-omp" }
! { dg-additional-options "-fdump-tree-ompexp" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
-! { dg-additional-options "-fdump-tree-oaccdevlow" }
+! { dg-additional-options "-fdump-tree-oaccloops" }
+
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
program main
implicit none
@@ -37,6 +40,6 @@ end program main
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
-! { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccdevlow" } }
+! { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95
index 715a983..6c8d298 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95
@@ -5,7 +5,10 @@
! { dg-additional-options "-fopt-info-optimized-omp" }
! { dg-additional-options "-fdump-tree-ompexp" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
-! { dg-additional-options "-fdump-tree-oaccdevlow" }
+! { dg-additional-options "-fdump-tree-oaccloops" }
+
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
program main
implicit none
@@ -33,6 +36,6 @@ end program main
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
-! { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccdevlow" } }
+! { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95
index 01f06bb..ce4c08f 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95
@@ -4,7 +4,10 @@
! { dg-additional-options "-O2" }
! { dg-additional-options "-fopt-info-optimized-omp" }
! { dg-additional-options "-fdump-tree-ompexp" }
-! { dg-additional-options "-fdump-tree-oaccdevlow" }
+! { dg-additional-options "-fdump-tree-oaccloops" }
+
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
program main
implicit none
@@ -26,6 +29,6 @@ end program main
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
-! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC parallel offload" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint\\)\\)" 1 "oaccdevlow" } }
+! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC parallel offload" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-routine-nohost.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-routine-nohost.f95
new file mode 100644
index 0000000..07e2063
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-routine-nohost.f95
@@ -0,0 +1,39 @@
+! Check offloaded function's attributes and classification for OpenACC
+! routine with 'nohost' clause.
+
+! { dg-additional-options "-O2" }
+! { dg-additional-options "-fopt-info-optimized-omp" }
+! { dg-additional-options "-fdump-tree-ompexp" }
+! { dg-additional-options "-fdump-tree-oaccloops" }
+
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
+subroutine ROUTINE
+ !$acc routine nohost worker
+ integer, parameter :: n = 1024
+ integer, dimension (0:n-1) :: a, b, c
+ integer :: i
+
+ call setup(a, b)
+
+ !$acc loop ! { dg-bogus "assigned OpenACC .* loop parallelism" }
+ do i = 0, n - 1
+ c(i) = a(i) + b(i)
+ end do
+end subroutine ROUTINE
+
+! Check the offloaded function's attributes.
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(0 1, 1 0, 1 0\\), omp declare target \\(nohost worker\\)\\)\\)" 1 "ompexp" } }
+
+! Check the offloaded function's classification.
+! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine' discarded" 1 "oaccloops" { target { ! offloading_enabled } } } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine_' discarded" 1 "oaccloops" { target offloading_enabled } } }
+! { dg-final { scan-tree-dump-not "(?n)Compute dimensions" "oaccloops" } }
+! { dg-final { scan-tree-dump-not "(?n)__attribute__\\(.*omp declare target \\(nohost" "oaccloops" } }
+! { dg-final { scan-tree-dump-not "(?n)void routine \\(\\)" "oaccloops" { target { ! offloading_enabled } } } }
+! { dg-final { scan-tree-dump-not "(?n)void routine_ \\(\\)" "oaccloops" { target offloading_enabled } } }
+!TODO See PR101551 for 'offloading_enabled' differences.
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95
index 401d527..b065cca 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95
@@ -4,7 +4,10 @@
! { dg-additional-options "-O2" }
! { dg-additional-options "-fopt-info-optimized-omp" }
! { dg-additional-options "-fdump-tree-ompexp" }
-! { dg-additional-options "-fdump-tree-oaccdevlow" }
+! { dg-additional-options "-fdump-tree-oaccloops" }
+
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
subroutine ROUTINE
!$acc routine worker
@@ -25,6 +28,13 @@ end subroutine ROUTINE
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
-! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(0 1, 1 1, 1 1\\), omp declare target \\(worker\\)\\)\\)" 1 "oaccdevlow" } }
+! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine' not discarded" 1 "oaccloops" { target { ! offloading_enabled } } } }
+! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine_' not discarded" 1 "oaccloops" { target offloading_enabled } } }
+! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(0 1, 1 1, 1 1\\), omp declare target \\(worker\\)\\)\\)" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)void routine \\(\\)" 1 "oaccloops" { target { ! offloading_enabled } } } }
+! { dg-final { scan-tree-dump-times "(?n)void routine_ \\(\\)" 1 "oaccloops" { target offloading_enabled } } }
+!TODO See PR101551 for 'offloading_enabled' differences.
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95
index 51061af..f5cb3fe 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95
@@ -4,7 +4,10 @@
! { dg-additional-options "-O2" }
! { dg-additional-options "-fopt-info-optimized-omp" }
! { dg-additional-options "-fdump-tree-ompexp" }
-! { dg-additional-options "-fdump-tree-oaccdevlow" }
+! { dg-additional-options "-fdump-tree-oaccloops" }
+
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
program main
implicit none
@@ -15,6 +18,9 @@ program main
call setup(a, b)
!$acc serial loop copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" }
+ ! { dg-bogus "\[Ww\]arning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 }
+ ! { dg-bogus "\[Ww\]arning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 }
+ ! { dg-bogus "\[Ww\]arning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 }
do i = 0, n - 1
c(i) = a(i) + b(i)
end do
@@ -26,6 +32,6 @@ end program main
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
-! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint\\)\\)" 1 "oaccdevlow" } }
+! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/default-2.f b/gcc/testsuite/gfortran.dg/goacc/default-2.f
index ea82388..963d978 100644
--- a/gcc/testsuite/gfortran.dg/goacc/default-2.f
+++ b/gcc/testsuite/gfortran.dg/goacc/default-2.f
@@ -3,44 +3,44 @@
SUBROUTINE F1
IMPLICIT NONE
-!$ACC KERNELS DEFAULT ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT ! { dg-error "Expected '\\(' after 'default" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT ! { dg-error "Expected '\\(' after 'default" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
-!$ACC KERNELS DEFAULT ( ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT ( ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT ( ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT ( ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
-!$ACC KERNELS DEFAULT (, ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT (, ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT (, ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT (, ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
-!$ACC KERNELS DEFAULT () ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT () ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT () ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT () ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
-!$ACC KERNELS DEFAULT (,) ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT (,) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT (,) ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT (,) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
-!$ACC KERNELS DEFAULT (FIRSTPRIVATE) ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT (FIRSTPRIVATE) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT (FIRSTPRIVATE) ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT (FIRSTPRIVATE) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
-!$ACC KERNELS DEFAULT (PRIVATE) ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT (PRIVATE) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT (PRIVATE) ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT (PRIVATE) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
-!$ACC KERNELS DEFAULT (SHARED) ! { dg-error "Failed to match clause" }
+!$ACC KERNELS DEFAULT (SHARED) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END KERNELS ! { dg-error "Unexpected" }
-!$ACC PARALLEL DEFAULT (SHARED) ! { dg-error "Failed to match clause" }
+!$ACC PARALLEL DEFAULT (SHARED) ! { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
!$ACC END PARALLEL ! { dg-error "Unexpected" }
!$ACC KERNELS DEFAULT (NONE ! { dg-error "Failed to match clause" }
diff --git a/gcc/testsuite/gfortran.dg/goacc/enter-exit-data.f95 b/gcc/testsuite/gfortran.dg/goacc/enter-exit-data.f95
index c2a4979..e71077a 100644
--- a/gcc/testsuite/gfortran.dg/goacc/enter-exit-data.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/enter-exit-data.f95
@@ -28,7 +28,7 @@ contains
!$acc enter data
!$acc enter data if (.false.)
!$acc enter data if (l)
- !$acc enter data if (.false.) if (l) ! { dg-error "Failed to match clause" }
+ !$acc enter data if (.false.) if (l) ! { dg-error "Duplicated 'if' clause" }
!$acc enter data if (i) ! { dg-error "LOGICAL" }
!$acc enter data if (1) ! { dg-error "LOGICAL" }
!$acc enter data if (a) ! { dg-error "LOGICAL" }
@@ -63,7 +63,7 @@ contains
!$acc exit data
!$acc exit data if (.false.)
!$acc exit data if (l)
- !$acc exit data if (.false.) if (l) ! { dg-error "Failed to match clause" }
+ !$acc exit data if (.false.) if (l) ! { dg-error "Duplicated 'if' clause" }
!$acc exit data if (i) ! { dg-error "LOGICAL" }
!$acc exit data if (1) ! { dg-error "LOGICAL" }
!$acc exit data if (a) ! { dg-error "LOGICAL" }
diff --git a/gcc/testsuite/gfortran.dg/goacc/finalize-1.f b/gcc/testsuite/gfortran.dg/goacc/finalize-1.f
index a778858..b706b38 100644
--- a/gcc/testsuite/gfortran.dg/goacc/finalize-1.f
+++ b/gcc/testsuite/gfortran.dg/goacc/finalize-1.f
@@ -13,25 +13,25 @@
!$ACC EXIT DATA DELETE (del_r)
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(release:del_r\\);$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(release:del_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(release:del_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } }
!$ACC EXIT DATA FINALIZE DELETE (del_f)
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(release:del_f\\) finalize;$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(delete:del_f \\\[len: \[0-9\]+\\\]\\) finalize$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(delete:del_f \\\[len: \[0-9\]+\\\]\\) finalize$" 1 "gimple" } }
!$ACC EXIT DATA FINALIZE DELETE (del_f_p(2:5))
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(release:\\*\\(c_char \\*\\) parm\\.0\\.data \\\[len: \[^\\\]\]+\\\]\\) map\\(to:del_f_p \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(alloc:\\(integer\\(kind=1\\)\\\[0:\\\] \\* restrict\\) del_f_p\\.data \\\[pointer assign, bias: \\(.*int.*\\) parm\\.0\\.data - \\(.*int.*\\) del_f_p\\.data\\\]\\) finalize;$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(delete:MEM\\\[\\(c_char \\*\\)\[^\\\]\]+\\\] \\\[len: \[^\\\]\]+\\\]\\) map\\(to:del_f_p \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(alloc:del_f_p\\.data \\\[pointer assign, bias: \[^\\\]\]+\\\]\\) finalize$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(delete:MEM\\\[\\(c_char \\*\\)\[^\\\]\]+\\\] \\\[len: \[^\\\]\]+\\\]\\) map\\(to:del_f_p \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(alloc:del_f_p\\.data \\\[pointer assign, bias: \[^\\\]\]+\\\]\\) finalize$" 1 "gimple" } }
!$ACC EXIT DATA COPYOUT (cpo_r)
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(from:cpo_r\\);$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(from:cpo_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(from:cpo_r \\\[len: \[0-9\]+\\\]\\)$" 1 "gimple" } }
!$ACC EXIT DATA COPYOUT (cpo_f) FINALIZE
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(from:cpo_f\\) finalize;$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(force_from:cpo_f \\\[len: \[0-9\]+\\\]\\) finalize$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(force_from:cpo_f \\\[len: \[0-9\]+\\\]\\) finalize$" 1 "gimple" } }
!$ACC EXIT DATA COPYOUT (cpo_f_p(4:10)) FINALIZE
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(from:\\*\\(c_char \\*\\) parm\\.1\\.data \\\[len: \[^\\\]\]+\\\]\\) map\\(to:cpo_f_p \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(alloc:\\(integer\\(kind=1\\)\\\[0:\\\] \\* restrict\\) cpo_f_p\\.data \\\[pointer assign, bias: \\(.*int.*\\) parm\\.1\\.data - \\(.*int.*\\) cpo_f_p\\.data\\\]\\) finalize;$" 1 "original" } }
-! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_exit_data map\\(force_from:MEM\\\[\\(c_char \\*\\)\[^\\\]\]+\\\] \\\[len: \[^\\\]\]+\\\]\\) map\\(to:cpo_f_p \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(alloc:cpo_f_p\\.data \\\[pointer assign, bias: \[^\\\]\]+\\\]\\) finalize$" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(force_from:MEM\\\[\\(c_char \\*\\)\[^\\\]\]+\\\] \\\[len: \[^\\\]\]+\\\]\\) map\\(to:cpo_f_p \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(alloc:cpo_f_p\\.data \\\[pointer assign, bias: \[^\\\]\]+\\\]\\) finalize$" 1 "gimple" } }
END SUBROUTINE f
diff --git a/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95
index 558e800..e575890 100644
--- a/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95
@@ -12,12 +12,12 @@ program test
!$acc host_data use_device(p) if (p == 42)
! { dg-final { scan-tree-dump-times "(?n)D\\.\[0-9\]+ = \\*p == 42;$" 1 "original" } }
! { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data use_device_ptr\\(p\\) if\\(D\\.\[0-9\]+\\)$" 1 "original" } }
- ! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(p\\) if\\(D\\.\[0-9\]+\\)$" 1 "gimple" } }
+ ! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(p\\) if\\((?:D\\.|_)\[0-9\]+\\)$" 1 "gimple" } }
!$acc end host_data
!$acc host_data use_device(p) if_present if (p == 43)
! { dg-final { scan-tree-dump-times "(?n)D\\.\[0-9\]+ = \\*p == 43;$" 1 "original" } }
! { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data use_device_ptr\\(p\\) if\\(D\\.\[0-9\]+\\) if_present$" 1 "original" } }
- ! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(if_present:p\\) if\\(D\\.\[0-9\]+\\) if_present$" 1 "gimple" } }
+ ! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(if_present:p\\) if\\((?:D\\.|_)\[0-9\]+\\) if_present$" 1 "gimple" } }
!$acc end host_data
end program test
diff --git a/gcc/testsuite/gfortran.dg/goacc/if.f95 b/gcc/testsuite/gfortran.dg/goacc/if.f95
index 35e9cfe..56f3711 100644
--- a/gcc/testsuite/gfortran.dg/goacc/if.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/if.f95
@@ -6,7 +6,7 @@ program test
logical :: x
integer :: i
- !$acc parallel if ! { dg-error "Failed to match clause" }
+ !$acc parallel if ! { dg-error "Expected '\\(' after 'if'" }
!$acc parallel if () ! { dg-error "Invalid character" }
!$acc parallel if (i) ! { dg-error "scalar LOGICAL expression" }
!$acc end parallel
@@ -14,11 +14,11 @@ program test
!$acc end parallel
!$acc kernels if (i) ! { dg-error "scalar LOGICAL expression" }
!$acc end kernels
- !$acc kernels if ! { dg-error "Failed to match clause" }
+ !$acc kernels if ! { dg-error "Expected '\\(' after 'if'" }
!$acc kernels if () ! { dg-error "Invalid character" }
!$acc kernels if (1) ! { dg-error "scalar LOGICAL expression" }
!$acc end kernels
- !$acc data if ! { dg-error "Failed to match clause" }
+ !$acc data if ! { dg-error "Expected '\\(' after 'if'" }
!$acc data if () ! { dg-error "Invalid character" }
!$acc data if (i) ! { dg-error "scalar LOGICAL expression" }
!$acc end data
@@ -26,9 +26,9 @@ program test
!$acc end data
! at most one if clause may appear
- !$acc parallel if (.false.) if (.false.) { dg-error "Failed to match clause" }
- !$acc kernels if (.false.) if (.false.) { dg-error "Failed to match clause" }
- !$acc data if (.false.) if (.false.) { dg-error "Failed to match clause" }
+ !$acc parallel if (.false.) if (.false.) { dg-error "Duplicated 'if' clause" }
+ !$acc kernels if (.false.) if (.false.) { dg-error "Duplicated 'if' clause" }
+ !$acc data if (.false.) if (.false.) { dg-error "Duplicated 'if' clause" }
!$acc parallel if (x)
!$acc end parallel
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95
index 7e513f8..ddaf7f8 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95
@@ -2,9 +2,12 @@
! { dg-additional-options "-fopt-info-omp-all" }
! { dg-additional-options "-fdump-tree-gimple" }
-! { dg-additional-options "-fopenacc-kernels=decompose" }
+! { dg-additional-options "--param=openacc-kernels=decompose" }
! { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" }
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
! See also '../../c-c++-common/goacc/kernels-decompose-1.c'.
! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95
index 22f65e5..238482b 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95
@@ -1,9 +1,12 @@
! Test OpenACC 'kernels' construct decomposition.
! { dg-additional-options "-fopt-info-omp-all" }
-! { dg-additional-options "-fopenacc-kernels=decompose" }
+! { dg-additional-options "--param=openacc-kernels=decompose" }
! { dg-additional-options "-O2" } for 'parloops'.
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
! See also '../../c-c++-common/goacc/kernels-decompose-2.c'.
! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
@@ -119,6 +122,7 @@ program main
!$acc end kernels
!$acc kernels
+ ! { dg-bogus "\[Ww\]arning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 }
y = f_g (a(5)) ! { dg-line l_part[incr c_part] }
!TODO If such a construct is placed in its own part (like it is, here), can't this actually use gang paralelism, instead of "gang-single"?
! { dg-message "note: beginning 'gang-single' part in OpenACC 'kernels' region" "" { target *-*-* } l_part$c_part }
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95
index d01eee2..688ed0a 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95
@@ -1,6 +1,6 @@
! { dg-do compile }
! { dg-additional-options "-fdump-tree-original" }
-! { dg-additional-options "-fopenacc-kernels=decompose" }
+! { dg-additional-options "--param=openacc-kernels=decompose" }
! { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" }
program test
@@ -37,5 +37,5 @@ end program test
! { dg-final { scan-tree-dump-times "map\\(force_deviceptr:u\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_data_kernels if\(D\.[0-9]+\)$} 1 "omp_oacc_kernels_decompose" } }
-! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_parallel_kernels_gang_single num_gangs\(1\) if\(D\.[0-9]+\) async\(-1\)$} 1 "omp_oacc_kernels_decompose" } }
+! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_data_kernels if\((?:D\.|_)[0-9]+\)$} 1 "omp_oacc_kernels_decompose" } }
+! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_parallel_kernels_gang_single num_gangs\(1\) if\((?:D\.|_)[0-9]+\) async\(-1\)$} 1 "omp_oacc_kernels_decompose" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90 b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90
index 890ca78..662104f 100644
--- a/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90
@@ -11,5 +11,5 @@ subroutine foo
type(two) x
!$acc enter data copyin(x%A)
-! { dg-final { scan-tree-dump-times "omp target oacc_enter_exit_data map\\(struct:x \\\[len: 1\\\]\\) map\\(to:x.a \\\[len: \[0-9\]+\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "omp target oacc_enter_data map\\(struct:x \\\[len: 1\\\]\\) map\\(to:x.a \\\[len: \[0-9\]+\\\]\\)" 1 "gimple" } }
end
diff --git a/gcc/testsuite/gfortran.dg/goacc/omp-fixed.f b/gcc/testsuite/gfortran.dg/goacc/omp-fixed.f
index c6206e7..b1e7aff 100644
--- a/gcc/testsuite/gfortran.dg/goacc/omp-fixed.f
+++ b/gcc/testsuite/gfortran.dg/goacc/omp-fixed.f
@@ -6,7 +6,7 @@
!$OMP PARALLEL
!$ACC PARALLEL &
-!$ACC& COPYIN(ARGC) ! { dg-error "directive cannot be specified within" }
+!$ACC& COPYIN(ARGC) ! { dg-error "The !.ACC PARALLEL directive cannot be specified within a !.OMP PARALLEL region" }
IF (ARGC .NE. 0) THEN
STOP 1
END IF
@@ -24,9 +24,17 @@
!$OMP& DO ! { dg-error "Wrong OpenACC continuation" }
DO I = 1, 10
ENDDO
+!$ACC END PARALLEL
+
+!$OMP PARALLEL &
+!$ACC& KERNELS LOOP ! { dg-error "Wrong OpenMP continuation" }
+ DO I = 1, 10
+ ENDDO
+!$OMP END PARALLEL
!$OMP PARALLEL &
!$ACC& LOOP ! { dg-error "Wrong OpenMP continuation" }
DO I = 1, 10
ENDDO
+!$OMP END PARALLEL
END SUBROUTINE NI
diff --git a/gcc/testsuite/gfortran.dg/goacc/omp.f95 b/gcc/testsuite/gfortran.dg/goacc/omp.f95
index 339438a..d8bd886 100644
--- a/gcc/testsuite/gfortran.dg/goacc/omp.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/omp.f95
@@ -67,8 +67,20 @@ contains
subroutine nana
!$acc parallel &
!$omp do ! { dg-error "Wrong OpenACC continuation" }
+ do i = 1, 5 ! { dg-error "The !.OMP DO directive cannot be specified within a !.ACC PARALLEL region" "" { target *-*-* } .-1 }
+ end do
+ !$acc end parallel
+
+ !$omp parallel &
+ !$acc kernels loop ! { dg-error "Wrong OpenMP continuation" }
+ do i = 1, 5 ! { dg-error "The !.ACC KERNELS LOOP directive cannot be specified within a !.OMP PARALLEL region" "" { target *-*-* } .-1 }
+ end do
+ !$omp end parallel
!$omp parallel &
!$acc loop ! { dg-error "Wrong OpenMP continuation" }
+ do i = 1, 5 ! { dg-error "The !.ACC LOOP directive cannot be specified within a !.OMP PARALLEL region" "" { target *-*-* } .-1 }
+ end do
+ !$omp end parallel
end subroutine nana
end module test
diff --git a/gcc/testsuite/gfortran.dg/goacc/parallel-kernels-clauses.f95 b/gcc/testsuite/gfortran.dg/goacc/parallel-kernels-clauses.f95
index 72ba147..70b84f1 100644
--- a/gcc/testsuite/gfortran.dg/goacc/parallel-kernels-clauses.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/parallel-kernels-clauses.f95
@@ -59,17 +59,17 @@ program test
!$acc parallel default ( none )
!$acc end parallel
- !$acc kernels default { dg-error "Failed to match clause" }
- !$acc parallel default { dg-error "Failed to match clause" }
+ !$acc kernels default { dg-error "Expected '\\(' after 'default'" }
+ !$acc parallel default { dg-error "Expected '\\(' after 'default'" }
- !$acc kernels default() { dg-error "Failed to match clause" }
- !$acc parallel default() { dg-error "Failed to match clause" }
+ !$acc kernels default() { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
+ !$acc parallel default() { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
- !$acc kernels default(i) { dg-error "Failed to match clause" }
- !$acc parallel default(i) { dg-error "Failed to match clause" }
+ !$acc kernels default(i) { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
+ !$acc parallel default(i) { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
- !$acc kernels default(1) { dg-error "Failed to match clause" }
- !$acc parallel default(1) { dg-error "Failed to match clause" }
+ !$acc kernels default(1) { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
+ !$acc parallel default(1) { dg-error "Expected NONE or PRESENT in DEFAULT clause" }
! Wait
!$acc kernels wait (l) ! { dg-error "INTEGER" }
diff --git a/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95
index e33653b..c51cb2a 100644
--- a/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95
@@ -2,6 +2,9 @@
! test for tree-dump-original and spaces-commas
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
program test
implicit none
integer :: q, i, j, k, m, n, o, p, r, s, t, u, v, w
@@ -12,6 +15,9 @@ program test
!$acc no_create(n) &
!$acc present(o), pcopy(p), pcopyin(r), pcopyout(s), pcreate(t) &
!$acc deviceptr(u), private(v), firstprivate(w)
+ ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 }
+ ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-2 }
+ ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 }
!$acc end parallel
end program test
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr78027.f90 b/gcc/testsuite/gfortran.dg/goacc/pr78027.f90
index cf13ff7..415e3a1 100644
--- a/gcc/testsuite/gfortran.dg/goacc/pr78027.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/pr78027.f90
@@ -1,9 +1,5 @@
! { dg-additional-options "-fopenmp -O2 -fdump-ipa-icf" }
-! f951: warning: could not emit HSAIL for the function [-Whsa]
-! f951: note: HSA does not support functions with variadic arguments (or unknown return type): 'GOACC_parallel_keyed'
-! { dg-additional-options "-Wno-hsa" }
-
real function f()
!$omp declare target(f)
f = 1.
diff --git a/gcc/testsuite/gfortran.dg/goacc/private-3.f95 b/gcc/testsuite/gfortran.dg/goacc/private-3.f95
index a7c6d81..1bfb4f1 100644
--- a/gcc/testsuite/gfortran.dg/goacc/private-3.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/private-3.f95
@@ -1,7 +1,9 @@
-! { dg-do compile }
-
! test for private variables in a reduction clause
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
program test
implicit none
integer, parameter :: n = 100
@@ -16,6 +18,7 @@ program test
!$acc parallel private (k)
k = 0
!$acc loop reduction (+:k)
+ ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
do i = 1, n
k = k + 1
end do
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90
new file mode 100644
index 0000000..bcd7159
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90
@@ -0,0 +1,57 @@
+! OpenACC privatization: 'loop' construct
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-compute-loop.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_loop 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+ subroutine f (i, j, a)
+ implicit none
+ integer :: i, j, a
+ integer :: x, y
+ integer, parameter :: c = 3
+ integer, external :: g
+
+ !$acc parallel
+ !$acc loop collapse(2) private(a) private(x, y) ! { dg-line l_loop[incr c_loop] }
+ do i = 1, 20
+ do j = 1, 25
+ ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+ ! Don't know how to effect a 'LABEL_DECL' here.
+ ! Don't know how to effect a 'TYPE_DECL' here.
+ ! Don't know how to effect a 'FUNCTION_DECL' here.
+ ! Don't know how to effect a 'RESULT_DECL' here.
+ ! Don't know how to effect a 'VAR_DECL' here.
+ ! (See C/C++ example.)
+
+ a = g (i, j, a, c)
+ x = a
+ !$acc atomic write
+ y = a
+ end do
+ end do
+ ! { dg-note {variable 'count\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop }
+ !$acc end parallel
+ end subroutine f
+end module m
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90
new file mode 100644
index 0000000..ed7e9ec
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90
@@ -0,0 +1,48 @@
+! OpenACC privatization: compute construct
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-compute.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_compute 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+ subroutine f (i, j, a)
+ implicit none
+ integer :: i, j, a
+ integer :: x, y
+ integer, parameter :: c = 3
+ integer, external :: g
+
+ !$acc parallel private(i, j, a) private(x, y) ! { dg-line l_compute[incr c_compute] }
+ ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+ ! Don't know how to effect a 'LABEL_DECL' here.
+ ! Don't know how to effect a 'TYPE_DECL' here.
+ ! Don't know how to effect a 'FUNCTION_DECL' here.
+ ! Don't know how to effect a 'RESULT_DECL' here.
+ ! Don't know how to effect a 'VAR_DECL' here.
+ ! (See C/C++ example.)
+
+ a = g (i, j, a, c)
+ x = a
+ !$acc atomic write ! ... to force 'TREE_ADDRESSABLE'.
+ y = a
+ !$acc end parallel
+ ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute }
+ ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute }
+ ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute }
+ ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+ end subroutine f
+end module m
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90
new file mode 100644
index 0000000..db6d822
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90
@@ -0,0 +1,56 @@
+! OpenACC privatization: 'loop' construct inside 'routine'
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-routine_gang-loop.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_loop 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+ subroutine f (i, j, a)
+ implicit none
+ integer :: i, j, a
+ !$acc routine (f) gang
+ integer :: x, y
+ integer, parameter :: c = 3
+ integer, external :: g
+
+ !$acc loop collapse(2) private(a) private(x, y) ! { dg-line l_loop[incr c_loop] }
+ do i = 1, 20
+ do j = 1, 25
+ ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+ ! Don't know how to effect a 'LABEL_DECL' here.
+ ! Don't know how to effect a 'TYPE_DECL' here.
+ ! Don't know how to effect a 'FUNCTION_DECL' here.
+ ! Don't know how to effect a 'RESULT_DECL' here.
+ ! Don't know how to effect a 'VAR_DECL' here.
+ ! (See C/C++ example.)
+
+ a = g (i, j, a, c)
+ x = a
+ !$acc atomic write
+ y = a
+ end do
+ end do
+ ! { dg-note {variable 'count\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+ ! { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop }
+ end subroutine f
+end module m
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90
new file mode 100644
index 0000000..725bd5e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90
@@ -0,0 +1,47 @@
+! OpenACC privatization: 'routine'
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-routine_gang.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_routine 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+ subroutine f (i, j, a)
+ implicit none
+ integer :: i, j, a
+ !$acc routine (f) gang ! { dg-line l_routine[incr c_routine] }
+ integer :: x, y
+ integer, parameter :: c = 3
+ integer, external :: g
+
+ ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+ ! Don't know how to effect a 'LABEL_DECL' here.
+ ! Don't know how to effect a 'TYPE_DECL' here.
+ ! Don't know how to effect a 'FUNCTION_DECL' here.
+ ! Don't know how to effect a 'RESULT_DECL' here.
+ ! Don't know how to effect a 'VAR_DECL' here.
+ ! (See C/C++ example.)
+
+ a = g (i, j, a, c)
+ x = a
+ !$acc atomic write ! ... to force 'TREE_ADDRESSABLE'.
+ y = a
+ end subroutine f
+ ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+ ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+ ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+ ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine }
+end module m
diff --git a/gcc/testsuite/gfortran.dg/goacc/pure-elemental-procedures-2.f90 b/gcc/testsuite/gfortran.dg/goacc/pure-elemental-procedures-2.f90
index 97d92c3..31233b3 100644
--- a/gcc/testsuite/gfortran.dg/goacc/pure-elemental-procedures-2.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/pure-elemental-procedures-2.f90
@@ -2,6 +2,10 @@ pure elemental subroutine foo()
!$acc routine vector ! { dg-error "ROUTINE with GANG, WORKER, or VECTOR clause is not permitted in PURE procedure" }
end
+pure elemental subroutine foo_nh()
+!$acc routine nohost vector ! { dg-error "ROUTINE with GANG, WORKER, or VECTOR clause is not permitted in PURE procedure" }
+end
+
elemental subroutine foo2()
!$acc routine (myfoo2) gang ! { dg-error "Invalid NAME 'myfoo2' in" }
end
@@ -10,18 +14,38 @@ elemental subroutine foo2a()
!$acc routine gang ! { dg-error "ROUTINE with GANG, WORKER, or VECTOR clause is not permitted in PURE procedure" }
end
+elemental subroutine foo2a_nh()
+!$acc routine nohost gang ! { dg-error "ROUTINE with GANG, WORKER, or VECTOR clause is not permitted in PURE procedure" }
+end
+
pure subroutine foo3()
!$acc routine vector ! { dg-error "ROUTINE with GANG, WORKER, or VECTOR clause is not permitted in PURE procedure" }
end
+pure subroutine foo3_nh()
+!$acc routine nohost vector ! { dg-error "ROUTINE with GANG, WORKER, or VECTOR clause is not permitted in PURE procedure" }
+end
+
elemental impure subroutine foo4()
!$acc routine vector ! OK: impure
end
+elemental impure subroutine foo4_nh()
+!$acc routine nohost vector ! OK: impure
+end
+
pure subroutine foo5()
!$acc routine seq ! OK: seq
end
+pure subroutine foo5_nh()
+!$acc routine nohost seq ! OK: seq
+end
+
pure subroutine foo6()
!$acc routine ! OK (implied 'seq')
end
+
+pure subroutine foo6_nh()
+!$acc routine nohost ! OK (implied 'seq')
+end
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-4.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-4.f90
index 6714c7b..53b1fbe 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-4.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-4.f90
@@ -1,5 +1,8 @@
! Test invalid calls to routines.
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
module param
integer, parameter :: N = 32
end module param
@@ -120,6 +123,9 @@ contains
subroutine gang (a) ! { dg-message "declared here" 3 }
!$acc routine gang
+ ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-2 }
+ ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-3 }
+ ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 }
integer, intent (inout) :: a(N)
integer :: i
@@ -130,6 +136,8 @@ contains
subroutine worker (a) ! { dg-message "declared here" 2 }
!$acc routine worker
+ ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-2 }
+ ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 }
integer, intent (inout) :: a(N)
integer :: i
@@ -140,6 +148,7 @@ contains
subroutine vector (a) ! { dg-message "declared here" }
!$acc routine vector
+ ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 }
integer, intent (inout) :: a(N)
integer :: i
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-6.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-6.f90
index f1e2aa3..2b22b1c 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-6.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-6.f90
@@ -116,3 +116,13 @@ subroutine subr10 (x)
x = x * x - 1
end if
end subroutine subr10
+
+subroutine subr20 (x)
+ !$acc routine (subr20) nohost nohost ! { dg-error "Duplicated 'nohost' clause" }
+ integer, intent(inout) :: x
+ if (x < 1) then
+ x = 1
+ else
+ x = x * x - 1
+ end if
+end subroutine subr20
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f
index 0e8dfb1..04d507f 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f
@@ -22,6 +22,8 @@
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do j = 1, n
call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
+! { dg-bogus "note: routine 'workerr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'workerr_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
end do
!$acc end parallel loop
@@ -30,9 +32,12 @@
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do i = 1, n
!$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do j = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
+! { dg-bogus "note: routine 'gangr' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 }
+! { dg-bogus "note: routine 'gangr_' declared here" "TODO" { xfail offloading_enabled } .-3 }
end do
end do
!$acc end parallel loop
@@ -83,6 +88,7 @@
!$acc end parallel loop
!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -90,6 +96,7 @@
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -97,6 +104,7 @@
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -126,6 +134,7 @@
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call workerr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -133,6 +142,7 @@
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -152,6 +162,8 @@
!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
do i = 1, n
call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-bogus "note: routine 'vectorr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'vectorr_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
!$acc end parallel loop
@@ -168,6 +180,7 @@
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -201,6 +214,8 @@
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do j = 1, n
a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
+! { dg-bogus "note: routine 'workerf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'workerf_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
end do
!$acc end parallel loop
@@ -209,9 +224,12 @@
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do i = 1, n
!$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do j = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
+! { dg-bogus "note: routine 'gangf' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 }
+! { dg-bogus "note: routine 'gangf_' declared here" "TODO" { xfail offloading_enabled } .-3 }
end do
end do
!$acc end parallel loop
@@ -262,6 +280,7 @@
!$acc end parallel loop
!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -269,6 +288,7 @@
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -276,6 +296,7 @@
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -305,6 +326,7 @@
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -312,6 +334,7 @@
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
@@ -331,6 +354,8 @@
!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
do i = 1, n
a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-bogus "note: routine 'vectorf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'vectorf_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
!$acc end parallel loop
@@ -347,6 +372,7 @@
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f b/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f
index 22524cc..0372e78 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f
@@ -7,6 +7,11 @@
!$ACC ROUTINE (ABORT) GANG ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
!$ACC ROUTINE (ABORT) VECTOR ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
+!$ACC ROUTINE (ABORT) NOHOST ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible NOHOST clause" }
+
+!$ACC ROUTINE (ABORT) WORKER NOHOST ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
+!$ACC ROUTINE (ABORT) NOHOST GANG ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
+
CALL ABORT
END SUBROUTINE sub_1
@@ -16,6 +21,11 @@
!$ACC ROUTINE (ABORT) WORKER ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
!$ACC ROUTINE (ABORT) GANG ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
+!$ACC ROUTINE (ABORT) NOHOST ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible NOHOST clause" }
+
+!$ACC ROUTINE (ABORT) VECTOR NOHOST ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
+!$ACC ROUTINE (ABORT) NOHOST WORKER ! { dg-error "Intrinsic symbol specified in \\!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORKER, or VECTOR clause" }
+
CONTAINS
SUBROUTINE sub_2
CALL ABORT
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90
index 83b8c24..99929f1 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90
@@ -2,8 +2,14 @@
! with the OpenACC routine directive. The C/C++ counterpart is
! '../../c-c++-common/goacc/routine-level-of-parallelism-2.c'.
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
subroutine g_1
!$acc routine gang
+ ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-2 }
+ ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-3 }
+ ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 }
end subroutine g_1
subroutine s_1_2a
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-1.f90
index 4e81f11..46eec3d 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-module-1.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-1.f90
@@ -14,34 +14,48 @@ program main
!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
do i = 1, 10
call s_1 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_1_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call s_2 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_2_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call g_1 ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" }
+ call g_1_nh ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" }
call w_1 ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
+ call w_1_nh ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
call v_1 ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+ call v_1_nh ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
end do
!$acc end parallel loop
!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
do i = 1, 10
call s_1 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_1_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call s_2 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_2_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call w_1 ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
+ call w_1_nh ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
call v_1 ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+ call v_1_nh ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
end do
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
do i = 1, 10
call s_1 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_1_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call s_2 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_2_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call v_1 ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+ call v_1_nh ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
end do
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
do i = 1, 10
call s_1 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_1_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call s_2 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_2_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
end do
!$acc end parallel loop
end program main
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-2.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-2.f90
index eae0807..e796c1d 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-module-2.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-2.f90
@@ -11,21 +11,27 @@ program main
!$acc parallel loop gang
do i = 1, 10
call g_1 ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
+ call g_1_nh ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
end do
!$acc end parallel loop
!$acc parallel loop worker
do i = 1, 10
call g_1 ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
+ call g_1_nh ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
call w_1 ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
+ call w_1_nh ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
end do
!$acc end parallel loop
!$acc parallel loop vector
do i = 1, 10
call g_1 ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
+ call g_1_nh ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
call w_1 ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
+ call w_1_nh ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
call v_1 ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
+ call v_1_nh ! { dg-error "routine call uses same OpenACC parallelism as containing loop" }
end do
!$acc end parallel loop
end program main
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-3.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-3.f90
index a4ff549..80fe07a 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-module-3.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-3.f90
@@ -2,15 +2,54 @@
! { dg-compile-aux-modules "routine-module-mod-1.f90" }
-program main
+subroutine sr_1
use routine_module_mod_1
implicit none
+
!$acc routine (s_1) seq ! { dg-error "Cannot change attributes of USE-associated symbol s_1" }
! { dg-error "NAME 's_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (s_1_nh) seq nohost ! { dg-error "Cannot change attributes of USE-associated symbol s_1_nh" }
+ ! { dg-error "NAME 's_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
!$acc routine (s_2) seq ! { dg-error "Cannot change attributes of USE-associated symbol s_2" }
! { dg-error "NAME 's_2' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (s_2_nh) seq nohost ! { dg-error "Cannot change attributes of USE-associated symbol s_2_nh" }
+ ! { dg-error "NAME 's_2_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
!$acc routine (v_1) seq ! { dg-error "Cannot change attributes of USE-associated symbol v_1" }
! { dg-error "NAME 'v_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (v_1_nh) seq nohost ! { dg-error "Cannot change attributes of USE-associated symbol v_1_nh" }
+ ! { dg-error "NAME 'v_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
!$acc routine (w_1) gang ! { dg-error "Cannot change attributes of USE-associated symbol w_1" }
! { dg-error "NAME 'w_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
-end program main
+ !$acc routine (w_1_nh) gang nohost ! { dg-error "Cannot change attributes of USE-associated symbol w_1_nh" }
+ ! { dg-error "NAME 'w_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (g_1) gang ! { dg-error "Cannot change attributes of USE-associated symbol g_1" }
+ ! { dg-error "NAME 'g_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (g_1_nh) gang nohost ! { dg-error "Cannot change attributes of USE-associated symbol g_1_nh" }
+ ! { dg-error "NAME 'g_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+end subroutine sr_1
+
+subroutine sr_2
+ use routine_module_mod_1
+ implicit none
+
+ !$acc routine (s_1) seq nohost ! { dg-error "Cannot change attributes of USE-associated symbol s_1" }
+ ! { dg-error "NAME 's_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (s_1_nh) seq ! { dg-error "Cannot change attributes of USE-associated symbol s_1_nh" }
+ ! { dg-error "NAME 's_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (s_2) seq nohost ! { dg-error "Cannot change attributes of USE-associated symbol s_2" }
+ ! { dg-error "NAME 's_2' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (s_2_nh) seq ! { dg-error "Cannot change attributes of USE-associated symbol s_2_nh" }
+ ! { dg-error "NAME 's_2_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (v_1) vector nohost ! { dg-error "Cannot change attributes of USE-associated symbol v_1" }
+ ! { dg-error "NAME 'v_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (v_1_nh) vector ! { dg-error "Cannot change attributes of USE-associated symbol v_1_nh" }
+ ! { dg-error "NAME 'v_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (w_1) worker nohost ! { dg-error "Cannot change attributes of USE-associated symbol w_1" }
+ ! { dg-error "NAME 'w_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (w_1_nh) worker ! { dg-error "Cannot change attributes of USE-associated symbol w_1_nh" }
+ ! { dg-error "NAME 'w_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (g_1) worker nohost ! { dg-error "Cannot change attributes of USE-associated symbol g_1" }
+ ! { dg-error "NAME 'g_1' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+ !$acc routine (g_1_nh) worker ! { dg-error "Cannot change attributes of USE-associated symbol g_1_nh" }
+ ! { dg-error "NAME 'g_1_nh' invalid in \\!\\\$ACC ROUTINE \\( NAME \\)" "" { target *-*-* } .-1 }
+end subroutine sr_2
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90
index 23c673f..10e1096 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90
@@ -2,6 +2,9 @@
! { dg-additional-options "-fopt-info-optimized-omp" }
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
module routine_module_mod_1
contains
subroutine s_1
@@ -16,6 +19,17 @@ contains
end do
end subroutine s_1
+ subroutine s_1_nh
+ implicit none
+ !$acc routine nohost
+
+ integer :: i
+
+ !$acc loop ! { dg-bogus "assigned OpenACC .* loop parallelism" }
+ do i = 1, 3
+ end do
+ end subroutine s_1_nh
+
subroutine s_2
implicit none
!$acc routine (s_2) seq
@@ -28,6 +42,17 @@ contains
end do
end subroutine s_2
+ subroutine s_2_nh
+ implicit none
+ !$acc routine (s_2_nh) seq nohost
+
+ integer :: i
+
+ !$acc loop ! { dg-bogus "assigned OpenACC .* loop parallelism" }
+ do i = 1, 3
+ end do
+ end subroutine s_2_nh
+
subroutine v_1
implicit none
!$acc routine vector
@@ -39,6 +64,17 @@ contains
end do
end subroutine v_1
+ subroutine v_1_nh
+ implicit none
+ !$acc routine vector nohost
+
+ integer :: i
+
+ !$acc loop ! { dg-bogus "assigned OpenACC .* loop parallelism" }
+ do i = 1, 3
+ end do
+ end subroutine v_1_nh
+
subroutine w_1
implicit none
!$acc routine (w_1) worker
@@ -50,9 +86,21 @@ contains
end do
end subroutine w_1
+ subroutine w_1_nh
+ implicit none
+ !$acc routine (w_1_nh) worker nohost
+
+ integer :: i
+
+ !$acc loop ! { dg-bogus "assigned OpenACC .* loop parallelism" }
+ do i = 1, 3
+ end do
+ end subroutine w_1_nh
+
subroutine g_1
implicit none
!$acc routine gang
+ ! { dg-bogus "\[Ww\]arning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .-3 }
integer :: i
@@ -61,6 +109,17 @@ contains
end do
end subroutine g_1
+ subroutine g_1_nh
+ implicit none
+ !$acc routine gang nohost
+
+ integer :: i
+
+ !$acc loop ! { dg-bogus "assigned OpenACC .* loop parallelism" }
+ do i = 1, 3
+ end do
+ end subroutine g_1_nh
+
subroutine pl_1
implicit none
@@ -70,10 +129,15 @@ contains
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do i = 1, 3
call s_1 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_1_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call s_2 ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
+ call s_2_nh ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
call v_1 ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+ call v_1_nh ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
call w_1 ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
+ call w_1_nh ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
call g_1 ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" }
+ call g_1_nh ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" }
end do
end subroutine pl_1
end module routine_module_mod_1
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90
index 6e12ee9..42bcb0e 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90
@@ -1,29 +1,80 @@
! Check for valid cases of multiple OpenACC 'routine' directives.
+! { dg-additional-options "-fdump-tree-oaccloops" }
+!TODO See PR101551 for 'offloading_enabled' differences.
+
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
SUBROUTINE s_1
!$ACC ROUTINE(s_1)
!$ACC ROUTINE(s_1) SEQ
!$ACC ROUTINE SEQ
END SUBROUTINE s_1
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
+
+ SUBROUTINE s_1_nh
+!$ACC ROUTINE(s_1_nh) NOHOST
+!$ACC ROUTINE(s_1_nh) SEQ NOHOST
+!$ACC ROUTINE NOHOST SEQ
+ END SUBROUTINE s_1_nh
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
SUBROUTINE s_2
!$ACC ROUTINE
!$ACC ROUTINE SEQ
!$ACC ROUTINE(s_2)
END SUBROUTINE s_2
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
+
+ SUBROUTINE s_2_nh
+!$ACC ROUTINE NOHOST
+!$ACC ROUTINE NOHOST SEQ
+!$ACC ROUTINE(s_2_nh) NOHOST
+ END SUBROUTINE s_2_nh
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
SUBROUTINE v_1
!$ACC ROUTINE VECTOR
!$ACC ROUTINE VECTOR
!$ACC ROUTINE(v_1) VECTOR
!$ACC ROUTINE VECTOR
+! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-5 }
END SUBROUTINE v_1
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
+
+ SUBROUTINE v_1_nh
+!$ACC ROUTINE NOHOST VECTOR
+!$ACC ROUTINE VECTOR NOHOST
+!$ACC ROUTINE(v_1_nh) NOHOST VECTOR
+!$ACC ROUTINE VECTOR NOHOST
+! { dg-bogus "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-5 }
+ END SUBROUTINE v_1_nh
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
SUBROUTINE v_2
!$ACC ROUTINE(v_2) VECTOR
!$ACC ROUTINE VECTOR
!$ACC ROUTINE(v_2) VECTOR
+! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 }
END SUBROUTINE v_2
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
+
+ SUBROUTINE v_2_nh
+!$ACC ROUTINE(v_2_nh) VECTOR NOHOST
+!$ACC ROUTINE VECTOR NOHOST
+!$ACC ROUTINE(v_2_nh) NOHOST VECTOR
+! { dg-bogus "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 }
+ END SUBROUTINE v_2_nh
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
+ ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
SUBROUTINE sub_1
IMPLICIT NONE
@@ -31,12 +82,22 @@
!$ACC ROUTINE (g_1) GANG
!$ACC ROUTINE (g_1) GANG
!$ACC ROUTINE (g_1) GANG
+ EXTERNAL :: g_1_nh
+!$ACC ROUTINE (g_1_nh) GANG NOHOST
+!$ACC ROUTINE (g_1_nh) NOHOST GANG
+!$ACC ROUTINE (g_1_nh) NOHOST GANG
+!$ACC ROUTINE (g_1_nh) GANG NOHOST
CALL s_1
+ CALL s_1_nh
CALL s_2
+ CALL s_2_nh
CALL v_1
+ CALL v_1_nh
CALL v_2
+ CALL v_2_nh
CALL g_1
+ CALL g_1_nh
CALL ABORT
END SUBROUTINE sub_1
@@ -45,14 +106,22 @@
EXTERNAL :: w_1
!$ACC ROUTINE (w_1) WORKER
!$ACC ROUTINE (w_1) WORKER
+ EXTERNAL :: w_1_nh
+!$ACC ROUTINE (w_1_nh) NOHOST WORKER
+!$ACC ROUTINE (w_1_nh) WORKER NOHOST
CONTAINS
SUBROUTINE sub_2
CALL s_1
+ CALL s_1_nh
CALL s_2
+ CALL s_2_nh
CALL v_1
+ CALL v_1_nh
CALL v_2
+ CALL v_2_nh
CALL w_1
+ CALL w_1_nh
CALL ABORT
END SUBROUTINE sub_2
END MODULE m_w_1
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-2.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-2.f90
index 54365ae..f332ed5 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-2.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-2.f90
@@ -9,8 +9,32 @@
!$ACC ROUTINE
!$ACC ROUTINE(s_1) WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
!$ACC ROUTINE GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE VECTOR NOHOST WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(s_1) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE NOHOST GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_1) SEQ NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_1) NOHOST WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG NOHOST VECTOR ! { dg-error "Multiple loop axes specified for routine" }
END SUBROUTINE s_1
+ SUBROUTINE s_1_nh
+!$ACC ROUTINE NOHOST VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(s_1_nh) NOHOST
+!$ACC ROUTINE NOHOST GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_1_nh) NOHOST SEQ
+!$ACC ROUTINE NOHOST
+!$ACC ROUTINE(s_1_nh) WORKER NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG NOHOST VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(s_1_nh) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_1_nh) SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_1_nh) WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+ END SUBROUTINE s_1_nh
+
SUBROUTINE s_2
!$ACC ROUTINE(s_2) VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
!$ACC ROUTINE
@@ -19,8 +43,32 @@
!$ACC ROUTINE(s_2)
!$ACC ROUTINE WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
!$ACC ROUTINE(s_2) GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(s_2) VECTOR NOHOST WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_2) GANG NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE SEQ NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_2) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE NOHOST WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_2) NOHOST GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
END SUBROUTINE s_2
+ SUBROUTINE s_2_nh
+!$ACC ROUTINE(s_2_nh) NOHOST VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE NOHOST
+!$ACC ROUTINE(s_2_nh) GANG NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE SEQ NOHOST
+!$ACC ROUTINE(s_2_nh) NOHOST
+!$ACC ROUTINE NOHOST WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_2_nh) NOHOST GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(s_2_nh) VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_2_nh) GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_2_nh) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(s_2_nh) GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+ END SUBROUTINE s_2_nh
+
SUBROUTINE v_1
!$ACC ROUTINE VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
!$ACC ROUTINE VECTOR
@@ -30,16 +78,61 @@
!$ACC ROUTINE(v_1) VECTOR
!$ACC ROUTINE WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
!$ACC ROUTINE GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE NOHOST VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE NOHOST VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE NOHOST SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(v_1) VECTOR NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE WORKER NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG VECTOR NOHOST ! { dg-error "Multiple loop axes specified for routine" }
END SUBROUTINE v_1
+ SUBROUTINE v_1_nh
+!$ACC ROUTINE VECTOR WORKER NOHOST ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE VECTOR NOHOST
+!$ACC ROUTINE GANG NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE NOHOST SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(v_1_nh) VECTOR NOHOST
+!$ACC ROUTINE WORKER NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG NOHOST VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(v_1_nh) VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+ END SUBROUTINE v_1_nh
+
SUBROUTINE v_2
!$ACC ROUTINE(v_2) VECTOR
!$ACC ROUTINE(v_2) VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
!$ACC ROUTINE(v_2) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
!$ACC ROUTINE VECTOR
!$ACC ROUTINE(v_2) GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(v_2) VECTOR NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(v_2) VECTOR NOHOST WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(v_2) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE VECTOR NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(v_2) NOHOST GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
END SUBROUTINE v_2
+ SUBROUTINE v_2_nh
+!$ACC ROUTINE(v_2_nh) VECTOR NOHOST
+!$ACC ROUTINE(v_2_nh) VECTOR WORKER NOHOST ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(v_2_nh) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE VECTOR NOHOST
+!$ACC ROUTINE(v_2_nh) GANG NOHOST VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(v_2_nh) VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(v_2_nh) VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE(v_2_nh) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE(v_2_nh) GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" }
+ END SUBROUTINE v_2_nh
+
SUBROUTINE sub_1
IMPLICIT NONE
EXTERNAL :: g_1
@@ -50,12 +143,39 @@
!$ACC ROUTINE (g_1) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
!$ACC ROUTINE (g_1) GANG
!$ACC ROUTINE (g_1) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1) NOHOST GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1) GANG WORKER NOHOST ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE (g_1) NOHOST VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1) NOHOST SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1) GANG NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+ EXTERNAL :: g_1_nh
+!$ACC ROUTINE (g_1_nh) NOHOST GANG
+!$ACC ROUTINE (g_1_nh) GANG NOHOST WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE (g_1_nh) NOHOST VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) SEQ NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) GANG NOHOST
+!$ACC ROUTINE (g_1_nh) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) GANG WORKER ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE (g_1_nh) VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) GANG ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (g_1_nh) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
CALL s_1
+ CALL s_1_nh
CALL s_2
+ CALL s_2_nh
CALL v_1
+ CALL v_1_nh
CALL v_2
+ CALL v_2_nh
CALL g_1
+ CALL g_1_nh
CALL ABORT
END SUBROUTINE sub_1
@@ -69,14 +189,41 @@
!$ACC ROUTINE (w_1) SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
!$ACC ROUTINE (w_1) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
!$ACC ROUTINE (w_1) VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1) WORKER NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1) WORKER NOHOST SEQ ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE (w_1) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1) NOHOST WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1) SEQ NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1) VECTOR NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+ EXTERNAL :: w_1_nh
+!$ACC ROUTINE (w_1_nh) WORKER NOHOST
+!$ACC ROUTINE (w_1_nh) WORKER NOHOST SEQ ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE (w_1_nh) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) NOHOST WORKER
+!$ACC ROUTINE (w_1_nh) NOHOST SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) VECTOR NOHOST ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) WORKER SEQ ! { dg-error "Multiple loop axes specified for routine" }
+!$ACC ROUTINE (w_1_nh) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) WORKER ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) SEQ ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
+!$ACC ROUTINE (w_1_nh) VECTOR ! { dg-error "\\!\\\$ACC ROUTINE already applied" }
CONTAINS
SUBROUTINE sub_2
CALL s_1
+ CALL s_1_nh
CALL s_2
+ CALL s_2_nh
CALL v_1
+ CALL v_1_nh
CALL v_2
+ CALL v_2_nh
CALL w_1
+ CALL w_1_nh
CALL ABORT
END SUBROUTINE sub_2
END MODULE m_w_1
diff --git a/gcc/testsuite/gfortran.dg/goacc/sie.f95 b/gcc/testsuite/gfortran.dg/goacc/sie.f95
index 194a1da..5982d5d 100644
--- a/gcc/testsuite/gfortran.dg/goacc/sie.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/sie.f95
@@ -67,7 +67,7 @@ program test
!$acc end kernels
- !$acc parallel num_gangs ! { dg-error "Failed to match clause" }
+ !$acc parallel num_gangs ! { dg-error "Expected '\\(' after 'num_gangs'" }
!$acc parallel num_gangs(3)
!$acc end parallel
@@ -95,7 +95,7 @@ program test
!$acc parallel num_gangs("1") ! { dg-error "scalar INTEGER expression" }
!$acc end parallel
- !$acc kernels num_gangs ! { dg-error "Failed to match clause" }
+ !$acc kernels num_gangs ! { dg-error "Expected '\\(' after 'num_gangs'" }
!$acc kernels num_gangs(3)
!$acc end kernels
@@ -124,7 +124,7 @@ program test
!$acc end kernels
- !$acc parallel num_workers ! { dg-error "Failed to match clause" }
+ !$acc parallel num_workers ! { dg-error "Expected '\\(' after 'num_workers'" }
!$acc parallel num_workers(3)
!$acc end parallel
@@ -141,7 +141,7 @@ program test
!$acc parallel num_workers(0) ! { dg-warning "must be positive" }
!$acc end parallel
- !$acc parallel num_workers() ! { dg-error "Invalid character in name" }
+ !$acc parallel num_workers() ! { dg-error "Invalid expression after 'num_workers\\('" }
!$acc parallel num_workers(1.5) ! { dg-error "scalar INTEGER expression" }
!$acc end parallel
@@ -152,7 +152,7 @@ program test
!$acc parallel num_workers("1") ! { dg-error "scalar INTEGER expression" }
!$acc end parallel
- !$acc kernels num_workers ! { dg-error "Failed to match clause" }
+ !$acc kernels num_workers ! { dg-error "Expected '\\(' after 'num_workers'" }
!$acc kernels num_workers(3)
!$acc end kernels
@@ -169,7 +169,7 @@ program test
!$acc kernels num_workers(0) ! { dg-warning "must be positive" }
!$acc end kernels
- !$acc kernels num_workers() ! { dg-error "Invalid character in name" }
+ !$acc kernels num_workers() ! { dg-error "Invalid expression after 'num_workers\\('" }
!$acc kernels num_workers(1.5) ! { dg-error "scalar INTEGER expression" }
!$acc end kernels
@@ -181,7 +181,7 @@ program test
!$acc end kernels
- !$acc parallel vector_length ! { dg-error "Failed to match clause" }
+ !$acc parallel vector_length ! { dg-error "Expected '\\(' after 'vector_length'" }
!$acc parallel vector_length(3)
!$acc end parallel
@@ -198,7 +198,7 @@ program test
!$acc parallel vector_length(0) ! { dg-warning "must be positive" }
!$acc end parallel
- !$acc parallel vector_length() ! { dg-error "Invalid character in name" }
+ !$acc parallel vector_length() ! { dg-error "Invalid expression after 'vector_length\\('" }
!$acc parallel vector_length(1.5) ! { dg-error "scalar INTEGER expression" }
!$acc end parallel
@@ -209,7 +209,7 @@ program test
!$acc parallel vector_length("1") ! { dg-error "scalar INTEGER expression" }
!$acc end parallel
- !$acc kernels vector_length ! { dg-error "Failed to match clause" }
+ !$acc kernels vector_length ! { dg-error "Expected '\\(' after 'vector_length'" }
!$acc kernels vector_length(3)
!$acc end kernels
@@ -226,7 +226,7 @@ program test
!$acc kernels vector_length(0) ! { dg-warning "must be positive" }
!$acc end kernels
- !$acc kernels vector_length() ! { dg-error "Invalid character in name" }
+ !$acc kernels vector_length() ! { dg-error "Invalid expression after 'vector_length\\('" }
!$acc kernels vector_length(1.5) ! { dg-error "scalar INTEGER expression" }
!$acc end kernels
diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95
index c77d47a..59e923f 100644
--- a/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95
@@ -1,16 +1,22 @@
! { dg-additional-options "-Wuninitialized" }
+! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
+! aspects of that functionality.
+
subroutine acc_parallel
implicit none
integer :: i, j, k
!$acc parallel num_gangs(i) ! { dg-warning "is used uninitialized" }
+ ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 }
!$acc end parallel
!$acc parallel num_workers(j) ! { dg-warning "is used uninitialized" }
+ ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 }
!$acc end parallel
!$acc parallel vector_length(k) ! { dg-warning "is used uninitialized" }
+ ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 }
!$acc end parallel
end subroutine acc_parallel
diff --git a/gcc/testsuite/gfortran.dg/goacc/update-if_present-2.f90 b/gcc/testsuite/gfortran.dg/goacc/update-if_present-2.f90
index bf8b319..368e937 100644
--- a/gcc/testsuite/gfortran.dg/goacc/update-if_present-2.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/update-if_present-2.f90
@@ -12,10 +12,10 @@ subroutine t1
allocate (x, y, z(100))
- !$acc enter data copyin(a) if_present ! { dg-error "Failed to match clause" }
- !$acc exit data copyout(a) if_present ! { dg-error "Failed to match clause" }
+ !$acc enter data copyin(a) if_present ! { dg-error "Expected '\\(' after 'if'" }
+ !$acc exit data copyout(a) if_present ! { dg-error "Expected '\\(' after 'if'" }
- !$acc data copy(a) if_present ! { dg-error "Failed to match clause" }
+ !$acc data copy(a) if_present ! { dg-error "Expected '\\(' after 'if'" }
!$acc end data ! { dg-error "Unexpected ..ACC END DATA statement" }
!$acc declare link(a) if_present ! { dg-error "Unexpected junk after" }
@@ -40,12 +40,12 @@ subroutine t2
end do
!$acc end parallel
- !$acc kernels loop if_present ! { dg-error "Failed to match clause" }
+ !$acc kernels loop if_present ! { dg-error "Expected '\\(' after 'if'" }
do b = 1, 10
end do
!$acc end kernels loop ! { dg-error "Unexpected ..ACC END KERNELS LOOP statement" }
- !$acc parallel loop if_present ! { dg-error "Failed to match clause" }
+ !$acc parallel loop if_present ! { dg-error "Expected '\\(' after 'if'" }
do b = 1, 10
end do
!$acc end parallel loop ! { dg-error "Unexpected ..ACC END PARALLEL LOOP statement" }
diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-1.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-1.f90
index b6e20b9..cb1543b 100644
--- a/gcc/testsuite/gfortran.dg/gomp/affinity-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/affinity-1.f90
@@ -9,6 +9,15 @@
j = 8
end do
!$omp end parallel do
+!$omp parallel do default(none)proc_bind(primary)shared(a)
+ do i = 1, 10
+ j = 4
+ do j = 1, 10
+ a(i, j) = i + j
+ end do
+ j = 8
+ end do
+!$omp end parallel do
!$omp parallel proc_bind (close)
!$omp parallel default(none) proc_bind (spread) firstprivate(a) private (i)
do i = 1, 10
diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-clause-1.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-1.f90
new file mode 100644
index 0000000..13bdd36
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-1.f90
@@ -0,0 +1,33 @@
+! { dg-additional-options "-fdump-tree-original" }
+subroutine foo(x)
+ integer :: x
+ integer :: a, b(5), cc, d(5,5)
+ !$omp taskgroup
+ !$omp task affinity(a)
+ !$omp end task
+ !$omp task affinity(iterator(i=int(cos(1.0+a)):5, jj =2:5:2) : b(i), d(i,jj))
+ !$omp end task
+ !$omp task affinity(iterator(i=int(cos(1.0+a)):5) : b(i), d(i,i))
+ !$omp end task
+ !$omp task affinity (iterator(i=1:5): a)
+ !$omp end task
+ !$omp task affinity (iterator(i=1:5): a) affinity(iterator(i=1:5) : x)
+ !$omp end task
+ !$omp task affinity (iterator(integer(8) :: j=1:5, k=7:4:-1) : b(j+k),a) affinity (cc)
+ !$omp end task
+ !$omp end taskgroup
+end
+
+! { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(a\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = .integer.kind=4.. __builtin_cosf ..real.kind=4.. a \\+ 1.0e\\+0\\);" 2 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(integer\\(kind=4\\) jj=2:5:2, integer\\(kind=4\\) i=D\\.\[0-9\]+:5:1\\):\\*\\(c_char \\*\\) &b\\\[.* <?i>? \\+ -1\\\]\\) affinity\\(iterator\\(integer\\(kind=4\\) jj=2:5:2, integer\\(kind=4\\) i=D\\.\[0-9\]+:5:1\\):\\*\\(c_char \\*\\) &d\\\[\\(.*jj \\* 5 \\+ .* <?i>?\\) \\+ -6\\\]\\)" 1 "original" } }
+
+! { dg final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(integer\\(kind=4\\) i=D.3938:5:1\\):\\*\\(c_char \\*\\) &b\\\[\\(.* <?i>? \\+ -1\\\]\\) affinity\\(iterator\\(integer\\(kind=4\\) i=D\\.\[0-9\]+:5:1\\):\\*\\(c_char \\*\\) &d\\\[\\(\\(integer\\(kind=8\\)\\) i \\+ -1\\) \\* 6\\\]\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(integer\\(kind=4\\) i=1:5:1\\):a\\)\[^ \]" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(integer\\(kind=4\\) i=1:5:1\\):a\\) affinity\\(iterator\\(integer\\(kind=4\\) i=1:5:1\\):\\*x\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(integer\\(kind=4\\) k=7:4:-1, integer\\(kind=8\\) j=1:5:1\\):\\*\\(c_char \\*\\) &b\\\[\\(?\\(integer\\(kind=.\\).* \[jk\] \\+ .*\[kj\]\\) \\+ -1\\\]\\) affinity\\(iterator\\(integer\\(kind=4\\) k=7:4:-1, integer\\(kind=8\\) j=1:5:1\\):a\\) affinity\\(cc\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-clause-2.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-2.f90
new file mode 100644
index 0000000..54768a8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-2.f90
@@ -0,0 +1,27 @@
+subroutine foo
+ implicit none
+ external bar
+ integer :: i, b(10)
+ !$omp task affinity(bar(1)) ! { dg-error "not a variable" }
+ !!$omp end task
+ !$omp task affinity(b(1.0)) ! { dg-warning "Legacy Extension: REAL array index" }
+ !$omp end task
+ !$omp task affinity( iterator( real :: i=1.0:5:1) : b(i)) ! { dg-error "Expected INTEGER type" }
+ !!$omp end task
+ !$omp task affinity(iterator(i=1.0:5:1) : b(i)) ! { dg-error "Scalar integer expression for range begin expected" }
+ !$omp end task
+ !$omp task affinity(iterator(i=1:5.0:1) : b(i)) ! { dg-error "Scalar integer expression for range end expected" }
+ !$omp end task
+ !$omp task affinity(iterator(i=1:5:1.0) : b(i)) ! { dg-error "Scalar integer expression for range step expected" }
+ !$omp end task
+ !$omp task affinity(iterator(j=1:3:5, i=1:5:0) : b(i)) ! { dg-error "Nonzero range step expected" }
+ !$omp end task
+ !$omp task affinity(iterator(=1:5:0) : b(i)) ! { dg-error "31:Syntax error in OpenMP variable list" }
+ !!$omp end task
+ !$omp task affinity(iterator(b(2)=1:5:0) : b(i)) ! { dg-error "31:Syntax error in OpenMP variable list" }
+ !!$omp end task
+ !$omp task affinity(iterator(i=1:5:0, i=4:6) : b(i)) ! { dg-error "Same identifier 'i' specified again" }
+ !!$omp end task
+ !$omp task affinity(iterator(i=1) : b(i)) ! { dg-error "Expected range-specification" }
+ !!$omp end task
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-clause-3.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-3.f90
new file mode 100644
index 0000000..3fd39fe
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-3.f90
@@ -0,0 +1,14 @@
+! { dg-additional-options "-fdump-tree-gimple" }
+subroutine foo
+ integer :: A(10), B(10), C(10)
+ interface
+ integer function ibar(x)
+ integer :: x
+ end function ibar
+ end interface
+
+ !$omp task affinity (iterator(j=ibar(0):ibar(1):ibar(2)) : a(ibar(j)), b(j), c(j))
+ !$omp end task
+end
+! { dg-final { scan-tree-dump-times "= ibar \\(&C\\." 3 "gimple" } }
+! { dg-final { scan-tree-dump-times "= ibar \\(j\\." 1 "gimple" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-clause-4.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-4.f90
new file mode 100644
index 0000000..0d07efd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-4.f90
@@ -0,0 +1,16 @@
+subroutine foo
+ integer :: A(10), B(10), C(10)
+ interface
+ integer function ibar(x)
+ integer :: x
+ end function ibar
+ end interface
+
+ !$omp parallel default(none) ! { dg-note "enclosing 'parallel'" }
+ !$omp task affinity (iterator(j=ibar(0):ibar(1):ibar(2)) : a(ibar(j)), b(j), c(j))
+ !$omp end task
+ !$omp end parallel
+! { dg-error "'a' not specified in enclosing 'parallel'" "" { target *-*-* } .-3 }
+! { dg-error "'b' not specified in enclosing 'parallel'" "" { target *-*-* } .-4 }
+! { dg-error "'c' not specified in enclosing 'parallel'" "" { target *-*-* } .-5 }
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-clause-5.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-5.f90
new file mode 100644
index 0000000..538b5a5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-5.f90
@@ -0,0 +1,23 @@
+! { dg-additional-options "-fdump-tree-original" }
+implicit none
+integer :: iterator(10), i
+
+!$omp taskgroup
+ !$omp task affinity(iterator)
+ !$omp end task
+
+ !$omp task affinity(iterator(3))
+ !$omp end task
+
+ !$omp task affinity(iterator(i=1:10) : iterator(i))
+ !$omp end task
+
+!$omp end taskgroup
+
+end
+
+! { dg-final { scan-tree-dump-times "pragma omp task affinity\\(iterator\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(\\*\\(c_char \\*\\) &iterator\\\[2\\\]\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp task affinity\\(iterator\\(integer\\(kind=4\\) i=1:10:1\\):\\*\\(c_char \\*\\) &iterator\\\[.* <?i>? \\+ -1\\\]\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-clause-6.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-6.f90
new file mode 100644
index 0000000..90ec0ac
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-6.f90
@@ -0,0 +1,24 @@
+implicit none
+integer :: iterator(10), i
+
+!$omp taskgroup
+ !$omp task affinity(iterator)
+ !$omp end task
+
+ !$omp task affinity(iterator(3))
+ !$omp end task
+
+ !$omp task affinity(iterator(i=1:10) : iterator(i))
+ !$omp end task
+
+ !$omp task affinity(iterator(integer :: i)) ! { dg-error "Failed to match clause at" }
+ !!$omp end task
+
+ !$omp task affinity(iterator(integer :: i=1:1)) ! { dg-error "Expected ':' at" }
+ !!$omp end task
+
+ !$omp task affinity(iterator(i=)) ! { dg-error "Expected range-specification at" }
+! !$omp end task
+!$omp end taskgroup
+
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/cancel-1.f90 b/gcc/testsuite/gfortran.dg/gomp/cancel-1.f90
new file mode 100644
index 0000000..d60dd72
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/cancel-1.f90
@@ -0,0 +1,539 @@
+! { dg-additional-options "-cpp" }
+
+subroutine f1
+ !$omp cancel parallel ! { dg-error "orphaned" }
+ !$omp cancel do ! { dg-error "orphaned" }
+ !$omp cancel sections ! { dg-error "orphaned" }
+ !$omp cancel taskgroup ! { dg-error "orphaned" }
+ !$omp cancellation point parallel ! { dg-error "orphaned" }
+ !$omp cancellation point do ! { dg-error "orphaned" }
+ !$omp cancellation point sections ! { dg-error "orphaned" }
+ !$omp cancellation point taskgroup ! { dg-error "orphaned" }
+end
+
+subroutine f2
+ integer :: i, j
+ j = 0
+ !$omp parallel
+ !$omp cancel parallel
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+
+ !$omp master
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end master
+
+ !$omp masked
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end masked
+
+ !$omp scope
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end scope
+
+ !$omp single
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end single
+
+ !$omp critical
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end critical
+
+ !$omp taskgroup
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end taskgroup
+
+ !$omp task
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+
+ !$omp taskgroup
+ !$omp task
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup
+ !$omp end task
+ !$omp end taskgroup
+
+ !$omp taskloop
+ do i = 0, 9
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup
+ !$omp task
+ !$omp cancellation point taskgroup
+ !$omp cancel taskgroup
+ !$omp end task
+ end do
+ !$omp taskloop nogroup
+ do i = 0, 9
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp task
+ !$omp cancellation point taskgroup! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+ end do
+ !$omp taskgroup
+ !$omp task
+ !$omp task
+ !$omp cancellation point taskgroup
+ !$omp cancel taskgroup
+ !$omp end task
+ !$omp end task
+ !$omp taskloop nogroup
+ do i = 0, 9
+ !$omp task
+ !$omp cancellation point taskgroup
+ !$omp cancel taskgroup
+ !$omp end task
+ !$omp cancellation point taskgroup
+ !$omp cancel taskgroup
+ end do
+ !$omp end taskgroup
+
+ !$omp taskgroup
+ !$omp parallel
+ !$omp task
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+ !$omp taskloop
+ do i = 0, 9
+ !$omp cancel taskgroup
+ !$omp cancellation point taskgroup
+ end do
+ !$omp taskloop nogroup
+ do i = 0, 9
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ end do
+ !$omp end parallel
+ !$omp target
+ !$omp task
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+ !$omp end target
+ !$omp target
+ !$omp teams
+ !$omp distribute
+ do i = 0, 9
+ !$omp task
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+ end do
+ !$omp end distribute
+ !$omp end teams
+ !$omp end target
+ !$omp target data map(i)
+ !$omp task
+ !$omp cancel taskgroup
+ !$omp cancellation point taskgroup
+ !$omp end task
+ !$omp end target data
+ !$omp end taskgroup
+
+ !$omp taskloop
+ do i = 0, 9
+ !$omp parallel
+ !$omp task
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+ !$omp end parallel
+ !$omp target
+ !$omp task
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+ !$omp end target
+ !$omp target
+ !$omp teams
+ !$omp distribute
+ do j = 0, 9
+ !$omp task
+ !$omp cancel taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp cancellation point taskgroup ! { dg-error "construct not closely nested inside of .taskgroup. region" }
+ !$omp end task
+ end do
+ !$omp end distribute
+ !$omp end teams
+ !$omp end target
+ !$omp target data map(i)
+ !$omp task
+ !$omp cancel taskgroup
+ !$omp cancellation point taskgroup
+ !$omp end task
+ !$omp end target data
+ end do
+
+ !$omp do
+ do i = 0, 9
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup! { dg-error "not closely nested inside" }
+ end do
+
+ !$omp do ordered
+ do i = 0, 9
+ !$omp ordered
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup! { dg-error "not closely nested inside" }
+ !$omp end ordered
+ end do
+ !$omp end do
+ !$omp sections
+ block
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections
+ !$omp cancellation point taskgroup! { dg-error "not closely nested inside" }
+ end block
+ !$omp section
+ block
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections
+ !$omp cancellation point taskgroup! { dg-error "not closely nested inside" }
+ end block
+ !$omp target data map(j)
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target data
+ !$omp target
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target
+ !$omp end sections
+ !$omp end parallel
+ !$omp target data map(j)
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target data
+ !$omp target
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target
+ !$omp target teams
+ !$omp cancel parallel ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp cancel do ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp cancel sections ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp cancel taskgroup ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp cancellation point parallel ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp cancellation point do ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp cancellation point sections ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp cancellation point taskgroup ! { dg-error "only .distribute., .parallel. or .loop. regions are allowed to be strictly nested" }
+ !$omp end target teams
+ !$omp target teams distribute
+ do i = 0, 9
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ end do
+ !$omp end target teams distribute
+ !$omp do
+ do i = 0, 9
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ end do
+ !$omp do
+ do i = 0, 9
+ !$omp target data map(j)
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target data
+ end do
+ !$omp do
+ do i = 0, 9
+ !$omp target
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target
+ end do
+ !$omp do ordered
+ do i = 0, 9
+ !$omp ordered
+ !$omp target data map(j)
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup! { dg-error "not closely nested inside" }
+ !$omp end target data
+ !$omp end ordered
+ end do
+ do i = 0, 9
+ !$omp ordered
+ !$omp target
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup! { dg-error "not closely nested inside" }
+ !$omp end target
+ !$omp end ordered
+ end do
+ !$omp sections
+ block
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ end block
+ !$omp section
+ block
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ end block
+ !$omp end sections
+ !$omp sections
+ !$omp target data map(j)
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target data
+ !$omp section
+ !$omp target data map(j)
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target data
+ !$omp end sections
+ !$omp sections
+ !$omp target
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target
+ !$omp section
+ !$omp target
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end target
+ !$omp end sections
+ !$omp task
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup
+ !$omp taskgroup
+ !$omp cancel parallel ! { dg-error "not closely nested inside" }
+ !$omp cancel do ! { dg-error "not closely nested inside" }
+ !$omp cancel sections ! { dg-error "not closely nested inside" }
+ !$omp cancel taskgroup ! { dg-error "not closely nested inside" }
+ !$omp cancellation point parallel ! { dg-error "not closely nested inside" }
+ !$omp cancellation point do ! { dg-error "not closely nested inside" }
+ !$omp cancellation point sections ! { dg-error "not closely nested inside" }
+ !$omp cancellation point taskgroup ! { dg-error "not closely nested inside" }
+ !$omp end taskgroup
+ !$omp end task
+end
+
+subroutine f3
+ integer i
+ !$omp do
+ do i = 0, 9
+ !$omp cancel do ! { dg-warning "nowait" }
+ end do
+ !$omp end do nowait
+ !$omp sections
+ block
+ !$omp cancel sections ! { dg-warning "nowait" }
+ end block
+ !$omp section
+ block
+ !$omp cancel sections ! { dg-warning "nowait" }
+ end block
+ !$omp end sections nowait
+ !$omp do ordered
+ do i = 0, 9
+ !$omp cancel do ! { dg-warning "ordered" }
+ !$omp ordered
+ !$omp end ordered
+ end do
+end
+
+
+subroutine f4
+! if (.false.) then
+!$omp cancellation point do ! { dg-error "orphaned 'cancellation point' construct" }
+! end if
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/cancel-2.f90 b/gcc/testsuite/gfortran.dg/gomp/cancel-2.f90
index 481b1aa..4ffbb2f 100644
--- a/gcc/testsuite/gfortran.dg/gomp/cancel-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/cancel-2.f90
@@ -5,11 +5,11 @@ subroutine foo ()
!$omp cancel parallel if (.true.)
!$omp cancel parallel if (cancel: .true.)
- !$omp cancel parallel if (.true.) if (.true.) ! { dg-error "Failed to match clause" }
+ !$omp cancel parallel if (.true.) if (.true.) ! { dg-error "Duplicated 'if' clause" }
!$omp cancel parallel if (cancel: .true.) if (cancel: .true.) ! { dg-error "Failed to match clause" }
!$omp cancel parallel if (cancel: .true.) if (.true.) ! { dg-error "IF clause without modifier at .1. used together with IF clauses with modifiers" }
!$omp cancel parallel if (cancel: .true.) if (parallel: .true.) ! { dg-error "IF clause modifier PARALLEL at .1. not appropriate for the current OpenMP construct" }
- !$omp cancel parallel if (.true.) if (cancel: .true.) ! { dg-error "Failed to match clause at" }
+ !$omp cancel parallel if (.true.) if (cancel: .true.) ! { dg-error "Duplicated 'if' clause" }
!$omp cancel parallel if (parallel: .true.) if (cancel: .true.) ! { dg-error "IF clause modifier PARALLEL at .1. not appropriate for the current OpenMP construct" }
!$omp end parallel
end subroutine
diff --git a/gcc/testsuite/gfortran.dg/gomp/cancel-4.f90 b/gcc/testsuite/gfortran.dg/gomp/cancel-4.f90
new file mode 100644
index 0000000..0fb814e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/cancel-4.f90
@@ -0,0 +1,9 @@
+subroutine f4
+ !$omp cancellation point ! { dg-error "Expected construct-type PARALLEL, SECTIONS, DO or TASKGROUP in .OMP CANCELLATION POINT statement at" }
+ if (.false.) then
+!$omp cancellation EKAHI ! { dg-error "Unclassifiable OpenMP directive" }
+ end if
+!$omp cancellation HO OKAHI ! { dg-error "Unclassifiable OpenMP directive" }
+
+!$omp cancellation point ! { dg-error "Expected construct-type PARALLEL, SECTIONS, DO or TASKGROUP in .OMP CANCELLATION POINT statement at" }
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-1.f90 b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-1.f90
new file mode 100644
index 0000000..0ff851d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-1.f90
@@ -0,0 +1,62 @@
+! { dg-do compile }
+! { dg-prune-output "compilation terminated." }
+!
+! FIRSTPRIVATE + class array
+!
+! For now: Expected to give "Sorry" for polymorphic arrays.
+!
+! Polymorphic arrays are tricky - at least if not allocatable, they become:
+! var.0 = var._data.data
+! which needs to be handled properly.
+!
+!
+program select_type_openmp
+ use iso_c_binding
+ !use omp_lib
+ implicit none
+ integer :: i
+ integer :: A(4)
+ type(c_ptr) :: B(4)
+
+ B = [(c_null_ptr, i=1,4)]
+ A = [1,2,3,4]
+ call sub(A, B)
+contains
+ subroutine sub(val1, val2)
+ class(*) :: val1(4)
+ type(c_ptr) :: val2(2:5)
+
+ !$OMP PARALLEL firstprivate(val2)
+ do i = 2, 5
+ if (c_associated (val2(i))) stop 123
+ end do
+ !$OMP END PARALLEL
+
+ !$OMP PARALLEL firstprivate(val1) ! { dg-error "Sorry, polymorphic arrays not yet supported for firstprivate" }
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 33
+ if (any (val1 /= [1, 2, 3, 4])) stop 4549
+ val1 = [32,6,48,28]
+ class default
+ stop 99
+ end select
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 33
+ if (any (val1 /= [32,6,48,28])) stop 4512
+ class default
+ stop 99
+ end select
+ !$OMP END PARALLEL
+
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 33
+ if (any (val1 /= [1, 2, 3, 4])) stop 454
+ class default
+ stop 99
+ end select
+ print *, "PASS!"
+ end subroutine
+end program select_type_openmp
diff --git a/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-2.f90 b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-2.f90
new file mode 100644
index 0000000..3542237
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-2.f90
@@ -0,0 +1,54 @@
+! { dg-do compile }
+! { dg-prune-output "compilation terminated." }
+!
+! FIRSTPRIVATE + class array
+!
+! For now: Expected to give "Sorry" for polymorphic arrays.
+!
+! Polymorphic arrays are tricky - at least if not allocatable, they become:
+! var.0 = var._data.data
+! which needs to be handled properly.
+!
+!
+program select_type_openmp
+ !use omp_lib
+ implicit none
+ class(*), allocatable :: B(:)
+
+ allocate(B, source=["abcdef","cdefi2"])
+ allocate(B, source=[1,2,3])
+ call sub(B)
+contains
+ subroutine sub(val2)
+ class(*), allocatable :: val2(:)
+
+ !$OMP PARALLEL firstprivate(val2) ! { dg-error "Sorry, polymorphic arrays not yet supported for firstprivate" }
+ if (.not.allocated(val2)) stop 3
+ select type (val2)
+ type is (character(len=*))
+ if (len(val2) /= 6) stop 44
+ if (val2(1) /= "abcdef" .or. val2(2) /= "cdefi2") stop 4545
+ val2 = ["123456", "789ABC"]
+ class default
+ stop 991
+ end select
+ select type (val2)
+ type is (character(len=*))
+ if (len(val2) /= 6) stop 44
+ if (val2(1) /= "123456" .or. val2(2) /= "789ABC") stop 453
+ class default
+ stop 991
+ end select
+ !$OMP END PARALLEL
+
+ if (.not.allocated(val2)) stop 3
+ select type (val2)
+ type is (character(len=*))
+ if (len(val2) /= 6) stop 44
+ if (val2(1) /= "abcdef" .or. val2(2) /= "cdefi2") stop 456
+ class default
+ stop 991
+ end select
+ print *, "PASS!"
+ end subroutine
+end program select_type_openmp
diff --git a/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-3.f90 b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-3.f90
new file mode 100644
index 0000000..c83bf29
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-3.f90
@@ -0,0 +1,61 @@
+! { dg-do compile }
+! { dg-prune-output "compilation terminated." }
+!
+! FIRSTPRIVATE + class array
+!
+! For now: Expected to give "Sorry" for polymorphic arrays.
+!
+! Polymorphic arrays are tricky - at least if not allocatable, they become:
+! var.0 = var._data.data
+! which needs to be handled properly.
+!
+!
+program select_type_openmp
+ use iso_c_binding
+ !use omp_lib
+ implicit none
+ call sub
+contains
+ subroutine sub
+ integer :: i
+ class(*), allocatable :: val1(:)
+ type(c_ptr), allocatable :: val2(:)
+
+ allocate(val1, source=[1, 2, 3, 4])
+ allocate(val2(2:5))
+ val2 = c_null_ptr
+
+ !$OMP PARALLEL firstprivate(val2)
+ do i = 2, 5
+ if (c_associated (val2(i))) stop 123
+ end do
+ !$OMP END PARALLEL
+
+ !$OMP PARALLEL firstprivate(val1) ! { dg-error "Sorry, polymorphic arrays not yet supported for firstprivate" }
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 33
+ if (any (val1 /= [1, 2, 3, 4])) stop 4549
+ val1 = [32,6,48,28]
+ class default
+ stop 99
+ end select
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 33
+ if (any (val1 /= [32,6,48,28])) stop 4512
+ class default
+ stop 99
+ end select
+ !$OMP END PARALLEL
+
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 33
+ if (any (val1 /= [1, 2, 3, 4])) stop 454
+ class default
+ stop 99
+ end select
+ print *, "PASS!"
+ end subroutine
+end program select_type_openmp
diff --git a/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-4.f90 b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-4.f90
new file mode 100644
index 0000000..237c6c5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/class-firstprivate-4.f90
@@ -0,0 +1,44 @@
+! { dg-do compile }
+! { dg-prune-output "compilation terminated." }
+!
+! FIRSTPRIVATE + class array
+!
+! For now: Expected to give "Sorry" for polymorphic arrays.
+!
+! Polymorphic arrays are tricky - at least if not allocatable, they become:
+! var.0 = var._data.data
+! which needs to be handled properly.
+!
+!
+program select_type_openmp
+ use iso_c_binding
+ !use omp_lib
+ implicit none
+ integer x(4)
+ x = [1, 2, 3, 4]
+ call sub(x)
+ if (any (x /= [1,2,3,4])) stop 3
+contains
+ subroutine sub(val1)
+ integer :: i
+ class(*) :: val1(4)
+
+ !$OMP PARALLEL firstprivate(val1) ! { dg-error "Sorry, polymorphic arrays not yet supported for firstprivate" }
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 33
+ if (any (val1 /= [1, 2, 3, 4])) stop 4549
+ val1 = [32,6,48,28]
+ class default
+ stop 99
+ end select
+ select type (val1)
+ type is (integer)
+ if (size(val1) /= 4) stop 34
+ if (any (val1 /= [32,6,48,28])) stop 4512
+ class default
+ stop 98
+ end select
+ !$OMP END PARALLEL
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-1.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-1.f90
index 40169d3..04abd51 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-simd-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-1.f90
@@ -2,7 +2,7 @@
subroutine fn1 (x)
integer :: x
-!$omp declare simd (fn1) inbranch notinbranch uniform (x) ! { dg-error "Failed to match clause" }
+!$omp declare simd (fn1) inbranch notinbranch uniform (x) ! { dg-error "Duplicated 'notinbranch' clause" }
end subroutine fn1
subroutine fn2 (x)
!$omp declare simd (fn100) ! { dg-error "should refer to containing procedure" }
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90
new file mode 100644
index 0000000..f0c4e39
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90
@@ -0,0 +1,12 @@
+! { dg-additional-options "-fcoarray=lib" }
+!
+! PR fortran/93660
+!
+! Failed as TREE_TYPE(fndecl) did not include the
+! hidden caf_token/caf_offset arguments.
+!
+integer function f(x) ! { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } }
+ integer :: x[*]
+ !$omp declare simd
+ f = x[1]
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-1.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-1.f90
new file mode 100644
index 0000000..299d971
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-1.f90
@@ -0,0 +1,19 @@
+! PR fortran/92568
+
+implicit none
+
+!$omp target defaultmap(bar) ! { dg-error "25: Expected ALLOC, TO, FROM, TOFROM, FIRSTPRIVATE, NONE or DEFAULT" }
+
+!$omp target defaultmap ( alloc: foo) ! { dg-error "34: Expected SCALAR, AGGREGATE, ALLOCATABLE or POINTER" }
+
+!$omp target defaultmap(alloc:scalar) defaultmap(none:Scalar) ! { dg-error "DEFAULTMAP at .1. but prior DEFAULTMAP for category SCALAR" }
+
+!$omp target defaultmap(default:aggregate) defaultmap(tofrom) ! { dg-error "DEFAULTMAP at .1. but prior DEFAULTMAP for category AGGREGATE" }
+
+!$omp target defaultmap(from:pointer) defaultmap(tofrom:pointer) ! { dg-error "DEFAULTMAP at .1. but prior DEFAULTMAP for category POINTER" }
+
+!$omp target defaultmap(from:scalar) defaultmap(to:allocatable) defaultmap(tofrom:allocatable) ! { dg-error "DEFAULTMAP at .1. but prior DEFAULTMAP for category ALLOCATABLE" }
+
+!$omp target defaultmap(from) defaultmap(to) ! { dg-error "DEFAULTMAP at .1. but prior DEFAULTMAP with unspecified category" }
+
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-2.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-2.f90
new file mode 100644
index 0000000..1658424
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-2.f90
@@ -0,0 +1,108 @@
+! PR fortran/92568
+!
+implicit none
+ type t
+ end type t
+
+ integer :: ii
+ integer :: arr(5)
+ integer, allocatable :: aii, aarr(:)
+ integer, pointer :: pii, parr(:)
+
+ character :: str1, str1arr(5), str1a, str1aarr(:), str1p, str1parr(:)
+ character(len=5) :: str5, str5arr(5), str5a, str5aarr(:), str5p, str5parr(:)
+ character(len=:) :: strXa, strXaarr(:), strXp, strXparr(:)
+ allocatable :: str1a, str1aarr, str5a, str5aarr, strXa, strXaarr
+ pointer :: str1p, str1parr, str5p, str5parr, strXp, strXparr
+
+ type(t) :: dt, dtarr(5), dta, dtaarr(:), dtp, dtparr(:)
+ allocatable :: dta, dtaarr
+ pointer :: dtp, dtparr
+
+ allocate(aii, aarr(5), str1a, str1aarr(5), dta, dtparr(5))
+ allocate(pii, parr(5), str1p, str1parr(5), dtp, dtparr(5))
+ allocate(character(len=7) :: strXa, strXaarr(5), strXp, strXparr(5))
+
+
+ !$omp target defaultmap ( none ) ! { dg-note "enclosing 'target'" }
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ ! { dg-error "'ii' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'arr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'aii' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'aarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'pii' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'parr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ ! { dg-error "'str1' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'str1arr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'str1a' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'str1aarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'str1p' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'str1parr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ ! { dg-error "'str5' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'str5arr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'str5a' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'str5aarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'str5p' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'str5parr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ ! { dg-error "'strxa' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'strxaarr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'strxp' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'strxparr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ ! { dg-error "'dt' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'dtarr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'dta' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'dtaarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'dtp' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'dtparr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+ !$omp end target
+
+
+ !$omp target defaultmap(none : scalar) defaultmap(none : aggregate) &
+ !$omp& defaultmap(none : allocatable) defaultmap(none : pointer) ! { dg-note "enclosing 'target'" }
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ ! { dg-error "'ii' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'arr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'aii' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'aarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'pii' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'parr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ ! { dg-error "'str1' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'str1arr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'str1a' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'str1aarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'str1p' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'str1parr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ ! { dg-error "'str5' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'str5arr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'str5a' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'str5aarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'str5p' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'str5parr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ ! { dg-error "'strxa' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'strxaarr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'strxp' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'strxparr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ ! { dg-error "'dt' not specified in enclosing 'target'" "" { target *-*-* } .-1 }
+ ! { dg-error "'dtarr' not specified in enclosing 'target'" "" { target *-*-* } .-2 }
+ ! { dg-error "'dta' not specified in enclosing 'target'" "" { target *-*-* } .-3 }
+ ! { dg-error "'dtaarr' not specified in enclosing 'target'" "" { target *-*-* } .-4 }
+ ! { dg-error "'dtp' not specified in enclosing 'target'" "" { target *-*-* } .-5 }
+ ! { dg-error "'dtparr' not specified in enclosing 'target'" "" { target *-*-* } .-6 }
+ !$omp end target
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-3.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-3.f90
new file mode 100644
index 0000000..cfe40e8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-3.f90
@@ -0,0 +1,60 @@
+! { dg-additional-options "-fdump-tree-original" }
+! { dg-additional-options "-fdump-tree-gimple" }
+!
+! PR fortran/92568
+!
+implicit none
+ type t
+ end type t
+
+ integer :: ii
+ integer :: arr(5)
+ integer, allocatable :: aii, aarr(:)
+ integer, pointer :: pii, parr(:)
+
+ character :: str1, str1arr(5), str1a, str1aarr(:), str1p, str1parr(:)
+ character(len=5) :: str5, str5arr(5), str5a, str5aarr(:), str5p, str5parr(:)
+ character(len=:) :: strXa, strXaarr(:), strXp, strXparr(:)
+ allocatable :: str1a, str1aarr, str5a, str5aarr, strXa, strXaarr
+ pointer :: str1p, str1parr, str5p, str5parr, strXp, strXparr
+
+ type(t) :: dt, dtarr(5), dta, dtaarr(:), dtp, dtparr(:)
+ allocatable :: dta, dtaarr
+ pointer :: dtp, dtparr
+
+ allocate(aii, aarr(5), str1a, str1aarr(5), dta, dtparr(5))
+ allocate(pii, parr(5), str1p, str1parr(5), dtp, dtparr(5))
+ allocate(character(len=7) :: strXa, strXaarr(5), strXp, strXparr(5))
+
+
+ !$omp target defaultmap ( none ) &
+ !$omp& map(tofrom: ii, arr, aii, aarr, pii, parr) &
+ !$omp& map(tofrom: str1, str1arr, str1a, str1aarr, str1p, str1parr) &
+ !$omp& map(tofrom: str5, str5arr, str5a, str5aarr, str5p, str5parr) &
+ !$omp& map(tofrom: strXa, strXaarr, strXp, strXparr) &
+ !$omp& map(tofrom: dt, dtarr, dta, dtaarr, dtp, dtparr)
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ !$omp end target
+
+
+ !$omp target defaultmap(none : scalar) defaultmap(none : aggregate) &
+ !$omp& defaultmap(none : allocatable) defaultmap(none : pointer) &
+ !$omp& map(alloc: ii, arr, aii, aarr, pii, parr) &
+ !$omp& map(alloc: str1, str1arr, str1a, str1aarr, str1p, str1parr) &
+ !$omp& map(alloc: str5, str5arr, str5a, str5aarr, str5p, str5parr) &
+ !$omp& map(alloc: strXa, strXaarr, strXp, strXparr) &
+ !$omp& map(alloc: dt, dtarr, dta, dtaarr, dtp, dtparr)
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ !$omp end target
+end
+
+! { dg-final { scan-tree-dump-times "#pragma omp target map\\(tofrom:.* defaultmap\\(none\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target map\\(alloc:.* defaultmap\\(none:scalar\\) defaultmap\\(none:aggregate\\) defaultmap\\(none:allocatable\\) defaultmap\\(none:pointer\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-4.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-4.f90
new file mode 100644
index 0000000..89bbe87
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-4.f90
@@ -0,0 +1,141 @@
+! { dg-additional-options "-fdump-tree-original" }
+! { dg-additional-options "-fdump-tree-gimple" }
+!
+! PR fortran/92568
+!
+implicit none
+ type t
+ end type t
+
+ integer :: ii
+ integer :: arr(5)
+ integer, allocatable :: aii, aarr(:)
+ integer, pointer :: pii, parr(:)
+
+ character :: str1, str1arr(5), str1a, str1aarr(:), str1p, str1parr(:)
+ character(len=5) :: str5, str5arr(5), str5a, str5aarr(:), str5p, str5parr(:)
+ character(len=:) :: strXa, strXaarr(:), strXp, strXparr(:)
+ allocatable :: str1a, str1aarr, str5a, str5aarr, strXa, strXaarr
+ pointer :: str1p, str1parr, str5p, str5parr, strXp, strXparr
+
+ type(t) :: dt, dtarr(5), dta, dtaarr(:), dtp, dtparr(:)
+ allocatable :: dta, dtaarr
+ pointer :: dtp, dtparr
+
+ allocate(aii, aarr(5), str1a, str1aarr(5), dta, dtparr(5))
+ allocate(pii, parr(5), str1p, str1parr(5), dtp, dtparr(5))
+ allocate(character(len=7) :: strXa, strXaarr(5), strXp, strXparr(5))
+
+
+ !$omp target defaultmap ( alloc )
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ !$omp end target
+
+ !$omp target defaultmap(alloc : scalar) defaultmap(to : aggregate) &
+ !$omp& defaultmap(tofrom : allocatable) defaultmap(firstprivate : pointer)
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ !$omp end target
+end
+
+! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(alloc:scalar\\) defaultmap\\(to:aggregate\\) defaultmap\\(tofrom:allocatable\\) defaultmap\\(firstprivate:pointer\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(alloc\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "firstprivate\\(dtp\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(pii\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(str1p\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(str5p\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(strxp\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*aii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:aii \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) dtaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) dtparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) str1aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) str1parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) str5aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) str5parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) strxaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*\\(c_char \\*\\) strxparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:1\\\] \\* restrict\\) str1aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:5\\\] \\* restrict\\) str5aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:\\.strxaarr\\\] \\* restrict\\) strxaarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*dta \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dta \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dtarr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dt \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*dtp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dtp \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:ii \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(integer\\(kind=4\\)\\\[0:\\\] \\* restrict\\) aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*pii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:pii \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*str1a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1a \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*str1p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1p \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*str5a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5a \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*str5p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5p \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(struct t\\\[0:\\\] \\* restrict\\) dtaarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*strxa \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:strxa \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\*strxp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:strxp \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:1\\\] \\*\\) str1parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:5\\\] \\*\\) str5parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:\\.strxparr\\\] \\*\\) strxparr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(struct t\\\[0:\\\] \\*\\) dtparr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:aarr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) dtparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) str1parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) str5parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) strxparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtaarr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtarr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dt \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtparr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*aii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) dtaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str1aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str5aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) strxaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*dta \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str1a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str5a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*strxa \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:parr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1aarr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1parr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5aarr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5parr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxaarr \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:strxaarr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxa \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxparr \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:strxparr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxp \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(1\\) thread_limit\\(0\\) defaultmap\\(alloc\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(1\\) thread_limit\\(0\\) defaultmap\\(alloc:scalar\\) defaultmap\\(to:aggregate\\) defaultmap\\(tofrom:allocatable\\) defaultmap\\(firstprivate:pointer\\)" 1 "gimple" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-5.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-5.f90
new file mode 100644
index 0000000..d6b32dc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-5.f90
@@ -0,0 +1,145 @@
+! { dg-additional-options "-fdump-tree-original" }
+! { dg-additional-options "-fdump-tree-gimple" }
+!
+! PR fortran/92568
+!
+implicit none
+ type t
+ end type t
+
+ integer :: ii
+ integer :: arr(5)
+ integer, allocatable :: aii, aarr(:)
+ integer, pointer :: pii, parr(:)
+
+ character :: str1, str1arr(5), str1a, str1aarr(:), str1p, str1parr(:)
+ character(len=5) :: str5, str5arr(5), str5a, str5aarr(:), str5p, str5parr(:)
+ character(len=:) :: strXa, strXaarr(:), strXp, strXparr(:)
+ allocatable :: str1a, str1aarr, str5a, str5aarr, strXa, strXaarr
+ pointer :: str1p, str1parr, str5p, str5parr, strXp, strXparr
+
+ type(t) :: dt, dtarr(5), dta, dtaarr(:), dtp, dtparr(:)
+ allocatable :: dta, dtaarr
+ pointer :: dtp, dtparr
+
+ allocate(aii, aarr(5), str1a, str1aarr(5), dta, dtparr(5))
+ allocate(pii, parr(5), str1p, str1parr(5), dtp, dtparr(5))
+ allocate(character(len=7) :: strXa, strXaarr(5), strXp, strXparr(5))
+
+
+ !$omp target defaultmap ( to )
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ !$omp end target
+
+
+ ! FIXME: strXp disabled because of PR fortran/100965
+
+ !$omp target defaultmap(to : scalar) defaultmap(tofrom : aggregate) &
+ !$omp& defaultmap(firstprivate : allocatable) defaultmap(default : pointer)
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ !strXa = "";
+ strXaarr = "";
+ ! strXp = ""
+ strXparr = ""
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ !$omp end target
+end
+
+! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(to\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(to:scalar\\) defaultmap\\(tofrom:aggregate\\) defaultmap\\(firstprivate:allocatable\\) defaultmap\\(default:pointer\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "firstprivate\\(aarr\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(aii\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(dta\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(dtaarr\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(str1a\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(str1aarr\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(str5a\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(str5aarr\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "firstprivate\\(strxaarr\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:aii \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:1\\\] \\* restrict\\) str1aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:5\\\] \\* restrict\\) str5aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:\\.strxaarr\\\] \\* restrict\\) strxaarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dta \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dtp \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(integer\\(kind=4\\)\\\[0:\\\] \\* restrict\\) aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:pii \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1a \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1p \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5a \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5p \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(struct t\\\[0:\\\] \\* restrict\\) dtaarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:strxa \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:strxp \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:1\\\] \\*\\) str1parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:5\\\] \\*\\) str5parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:\\.strxparr\\\] \\*\\) strxparr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(struct t\\\[0:\\\] \\*\\) dtparr\\.data \\\[pointer assign, bias: 0\\\]\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:aarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*aii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) dtaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) dtparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) str1aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) str1parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) str5aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) str5parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) strxaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*\\(c_char \\*\\) strxparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtaarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*dta \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtarr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dt \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtparr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*dtp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) dtparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str1parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str5parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) strxparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:dtarr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:dt \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*dtp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*pii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str1arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str1 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str1p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str5arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str5 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str5p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:ii \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:parr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*pii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1aarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*str1a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1parr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*str1p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5aarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*str5a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5parr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*str5p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxaarr \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:strxaarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*strxa \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxa \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxparr \\\[len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:strxparr \\\[pointer set, len:" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\*strxp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(1\\) thread_limit\\(0\\) defaultmap\\(to\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(1\\) thread_limit\\(0\\) defaultmap\\(to:scalar\\) defaultmap\\(tofrom:aggregate\\) defaultmap\\(firstprivate:allocatable\\) defaultmap\\(default:pointer\\)" 1 "gimple" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-6.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-6.f90
new file mode 100644
index 0000000..fabf771
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-6.f90
@@ -0,0 +1,104 @@
+! { dg-additional-options "-fdump-tree-original" }
+! { dg-additional-options "-fdump-tree-gimple" }
+!
+! PR fortran/92568
+!
+implicit none
+ type t
+ end type t
+
+ integer :: ii
+ integer :: arr(5)
+ integer, allocatable :: aii, aarr(:)
+ integer, pointer :: pii, parr(:)
+
+ character :: str1, str1arr(5), str1a, str1aarr(:), str1p, str1parr(:)
+ character(len=5) :: str5, str5arr(5), str5a, str5aarr(:), str5p, str5parr(:)
+ character(len=:) :: strXa, strXaarr(:), strXp, strXparr(:)
+ allocatable :: str1a, str1aarr, str5a, str5aarr, strXa, strXaarr
+ pointer :: str1p, str1parr, str5p, str5parr, strXp, strXparr
+
+ type(t) :: dt, dtarr(5), dta, dtaarr(:), dtp, dtparr(:)
+ allocatable :: dta, dtaarr
+ pointer :: dtp, dtparr
+
+ allocate(aii, aarr(5), str1a, str1aarr(5), dta, dtparr(5))
+ allocate(pii, parr(5), str1p, str1parr(5), dtp, dtparr(5))
+ allocate(character(len=7) :: strXa, strXaarr(5), strXp, strXparr(5))
+
+
+ !$omp target defaultmap ( default )
+ ii = 42; arr = 42; aii = 42; aarr = 42; pii = 42; parr = 42
+ str1 = ""; str1arr = ""; str1a = ""; str1aarr = ""; str1p = ""; str1parr = ""
+ str5 = ""; str5arr = ""; str5a = ""; str5aarr = ""; str5p = ""; str5parr = ""
+ strXa = ""; strXaarr = ""; strXp = ""; strXparr = ""
+ dt = t(); dtarr = t(); dta = t(); dtaarr = t(); dtp = t(); dtparr = t()
+ !$omp end target
+
+end
+
+! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(default\\)" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "firstprivate\\(ii\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:aii \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:1\\\] \\* restrict\\) str1aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:5\\\] \\* restrict\\) str5aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:\\.strxaarr\\\] \\* restrict\\) strxaarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dta \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:dtp \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(integer\\(kind=4\\)\\\[0:\\\] \\* restrict\\) aarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:pii \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1a \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str1p \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5a \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:str5p \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:\\(struct t\\\[0:\\\] \\* restrict\\) dtaarr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:strxa \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(alloc:strxp \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:1\\\] \\*\\) str1parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:5\\\] \\*\\) str5parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:\\.strxparr\\\] \\*\\) strxparr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) parr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(always_pointer:\\(struct t\\\[0:\\\] \\*\\) dtparr\\.data \\\[pointer assign, bias: 0\\\]\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:aarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtaarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:dtparr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*aii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) dtaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) dtparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str1aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str1parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str5aarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) str5parr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) strxaarr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*\\(c_char \\*\\) strxparr\\.data \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*dta \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:dtarr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:dt \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*dtp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*pii \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str1a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str1arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str1 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str1p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str5a \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str5arr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str5 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*str5p \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*strxa \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*strxp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:parr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1aarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str1parr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5aarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:str5parr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxaarr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:strxaarr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxa \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxparr \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:strxparr \\\[pointer set, len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(to:\\.strxp \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(1\\) thread_limit\\(0\\) defaultmap\\(default\\)" 1 "gimple" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-7.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-7.f90
new file mode 100644
index 0000000..e1b4fc2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-7.f90
@@ -0,0 +1,24 @@
+! PR fortran/92568
+!
+! { dg-additional-options "-fdump-tree-original" }
+! { dg-additional-options "-fdump-tree-gimple" }
+implicit none
+ integer :: ii, aa, pp
+ allocatable :: aa
+ pointer :: pp
+ character :: str
+ character(len=2) :: str2
+
+!$omp target
+ ii = 1
+ aa = 5
+ pp = 7
+ str = '1'
+ str2 = '12'
+!$omp end target
+end
+! { dg-final { scan-tree-dump-times "firstprivate\\(ii\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*aa" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:\\*pp" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str2 \\\[len:" 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "map\\(tofrom:str \\\[len:" 1 "gimple" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/depend-iterator-1.f90 b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-1.f90
new file mode 100644
index 0000000..d852b95
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-1.f90
@@ -0,0 +1,45 @@
+! { dg-do compile }
+
+module mymod
+ implicit none (type, external)
+ integer, target :: var(0:5) = [0,1,2,3,4,5]
+end module mymod
+
+program main
+ use mymod
+ implicit none
+
+ type t
+ integer :: x(0:64)
+ integer :: y
+ end type t
+ type(t) :: dep2(0:64)
+ integer :: dep1(0:64)
+
+ integer arr(0:63)
+ !$omp parallel
+ !$omp master
+ block
+ integer :: i
+ do i = 0, 63
+ !$omp task depend (iterator (j=i:i+1) , out : dep1 (j))
+ arr(i) = i
+ !$omp end task
+ !$omp task depend (iterator (j=i:i+1) , out : dep2 (j))
+ arr(i) = i
+ !$omp end task
+ !$omp task depend (iterator (j=i:i+1) , out : dep2 (j)%y)
+ arr(i) = i
+ !$omp end task
+ !$omp task depend (iterator (j=i:i+1) , out : dep2 (j)%x(j))
+ arr(i) = i
+ !$omp end task
+ !$omp task depend (out : dep2 (:4))
+ arr(i) = i
+ !$omp end task
+ !$omp taskwait depend(out: dep1(1))
+ end do
+ end block
+ !$omp end master
+ !$omp end parallel
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f90 b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f90
new file mode 100644
index 0000000..21fc327
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f90
@@ -0,0 +1,44 @@
+! { dg-do compile }
+
+module mymod
+ implicit none (type, external)
+ integer, target :: var(0:5) = [0,1,2,3,4,5]
+contains
+ function foo (i)
+ integer :: i
+ integer, pointer :: foo
+ foo => var(mod(i, 6))
+ end
+end module mymod
+
+program main
+ use mymod
+ implicit none
+
+ type t
+ integer :: x(0:64)
+ integer :: y
+ end type t
+ type(t) :: dep2(0:64)
+ integer :: dep1(0:64)
+
+ integer arr(0:63)
+ !$omp parallel
+ !$omp master
+ block
+ integer :: i
+ do i = 0, 63
+ ! NB: Revoking foo (pointer returning function) as in 'foo(i)' is a variable in the Fortran sense
+ !$omp task depend (iterator (j=i:i+1) , out : foo (j)) ! { dg-error "is not a variable" }
+ arr(i) = i
+ !!$omp end task
+ !$omp task depend(iterator(i=1:5), source ) ! { dg-error "ITERATOR may not be combined with SOURCE" }
+ !!$omp end task
+ !$omp task affinity (iterator(i=1:5): a) depend(iterator(i=1:5), sink : x) ! { dg-error "ITERATOR may not be combined with SINK" }
+ !!$omp end task
+
+ end do
+ end block
+ !$omp end master
+ !$omp end parallel
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/depend-iterator-3.f90 b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-3.f90
new file mode 100644
index 0000000..85465ee
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-3.f90
@@ -0,0 +1,27 @@
+subroutine foo
+ implicit none
+ external bar
+ integer :: i, b(10)
+ !$omp task depend(in : bar(1)) ! { dg-error "not a variable" }
+ !!$omp end task
+ !$omp task depend(out : b(1.0)) ! { dg-warning "Legacy Extension: REAL array index" }
+ !$omp end task
+ !$omp task depend( iterator( real :: i=1.0:5:1), in : b(i)) ! { dg-error "Expected INTEGER type" }
+ !!$omp end task
+ !$omp task depend(iterator(i=1.0:5:1), out : b(i)) ! { dg-error "Scalar integer expression for range begin expected" }
+ !$omp end task
+ !$omp task depend(iterator(i=1:5.0:1), in : b(i)) ! { dg-error "Scalar integer expression for range end expected" }
+ !$omp end task
+ !$omp task depend(iterator(i=1:5:1.0), in : b(i)) ! { dg-error "Scalar integer expression for range step expected" }
+ !$omp end task
+ !$omp task depend(iterator(j=1:3:5, i=1:5:0), out : b(i)) ! { dg-error "Nonzero range step expected" }
+ !$omp end task
+ !$omp task depend(iterator(=1:5:0), in : b(i)) ! { dg-error "Expected identifier" }
+ !!$omp end task
+ !$omp task depend(iterator(b(2)=1:5:1), in : b(i)) ! { dg-error "Failed to match clause" }
+ !!$omp end task
+ !$omp task depend(iterator(i=1:5:0, i=4:6), out: b(i)) ! { dg-error "Same identifier 'i' specified again" }
+ !!$omp end task
+ !$omp task depend(iterator(i=1) ,out: b(i)) ! { dg-error "Expected range-specification" }
+ !!$omp end task
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/depobj-1.f90 b/gcc/testsuite/gfortran.dg/gomp/depobj-1.f90
new file mode 100644
index 0000000..66cfb61
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/depobj-1.f90
@@ -0,0 +1,25 @@
+! { dg-do compile { target { fortran_integer_16 || ilp32 } } }
+! omp_depend_kind = 2*intptr_t --> 16 (128 bit) on 64bit-pointer systems
+! --> 8 (128 bit) on 32bit-pointer systems
+subroutine f1
+ !use omp_lib ! N/A in gcc/testsuite
+ use iso_c_binding, only: c_intptr_t
+ implicit none
+ integer, parameter :: omp_depend_kind = 2*c_intptr_t
+ integer :: a
+ integer(kind=omp_depend_kind) :: depobj1, depobj2, depobj3, depobj4, depobj5
+ !$omp depobj(depobj1) depend (in : a)
+ !$omp depobj(depobj2) depend (out : a)
+ !$omp depobj(depobj3) depend( inout : a)
+ !$omp depobj(depobj4) depend(mutexinoutset: a)
+ !$omp depobj(depobj1) update(out)
+ !$omp depobj(depobj2) update(mutexinoutset)
+ !$omp depobj(depobj3) update(in)
+ !$omp depobj(depobj4) update(inout)
+ !$omp task depend (depobj: depobj1, depobj2, depobj3)
+ !$omp end task
+
+ !$omp task depend(mutexinoutset: a)
+ !$omp end task
+ !$omp depobj(depobj2) destroy
+end subroutine f1
diff --git a/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90 b/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90
new file mode 100644
index 0000000..3ffd3d5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90
@@ -0,0 +1,33 @@
+! { dg-do compile { target { fortran_integer_16 || ilp32 } } }
+! omp_depend_kind = 2*intptr_t --> 16 (128 bit) on 64bit-pointer systems
+! --> 8 (128 bit) on 32bit-pointer systems
+subroutine f1
+ !use omp_lib ! N/A in gcc/testsuite
+ use iso_c_binding, only: c_intptr_t
+ implicit none
+ integer, parameter :: omp_depend_kind = 2*c_intptr_t
+ integer :: a, b
+ integer(kind=omp_depend_kind) :: depobj, depobj1(5)
+ real :: r
+ integer(1) :: d
+
+ !$omp depobj ! { dg-error "Expected '\\( depobj \\)\'" }
+ !$omp depobj(depobj) ! { dg-error "Expected DEPEND, UPDATE, or DESTROY clause" }
+ !$omp depobj destroy ! { dg-error "Expected '\\( depobj \\)\'" }
+ !$omp depobj ( depobj1 ( 1 ) ) depend( inout : a) ! OK
+ !$omp depobj(depobj1) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" }
+ !$omp depobj(depobj1(:)) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" }
+ !$omp depobj(r) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" }
+ !$omp depobj(d) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" }
+ !$omp depobj(depobj) depend( inout : a, b) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall have only a single locator" }
+ !$omp depobj(depobj) depend(mutexinoutset : a) ! OK
+ !$omp depobj(depobj) depend(source) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" }
+ !$omp depobj(depobj) depend(sink : i + 1) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" }
+ !$omp depobj(depobj) update(source) ! { dg-error "Expected IN, OUT, INOUT, MUTEXINOUTSET followed by '\\)'" }
+ !$omp depobj(depobj) update(sink) ! { dg-error "Expected IN, OUT, INOUT, MUTEXINOUTSET followed by '\\)'" }
+ !$omp depobj(depobj) update(depobj) ! { dg-error "Expected IN, OUT, INOUT, MUTEXINOUTSET followed by '\\)'" }
+
+ ! Valid in OpenMP 5.1:
+ !$omp depobj(depobj5) depend(depobj: depobj3) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" }
+end subroutine f1
+
diff --git a/gcc/testsuite/gfortran.dg/gomp/error-1.f90 b/gcc/testsuite/gfortran.dg/gomp/error-1.f90
new file mode 100644
index 0000000..0ee0b4b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/error-1.f90
@@ -0,0 +1,51 @@
+! { dg-additional-options "-ffree-line-length-none" }
+module m
+!$omp error ! { dg-error ".OMP ERROR encountered at .1." }
+!$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." }
+!$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." }
+!$omp error message("my msg") ! { dg-error ".OMP ERROR encountered at .1.: my msg" }
+!$omp error severity(warning)message("another message")at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: another message" }
+
+type S
+ !$omp error ! { dg-error ".OMP ERROR encountered at .1." }
+ !$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." }
+ !$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." }
+ !$omp error message("42") ! { dg-error ".OMP ERROR encountered at .1.: 42" }
+ !$omp error severity(warning), message("foo"), at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: foo" }
+ integer s
+end type S
+end module m
+
+integer function foo (i, x)
+ integer :: i
+ logical :: x
+ !$omp error ! { dg-error ".OMP ERROR encountered at .1." }
+ !$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." }
+ !$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." }
+ !$omp error message("42 / 1") ! { dg-error ".OMP ERROR encountered at .1.: 42 / 1" }
+ !$omp error severity(warning) message("bar") at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: bar" }
+ if (x) then
+ !$omp error ! { dg-error ".OMP ERROR encountered at .1." }
+ i = i + 1
+ end if
+ if (x) then
+ ;
+ else
+ !$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." }
+ i = i + 1
+ end if
+ select case (.false.)
+ !$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." }
+ case default
+ !
+ end select
+ do while (.false.)
+ !$omp error message("42 - 1") ! { dg-error ".OMP ERROR encountered at .1.: 42 - 1" }
+ i = i + 1
+ end do
+ lab:
+ !$omp error severity(warning) message("bar") at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: bar" }
+ i++;
+ foo = i
+ return
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/error-2.f90 b/gcc/testsuite/gfortran.dg/gomp/error-2.f90
new file mode 100644
index 0000000..718e82c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/error-2.f90
@@ -0,0 +1,15 @@
+subroutine foo (x, msg1, msg2)
+ integer x
+ character(len=*) :: msg1, msg2
+ if (x == 0) then
+ !$omp error at(execution)
+ else if (x == 1) then
+ !$omp error severity (warning), at (execution)
+ else if (x == 2) then
+ !$omp error at ( execution ) severity (fatal) message ("baz")
+ else if (x == 3) then
+ !$omp error severity(warning) message (msg1) at(execution)
+ else
+ !$omp error message (msg2), at(execution), severity(fatal)
+ end if
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/error-3.f90 b/gcc/testsuite/gfortran.dg/gomp/error-3.f90
new file mode 100644
index 0000000..b4d8b77
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/error-3.f90
@@ -0,0 +1,88 @@
+module m
+!$omp error asdf ! { dg-error "Failed to match clause" }
+!$omp error at ! { dg-error "Expected '\\(' after 'at'" }
+!$omp error at( ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" }
+!$omp error at(runtime) ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" }
+!$omp error at(+ ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" }
+!$omp error at(compilation ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" }
+!$omp error severity ! { dg-error "Expected '\\(' after 'severity'" }
+!$omp error severity( ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" }
+!$omp error severity(error) ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" }
+!$omp error severity(- ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" }
+!$omp error severity(fatal ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" }
+!$omp error message ! { dg-error "Expected '\\(' after 'message'" }
+!$omp error message( ! { dg-error "Invalid expression after 'message\\('" }
+!$omp error message(0 ! { dg-error "Invalid expression after 'message\\('" }
+!$omp error message("foo" ! { dg-error "Invalid expression after 'message\\('" }
+
+!$omp error at(compilation) at(compilation) ! { dg-error "Duplicated 'at' clause at" }
+!$omp error severity(fatal) severity(warning) ! { dg-error "Duplicated 'severity' clause at" }
+!$omp error message("foo") message("foo") ! { dg-error "Duplicated 'message' clause at" }
+!$omp error message("foo"),at(compilation),severity(fatal),asdf ! { dg-error "Failed to match clause" }
+
+!$omp error at(execution) ! { dg-error "Unexpected !.OMP ERROR statement in MODULE" }
+
+end module
+
+module m2
+character(len=10) :: msg
+!$omp error message(1) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error message(1.2) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error message(4_"foo") ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error message(["bar","bar"]) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error message(msg) ! { dg-error "Constant character expression required in MESSAGE clause" }
+
+type S
+ !$omp error at(execution) message("foo")! { dg-error "Unexpected !.OMP ERROR statement at" }
+ integer s
+end type
+end module
+
+subroutine bar
+character(len=10) :: msg
+!$omp error at(execution) message(1) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error at(execution) message(1.2) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error at(execution) message(4_"foo") ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error at(execution) message(["bar","bar"]) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" }
+!$omp error at(execution) message(msg) ! OK
+
+end
+
+integer function foo (i, x, msg)
+ integer :: i
+ logical :: x
+ character(len=*) :: msg
+ !$omp error message(msg) ! { dg-error "Constant character expression required in MESSAGE clause" }
+ if (x) then
+ !$omp error at(execution) ! OK
+ end if
+ i = i + 1
+ if (x) then
+ ;
+ else
+ !$omp error at(execution) severity(warning) ! OK
+ end if
+ i = i + 1
+ select case (.false.)
+ !$omp error severity(fatal) at(execution) ! { dg-error "Expected a CASE or END SELECT statement following SELECT CASE" }
+ end select
+ do while (.false.)
+ !$omp error at(execution)message("42 - 1") ! OK
+ i = i + 1
+ end do
+99 continue
+ !$omp error severity(warning) message("bar") at(execution) ! OK
+ i = i + 1
+ foo = i
+end
+
+
+subroutine foobar
+ if (.true.) & ! { dg-error "Syntax error in IF-clause after" }
+ !$omp error at(execution)
+
+ continue
+
+ if (.true.) & ! { dg-error "Syntax error in IF-clause after" }
+ !$omp error ! { dg-error ".OMP ERROR encountered at" }
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/flush-1.f90 b/gcc/testsuite/gfortran.dg/gomp/flush-1.f90
index d0b7f9e..904bb1d 100644
--- a/gcc/testsuite/gfortran.dg/gomp/flush-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/flush-1.f90
@@ -1,4 +1,5 @@
! { dg-additional-options "-fdump-tree-gimple" }
+! { dg-final { scan-tree-dump "foo \\(6\\);\[\n\r]* __sync_synchronize \\(\\);\[\n\r]* foo \\(6\\);" "gimple" } }
! { dg-final { scan-tree-dump "foo \\(4\\);\[\n\r]* __atomic_thread_fence \\(4\\);\[\n\r]* foo \\(4\\);" "gimple" } }
! { dg-final { scan-tree-dump "foo \\(3\\);\[\n\r]* __atomic_thread_fence \\(3\\);\[\n\r]* foo \\(3\\);" "gimple" } }
! { dg-final { scan-tree-dump "foo \\(2\\);\[\n\r]* __atomic_thread_fence \\(2\\);\[\n\r]* foo \\(2\\);" "gimple" } }
@@ -39,3 +40,10 @@ subroutine f4
!$omp flush
call foo (5)
end
+
+subroutine f5
+ use m
+ call foo (6)
+ !$omp flush seq_cst
+ call foo (6)
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/flush-2.f90 b/gcc/testsuite/gfortran.dg/gomp/flush-2.f90
index 6857371..ba23444 100644
--- a/gcc/testsuite/gfortran.dg/gomp/flush-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/flush-2.f90
@@ -9,10 +9,11 @@ subroutine foo (void)
!$omp flush acquire
!$omp flush release
!$omp flush acq_rel
- !$omp flush relaxed ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
- !$omp flush seq_cst ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
- !$omp flush foobar ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
+ !$omp flush seq_cst
+ !$omp flush relaxed ! { dg-error "Expected SEQ_CST, AQC_REL, RELEASE, or ACQUIRE" }
+ !$omp flush foobar ! { dg-error "Expected SEQ_CST, AQC_REL, RELEASE, or ACQUIRE" }
!$omp flush acquire (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
!$omp flush release (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
!$omp flush acq_rel (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
-end
+ !$omp flush seq_cst (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
+ end
diff --git a/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90 b/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90
new file mode 100644
index 0000000..2af9647
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90
@@ -0,0 +1,11 @@
+subroutine foo
+ integer :: n = 5, m = 7
+ !$omp declare target to(n)
+ !$omp threadprivate (m)
+end
+
+program main
+ integer :: i, j
+ !$omp declare target to(i)
+ !$omp threadprivate (j)
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/loop-1.f90 b/gcc/testsuite/gfortran.dg/gomp/loop-1.f90
new file mode 100644
index 0000000..7308567
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/loop-1.f90
@@ -0,0 +1,55 @@
+! { dg-additional-options "-fdump-tree-original" }
+
+implicit none
+integer :: q, i, j
+integer :: r
+r = 0
+!$omp loop bind(thread) reduction(default,+: r) collapse(2) order(concurrent), private(q) lastprivate(i)
+do i = 1,4
+do j = 1,4
+ r = r + 1
+ q = 5
+end do
+end do
+
+!$omp teams loop bind(teams) collapse(2) order(concurrent), private(q) lastprivate(i) reduction(default,+: r)
+do i = 1,4
+do j = 1,4
+ r = r + 1
+ q = 5
+end do
+end do
+
+!$omp target teams loop bind(thread) reduction(+: r) collapse(2) order(concurrent), private(q) lastprivate(i)
+do i = 1,4
+do j = 1,4
+ r = r + 1
+ q = 5
+end do
+end do
+
+!$omp parallel loop bind(thread) collapse(2) order(concurrent), private(q) lastprivate(i) reduction(default,+: r)
+do i = 1,4
+do j = 1,4
+ r = r + 1
+ q = 5
+end do
+end do
+
+!$omp target parallel loop bind(parallel) collapse(2) order(concurrent), private(q) lastprivate(i) reduction(default,+: r)
+do i = 1,4
+do j = 1,4
+ r = r + 1
+ q = 5
+end do
+end do
+
+end
+
+! { dg-final { scan-tree-dump-times "#pragma omp target map\\(tofrom:i\\) map\\(tofrom:r\\)\[\r\n\]" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp parallel shared\\(i\\) shared\\(r\\)\[\r\n\]" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp teams shared\\(i\\) shared\\(r\\)\[\r\n\]" 2 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp loop private\\(q\\) lastprivate\\(i\\) reduction\\(\\+:r\\) order\\(concurrent\\) collapse\\(2\\) bind\\(parallel\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp loop private\\(q\\) lastprivate\\(i\\) reduction\\(\\+:r\\) order\\(concurrent\\) collapse\\(2\\) bind\\(teams\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp loop private\\(q\\) lastprivate\\(i\\) reduction\\(\\+:r\\) order\\(concurrent\\) collapse\\(2\\) bind\\(thread\\)" 3 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/loop-2.f90 b/gcc/testsuite/gfortran.dg/gomp/loop-2.f90
new file mode 100644
index 0000000..4962683
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/loop-2.f90
@@ -0,0 +1,44 @@
+subroutine foo()
+implicit none
+integer :: i, r
+!$omp loop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp teams loop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp parallel loop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp target teams loop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp target parallel loop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+
+!$omp loop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64
+end do
+!$omp teams loop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64
+end do
+!$omp parallel loop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64
+end do
+!$omp target teams loop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64
+end do
+!$omp target parallel loop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64
+end do
+
+!$omp loop bind(target) ! { dg-error "17: Expected TEAMS, PARALLEL or THREAD as binding in BIND" }
+do i = 1, 64
+end do
+
+!$omp loop bind(teams) bind(teams) ! { dg-error "Duplicated 'bind' clause" }
+do i = 1, 64
+end do
+
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/loop-3.f90 b/gcc/testsuite/gfortran.dg/gomp/loop-3.f90
new file mode 100644
index 0000000..6d25b19
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/loop-3.f90
@@ -0,0 +1,55 @@
+! PR middle-end/100905
+!
+PROGRAM test_loop_order_concurrent
+ implicit none
+ integer :: a, cc(64), dd(64)
+
+ dd = 54
+ cc = 99
+
+ call test_loop()
+ call test_affinity(a)
+ if (a /= 5) stop 3
+ call test_scan(cc, dd)
+ if (any (cc /= 99)) stop 4
+ if (dd(1) /= 5 .or. dd(2) /= 104) stop 5
+
+CONTAINS
+
+ SUBROUTINE test_loop()
+ INTEGER,DIMENSION(1024):: a, b, c
+ INTEGER:: i
+
+ DO i = 1, 1024
+ a(i) = 1
+ b(i) = i + 1
+ c(i) = 2*(i + 1)
+ END DO
+
+ !$omp loop order(concurrent) bind(thread)
+ DO i = 1, 1024
+ a(i) = a(i) + b(i)*c(i)
+ END DO
+
+ DO i = 1, 1024
+ if (a(i) /= 1 + (b(i)*c(i))) stop 1
+ END DO
+ END SUBROUTINE test_loop
+
+ SUBROUTINE test_affinity(aa)
+ integer :: aa
+ !$omp task affinity(aa)
+ a = 5
+ !$omp end task
+ end
+
+ subroutine test_scan(c, d)
+ integer i, c(*), d(*)
+ !$omp simd reduction (inscan, +: a)
+ do i = 1, 64
+ d(i) = a
+ !$omp scan exclusive (a)
+ a = a + c(i)
+ end do
+ end
+END PROGRAM test_loop_order_concurrent
diff --git a/gcc/testsuite/gfortran.dg/gomp/loop-4.f90 b/gcc/testsuite/gfortran.dg/gomp/loop-4.f90
new file mode 100644
index 0000000..7374589
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/loop-4.f90
@@ -0,0 +1,279 @@
+module m
+ use iso_c_binding, only: c_loc
+ implicit none (type, external)
+ integer :: v
+ interface
+ subroutine foo (); end
+ integer function omp_get_thread_num (); end
+ integer function omp_get_num_threads (); end
+ integer function omp_get_cancellation (); end
+ integer(c_int) function omp_target_is_present(ptr, device_num) bind(c)
+ use, intrinsic :: iso_c_binding, only : c_ptr, c_int
+ type(c_ptr), value :: ptr
+ integer(c_int), value :: device_num
+ end
+ end interface
+
+contains
+subroutine f1(a)
+ integer :: a(0:)
+ integer :: i, j
+ !$omp simd order(concurrent)
+ do i = 0, 63
+ !$omp loop
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+end
+
+subroutine f2 (a)
+ integer :: a(0:)
+ integer :: i, j
+ !$omp do simd order(concurrent)
+ do i = 0, 63
+ !$omp loop
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+end
+
+subroutine f3 (a)
+ integer :: a(0:)
+ integer :: i, j
+ !$omp do order(concurrent)
+ do i = 0, 63
+ !$omp loop
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+end
+
+subroutine f4 (a)
+ integer, target :: a(0:)
+ integer :: i, j
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp parallel
+ call foo ()
+ !$omp end parallel
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp simd
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp loop
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp critical ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end critical
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp ordered simd ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end ordered
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp atomic ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ v = v + 1
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp atomic read ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ a(i) = v
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ !$omp atomic write ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ v = a(i)
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ a(i) = a(i) + omp_get_thread_num () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ a(i) = a(i) + omp_get_num_threads () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ a(i) = a(i) + omp_target_is_present (c_loc (a(i)), 0) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop order(concurrent) bind(parallel)
+ do i = 0, 63
+ a(i) = a(i) + omp_get_cancellation () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+end
+
+subroutine f5 (a)
+ integer, target :: a(0:)
+ integer :: i, j
+ !$omp parallel
+ !$omp loop
+ do i = 0, 63
+ !$omp parallel
+ call foo ()
+ !$omp end parallel
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp simd
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp loop
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp critical ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end critical
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp ordered simd ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end ordered
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp atomic ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ v = v + 1
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp atomic read ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ a(i) = v
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp atomic write ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ v = a(i)
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp master ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end master
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp masked ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end masked
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp scope ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end scope
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_get_thread_num () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_get_num_threads () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_target_is_present (c_loc(a(i)), 0) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_get_cancellation () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp end parallel
+end
+
+subroutine f6 (a)
+ integer, target :: a(0:)
+ integer :: i, j
+ !$omp master
+ !$omp loop
+ do i = 0, 63
+ !$omp parallel
+ call foo ()
+ !$omp end parallel
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp simd
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp loop
+ do j = 0, 63
+ a(64 * i + j) = i + j
+ end do
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp critical ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end critical
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp ordered simd ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ call foo ()
+ !$omp end ordered
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp atomic ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ v = v + 1
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp atomic read ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ a(i) = v
+ end do
+ !$omp loop
+ do i = 0, 63
+ !$omp atomic write ! { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a 'loop' region" }
+ v = a(i)
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_get_thread_num () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_get_num_threads () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_target_is_present (c_loc(a(i)), 0) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp loop
+ do i = 0, 63
+ a(i) = a(i) + omp_get_cancellation () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" }
+ end do
+ !$omp end master
+end
+end module
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-5.f90 b/gcc/testsuite/gfortran.dg/gomp/map-5.f90
new file mode 100644
index 0000000..2b4b341
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/map-5.f90
@@ -0,0 +1,13 @@
+implicit none
+type t
+ integer :: b(5)
+end type t
+integer :: a(5), x, y(5)
+type(t) :: b
+!$omp target enter data map( to: a (:) )
+!$omp target enter data map( to: b % b )
+!$omp target enter data map( to: a(:) )
+!$omp target depend(out: y (2)) nowait
+!$omp end target
+
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-6.f90 b/gcc/testsuite/gfortran.dg/gomp/map-6.f90
new file mode 100644
index 0000000..309f845
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/map-6.f90
@@ -0,0 +1,50 @@
+! { dg-additional-options "-fdump-tree-original" }
+
+implicit none
+
+integer :: a, b, b1, b2, b3, b4, b5, b6
+
+!$omp target map(a)
+!$omp end target
+
+!$omp target map(to : a)
+!$omp end target
+
+!$omp target map(always to: a)
+!$omp end target
+!$omp target map(always, to: a)
+!$omp end target
+!$omp target map(close to: a)
+!$omp end target
+!$omp target map(close, to: a)
+!$omp end target
+
+!$omp target map(close always to:b1)
+!$omp end target
+!$omp target map(close, always to:b2)
+!$omp end target
+!$omp target map(close, always, to:b3)
+!$omp end target
+!$omp target map(always close to:b4)
+!$omp end target
+!$omp target map(always, close to:b5)
+!$omp end target
+!$omp target map(always, close, to:b6)
+!$omp end target
+
+
+!$omp target map (always to : a) map (close to : b)
+!$omp end target
+
+end
+
+! { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp target map\\(always,to:" 9 "original" } }
+
+! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b1\\)" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b2\\)" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b3\\)" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b4\\)" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b5\\)" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b6\\)" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-7.f90 b/gcc/testsuite/gfortran.dg/gomp/map-7.f90
new file mode 100644
index 0000000..009c6d4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/map-7.f90
@@ -0,0 +1,26 @@
+! { dg-additional-options "-fdump-tree-original" }
+
+implicit none
+
+integer :: a, b, close, always, to
+
+!$omp target map(close)
+!$omp end target
+
+!$omp target map(always)
+!$omp end target
+
+!$omp target map(always, close)
+!$omp end target
+
+!$omp target map(always, close, to : always, close, a)
+!$omp end target
+
+!$omp target map(to, always, close)
+!$omp end target
+
+end
+
+! { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:always\\) map\\(always,to:close\\) map\\(always,to:a\\)" "original" } }
+! { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-8.f90 b/gcc/testsuite/gfortran.dg/gomp/map-8.f90
new file mode 100644
index 0000000..92b802c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/map-8.f90
@@ -0,0 +1,34 @@
+implicit none
+
+integer :: a
+
+!$omp target map(close, delete: a) ! { dg-error "TARGET with map-type other than TO, FROM, TOFROM, or ALLOC on MAP clause at \\(1\\)" }
+!$omp end target
+
+!$omp target map(close) ! { dg-error "Symbol 'close' at \\(1\\) has no IMPLICIT type" }
+!$omp end target
+
+!$omp target map(always) ! { dg-error "Symbol 'always' at \\(1\\) has no IMPLICIT type" }
+!$omp end target
+
+!$omp target map(always, always, to : a) ! { dg-error "too many 'always' modifiers" }
+! !$omp end target
+!$omp target map(always always, to : a) ! { dg-error "too many 'always' modifiers" }
+! !$omp end target
+!$omp target map(always, always to : a) ! { dg-error "too many 'always' modifiers" }
+! !$omp end target
+!$omp target map(always always to : a) ! { dg-error "too many 'always' modifiers" }
+! !$omp end target
+!$omp target map(close, close, to : a) ! { dg-error "too many 'close' modifiers" }
+! !$omp end target
+!$omp target map(close close, to : a) ! { dg-error "too many 'close' modifiers" }
+! !$omp end target
+!$omp target map(close, close to : a) ! { dg-error "too many 'close' modifiers" }
+! !$omp end target
+!$omp target map(close close to : a) ! { dg-error "too many 'close' modifiers" }
+! !$omp end target
+
+!$omp target map(close close always always to : a) ! { dg-error "too many 'always' modifiers" }
+! !$omp end target
+
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/masked-1.f90 b/gcc/testsuite/gfortran.dg/gomp/masked-1.f90
new file mode 100644
index 0000000..1bd6176
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/masked-1.f90
@@ -0,0 +1,94 @@
+! { dg-additional-options "-ffree-line-length-none" }
+subroutine foo (x, a)
+ implicit none
+ integer, value :: x
+ integer, contiguous :: a(0:)
+ external :: bar
+ integer :: i
+
+ !$omp masked
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (0)
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (7)
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (x)
+ call bar ()
+ !$omp end masked
+
+ !$omp masked taskloop simd filter (x) grainsize (12) simdlen (4)
+ do i = 0, 127
+ a(i) = i
+ end do
+ !$omp end masked taskloop simd
+
+ !$omp parallel masked filter (x) firstprivate (x)
+ call bar ()
+ !$omp end parallel masked
+
+ !$omp masked
+ !$omp masked filter (0)
+ !$omp masked filter (x)
+ !$omp end masked
+ !$omp end masked
+ !$omp end masked
+end
+
+subroutine foobar (d, f, fi, p, s, g, i1, i2, l, ll, nth, ntm, pp, q, r, r2)
+ implicit none (type, external)
+ logical :: i1, i2, fi
+ integer :: i, d, f, p, s, g, l, ll, nth, ntm, pp, q, r, r2
+ allocatable :: q
+ integer, save :: t
+ !$omp threadprivate (t)
+
+ !$omp parallel masked &
+ !$omp& private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) reduction(+:r) &
+ !$omp& num_threads (nth) proc_bind(spread) copyin(t) filter (d) ! allocate (f)
+ !
+ !$omp end parallel masked
+
+ !$omp taskgroup task_reduction (+:r2) ! allocate (r2)
+ !$omp masked taskloop &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) &
+ !$omp& reduction(default, +:r) in_reduction(+:r2) filter (d) ! allocate (f)
+ do i = 0, 63
+ ll = ll + 1
+ end do
+ !$omp end masked taskloop
+ !$omp end taskgroup
+
+ !$omp taskgroup task_reduction (+:r2) ! allocate (r2)
+ !$omp masked taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) &
+ !$omp& order(concurrent) filter (d) ! allocate (f)
+ do i = 0, 63
+ ll = ll + 1
+ end do
+ !$omp end masked taskloop simd
+ !$omp end taskgroup
+
+ !$omp parallel masked taskloop &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) &
+ !$omp& reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) filter (d) ! allocate (f)
+ do i = 0, 63
+ ll = ll + 1
+ end do
+ !$omp end parallel masked taskloop
+
+ !$omp parallel masked taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) &
+ !$omp& order(concurrent) filter (d) ! allocate (f)
+ do i = 0, 63
+ ll = ll + 1
+ end do
+ !$omp end parallel masked taskloop simd
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/gomp/masked-2.f90 b/gcc/testsuite/gfortran.dg/gomp/masked-2.f90
new file mode 100644
index 0000000..b6eb861
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/masked-2.f90
@@ -0,0 +1,46 @@
+module m
+ implicit none (external, type)
+ type t
+ end type t
+contains
+subroutine foo (x, y, z, a)
+ external :: bar
+ type(t) :: x
+ integer :: y
+ real :: z
+ integer :: a(4)
+
+ !$omp masked filter (x) ! { dg-error "FILTER clause at .1. requires a scalar INTEGER expression" }
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (y) ! OK
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (z) ! { dg-error "FILTER clause at .1. requires a scalar INTEGER expression" }
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (a) ! { dg-error "FILTER clause at .1. requires a scalar INTEGER expression" }
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (0.0) ! { dg-error "FILTER clause at .1. requires a scalar INTEGER expression" }
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter ([1]) ! { dg-error "FILTER clause at .1. requires a scalar INTEGER expression" }
+ call bar ()
+ !$omp end masked
+
+ !$omp masked filter (-1) ! { dg-warning "INTEGER expression of FILTER clause at .1. must be non-negative" }
+ call bar ()
+ !$omp end masked
+end
+end module
+
+subroutine bar
+ !$omp masked filter (0) filter (0) ! { dg-error "Duplicated 'filter' clause" }
+ call foobar
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/masked-3.f90 b/gcc/testsuite/gfortran.dg/gomp/masked-3.f90
new file mode 100644
index 0000000..49c633d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/masked-3.f90
@@ -0,0 +1,12 @@
+subroutine foo
+
+ !$omp masked
+ goto 55 ! { dg-error "invalid branch to/from OpenMP structured block" }
+ ! { dg-warning "Legacy Extension: Label at .1. is not in the same block as the GOTO statement" "" { target *-*-* } .-1 }
+ !$omp end masked
+
+ !$omp masked
+55 continue ! { dg-warning "Legacy Extension: Label at .1. is not in the same block as the GOTO statement" }
+ return ! { dg-error "invalid branch to/from OpenMP structured block" }
+ !$omp end masked
+end subroutine foo
diff --git a/gcc/testsuite/gfortran.dg/gomp/masked-combined-1.f90 b/gcc/testsuite/gfortran.dg/gomp/masked-combined-1.f90
new file mode 100644
index 0000000..23ffb08
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/masked-combined-1.f90
@@ -0,0 +1,65 @@
+subroutine foo (a, f)
+ implicit none (type, external)
+ interface
+ subroutine bar (x)
+ integer :: x
+ end subroutine
+ end interface
+
+ integer, value :: f
+ integer, contiguous :: a(0:)
+ integer :: i, j, k, u, v, w, x, y, z
+
+ !$omp parallel masked default(none) private (k) filter (f) firstprivate (f)
+ call bar (k)
+ !$omp end parallel masked
+
+ !$omp parallel masked default(none) private (k)
+ call bar (k)
+ !$omp end parallel masked
+
+ !$omp parallel default(none) firstprivate(a, f) shared(x, y, z)
+ !$omp masked taskloop reduction (+:x) default(none) firstprivate(a) filter (f)
+ do i = 0, 63
+ x = x + a(i)
+ end do
+ !$omp end masked taskloop
+ !$omp masked taskloop simd reduction (+:y) default(none) firstprivate(a) private (i) filter (f)
+ do i = 0, 63
+ y = y + a(i)
+ end do
+ !$omp end masked taskloop simd
+ !$omp masked taskloop simd reduction (+:y) default(none) firstprivate(a) private (i)
+ do i = 0, 63
+ y = y + a(i)
+ end do
+ !$omp end masked taskloop simd
+ !$omp masked taskloop simd collapse(2) reduction (+:z) default(none) firstprivate(a) private (i, j) filter (f)
+ do j = 0, 0
+ do i = 0, 63
+ z = z + a(i)
+ end do
+ end do
+ !$omp end masked taskloop simd
+ !$omp end parallel
+
+ !$omp parallel masked taskloop reduction (+:u) default(none) firstprivate(a, f) filter (f)
+ do i = 0, 63
+ u = u + a(i)
+ end do
+ !$omp end parallel masked taskloop
+
+ !$omp parallel masked taskloop simd reduction (+:v) default(none) firstprivate(a, f) filter (f)
+ do i = 0, 63
+ v = v + a(i)
+ end do
+ !$omp end parallel masked taskloop simd
+
+ !$omp parallel masked taskloop simd collapse(2) reduction (+:w) default(none) firstprivate(a, f) filter (f)
+ do j = 0, 0
+ do i = 0, 63
+ w = w + a(i)
+ end do
+ end do
+ !$omp end parallel masked taskloop simd
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/masked-combined-2.f90 b/gcc/testsuite/gfortran.dg/gomp/masked-combined-2.f90
new file mode 100644
index 0000000..c94425f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/masked-combined-2.f90
@@ -0,0 +1,24 @@
+subroutine foo (a)
+ implicit none (external, type)
+ integer, contiguous :: a(0:)
+ integer :: i, r, s
+ r = 0; s = 0
+
+ ! In 'parallel masked taskloop', in_reduction is not permitted.
+
+ !$omp taskgroup task_reduction(+:r)
+ !$omp parallel masked taskloop in_reduction(+:r) ! { dg-error "36: Failed to match clause" }
+ do i = 0, 63
+ r = r + a(i)
+ end do
+ !!$omp end parallel masked taskloop
+ !$omp end taskgroup
+
+ !$omp taskgroup task_reduction(+:s)
+ !$omp parallel masked taskloop simd in_reduction(+:s) ! { dg-error "41: Failed to match clause" }
+ do i = 0, 63
+ s = s + a(i)
+ end do
+ !!$omp end parallel masked taskloop simd
+ !$omp end taskgroup
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/nesting-1.f90 b/gcc/testsuite/gfortran.dg/gomp/nesting-1.f90
new file mode 100644
index 0000000..af4c2fbf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nesting-1.f90
@@ -0,0 +1,68 @@
+module m
+ implicit none
+ integer i
+contains
+
+subroutine f_omp_parallel
+ !$omp parallel
+ !$omp parallel
+ !$omp end parallel
+
+ !$omp target
+ !$omp end target
+
+ !$omp target data map(i)
+ !$omp end target data
+
+ !$omp target update to(i)
+
+ !$omp target data map(i)
+ !$omp parallel
+ !$omp end parallel
+
+ !$omp target
+ !$omp end target
+
+ !$omp target data map(i)
+ !$omp end target data
+
+ !$omp target update to(i)
+ !$omp end target data
+ !$omp end parallel
+end
+
+subroutine f_omp_target
+ !$omp target
+ !$omp parallel
+ !$omp end parallel
+ !$omp end target
+end
+
+subroutine f_omp_target_data
+ !$omp target data map(i)
+ !$omp parallel
+ !$omp end parallel
+
+ !$omp target
+ !$omp end target
+
+ !$omp target data map(i)
+ !$omp end target data
+
+ !$omp target update to(i)
+
+ !$omp target data map(i)
+ !$omp parallel
+ !$omp end parallel
+
+ !$omp target
+ !$omp end target
+
+ !$omp target data map(i)
+ !$omp end target data
+
+ !$omp target update to(i)
+ !$omp end target data
+ !$omp end target data
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/nesting-2.f90 b/gcc/testsuite/gfortran.dg/gomp/nesting-2.f90
new file mode 100644
index 0000000..2eccdf9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nesting-2.f90
@@ -0,0 +1,165 @@
+subroutine foo
+ integer :: i, j
+ !$omp taskloop
+ do i = 0, 63
+ !$omp do ! { dg-error "region may not be closely nested inside of" }
+ do j = 0, 9
+ end do
+ !$omp single ! { dg-error "region may not be closely nested inside of" }
+ !$omp end single
+ !$omp sections ! { dg-error "region may not be closely nested inside of" }
+ !$omp section
+ block
+ end block
+ !$omp end sections
+ !$omp barrier ! { dg-error "region may not be closely nested inside of" }
+ !$omp master ! { dg-error "region may not be closely nested inside of" } -- ?
+ block; end block ! otherwise not generated
+ !$omp end master
+ !$omp masked ! { dg-error "region may not be closely nested inside of" } -- ?
+ block; end block ! otherwise not generated
+ !$omp end masked
+ !$omp scope ! { dg-error "region may not be closely nested inside of" } -- ?
+ block; end block ! otherwise not generated
+ !$omp end scope
+ !$omp ordered ! { dg-error "region may not be closely nested inside of" }
+ !$omp end ordered
+ !$omp ordered threads ! { dg-error "region may not be closely nested inside of" }
+ !$omp end ordered
+ !$omp ordered simd threads ! { dg-error ".ordered. .simd. must be closely nested inside .simd. region" }
+ !$omp end ordered
+ !$omp simd
+ do j = 0, 9
+ !$omp ordered simd
+ !$omp end ordered
+ end do
+ !$omp critical
+ !$omp simd
+ do j = 0, 9
+ !$omp ordered simd
+ !$omp end ordered
+ end do
+ !$omp end critical
+ end do
+ !$omp taskloop
+ do i = 0, 63
+ !$omp parallel
+ !$omp do
+ do j = 0, 9
+ end do
+ !$omp single
+ !$omp end single
+ !$omp sections
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp barrier
+ !$omp master
+ block; end block ! otherwise not generated
+ !$omp end master
+ !$omp masked
+ block; end block ! otherwise not generated
+ !$omp end masked
+ !$omp scope
+ block; end block ! otherwise not generated
+ !$omp end scope
+ !$omp ordered ! { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" }
+ !$omp end ordered
+ !$omp ordered threads ! { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" }
+ !$omp end ordered
+ !$omp simd
+ do j = 0, 9
+ !$omp ordered simd
+ !$omp end ordered
+ end do
+ !$omp critical
+ !$omp simd
+ do j = 0, 9
+ !$omp ordered simd
+ !$omp end ordered
+ end do
+ !$omp end critical
+ !$omp end parallel
+ end do
+ !$omp taskloop
+ do i = 0, 63
+ !$omp target
+ !$omp do
+ do j = 0, 9
+ end do
+ !$omp single
+ !$omp end single
+ !$omp sections
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp barrier
+ !$omp master
+ block; end block ! otherwise not generated
+ !$omp end master
+ !$omp masked
+ block; end block ! otherwise not generated
+ !$omp end masked
+ !$omp scope
+ block; end block ! otherwise not generated
+ !$omp end scope
+ !$omp ordered ! { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" }
+ !$omp end ordered
+ !$omp ordered threads ! { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" }
+ !$omp end ordered
+ !$omp simd
+ do j = 0, 9
+ !$omp ordered simd
+ !$omp end ordered
+ end do
+ !$omp critical
+ !$omp simd
+ do j = 0, 9
+ !$omp ordered simd
+ !$omp end ordered
+ end do
+ !$omp end critical
+ !$omp end target
+ end do
+ !$omp ordered
+ !$omp ordered ! { dg-error "region may not be closely nested inside of" }
+ !$omp end ordered
+ !$omp end ordered
+ !$omp ordered threads
+ !$omp ordered ! { dg-error "region may not be closely nested inside of" }
+ !$omp end ordered
+ !$omp end ordered
+ !$omp ordered
+ !$omp ordered threads ! { dg-error "region may not be closely nested inside of" }
+ !$omp end ordered
+ !$omp end ordered
+ !$omp ordered threads
+ !$omp ordered threads ! { dg-error "region may not be closely nested inside of" }
+ !$omp end ordered
+ !$omp end ordered
+ !$omp critical
+ !$omp ordered simd ! { dg-error ".ordered. .simd. must be closely nested inside .simd. region" }
+ !$omp end ordered
+ !$omp end critical
+ !$omp do ordered
+ do i = 0, 63
+ !$omp parallel
+ !$omp ordered threads ! { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" }
+ !$omp end ordered
+ !$omp end parallel
+ end do
+ !$omp do ordered
+ do i = 0, 63
+ !$omp parallel
+ !$omp ordered ! { dg-error ".ordered. region must be closely nested inside a loop region with an .ordered. clause" }
+ !$omp end ordered
+ !$omp end parallel
+ end do
+ !$omp do ordered(1)
+ do i = 0, 63
+ !$omp parallel
+ !$omp ordered depend(source) ! { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause with a parameter" }
+ !$omp ordered depend(sink: i - 1) ! { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause with a parameter" }
+ !$omp end parallel
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/nesting-3.f90 b/gcc/testsuite/gfortran.dg/gomp/nesting-3.f90
new file mode 100644
index 0000000..cd2e39a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nesting-3.f90
@@ -0,0 +1,347 @@
+subroutine f1
+ integer i, j
+ !$omp do
+ do i = 0, 2
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp master ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end master
+ !$omp masked ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end masked
+ !$omp barrier ! { dg-error "may not be closely nested" }
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ end do
+ !$omp sections
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp end sections
+ !$omp sections
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp end sections
+ !$omp sections
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp end sections
+ !$omp sections
+ !$omp master ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end master
+ !$omp end sections
+ !$omp sections
+ !$omp masked ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end masked
+ !$omp end sections
+ !$omp sections
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end sections
+ !$omp sections
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp sections
+ !$omp section
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp end sections
+ !$omp sections
+ !$omp section
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp end sections
+ !$omp sections
+ !$omp section
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp end sections
+ !$omp sections
+ !$omp section
+ !$omp master ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end master
+ !$omp section
+ !$omp masked ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end masked
+ !$omp end sections
+ !$omp sections
+ !$omp section
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end sections
+ !$omp single
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp master ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end master
+ !$omp masked ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end masked
+ !$omp barrier ! { dg-error "may not be closely nested" }
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end single
+ !$omp master
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp master
+ block; end block
+ !$omp end master
+ !$omp barrier ! { dg-error "may not be closely nested" }
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end master
+ !$omp masked filter (1)
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp master
+ block; end block
+ !$omp end master
+ !$omp barrier ! { dg-error "may not be closely nested" }
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end masked
+ !$omp task
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp master ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end master
+ !$omp masked ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end masked
+ !$omp barrier ! { dg-error "may not be closely nested" }
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end task
+ !$omp parallel
+ !$omp do
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single
+ block; end block
+ !$omp end single
+ !$omp master
+ block; end block
+ !$omp end master
+ !$omp masked
+ block; end block
+ !$omp end masked
+ !$omp barrier
+ !$omp scope
+ block; end block
+ !$omp end scope
+ !$omp scope
+ !$omp scope
+ block; end block
+ !$omp end scope
+ !$omp end scope
+ !$omp end parallel
+ !$omp scope
+ !$omp do
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single
+ block; end block
+ !$omp end single
+ !$omp master
+ block; end block
+ !$omp end master
+ !$omp masked
+ block; end block
+ !$omp end masked
+ !$omp barrier
+ !$omp scope
+ block; end block
+ !$omp end scope
+ !$omp scope
+ !$omp scope
+ block; end block
+ !$omp end scope
+ !$omp end scope
+ !$omp end scope
+end
+
+subroutine f2
+ integer i, j
+ !$omp ordered
+ !$omp do ! { dg-error "may not be closely nested" }
+ do j = 0, 2
+ block; end block
+ end do
+ !$omp sections ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp section
+ block; end block
+ !$omp end sections
+ !$omp single ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end single
+ !$omp master
+ block; end block
+ !$omp end master
+ !$omp masked
+ block; end block
+ !$omp end masked
+ !$omp barrier ! { dg-error "may not be closely nested" }
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end ordered
+end
+
+subroutine f3 (void)
+ !$omp critical
+ !$omp ordered ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end ordered
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end critical
+end
+
+subroutine f4 (void)
+ !$omp task
+ !$omp ordered ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end ordered
+ !$omp scope ! { dg-error "may not be closely nested" }
+ block; end block
+ !$omp end scope
+ !$omp end task
+end
+
+subroutine f5 (void)
+ integer i
+ !$omp do
+ do i = 0, 9
+ !$omp ordered ! { dg-error "must be closely nested" }
+ block; end block
+ !$omp end ordered
+ end do
+ !$omp do ordered
+ do i = 0, 9
+ !$omp ordered
+ block; end block
+ !$omp end ordered
+ end do
+end
+
+subroutine f6 (void)
+ !$omp critical (foo)
+ !$omp critical (bar)
+ block; end block
+ !$omp end critical (bar)
+ !$omp end critical (foo)
+ !$omp critical
+ !$omp critical (baz)
+ block; end block
+ !$omp end critical (baz)
+ !$omp end critical
+end
+
+subroutine f7 (void)
+ !$omp critical (foo2)
+ !$omp critical
+ block; end block
+ !$omp end critical
+ !$omp end critical (foo2)
+ !$omp critical (bar)
+ !$omp critical (bar) ! { dg-error "may not be nested" }
+ block; end block
+ !$omp end critical (bar)
+ !$omp end critical (bar)
+ !$omp critical
+ !$omp critical ! { dg-error "may not be nested" }
+ block; end block
+ !$omp end critical
+ !$omp end critical
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/nothing-1.f90 b/gcc/testsuite/gfortran.dg/gomp/nothing-1.f90
new file mode 100644
index 0000000..9fc24d4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nothing-1.f90
@@ -0,0 +1,28 @@
+module m
+ implicit none (type, external)
+ !$omp nothing
+
+ type t
+ !$omp nothing
+ integer s
+ end type
+
+contains
+
+integer function foo (i)
+ integer :: i
+
+ !$omp nothing
+ if (.false.) &
+& & !$omp nothing
+ i = i + 1
+
+! In the following, '& & !$' is not a valid OpenMP sentinel and,
+! hence, the line is regarded as comment
+ if (.false.) &
+& & !$omp nothing
+ then
+ end if
+ foo = i
+end
+end module
diff --git a/gcc/testsuite/gfortran.dg/gomp/nothing-2.f90 b/gcc/testsuite/gfortran.dg/gomp/nothing-2.f90
new file mode 100644
index 0000000..554d4ef
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nothing-2.f90
@@ -0,0 +1,7 @@
+pure subroutine foo
+ !$omp nothing ! { dg-error "OpenMP directives other than SIMD or DECLARE TARGET at .1. may not appear in PURE procedures" }
+end subroutine
+
+subroutine bar
+ !$omp nothing foo ! { dg-error "Unexpected junk after .OMP NOTHING statement" }
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/nowait-1.f90 b/gcc/testsuite/gfortran.dg/gomp/nowait-1.f90
new file mode 100644
index 0000000..b47b4a1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nowait-1.f90
@@ -0,0 +1,19 @@
+subroutine foo
+
+!$omp do
+do i = 1, 2
+end do
+!$omp end do nowait foo ! { dg-error "Unexpected junk after NOWAIT clause" }
+!$omp end do ! as previous line is ignored
+
+!$omp scope
+ block; end block
+!$omp end scope bar ! { dg-error "Unexpected junk at" }
+!$omp end scope
+
+!$omp scope
+ block; end block
+!$omp end scope nowait nowait ! { dg-error "Unexpected junk after NOWAIT clause" }
+!$omp end scope
+
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/openmp-simd-6.f90 b/gcc/testsuite/gfortran.dg/gomp/openmp-simd-6.f90
index 361e0da..14164b9 100644
--- a/gcc/testsuite/gfortran.dg/gomp/openmp-simd-6.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/openmp-simd-6.f90
@@ -49,7 +49,7 @@ subroutine bar(n, m, u)
end
-! { dg-final { scan-tree-dump-times "#pragma omp teams firstprivate\\(a1\\) firstprivate\\(b1\\) shared\\(u\\) default\\(none\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp teams firstprivate\\(a1\\) firstprivate\\(b1\\) shared\\(u\\) shared\\(d1\\) default\\(none\\)" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp distribute lastprivate\\(d1\\)" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp parallel firstprivate\\(a1\\) firstprivate\\(b1\\) lastprivate\\(d1\\) shared\\(u\\) default\\(none\\)" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp for nowait" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f90 b/gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f90
new file mode 100644
index 0000000..2ccc18f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f90
@@ -0,0 +1,23 @@
+! { dg-additional-options "-fdump-tree-original" }
+ implicit none
+ integer :: k, p, s, r, nth, t, f
+ logical(kind=2) l2
+ !$omp threadprivate (t)
+
+ external bar
+ !$omp parallel master default(none) private (k)
+ call bar (k)
+ !$omp end parallel master
+
+ !$omp parallel master private (p) firstprivate (f) if (parallel: l2) default(shared) &
+ !$omp& shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) copyin(t)
+ !
+ !$omp end parallel master
+end
+
+! { dg-final { scan-tree-dump "omp parallel private\\(k\\) default\\(none\\)" "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp master" 1 "original" } }
+! { dg-final { scan-tree-dump "D.\[0-9\]+ = l2;" "original" } }
+! { dg-final { scan-tree-dump "D.\[0-9\]+ = nth;" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp parallel private\\(p\\) firstprivate\\(f\\) shared\\(s\\) copyin\\(t\\) reduction\\(\\+:r\\) if\\(parallel:D.\[0-9\]+\\) num_threads\\(D.\[0-9\]+\\) default\\(shared\\) proc_bind\\(spread\\)" "original" } }
+
diff --git a/gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f90 b/gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f90
new file mode 100644
index 0000000..2e12de6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f90
@@ -0,0 +1,9 @@
+ use iso_c_binding, only: c_intptr_t
+ implicit none (external, type)
+ integer, parameter :: omp_event_handle_kind = c_intptr_t
+ integer (kind=omp_event_handle_kind) :: x
+ !$omp parallel master default (none) ! { dg-message "enclosing 'parallel'" }
+ !$omp task detach (x) ! { dg-error "'x' not specified in enclosing 'parallel'" }
+ !$omp end task
+ !$omp end parallel master
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr100965.f90 b/gcc/testsuite/gfortran.dg/gomp/pr100965.f90
new file mode 100644
index 0000000..9044547
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr100965.f90
@@ -0,0 +1,16 @@
+! PR fortran/100965
+! { dg-do compile }
+
+implicit none
+ character(len=:), allocatable :: s
+ logical :: l
+ !$omp target map(from: l)
+ l = allocated (s)
+ !$omp end target
+ if (l) stop 1
+
+ !$omp target map(from: l)
+ l = allocated (s)
+ !$omp end target
+ if (l) stop 2
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-1.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-1.f90
new file mode 100644
index 0000000..b61b2fc3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-1.f90
@@ -0,0 +1,239 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: f00, f01, f02, f03, f04, f05, f06, f07, f08, f09
+ integer :: f12, f13, f14, f15, f16, f17, f18, f19
+ integer :: f20, f21, f22, f23, f24, f25, f26, f27, f28, f29
+
+contains
+
+subroutine foo ()
+ integer :: i
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } ! FIXME.
+ !$omp distribute parallel do firstprivate (f00) default(none)
+ do i = 1, 64
+ f00 = f00 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f01\\)" "gimple" } }
+ !$omp distribute parallel do simd firstprivate (f01) default(none)
+ do i = 1, 64
+ f01 = f01 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f02\\)" "gimple" } }
+ !$omp distribute simd firstprivate (f02)
+ do i = 1, 64
+ f02 = f02 + 1
+ end do
+end
+
+subroutine bar ()
+ integer :: f10, f11
+ integer :: i
+ f10 = 0; f11 = 0
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(f03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f03\\)" "gimple" } }
+ !$omp do simd firstprivate (f03)
+ do i = 1, 64
+ f03 = f03 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f04\\)" "gimple" } }
+ !$omp master taskloop firstprivate (f04) default(none)
+ do i = 1, 64
+ f04 = f04 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f05\\)" "gimple" } }
+ !$omp master taskloop simd firstprivate (f05) default(none)
+ do i = 1, 64
+ f05 = f05 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f06\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f06\\)" "gimple" } } ! FIXME.
+ !$omp parallel do firstprivate (f06) default(none)
+ do i = 1, 64
+ f06 = f06 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f07\\)" "gimple" } }
+ !$omp parallel do simd firstprivate (f07) default(none)
+ do i = 1, 64
+ f07 = f07 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f08\\)" "gimple" } }
+ !$omp parallel loop firstprivate (f08) default(none)
+ do i = 1, 64
+ f08 = f08 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f09\\)" "gimple" } }
+ !$omp parallel master firstprivate (f09) default(none)
+ f09 = f09 + 1
+ !$omp end parallel master
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f10\\)" "gimple" } }
+ !$omp parallel master taskloop firstprivate (f10) default(none)
+ do i = 1, 64
+ f10 = f10 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f11\\)" "gimple" } }
+ !$omp parallel master taskloop simd firstprivate (f11) default(none)
+ do i = 1, 64
+ f11 = f11 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f12\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*firstprivate\\(f12\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp section \[^\n\r]*firstprivate\\(f12\\)" "gimple" } }
+ !$omp parallel sections firstprivate (f12) default(none)
+ f12 = f12 + 1
+ !$omp section
+ f12 = f12 + 1
+ !$omp end parallel sections
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f13\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f13\\)" "gimple" } }
+ !$omp target parallel firstprivate (f13) default(none) defaultmap(none)
+ f13 = f13 + 1
+ !$omp end target parallel
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f14\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } ! FIXME.
+ !$omp target parallel do firstprivate (f14) default(none) defaultmap(none)
+ do i = 1, 64
+ f14 = f14 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f15\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f15\\)" "gimple" } }
+ !$omp target parallel do simd firstprivate (f15) default(none) defaultmap(none)
+ do i = 1, 64
+ f15 = f15 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f16\\)" "gimple" } }
+ !$omp target parallel loop firstprivate (f16) default(none) defaultmap(none)
+ do i = 1, 64
+ f16 = f16 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f17\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f17\\)" "gimple" } }
+ !$omp target teams firstprivate (f17) default(none) defaultmap(none)
+ f17 = f17 + 1
+ !$omp end target teams
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f18\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } ! FIXME: This should be on distribute instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } ! FIXME.
+ !$omp target teams distribute firstprivate (f18) default(none) defaultmap(none)
+ do i = 1, 64
+ f18 = f18 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f19\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } ! FIXME: This should be on distribute instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } ! FIXME.
+ !$omp target teams distribute parallel do firstprivate (f19) default(none) defaultmap(none)
+ do i = 1, 64
+ f19 = f19 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f20\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f20\\)" "gimple" } }
+ !$omp target teams distribute parallel do simd firstprivate (f20) default(none) defaultmap(none)
+ do i = 1, 64
+ f20 = f20 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f21\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f21\\)" "gimple" } }
+ !$omp target teams distribute simd firstprivate (f21) default(none) defaultmap(none)
+ do i = 1, 64
+ f21 = f21 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f22\\)" "gimple" } } ! NOTE: This is an implementation detail.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f22\\)" "gimple" } }
+ !$omp target teams loop firstprivate (f22) default(none) defaultmap(none)
+ do i = 1, 64
+ f22 = f22 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f23\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f23\\)" "gimple" } }
+ !$omp target simd firstprivate (f23) defaultmap(none)
+ do i = 1, 64
+ f23 = f23 + 1
+ end do
+ !$omp end target simd
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f24\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f24\\)" "gimple" } }
+ !$omp taskloop simd firstprivate (f24) default(none)
+ do i = 1, 64
+ f24 = f24 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f25\\)" "gimple" } } ! FIXME: This should be on distribute instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f25\\)" "gimple" } } ! FIXME.
+ !$omp teams distribute firstprivate (f25) default(none)
+ do i = 1, 64
+ f25 = f25 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } ! FIXME: This should be on distribute instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } ! FIXME.
+ !$omp teams distribute parallel do firstprivate (f26) default(none)
+ do i = 1, 64
+ f26 = f26 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f27\\)" "gimple" } }
+ !$omp teams distribute parallel do simd firstprivate (f27) default(none)
+ do i = 1, 64
+ f27 = f27 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f28\\)" "gimple" } }
+ !$omp teams distribute simd firstprivate (f28) default(none)
+ do i = 1, 64
+ f28 = f28 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f29\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f29\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f29\\)" "gimple" } } ! NOTE: This is an implementation detail.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f29\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f29\\)" "gimple" } }
+ !$omp teams loop firstprivate (f29) default(none)
+ do i = 1, 64
+ f29 = f29 + 1
+ end do
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-11.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-11.f90
new file mode 100644
index 0000000..22a40e2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-11.f90
@@ -0,0 +1,35 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: r00, r01, r02
+
+contains
+
+subroutine bar ()
+ integer :: i
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*in_reduction\\(\\+:r00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r00\\)" "gimple" } }
+ !$omp master taskloop in_reduction(+:r00)
+ do i = 1, 64
+ r00 = r00 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } }
+ !$omp master taskloop simd in_reduction(+:r01)
+ do i = 1, 64
+ r01 = r01 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*in_reduction\\(\\+:r02\\)" "gimple" } }
+ !$omp taskloop simd in_reduction(+:r02)
+ do i = 1, 64
+ r02 = r02 + 1
+ end do
+ ! FIXME: We don't support in_reduction clause on target yet, once we do, should
+ ! add testcase coverage for all combined/composite constructs with target as leaf construct.
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-2.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-2.f90
new file mode 100644
index 0000000..7a98248
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-2.f90
@@ -0,0 +1,233 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: l00, l01, l02, l03, l04, l05, l06, l07
+ integer :: l10, l11, l12, l13, l14, l15, l16, l17, l18
+
+contains
+
+subroutine foo ()
+ integer :: i
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } ! FIXME.
+ !$omp distribute parallel do lastprivate (l00) default(none)
+ do i = 1, 64
+ l00 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l01\\)" "gimple" } }
+ !$omp distribute parallel do simd lastprivate (l01) default(none)
+ do i = 1, 64
+ l01 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l02\\)" "gimple" } }
+ !$omp distribute simd lastprivate (l02)
+ do i = 1, 64
+ l02 = i
+ end do
+end
+
+subroutine bar ()
+ integer :: j00, j01, j02, j03
+ integer :: l08, l09, l19, l20, l21, l22
+ integer :: i
+ l08 = 0; l09 = 0; l19 = 0; l20 = 0; l21 = 0; l22 = 0
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l03\\)" "gimple" } }
+ !$omp do simd lastprivate (l03)
+ do i = 1, 64
+ l03 = i
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l04\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l04\\)" "gimple" } }
+ !$omp master taskloop lastprivate (l04) default(none)
+ do i = 1, 64
+ l04 = i
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l05\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l05\\)" "gimple" } }
+ !$omp master taskloop simd lastprivate (l05) default(none)
+ do i = 1, 64
+ l05 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } ! FIXME.
+ !$omp parallel do lastprivate (l06) default(none)
+ do i = 1, 64
+ l06 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l07\\)" "gimple" } }
+ !$omp parallel do simd lastprivate (l07) default(none)
+ do i = 1, 64
+ l07 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp parallel loop lastprivate (j00) default(none)
+ do j00 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l08\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l08\\)" "gimple" } }
+ !$omp parallel master taskloop lastprivate (l08) default(none)
+ do i = 1, 64
+ l08 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l09\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l09\\)" "gimple" } }
+ !$omp parallel master taskloop simd lastprivate (l09) default(none)
+ do i = 1, 64
+ l09 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } ! FIXME: This should be on sections instead.
+ ! { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp section \[^\n\r]*lastprivate\\(l10\\)" "gimple" } }
+ !$omp parallel sections lastprivate (l10) default(none)
+ l10 = 1
+ !$omp section
+ l10 = 2
+ !$omp end parallel sections
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l11" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } ! FIXME.
+ !$omp target parallel do lastprivate (l11) default(none) defaultmap(none)
+ do i = 1, 64
+ l11 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l12" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l12\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l12\\)" "gimple" } }
+ !$omp target parallel do simd lastprivate (l12) default(none) defaultmap(none)
+ do i = 1, 64
+ l12 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j01" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp target parallel loop lastprivate (j01) default(none) defaultmap(none)
+ do j01 = 0, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l13" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l13\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l13\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l13\\)" "gimple" } }
+ !$omp target teams distribute lastprivate (l13) default(none) defaultmap(none)
+ do i = 1, 64
+ l13 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l14" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l14\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l14\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l14\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } ! FIXME.
+ !$omp target teams distribute parallel do lastprivate (l14) default(none) defaultmap(none)
+ do i = 1, 64
+ l14 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l15" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l15\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l15\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l15\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l15\\)" "gimple" } }
+ !$omp target teams distribute parallel do simd lastprivate (l15) default(none) defaultmap(none)
+ do i = 1, 64
+ l15 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l16" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l16\\)" "gimple" } }
+ !$omp target teams distribute simd lastprivate (l16) default(none) defaultmap(none)
+ do i = 1, 64
+ l16 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j02" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j02\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp target teams loop lastprivate (j02) default(none) defaultmap(none)
+ do j02 = 0, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l17" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l17\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l17\\)" "gimple" } }
+ !$omp target simd lastprivate (l17) defaultmap(none)
+ do i = 1, 64
+ l17 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l18\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l18\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l18\\)" "gimple" } }
+ !$omp taskloop simd lastprivate (l18) default(none)
+ do i = 1, 64
+ l18 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l19\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l19\\)" "gimple" } }
+ !$omp teams distribute lastprivate (l19) default(none)
+ do i = 1, 64
+ l19 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l20\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l20\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } ! FIXME.
+ !$omp teams distribute parallel do lastprivate (l20) default(none)
+ do i = 1, 64
+ l20 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l21\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l21\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l21\\)" "gimple" } }
+ !$omp teams distribute parallel do simd lastprivate (l21) default(none)
+ do i = 1, 64
+ l21 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l22\\)" "gimple" } }
+ !$omp teams distribute simd lastprivate (l22) default(none)
+ do i = 1, 64
+ l22 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j03\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp teams loop lastprivate (j03) default(none)
+ do j03 = 1, 64
+ end do
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-3.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-3.f90
new file mode 100644
index 0000000..3c02c88
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-3.f90
@@ -0,0 +1,139 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: l00, l01, l02, l03, l04, l07, l08, l09
+ integer :: l10, l11
+
+contains
+
+subroutine bar ()
+ integer :: l05, l06
+ integer :: i
+ l05 = 0; l06 = 0
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(l00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l00\\)" "gimple" } }
+ !$omp do simd firstprivate (l00) lastprivate (l00)
+ do i = 1, 64
+ l00 = i
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l01\\)" "gimple" } }
+ !$omp master taskloop firstprivate (l01) lastprivate (l01) default(none)
+ do i = 1, 64
+ l01 = i
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l02\\)" "gimple" } }
+ !$omp master taskloop simd firstprivate (l02) lastprivate (l02) default(none)
+ do i = 1, 64
+ l02 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } ! FIXME.
+ !$omp parallel do firstprivate (l03) lastprivate (l03) default(none)
+ do i = 1, 64
+ l03 = i
+ end do
+ !$omp end parallel do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l04\\)" "gimple" } }
+ !$omp parallel do simd firstprivate (l04) lastprivate (l04) default(none)
+ do i = 1, 64
+ l04 = i
+ end do
+ !$omp end parallel do simd
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l05\\)" "gimple" } }
+ !$omp parallel master taskloop firstprivate (l05) lastprivate (l05) default(none)
+ do i = 1, 64
+ l05 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l06\\)" "gimple" } }
+ !$omp parallel master taskloop simd firstprivate (l06) lastprivate (l06) default(none)
+ do i = 1, 64
+ l06 = i
+ end do
+ !$omp end parallel master taskloop simd
+ ! FIXME: OpenMP 5.0/5.1 broken here, conceptually it should be shared on parallel and
+ ! firstprivate+lastprivate on sections, in GCC implementation we put firstprivate+lastprivate
+ ! on parallel for historic reasons, but OpenMP 5.0/5.1 mistakenly say firstprivate
+ ! should be on parallel and lastprivate on sections.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*firstprivate\\(l07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*lastprivate\\(l07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp section \[^\n\r]*firstprivate\\(l07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp section \[^\n\r]*lastprivate\\(l07\\)" "gimple" } }
+ !$omp parallel sections firstprivate (l07) lastprivate (l07) default(none)
+ l07 = 1
+ !$omp section
+ l07 = 2
+ !$omp end parallel sections
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l08" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } ! FIXME.
+ !$omp target parallel do firstprivate (l08) lastprivate (l08) default(none) defaultmap(none)
+ do i = 1, 64
+ l08 = i
+ end do
+ !$omp end target parallel do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l09" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l09\\)" "gimple" } }
+ !$omp target parallel do simd firstprivate (l09) lastprivate (l09) default(none) defaultmap(none)
+ do i = 1, 64
+ l09 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l10" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l10\\)" "gimple" } }
+ !$omp target simd firstprivate (l10) lastprivate (l10) defaultmap(none)
+ do i = 1, 64
+ l10 = i
+ end do
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l11\\)" "gimple" } }
+ !$omp taskloop simd firstprivate (l11) lastprivate (l11) default(none)
+ do i = 1, 64
+ l11 = i
+ end do
+ !$omp end taskloop simd
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-4.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-4.f90
new file mode 100644
index 0000000..1563c4f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-4.f90
@@ -0,0 +1,90 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: l00, l01, l05, l06, l07, l08
+
+contains
+
+subroutine bar ()
+ integer :: l02, l03, l04
+ integer :: i
+ l02 = 0; l03 = 0; l04 = 0
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(l00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l00:1\\)" "gimple" } }
+ !$omp do simd linear (l00)
+ do i = 1, 64
+ l00 = l00 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l01:1\\)" "gimple" } }
+ !$omp master taskloop simd linear (l01) default(none)
+ do i = 1, 64
+ l01 = l01 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*linear\\(l02:1\\)" "gimple" } }
+ !$omp parallel do linear (l02) default(none)
+ do i = 1, 64
+ l02 = l02 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l03:1\\)" "gimple" } }
+ !$omp parallel do simd linear (l03) default(none)
+ do i = 1, 64
+ l03 = l03 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l04:1\\)" "gimple" } }
+ !$omp parallel master taskloop simd linear (l04) default(none)
+ do i = 1, 64
+ l04 = l04 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l05" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*linear\\(l05:1\\)" "gimple" } }
+ !$omp target parallel do linear (l05) default(none) defaultmap(none)
+ do i = 1, 64
+ l05 = l05 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l06" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l06:1\\)" "gimple" } }
+ !$omp target parallel do simd linear (l06) default(none) defaultmap(none)
+ do i = 1, 64
+ l06 = l06 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l07" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l07:1\\)" "gimple" } }
+ !$omp target simd linear (l07) defaultmap(none)
+ do i = 1, 64
+ l07 = l07 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l08:1\\)" "gimple" } }
+ !$omp taskloop simd linear (l08) default(none)
+ do i = 1, 64
+ l08 = l08 + 1
+ end do
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-5.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-5.f90
new file mode 100644
index 0000000..259f6cc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-5.f90
@@ -0,0 +1,108 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: j00, j01, j02, j03, j04, j06, j07, j08, j09
+ integer :: j10
+
+contains
+
+subroutine foo ()
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } }
+ !$omp distribute parallel do simd linear (j00) default(none)
+ do j00 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } }
+ !$omp distribute simd linear (j01)
+ do j01 = 1, 64
+ end do
+end
+
+subroutine bar ()
+ integer :: j05, j11, j12
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } }
+ !$omp do simd linear (j02)
+ do j02 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } }
+ !$omp master taskloop simd linear (j03) default(none)
+ do j03 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } }
+ !$omp parallel do simd linear (j04) default(none)
+ do j04 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } }
+ !$omp parallel master taskloop simd linear (j05) default(none)
+ do j05 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } }
+ !$omp target parallel do simd linear (j06) default(none) defaultmap(none)
+ do j06 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } }
+ !$omp target simd linear (j07) defaultmap(none)
+ do j07 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } }
+ !$omp target teams distribute parallel do simd linear (j08) default(none) defaultmap(none)
+ do j08 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } }
+ !$omp target teams distribute simd linear (j09) default(none) defaultmap(none)
+ do j09 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } }
+ !$omp taskloop simd linear (j10) default(none)
+ do j10 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } }
+ !$omp teams distribute parallel do simd linear (j11) default(none)
+ do j11 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } }
+ !$omp teams distribute simd linear (j12) default(none)
+ do j12 = 1, 64
+ end do
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-6.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-6.f90
new file mode 100644
index 0000000..a9ad226
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-6.f90
@@ -0,0 +1,108 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: j00, j01, j02, j03, j04, j06, j07, j08, j09
+ integer :: j10
+
+contains
+
+subroutine foo ()
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } }
+ !$omp distribute parallel do simd default(none)
+ do j00 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } }
+ !$omp distribute simd
+ do j01 = 1, 64
+ end do
+end
+
+subroutine bar ()
+ integer :: j05, j11, j12;
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } }
+ !$omp do simd
+ do j02 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } }
+ !$omp master taskloop simd default(none)
+ do j03 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } }
+ !$omp parallel do simd default(none)
+ do j04 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } }
+ !$omp parallel master taskloop simd default(none)
+ do j05 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } }
+ !$omp target parallel do simd default(none) defaultmap(none)
+ do j06 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } }
+ !$omp target simd defaultmap(none)
+ do j07 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } }
+ !$omp target teams distribute parallel do simd default(none) defaultmap(none)
+ do j08 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } }
+ !$omp target teams distribute simd default(none) defaultmap(none)
+ do j09 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } }
+ !$omp taskloop simd default(none)
+ do j10 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } }
+ !$omp teams distribute parallel do simd default(none)
+ do j11 = 1, 64
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } }
+ !$omp teams distribute simd default(none)
+ do j12 = 1, 64
+ end do
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr99928-8.f90 b/gcc/testsuite/gfortran.dg/gomp/pr99928-8.f90
new file mode 100644
index 0000000..a0414a5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr99928-8.f90
@@ -0,0 +1,253 @@
+! PR middle-end/99928
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-gimple" }
+
+module m
+ implicit none
+ integer :: r00, r01, r02, r03, r04, r05
+ integer :: r13, r14, r15, r16, r17, r18, r19
+ integer :: r20, r21, r22, r23, r24
+
+contains
+
+subroutine foo ()
+ integer :: i
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } ! FIXME.
+ !$omp distribute parallel do reduction(+:r00) default(none)
+ do i = 1, 64
+ r00 = r00 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } }
+ !$omp distribute parallel do simd reduction(+:r01) default(none)
+ do i = 1, 64
+ r01 = r01 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r02\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r02\\)" "gimple" } }
+ !$omp distribute simd reduction(+:r02)
+ do i = 1, 64
+ r02 = r02 + 1
+ end do
+end
+
+subroutine bar ()
+ integer :: r06, r07, r08, r09
+ integer :: r10, r11, r12
+ integer :: r25, r26, r27, r28, r29
+ integer :: i
+ r06 = 0; r07 = 0; r08 = 0; r09 = 0
+ r10 = 0; r11 = 0; r12 = 0
+ r25 = 0; r26 = 0; r27 = 0; r28 = 0; r29 = 0
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r03\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r03\\)" "gimple" } }
+ !$omp do simd reduction(+:r03)
+ do i = 1, 64
+ r03 = r03 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r04\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r04\\)" "gimple" } }
+ !$omp master taskloop reduction(+:r04) default(none)
+ do i = 1, 64
+ r04 = r04 + 1
+ end do
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } }
+ !$omp master taskloop simd reduction(+:r05) default(none)
+ do i = 1, 64
+ r05 = r05 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r06\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r06\\)" "gimple" } } ! FIXME.
+ !$omp parallel do reduction(+:r06) default(none)
+ do i = 1, 64
+ r06 = r06 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } }
+ !$omp parallel do simd reduction(+:r07) default(none)
+ do i = 1, 64
+ r07 = r07 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r08\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r08\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r08\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp parallel loop reduction(+:r08) default(none)
+ do i = 1, 64
+ r08 = r08 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r09\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r09\\)" "gimple" } }
+ !$omp parallel master reduction(+:r09) default(none)
+ r09 = r09 + 1
+ !$omp end parallel master
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r10\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r10\\)" "gimple" } }
+ !$omp parallel master taskloop reduction(+:r10) default(none)
+ do i = 1, 64
+ r10 = r10 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } }
+ !$omp parallel master taskloop simd reduction(+:r11) default(none)
+ do i = 1, 64
+ r11 = r11 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } ! FIXME: This should be on sections instead.
+ ! { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump-not "omp section \[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } }
+ !$omp parallel sections reduction(+:r12) default(none)
+ r12 = r12 + 1
+ !$omp section
+ r12 = r12 + 1
+ !$omp end parallel sections
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r13\\)" "gimple" } }
+ !$omp target parallel reduction(+:r13) default(none) defaultmap(none)
+ r13 = r13 + 1
+ !$omp end target parallel
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r14\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r14\\)" "gimple" } } ! FIXME.
+ !$omp target parallel do reduction(+:r14) default(none) defaultmap(none)
+ do i = 1, 64
+ r14 = r14 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } }
+ !$omp target parallel do simd reduction(+:r15) default(none) defaultmap(none)
+ do i = 1, 64
+ r15 = r15 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r16\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r16\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r16\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp target parallel loop reduction(+:r16) default(none) defaultmap(none)
+ do i = 1, 64
+ r16 = r16 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r17\\)" "gimple" } }
+ !$omp target teams reduction(+:r17) default(none) defaultmap(none)
+ r17 = r17 + 1
+ !$omp end target teams
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r18\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r18\\)" "gimple" } }
+ !$omp target teams distribute reduction(+:r18) default(none) defaultmap(none)
+ do i = 1, 64
+ r18 = r18 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } ! FIXME.
+ !$omp target teams distribute parallel do reduction(+:r19) default(none) defaultmap(none)
+ do i = 1, 64
+ r19 = r19 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } }
+ !$omp target teams distribute parallel do simd reduction(+:r20) default(none) defaultmap(none)
+ do i = 1, 64
+ r20 = r20 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } }
+ !$omp target teams distribute simd reduction(+:r21) default(none) defaultmap(none)
+ do i = 1, 64
+ r21 = r21 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r22\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r22\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp target teams loop reduction(+:r22) default(none) defaultmap(none)
+ do i = 1, 64
+ r22 = r22 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r23\\)" "gimple" } }
+ !$omp target simd reduction(+:r23) defaultmap(none)
+ do i = 1, 64
+ r23 = r23 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r24\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r24\\)" "gimple" } }
+ !$omp taskloop simd reduction(+:r24) default(none)
+ do i = 1, 64
+ r24 = r24 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r25\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r25\\)" "gimple" } }
+ !$omp teams distribute reduction(+:r25) default(none)
+ do i = 1, 64
+ r25 = r25 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } ! FIXME.
+ !$omp teams distribute parallel do reduction(+:r26) default(none)
+ do i = 1, 64
+ r26 = r26 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } ! FIXME: This should be on for instead.
+ ! { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } ! FIXME.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } }
+ !$omp teams distribute parallel do simd reduction(+:r27) default(none)
+ do i = 1, 64
+ r27 = r27 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } }
+ !$omp teams distribute simd reduction(+:r28) default(none)
+ do i = 1, 64
+ r28 = r28 + 1
+ end do
+ ! { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r29\\)" "gimple" } }
+ ! { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r29\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } ! NOTE: This is implementation detail.
+ ! { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } ! NOTE: This is implementation detail.
+ !$omp teams loop reduction(+:r29) default(none)
+ do i = 1, 64
+ r29 = r29 + 1
+ end do
+end
+end module m
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction-task-1.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction-task-1.f90
new file mode 100644
index 0000000..99c097f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction-task-1.f90
@@ -0,0 +1,112 @@
+module m
+ implicit none
+ integer v
+ interface
+ subroutine foo(x)
+ integer, value :: x
+ end
+ end interface
+contains
+
+subroutine bar
+ integer i
+ !$omp do reduction (task, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp sections reduction (task, +: v)
+ call foo (-2)
+ !$omp section
+ call foo (-3)
+ !$omp end sections
+ !$omp parallel reduction (task, +: v)
+ call foo (-1)
+ !$omp end parallel
+ !$omp parallel do reduction (task, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end parallel do
+ !$omp parallel sections reduction (task, +: v)
+ call foo (-2)
+ !$omp section
+ call foo (-3)
+ !$omp end parallel sections
+ !$omp teams distribute parallel do reduction (task, +: v) ! { dg-bogus "invalid 'task' reduction modifier on construct other than 'parallel', 'do', 'sections' or 'scope'" "PR101948" { xfail *-*-* } }
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end teams distribute parallel do
+ !$omp do reduction (default, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp sections reduction (default, +: v)
+ call foo (-2)
+ !$omp section
+ call foo (-3)
+ !$omp end sections
+ !$omp parallel reduction (default, +: v)
+ call foo (-1)
+ !$omp end parallel
+ !$omp parallel do reduction (default, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end parallel do
+ !$omp parallel sections reduction (default, +: v)
+ call foo (-2)
+ !$omp section
+ call foo (-3)
+ !$omp end parallel sections
+ !$omp teams distribute parallel do reduction (default, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end teams distribute parallel do
+ !$omp do reduction (default, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end do nowait
+ !$omp sections reduction (default, +: v)
+ call foo (-2)
+ !$omp section
+ call foo (-3)
+ !$omp end sections nowait
+ !$omp simd reduction (default, +: v)
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp do simd reduction (default, +: v)
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp parallel do simd reduction (default, +: v)
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp end parallel do simd
+ !$omp teams distribute parallel do simd reduction (default, +: v)
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp end teams distribute parallel do simd
+ !$omp taskloop reduction (default, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp taskloop simd reduction (default, +: v)
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp teams reduction (default, +: v)
+ call foo (i)
+ !$omp end teams
+ !$omp teams distribute reduction (default, +: v)
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end teams distribute
+end
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction-task-2.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction-task-2.f90
new file mode 100644
index 0000000..c4169bc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction-task-2.f90
@@ -0,0 +1,45 @@
+module m
+ integer :: v
+ interface
+ subroutine foo(i)
+ integer :: i
+ end
+ end interface
+end
+
+subroutine bar
+ use m
+ implicit none
+ integer :: i
+ !$omp do reduction (task, +: v) ! { dg-error "'task' reduction modifier on a construct with a 'nowait' clause" }
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end do nowait
+ !$omp sections reduction (task, +: v) ! { dg-error "'task' reduction modifier on a construct with a 'nowait' clause" }
+ call foo (-2)
+ !$omp section
+ call foo (-3)
+ !$omp end sections nowait
+ !$omp scope reduction (task, +: v) ! { dg-error "'task' reduction modifier on a construct with a 'nowait' clause" }
+ call foo (-4)
+ !$omp end scope nowait
+ !$omp simd reduction (task, +: v) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do', 'sections' or 'scope'" }
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp do simd reduction (task, +: v) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do', 'sections' or 'scope'" }
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp parallel do simd reduction (task, +: v) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do', 'sections' or 'scope'" }
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp end parallel do simd
+ !$omp teams distribute parallel do simd reduction (task, +: v) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do', 'sections' or 'scope'" }
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp end teams distribute parallel do simd
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction-task-2a.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction-task-2a.f90
new file mode 100644
index 0000000..37ce1c8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction-task-2a.f90
@@ -0,0 +1,30 @@
+module m
+ integer :: v
+ interface
+ subroutine foo(i)
+ integer :: i
+ end
+ end interface
+end
+
+subroutine bar
+ use m
+ implicit none
+ integer :: i
+ !$omp taskloop reduction (task, +: v) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp taskloop simd reduction (task, +: v) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+ do i = 0, 63
+ v = v + 1
+ end do
+ !$omp teams reduction (task, +: v) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+ call foo (i)
+ !$omp end teams
+ !$omp teams distribute reduction (task, +: v) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+ do i = 0, 63
+ call foo (i)
+ end do
+ !$omp end teams distribute
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction-task-3.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction-task-3.f90
new file mode 100644
index 0000000..ebf1f13
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction-task-3.f90
@@ -0,0 +1,15 @@
+! Fortran testcase of reduction-task-3.f90 ( PR c/91149 )
+
+module m
+ integer :: r
+end
+
+subroutine foo
+ use m
+ !$omp parallel reduction(task, +: r)
+ r = r + 1
+ !$omp end parallel
+ !$omp target parallel reduction(task, +: r)
+ r = r + 1
+ !$omp end target parallel
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction4.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction4.f90
index 2e8aaa2..52d504b 100644
--- a/gcc/testsuite/gfortran.dg/gomp/reduction4.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction4.f90
@@ -40,7 +40,7 @@ do i=1,10
a = a + 1
end do
-!$omp simd reduction(task,+:a) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do' or 'sections'" }
+!$omp simd reduction(task,+:a) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do', 'sections' or 'scope'" }
do i=1,10
a = a + 1
end do
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction5.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction5.f90
index 032703d..44f89d8 100644
--- a/gcc/testsuite/gfortran.dg/gomp/reduction5.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction5.f90
@@ -22,8 +22,7 @@ end do
!$omp taskloop reduction(inscan,+:a) in_reduction(+:b) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
! { dg-error "34: With INSCAN at .1., expected loop body with ..OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
- ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" "" { target *-*-* } .-2 }
- ! { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" "" { target *-*-* } .-3 }
+ ! { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" "" { target *-*-* } .-2 }
do i=1,10
a = a + 1
end do
@@ -34,7 +33,6 @@ do i=1,10
end do
!$omp teams reduction(inscan,+:b) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
- ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" "" { target *-*-* } .-1 }
a = a + 1
!$omp end teams
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction7.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction7.f90
index 7dc50e1..5f0b7bd 100644
--- a/gcc/testsuite/gfortran.dg/gomp/reduction7.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction7.f90
@@ -2,7 +2,7 @@ implicit none
integer :: a, b, i
a = 0
-!$omp simd reduction(task,+:a) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do' or 'sections'" }
+!$omp simd reduction(task,+:a) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do', 'sections' or 'scope'" }
do i=1,10
a = a + 1
end do
diff --git a/gcc/testsuite/gfortran.dg/gomp/scan-1.f90 b/gcc/testsuite/gfortran.dg/gomp/scan-1.f90
index 8c879fd..f91c7fa 100644
--- a/gcc/testsuite/gfortran.dg/gomp/scan-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/scan-1.f90
@@ -100,11 +100,16 @@ subroutine f3 (c, d)
use m
implicit none
integer i, c(64), d(64)
- !$omp teams reduction (inscan, +: a) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause at" }
+ !$omp teams reduction (inscan, +: a)
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 }
! ...
!$omp end teams
+ !$omp scope reduction (inscan, +: a)
+ ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 }
+ ! ...
+ !$omp end scope
+
!$omp target parallel do reduction (inscan, +: a) map (c, d)
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 }
do i = 1, 64
@@ -135,7 +140,7 @@ subroutine f4 (c, d)
use m
implicit none
integer i, c(64), d(64)
- !$omp taskloop reduction (inscan, +: a) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+ !$omp taskloop reduction (inscan, +: a)
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 }
do i = 1, 64
d(i) = a
diff --git a/gcc/testsuite/gfortran.dg/gomp/scan-5.f90 b/gcc/testsuite/gfortran.dg/gomp/scan-5.f90
index a3789a5..df12f9f 100644
--- a/gcc/testsuite/gfortran.dg/gomp/scan-5.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/scan-5.f90
@@ -13,6 +13,6 @@ integer function foo(a,b, n) result(r)
end do
end
-! { dg-final { scan-tree-dump-times "#pragma omp parallel firstprivate\\(a\\) firstprivate\\(b\\) default\\(none\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp parallel firstprivate\\(a\\) firstprivate\\(b\\) shared\\(r\\) default\\(none\\)" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp for reduction\\(inscan,\\\+:r\\) nowait" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp scan inclusive\\(r\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/scope-1.f90 b/gcc/testsuite/gfortran.dg/gomp/scope-1.f90
new file mode 100644
index 0000000..43ec800
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/scope-1.f90
@@ -0,0 +1,39 @@
+module m
+ implicit none (external, type)
+ integer :: r, r2, r3
+contains
+
+subroutine foo
+ integer :: i, j, k
+ i = 0; j = 0; k = 0
+ !$omp scope private (i) reduction (+:r)
+ i = 1
+ r = r + 1
+ !$omp end scope nowait
+
+ !$omp scope private (i) reduction (task, +:r)
+ !$omp scope private (j) reduction (task, +:r2)
+ !$omp scope private (k) reduction (task, +:r3)
+ i = 1
+ j = 2
+ k = 3
+ r = r + 1
+ r2 = r2 + 1
+ r3 = r3 + 1
+ !$omp end scope
+ !$omp end scope
+ !$omp end scope
+ !$omp parallel
+ !$omp scope reduction (+:r) private (i)
+ !$omp scope reduction (+:r2) private (j)
+ !$omp single
+ i = 1
+ j = 2
+ r = r + 1
+ r2 = r2 + 1
+ !$omp end single
+ !$omp end scope nowait
+ !$omp end scope nowait
+ !$omp end parallel
+end
+end module
diff --git a/gcc/testsuite/gfortran.dg/gomp/scope-2.f90 b/gcc/testsuite/gfortran.dg/gomp/scope-2.f90
new file mode 100644
index 0000000..a097ced
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/scope-2.f90
@@ -0,0 +1,40 @@
+module m
+ implicit none (type, external)
+ integer :: r, r2, r3 = 1
+ interface
+ logical function bar(); end
+ end interface
+contains
+
+subroutine foo
+ integer :: i, j, k
+ i = 0; j = 0; k = 0
+ !$omp parallel
+ if (bar ()) then
+ !$omp cancel parallel
+ end if
+ !$omp scope reduction (+:r) private (i)
+ !$omp scope reduction (+:r2) private (j)
+ !$omp single
+ i = 1;
+ j = 2;
+ r = r + 1
+ r2 = r2 + 1
+ !$omp end single nowait
+ !$omp end scope
+ !$omp end scope
+ !$omp end parallel
+
+ !$omp parallel
+ if (bar ()) then
+ !$omp cancel parallel
+ end if
+ !$omp scope reduction (task, +:r) private (i)
+ !$omp scope reduction (task, *:r3)
+ r = r + 1
+ r3 = r3 + 1
+ !$omp end scope
+ !$omp end scope
+ !$omp end parallel
+end
+end module
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-1.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-1.f90
new file mode 100644
index 0000000..20b9755
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-1.f90
@@ -0,0 +1,67 @@
+! { dg-do compile }
+
+implicit none
+
+integer :: n
+
+!$omp target device (1)
+!$omp end target
+
+!$omp target device (n)
+!$omp end target
+
+!$omp target device (n + 1)
+!$omp end target
+
+!$omp target device (device_num : 1)
+!$omp end target
+
+!$omp target device (device_num : n)
+!$omp end target
+
+!$omp target device (device_num : n + 1)
+!$omp end target
+
+!$omp target device (invalid : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device ( : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device ( , : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (ancestor, device_num : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (ancestor, device_num, ancestor : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (device_num device_num : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (ancestor device_num : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (device_num, invalid : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (ancestor, invalid : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (ancestor, , , : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (invalid, ancestor : 1) ! { dg-error "xpected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (invalid, invalid, ancestor : 1) ! { dg-error "xpected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (device_num invalid : 1) ! { dg-error "Expected integer expression or a single device-modifier 'device_num' or 'ancestor' at" }
+! !$omp end target
+
+!$omp target device (device_num : n, n) ! { dg-error "Expected integer expression" }
+! !$omp end target
+
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-2.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-2.f90
new file mode 100644
index 0000000..133b805
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-2.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+
+! Test to ensure that device-modifier 'device_num' is parsed correctly in
+! device clauses.
+
+!$omp target device (device_num : 42)
+!$omp end target
+
+end
+
+! { dg-final { scan-tree-dump "pragma omp target \[^\n\r)]*device\\(42\\)" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-1.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-1.f90
new file mode 100644
index 0000000..9a170db
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-1.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+
+! Ensure that a 'requires' directive with the 'reverse_offload' clause was
+! specified.
+
+!$omp target device (ancestor:1) ! { dg-error "'ancestor' device modifier not preceded by 'requires' directive with 'reverse_offload' clause" }
+! !$omp end target
+
+end \ No newline at end of file
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-2.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-2.f90
new file mode 100644
index 0000000..117a1d0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-2.f90
@@ -0,0 +1,92 @@
+! { dg-do compile }
+
+implicit none
+
+integer :: a, b, c
+
+!$omp requires reverse_offload ! { dg-error "Sorry, 'reverse_offload' clause at \\(1\\) on REQUIRES directive is not yet supported" }
+
+
+! The following test case is marked with 'xfail' because a previous 'sorry' from
+! 'reverse_offload' suppresses the 'sorry' for 'ancestor'.
+
+!$omp target device (ancestor: 1) ! { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } }
+!$omp end target
+
+!$omp target device (ancestor : a) ! { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } }
+!$omp end target
+
+!$omp target device (ancestor : a + 1) ! { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } }
+!$omp end target
+
+
+! Ensure that the integer expression in the 'device' clause for
+! device-modifier 'ancestor' evaluates to '1' in case of a constant.
+
+!$omp target device (ancestor: 42) ! { dg-error "the 'device' clause expression must evaluate to '1'" }
+! !$omp end target
+
+!$omp target device (device_num:42)
+!$omp end target
+
+!$omp target device (42)
+!$omp end target
+
+
+! Ensure that no OpenMP constructs appear inside target regions with 'ancestor'.
+! The following test case is marked with 'xfail' because a previous 'sorry' from
+! 'reverse_offload' suppresses the 'sorry' for 'ancestor'.
+
+!$omp target device (ancestor: 1)
+ !$omp teams ! { dg-error "" "OpenMP constructs are not allowed in target region with 'ancestor'" { xfail *-*-* } }
+ !$omp end teams
+!$omp end target
+
+!$omp target device (device_num: 1)
+ !$omp teams
+ !$omp end teams
+!$omp end target
+
+!$omp target device (1)
+ !$omp teams
+ !$omp end teams
+!$omp end target
+
+
+! Ensure that with 'ancestor' only the 'device', 'firstprivate', 'private',
+! 'defaultmap', and 'map' clauses appear on the construct.
+! The following test case is marked with 'xfail' because a previous 'sorry' from
+! 'reverse_offload' suppresses the 'sorry' for 'ancestor'.
+
+!$omp target nowait device (ancestor: 1) ! { dg-error "" "with 'ancestor', only the 'device', 'firstprivate', 'private', 'defaultmap', and 'map' clauses may appear on the construct" { xfail *-*-* } }
+!$omp end target
+
+!$omp target device (ancestor: 1) nowait ! { dg-error "" "with 'ancestor', only the 'device', 'firstprivate', 'private', 'defaultmap', and 'map' clauses may appear on the construct" { xfail *-*-* } }
+!$omp end target
+
+!$omp target nowait device (device_num: 1)
+!$omp end target
+
+!$omp target nowait device (1)
+!$omp end target
+
+!$omp target device (ancestor: 1) firstprivate (a) private (b) defaultmap (none) map (c)
+!$omp end target
+
+
+! Ensure that 'ancestor' is only used with 'target' constructs (not with
+! 'target data', 'target update' etc.).
+! The following test case is marked with 'xfail' because a previous 'sorry' from
+! 'reverse_offload' suppresses the 'sorry' for 'ancestor'.
+
+!$omp target data map (a) device (ancestor: 1) ! { dg-error "" "'device' clause with 'ancestor' is only allowed on 'target' construct" { xfail *-*-* } }
+!$omp end target data
+
+!$omp target enter data map (to: a) device (ancestor: 1) ! { dg-error "" "'device' clause with 'ancestor' is only allowed on 'target' construct" { xfail *-*-* } }
+!$omp target exit data map (from: a) device (ancestor: 1) ! { dg-error "" "'device' clause with 'ancestor' is only allowed on 'target' construct" { xfail *-*-* } }
+
+!$omp target update to (a) device (ancestor: 1) ! { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" "" { xfail *-*-* } }
+! { dg-error "with 'ancestor', only the 'device', 'firstprivate', 'private', 'defaultmap', and 'map' clauses may appear on the construct" "" { xfail *-*-* } .-1 }
+
+
+end \ No newline at end of file
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-3.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-3.f90
new file mode 100644
index 0000000..f1145bd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-3.f90
@@ -0,0 +1,33 @@
+! { dg-do compile }
+
+! This testcase ensure that no calls to OpenMP API runtime routines are allowed
+! inside the corresponding target region.
+
+module my_omp_mod
+ use iso_c_binding
+ interface
+ integer function omp_get_thread_num ()
+ end
+ end interface
+end
+
+subroutine f1 ()
+ use my_omp_mod
+ implicit none
+ integer :: n
+
+ !$omp requires reverse_offload ! { dg-error "Sorry, 'reverse_offload' clause at \\(1\\) on REQUIRES directive is not yet supported" }
+
+ !$omp target device (ancestor : 1)
+ n = omp_get_thread_num () ! { dg-error "" "OpenMP runtime API call 'omp_get_thread_num' in a region with 'device\\(ancestor\\)' clause" { xfail *-*-* } }
+ !$omp end target
+
+ !$omp target device (device_num : 1)
+ n = omp_get_thread_num ()
+ !$omp end target
+
+ !$omp target device (1)
+ n = omp_get_thread_num ()
+ !$omp end target
+
+end \ No newline at end of file
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90
new file mode 100644
index 0000000..63872fa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+
+! Test to ensure that device-modifier 'ancestor' is parsed correctly in
+! device clauses.
+
+!$omp requires reverse_offload ! { dg-error "Sorry, 'reverse_offload' clause at \\(1\\) on REQUIRES directive is not yet supported" }
+
+!$omp target device (ancestor : 1) ! { dg-message "" "sorry, unimplemented: 'ancestor' not yet supported" { xfail *-*-* } }
+!$omp end target
+
+end
+
+! TODO: dg-final { scan-tree-dump-times "pragma omp target \[^\n\r)]*device\\(ancestor:1\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/taskloop-1.f90 b/gcc/testsuite/gfortran.dg/gomp/taskloop-1.f90
new file mode 100644
index 0000000..7060a7a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/taskloop-1.f90
@@ -0,0 +1,126 @@
+module m
+ implicit none
+ integer :: t
+ !$omp threadprivate (t)
+ integer :: f, l, ll, r, r2
+ !$omp declare target to(f, l, ll, r, r2)
+end module m
+
+subroutine foo(fi, p, pp, g, s, nta, nth, ntm, i1, i2, i3, q)
+ use m
+ implicit none
+ integer, value :: p, pp, g, s, nta, nth, ntm
+ logical, value :: fi, i1, i2, i3
+ integer, pointer :: q(:)
+ integer :: i
+
+ !$omp taskgroup task_reduction(+:r2) !allocate (r2)
+ !$omp taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) &
+ !$omp& if(simd: i2) final(fi) mergeable priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) &
+ !$omp& order(concurrent) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+ !$omp end taskgroup
+
+ !$omp taskgroup task_reduction(+:r) !allocate (r)
+ !$omp taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) &
+ !$omp& collapse(1) untied if(i1) final(fi) mergeable nogroup priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) in_reduction(+:r) nontemporal(ntm) &
+ !$omp& order(concurrent) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+ !$omp taskwait
+
+ !$omp taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) &
+ !$omp& collapse(1) if(taskloop: i1) final(fi) priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(+:r) if (simd: i3) nontemporal(ntm) &
+ !$omp& order(concurrent) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+ !$omp end taskgroup
+
+ !$omp taskgroup task_reduction (+:r2) !allocate (r2)
+ !$omp master taskloop &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) &
+ !$omp& collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) &
+ !$omp& reduction(default, +:r) in_reduction(+:r2) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+ !$omp end taskgroup
+
+ !$omp taskgroup task_reduction (+:r2) !allocate (r2)
+ !$omp master taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) &
+ !$omp& collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) &
+ !$omp& order(concurrent) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+ !$omp end taskgroup
+
+ !$omp parallel master taskloop &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) &
+ !$omp& collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) &
+ !$omp& reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+
+ !$omp parallel master taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) &
+ !$omp& untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) &
+ !$omp& if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) &
+ !$omp& order(concurrent) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+
+ !$omp taskgroup task_reduction (+:r2) !allocate (r2)
+ !$omp master taskloop &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) &
+ !$omp& collapse(1) untied if(i1) final(fi) mergeable priority (pp) &
+ !$omp& reduction(default, +:r) in_reduction(+:r2)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+ !$omp end taskgroup
+
+ !$omp taskgroup task_reduction (+:r2) !allocate (r2)
+ !$omp master taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) &
+ !$omp& collapse(1) untied if(i1) final(fi) mergeable priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) &
+ !$omp& order(concurrent) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+ !$omp end taskgroup
+
+ !$omp parallel master taskloop &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) &
+ !$omp& collapse(1) untied if(i1) final(fi) mergeable priority (pp) &
+ !$omp& reduction(default, +:r) num_threads (nth) proc_bind(spread) copyin(t) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+
+ !$omp parallel master taskloop simd &
+ !$omp& private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) &
+ !$omp& collapse(1) untied if(i1) final(fi) mergeable priority (pp) &
+ !$omp& safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) &
+ !$omp& nontemporal(ntm) num_threads (nth) proc_bind(spread) copyin(t) &
+ !$omp& order(concurrent) !allocate (f)
+ do i = 1, 64
+ ll = ll + 1
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/taskloop-2.f90 b/gcc/testsuite/gfortran.dg/gomp/taskloop-2.f90
new file mode 100644
index 0000000..2142762
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/taskloop-2.f90
@@ -0,0 +1,72 @@
+subroutine foo()
+implicit none
+integer :: i, r
+!$omp taskloop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp taskloop simd reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp master taskloop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp master taskloop simd reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp parallel master taskloop reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+!$omp parallel master taskloop simd reduction(task, +: r) ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i = 1, 64
+end do
+
+!$omp taskloop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64 ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
+end do
+!$omp taskloop simd reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64 ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
+end do
+!$omp master taskloop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64
+end do
+!$omp master taskloop simd reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64
+end do
+!$omp parallel master taskloop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64 ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
+end do
+!$omp parallel master taskloop simd reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
+do i = 1, 64 ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
+end do
+end
+
+
+subroutine bar()
+implicit none
+integer :: i, r
+r = 0
+!$omp parallel reduction(+:r)
+ !$omp master taskloop in_reduction(+:r)
+ do i = 1, 64
+ end do
+ !$omp master taskloop simd in_reduction(+:r)
+ do i = 1, 64
+ end do
+ !$omp master
+ !$omp taskloop in_reduction(+:r)
+ do i = 1, 64
+ end do
+ !$omp taskloop simd in_reduction(+:r)
+ do i = 1, 64
+ end do
+ !$omp end master
+!$omp end parallel
+
+!$omp parallel master taskloop in_reduction(+:r) ! { dg-error "Failed to match clause" }
+ do i = 1, 64
+ end do
+
+!$omp parallel master taskloop simd in_reduction(+:r) ! { dg-error "Failed to match clause" }
+ do i = 1, 64
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/taskwait.f90 b/gcc/testsuite/gfortran.dg/gomp/taskwait.f90
new file mode 100644
index 0000000..80ae24a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/taskwait.f90
@@ -0,0 +1,7 @@
+! { dg-additional-options "-fdump-tree-original" }
+!$omp taskwait
+!$omp taskwait depend(out:foo)
+end
+
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_taskwait \\(\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp taskwait depend\\(out:foo\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare-59.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare-59.f90
new file mode 100644
index 0000000..65d04c2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/workshare-59.f90
@@ -0,0 +1,26 @@
+! PR fortran/100633
+
+module defined_assign
+ interface assignment(=)
+ module procedure work_assign
+ end interface
+
+ contains
+ subroutine work_assign(a,b)
+ integer, intent(out) :: a
+ logical, intent(in) :: b(:)
+ end subroutine work_assign
+end module defined_assign
+
+program omp_workshare
+ use defined_assign
+
+ integer :: a
+ logical :: l(10)
+ l = .TRUE.
+
+ !$omp workshare
+ a = l ! { dg-error "Expected intrinsic assignment in OMP WORKSHARE" }
+ !$omp end workshare
+
+end program omp_workshare
diff --git a/gcc/testsuite/gfortran.dg/goto_9.f90 b/gcc/testsuite/gfortran.dg/goto_9.f90
new file mode 100644
index 0000000..e05e738
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goto_9.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+! PR fortran/102113 - parsing error in assigned goto
+
+program p
+ assign 10 to i
+ goto i,(10,20 )
+10 continue
+20 continue
+end
diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90
index 96ceaff..1af7ed3 100644
--- a/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90
+++ b/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90
@@ -1,4 +1,5 @@
! { dg-do run }
+! { dg-skip-if "PR libfortran/78314" { aarch64*-*-gnu* arm*-*-gnueabi arm*-*-gnueabihf } }
!
! This test will fail on older x86_64 glibc (< 2.20), due to this bug:
! https://sourceware.org/bugzilla/show_bug.cgi?id=16198
diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90
index d847b1b..4a11581 100644
--- a/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90
+++ b/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90
@@ -1,5 +1,5 @@
-! { dg-do run { xfail aarch64*-*-gnu* arm*-*-gnueabi arm*-*-gnueabihf } }
-! XFAIL because of PR libfortran/78449.
+! { dg-do run }
+! { dg-skip-if "PR libfortran/78314" { aarch64*-*-gnu* arm*-*-gnueabi arm*-*-gnueabihf } }
module foo
use :: ieee_exceptions
diff --git a/gcc/testsuite/gfortran.dg/implicit_11.f90 b/gcc/testsuite/gfortran.dg/implicit_11.f90
index 61091ec..8f93704 100644
--- a/gcc/testsuite/gfortran.dg/implicit_11.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_11.f90
@@ -31,6 +31,6 @@
SUBROUTINE AD0001
REAL RLA1(:)
ALLOCATABLE RLA1
- ALLOCATE (RLA1(NF10), STAT = ISTAT2) ! { dg-error "is not a variable" }
+ ALLOCATE (RLA1(NF10), STAT = ISTAT2) ! { dg-error "requires an argument list" }
END SUBROUTINE
END MODULE tests2
diff --git a/gcc/testsuite/gfortran.dg/implied_do_io_7.f90 b/gcc/testsuite/gfortran.dg/implied_do_io_7.f90
new file mode 100644
index 0000000..63927aa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/implied_do_io_7.f90
@@ -0,0 +1,16 @@
+! { dg-do run }
+! PR 100227 - this was falsely optimized, leading to nonsense results.
+! Original test case by "Mathieu".
+
+program p
+ implicit none
+ integer, parameter :: nbmode = 3
+ integer :: k
+ real :: mass(nbmode*2)
+ character (len=80) :: line
+ do k = 1, nbmode*2
+ mass(k) = k
+ end do
+ write (unit=line,fmt='(*(F6.2))') (mass(k+k), k=1,nbmode)
+ if (line /= ' 2.00 4.00 6.00') stop 1
+end program
diff --git a/gcc/testsuite/gfortran.dg/inline_matmul_25.f90 b/gcc/testsuite/gfortran.dg/inline_matmul_25.f90
new file mode 100644
index 0000000..df8ad06
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_matmul_25.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-ffrontend-optimize" }
+! PR fortran/99839 - ICE in inline_matmul_assign
+
+program p
+ real :: x(3, 3) = 1.0
+ class(*), allocatable :: z(:, :)
+ z = matmul(x, x)
+end
diff --git a/gcc/testsuite/gfortran.dg/inline_matmul_6.f90 b/gcc/testsuite/gfortran.dg/inline_matmul_6.f90
index 491a721..da717bd 100644
--- a/gcc/testsuite/gfortran.dg/inline_matmul_6.f90
+++ b/gcc/testsuite/gfortran.dg/inline_matmul_6.f90
@@ -45,4 +45,4 @@ program main
if (any(abs(c2 - (/39., -61., 75./)) > 1e-3)) STOP 2
end program main
-! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_matmul" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/inquiry_type_ref_3.f90 b/gcc/testsuite/gfortran.dg/inquiry_type_ref_3.f90
index 4e8d8a0..7c1bf43 100644
--- a/gcc/testsuite/gfortran.dg/inquiry_type_ref_3.f90
+++ b/gcc/testsuite/gfortran.dg/inquiry_type_ref_3.f90
@@ -17,7 +17,7 @@ program main
type(t) :: s
b = "abcdefg"
a%kind = 2 ! { dg-error "Assignment to a constant expression" }
- b%len = 2 ! { dg-error "Assignment to a LEN or KIND part_ref" }
+ b%len = 2 ! { dg-error "parameter inquiry" }
i = a%kind ! OK
i = b%len ! OK
print *, z%re ! { dg-error "must be applied to a COMPLEX expression" }
diff --git a/gcc/testsuite/gfortran.dg/iso_c_binding_char_1.f90 b/gcc/testsuite/gfortran.dg/iso_c_binding_char_1.f90
index ebf9a24..a261656 100644
--- a/gcc/testsuite/gfortran.dg/iso_c_binding_char_1.f90
+++ b/gcc/testsuite/gfortran.dg/iso_c_binding_char_1.f90
@@ -4,7 +4,8 @@
!
! Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
!
-subroutine bar(c,d) BIND(C) ! { dg-error "must be length 1" }
+subroutine bar(c,d) BIND(C) ! { dg-error "character dummy argument 'c' at .1. with assumed length is not yet supported for procedure 'bar' with BIND\\(C\\) attribute" }
+ ! { dg-error "Character dummy argument 'd' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'bar' has the BIND\\(C\\) attribute" "" { target *-*-* } .-1 }
character (len=*) c
character (len=2) d
end
diff --git a/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c b/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c
index 79b8a14..9c2b5fb 100644
--- a/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c
+++ b/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
-#include "../../../libgfortran/ISO_Fortran_binding.h"
+#include <ISO_Fortran_binding.h>
extern void fsub(CFI_cdesc_t *);
diff --git a/gcc/testsuite/gfortran.dg/longnames.f90 b/gcc/testsuite/gfortran.dg/longnames.f90
new file mode 100644
index 0000000..046179e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/longnames.f90
@@ -0,0 +1,92 @@
+! { dg-do compile }
+!
+! PR fortran/99369
+!
+! Contributed by G. Steinmetz
+!
+
+module m1bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc
+ type tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc
+ end type
+ interface operator (.oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc.)
+ procedure fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc
+ end interface
+contains
+ function fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc &
+ (uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc)
+ type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc), intent(in) :: &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc
+ end
+end
+subroutine p1
+ use m1bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc
+ type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc) :: &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc
+ wabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc = &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc &
+ .oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc. &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc
+end
+
+
+module m2bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd
+ type tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd
+ end type
+ interface operator (.oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd.)
+ procedure fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd
+ end interface
+contains
+ function fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd &
+ (uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd)
+ type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd), intent(in) :: &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd
+ end
+end
+subroutine p2
+ use m2bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd
+ type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd) :: &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd
+ wabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd = &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd &
+ .oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd. &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd
+end
+
+
+module m3bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab
+ type tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab
+ end type
+ interface operator (.oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab.)
+ procedure fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab
+ end interface
+contains
+ function fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab &
+ (uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab)
+ type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab), intent(in) :: &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab
+ end
+end
+subroutine p3
+ use m3bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab
+ type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab) :: &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab, &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab
+ wabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab = &
+ uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab &
+ .oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab. &
+ vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab
+end
+
+program main
+ call p1
+ call p2
+ call p3
+end
diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90
index 5552e40..786e3e7 100644
--- a/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90
+++ b/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90
@@ -1,6 +1,6 @@
! { dg-do run }
! { dg-options "-fbounds-check -ffrontend-optimize" }
-! { dg-shouldfail "Fortran runtime error: Incorrect extent in argument B in MATMUL intrnisic for dimension 2: is 1, should be 2" }
+! { dg-shouldfail "Fortran runtime error: Incorrect extent in argument B in MATMUL intrinsic for dimension 2: is 1, should be 2" }
module x
implicit none
contains
diff --git a/gcc/testsuite/gfortran.dg/min0_max0_1.f90 b/gcc/testsuite/gfortran.dg/min0_max0_1.f90
new file mode 100644
index 0000000..118b0f0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/min0_max0_1.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-std=gnu" }
+! PR fortran/100283
+
+subroutine s ()
+ integer(kind=8) :: i,j,k
+ i = min0 (j,k)
+ i = max0 (-127_8, min0 (j,127_8))
+end subroutine s
diff --git a/gcc/testsuite/gfortran.dg/min0_max0_2.f90 b/gcc/testsuite/gfortran.dg/min0_max0_2.f90
new file mode 100644
index 0000000..3fe4fcd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/min0_max0_2.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-fdefault-integer-8 -std=gnu" }
+! PR fortran/101123
+
+SUBROUTINE TEST
+ IMPLICIT INTEGER*4 (I-N)
+ MAXMN=MAX0(M,N)
+ MINMN=MIN0(M,0_4)
+ MAXRS=MAX1(R,S)
+END SUBROUTINE TEST
diff --git a/gcc/testsuite/gfortran.dg/null_11.f90 b/gcc/testsuite/gfortran.dg/null_11.f90
new file mode 100644
index 0000000..040cc26
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/null_11.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+!
+! PR fortran/99651
+!
+module m
+ type :: CHAR_STAR
+ character(len=1),dimension(:),pointer :: ptr
+ end type
+ type(CHAR_STAR), parameter ::CHAR_STAR_NULL = CHAR_STAR(NULL())
+end module m
+
+use m
+type typeNode
+ type(typeNode), pointer :: Next => null()
+end type typeNode
+end
diff --git a/gcc/testsuite/gfortran.dg/pdt_26.f03 b/gcc/testsuite/gfortran.dg/pdt_26.f03
index bf12737..59ddcfb 100644
--- a/gcc/testsuite/gfortran.dg/pdt_26.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_26.f03
@@ -2,7 +2,7 @@
! { dg-options "-fdump-tree-original" }
!
! Test the fix for PR83567 in which the parameterized component 'foo' was
-! being deallocated before return from 'addw', with consequent segfault in
+! being deallocated before return from 'addw', with consequent segfault in
! the main program.
!
! Contributed by Berke Durak <berke.durak@gmail.com>
@@ -43,4 +43,4 @@ program test_pdt
if (any (c(1)%foo .ne. [13,15,17])) STOP 2
end program test_pdt
! { dg-final { scan-tree-dump-times "__builtin_free" 8 "original" } }
-! { dg-final { scan-tree-dump-times "__builtin_malloc" 9 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_malloc" 8 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pdt_31.f03 b/gcc/testsuite/gfortran.dg/pdt_31.f03
new file mode 100644
index 0000000..708c945
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pdt_31.f03
@@ -0,0 +1,26 @@
+! { dg-do run }
+!
+! Test the fix for PR100110, in which 'obj' was not being initialized.
+!
+! Contributed by Xiao Liu <xiao.liu@compiler-dev.com>
+!
+program p
+ implicit none
+ type t(n)
+ integer, len :: n
+ integer :: arr(n, n)
+ end type
+
+ type(t(2)) :: obj
+
+ obj%arr = reshape ([1,2,3,4],[2,2])
+ if (obj%n .ne. 2) stop 1
+ if (any (shape(obj%arr) .ne. [2,2])) stop 2
+ call test()
+contains
+ subroutine test()
+ if (obj%n .ne. 2) stop 3
+ if (any (shape(obj%arr) .ne. [2,2])) stop 4
+ if (any (reshape (obj%arr, [4]) .ne. [1,2,3,4])) stop 5
+ end subroutine
+end program
diff --git a/gcc/testsuite/gfortran.dg/pointer_check_14.f90 b/gcc/testsuite/gfortran.dg/pointer_check_14.f90
new file mode 100644
index 0000000..8ef6b36
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pointer_check_14.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+! { dg-options "-fcheck=pointer -fdump-tree-original" }
+! PR100602 - Erroneous "pointer argument is not associated" runtime error
+
+module m
+ type :: T
+ end type
+contains
+ subroutine f(this)
+ class(T), intent(in) :: this(:)
+ class(T), allocatable :: ca(:)
+ class(T), pointer :: cp(:)
+ if (size (this) == 0) return
+ write(*,*) size (this)
+ stop 1
+ write(*,*) size (ca) ! Check #1
+ write(*,*) size (cp) ! Check #2
+ end subroutine f
+end module
+
+program main
+ use m
+ call f([T::])
+end program
+
+! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 2 "original" } }
+! { dg-final { scan-tree-dump-times "Allocatable argument .*ca" 1 "original" } }
+! { dg-final { scan-tree-dump-times "Pointer argument .*cp" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr100154.f90 b/gcc/testsuite/gfortran.dg/pr100154.f90
new file mode 100644
index 0000000..3a1489a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr100154.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+! { dg-options "-std=gnu" }
+! PR100154 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131
+
+program p
+ implicit none
+ integer :: n
+ character, target :: c
+ character(len=0) :: c0
+ character(len=:), allocatable :: cc
+ n = fget(cc)
+ n = fget('a') ! { dg-error "must be a variable" }
+ n = fget(c0) ! { dg-error "must have length at least 1" }
+ call fget('x') ! { dg-error "must be a variable" }
+ n = fgetc(5,'a') ! { dg-error "must be a variable" }
+ call fgetc(5,c0) ! { dg-error "must have length at least 1" }
+ call fgetc(5,c,1) ! { dg-error "must be a variable" }
+ call fputc(5,'x',1) ! { dg-error "must be a variable" }
+ n = fget (ptr_returning_func())
+ print *, c
+contains
+ function ptr_returning_func () result (res)
+ character, pointer :: res
+ res => c
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/pr100551.f90 b/gcc/testsuite/gfortran.dg/pr100551.f90
new file mode 100644
index 0000000..f82f505
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr100551.f90
@@ -0,0 +1,30 @@
+! { dg-do run }
+! PR fortran/100551 - Passing return value to class(*) dummy argument
+
+program p
+ implicit none
+ integer :: result
+ result = 1
+ result = test ( (result)) ! works
+ if (result /= 1) stop 1
+ result = test (int (result)) ! issue 1
+! write(*,*) result
+ if (result /= 1) stop 2
+ result = test (f (result)) ! issue 2
+! write(*,*) result
+ if (result /= 2) stop 3
+contains
+ integer function test(x)
+ class(*), intent(in) :: x
+ select type (x)
+ type is (integer)
+ test = x
+ class default
+ test = -1
+ end select
+ end function test
+ integer function f(x)
+ integer, intent(in) :: x
+ f = 2*x
+ end function f
+end program
diff --git a/gcc/testsuite/gfortran.dg/pr100949.f90 b/gcc/testsuite/gfortran.dg/pr100949.f90
new file mode 100644
index 0000000..6c736fd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr100949.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR fortran/100949 - ICE in gfc_conv_expr_present, at fortran/trans-expr.c:1975
+
+subroutine s
+entry f
+ type t
+ end type
+ class(t), allocatable :: y, z
+ allocate (z, mold=y)
+end
diff --git a/gcc/testsuite/gfortran.dg/pr100950.f90 b/gcc/testsuite/gfortran.dg/pr100950.f90
new file mode 100644
index 0000000..a19409c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr100950.f90
@@ -0,0 +1,65 @@
+! { dg-do run }
+! { dg-additional-options "-fdump-tree-original" }
+! PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514
+
+program p
+ character(8), parameter :: u = "123"
+ character(8) :: x = "", s
+ character(2) :: w(2) = [character(len(x(3:4))) :: 'a','b' ]
+ character(*), parameter :: y(*) = [character(len(u(3:4))) :: 'a','b' ]
+ character(*), parameter :: z(*) = [character(len(x(3:4))) :: 'a','b' ]
+ character(*), parameter :: t(*) = [character(len(x( :2))) :: 'a','b' ]
+ character(*), parameter :: v(*) = [character(len(x(7: ))) :: 'a','b' ]
+ type t_
+ character(len=5) :: s
+ character(len=8) :: t(4)
+ character(len=8), pointer :: u(:)
+ character(len=:), allocatable :: str
+ character(len=:), allocatable :: str2(:)
+ end type t_
+ type(t_) :: q, r(1)
+ integer, parameter :: lq = len (q%s(3:4)), lr = len (r%s(3:4))
+ integer, parameter :: l1 = len (q %t(1)(3:4))
+ integer, parameter :: l2 = len (q %t(:)(3:4))
+ integer, parameter :: l3 = len (q %str (3:4))
+ integer, parameter :: l4 = len (r(:)%t(1)(3:4))
+ integer, parameter :: l5 = len (r(1)%t(:)(3:4))
+ integer, parameter :: l6 = len (r(1)%str (3:4))
+ integer, parameter :: l7 = len (r(1)%str2(1)(3:4))
+ integer, parameter :: l8 = len (r(1)%str2(:)(3:4))
+
+ if (len (y) /= 2) stop 1
+ if (len (z) /= 2) stop 2
+ if (any (w /= y)) stop 3
+ if (len ([character(len(u(3:4))) :: 'a','b' ]) /= 2) stop 4
+ if (len ([character(len(x(3:4))) :: 'a','b' ]) /= 2) stop 5
+ if (any ([character(len(x(3:4))) :: 'a','b' ] /= y)) stop 6
+ write(s,*) [character(len(x(3:4))) :: 'a','b' ]
+ if (s /= " a b ") stop 7
+ if (len (t) /= 2) stop 8
+ if (len (v) /= 2) stop 9
+ if (lq /= 2 .or. lr /= 2) stop 10
+ if (l1 /= 2 .or. l2 /= 2 .or. l4 /= 2 .or. l5 /= 2) stop 11
+ if (l3 /= 2 .or. l6 /= 2 .or. l7 /= 2 .or. l8 /= 2) stop 12
+
+ block
+ integer, parameter :: l9 = len (r(1)%u(:)(3:4))
+ if (l9 /= 2) stop 13
+ end block
+
+ call sub (42, "abcde")
+contains
+ subroutine sub (m, c)
+ integer, intent(in) :: m
+ character(len=*), intent(in) :: c
+ character(len=m) :: p, o(3)
+ integer, parameter :: l10 = len (p(6:7))
+ integer, parameter :: l11 = len (o(:)(6:7))
+ integer, parameter :: l12 = len (c(2:3))
+ if (l10 /= 2 .or. l11 /= 2 .or. l12 /= 2) stop 14
+ end subroutine sub
+end
+
+! { dg-final { scan-tree-dump-times "_gfortran_stop_numeric" 2 "original" } }
+! { dg-final { scan-tree-dump "_gfortran_stop_numeric \\(3, 0\\);" "original" } }
+! { dg-final { scan-tree-dump "_gfortran_stop_numeric \\(7, 0\\);" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr101026.f b/gcc/testsuite/gfortran.dg/pr101026.f
new file mode 100644
index 0000000..9576d88
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101026.f
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-Ofast -frounding-math" }
+ SUBROUTINE PASSB4 (CC,CH)
+ DIMENSION CC(IDO,4,L1), CH(IDO,L1,*)
+ DO 103 I=2,IDO,2
+ TI4 = CC0-CC(I,4,K)
+ CI4 = TI1-TI4
+ CH(I-1,K,4) = CI4
+ CH(I,K,4) = CI4
+ 103 CONTINUE
+ END
diff --git a/gcc/testsuite/gfortran.dg/pr101121.f b/gcc/testsuite/gfortran.dg/pr101121.f
new file mode 100644
index 0000000..b623ac1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101121.f
@@ -0,0 +1,203 @@
+! { dg-do compile }
+! { dg-options "-Ofast -std=legacy" }
+! { dg-additional-options "-march=haswell" { target x86_64-*-* i?86-*-* } }
+ COMMON /JMSG80/ PI4,PIF,P120,R12,P340,R34,FCS(4,3),E34MAX,
+ 7 IJSAME,KLSAME,IKSMJL
+ DIMENSION P1(3),FQ(0:5),F1(0:4),F2(0:4),WS(8),WP(8)
+ DIMENSION VEA(12),VES(9),WES(6)
+ DIMENSION T(0:20),U(0:20)
+ DIMENSION T3R(6,3,3,3),T9B(0:20,3,3,3)
+ DIMENSION F5X(0:12,3,3,3),F6X(0: 6,3,3,3,3)
+ DIMENSION A31(0:3,0:3),C31(2,0:3),A32(0:3,0:3),C32(2,0:3)
+ DIMENSION A41(0:3,0:3),C41(2,0:3),A42(0:3,0:3),C42(2,0:3)
+ DIMENSION A33(16),FIJ00(2),A43(16),FI0K0(2)
+ DIMENSION SEJJK0( 3),A54(16, 3),C54(2, 3)
+ DIMENSION A56(0:22,3,0:3),C56(2,0:3)
+ DIMENSION A60(0:3,0:3),C60(2,0:3),A61(0:3,0:3),C61(2,0:3)
+ DIMENSION A62(16),FI00L(2),A63(16),F0J0L(2)
+ DIMENSION A64(0:3,0:3),C64(2, 3),A65(0:3,0:3),C65(2, 3)
+ DIMENSION A69(0:3, 3),C69(2,0:3),A70(0:3, 3),C70(2,0:3)
+ DIMENSION A71(18, 3),C71(2, 3)
+ DIMENSION A72(18, 3),C72(2, 3)
+ DIMENSION A73(18,0:3),C73(2,0:3)
+ DIMENSION SE0LKL( 3),A75(16,3),C75(2,0:3)
+ DIMENSION SE0JLL( 3),A76(16,3),C76(2,0:3)
+ DIMENSION A77(0:25,3,0:3),C77(2,0:3),A78(0:31,3,0:3),C78(2,0:3)
+ DIMENSION A79(0:31,3,0:3),C79(2,0:3)
+ DIMENSION A80(0: 2,2),A81(0:24,3),A82(0:31,2),A83(0:22,2)
+ DIMENSION A84(0:13,2),A85(0:13,2),A86(0: 6)
+ DIMENSION S4(0:14),Q4(0:4),FIJKL(2)
+ IF(XVA.LT.CUG) THEN
+ ENDIF
+ F1(M)= FQ0*TMP
+ F2(M)= FQ0*TMP
+ XX1=-X12*X43
+ IF(JI.EQ.1) THEN
+ DO 255 J=1,3
+ 255 CONTINUE
+ DO 268 K=1,3
+ SEJJK00= E0+E(2,2,K,0)+E(3,3,K,0)
+ A54( 5,K)= A540
+ 268 CONTINUE
+ 297 F5X(3+M,I,I,I)=-R3(M,I,I,I)
+ DO 299 J=1,3
+ F5X(3+M,I,I,J)=-R3(M,J,I,I)
+ 299 CONTINUE
+ DO 300 L=0,M56
+ DO 300 M=1,3
+ 300 A56(N,M,L)= ZER
+ A60(2,L)= A600+P34(I,3)*E(I,0,0,L)
+ A61(0,L)= A610+D1I *E(L,0,0,I)
+ A61(1,L)= A610+P12(I,3)*E(L,0,0,I)
+ SEL00L= E(1,0,0,1)+E(2,0,0,2)+E(3,0,0,3)
+ IF(I.NE.J) THEN
+ K=6-I-J
+ F6X(0,J,I,I,I)= ZER
+ F6X(0,I,J,I,I)= ZER
+ F6X(0,I,I,J,I)= ZER
+ F6X(0,I,I,I,J)= ZER
+ F6X(M,I,I,K,J)= R2(M,K,J)
+ ENDIF
+ 391 A82( M,N)= ZER
+ 392 A83( M,N)= ZER
+ A84(M,N)= ZER
+ A85(M,N)= ZER
+ 397 A86( M)= ZER
+ DO 399 K=1,3
+ DO 399 J=1,3
+ DO 398 M=1,6
+ T9B(M+ 2,I,J,K)= T3R0
+ T9B(M+ 8,I,J,K)= T1R(M,I,J,K)
+ T9B(M+14,I,J,K)= T3R0
+ 398 CONTINUE
+ 399 CONTINUE
+ 417 A77( M,3,K)= A770+F5X0*GEIJKL
+ 445 A81( M,3) = A81( M,3)+T( M)*TMP
+ IF(K.EQ.L)A81( 5,3)=A81( 5,3)+TMP
+ IF(I.EQ.J) THEN
+ DO 447 M=6,11
+ 447 A81( M,3) = A81( M,3)+T( M)*GEIJKL
+ ENDIF
+ ENDIF
+ IF(LK.EQ.1) THEN
+ IF(JTYPE.NE.4) THEN
+ DO 510 J=0,3
+ A31(3,J)= A310+ A310*Y02
+ A32(3,J)= A320+ A320*Y02
+ 510 CONTINUE
+ A33( 6)=-AEIJ00*Y1Y+T01
+ A33( 7)= A330-0*Y01+T01
+ A33( 8)= A330- A330*Y01
+ A33(15)= A330+0*Y02
+ A33(16)= A330+ A330*Y02
+ ENDIF
+ A84(12,N)= A84( 7,N)+ A84( 8,N)*Y02
+ A84(13,N)= A84( 9,N)
+ A85(10,2)= A85(10,2)- A85(10,1)+ A850
+ A85(11,2)= A85(11,2)- A85(11,1)+ A850
+ A85(12,2)= A85(12,2)- A85(12,1)+ A850
+ A85(13,2)= A85(13,2)- A85(13,1)
+ Q4(0)= S4( 0)+(S4( 1)+(S4( 2)+(S4( 3)+S4( 4)*Y02)*Y02)*Y02)*Y02
+ Q4(1)= S4( 5)+(S4( 6)+(S4( 7)+ S4( 8)*Y02)*Y02)*Y02
+ Q4(2)= S4( 9)+(S4(10)+ S4(11)*Y02)*Y02
+ Q4(3)= S4(12)+ S4(13)*Y02
+ Q4(4)= S4(14)
+ ENDIF
+ IF(JTYPE.NE.4) THEN
+ ENDIF
+ C42(1,M)= T0*F10-T0*F10
+ C42(2,M)= T0*F20-T0*F20
+ T(1)= T01+(A43( 4)- A43( 5)*Y04)*Y04
+ F0J0L(2)= T(0)*F20-T0*F20+T(2)*F20
+ DO 660 N=1,3
+ T(0)= A64(3,N)- A64(0,N)- A64(1,N)
+ T(1)= A640- A640*Y04
+ C64(1,N)= T0*F10-T0*F10
+ C64(2,N)= T0*F20-T0*F2(1)
+ C65(1,N)= T0*F10-T0*F10
+ C65(2,N)= T0*F20-T0*F2(1)
+ C70(2,N)= T0*F20-T0*F20
+ T(2)=(A71(17,N)-(A71(18,N)- A71(16,N)*Y04)*Y04)*XX1
+ C71(1,N)= T0*F10-T0*F10+T0*F10
+ C71(2,N)= T0*F20-T0*F20+T0*F20
+ T(1)=(A720+ A720- A720-T0)*XX1
+ C72(1,N)= T0*F10-T0*F10+T0*F10
+ C75(1,N)= T(0)*F10-T0*F1(1)+T(2)*F1(2)
+ C75(2,N)= T(0)*F20-T0*F2(1)+T(2)*F2(2)
+ T01 = A76( 6,N)*XX1
+ T(1)=(T01- A760-(A760- A76( 7,N)- A76( 8,N)
+ 2 -(A760+ A76( 3,N))*Y04)*Y04)*XX1
+ 660 CONTINUE
+ C73(2,M)= T0*F20+T0*F20+T(2)*F20
+ 2 +(A77(23,1,M)+ A77(24,1,M)*Y04)*Y03
+ T(2)=(A77(21,2,M)+(A77(22,2,M)+ A77(23,2,M)*Y04)*Y04)*XX1
+ 2 -(A77(24,2,M)-(A77(25,2,M)+ A77(20,2,M)*Y04)*Y04)*Y03
+ T(3)=(A77(21,3,M)+(A77(22,3,M)+(A77(23,3,M)
+ 2 + A77(24,3,M)*Y04)*Y04)*Y04)*XX1
+ C77(1,M)= T0*F10-T0*F10-T0*F10+T0*F10
+ C77(2,M)= T(0)*F20-T(1)*F20-T(2)*F20+T(3)*F20
+ T(0)=(A780+ A78(24,1,M))*Y3Y+ A780*XX1
+ T(1)=(A78(23,1,M)+(A78(21,1,M)+A78(22,1,M)*Y04)*Y04)*XX1
+ 2 +(A78(25,1,M)+ A78(26,1,M)*Y04)*Y3Y- A78(27,1,M)*XX2
+ T(2)=(A78(21,2,M)+(A78(22,2,M)+ A78(28,2,M)*Y04)*Y04)*XX2
+ 2 +(A78(23,2,M)-(A78(24,2,M)+ A78(25,2,M)*Y04)*Y04)*XX1
+ 3 -(A78(29,2,M)-(A78(30,2,M)+ A78(31,2,M)*Y04)*Y04)*Y41
+ T(3)=(A78(21,3,M)+(A78(22,3,M)+(A78(23,3,M)
+ 2 + A78(24,3,M)*Y04)*Y04)*Y04)*XX2
+ C78(1,M)= T0*F10-T0*F1(1)-T(2)*F1(2)+T(3)*F1(3)
+ C78(2,M)= T(0)*F2(0)-T(1)*F2(1)-T(2)*F2(2)+T(3)*F2(3)
+ T(0)=-A79(24,1,M)*Y3Y+ A79(30,1,M)*H43
+ T(1)=(A79(21,1,M)-(A79(23,1,M)+ A79(22,1,M)*Y04)*Y04)*XX1
+ 2 +(A79(25,1,M)+ A79(26,1,M)*Y04)*Y3Y- A79(29,1,M)*XX2
+ T(2)=(A79(21,2,M)+(A79(22,2,M)- A79(28,2,M)*Y04)*Y04)*XX2
+ 2 +(A79(23,2,M)-(A79(24,2,M)+ A79(25,2,M)*Y04)*Y04)*XX1
+ 3 -(A79(29,2,M)-(A79(30,2,M)+ A79(31,2,M)*Y04)*Y04)*Y41
+ T(3)=(A79(21,3,M)+(A79(22,3,M)+(A79(23,3,M)
+ 2 + A79(24,3,M)*Y04)*Y04)*Y04)*XX2
+ C79(1,M)= T(0)*F1(0)-T(1)*F1(1)-T(2)*F1(2)+T(3)*F1(3)
+ C79(2,M)= T(0)*F2(0)-T(1)*F2(1)-T(2)*F2(2)+T(3)*F2(3)
+ T(0)= A80( 2,1)*Y3Y+ A80( 2,2)*H43
+ T(1)=(A81(16,1)+(A81(14,1)+A81(15,1)*Y04)*Y04)*XX1
+ 2 +(A81(18,1)+ A81(19,1)*Y04)*Y3Y- A81(20,1)*XX2
+ T(2)=(A82(21,1)+(A82(22,1)+ A82(28,1)*Y04)*Y04)*XX2
+ 2 +(A82(23,1)-(A82(24,1)+ A82(25,1)*Y04)*Y04)*XX1
+ 3 +(A83(15,2)+(A83(16,2)+ A82(31,1)*Y04)*Y04)*Y41
+ 4 -(A83(17,2)-(A83(18,2)- A83(19,2)*Y04)*Y04)*Y3Y
+ T(3)=(A84(10,1)+(A84(11,1)+(A84(12,1)+A84(13,1)*Y04)*Y04)*Y04)*XX2
+ 2 +(A85(10,1)+(A85(10,2)+(A85(11,2)+(A85(12,2)
+ 3 + A85(13,2)*Y04)*Y04)*Y04)*Y04)*XX1
+ T(4)=(Q4(0)+(Q4(1)+(Q4(2)+(Q4(3)+Q4(4)*Y04)*Y04)*Y04)*Y04)*XX2
+ FIJKL(1)= T(0)*F1(0)-T(1)*F1(1)-T(2)*F1(2)+T(3)*F1(3)+T(4)*F1(4)
+ FIJKL(2)= T(0)*F2(0)-T(1)*F2(1)-T(2)*F2(2)+T(3)*F2(3)+T(4)*F2(4)
+ DO 800 ICP=1,2
+ VE0= VE0+C61(ICP,0)*WP(1)+FI00L(ICP)*WP(2)
+ 2 +F0J0L(ICP)*WP(3)+C77(ICP,0)*WP(4)
+ 3 +C73(ICP,0)*WP(5)+C78(ICP,0)*WP(6)
+ 4 +C79(ICP,0)*WP(7)+FIJKL(ICP)*WP(8)
+ IF(ICP.EQ.1) THEN
+ DO 720 M=1,3
+ VES( M)= VES( M)+VEA( M)
+ VES(3+M)= VES(3+M)+VEA(3+M)
+ T01 = VEA(6+M)
+ T02 = VEA(9+M)
+ WES( M)=-T01+(T01+T02)*Y03
+ 720 CONTINUE
+ FE1= X24*VE0
+ DO 730 M=1,3
+ T01 = VEA( M)+VEA(3+M)
+ T02 = VEA(6+M)+VEA(9+M)
+ WES(3+M)=-T01+(T01+T02)*Z02
+ 730 CONTINUE
+ ENDIF
+ 800 CONTINUE
+ WES( M)= WES( M)+P34(M,3)*FE0
+ WES(3+M)= WES(3+M)-P1(M)*FE1
+ VES(6+M)= VES(6+M)+WES(3+M)
+ FCS(3,M)= FCS(3,M)-WES(3+M)*Y03+WES( M)
+ DO 925 M=1,3
+ T01= VES( M)
+ T02= VES(3+M)+VES(6+M)
+ T01=-T01+(T01+T02)*Y01+P12(M,3)*TMP
+ FCS(2,M)= FCS(2,M)-T01+VES(6+M)
+ 925 CONTINUE
+ END
diff --git a/gcc/testsuite/gfortran.dg/pr101158.f90 b/gcc/testsuite/gfortran.dg/pr101158.f90
new file mode 100644
index 0000000..9a4d9a2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101158.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-options "-O1 -ftree-slp-vectorize -fwrapv" }
+! { dg-additional-options "-march=armv8-a+sve" { target aarch64-*-* } }
+
+subroutine sprpl5 (left)
+ implicit none
+
+ integer :: left
+ integer :: avail1, avail2, delx1, delx2, i2, ic
+
+ ic = left
+ delx1 = ic / 2
+ delx2 = delx1 + 1
+ i2 = ic + delx2
+ avail1 = i2
+ avail2 = 1
+
+ do delx1 = 1, 2
+ ic = left + nint (real (left) / 2)
+ if (ic .ge. avail1) avail1 = ic + 1
+
+ i2 = ic + delx2
+ if (i2 .le. avail2) avail2 = i2 + 1
+ end do
+end subroutine sprpl5
diff --git a/gcc/testsuite/gfortran.dg/pr101264.f90 b/gcc/testsuite/gfortran.dg/pr101264.f90
new file mode 100644
index 0000000..5602a70
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101264.f90
@@ -0,0 +1,94 @@
+! { dg-do compile }
+! { dg-options "-Ofast" }
+ SUBROUTINE foo (a,b,c,d,trigs,inc1,inc2,inc3,inc4,lot,n,la)
+ IMPLICIT NONE (type, external)
+ INTEGER, PARAMETER :: wp = 8
+ INTEGER, PARAMETER :: iwp = 4
+ INTEGER(iwp) :: inc1
+ INTEGER(iwp) :: inc2
+ INTEGER(iwp) :: inc3
+ INTEGER(iwp) :: inc4
+ INTEGER(iwp) :: la
+ INTEGER(iwp) :: lot
+ INTEGER(iwp) :: n
+
+ REAL(wp) :: a(*)
+ REAL(wp) :: b(*)
+ REAL(wp) :: c(*)
+ REAL(wp) :: d(*)
+ REAL(wp) :: trigs(*)
+
+ REAL(wp) :: c1
+ REAL(wp) :: c2
+ REAL(wp) :: s1
+ REAL(wp) :: s2
+ REAL(wp) :: sin60
+
+ INTEGER(iwp) :: i
+ INTEGER(iwp) :: ia
+ INTEGER(iwp) :: ib
+ INTEGER(iwp) :: ibase
+ INTEGER(iwp) :: ic
+ INTEGER(iwp) :: iink
+ INTEGER(iwp) :: ijk
+ INTEGER(iwp) :: j
+ INTEGER(iwp) :: ja
+ INTEGER(iwp) :: jb
+ INTEGER(iwp) :: jbase
+ INTEGER(iwp) :: jc
+ INTEGER(iwp) :: jink
+ INTEGER(iwp) :: jump
+ INTEGER(iwp) :: k
+ INTEGER(iwp) :: kb
+ INTEGER(iwp) :: kc
+ INTEGER(iwp) :: kstop
+ INTEGER(iwp) :: l
+ INTEGER(iwp) :: m
+
+ sin60=0.866025403784437_wp
+
+ ia = 1
+ ib = ia + (2*m-la)*inc1
+ ic = ib
+ ja = 1
+ jb = ja + jink
+ jc = jb + jink
+
+ DO k = la, kstop, la
+ kb = k + k
+ kc = kb + kb
+ c1 = trigs(kb+1)
+ s1 = trigs(kb+2)
+ c2 = trigs(kc+1)
+ s2 = trigs(kc+2)
+ ibase = 0
+ DO l = 1, la
+ i = ibase
+ j = jbase
+ DO ijk = 1, lot
+ c(ja+j) = a(ia+i) + (a(ib+i)+a(ic+i))
+ d(ja+j) = b(ia+i) + (b(ib+i)-b(ic+i))
+ c(jb+j) = c1*((a(ia+i)-0.5_wp*(a(ib+i)+a(ic+i)))-(sin60*(b(ib+i)+ &
+ & b(ic+i)))) &
+ & - s1*((b(ia+i)-0.5_wp*(b(ib+i)-b(ic+i)))+(sin60*(a(ib+i)- &
+ & a(ic+i))))
+ d(jb+j) = s1*((a(ia+i)-0.5_wp*(a(ib+i)+a(ic+i)))-(sin60*(b(ib+i)+ &
+ & b(ic+i)))) &
+ & + c1*((b(ia+i)-0.5_wp*(b(ib+i)-b(ic+i)))+(sin60*(a(ib+i)- &
+ & a(ic+i))))
+ c(jc+j) = c2*((a(ia+i)-0.5_wp*(a(ib+i)+a(ic+i)))+(sin60*(b(ib+i)+ &
+ & b(ic+i)))) &
+ & - s2*((b(ia+i)-0.5_wp*(b(ib+i)-b(ic+i)))-(sin60*(a(ib+i)- &
+ & a(ic+i))))
+ i = i + inc3
+ j = j + inc4
+ END DO
+ ibase = ibase + inc1
+ jbase = jbase + inc2
+ END DO
+ ia = ia + iink
+ ib = ib + iink
+ ic = ic - iink
+ jbase = jbase + jump
+ END DO
+ END
diff --git a/gcc/testsuite/gfortran.dg/pr101267.f90 b/gcc/testsuite/gfortran.dg/pr101267.f90
new file mode 100644
index 0000000..12723cf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101267.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-Ofast" }
+! { dg-additional-options "-march=znver2" { target x86_64-*-* i?86-*-* } }
+ SUBROUTINE sfddagd( regime, znt,ite ,jte )
+ REAL, DIMENSION( ime, IN) :: regime, znt
+ REAL, DIMENSION( ite, jte) :: wndcor_u
+ LOGICAL wrf_dm_on_monitor
+ IF( int4 == 1 ) THEN
+ DO j=jts,jtf
+ DO i=itsu,itf
+ reg = regime(i, j)
+ IF( reg > 10.0 ) THEN
+ znt0 = znt(i-1, j) + znt(i, j)
+ IF( znt0 <= 0.2) THEN
+ wndcor_u(i,j) = 0.2
+ ENDIF
+ ENDIF
+ ENDDO
+ ENDDO
+ IF ( wrf_dm_on_monitor()) THEN
+ ENDIF
+ ENDIF
+ END
diff --git a/gcc/testsuite/gfortran.dg/pr101327.f90 b/gcc/testsuite/gfortran.dg/pr101327.f90
new file mode 100644
index 0000000..f4377aa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101327.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! PR fortran/101327 - ICE in find_array_element, at fortran/expr.c:1355
+
+subroutine s
+ integer, parameter :: n([2]) = [1, 2] ! { dg-error "must be scalar" }
+ type t
+ integer :: a(n(1):n(2))
+ end type
+end
+
+! { dg-error "cannot be automatic or of deferred shape" " " { target *-*-* } 5 }
diff --git a/gcc/testsuite/gfortran.dg/pr101514.f90 b/gcc/testsuite/gfortran.dg/pr101514.f90
new file mode 100644
index 0000000..51fbf8a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101514.f90
@@ -0,0 +1,35 @@
+! { dg-do compile }
+! PR fortran/101514 - ICE: out of memory allocating ... bytes
+
+subroutine s
+ type t1
+ integer :: a(..) ! { dg-error "must have an explicit shape" }
+ end type
+ type t2
+ integer :: a(*) ! { dg-error "must have an explicit shape" }
+ end type
+ type t3
+ integer :: a(:) ! { dg-error "must have an explicit shape" }
+ end type
+ type t4
+ integer :: a(0:) ! { dg-error "must have an explicit shape" }
+ end type
+ type t5
+ integer, allocatable :: a(:)
+ end type
+ type t6
+ integer, pointer :: a(:)
+ end type
+ type(t1) :: a1
+ type(t2) :: a2
+ type(t3) :: a3
+ type(t4) :: a4
+ type(t5) :: a5
+ type(t6) :: a6
+ a1 = transfer(1, a1)
+ a2 = transfer(1, a2)
+ a3 = transfer(1, a3)
+ a4 = transfer(1, a4)
+ a5 = transfer(1, a5)
+ a6 = transfer(1, a6)
+end
diff --git a/gcc/testsuite/gfortran.dg/pr101536.f90 b/gcc/testsuite/gfortran.dg/pr101536.f90
new file mode 100644
index 0000000..b16af00
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101536.f90
@@ -0,0 +1,33 @@
+! { dg-do compile }
+! PR fortran/101536 - ICE in gfc_conv_expr_descriptor
+
+program p
+ type s
+ class(*), allocatable :: c
+ end type
+ type t
+ class(*), allocatable :: c(:)
+ end type t
+ type u
+ integer :: c(2)
+ end type
+ type(t) :: x
+ x%c = [1,2,3,4]
+! print *, size (x)
+ print *, size (x%c)
+ print *, size (x%c(1)) ! { dg-error "must be an array" }
+contains
+ integer function f(x, y, z)
+ class(t), allocatable :: x(:)
+ class(u) :: y(:)
+ class(s) :: z
+ f = size (x)
+ f = size (x(1)) ! { dg-error "must be an array" }
+ f = size (y)
+ f = size (y%c(1))
+ f = size (y(2)%c)
+ f = size (y(2)%c(1)) ! { dg-error "must be an array" }
+ f = size (z) ! { dg-error "must be an array" }
+ f = size (z% c) ! { dg-error "must be an array" }
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/pr32599.f03 b/gcc/testsuite/gfortran.dg/pr32599.f03
index 297b75a..819a2b8 100644
--- a/gcc/testsuite/gfortran.dg/pr32599.f03
+++ b/gcc/testsuite/gfortran.dg/pr32599.f03
@@ -1,20 +1,20 @@
! { dg-do compile }
-! { dg-options "-std=f2008" }
+! { dg-options "-std=f2003" }
!
! PR fortran/32599
! Verifies that character string arguments to a bind(c) procedure have length
-! 1, or no len is specified. Note that the C interop extensions in F2018 allow
+! 1, or no len is specified. Note that the C interop extensions in F2008 allow
! string arguments of length greater than one to be passed to a C descriptor.
!
module pr32599
interface
- subroutine destroy(path) BIND(C) ! { dg-error "must be length 1" }
+ subroutine destroy(path) BIND(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'path' at .1. of procedure .destroy. with BIND\\(C\\) attribute" }
use iso_c_binding
implicit none
character(len=*,kind=c_char), intent(IN) :: path
end subroutine destroy
- subroutine create(path) BIND(C) ! { dg-error "must be length 1" }
+ subroutine create(path) BIND(C) ! { dg-error "Character dummy argument 'path' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'create' has the BIND\\(C\\) attribute" }
use iso_c_binding
implicit none
character(len=5,kind=c_char), intent(IN) :: path
diff --git a/gcc/testsuite/gfortran.dg/pr63797.f90 b/gcc/testsuite/gfortran.dg/pr63797.f90
new file mode 100644
index 0000000..1131e81
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr63797.f90
@@ -0,0 +1,60 @@
+! { dg-do compile }
+! PR63797 - Bogus ambiguous reference to 'sqrt'
+
+module mod1
+ implicit none
+ real, parameter :: z = sqrt (0.0)
+ real :: w = sqrt (1.0)
+ interface
+ pure real function sqrt_ifc (x)
+ real, intent(in) :: x
+ end function sqrt_ifc
+ end interface
+contains
+ pure function myroot () result (f)
+ procedure(sqrt_ifc), pointer :: f
+ intrinsic :: sqrt
+ f => sqrt
+ end function myroot
+end module mod1
+
+module mod2
+ implicit none
+ type t
+ real :: a = 0.
+ end type
+ interface sqrt
+ module procedure sqrt
+ end interface
+contains
+ elemental function sqrt (a)
+ type(t), intent(in) :: a
+ type(t) :: sqrt
+ sqrt% a = a% a
+ end function sqrt
+end module mod2
+
+module mod3
+ implicit none
+ abstract interface
+ function real_func (x)
+ real :: real_func
+ real, intent (in) :: x
+ end function real_func
+ end interface
+ intrinsic :: sqrt
+ procedure(real_func), pointer :: real_root => sqrt
+end module mod3
+
+program test
+ use mod1
+ use mod2
+ use mod3
+ implicit none
+ type(t) :: x, y
+ procedure(sqrt_ifc), pointer :: root
+ root => myroot ()
+ y = sqrt (x)
+ y% a = sqrt (x% a) + z - w + root (x% a)
+ y% a = real_root (x% a)
+end program test
diff --git a/gcc/testsuite/gfortran.dg/pr78033.f90 b/gcc/testsuite/gfortran.dg/pr78033.f90
index ce794b3..9593521 100644
--- a/gcc/testsuite/gfortran.dg/pr78033.f90
+++ b/gcc/testsuite/gfortran.dg/pr78033.f90
@@ -14,7 +14,7 @@ subroutine f(n, x, y)
y = [real(x), aimag(x)]
y = [real(x(1:n)), aimag(x(1:n))]
y = [real(knd) :: 1]
- y = [real(kind=42) :: 1] { dg-error "Invalid type-spec" }
+ y = [real(kind=42) :: 1] ! { dg-error "Invalid type-spec" }
y = [real(kind=knd) :: 1]
y = [real(kind=knd, a=1.)]
y = [real(a=1.)]
diff --git a/gcc/testsuite/gfortran.dg/pr82314.f90 b/gcc/testsuite/gfortran.dg/pr82314.f90
new file mode 100644
index 0000000..3a147e2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr82314.f90
@@ -0,0 +1,11 @@
+! { dg-do run }
+! PR fortran/82314 - ICE in gfc_conv_expr_descriptor
+
+program p
+ implicit none
+ integer, parameter :: karray(merge(3,7,.true.):merge(3,7,.false.)) = 1
+ integer, parameter :: i = size (karray)
+ integer, parameter :: l = lbound (karray,1)
+ integer, parameter :: u = ubound (karray,1)
+ if (l /= 3 .or. u /= 7 .or. i /= 5) stop 1
+end
diff --git a/gcc/testsuite/gfortran.dg/pr93524.c b/gcc/testsuite/gfortran.dg/pr93524.c
new file mode 100644
index 0000000..8a6c066
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr93524.c
@@ -0,0 +1,33 @@
+/* Test the fix for PR93524, in which CFI_allocate was computing
+ sm incorrectly for dimensions > 2. */
+
+#include <stdlib.h> // For size_t
+#include <ISO_Fortran_binding.h>
+
+void my_fortran_sub_1 (CFI_cdesc_t *dv);
+void my_fortran_sub_2 (CFI_cdesc_t *dv);
+
+int main ()
+{
+ CFI_CDESC_T (3) a;
+ CFI_cdesc_t *dv = (CFI_cdesc_t *) &a;
+ // dv, base_addr, attribute, type, elem_len, rank, extents
+ CFI_establish (dv, NULL, CFI_attribute_allocatable, CFI_type_float, 0, 3, NULL);
+
+ if (dv->base_addr != NULL)
+ return 1; // shall not be allocated
+
+ CFI_index_t lower_bounds[] = {-10, 0, 3};
+ CFI_index_t upper_bounds[] = {10, 5, 10};
+ size_t elem_len = 0; // only needed for strings
+ if (CFI_SUCCESS != CFI_allocate (dv, lower_bounds, upper_bounds, elem_len))
+ return 2;
+
+ if (!CFI_is_contiguous (dv))
+ return 2; // allocatables shall be contiguous,unless a strided section is used
+
+ my_fortran_sub_1 (dv);
+ my_fortran_sub_2 (dv);
+ CFI_deallocate (dv);
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/pr93524.f90 b/gcc/testsuite/gfortran.dg/pr93524.f90
new file mode 100644
index 0000000..0cebc8f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr93524.f90
@@ -0,0 +1,17 @@
+! { dg-additional-sources pr93524.c }
+! { dg-do run }
+!
+! Test the fix for PR93524. The main program is in pr93524.c.
+
+subroutine my_fortran_sub_1 (A) bind(C)
+ real :: A(:, :, :)
+ if (any (lbound(A) /= 1)) stop 1
+ if (any (ubound(A) /= [21,6,8])) stop 2
+ if (.not. is_contiguous (A)) stop 3
+end
+subroutine my_fortran_sub_2 (A) bind(C)
+ real, ALLOCATABLE :: A(:, :, :)
+ if (any (lbound(A) /= [-10,0,3])) stop 1
+ if (any (ubound(A) /= [10,5,10])) stop 2
+ if (.not. is_contiguous (A)) stop 3
+end subroutine my_fortran_sub_2
diff --git a/gcc/testsuite/gfortran.dg/pr95502.f90 b/gcc/testsuite/gfortran.dg/pr95502.f90
new file mode 100644
index 0000000..d40fd9a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95502.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/95502 - ICE in gfc_check_do_variable, at fortran/parse.c:4446
+
+program p
+ integer, pointer :: z
+ nullify (z%kind) ! { dg-error "in variable definition context" }
+ z%kind => NULL() ! { dg-error "constant expression" }
+end
diff --git a/gcc/testsuite/gfortran.dg/pr96325.f90 b/gcc/testsuite/gfortran.dg/pr96325.f90
index 62f4cfb..b6a86e8 100644
--- a/gcc/testsuite/gfortran.dg/pr96325.f90
+++ b/gcc/testsuite/gfortran.dg/pr96325.f90
@@ -15,7 +15,7 @@
type(t2) :: t
integer :: a
- a = t%r1%foo(1) { dg-error "is not an inquiry reference" }
+ a = t%r1%foo(1) ! { dg-error "is not an inquiry reference" }
if (a == 42) stop
end
diff --git a/gcc/testsuite/gfortran.dg/pr96711.f90 b/gcc/testsuite/gfortran.dg/pr96711.f90
index 3761a8e..3fa5d99 100644
--- a/gcc/testsuite/gfortran.dg/pr96711.f90
+++ b/gcc/testsuite/gfortran.dg/pr96711.f90
@@ -10,10 +10,12 @@ program p
implicit none
real(8) :: x
real(16) :: y
+ ! Assume radix(x) == 2
+ ! 2/epsilon(x) = 2/(radix(x)**(1-digits(x)) = 2**digits(x) with that assumption
integer(16), parameter :: k1 = nint (2 / epsilon (x), kind(k1))
integer(16), parameter :: k2 = nint (2 / epsilon (y), kind(k2))
- integer(16), parameter :: m1 = 9007199254740992_16 !2**53
- integer(16), parameter :: m2 = 10384593717069655257060992658440192_16 !2**113
+ integer(16), parameter :: m1 = 2_16**digits(x) ! IEEE: 2**53
+ integer(16), parameter :: m2 = 2_16**digits(y) ! IEEE: 2**113
integer(16), volatile :: m
x = 2 / epsilon (x)
y = 2 / epsilon (y)
diff --git a/gcc/testsuite/gfortran.dg/pr98411.f90 b/gcc/testsuite/gfortran.dg/pr98411.f90
new file mode 100644
index 0000000..7c906a9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr98411.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-std=f2008 -Wall -fautomatic -fmax-stack-var-size=100" }
+! PR fortran/98411 - Pointless warning for static variables
+
+module try
+ implicit none
+ integer, save :: a(1000)
+contains
+ subroutine initmodule
+ real, save :: b(1000)
+ logical :: c(1000) ! { dg-warning "moved from stack to static storage" }
+ integer :: e(1000) = 1
+ a(1) = 42
+ b(2) = 3.14
+ c(3) = .true.
+ e(5) = -1
+ end subroutine initmodule
+end module try
diff --git a/gcc/testsuite/gfortran.dg/pr99602.f90 b/gcc/testsuite/gfortran.dg/pr99602.f90
new file mode 100644
index 0000000..6c8455b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr99602.f90
@@ -0,0 +1,94 @@
+! { dg-do compile }
+! { dg-options "-fcheck=pointer -fdump-tree-original" }
+!
+! Test fix of PR99602, where a spurious runtime error was introduced
+! by PR99112. This is the testcase in comment #6 of the PR.
+! PR99602a.f90 turns on the runtime errors by eliminating the pointer
+! attribute from the formal arguments in the abstract interface and
+! prepare_whizard_m2.
+!
+! Contributed by Jeurgen Reuter <juergen.reuter@desy.de>
+!
+module m
+ implicit none
+ private
+ public :: m_t
+ type :: m_t
+ private
+ end type m_t
+end module m
+
+module m2_testbed
+ use m
+ implicit none
+ private
+ public :: prepare_m2
+ procedure (prepare_m2_proc), pointer :: prepare_m2 => null ()
+
+ abstract interface
+ subroutine prepare_m2_proc (m2)
+ import
+ class(m_t), intent(inout), pointer :: m2
+ end subroutine prepare_m2_proc
+ end interface
+
+end module m2_testbed
+
+module a
+ use m
+ use m2_testbed, only: prepare_m2
+ implicit none
+ private
+ public :: a_1
+
+contains
+
+ subroutine a_1 ()
+ class(m_t), pointer :: mm
+ mm => null ()
+ call prepare_m2 (mm) ! Runtime error triggered here
+ end subroutine a_1
+
+end module a
+
+
+module m2
+ use m
+ implicit none
+ private
+ public :: m2_t
+
+ type, extends (m_t) :: m2_t
+ private
+ contains
+ procedure :: read => m2_read
+ end type m2_t
+contains
+
+ subroutine m2_read (mm)
+ class(m2_t), intent(out), target :: mm
+ end subroutine m2_read
+end module m2
+
+program main
+ use m2_testbed
+ use a, only: a_1
+ implicit none
+ prepare_m2 => prepare_whizard_m2
+ call a_1 ()
+
+contains
+
+ subroutine prepare_whizard_m2 (mm)
+ use m
+ use m2
+ class(m_t), intent(inout), pointer :: mm
+ if (.not. associated (mm)) allocate (m2_t :: mm)
+ select type (mm)
+ type is (m2_t)
+! call mm%read () ! Since mm is passed to non-pointer, this generates the error code.
+ end select
+ end subroutine prepare_whizard_m2
+end program main
+! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 0 "original" } }
+! { dg-final { scan-tree-dump-times "Pointer actual argument" 0 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr99602a.f90 b/gcc/testsuite/gfortran.dg/pr99602a.f90
new file mode 100644
index 0000000..45063e4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr99602a.f90
@@ -0,0 +1,93 @@
+! { dg-do compile }
+! { dg-options "-fcheck=pointer -fdump-tree-original" }
+!
+! Test fix of PR99602, where a spurious runtime error was introduced
+! by PR99112. This is the testcase in comment #6 of the PR.
+! This version of PR99602.f90 turns on the runtime errors by eliminating
+! the pointer attribute from the formal arguments in the abstract interface
+! and prepare_whizard_m2.
+!
+! Contributed by Jeurgen Reuter <juergen.reuter@desy.de>
+!
+module m
+ implicit none
+ private
+ public :: m_t
+ type :: m_t
+ private
+ end type m_t
+end module m
+
+module m2_testbed
+ use m
+ implicit none
+ private
+ public :: prepare_m2
+ procedure (prepare_m2_proc), pointer :: prepare_m2 => null ()
+
+ abstract interface
+ subroutine prepare_m2_proc (m2)
+ import
+ class(m_t), intent(inout) :: m2
+ end subroutine prepare_m2_proc
+ end interface
+
+end module m2_testbed
+
+module a
+ use m
+ use m2_testbed, only: prepare_m2
+ implicit none
+ private
+ public :: a_1
+
+contains
+
+ subroutine a_1 ()
+ class(m_t), pointer :: mm
+ mm => null ()
+ call prepare_m2 (mm) ! Runtime error triggered here
+ end subroutine a_1
+
+end module a
+
+
+module m2
+ use m
+ implicit none
+ private
+ public :: m2_t
+
+ type, extends (m_t) :: m2_t
+ private
+ contains
+ procedure :: read => m2_read
+ end type m2_t
+contains
+
+ subroutine m2_read (mm)
+ class(m2_t), intent(out), target :: mm
+ end subroutine m2_read
+end module m2
+
+program main
+ use m2_testbed
+ use a, only: a_1
+ implicit none
+ prepare_m2 => prepare_whizard_m2
+ call a_1 ()
+
+contains
+
+ subroutine prepare_whizard_m2 (mm)
+ use m
+ use m2
+ class(m_t), intent(inout) :: mm
+ select type (mm)
+ type is (m2_t)
+ call mm%read ()
+ end select
+ end subroutine prepare_whizard_m2
+end program main
+! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 1 "original" } }
+! { dg-final { scan-tree-dump-times "Pointer actual argument" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr99602b.f90 b/gcc/testsuite/gfortran.dg/pr99602b.f90
new file mode 100644
index 0000000..ba6d5b6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr99602b.f90
@@ -0,0 +1,64 @@
+! { dg-do run }
+! { dg-options "-fcheck=pointer" }
+!
+! Test the fix for PR99602 in which the runtime error,
+! "Proc-pointer actual argument 'model' is not associated" was triggered
+! by the NULL result from model%get_par_data_ptr ("tea ")
+!
+! Contributed by Juergen Reuter <juergen.reuter@desy.de>
+!
+module model_data
+ type :: model_data_t
+ type(modelpar_real_t), dimension(:), pointer :: par_real => null ()
+ contains
+ procedure :: get_par_data_ptr => model_data_get_par_data_ptr_name
+ procedure :: set => field_data_set
+ end type model_data_t
+
+ type :: modelpar_real_t
+ character (4) :: name
+ real(4) :: value
+ end type modelpar_real_t
+
+ type(modelpar_real_t), target :: names(2) = [modelpar_real_t("foo ", 1.0), &
+ modelpar_real_t("bar ", 2.0)]
+ integer :: return_value = 0
+
+contains
+
+ function model_data_get_par_data_ptr_name (model, name) result (ptr)
+ class(model_data_t), intent(in) :: model
+ character (*), intent(in) :: name
+ class(modelpar_real_t), pointer :: ptr
+ integer :: i
+ ptr => null ()
+ do i = 1, size (model%par_real)
+ if (model%par_real(i)%name == name) ptr => model%par_real(i)
+ end do
+ end function model_data_get_par_data_ptr_name
+
+ subroutine field_data_set (this, ptr)
+ class(model_data_t), intent(inout) :: this
+ class(modelpar_real_t), intent(in), pointer :: ptr
+ if (associated (ptr)) then
+ return_value = int (ptr%value)
+ else
+ return_value = -1
+ end if
+ end subroutine
+
+end module model_data
+
+ use model_data
+ class(model_data_t), allocatable :: model
+ class(modelpar_real_t), pointer :: name_ptr
+
+ allocate (model_data_t :: model)
+ model%par_real => names
+
+ call model%set (model%get_par_data_ptr ("bar "))
+ if (return_value .ne. 2) stop 1
+ call model%set (model%get_par_data_ptr ("tea ")) ! Triggered runtime error
+ if (return_value .ne. -1) stop 2
+end
+
diff --git a/gcc/testsuite/gfortran.dg/pr99602c.f90 b/gcc/testsuite/gfortran.dg/pr99602c.f90
new file mode 100644
index 0000000..d16c9ff
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr99602c.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-options "-fcheck=pointer -fdump-tree-original" }
+!
+! PR fortran/99602
+!
+
+module m
+ implicit none
+contains
+ subroutine wr(y)
+ class(*), pointer :: y
+ if (associated (y)) stop 1
+ end
+end module m
+
+use m
+implicit none
+class(*), pointer :: cptr
+
+nullify (cptr)
+call wr(cptr)
+end
+
+! { dg-final { scan-tree-dump-not "_gfortran_runtime_error_at" "original" } }
+! { dg-final { scan-tree-dump-not "Pointer actual argument" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr99602d.f90 b/gcc/testsuite/gfortran.dg/pr99602d.f90
new file mode 100644
index 0000000..d16c9ff
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr99602d.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-options "-fcheck=pointer -fdump-tree-original" }
+!
+! PR fortran/99602
+!
+
+module m
+ implicit none
+contains
+ subroutine wr(y)
+ class(*), pointer :: y
+ if (associated (y)) stop 1
+ end
+end module m
+
+use m
+implicit none
+class(*), pointer :: cptr
+
+nullify (cptr)
+call wr(cptr)
+end
+
+! { dg-final { scan-tree-dump-not "_gfortran_runtime_error_at" "original" } }
+! { dg-final { scan-tree-dump-not "Pointer actual argument" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr99956.f b/gcc/testsuite/gfortran.dg/pr99956.f
new file mode 100644
index 0000000..b5c0be3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr99956.f
@@ -0,0 +1,45 @@
+! { dg-do compile }
+! { dg-options "-O3 -ffast-math -floop-interchange -fdump-tree-linterchange-details" }
+
+ subroutine mat_times_vec(y,x,a,axp,ayp,azp,axm,aym,azm,
+ $ nb,nx,ny,nz)
+ implicit none
+ integer nb,nx,ny,nz,i,j,k,m,l,kit,im1,ip1,jm1,jp1,km1,kp1
+
+ real*8 y(nb,nx,ny,nz),x(nb,nx,ny,nz),tem
+
+ real*8 a(nb,nb,nx,ny,nz),
+ 1 axp(nb,nb,nx,ny,nz),ayp(nb,nb,nx,ny,nz),azp(nb,nb,nx,ny,nz),
+ 2 axm(nb,nb,nx,ny,nz),aym(nb,nb,nx,ny,nz),azm(nb,nb,nx,ny,nz)
+
+
+ do k=1,nz
+ km1=mod(k+nz-2,nz)+1
+ kp1=mod(k,nz)+1
+ do j=1,ny
+ jm1=mod(j+ny-2,ny)+1
+ jp1=mod(j,ny)+1
+ do i=1,nx
+ im1=mod(i+nx-2,nx)+1
+ ip1=mod(i,nx)+1
+ do l=1,nb
+ tem=0.0
+ do m=1,nb
+ tem=tem+
+ 1 a(l,m,i,j,k)*x(m,i,j,k)+
+ 2 axp(l,m,i,j,k)*x(m,ip1,j,k)+
+ 3 ayp(l,m,i,j,k)*x(m,i,jp1,k)+
+ 4 azp(l,m,i,j,k)*x(m,i,j,kp1)+
+ 5 axm(l,m,i,j,k)*x(m,im1,j,k)+
+ 6 aym(l,m,i,j,k)*x(m,i,jm1,k)+
+ 7 azm(l,m,i,j,k)*x(m,i,j,km1)
+ enddo
+ y(l,i,j,k)=tem
+ enddo
+ enddo
+ enddo
+ enddo
+ return
+ end
+
+! { dg-final { scan-tree-dump-times "is interchanged" 1 "linterchange" } }
diff --git a/gcc/testsuite/gfortran.dg/ptr-func-4.f90 b/gcc/testsuite/gfortran.dg/ptr-func-4.f90
new file mode 100644
index 0000000..62b18f6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ptr-func-4.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! { dg-options "-O2 -std=f2008" }
+! PR fortran/100218 - target of pointer from evaluation of function-reference
+
+program p
+ implicit none
+ integer, target :: z = 0
+ call g (f ())
+ if (z /= 1) stop 1
+contains
+ function f () result (r)
+ integer, pointer :: r
+ r => z
+ end function f
+ subroutine g (x)
+ integer, intent(out) :: x
+ x = 1
+ end subroutine g
+end program p
diff --git a/gcc/testsuite/gfortran.dg/set_vm_limit.c b/gcc/testsuite/gfortran.dg/set_vm_limit.c
index 30c4b43..8344f6f 100644
--- a/gcc/testsuite/gfortran.dg/set_vm_limit.c
+++ b/gcc/testsuite/gfortran.dg/set_vm_limit.c
@@ -8,9 +8,20 @@
void
set_vm_limit (int vm_limit)
{
- struct rlimit rl = { vm_limit, RLIM_INFINITY };
+ struct rlimit rl;
int r;
+ r = getrlimit (RLIMIT_AS, &rl);
+ if (r)
+ {
+ perror ("get_vm_limit");
+ exit (1);
+ }
+
+ if (vm_limit >= rl.rlim_cur)
+ return;
+
+ rl.rlim_cur = vm_limit;
r = setrlimit (RLIMIT_AS, &rl);
if (r)
{
diff --git a/gcc/testsuite/substr_10.f90 b/gcc/testsuite/gfortran.dg/substr_10.f90
index 918ca8a..918ca8a 100644
--- a/gcc/testsuite/substr_10.f90
+++ b/gcc/testsuite/gfortran.dg/substr_10.f90
diff --git a/gcc/testsuite/gfortran.dg/substr_6.f90 b/gcc/testsuite/gfortran.dg/substr_6.f90
index 0d5e3d7..83e788a 100644
--- a/gcc/testsuite/gfortran.dg/substr_6.f90
+++ b/gcc/testsuite/gfortran.dg/substr_6.f90
@@ -6,6 +6,8 @@ CHARACTER(5), parameter :: c0(1) = (/ "123" // ACHAR(0) // "5" /)
CHARACTER*5 c(1)
CHARACTER(1), parameter :: c1(5) = (/ "1", "2", "3", ACHAR(0), "5" /)
+c = c0(1)(-5:-8)
+if (c(1) /= " ") STOP 1
c = (/ c0(1)(1:5) /)
do i=1,5
if (c(1)(i:i) /= c1(i)) STOP 2
diff --git a/gcc/testsuite/substr_9.f90 b/gcc/testsuite/gfortran.dg/substr_9.f90
index 73152d6..73152d6 100644
--- a/gcc/testsuite/substr_9.f90
+++ b/gcc/testsuite/gfortran.dg/substr_9.f90
diff --git a/gcc/testsuite/gfortran.dg/transpose_5.f90 b/gcc/testsuite/gfortran.dg/transpose_5.f90
new file mode 100644
index 0000000..ed4b643
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/transpose_5.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! { dg-options "-O2" }
+! PR fortran/99840 - ICE in gfc_simplify_matmul, at fortran/simplify.c:4777
+program p
+ integer, parameter :: x(0,0) = 0
+ integer :: y(0,0)
+ y = matmul (x, transpose(x))
+end
diff --git a/gcc/testsuite/gfortran.dg/ubsan/pr101624.f90 b/gcc/testsuite/gfortran.dg/ubsan/pr101624.f90
new file mode 100644
index 0000000..51783c8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ubsan/pr101624.f90
@@ -0,0 +1,13 @@
+! PR middle-end/101624
+! { dg-do compile }
+! { dg-options "-O2 -fsanitize=undefined" }
+
+complex function foo (x)
+ complex, intent(in) :: x
+ foo = aimag (x)
+end
+program pr101624
+ complex, parameter :: a = (0.0, 1.0)
+ complex :: b, foo
+ b = foo (a)
+end
diff --git a/gcc/testsuite/gfortran.dg/ubsan/ubsan.exp b/gcc/testsuite/gfortran.dg/ubsan/ubsan.exp
new file mode 100644
index 0000000..e44d946
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ubsan/ubsan.exp
@@ -0,0 +1,38 @@
+# Copyright (C) 2021 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite for gfortran that checks undefined behavior sanitizer.
+
+# Load support procs.
+load_lib gfortran-dg.exp
+load_lib ubsan-dg.exp
+
+
+# Initialize `dg'.
+dg-init
+ubsan_init
+
+# Main loop.
+if [check_effective_target_fsanitize_undefined] {
+ gfortran-dg-runtest [lsort \
+ [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" ""
+}
+
+# All done.
+ubsan_finish
+dg-finish
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_33.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_33.f90
new file mode 100644
index 0000000..8bb8864
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_33.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR fortran/101349 - ICE in gfc_get_descriptor_field
+! Check constraint F2008:C628 / F2018:C932
+
+subroutine s(x)
+ class(*) :: x(:)
+ allocate (x, source=['abc']) ! { dg-error "must be ALLOCATABLE or a POINTER" }
+end
+
+subroutine t(x)
+ class(*), allocatable :: x(:)
+ allocate (x, source=['abc'])
+end
+
+subroutine u(x)
+ class(*), pointer :: x(:)
+ allocate (x, source=['abc'])
+end
diff --git a/gcc/testsuite/gfortran.dg/vect/pr100981-1.f90 b/gcc/testsuite/gfortran.dg/vect/pr100981-1.f90
new file mode 100644
index 0000000..6f11121
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr100981-1.f90
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-additional-options "-O3 -ftree-parallelize-loops=2 -fno-signed-zeros -fno-trapping-math" }
+! { dg-additional-options "-march=armv8.3-a" { target aarch64*-*-* } }
+
+complex function cdcdot(n, cx)
+ implicit none
+
+ integer :: n, i, kx
+ complex :: cx(*)
+ double precision :: dsdotr, dsdoti, dt1, dt3
+
+ kx = 1
+ do i = 1, n
+ dt1 = real(cx(kx))
+ dt3 = aimag(cx(kx))
+ dsdotr = dsdotr + dt1 * 2 - dt3 * 2
+ dsdoti = dsdoti + dt1 * 2 + dt3 * 2
+ kx = kx + 1
+ end do
+ cdcdot = cmplx(real(dsdotr), real(dsdoti))
+ return
+end function cdcdot
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99656.f90 b/gcc/testsuite/gfortran.dg/vect/pr99656.f90
new file mode 100644
index 0000000..59a28ee
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99656.f90
@@ -0,0 +1,24 @@
+! { dg-do compile { target { aarch64*-*-* } } }
+! { dg-require-effective-target le }
+! { dg-additional-options "-march=armv8.3-a -O1 -ftree-slp-vectorize" }
+
+SUBROUTINE ZLAHQR2(H, LDH, H22, T1)
+
+ INTEGER LDH
+ COMPLEX*16 H(LDH, *)
+
+ INTEGER NR
+ COMPLEX*16 H22, SUM, T1, V2
+
+ COMPLEX*16 V( 3 )
+
+ EXTERNAL ZLARFG
+ INTRINSIC DCONJG
+
+ V2 = H22
+ CALL ZLARFG(T1)
+ SUM = DCONJG(T1) * H(1, 1)
+ H(1, 1) = SUM * V2
+
+ RETURN
+END
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99721.f90 b/gcc/testsuite/gfortran.dg/vect/pr99721.f90
new file mode 100644
index 0000000..651e86a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99721.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-additional-options "-O3" }
+! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } }
+subroutine sub_c
+ complex, dimension(2,3) :: at
+ complex, dimension(2,4) :: b
+ complex, dimension(3,4) :: c
+ data b / (41., 43.), 0, 0, 0, 0, 0, 0, 0/
+ c = matmul(transpose(at), b)
+ if (any (c /= cres)) stop
+end subroutine sub_c
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99746.f90 b/gcc/testsuite/gfortran.dg/vect/pr99746.f90
new file mode 100644
index 0000000..fe947ae
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99746.f90
@@ -0,0 +1,45 @@
+! { dg-do compile }
+! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } }
+SUBROUTINE CLAREF(A, WANTZ, Z, ICOL1, ITMP1, ITMP2, T1, T2, V2)
+LOGICAL BLOCK, WANTZ
+COMPLEX T1, T2, V2
+COMPLEX A(LDA, *), VECS, Z(LDA, *)
+COMPLEX SUM
+LOGICAL LSAME
+IF (LSAME) THEN
+ DO 30 K = ITMP1, ITMP2, 3
+ T1 = VECS0
+30 CONTINUE
+ELSE
+ IF (BLOCK) THEN
+ DO 90 K = ITMP1, ITMP2 - 1, 3
+ A(J, ICOL1) = ITMP1
+ IF (WANTZ) THEN
+ DO 80 J = ITMP1, ITMP2
+ SUM = ICOL1
+ Z(J, 3) = V23
+80 CONTINUE
+ END IF
+90 CONTINUE
+ DO 120 K = ITMP1, ITMP2
+ V2 = VECS()
+ DO 100 J = ITMP1, ITMP2
+ A(J, ICOL1) = A(J, ICOL1) - SUM
+100 CONTINUE
+ IF (WANTZ) THEN
+ DO 110 J = 1, 3
+ SUM = Z(J, ICOL1)
+ Z(J, ICOL1) = 0
+110 CONTINUE
+ END IF
+ ICOL1 = ICOL1 + 1
+120 CONTINUE
+ ELSE
+ DO 130 J = ITMP1, ITMP2
+ SUM = T1 * A(J, ICOL1) + T2 * A(J, 1) + V2 * A(J, 2)
+ A(J, ICOL1) = SUM
+ A(J, ICOL1 + 2) = SUM * V1
+130 CONTINUE
+ END IF
+END IF
+END
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99807.f90 b/gcc/testsuite/gfortran.dg/vect/pr99807.f90
new file mode 100644
index 0000000..4ab46a3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99807.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } }
+
+subroutine cppco(ap, z)
+ implicit none
+ complex :: ap(*), z(*)
+
+ z(1) = z(1) + z(2) * (ap(1))
+
+ return
+end subroutine cppco
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99825.f90 b/gcc/testsuite/gfortran.dg/vect/pr99825.f90
new file mode 100644
index 0000000..b1423df
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99825.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-additional-options "-march=armv8.3-a -O3" { target { aarch64*-*-* } } }
+
+program main
+ complex, dimension(3, 2) :: a
+ complex, dimension(2, 4) :: b
+ complex, dimension(3, 4) :: c, res1
+
+ data a /0, (-5., -7.), (11., -13.), 0, 0, 0/
+ data b /0, 0, 0, 0, 0, 0, 0, 0/
+ data res1 /0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/
+
+ c = matmul(a, conjg(b))
+ if (any(res1 /= c)) stop 2
+end program main
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99924.f90 b/gcc/testsuite/gfortran.dg/vect/pr99924.f90
new file mode 100644
index 0000000..f271ea1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99924.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } }
+subroutine cunhj (tfn, asum, bsum)
+ implicit none
+ complex :: up, tfn, asum, bsum
+ real :: ar
+
+ up = tfn * ar
+ bsum = up + ar
+ asum = up + asum
+ return
+end subroutine cunhj
diff --git a/gcc/testsuite/gfortran.dg/vect/vect-8.f90 b/gcc/testsuite/gfortran.dg/vect/vect-8.f90
index b10c4fc..c8a7d89 100644
--- a/gcc/testsuite/gfortran.dg/vect/vect-8.f90
+++ b/gcc/testsuite/gfortran.dg/vect/vect-8.f90
@@ -704,6 +704,6 @@ CALL track('KERNEL ')
RETURN
END SUBROUTINE kernel
-! { dg-final { scan-tree-dump-times "vectorized 23 loops" 1 "vect" { target aarch64*-*-* } } }
-! { dg-final { scan-tree-dump-times "vectorized 2\[23\] loops" 1 "vect" { target { vect_intdouble_cvt && { ! aarch64*-*-* } } } } }
+! { dg-final { scan-tree-dump-times "vectorized 24 loops" 1 "vect" { target aarch64*-*-* } } }
+! { dg-final { scan-tree-dump-times "vectorized 2\[234\] loops" 1 "vect" { target { vect_intdouble_cvt && { ! aarch64*-*-* } } } } }
! { dg-final { scan-tree-dump-times "vectorized 17 loops" 1 "vect" { target { { ! vect_intdouble_cvt } && { ! aarch64*-*-* } } } } }
diff --git a/gcc/testsuite/gnat.dg/bit_packed_array6.adb b/gcc/testsuite/gnat.dg/bit_packed_array6.adb
new file mode 100644
index 0000000..84f7a4b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/bit_packed_array6.adb
@@ -0,0 +1,10 @@
+-- { dg-do run }
+-- { dg-options "-O2 -gnata -gnatVa" }
+
+with Bit_Packed_Array6_Pkg; use Bit_Packed_Array6_Pkg;
+
+procedure Bit_Packed_Array6 is
+ B : constant Boolean := Everywhere (K_Configuration);
+begin
+ null;
+end;
diff --git a/gcc/testsuite/gnat.dg/bit_packed_array6_pkg.ads b/gcc/testsuite/gnat.dg/bit_packed_array6_pkg.ads
new file mode 100644
index 0000000..4eb1516
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/bit_packed_array6_pkg.ads
@@ -0,0 +1,13 @@
+package Bit_Packed_Array6_Pkg is
+
+ type Project_Kind is
+ (K_Configuration, K_Abstract,
+ K_Standard, K_Library, K_Aggregate, K_Aggregate_Library);
+
+ type Projects_Kind is array (Project_Kind) of Boolean
+ with Pack,
+ Dynamic_Predicate => Projects_Kind /= (Project_Kind => False);
+
+ Everywhere : constant Projects_Kind := (others => True);
+
+end Bit_Packed_Array6_Pkg;
diff --git a/gcc/testsuite/gnat.dg/containers2.adb b/gcc/testsuite/gnat.dg/containers2.adb
new file mode 100644
index 0000000..9c5dc0f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/containers2.adb
@@ -0,0 +1,158 @@
+-- { dg-do run }
+-- { dg-options "-gnata" }
+
+with Ada.Strings.Hash;
+with Ada.Containers.Hashed_Sets;
+with Ada.Containers.Hashed_Maps;
+with Ada.Containers.Indefinite_Hashed_Sets;
+with Ada.Containers.Indefinite_Hashed_Maps;
+
+procedure Containers2 is
+ -- Check that Cursors of the hashed containers follow the correct
+ -- predefined equality rules - that two Cursors to the same element
+ -- are equal, one one is obtained through, for example, iteration,
+ -- and the other is obtained through a search
+
+ subtype Definite_Name is String (1 .. 5);
+
+ type Named_Item is
+ record
+ Name : Definite_Name;
+ Item : Integer := 0;
+ end record;
+
+
+ function Equivalent_Item (Left, Right: Named_Item) return Boolean
+ is (Left.Name = Right.Name);
+
+ function DI_Hash (Item: Named_Item) return Ada.Containers.Hash_Type
+ is (Ada.Strings.Hash (Item.Name));
+
+ package HS is new Ada.Containers.Hashed_Sets
+ (Element_Type => Named_Item,
+ Hash => DI_Hash,
+ Equivalent_Elements => Equivalent_Item);
+
+ package IHS is new Ada.Containers.Indefinite_Hashed_Sets
+ (Element_Type => Named_Item,
+ Hash => DI_Hash,
+ Equivalent_Elements => Equivalent_Item);
+
+ package HM is new Ada.Containers.Hashed_Maps
+ (Key_Type => Definite_Name,
+ Element_Type => Integer,
+ Hash => Ada.Strings.Hash,
+ Equivalent_Keys => "=");
+
+ package IHM is new Ada.Containers.Indefinite_Hashed_Maps
+ (Key_Type => Definite_Name,
+ Element_Type => Integer,
+ Hash => Ada.Strings.Hash,
+ Equivalent_Keys => "=");
+
+ Item_Data : constant array (1 .. 5) of Named_Item
+ := ((Name => "ABCDE", others => <>),
+ (Name => "FGHIJ", others => <>),
+ (Name => "KLMNO", others => <>),
+ (Name => "PQRST", others => <>),
+ (Name => "UVWXY", others => <>));
+
+ use type HS.Cursor;
+ use type IHS.Cursor;
+ use type HM.Cursor;
+ use type IHM.Cursor;
+
+ type HS_Cursor_Vec is array (Item_Data'Range) of HS.Cursor;
+ type IHS_Cursor_Vec is array (Item_Data'Range) of IHS.Cursor;
+ type HM_Cursor_Vec is array (Item_Data'Range) of HM.Cursor;
+ type IHM_Cursor_Vec is array (Item_Data'Range) of IHM.Cursor;
+
+ HSC : HS.Set;
+ IHSC : IHS.Set;
+ HMC : HM.Map;
+ IHMC : IHM.Map;
+
+ HS_Create_Cursors : HS_Cursor_Vec;
+ IHS_Create_Cursors : IHS_Cursor_Vec;
+ HM_Create_Cursors : HM_Cursor_Vec;
+ IHM_Create_Cursors : IHM_Cursor_Vec;
+
+ HS_Index : HS.Cursor;
+ IHS_Index : IHS.Cursor;
+ HM_Index : HM.Cursor;
+ IHM_Index : IHM.Cursor;
+
+ HS_Find : HS.Cursor;
+ IHS_Find : IHS.Cursor;
+ HM_Find : HM.Cursor;
+ IHM_Find : IHM.Cursor;
+
+
+ Inserted : Boolean;
+
+begin
+
+ for I in Item_Data'Range loop
+ HSC.Insert (New_Item => Item_Data(I),
+ Position => HS_Create_Cursors(I),
+ Inserted => Inserted);
+
+ pragma Assert (Inserted);
+
+
+ IHSC.Insert (New_Item => Item_Data(I),
+ Position => IHS_Create_Cursors(I),
+ Inserted => Inserted);
+
+ pragma Assert (Inserted);
+
+ HMC.Insert (New_Item => Item_Data(I).Item,
+ Key => Item_Data(I).Name,
+ Position => HM_Create_Cursors(I),
+ Inserted => Inserted);
+
+ pragma Assert (Inserted);
+
+ IHMC.Insert (New_Item => Item_Data(I).Item,
+ Key => Item_Data(I).Name,
+ Position => IHM_Create_Cursors(I),
+ Inserted => Inserted);
+
+ pragma Assert (Inserted);
+
+ end loop;
+
+ HS_Index := HSC.First;
+ IHS_Index := IHSC.First;
+ HM_Index := HMC.First;
+ IHM_Index := IHMC.First;
+
+ for I in Item_Data'Range loop
+ pragma Assert (HS.Has_Element (HS_Index));
+ pragma Assert (IHS.Has_Element (IHS_Index));
+ pragma Assert (HM.Has_Element (HM_Index));
+ pragma Assert (IHM.Has_Element (IHM_Index));
+
+ HS_Find := HSC.Find (Item_Data(I));
+ pragma Assert (HS_Create_Cursors(I) = HS_Index);
+ pragma Assert (HS_Find = HS_Index);
+
+ IHS_Find := IHSC.Find (Item_Data(I));
+ pragma Assert (IHS_Create_Cursors(I) = IHS_Index);
+ pragma Assert (IHS_Find = IHS_Index);
+
+ HM_Find := HMC.Find (Item_Data(I).Name);
+ pragma Assert (HM_Create_Cursors(I) = HM_Index);
+ pragma Assert (HM_Find = HM_Index);
+
+ IHM_Find := IHMC.Find (Item_Data(I).Name);
+ pragma Assert (IHM_Create_Cursors(I) = IHM_Index);
+ pragma Assert (IHM_Find = IHM_Index);
+
+ HS.Next (HS_Index);
+ IHS.Next (IHS_Index);
+ HM.Next (HM_Index);
+ IHM.Next (IHM_Index);
+ end loop;
+
+end;
diff --git a/gcc/testsuite/gnat.dg/debug11.adb b/gcc/testsuite/gnat.dg/debug11.adb
index 26db5db..0fd9e36 100644
--- a/gcc/testsuite/gnat.dg/debug11.adb
+++ b/gcc/testsuite/gnat.dg/debug11.adb
@@ -1,14 +1,11 @@
--- { dg-do compile }
--- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
--- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
+-- { dg-do compile }
+-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
+-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
--
--- This testcase checks that in the DWARF description of the variant type
--- below, the C discriminant is properly described as unsigned, hence the 0x5a
--- ('Z') and 0x80 (128) values in the DW_AT_discr_list attribute. If it was
--- described as signed, we would have instead 90 and -128.
---
--- { dg-final { scan-assembler-times "0x5a.*DW_AT_discr_list" 1 } }
--- { dg-final { scan-assembler-times "0x80.*DW_AT_discr_list" 1 } }
+-- This testcase checks that in the DWARF description of the variant type
+-- below, the C discriminant is properly described as unsigned, hence the 0x5a
+-- ('Z') and 0x80 (128) values in the DW_AT_discr_list attribute. If it was
+-- described as signed, we would have instead 90 and -128.
with Ada.Text_IO;
@@ -25,3 +22,6 @@ begin
R.I := 0;
Ada.Text_IO.Put_Line ("" & R.C);
end Debug11;
+
+-- { dg-final { scan-assembler-times "0x5a.*DW_AT_discr_list" 1 } }
+-- { dg-final { scan-assembler-times "0x80.*DW_AT_discr_list" 1 } }
diff --git a/gcc/testsuite/gnat.dg/debug16.adb b/gcc/testsuite/gnat.dg/debug16.adb
index 8752002..5695edb 100644
--- a/gcc/testsuite/gnat.dg/debug16.adb
+++ b/gcc/testsuite/gnat.dg/debug16.adb
@@ -1,6 +1,6 @@
--- { dg-do compile }
--- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
--- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
+-- { dg-do compile }
+-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
+-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
procedure Debug16 is
@@ -24,4 +24,4 @@ begin
end if;
end;
--- { dg-final { scan-assembler-times "DW_AT_discr" 4 } }
+-- { dg-final { scan-assembler-times "DW_AT_discr" 4 } }
diff --git a/gcc/testsuite/gnat.dg/debug17.adb b/gcc/testsuite/gnat.dg/debug17.adb
new file mode 100644
index 0000000..d3ad812
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/debug17.adb
@@ -0,0 +1,25 @@
+-- { dg-do compile }
+-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
+-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
+
+pragma No_Component_Reordering;
+
+procedure Debug17 (Number_Of_Bits : Natural) is
+
+ type Bitinfos_T is array (Natural range 1 .. Number_Of_Bits) of Float;
+
+ type Inner_Record_T is record
+ Bitinfos : Bitinfos_T := (others => 1.5);
+ Check1 : Integer := 1983;
+ Check2 : Integer := 1995;
+ Flag : Boolean := False;
+ Check3 : Integer := 2005;
+ end record;
+
+ Rfield : Inner_Record_T;
+
+begin
+ null;
+end;
+
+-- { dg-final { scan-assembler-not "DW_AT_data_member_location (0)" } }
diff --git a/gcc/testsuite/gnat.dg/debug18.adb b/gcc/testsuite/gnat.dg/debug18.adb
new file mode 100644
index 0000000..59ba54d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/debug18.adb
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
+-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
+
+procedure Debug18 is
+
+ procedure Check (Size : Integer) is
+ type Bit_Array_Type is array (1 .. Size) of boolean;
+ pragma Pack (Bit_Array_Type);
+
+ Bits : Bit_Array_Type := (others => False);
+ begin
+ Bits (Bits'First) := True;
+ end;
+
+begin
+ Check (Size => 9);
+end;
+
+-- { dg-final { scan-assembler-not "DW_AT_lower_bound" } }
diff --git a/gcc/testsuite/gnat.dg/debug8.adb b/gcc/testsuite/gnat.dg/debug8.adb
index 882be55..6302be3 100644
--- a/gcc/testsuite/gnat.dg/debug8.adb
+++ b/gcc/testsuite/gnat.dg/debug8.adb
@@ -1,7 +1,6 @@
-- { dg-do compile }
--- { dg-options "-cargs -g -fgnat-encodings=minimal -dA -margs" }
--- { dg-final { scan-assembler-not "DW_OP_const4u" } }
--- { dg-final { scan-assembler-not "DW_OP_const8u" } }
+-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
+-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
-- The DW_AT_byte_size attribute DWARF expression for the
-- DW_TAG_structure_type DIE that describes Rec_Type contains the -4u literal.
@@ -27,3 +26,6 @@ procedure Debug8 is
begin
null;
end Debug8;
+
+-- { dg-final { scan-assembler-not "DW_OP_const4u" } }
+-- { dg-final { scan-assembler-not "DW_OP_const8u" } }
diff --git a/gcc/testsuite/gnat.dg/derived_type7.adb b/gcc/testsuite/gnat.dg/derived_type7.adb
new file mode 100644
index 0000000..61e7aba
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/derived_type7.adb
@@ -0,0 +1,9 @@
+package body Derived_Type7 is
+
+ procedure Proc (Size : Natural) is
+ type Sar_Six_Bit_Arr is new Six_Bit_Data_Array_Type (1 .. Size);
+ begin
+ null;
+ end;
+
+end Derived_Type7;
diff --git a/gcc/testsuite/gnat.dg/derived_type7.ads b/gcc/testsuite/gnat.dg/derived_type7.ads
new file mode 100644
index 0000000..2b1427a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/derived_type7.ads
@@ -0,0 +1,13 @@
+-- { dg-do compile }
+
+package Derived_Type7 is
+
+ type Six_Bit_Data_Type is range 0 .. 63;
+ for Six_Bit_Data_Type'Size use 6;
+
+ type Six_Bit_Data_Array_Type is array (Integer range <>) of Six_Bit_Data_Type;
+ for Six_Bit_Data_Array_Type'Component_Size use 6;
+
+ procedure Proc (Size : Natural);
+
+end Derived_Type7;
diff --git a/gcc/testsuite/gnat.dg/inline22.adb b/gcc/testsuite/gnat.dg/inline22.adb
new file mode 100644
index 0000000..5812c2f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/inline22.adb
@@ -0,0 +1,19 @@
+-- { dg-compile }
+
+procedure Inline22 (L, U : Integer) is
+
+ type Arr is array (Integer range L .. U) of Boolean;
+
+ function Get_Zero return Arr;
+ pragma Inline_Always (Get_Zero);
+
+ function Get_Zero return Arr is
+ begin
+ return (others => False);
+ end;
+
+ A : Arr;
+
+begin
+ A := Get_Zero;
+end;
diff --git a/gcc/testsuite/gnat.dg/limited4.adb b/gcc/testsuite/gnat.dg/limited4.adb
index 1a8ec97..2a22a2c 100644
--- a/gcc/testsuite/gnat.dg/limited4.adb
+++ b/gcc/testsuite/gnat.dg/limited4.adb
@@ -22,11 +22,12 @@ procedure Limited4 is
Obj2 : Lim_Tagged'Class := Lim_Tagged'Class'(raise TBD_Error);
-- b) initialization expression of a CW component_declaration
-
- type Rec is record
- Comp01 : Lim_Tagged'Class := (raise TBD_Error);
- Comp02 : Lim_Tagged'Class := Lim_Tagged'Class'((raise TBD_Error));
- end record;
+ -- ... is illegal: cannot have unconstrained components.
+ --
+ -- type Rec is record
+ -- Comp01 : Lim_Tagged'Class := (raise TBD_Error);
+ -- Comp02 : Lim_Tagged'Class := Lim_Tagged'Class'((raise TBD_Error));
+ -- end record;
-- c) the expression of a record_component_association
@@ -55,4 +56,4 @@ procedure Limited4 is
begin
Check := Do_Test1 (raise TBD_Error);
Check := Do_Test2;
-end; \ No newline at end of file
+end;
diff --git a/gcc/testsuite/gnat.dg/lto21.adb b/gcc/testsuite/gnat.dg/lto21.adb
index fe6fb273..f626697 100644
--- a/gcc/testsuite/gnat.dg/lto21.adb
+++ b/gcc/testsuite/gnat.dg/lto21.adb
@@ -1,5 +1,6 @@
-- { dg-do run }
-- { dg-options "-O3 -flto" { target lto } }
+-- { dg-prune-output "warning: using serial compilation" }
with Lto21_Pkg1;
with Lto21_Pkg2; use Lto21_Pkg2;
diff --git a/gcc/testsuite/gnat.dg/opt92.adb b/gcc/testsuite/gnat.dg/opt92.adb
new file mode 100644
index 0000000..f6eb6a0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt92.adb
@@ -0,0 +1,38 @@
+-- { dg-do compile { target { lp64 || llp64 } } }
+-- { dg-options "-O2 -gnatws" }
+
+procedure Main is
+
+ subtype Int64 is Long_Long_Integer;
+
+ type Arr is array (Int64 range <>) of Boolean;
+
+ Pow : constant := 10;
+
+ procedure Compute (B : in out Arr) is
+ Factor : Int64 := 3;
+ Num : Int64;
+ begin
+ while Factor <= 10 ** (Pow / 2) loop
+ Num := Factor;
+ while Num < 10 ** Pow loop
+ if B (Num) then
+ Factor := Num;
+ exit;
+ end if;
+ Num := Num + 2;
+ end loop;
+ Num := Factor * Factor;
+ while Num < 10 ** Pow loop
+ B (Num) := False;
+ Num := Num + Factor * 2;
+ end loop;
+ Factor := Factor + 2;
+ end loop;
+ end;
+
+ B : Arr (1 .. 10 ** Pow) := (others => True);
+
+begin
+ Compute (B);
+end;
diff --git a/gcc/testsuite/gnat.dg/opt93.adb b/gcc/testsuite/gnat.dg/opt93.adb
new file mode 100644
index 0000000..04a6a06
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt93.adb
@@ -0,0 +1,20 @@
+-- { dg-do compile { target lp64 } }
+-- { dg-options "-O2 -fdump-tree-optimized" }
+
+package body Opt93 is
+
+ function Worker (Obj : T) return Boolean is
+ begin
+ return (for some J in 1 .. Obj.D2 => Obj.A (J) = 0);
+ end;
+
+ function Contains_Zero (Obj : T) return Boolean is
+ begin
+ return Worker (Obj);
+ exception
+ when Others => raise Program_Error;
+ end;
+
+end Opt93;
+
+-- { dg-final { scan-tree-dump "ivtmp.\[0-9_]+ = ivtmp.\[0-9_]+ \\+ 2" "optimized" } }
diff --git a/gcc/testsuite/gnat.dg/opt93.ads b/gcc/testsuite/gnat.dg/opt93.ads
new file mode 100644
index 0000000..61bc236
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt93.ads
@@ -0,0 +1,14 @@
+package Opt93 is
+
+ type Arr is array (Natural range <>) of Short_Integer;
+
+ type Rec (D1, D2 : Natural) is record
+ S : String (1 .. D1);
+ A : Arr (1 .. D2);
+ end record;
+
+ type T is access Rec;
+
+ function Contains_Zero (Obj : T) return Boolean;
+
+end Opt93;
diff --git a/gcc/testsuite/gnat.dg/opt94.adb b/gcc/testsuite/gnat.dg/opt94.adb
new file mode 100644
index 0000000..547bef3
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt94.adb
@@ -0,0 +1,17 @@
+-- { dg-do compile }
+-- { dg-options "-O -gnatn -fdump-tree-optimized" }
+
+with Opt94_Pkg; use Opt94_Pkg;
+
+function Opt94 (S : String) return Integer is
+ A : constant String := Get;
+
+begin
+ if Valid_Result (A) then
+ return Result (A);
+ else
+ return -1;
+ end if;
+end;
+
+-- { dg-final { scan-tree-dump-times "worker" 1 "optimized" } }
diff --git a/gcc/testsuite/gnat.dg/opt94_pkg.adb b/gcc/testsuite/gnat.dg/opt94_pkg.adb
new file mode 100644
index 0000000..6702917
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt94_pkg.adb
@@ -0,0 +1,31 @@
+package body Opt94_Pkg is
+
+ function Worker (S : String) return Integer;
+ pragma Pure_Function (Worker);
+
+ function Valid_Result (S : String) return Boolean is
+ begin
+ return Worker (S) > 0;
+ end;
+
+ function Result (S : String) return Integer is
+ R : constant Integer := Worker (S);
+ begin
+ if R > 0 then
+ return R;
+ else
+ raise Program_Error;
+ end if;
+ end;
+
+ function Worker (S : String) return Integer is
+ begin
+ return Character'Pos (S (S'First));
+ end;
+
+ function Get return String is
+ begin
+ return "";
+ end;
+
+end Opt94_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt94_pkg.ads b/gcc/testsuite/gnat.dg/opt94_pkg.ads
new file mode 100644
index 0000000..16e3433
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt94_pkg.ads
@@ -0,0 +1,11 @@
+package Opt94_Pkg is
+
+ function Valid_Result (S : String) return Boolean;
+ pragma Inline (Valid_Result);
+
+ function Result (S : String) return Integer;
+ pragma Inline (Result);
+
+ function Get return String;
+
+end Opt94_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt95.adb b/gcc/testsuite/gnat.dg/opt95.adb
new file mode 100644
index 0000000..2c72582
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt95.adb
@@ -0,0 +1,40 @@
+-- { dg-do run }
+-- { dg-options "-O2 -gnatp" }
+
+procedure Opt95 is
+
+ function Foo (J : Integer) return Integer;
+ pragma Pure_Function (Foo);
+ pragma Machine_Attribute (Foo, "noipa");
+
+ function Foo (J : Integer) return Integer is
+ begin
+ if J /= 0 then
+ raise Constraint_Error;
+ end if;
+ return 0;
+ end;
+
+ function Bar (A : access Integer; N : Integer) return Integer;
+ pragma Machine_Attribute (Bar, "noipa");
+
+ function Bar (A : access Integer; N : Integer) return Integer is
+ Ret : Integer := 0;
+ Ret2 : Integer := 0;
+ begin
+ if N /= 0 then
+ Ret2 := Foo (N);
+ Ret := A.all;
+ end if;
+ Ret := Ret + A.all;
+ return Ret + Ret2;
+ end;
+
+ V : Integer;
+ pragma Volatile (V);
+
+begin
+ V := Bar (null, 1);
+exception
+ when Constraint_Error => null;
+end;
diff --git a/gcc/testsuite/gnat.dg/specs/debug1.ads b/gcc/testsuite/gnat.dg/specs/debug1.ads
index f94b42a..9b67427 100644
--- a/gcc/testsuite/gnat.dg/specs/debug1.ads
+++ b/gcc/testsuite/gnat.dg/specs/debug1.ads
@@ -1,5 +1,6 @@
-- { dg-do compile }
--- { dg-options "-cargs -g -dA -fgnat-encodings=minimal -margs" }
+-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
+-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
package Debug1 is
diff --git a/gcc/testsuite/gnat.dg/specs/opt5.ads b/gcc/testsuite/gnat.dg/specs/opt5.ads
new file mode 100644
index 0000000..09b8db5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt5.ads
@@ -0,0 +1,25 @@
+-- { dg-do compile }
+-- { dg-options "-O2 -gnata -gnatVa" }
+
+with Opt5_Pkg;
+
+package Opt5 is
+
+ type Object is new Opt5_Pkg.Object with private;
+
+ Undefined : constant Object;
+
+ overriding function Is_Defined (Self : Object) return Boolean;
+
+ function Create (Sloc : Opt5_Pkg.Object) return Integer is (0)
+ with Pre => Sloc.Is_Defined;
+
+private
+
+ type Object is new Opt5_Pkg.Object with null record;
+
+ Undefined : constant Object := (Opt5_Pkg.Undefined with others => <>);
+
+ overriding function Is_Defined (Self : Object) return Boolean is (Self /= Undefined);
+
+end Opt5;
diff --git a/gcc/testsuite/gnat.dg/specs/opt5_pkg.ads b/gcc/testsuite/gnat.dg/specs/opt5_pkg.ads
new file mode 100644
index 0000000..a549f08
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt5_pkg.ads
@@ -0,0 +1,17 @@
+package Opt5_Pkg is
+
+ type Object is tagged private;
+
+ Undefined : constant Object;
+
+ function Is_Defined (Self : Object) return Boolean;
+
+private
+
+ type Object is tagged null record;
+
+ Undefined : constant Object := (others => <>);
+
+ function Is_Defined (Self : Object) return Boolean is (Self /= Undefined);
+
+end Opt5_Pkg;
diff --git a/gcc/testsuite/gnat.dg/unchecked_convert5.adb b/gcc/testsuite/gnat.dg/unchecked_convert5.adb
index e3e4312..9c24d66 100644
--- a/gcc/testsuite/gnat.dg/unchecked_convert5.adb
+++ b/gcc/testsuite/gnat.dg/unchecked_convert5.adb
@@ -1,4 +1,4 @@
--- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
+-- { dg-do run { target hppa*-*-* sparc*-*-* powerpc-*-* powerpc64-*-* } }
with Unchecked_Conversion;
diff --git a/gcc/testsuite/gnat.dg/unchecked_convert6.adb b/gcc/testsuite/gnat.dg/unchecked_convert6.adb
index a26a6a9..ce8cc10 100644
--- a/gcc/testsuite/gnat.dg/unchecked_convert6.adb
+++ b/gcc/testsuite/gnat.dg/unchecked_convert6.adb
@@ -1,4 +1,4 @@
--- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
+-- { dg-do run { target hppa*-*-* sparc*-*-* powerpc-*-* powerpc64-*-* } }
with Unchecked_Conversion;
diff --git a/gcc/testsuite/go.test/test/convert4.go b/gcc/testsuite/go.test/test/convert4.go
new file mode 100644
index 0000000..2bc9c96
--- /dev/null
+++ b/gcc/testsuite/go.test/test/convert4.go
@@ -0,0 +1,86 @@
+// run
+
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test conversion from slice to array pointer.
+
+package main
+
+func wantPanic(fn func(), s string) {
+ defer func() {
+ err := recover()
+ if err == nil {
+ panic("expected panic")
+ }
+ if got := err.(error).Error(); got != s {
+ panic("expected panic " + s + " got " + got)
+ }
+ }()
+ fn()
+}
+
+func main() {
+ s := make([]byte, 8, 10)
+ if p := (*[8]byte)(s); &p[0] != &s[0] {
+ panic("*[8]byte conversion failed")
+ }
+ wantPanic(
+ func() {
+ _ = (*[9]byte)(s)
+ },
+ "runtime error: cannot convert slice with length 8 to pointer to array with length 9",
+ )
+
+ var n []byte
+ if p := (*[0]byte)(n); p != nil {
+ panic("nil slice converted to *[0]byte should be nil")
+ }
+
+ z := make([]byte, 0)
+ if p := (*[0]byte)(z); p == nil {
+ panic("empty slice converted to *[0]byte should be non-nil")
+ }
+
+ // Test with named types
+ type Slice []int
+ type Int4 [4]int
+ type PInt4 *[4]int
+ ii := make(Slice, 4)
+ if p := (*Int4)(ii); &p[0] != &ii[0] {
+ panic("*Int4 conversion failed")
+ }
+ if p := PInt4(ii); &p[0] != &ii[0] {
+ panic("PInt4 conversion failed")
+ }
+}
+
+// test static variable conversion
+
+var (
+ ss = make([]string, 10)
+ s5 = (*[5]string)(ss)
+ s10 = (*[10]string)(ss)
+
+ ns []string
+ ns0 = (*[0]string)(ns)
+
+ zs = make([]string, 0)
+ zs0 = (*[0]string)(zs)
+)
+
+func init() {
+ if &ss[0] != &s5[0] {
+ panic("s5 conversion failed")
+ }
+ if &ss[0] != &s10[0] {
+ panic("s5 conversion failed")
+ }
+ if ns0 != nil {
+ panic("ns0 should be nil")
+ }
+ if zs0 == nil {
+ panic("zs0 should not be nil")
+ }
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go b/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go
index ce20923..5c2d7ca 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !386,!amd64p32,!arm,!mips,!mipsle
+// +build !386,!amd64p32,!arm,!mips,!mipsle,!sparc
package p
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6036.go b/gcc/testsuite/go.test/test/fixedbugs/issue6036.go
index 8ebef5a..0bac74d 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/issue6036.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/issue6036.go
@@ -1,4 +1,4 @@
-// +build !386,!arm,!mips,!mipsle,!amd64p32
+// +build !386,!arm,!mips,!mipsle,!amd64p32,!sparc
// compile
// Copyright 2013 The Go Authors. All rights reserved.
diff --git a/gcc/testsuite/go.test/test/unsafebuiltins.go b/gcc/testsuite/go.test/test/unsafebuiltins.go
new file mode 100644
index 0000000..4c940aa
--- /dev/null
+++ b/gcc/testsuite/go.test/test/unsafebuiltins.go
@@ -0,0 +1,64 @@
+// run
+
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "math"
+ "unsafe"
+)
+
+const maxUintptr = 1 << (8 * unsafe.Sizeof(uintptr(0)))
+
+func main() {
+ var p [10]byte
+
+ // unsafe.Add
+ {
+ p1 := unsafe.Pointer(&p[1])
+ assert(unsafe.Add(p1, 1) == unsafe.Pointer(&p[2]))
+ assert(unsafe.Add(p1, -1) == unsafe.Pointer(&p[0]))
+ }
+
+ // unsafe.Slice
+ {
+ s := unsafe.Slice(&p[0], len(p))
+ assert(&s[0] == &p[0])
+ assert(len(s) == len(p))
+ assert(cap(s) == len(p))
+
+ // nil pointer with zero length returns nil
+ assert(unsafe.Slice((*int)(nil), 0) == nil)
+
+ // nil pointer with positive length panics
+ mustPanic(func() { _ = unsafe.Slice((*int)(nil), 1) })
+
+ // negative length
+ var neg int = -1
+ mustPanic(func() { _ = unsafe.Slice(new(byte), neg) })
+
+ // length too large
+ var tooBig uint64 = math.MaxUint64
+ mustPanic(func() { _ = unsafe.Slice(new(byte), tooBig) })
+
+ // size overflows address space
+ mustPanic(func() { _ = unsafe.Slice(new(uint64), maxUintptr/8) })
+ mustPanic(func() { _ = unsafe.Slice(new(uint64), maxUintptr/8+1) })
+ }
+}
+
+func assert(ok bool) {
+ if !ok {
+ panic("FAIL")
+ }
+}
+
+func mustPanic(f func()) {
+ defer func() {
+ assert(recover() != nil)
+ }()
+ f()
+}
diff --git a/gcc/testsuite/jit.dg/all-non-failing-tests.h b/gcc/testsuite/jit.dg/all-non-failing-tests.h
index 4202eb7..84ef54a 100644
--- a/gcc/testsuite/jit.dg/all-non-failing-tests.h
+++ b/gcc/testsuite/jit.dg/all-non-failing-tests.h
@@ -98,6 +98,13 @@
#undef create_code
#undef verify_code
+/* test-cast.c */
+#define create_code create_code_cast
+#define verify_code verify_code_cast
+#include "test-cast.c"
+#undef create_code
+#undef verify_code
+
/* test-compound-assignment.c */
#define create_code create_code_compound_assignment
#define verify_code verify_code_compound_assignment
@@ -361,6 +368,9 @@ const struct testcase testcases[] = {
{"calling_internal_function",
create_code_calling_internal_function,
verify_code_calling_internal_function},
+ {"cast",
+ create_code_cast,
+ verify_code_cast},
{"compound_assignment",
create_code_compound_assignment,
verify_code_compound_assignment},
diff --git a/gcc/testsuite/jit.dg/harness.h b/gcc/testsuite/jit.dg/harness.h
index 6b59fb5..0dc5ed1 100644
--- a/gcc/testsuite/jit.dg/harness.h
+++ b/gcc/testsuite/jit.dg/harness.h
@@ -27,7 +27,7 @@
#define note dejagnu_note
#endif
-#include <dejagnu.h>
+#include "jit-dejagnu.h"
#ifdef MAKE_DEJAGNU_H_THREADSAFE
#undef pass
diff --git a/gcc/testsuite/jit.dg/jit.exp b/gcc/testsuite/jit.dg/jit.exp
index 9af87f9..4459dbc 100644
--- a/gcc/testsuite/jit.dg/jit.exp
+++ b/gcc/testsuite/jit.dg/jit.exp
@@ -377,6 +377,34 @@ proc dg-jit-set-exe-params { args } {
}
}
+# For test-debuginfo.c. Starts gdb, does cmds and checks the output against match
+proc jit-check-debug-info { obj_file cmds match } {
+ verbose "Checking debug info for $obj_file with match: $match"
+
+ if { [catch {exec gdb -v} fid] } {
+ verbose "No gdb seems to be in path. Can't check debug info. Reporting 'unsupported'."
+ unsupported "No gdb seems to be in path. Can't check debug info"
+ return
+ }
+
+ spawn gdb $obj_file
+
+ verbose "Disable color styling in GDB newer then 8.3 (errors on older)"
+ send "set style enabled off\n"
+
+ foreach cmd $cmds {
+ send $cmd
+ }
+ expect {
+ -re $match { pass OK }
+ default { fail FAIL }
+ }
+
+ # Quit gdb
+ send "set confirm off\n"
+ send "q\n"
+}
+
proc jit-dg-test { prog do_what extra_tool_flags } {
verbose "within jit-dg-test..."
verbose " prog: $prog"
@@ -914,9 +942,14 @@ proc jit-verify-executable { args } {
jit-run-executable $output_filename ${dg-output-text}
}
+set DEFAULT_CFLAGS "-I$srcdir/../jit -lgccjit -g -Wall -Werror"
+
# We need to link with --export-dynamic for test-calling-external-function.c
# so that the JIT-built code can call into functions from the main program.
-set DEFAULT_CFLAGS "-I$srcdir/../jit -lgccjit -g -Wall -Werror -Wl,--export-dynamic"
+
+if { [check_effective_target_rdynamic] } {
+ set DEFAULT_CFLAGS "$DEFAULT_CFLAGS -rdynamic"
+}
# Main loop. This will invoke jig-dg-test on each test-*.c file.
dg-runtest $tests "" $DEFAULT_CFLAGS
diff --git a/gcc/testsuite/jit.dg/test-asm.c b/gcc/testsuite/jit.dg/test-asm.c
index e7777ee..43255dc 100644
--- a/gcc/testsuite/jit.dg/test-asm.c
+++ b/gcc/testsuite/jit.dg/test-asm.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-do compile { target x86_64-*-* } } */
#include <stdlib.h>
#include <stdio.h>
@@ -438,6 +438,18 @@ verify_code_4 (gcc_jit_context *ctxt, gcc_jit_result *result)
static void
create_test_i386_basic_asm_5 (gcc_jit_context *ctxt)
{
+#if __APPLE__
+ /* Darwin's assemblers do not support push/pop section, do not use .type
+ and external symbols should use __USER_LABEL_PREFIX__. */
+ gcc_jit_context_add_top_level_asm (ctxt, NULL,
+ "\t.text\n"
+ "\t.globl _add_asm\n"
+ "_add_asm:\n"
+ "\tmovq %rdi, %rax\n"
+ "\tadd %rsi, %rax\n"
+ "\tret\n"
+ "\t# some asm here\n");
+#else
/* Quote from here in docs/topics/asm.rst: example 5: jit. */
gcc_jit_context_add_top_level_asm (ctxt, NULL,
"\t.pushsection .text\n"
@@ -450,6 +462,7 @@ create_test_i386_basic_asm_5 (gcc_jit_context *ctxt)
"\t# some asm here\n"
"\t.popsection\n");
/* Quote up to here in docs/topics/asm.rst: example 5: jit. */
+#endif
}
static void
diff --git a/gcc/testsuite/jit.dg/test-asm.cc b/gcc/testsuite/jit.dg/test-asm.cc
index 6f18280..a3b45da 100644
--- a/gcc/testsuite/jit.dg/test-asm.cc
+++ b/gcc/testsuite/jit.dg/test-asm.cc
@@ -1,4 +1,4 @@
-/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-do compile { target x86_64-*-* } } */
#include "libgccjit++.h"
@@ -400,6 +400,17 @@ static void
create_test_i386_basic_asm_5 (gcc_jit_context *c_ctxt)
{
gccjit::context ctxt (c_ctxt);
+#if __APPLE__
+ /* Darwin's assemblers do not support push/pop section, do not use .type
+ and external symbols should use __USER_LABEL_PREFIX__. */
+ ctxt.add_top_level_asm ("\t.text\n"
+ "\t.globl _add_asm\n"
+ "_add_asm:\n"
+ "\tmovq %rdi, %rax\n"
+ "\tadd %rsi, %rax\n"
+ "\tret\n"
+ "\t# some asm here\n");
+#else
/* Quote from here in docs/cp/topics/asm.rst: example 5: jit. */
ctxt.add_top_level_asm ("\t.pushsection .text\n"
"\t.globl add_asm\n"
@@ -411,6 +422,7 @@ create_test_i386_basic_asm_5 (gcc_jit_context *c_ctxt)
"\t# some asm here\n"
"\t.popsection\n");
/* Quote up to here in docs/cp/topics/asm.rst: example 5: jit. */
+#endif
}
static void
diff --git a/gcc/testsuite/jit.dg/test-cast.c b/gcc/testsuite/jit.dg/test-cast.c
new file mode 100644
index 0000000..2b1e385
--- /dev/null
+++ b/gcc/testsuite/jit.dg/test-cast.c
@@ -0,0 +1,66 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "libgccjit.h"
+
+#include "harness.h"
+
+void
+create_code (gcc_jit_context *ctxt, void *user_data)
+{
+ /* Let's try to inject the equivalent of:
+char
+my_casts (int x)
+{
+ return (char)(long) x;
+}
+ */
+ gcc_jit_type *int_type =
+ gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
+ gcc_jit_type *long_type =
+ gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_LONG);
+ gcc_jit_type *return_type =
+ gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CHAR);
+
+ gcc_jit_param *x =
+ gcc_jit_context_new_param (
+ ctxt,
+ NULL,
+ int_type, "x");
+ gcc_jit_param *params[1] = {x};
+ gcc_jit_function *func =
+ gcc_jit_context_new_function (ctxt,
+ NULL,
+ GCC_JIT_FUNCTION_EXPORTED,
+ return_type,
+ "my_casts",
+ 1, params, 0);
+
+ gcc_jit_block *initial =
+ gcc_jit_function_new_block (func, "initial");
+
+ gcc_jit_block_end_with_return(initial, NULL,
+ gcc_jit_context_new_cast(ctxt,
+ NULL,
+ gcc_jit_context_new_cast(ctxt,
+ NULL,
+ gcc_jit_param_as_rvalue(x),
+ long_type
+ ),
+ return_type
+ ));
+}
+
+void
+verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
+{
+ typedef int (*my_casts_fn_type) (int);
+ CHECK_NON_NULL (result);
+ my_casts_fn_type my_casts =
+ (my_casts_fn_type)gcc_jit_result_get_code (result, "my_casts");
+ CHECK_NON_NULL (my_casts);
+ char val = my_casts (10);
+ note ("my_casts returned: %d", val);
+ CHECK_VALUE (val, 10);
+}
diff --git a/gcc/testsuite/jit.dg/test-debuginfo.c b/gcc/testsuite/jit.dg/test-debuginfo.c
new file mode 100644
index 0000000..49e8834
--- /dev/null
+++ b/gcc/testsuite/jit.dg/test-debuginfo.c
@@ -0,0 +1,72 @@
+/* Essentially this test checks that debug info are generated for globals
+ locals and functions, including type info. The comment bellow is used
+ as fake code (does not affect the test, use for manual debugging). */
+/*
+int a_global_for_test_debuginfo;
+int main (int argc, char **argv)
+{
+ int a_local_for_test_debuginfo = 2;
+ return a_global_for_test_debuginfo + a_local_for_test_debuginfo;
+}
+*/
+#include "libgccjit.h"
+
+/* We don't want set_options() in harness.h to set -O3 so our little local
+ is optimized away. */
+#define TEST_ESCHEWS_SET_OPTIONS
+static void set_options (gcc_jit_context *ctxt, const char *argv0)
+{
+ gcc_jit_context_set_bool_option(ctxt, GCC_JIT_BOOL_OPTION_DEBUGINFO, 1);
+}
+
+#define TEST_COMPILING_TO_FILE
+#define OUTPUT_KIND GCC_JIT_OUTPUT_KIND_EXECUTABLE
+#define OUTPUT_FILENAME "jit-debuginfo.o"
+#include "harness.h"
+
+#define LOC(row, col) gcc_jit_context_new_location(ctxt, "test-debuginfo.c", row, col)
+
+void
+create_code (gcc_jit_context *ctxt, void* p)
+{
+ gcc_jit_type *int_type = gcc_jit_context_get_type(ctxt, GCC_JIT_TYPE_INT);
+
+ gcc_jit_lvalue *bar = gcc_jit_context_new_global(ctxt,
+ LOC(5,1), GCC_JIT_GLOBAL_EXPORTED,
+ int_type, "a_global_for_test_debuginfo");
+
+ gcc_jit_param *argc_para = gcc_jit_context_new_param(ctxt, LOC(6,15),
+ int_type, "argc");
+ gcc_jit_param *argv_para = gcc_jit_context_new_param(ctxt, LOC(6,28),
+ gcc_jit_type_get_pointer(
+ gcc_jit_type_get_pointer(
+ gcc_jit_context_get_type(ctxt, GCC_JIT_TYPE_CHAR))),
+ "argc");
+
+ gcc_jit_param *params[] = {argc_para, argv_para};
+
+ gcc_jit_function *foo_fn = gcc_jit_context_new_function(ctxt, LOC(6,5),
+ GCC_JIT_FUNCTION_EXPORTED, int_type, "main", 2, params, 0);
+ gcc_jit_block *start_block = gcc_jit_function_new_block(foo_fn,
+ "start_block");
+
+ gcc_jit_lvalue *a = gcc_jit_function_new_local(foo_fn, LOC(8,5),
+ int_type, "a_local_for_test_debuginfo");
+ gcc_jit_block_add_assignment(start_block, LOC(8,36), a,
+ gcc_jit_context_new_rvalue_from_int(ctxt, int_type, 2));
+ gcc_jit_rvalue *add = gcc_jit_context_new_binary_op(ctxt, LOC(9,40),
+ GCC_JIT_BINARY_OP_PLUS, int_type,
+ gcc_jit_lvalue_as_rvalue(a), gcc_jit_lvalue_as_rvalue(bar));
+
+ gcc_jit_block_end_with_return(start_block, LOC(9,5), add);
+}
+
+#undef LOC
+
+/* jit-check-debug-info fires up gdb and checks that the variables have
+ debug info */
+
+/* { dg-final { jit-check-debug-info "jit-debuginfo.o" {"info variables\n"} "int\\s+a_global_for_test_debuginfo;" } } */
+/* { dg-final { jit-check-debug-info "jit-debuginfo.o" {"pt main\n"} "int\\s*\\(\\s*int\\s*,\\s*char\\s*\\*\\*\\s*\\)"} } */
+/* { dg-final { jit-check-debug-info "jit-debuginfo.o" {"start\n" "info locals\n"} "a_local_for_test_debuginfo"} } */
+/* { dg-final { jit-check-debug-info "jit-debuginfo.o" {"start\n" "pt a_local_for_test_debuginfo\n"} "int"} } */ \ No newline at end of file
diff --git a/gcc/testsuite/jit.dg/test-error-array-bounds.c b/gcc/testsuite/jit.dg/test-error-array-bounds.c
index cd9361f..b6c0ee5 100644
--- a/gcc/testsuite/jit.dg/test-error-array-bounds.c
+++ b/gcc/testsuite/jit.dg/test-error-array-bounds.c
@@ -70,5 +70,5 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
/* ...and that the message was captured by the API. */
CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
"array subscript 10 is above array bounds of"
- " 'unsigned char[10]' [-Warray-bounds]");
+ " 'char[10]' [-Warray-bounds]");
}
diff --git a/gcc/testsuite/jit.dg/test-vector-rvalues.cc b/gcc/testsuite/jit.dg/test-vector-rvalues.cc
index ac230bf7..0287711 100644
--- a/gcc/testsuite/jit.dg/test-vector-rvalues.cc
+++ b/gcc/testsuite/jit.dg/test-vector-rvalues.cc
@@ -165,6 +165,14 @@ check_div (const V &a, const V &b, const V &c)
CHECK_VALUE (c[i], a[i] / b[i]);
}
+template <>
+void
+check_div<v4f> (const v4f &a, const v4f &b, const v4f &c)
+{
+ for (int i = 0; i < 4; i++)
+ CHECK_DOUBLE_VALUE (c[i], a[i] / b[i]);
+}
+
template <typename V, typename E>
void
verify_vec_code (gcc_jit_context *ctxt, gcc_jit_result *result,
diff --git a/gcc/testsuite/jit.dg/test-vector-types.cc b/gcc/testsuite/jit.dg/test-vector-types.cc
index 3389e04..1f49be6 100644
--- a/gcc/testsuite/jit.dg/test-vector-types.cc
+++ b/gcc/testsuite/jit.dg/test-vector-types.cc
@@ -139,6 +139,14 @@ check_div (const T &a, const T &b, const T &c)
CHECK_VALUE (c[i], a[i] / b[i]);
}
+template <>
+void
+check_div<v4f> (const v4f &a, const v4f &b, const v4f &c)
+{
+ for (int i = 0; i < 4; i++)
+ CHECK_DOUBLE_VALUE (c[i], a[i] / b[i]);
+}
+
template <typename T>
void
verify_vec_code (gcc_jit_context *ctxt, gcc_jit_result *result,
diff --git a/gcc/testsuite/lib/brig-dg.exp b/gcc/testsuite/lib/brig-dg.exp
deleted file mode 100644
index 41c55f9..0000000
--- a/gcc/testsuite/lib/brig-dg.exp
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (C) 2009-2021 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3. If not see
-# <http://www.gnu.org/licenses/>.
-
-load_lib gcc-dg.exp
-
-# Define brig callbacks for dg.exp.
-
-proc brig-dg-test { prog do_what extra_tool_flags } {
- set result \
- [gcc-dg-test-1 brig_target_compile $prog $do_what $extra_tool_flags]
-
- set comp_output [lindex $result 0]
- set output_file [lindex $result 1]
-
- return [list $comp_output $output_file]
-}
diff --git a/gcc/testsuite/lib/brig.exp b/gcc/testsuite/lib/brig.exp
deleted file mode 100644
index d82cd88..0000000
--- a/gcc/testsuite/lib/brig.exp
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2009-2021 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3. If not see
-# <http://www.gnu.org/licenses/>.
-
-load_lib prune.exp
-load_lib gcc-defs.exp
-load_lib timeout.exp
-load_lib target-libpath.exp
-#
-# brig_target_compile -- compile a HSAIL input to BRIG using HSAILasm and then
-# compile the BRIG to target ISA using gcc
-
-proc brig_target_compile { source dest type options } {
- global tmpdir
- global testname_with_flags
- if { [file extension $source] == ".hsail" } {
- # We cannot assume all inputs are .hsail as the dg machinery
- # calls this for a some c files to check linker plugin support or
- # similar.
- set brig_source ${tmpdir}/[file rootname [file tail ${source}]].brig
- exec HSAILasm $source -o ${brig_source}
- set source ${brig_source}
- # Change the testname the .brig.
- set testname_with_flags [file tail $source]
- }
- return [target_compile $source $dest $type $options]
-}
-
diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp
index 1f60fde..bb0ce46 100644
--- a/gcc/testsuite/lib/dg-pch.exp
+++ b/gcc/testsuite/lib/dg-pch.exp
@@ -28,7 +28,7 @@ proc pch-init { args } {
set result [check_compile pchtest object "int i;" "-g -x c-header"]
set pch_unsupported_debug \
- [regexp "debug format cannot be used with pre-compiled headers" \
+ [regexp "debug info cannot be used with pre-compiled headers" \
[lindex $result 0]]
remote_file build delete [lindex $result 1]
@@ -38,7 +38,7 @@ proc pch-init { args } {
set result [check_compile pchtest object "int i;" "-x c-header"]
set pch_unsupported \
- [regexp "debug format cannot be used with pre-compiled headers" \
+ [regexp "debug info cannot be used with pre-compiled headers" \
[lindex $result 0]]
remote_file build delete [lindex $result 1]
}
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index a36b30d..d17308d 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -176,6 +176,40 @@ if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \
global gcc_runtest_parallelize_dir
global gcc_runtest_parallelize_last
+ # GCC testsuite is parallelised by starting N runtest processes -- each
+ # with its own test directory. These N runtest processes ALL go through
+ # the relevant .exp and ALL attempt to run every test. And they go
+ # through the tests the same order -- this is important, and if there is
+ # a bug that causes different runtest processes to enumerate the tests
+ # differently, then things will break and some tests will be skipped, while
+ # others will be ran several times.
+ # So, just before a runtest processes runs a specific test it asks
+ # "runtest_file_p" routine whether a particular test is part of
+ # the requested testsuite. We override this function so that it
+ # returns "yes" to the first-arrived runtest process, and "no" to all
+ # subsequent runtest processes -- this is implemented by creating a marker
+ # file, which persist till the end of the test run. We optimize this
+ # a bit by batching 10 tests and using a single marker file for the batch.
+ #
+ # Note that the runtest processes all race each other to get to the next
+ # test batch. This means that batch allocation between testsuite runs
+ # is very likely to change.
+ #
+ # To confirm or deny suspicion that tests are skipped or executed
+ # multiple times due to runtest processes enumerating tests differently ...
+ # 1. Uncomment the three below "verbose -log gcc_parallel_test_run_p ..."
+ # debug print-outs.
+ # 2. Run the testsuite with "-v" added to RUNTESTFLAGS
+ # 3. Extract debug print-outs with something like:
+ # for i in $(find -name "*.log.sep"); do
+ # grep gcc_parallel_test_run_p $i \
+ # | sed -e "s/\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\)/\3 \2/" \
+ # | sed -e "s#\(/testsuite/[a-z+]*\)[0-9]*/#\1N/#" > $i.order
+ # done
+ # 4. Compare debug print-outs produced by individual runtest processes:
+ # find -name "*.log.sep.order" | xargs md5sum | sort
+ # 5. Check that MD5 hashes of all .order files of the same testsuite match
+ # and investigate if they don't.
set gcc_runtest_parallelize_counter 0
set gcc_runtest_parallelize_counter_minor 0
set gcc_runtest_parallelize_enable 1
@@ -506,3 +540,65 @@ proc dg-check-dot { args } {
pass "$testcase dg-check-dot $dotfile"
}
+
+# Used by aarch64-with-arch-dg-options to intercept dg-options and make
+# the changes required. See there for details.
+proc aarch64-arch-dg-options { args } {
+ upvar dg-do-what do_what
+ global aarch64_default_testing_arch
+
+ set add_arch 1
+ set add_tune 1
+ set checks_output [string equal [lindex $do_what 0] "compile"]
+ set options [lindex $args 1]
+
+ foreach option [split $options] {
+ switch -glob -- $option {
+ -march=* { set add_arch 0 }
+ -mcpu=* { set add_arch 0; set add_tune 0 }
+ -mtune=* { set add_tune 0 }
+ -moverride=* { set add_tune 0 }
+ -save-temps { set checks_output 1 }
+ --save-temps { set checks_output 1 }
+ -fdump* { set checks_output 1 }
+ }
+ }
+
+ if { $add_arch && ![string equal $aarch64_default_testing_arch ""] } {
+ # Force SVE if we're not testing it already.
+ append options " $aarch64_default_testing_arch"
+ }
+
+ if { $add_tune && $checks_output } {
+ # Turn off any default tuning and codegen tweaks.
+ append options " -mtune=generic -moverride=tune=none"
+ }
+
+ uplevel 1 aarch64-old-dg-options [lreplace $args 1 1 $options]
+}
+
+# Run Tcl code CODE with dg-options modified to work better for some
+# AArch64 tests. In particular:
+#
+# - If the dg-options do not specify an -march or -mcpu option,
+# use the architecture options in ARCH (which might be empty).
+#
+# - If the dg-options do not specify an -mcpu, -mtune or -moverride option,
+# and if the test appears to be checking assembly or dump output,
+# force the test to use generic tuning.
+#
+# The idea is to handle toolchains that are configured with a default
+# CPU or architecture that's different from the norm.
+proc aarch64-with-arch-dg-options { arch code } {
+ global aarch64_default_testing_arch
+
+ set aarch64_default_testing_arch $arch
+
+ rename dg-options aarch64-old-dg-options
+ rename aarch64-arch-dg-options dg-options
+
+ uplevel 1 $code
+
+ rename dg-options aarch64-arch-dg-options
+ rename aarch64-old-dg-options dg-options
+}
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index e48a184..7edd070 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -621,18 +621,52 @@ proc gcc-dg-runtest { testcases flags default-extra-flags } {
}
}
-proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
+# Check if frontend has CTF support
+proc gcc-dg-frontend-supports-ctf { target_compile trivial } {
+ global srcdir subdir
+
+ set comp_output [$target_compile \
+ "$srcdir/$subdir/$trivial" "trivial.S" assembly \
+ "additional_flags=-gctf"]
+ if { ! [string match \
+ "*CTF debug info requested, but not supported for * frontend*" \
+ $comp_output] } {
+ remove-build-file "trivial.S"
+ return 1
+ }
+ return 0
+}
+
+# Check if the target system supports the debug format
+proc gcc-dg-target-supports-debug-format { target_compile trivial type } {
global srcdir subdir
+ set comp_output [$target_compile \
+ "$srcdir/$subdir/$trivial" "trivial.S" assembly \
+ "additional_flags=$type"]
+ if { ! [string match "*: target system does not support the * debug format*" \
+ $comp_output] } {
+ remove-build-file "trivial.S"
+ return 1
+ }
+ return 0
+}
+
+proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
if ![info exists DEBUG_TORTURE_OPTIONS] {
set DEBUG_TORTURE_OPTIONS ""
- foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+} {
- set comp_output [$target_compile \
- "$srcdir/$subdir/$trivial" "trivial.S" assembly \
- "additional_flags=$type"]
- if { ! [string match "*: target system does not support the * debug format*" \
- $comp_output] } {
- remove-build-file "trivial.S"
+ foreach type {-gctf -gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+} {
+ if [expr [gcc-dg-target-supports-debug-format \
+ $target_compile $trivial $type]] {
+ if { $type == "-gctf" } {
+ if [expr [gcc-dg-frontend-supports-ctf \
+ $target_compile $trivial]] {
+ # At this time, running tests with various opt levels or
+ # ctf debug info levels does not add value.
+ lappend DEBUG_TORTURE_OPTIONS [list "${type}"]
+ }
+ continue
+ }
foreach level {1 "" 3} {
if { ($type == "-gdwarf-2") && ($level != "") } {
lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"]
@@ -689,6 +723,15 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
set doit 0
}
+ # These tests check for information which is not emitted for CTF
+ # as CTF type information is emitted for entities at file and
+ # global scope only.
+ if { ([string match {*/debug-[126].c} "$nshort"] \
+ || [string match {*/enum-[12].C} "$nshort"] ) \
+ && [string match "*ctf*" "$flags"] } {
+ set doit 0
+ }
+
if { $doit } {
verbose -log "Testing $nshort, $flags" 1
dg-test $test $flags ""
@@ -1012,6 +1055,8 @@ if { [info procs saved-dg-test] == [list] } {
}
unset save_linenr_varnames
}
+
+ initialize_prune_notes
}
proc dg-test { args } {
@@ -1245,6 +1290,36 @@ proc dg-missed { args } {
process-message saved-dg-warning "missed:" "$args"
}
+# Look for messages with 'note: ' prefixes.
+# In addition to standard compiler diagnostics ('DK_NOTE', 'inform' functions,
+# "for additional details on an error message"),
+# this also includes output from '-fopt-info' for 'MSG_NOTE':
+# a general optimization info.
+# By default, any *excess* notes are pruned, meaning their appearance doesn't
+# trigger *excess errors*. However, if 'dg-note' is used at least once in a
+# testcase, they're not pruned and instead must *all* be handled explicitly.
+# Thus, if looking for just single instances of messages with 'note: ' prefixes
+# without caring for all of them, use 'dg-message "note: [...]"' instead of
+# 'dg-note', or use 'dg-note' together with 'dg-prune-output "note: "'.
+
+variable prune_notes
+
+proc initialize_prune_notes { } {
+ global prune_notes
+ set prune_notes 1
+}
+
+initialize_prune_notes
+
+proc dg-note { args } {
+ upvar dg-messages dg-messages
+
+ global prune_notes
+ set prune_notes 0
+
+ process-message saved-dg-warning "note:" "$args"
+}
+
# Check the existence of a gdb in the path, and return true if there
# is one.
#
diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp
index dda4d0e..4d80606 100644
--- a/gcc/testsuite/lib/gcc.exp
+++ b/gcc/testsuite/lib/gcc.exp
@@ -134,6 +134,9 @@ proc gcc_target_compile { source dest type options } {
[info exists gluefile] } {
lappend options "libs=${gluefile}"
lappend options "ldflags=$wrap_flags"
+ if { $type == "executable" } {
+ set options [concat "{additional_flags=-dumpbase \"\"}" $options]
+ }
}
global TEST_EXTRA_LIBS
diff --git a/gcc/testsuite/lib/gdc-utils.exp b/gcc/testsuite/lib/gdc-utils.exp
index 6d4a15e..33c0145 100644
--- a/gcc/testsuite/lib/gdc-utils.exp
+++ b/gcc/testsuite/lib/gdc-utils.exp
@@ -145,37 +145,33 @@ proc gdc-convert-args { args } {
return $out
}
-proc gdc-copy-extra { base extra } {
- # Split base, folder/file.
- set type [file dirname $extra]
+proc gdc-copy-file { srcdir filename } {
+ # Split folder/file from the filename.
+ set targetdir [file dirname $filename]
- # print "Filename: $base - $extra"
+ # print "Filename: $srcdir - $filename"
- set fdin [open $base/$extra r]
- fconfigure $fdin -encoding binary
-
- file mkdir $type
- set fdout [open $extra w]
- fconfigure $fdout -encoding binary
-
- while { [gets $fdin copy_line] >= 0 } {
- set out_line $copy_line
- puts $fdout $out_line
- }
-
- close $fdin
- close $fdout
+ file mkdir $targetdir
+ file copy -force $srcdir/$filename $filename
# Remove file once test is finished.
upvar 2 cleanup_extra_files cleanups
- lappend cleanups $extra
-
- return $extra
+ lappend cleanups $filename
}
#
# Translate DMD test directives to dejagnu equivalent.
#
+# This procedure copies the test and all its dependencies from its source
+# location in `$srcdir/$type' to `$base_dir/$type'. A stub dejagnu test file
+# is then created in `$base_dir/gdc.test/$type' containing all translated test
+# directives. This stub is then the test that is handed over to `dg-test'.
+# Before invoking the compiler, the `gdc.test' prefix is trimmed from the test
+# `$prog' name in `gdc-dg-test' so that all copied tests then get picked up
+# with the correct path names.
+#
+# The following directives are recognized:
+#
# COMPILE_SEPARATELY: Not handled.
# EXECUTE_ARGS: Parameters to add to the execution of the test.
# COMPILED_IMPORTS: List of modules files that are imported by the main
@@ -215,29 +211,31 @@ proc gdc-convert-test { base test } {
upvar 1 compilable_do_what compilable_do_what
set compilable_output_file_ext ""
- # Split base, folder/file.
+ # Split folder/file from the test.
set type [file dirname $test]
set name [file tail $test]
# print "Filename: $base - $test"
+ gdc-copy-file $base $test
+ # Read in all test directives, and save the dejagnu equivalents to a new
+ # file that will be returned as the test to run.
set fdin [open $base/$test r]
#fconfigure $fdin -encoding binary
- file mkdir $type
- set fdout [open $test w]
+ # Include gdc.test prefix so test names follow DejaGnu conventions.
+ set testdir [file tail $base]
+ file mkdir $testdir/$type
+ set fdout [open $testdir/$test w]
#fconfigure $fdout -encoding binary
while { [gets $fdin copy_line] >= 0 } {
- set out_line $copy_line
if [regexp -- {COMPILE_SEPARATELY} $copy_line] {
# COMPILE_SEPARATELY is not handled.
- regsub -- {COMPILE_SEPARATELY.*$} $copy_line "" out_line
} elseif [regexp -- {DISABLED} $copy_line] {
# DISABLED is not handled.
- regsub -- {DISABLED.*$} $copy_line "" out_line
} elseif [regexp -- {LINK:} $copy_line] {
# LINK sets dg-do-what-default "link"
@@ -245,7 +243,6 @@ proc gdc-convert-test { base test } {
} elseif [regexp -- {POST_SCRIPT} $copy_line] {
# POST_SCRIPT is not handled
- regsub -- {POST_SCRIPT.*$} $copy_line "" out_line
} elseif [regexp -- {DFLAGS\s*:\s*(.*)} $copy_line match args] {
# DFLAGS overrides the default value of PERMUTE_ARGS.
@@ -253,32 +250,27 @@ proc gdc-convert-test { base test } {
error "gdc-convert-test: DFLAGS is not empty as expected"
}
set saw_test_flags 1
- regsub -- {DFLAGS.*$} $copy_line "" out_line
} elseif [regexp -- {PERMUTE_ARGS\s*:\s*(.*)} $copy_line match args] {
# PERMUTE_ARGS is handled by gdc-do-test.
set PERMUTE_ARGS [gdc-convert-args $args]
set saw_test_flags 1
- regsub -- {PERMUTE_ARGS.*$} $copy_line "" out_line
} elseif [regexp -- {EXECUTE_ARGS\s*:\s*(.*)} $copy_line match args] {
# EXECUTE_ARGS is handled by gdc_load.
foreach arg $args {
lappend GDC_EXECUTE_ARGS $arg
}
- regsub -- {EXECUTE_ARGS.*$} $copy_line "" out_line
} elseif [regexp -- {REQUIRED_ARGS\s*:\s*(.*)} $copy_line match args] {
# Convert all listed arguments to from dmd to gdc-style.
- set new_option "{ dg-additional-options \"[gdc-convert-args $args]\" }"
- regsub -- {REQUIRED_ARGS.*$} $copy_line $new_option out_line
+ puts $fdout "// { dg-additional-options \"[gdc-convert-args $args]\" }"
} elseif [regexp -- {EXTRA_SOURCES\s*:\s*(.*)} $copy_line match sources] {
# EXTRA_SOURCES are appended to extra_sources list
foreach srcfile $sources {
lappend extra_sources $srcfile
}
- regsub -- {EXTRA_SOURCES.*$} $copy_line "" out_line
} elseif [regexp -- {EXTRA_CPP_SOURCES\s*:\s*(.*)} $copy_line match sources] {
# EXTRA_CPP_SOURCES are appended to extra_sources list
@@ -286,50 +278,43 @@ proc gdc-convert-test { base test } {
# C++ sources are found in the extra-files directory.
lappend extra_sources "extra-files/$srcfile"
}
- regsub -- {EXTRA_CPP_SOURCES.*$} $copy_line "" out_line
} elseif [regexp -- {EXTRA_FILES\s*:\s*(.*)} $copy_line match files] {
# EXTRA_FILES are appended to extra_files list
foreach file $files {
lappend extra_files $file
}
- regsub -- {EXTRA_FILES.*$} $copy_line "" out_line
} elseif [regexp -- {COMPILED_IMPORTS\s*:\s*(.*)} $copy_line match sources] {
# COMPILED_IMPORTS are appended to extra_sources list
foreach import $sources {
lappend extra_sources $import
}
- regsub -- {COMPILED_IMPORTS.*$} $copy_line "" out_line
} elseif [regexp -- {RUNNABLE_PHOBOS_TEST} $copy_line match sources] {
# RUNNABLE_PHOBOS_TEST annotates tests that import the std module.
# It will need skipping if phobos is not available on the target.
- regsub -- {RUNNABLE_PHOBOS_TEST.*$} $copy_line "" out_line
set needs_phobos 1
} elseif [regexp -- {COMPILABLE_MATH_TEST} $copy_line match sources] {
# COMPILABLE_MATH_TEST annotates tests that import the std.math
# module. Which will need skipping if not available on the target.
- regsub -- {RUNNABLE_PHOBOS_TEST.*$} $copy_line "" out_line
set needs_phobos 1
}
-
- puts $fdout $out_line
}
# Now that all extra sources and files have been collected, copy them all
# to the testsuite build directory.
if { [llength $extra_sources] > 0 } {
foreach srcfile $extra_sources {
- gdc-copy-extra $base "$type/$srcfile"
+ gdc-copy-file $base "$type/$srcfile"
}
puts $fdout "// { dg-additional-sources \"$extra_sources\" }"
}
if { [llength $extra_files] > 0 } {
foreach file $extra_files {
- gdc-copy-extra $base "$type/$file"
+ gdc-copy-file $base "$type/$file"
}
puts $fdout "// { dg-additional-files \"$extra_files\" }"
}
@@ -367,9 +352,9 @@ proc gdc-convert-test { base test } {
# Check that file generation tests output the expected file.
set genfile "[file rootname $name].$compilable_output_file_ext"
puts $fdout "// { dg-final { if \[file exists $genfile\] \\{ } }"
- puts $fdout "// { dg-final { pass \"$test (file exists $genfile)\" } }"
+ puts $fdout "// { dg-final { pass \"$testdir/$test (file exists $genfile)\" } }"
puts $fdout "// { dg-final { \\} else \\{ } }"
- puts $fdout "// { dg-final { fail \"$test (file exists $genfile)\" } }"
+ puts $fdout "// { dg-final { fail \"$testdir/$test (file exists $genfile)\" } }"
puts $fdout "// { dg-final { \\} } }"
# Cleanup extra generated files.
puts $fdout "// { dg-final { file delete $genfile } }"
@@ -387,7 +372,7 @@ proc gdc-convert-test { base test } {
close $fdin
close $fdout
- return $test
+ return $testdir/$test
}
proc gdc-permute-options { options } {
@@ -413,7 +398,6 @@ proc gdc-permute-options { options } {
proc gdc-do-test { testcases } {
global dg-do-what-default
- global subdir
global verbose
# If a testcase doesn't have special options, use these.
@@ -441,10 +425,6 @@ proc gdc-do-test { testcases } {
set saved-dg-do-what-default ${dg-do-what-default}
- # Create gdc.test link so test names include that subdir.
- set testdir [file dirname $subdir]
- catch { file link $testdir . }
-
# Main loop.
# set verbose 1
@@ -457,8 +437,7 @@ proc gdc-do-test { testcases } {
set imports [format "-I%s/%s" $base $type]
set cleanup_extra_files ""
set compilable_do_what "compile"
- # Include $testdir prefix so test names follow DejaGnu conventions.
- set filename "$testdir/[gdc-convert-test $base $type/$name.$ext]"
+ set filename "[gdc-convert-test $base $type/$name.$ext]"
if { $type == "runnable" || $type == "runnable_cxx" } {
append PERMUTE_ARGS " $SHARED_OPTION"
diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp
index 1e7da11..43f4d4e 100644
--- a/gcc/testsuite/lib/gfortran.exp
+++ b/gcc/testsuite/lib/gfortran.exp
@@ -151,6 +151,7 @@ proc gfortran_init { args } {
global gcc_warning_prefix
global gcc_error_prefix
global TEST_ALWAYS_FLAGS
+ global gfortran_init_set_GFORTRAN_UNDER_TEST
# We set LC_ALL and LANG to C so that we get the same error messages as expected.
setenv LC_ALL C
@@ -166,7 +167,11 @@ proc gfortran_init { args } {
setenv LANG C.ASCII
}
- if ![info exists GFORTRAN_UNDER_TEST] then {
+ # GFORTRAN_UNDER_TEST as set below contains $specpath, which depends on
+ # the used multilib config. Thus, its value may need to be reset;
+ # that's tracked via gfortran_init_set_GFORTRAN_UNDER_TEST.
+ if { ![info exists GFORTRAN_UNDER_TEST]
+ || [info exists gfortran_init_set_GFORTRAN_UNDER_TEST] } then {
if [info exists TOOL_EXECUTABLE] {
set GFORTRAN_UNDER_TEST $TOOL_EXECUTABLE
} else {
@@ -178,6 +183,7 @@ proc gfortran_init { args } {
} else {
set specpath [get_multilibs]
}
+ set gfortran_init_set_GFORTRAN_UNDER_TEST 1
set GFORTRAN_UNDER_TEST [findfile $base_dir/../../gfortran "$base_dir/../../gfortran -B$base_dir/../../ -B$specpath/libgfortran/" [findfile $base_dir/gfortran "$base_dir/gfortran -B$base_dir/" [transform gfortran]]]
}
}
diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
index 94a81ff..d0e0dc6 100644
--- a/gcc/testsuite/lib/lto.exp
+++ b/gcc/testsuite/lib/lto.exp
@@ -159,8 +159,15 @@ proc lto_prune_warns { text } {
regsub -all "(^|\n)\[ \t\]*\[\(\]file \[^\n\]* value=\[^\n\]*; file \[^\n\]* value=\[^\n\]*\[)\];" $text "" text
regsub -all "(^|\n)\[ \t\]*\[^\n\]* definition taken" $text "" text
- # Ignore informational notes.
- regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ # Ignore missing jobserver for tests that do more than 1 LTRANS unit
+ regsub -all "(^|\n)\[^\n\]*: warning: using serial compilation of \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: note: see the \[^\n\]*'-flto' option documentation\[^\n\]* for more information" $text "" text
+
+ global prune_notes
+ if { $prune_notes } {
+ # Ignore informational notes.
+ regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ }
verbose "lto_prune_warns: exit: $text" 2
@@ -387,8 +394,8 @@ proc lto-can-handle-directive { op } {
# A list of directives to recognize, and a list of directives
# to remap them to.
# For example, "dg-lto-warning" is implemented by calling "dg-warning".
- set directives { dg-lto-warning dg-lto-message }
- set remapped_directives { dg-warning dg-message }
+ set directives { dg-lto-warning dg-lto-message dg-lto-note }
+ set remapped_directives { dg-warning dg-message dg-note }
set idx [lsearch -exact $directives $cmd]
if { $idx != -1 } {
@@ -594,7 +601,7 @@ proc lto-get-options { src } {
#
# SRC1 is the full pathname of the main file of the testcase.
# SID identifies a test suite in the names of temporary files.
-proc lto-execute { src1 sid } {
+proc lto-execute-1 { src1 sid } {
global srcdir tmpdir
global lto_option_list
global tool
@@ -808,6 +815,14 @@ proc lto-execute { src1 sid } {
}
}
+proc lto-execute { src1 sid } {
+ lto-execute-1 $src1 $sid
+
+ # LTO testing doesn't use 'dg-runtest'/'dg-test', and thus doesn't call
+ # 'cleanup-after-saved-dg-test', so we have to clean up manually.
+ initialize_prune_notes
+}
+
# Call pass if object readelf is ok, otherwise fail.
# example: /* { dg-final { object-readelf Tag_ABI_enum_size int} } */
proc object-readelf { args } {
diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index 9997eb3..25f45ec 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -289,8 +289,8 @@ proc auto-profopt-execute { src } {
return
}
set profile_wrapper [profopt-perf-wrapper]
- set profile_option "-g -DFOR_AUTOFDO_TESTING"
- set feedback_option "-fauto-profile -DFOR_AUTOFDO_TESTING"
+ set profile_option "-gdwarf-4 -DFOR_AUTOFDO_TESTING"
+ set feedback_option "-fauto-profile -DFOR_AUTOFDO_TESTING -fearly-inlining"
set run_autofdo 1
profopt-execute $src
unset profile_wrapper
@@ -451,7 +451,7 @@ proc profopt-execute { src } {
# convert profile
if { $run_autofdo == 1 } {
set bprefix "afdo."
- set cmd "create_gcov --binary $execname1 --profile=$tmpdir/$base.perf.data -gcov_version=1 --gcov=$tmpdir/$bprefix$base.$ext"
+ set cmd "create_gcov --binary $execname1 --profile=$tmpdir/$base.perf.data -gcov_version=2 --gcov=$tmpdir/$bprefix$base.$ext"
verbose "Running $cmd"
set id [remote_spawn "" $cmd]
if { $id < 0 } {
diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp
index 2809f88..91f165b 100644
--- a/gcc/testsuite/lib/prune.exp
+++ b/gcc/testsuite/lib/prune.exp
@@ -54,8 +54,11 @@ proc prune_gcc_output { text } {
regsub -all "(^|\n)\[ \]+from \[^\n\]*" $text "" text
regsub -all "(^|\n)(In|of) module( \[^\n \]*,)? imported at \[^\n\]*" $text "" text
- # Ignore informational notes.
- regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ global prune_notes
+ if { $prune_notes } {
+ # Ignore informational notes.
+ regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ }
# Ignore harmless -fpic warnings.
regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index e723608..0dcb893 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -754,7 +754,7 @@ proc scan-lto-assembler { args } {
set testcase [testname-for-summary]
# The name might include a list of options; extract the file name.
set filename [lindex $testcase 0]
- set output_file "[file rootname [file tail $filename]].exe.ltrans0.s"
+ set output_file "[file rootname [file tail $filename]].ltrans0.ltrans.s"
verbose "output_file: $output_file"
dg-scan "scan-lto-assembler" 1 $testcase $output_file $args
}
diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp
index c014abc..94ba79e 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -570,7 +570,15 @@ if { [info procs saved-dg-process-target] == [list] } {
# Evaluate a selector expression.
proc selector_expression { exp } {
- if { [llength $exp] == 2 } {
+ if { [llength $exp] >= 2
+ && [string match "any-opts" [lindex $exp 0]] } {
+ set args [list "" { *-*-* } [lrange $exp 1 end] ""]
+ set answer [check_conditional_xfail $args]
+ } elseif { [llength $exp] >= 2
+ && [string match "no-opts" [lindex $exp 0]] } {
+ set args [list "" { *-*-* } "*" [lrange $exp 1 end]]
+ set answer [check_conditional_xfail $args]
+ } elseif { [llength $exp] == 2 } {
if [string match "!" [lindex $exp 0]] {
set op1 [lindex $exp 1]
set answer [expr { ! [selector_opd $op1] }]
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index a90c375..82dc131 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -626,7 +626,7 @@ 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 -o perf.data -m8 "
+ return "$srcdir/../config/i386/gcc-auto-profile -m8 "
}
# Return true if profiling is supported on the target.
@@ -1067,6 +1067,12 @@ proc check_effective_target_mmap {} {
return [check_function_available "mmap"]
}
+# Return 1 if the target supports sysconf, 0 otherwise.
+
+proc check_effective_target_sysconf {} {
+ return [check_function_available "sysconf"]
+}
+
# Return 1 if the target supports dlopen, 0 otherwise.
proc check_effective_target_dlopen {} {
return [check_no_compiler_messages dlopen executable {
@@ -1570,6 +1576,22 @@ proc check_effective_target_fortran_real_10 { } {
}]
}
+# Return 1 if the target supports Fortran real kind C_FLOAT128,
+# 0 otherwise. This differs from check_effective_target_fortran_real_16
+# because __float128 has the additional requirement that it be the
+# 128-bit IEEE encoding; even if __float128 is available in C, it may not
+# have a corresponding Fortran kind on targets (PowerPC) that use some
+# other encoding for long double/TFmode/real(16).
+proc check_effective_target_fortran_real_c_float128 { } {
+ return [check_no_compiler_messages fortran_real_c_float128 executable {
+ ! Fortran
+ use iso_c_binding
+ real(kind=c_float128) :: x
+ x = cos (x)
+ end
+ }]
+}
+
# Return 1 if the target supports Fortran's IEEE modules,
# 0 otherwise.
#
@@ -2354,6 +2376,134 @@ proc check_effective_target_ppc_ieee128_ok { } {
}]
}
+# Check if GCC and GLIBC supports explicitly specifying that the long double
+# format uses the IBM 128-bit extended double format. Under little endian
+# PowerPC Linux, you need GLIBC 2.32 or later to be able to use a different
+# long double format for running a program than the system default.
+
+proc check_effective_target_long_double_ibm128 { } {
+ return [check_runtime_nocache long_double_ibm128 {
+ #include <string.h>
+ #include <stdio.h>
+ /* use volatile to prevent optimization. */
+ volatile __ibm128 a = (__ibm128) 3.0;
+ volatile long double one = 1.0L;
+ volatile long double two = 2.0L;
+ volatile long double b;
+ char buffer[20];
+ int main()
+ {
+ __ibm128 a2;
+ long double b2;
+ if (sizeof (long double) != 16)
+ return 1;
+ b = one + two;
+ /* eliminate removing volatile cast warning. */
+ a2 = a;
+ b2 = b;
+ if (memcmp (&a2, &b2, 16) != 0)
+ return 1;
+ sprintf (buffer, "%lg", b);
+ return strcmp (buffer, "3") != 0;
+ }
+ } [add_options_for_long_double_ibm128 ""]]
+}
+
+# Return the appropriate options to specify that long double uses the IBM
+# 128-bit format on PowerPC.
+
+proc add_options_for_long_double_ibm128 { flags } {
+ if { [istarget powerpc*-*-*] } {
+ return "$flags -mlong-double-128 -Wno-psabi -mabi=ibmlongdouble"
+ }
+ return "$flags"
+}
+
+# Check if GCC and GLIBC supports explicitly specifying that the long double
+# format uses the IEEE 128-bit format. Under little endian PowerPC Linux, you
+# need GLIBC 2.32 or later to be able to use a different long double format for
+# running a program than the system default.
+
+proc check_effective_target_long_double_ieee128 { } {
+ return [check_runtime_nocache long_double_ieee128 {
+ #include <string.h>
+ #include <stdio.h>
+ /* use volatile to prevent optimization. */
+ volatile _Float128 a = 3.0f128;
+ volatile long double one = 1.0L;
+ volatile long double two = 2.0L;
+ volatile long double b;
+ char buffer[20];
+ int main()
+ {
+ _Float128 a2;
+ long double b2;
+ if (sizeof (long double) != 16)
+ return 1;
+ b = one + two;
+ /* eliminate removing volatile cast warning. */
+ a2 = a;
+ b2 = b;
+ if (memcmp (&a2, &b2, 16) != 0)
+ return 1;
+ sprintf (buffer, "%lg", b);
+ return strcmp (buffer, "3") != 0;
+ }
+ } [add_options_for_long_double_ieee128 ""]]
+}
+
+# Return the appropriate options to specify that long double uses the IBM
+# 128-bit format on PowerPC.
+proc add_options_for_long_double_ieee128 { flags } {
+ if { [istarget powerpc*-*-*] } {
+ return "$flags -mlong-double-128 -Wno-psabi -mabi=ieeelongdouble"
+ }
+ return "$flags"
+}
+
+# Check if GCC and GLIBC supports explicitly specifying that the long double
+# format uses the IEEE 64-bit. Under little endian PowerPC Linux, you need
+# GLIBC 2.32 or later to be able to use a different long double format for
+# running a program than the system default.
+
+proc check_effective_target_long_double_64bit { } {
+ return [check_runtime_nocache long_double_64bit {
+ #include <string.h>
+ #include <stdio.h>
+ /* use volatile to prevent optimization. */
+ volatile double a = 3.0;
+ volatile long double one = 1.0L;
+ volatile long double two = 2.0L;
+ volatile long double b;
+ char buffer[20];
+ int main()
+ {
+ double a2;
+ long double b2;
+ if (sizeof (long double) != 8)
+ return 1;
+ b = one + two;
+ /* eliminate removing volatile cast warning. */
+ a2 = a;
+ b2 = b;
+ if (memcmp (&a2, &b2, 16) != 0)
+ return 1;
+ sprintf (buffer, "%lg", b);
+ return strcmp (buffer, "3") != 0;
+ }
+ } [add_options_for_ppc_long_double_override_64bit ""]]
+}
+
+# Return the appropriate options to specify that long double uses the IEEE
+# 64-bit format on PowerPC.
+
+proc add_options_for_long_double_64bit { flags } {
+ if { [istarget powerpc*-*-*] } {
+ return "$flags -mlong-double-64"
+ }
+ return "$flags"
+}
+
# Return 1 if the target supports executing VSX instructions, 0
# otherwise. Cache the result.
@@ -3014,7 +3164,7 @@ proc check_effective_target_has_q_floating_suffix { } {
proc check_effective_target_float16 {} {
return [check_no_compiler_messages_nocache float16 object {
- _Float16 x;
+ _Float16 foo (_Float16 x) { return x; }
} [add_options_for_float16 ""]]
}
@@ -3498,7 +3648,9 @@ proc check_effective_target_vect_intfloat_cvt { } {
|| [is-effective-target arm_neon]
|| ([istarget mips*-*-*]
&& [et-is-effective-target mips_msa])
- || [istarget amdgcn-*-*] }}]
+ || [istarget amdgcn-*-*]
+ || ([istarget s390*-*-*]
+ && [check_effective_target_s390_vxe2]) }}]
}
# Return 1 if the target supports signed double->int conversion
@@ -3515,7 +3667,9 @@ proc check_effective_target_vect_doubleint_cvt { } {
|| [istarget aarch64*-*-*]
|| ([istarget powerpc*-*-*] && [check_vsx_hw_available])
|| ([istarget mips*-*-*]
- && [et-is-effective-target mips_msa]) }}]
+ && [et-is-effective-target mips_msa])
+ || ([istarget s390*-*-*]
+ && [check_effective_target_s390_vx]) }}]
}
# Return 1 if the target supports signed int->double conversion
@@ -3532,7 +3686,9 @@ proc check_effective_target_vect_intdouble_cvt { } {
|| [istarget aarch64*-*-*]
|| ([istarget powerpc*-*-*] && [check_vsx_hw_available])
|| ([istarget mips*-*-*]
- && [et-is-effective-target mips_msa]) }}]
+ && [et-is-effective-target mips_msa])
+ || ([istarget s390*-*-*]
+ && [check_effective_target_s390_vx]) }}]
}
#Return 1 if we're supporting __int128 for target, 0 otherwise.
@@ -3561,7 +3717,9 @@ proc check_effective_target_vect_uintfloat_cvt { } {
|| [is-effective-target arm_neon]
|| ([istarget mips*-*-*]
&& [et-is-effective-target mips_msa])
- || [istarget amdgcn-*-*] }}]
+ || [istarget amdgcn-*-*]
+ || ([istarget s390*-*-*]
+ && [check_effective_target_s390_vxe2]) }}]
}
@@ -3576,7 +3734,9 @@ proc check_effective_target_vect_floatint_cvt { } {
|| [is-effective-target arm_neon]
|| ([istarget mips*-*-*]
&& [et-is-effective-target mips_msa])
- || [istarget amdgcn-*-*] }}]
+ || [istarget amdgcn-*-*]
+ || ([istarget s390*-*-*]
+ && [check_effective_target_s390_vxe2]) }}]
}
# Return 1 if the target supports unsigned float->int conversion
@@ -3589,7 +3749,9 @@ proc check_effective_target_vect_floatuint_cvt { } {
|| [is-effective-target arm_neon]
|| ([istarget mips*-*-*]
&& [et-is-effective-target mips_msa])
- || [istarget amdgcn-*-*] }}]
+ || [istarget amdgcn-*-*]
+ || ([istarget s390*-*-*]
+ && [check_effective_target_s390_vxe2]) }}]
}
# Return 1 if peeling for alignment might be profitable on the target
@@ -4162,24 +4324,64 @@ proc add_options_for_arm_simd32 { flags } {
return "$flags $et_arm_simd32_flags"
}
-# Return 1 if this is an ARM target supporting the saturation intrinsics
-# from arm_acle.h. Some multilibs may be incompatible with these options.
-# Also set et_arm_qbit_flags to the best options to add.
+# Return 1 if this is an ARM target supporting the __ssat and __usat
+# saturation intrinsics from arm_acle.h. Some multilibs may be
+# incompatible with these options. Also set et_arm_sat_flags to the
+# best options to add. arm_acle.h includes stdint.h which can cause
+# trouble with incompatible -mfloat-abi= options.
+
+proc check_effective_target_arm_sat_ok_nocache { } {
+ global et_arm_sat_flags
+ set et_arm_sat_flags ""
+ foreach flags {"" "-march=armv6" "-march=armv6 -mfloat-abi=softfp" "-march=armv6 -mfloat-abi=hard -mfpu=vfp"} {
+ if { [check_no_compiler_messages_nocache et_arm_sat_flags object {
+ #include <arm_acle.h>
+ int dummy;
+ #ifndef __ARM_FEATURE_SAT
+ #error not SAT
+ #endif
+ } "$flags"] } {
+ set et_arm_sat_flags $flags
+ return 1
+ }
+ }
+
+ return 0
+}
+
+proc check_effective_target_arm_sat_ok { } {
+ return [check_cached_effective_target et_arm_sat_flags \
+ check_effective_target_arm_sat_ok_nocache]
+}
+
+proc add_options_for_arm_sat { flags } {
+ if { ! [check_effective_target_arm_sat_ok] } {
+ return "$flags"
+ }
+ global et_arm_sat_flags
+ return "$flags $et_arm_sat_flags"
+}
+
+# Return 1 if this is an ARM target supporting the DSP intrinsics from
+# arm_acle.h. Some multilibs may be incompatible with these options.
+# Also set et_arm_dsp_flags to the best options to add.
# arm_acle.h includes stdint.h which can cause trouble with incompatible
# -mfloat-abi= options.
+# check_effective_target_arm_dsp also exists, which checks the current
+# multilib, without trying other options.
-proc check_effective_target_arm_qbit_ok_nocache { } {
- global et_arm_qbit_flags
- set et_arm_qbit_flags ""
+proc check_effective_target_arm_dsp_ok_nocache { } {
+ global et_arm_dsp_flags
+ set et_arm_dsp_flags ""
foreach flags {"" "-march=armv5te" "-march=armv5te -mfloat-abi=softfp" "-march=armv5te -mfloat-abi=hard"} {
- if { [check_no_compiler_messages_nocache et_arm_qbit_flags object {
+ if { [check_no_compiler_messages_nocache et_arm_dsp_ok object {
#include <arm_acle.h>
int dummy;
- #ifndef __ARM_FEATURE_QBIT
- #error not QBIT
+ #ifndef __ARM_FEATURE_DSP
+ #error not DSP
#endif
} "$flags"] } {
- set et_arm_qbit_flags $flags
+ set et_arm_dsp_flags $flags
return 1
}
}
@@ -4187,17 +4389,17 @@ proc check_effective_target_arm_qbit_ok_nocache { } {
return 0
}
-proc check_effective_target_arm_qbit_ok { } {
- return [check_cached_effective_target et_arm_qbit_flags \
- check_effective_target_arm_qbit_ok_nocache]
+proc check_effective_target_arm_dsp_ok { } {
+ return [check_cached_effective_target et_arm_dsp_flags \
+ check_effective_target_arm_dsp_ok_nocache]
}
-proc add_options_for_arm_qbit { flags } {
- if { ! [check_effective_target_arm_qbit_ok] } {
+proc add_options_for_arm_dsp { flags } {
+ if { ! [check_effective_target_arm_dsp_ok] } {
return "$flags"
}
- global et_arm_qbit_flags
- return "$flags $et_arm_qbit_flags"
+ global et_arm_dsp_flags
+ return "$flags $et_arm_dsp_flags"
}
# Return 1 if this is an ARM target supporting -mfpu=neon without any
@@ -4815,6 +5017,22 @@ proc check_effective_target_arm_cmse_ok {} {
} "-mcmse"];
}
+# Return 1 if the target supports executing CMSE instructions, 0
+# otherwise. Cache the result.
+
+proc check_effective_target_arm_cmse_hw { } {
+ return [check_runtime arm_cmse_hw_available {
+ int main (void)
+ {
+ unsigned id_pfr1;
+ asm ("ldr\t%0, =0xe000ed44\n" \
+ "ldr\t%0, [%0]\n" \
+ "sg" : "=l" (id_pfr1));
+ /* Exit with code 0 iff security extension is available. */
+ return !(id_pfr1 & 0xf0);
+ }
+ } "-mcmse"]
+}
# Return 1 if the target supports executing MVE instructions, 0
# otherwise.
@@ -5025,7 +5243,7 @@ proc check_effective_target_arm_v8_1m_mve_fp_ok_nocache { } {
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
- foreach flags {"" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve.fp" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve.fp"} {
+ foreach flags {"" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve.fp" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve.fp"} {
if { [check_no_compiler_messages_nocache \
arm_v8_1m_mve_fp_ok object {
#include <arm_mve.h>
@@ -5208,7 +5426,7 @@ proc check_effective_target_arm_v8_1m_mve_ok_nocache { } {
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
- foreach flags {"" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve"} {
+ foreach flags {"" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve"} {
if { [check_no_compiler_messages_nocache \
arm_v8_1m_mve_ok object {
#if !defined (__ARM_FEATURE_MVE)
@@ -5267,7 +5485,7 @@ proc check_effective_target_arm_v8_2a_i8mm_ok_nocache { } {
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
- foreach flags {"" "-mfloat-abi=hard -mfpu=neon-fp-armv8" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" } {
+ 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_i8mm_ok object {
#include <arm_neon.h>
@@ -5352,7 +5570,7 @@ proc check_effective_target_arm_v8_2a_bf16_neon_ok_nocache { } {
return 0;
}
- foreach flags {"" "-mfloat-abi=hard -mfpu=neon-fp-armv8" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" } {
+ 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)
@@ -5445,6 +5663,24 @@ foreach { armfunc armflag armdef arminc } {
global et_FUNC_flags
return "$flags $et_FUNC_flags"
}
+
+ proc check_effective_target_FUNC_multilib { } {
+ if { ! [check_effective_target_FUNC_ok] } {
+ return 0;
+ }
+ return [check_runtime FUNC_multilib {
+ #if !(DEF)
+ #error "DEF failed"
+ #endif
+ #include <arm_cde.h>
+ INC
+ int
+ main (void)
+ {
+ return 0;
+ }
+ } [add_options_for_FUNC ""]]
+ }
}]
}
@@ -5621,6 +5857,43 @@ proc check_effective_target_arm_v8_2a_dotprod_neon_hw { } {
} [add_options_for_arm_v8_2a_dotprod_neon ""]]
}
+# Return 1 if the target supports executing AdvSIMD instructions from ARMv8.2
+# with the i8mm extension, 0 otherwise. The test is valid for ARM and for
+# AArch64.
+
+proc check_effective_target_arm_v8_2a_i8mm_neon_hw { } {
+ if { ![check_effective_target_arm_v8_2a_i8mm_ok] } {
+ return 0;
+ }
+ return [check_runtime arm_v8_2a_i8mm_neon_hw_available {
+ #include "arm_neon.h"
+ int
+ main (void)
+ {
+
+ uint32x2_t results = {0,0};
+ uint8x8_t a = {1,1,1,1,2,2,2,2};
+ int8x8_t b = {2,2,2,2,3,3,3,3};
+
+ #ifdef __ARM_ARCH_ISA_A64
+ asm ("usdot %0.2s, %1.8b, %2.8b"
+ : "=w"(results)
+ : "w"(a), "w"(b)
+ : /* No clobbers. */);
+
+ #else
+ asm ("vusdot.u8 %P0, %P1, %P2"
+ : "=w"(results)
+ : "w"(a), "w"(b)
+ : /* No clobbers. */);
+ #endif
+
+ return (vget_lane_u32 (results, 0) == 8
+ && vget_lane_u32 (results, 1) == 24) ? 1 : 0;
+ }
+ } [add_options_for_arm_v8_2a_i8mm ""]]
+}
+
# Return 1 if this is a ARM target with NEON enabled.
proc check_effective_target_arm_neon { } {
@@ -6054,6 +6327,16 @@ proc check_effective_target_has_arch_pwr9 { } {
}]
}
+proc check_effective_target_has_arch_pwr10 { } {
+ return [check_no_compiler_messages arch_pwr10 assembly {
+ #ifndef _ARCH_PWR10
+ #error does not have power10 support.
+ #else
+ /* "has power10 support" */
+ #endif
+ }]
+}
+
# Return 1 if this is a PowerPC target supporting -mcpu=power10.
# Limit this to 64-bit linux systems for now until other targets support
# power10.
@@ -6977,6 +7260,19 @@ proc check_effective_target_vect_udot_qi { } {
}
# Return 1 if the target plus current options supports a vector
+# dot-product where one operand of the multiply is signed char
+# and the other unsigned chars, 0 otherwise.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_vect_usdot_qi { } {
+ return [check_cached_effective_target_indexed vect_usdot_qi {
+ expr { [istarget aarch64*-*-*]
+ || [istarget arm*-*-*] }}]
+}
+
+
+# Return 1 if the target plus current options supports a vector
# dot-product of signed shorts, 0 otherwise.
#
# This won't change for different subtargets so cache the result.
@@ -7553,6 +7849,7 @@ proc available_vector_sizes { } {
if { ![is-effective-target ia32] } {
lappend result 64
}
+ lappend result 32
} elseif { [istarget sparc*-*-*] } {
lappend result 64
} elseif { [istarget amdgcn*-*-*] } {
@@ -7582,6 +7879,12 @@ proc check_effective_target_vect64 { } {
return [expr { [lsearch -exact [available_vector_sizes] 64] >= 0 }]
}
+# Return 1 if the target supports vectors of 32 bits.
+
+proc check_effective_target_vect32 { } {
+ return [expr { [lsearch -exact [available_vector_sizes] 32] >= 0 }]
+}
+
# Return 1 if the target supports vector copysignf calls.
proc check_effective_target_vect_call_copysignf { } {
@@ -8208,6 +8511,18 @@ proc check_effective_target_stdint_types { } {
}]
}
+# Like check_effective_target_stdint_types, but test what happens when
+# -mbig-endian is passed. This test only makes sense on targets that
+# support -mbig-endian; it will fail elsewhere.
+
+proc check_effective_target_stdint_types_mbig_endian { } {
+ return [check_no_compiler_messages stdint_types_mbig_endian assembly {
+ #include <stdint.h>
+ int8_t a; int16_t b; int32_t c; int64_t d;
+ uint8_t e; uint16_t f; uint32_t g; uint64_t h;
+ } "-mbig-endian"]
+}
+
# Return 1 if target has the basic signed and unsigned types in
# <inttypes.h>, 0 otherwise. This is for tests that GCC's notions of
# these types agree with those in the header, as some systems have
@@ -8562,6 +8877,17 @@ proc check_prefer_avx128 { } {
}
+# Return 1 if avx512fp16 instructions can be compiled.
+
+proc check_effective_target_avx512fp16 { } {
+ return [check_no_compiler_messages avx512fp16 object {
+ void foo (void)
+ {
+ asm volatile ("vmovw %edi, %xmm0");
+ }
+ } "-O2 -mavx512fp16" ]
+}
+
# Return 1 if avx512f instructions can be compiled.
proc check_effective_target_avx512f { } {
@@ -9302,7 +9628,14 @@ proc check_effective_target_gas { } {
set status [remote_exec host "$gcc_as" "-v /dev/null"]
set as_output [lindex $status 1]
if { [ string first "GNU" $as_output ] >= 0 } {
- set use_gas_saved 1
+ # Some Darwin versions have an assembler which is based on an old
+ # version of GAS (and reports GNU assembler in its -v output) but
+ # but doesn't support many of the modern GAS features.
+ if { [ string first "cctools" $as_output ] >= 0 } {
+ set use_gas_saved 0
+ } else {
+ set use_gas_saved 1
+ }
} else {
set use_gas_saved 0
}
@@ -9721,7 +10054,10 @@ proc check_vect_support_and_set_flags { } {
lappend DEFAULT_VECTCFLAGS "--param" "max-unroll-times=8"
lappend DEFAULT_VECTCFLAGS "--param" "max-completely-peeled-insns=200"
lappend DEFAULT_VECTCFLAGS "--param" "max-completely-peel-times=16"
- if [check_effective_target_s390_vxe] {
+ if [check_effective_target_s390_vxe2] {
+ lappend DEFAULT_VECTCFLAGS "-march=z15" "-mzarch"
+ set dg-do-what-default run
+ } elseif [check_effective_target_s390_vxe] {
lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch"
set dg-do-what-default run
} elseif [check_effective_target_s390_vx] {
@@ -11015,3 +11351,13 @@ proc check_effective_target_lra { } {
return 1
}
+# Test whether optimizations are enabled ('__OPTIMIZE__') per the
+# 'current_compiler_flags' (thus don't cache).
+
+proc check_effective_target___OPTIMIZE__ {} {
+ return [check_no_compiler_messages_nocache __OPTIMIZE__ assembly {
+ #ifndef __OPTIMIZE__
+ # error nein
+ #endif
+ } [current_compiler_flags]]
+}
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-1.mm
new file mode 100644
index 0000000..e5708c2
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-1.mm
@@ -0,0 +1,34 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) method;
+- (int) method;
++ (int) unavailableClassMethod __attribute__((unavailable));
+- (int) unavailableInstanceMethod __attribute__((unavailable));
+@end
+
+/* Test that deprecation warnings are produced, but not if the
+ receiver is of type 'id'. */
+void foo (void)
+{
+ Class c;
+ id object;
+ MyClass *another_object;
+
+ [c method];
+ [object method];
+ [c unavailableClassMethod];
+ [object unavailableInstanceMethod];
+
+ [object method];
+ [another_object method];
+ [MyClass unavailableClassMethod]; /* { dg-error "is unavailable" } */
+ [another_object unavailableInstanceMethod]; /* { dg-error "is unavailable" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-2.mm b/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-2.mm
new file mode 100644
index 0000000..68ea46d
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-2.mm
@@ -0,0 +1,24 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) unavailableClassMethod: (id)firstObject, ... __attribute__((sentinel)) __attribute__((unavailable));
+- (int) unavailableInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((unavailable));
+@end
+
+/* Test that unavailability errors are produced even if the method is
+ also marked with another attribute too (this is to test the
+ processing of multiple attributes). */
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass unavailableClassMethod: object, nil]; /* { dg-error "is unavailable" } */
+ [object unavailableInstanceMethod: object, nil]; /* { dg-error "is unavailable" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-3.mm b/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-3.mm
new file mode 100644
index 0000000..9e55ae1
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-unavailable-3.mm
@@ -0,0 +1,22 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <objc/objc.h>
+
+/* Test that __attribute__ ((__unavailable__)) works as well as __attribute__ ((unavailable)). */
+@interface MyClass
+{
+ Class isa;
+}
++ (int) unavailableClassMethod: (id)firstObject, ... __attribute__((__unavailable__));
+- (int) unavailableInstanceMethod: (id)firstobject, ... __attribute__((__unavailable__));
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass unavailableClassMethod: object, nil]; /* { dg-error "is unavailable" } */
+ [object unavailableInstanceMethod: object, nil]; /* { dg-error "is unavailable" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/pr101666-0.mm b/gcc/testsuite/obj-c++.dg/pr101666-0.mm
new file mode 100644
index 0000000..5f87f60
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/pr101666-0.mm
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+/* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
+/* { dg-skip-if "ABI 2 only" { *-*-* && { ! objc2 } } { "*" } { "" } } */
+/* { dg-additional-options "-fobjc-nilcheck -Wno-objc-root-class" } */
+
+#include "pr101666.inc"
+
diff --git a/gcc/testsuite/obj-c++.dg/pr101666-1.mm b/gcc/testsuite/obj-c++.dg/pr101666-1.mm
new file mode 100644
index 0000000..41ef370
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/pr101666-1.mm
@@ -0,0 +1,10 @@
+/* Later versions of Darwin can compile for 10.5, but cannot link it so we
+ can only run this test up to 10.13. */
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-do run { target *-*-darwin[89]* *-*-darwin1[0-7]* } } */
+/* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
+/* { dg-skip-if "ABI 2 only" { *-*-* && { ! objc2 } } { "*" } { "" } } */
+/* { dg-additional-options "-fobjc-nilcheck -mmacosx-version-min=10.5 " } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
+
+#include "pr101666.inc"
diff --git a/gcc/testsuite/obj-c++.dg/pr101666.inc b/gcc/testsuite/obj-c++.dg/pr101666.inc
new file mode 100644
index 0000000..e81e1be
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/pr101666.inc
@@ -0,0 +1,29 @@
+#include <cstdlib>
+struct point { double x, y, z; };
+
+@interface Foo
+- (struct point)bar;
+- (struct point)baz;
+@end
+
+@implementation Foo
+- (struct point)bar { struct point q = { 1.0, 2.0, 3.0 }; return q; };
+- (struct point)baz { struct point q = { 4.0, 5.0, 6.0 }; return q; };
+@end
+
+/* Cases where a check for nil should be inserted by the compiler, when
+ -fobjc-nilcheck is in force. We should not attempt the calls, and the
+ result should be 0-filled. */
+
+Foo *f;
+
+int main(void) {
+ struct point p = [f bar];
+ if (p.x != 0.0 || p.y != 0.0 || p.z != 0.0)
+ abort ();
+ id nilobj = (id)0;
+ p = [nilobj baz];
+ if (p.x != 0.0 || p.y != 0.0 || p.z != 0.0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/obj-c++.dg/pr49070.mm b/gcc/testsuite/obj-c++.dg/pr49070.mm
new file mode 100644
index 0000000..d67c721
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/pr49070.mm
@@ -0,0 +1,52 @@
+/* Only needs to compile. */
+/* { dg-additional-options "-std=c++11" } */
+
+#ifdef __cplusplus
+enum X {
+ x = 5,
+ y
+};
+#endif
+
+__attribute__((__objc_root_class__))
+@interface A
+- (id) :(id)arg0 :(id)arg1;
+- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3;
+#ifdef __cplusplus
+- (id) n:(X)arg0 :(X)arg1 :(id)arg2 :(id)arg3;
+#endif
+@end
+
+@implementation A
+- (id) :(id)arg0 :(id)arg1
+{
+ return arg1;
+}
+- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3
+{
+ return arg2;
+}
+#ifdef __cplusplus
+- (id) n:(X)arg0 :(X)arg1 :(id)arg2 :(id)arg3
+{
+ return arg2;
+}
+#endif
+@end
+
+id f1 (A *x)
+{
+ return [x:x:x];
+}
+
+id f2 (A *x)
+{
+ return [x m:x:x:x:x];
+}
+
+#ifdef __cplusplus
+id f3 (A *x)
+{
+ return [x n:X::x:X::y:x:x];
+}
+#endif
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-unavailable-1.mm b/gcc/testsuite/obj-c++.dg/property/at-property-unavailable-1.mm
new file mode 100644
index 0000000..6bb4755
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-unavailable-1.mm
@@ -0,0 +1,38 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Test that properties can be unavailable. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int a;
+}
+@property int a __attribute__((unavailable));
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+@end
+
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+@synthesize a;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+
+ object.a = 40; /* { dg-error "is unavailable" } */
+ if (object.a != 40) /* { dg-error "is unavailable" } */
+ abort ();
+
+ return (0);
+}
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-unavailable-2.mm b/gcc/testsuite/obj-c++.dg/property/at-property-unavailable-2.mm
new file mode 100644
index 0000000..5edc162
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-unavailable-2.mm
@@ -0,0 +1,26 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Test that unavailability errors are produced when a setter/getter of
+ a @property is used directly. */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+ int variable;
+}
+@property (assign, nonatomic) int property __attribute__ ((unavailable));
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+ if ([object property] > 0) /* { dg-error "is unavailable" } */
+ {
+ [object setProperty: 43]; /* { dg-error "is unavailable" } */
+ }
+}
diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-unavailable-1.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-unavailable-1.mm
new file mode 100644
index 0000000..e2ef2a5
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-unavailable-1.mm
@@ -0,0 +1,42 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Test the 'dot syntax' with unavailable methods. */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) classCount __attribute__ ((unavailable));
++ (void) setClassCount: (int)value __attribute__ ((unavailable));
+
+- (int) count __attribute__ ((unavailable));
+- (void) setCount: (int)value __attribute__ ((unavailable));
+
+- (int) classCount2;
+- (void) setClassCount2: (int)value;
+
+- (int) count2;
+- (void) setCount2: (int)value;
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+
+ if (object.count > 0) /* { dg-error "is unavailable" } */
+ object.count = 20; /* { dg-error "is unavailable" } */
+
+ if (MyClass.classCount < -7) /* { dg-error "is unavailable" } */
+ MyClass.classCount = 11; /* { dg-error "is unavailable" } */
+
+ if (object.classCount2 > 0)
+ object.classCount2 = 19;
+
+ if (object.count2 < -7)
+ object.count2 = 74;
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-unavailable-1.m b/gcc/testsuite/objc.dg/attributes/method-unavailable-1.m
new file mode 100644
index 0000000..7a3de6b
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-unavailable-1.m
@@ -0,0 +1,34 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) method;
+- (int) method;
++ (int) unavailableClassMethod __attribute__((unavailable));
+- (int) unavailableInstanceMethod __attribute__((unavailable));
+@end
+
+/* Test that unavailability errors are produced, but not if the
+ receiver is of type 'id'. */
+void foo (void)
+{
+ Class c;
+ id object;
+ MyClass *another_object;
+
+ [c method];
+ [object method];
+ [c unavailableClassMethod];
+ [object unavailableInstanceMethod];
+
+ [object method];
+ [another_object method];
+ [MyClass unavailableClassMethod]; /* { dg-error "is unavailable" } */
+ [another_object unavailableInstanceMethod]; /* { dg-error "is unavailable" } */
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-unavailable-2.m b/gcc/testsuite/objc.dg/attributes/method-unavailable-2.m
new file mode 100644
index 0000000..68ea46d
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-unavailable-2.m
@@ -0,0 +1,24 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) unavailableClassMethod: (id)firstObject, ... __attribute__((sentinel)) __attribute__((unavailable));
+- (int) unavailableInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((unavailable));
+@end
+
+/* Test that unavailability errors are produced even if the method is
+ also marked with another attribute too (this is to test the
+ processing of multiple attributes). */
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass unavailableClassMethod: object, nil]; /* { dg-error "is unavailable" } */
+ [object unavailableInstanceMethod: object, nil]; /* { dg-error "is unavailable" } */
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-unavailable-3.m b/gcc/testsuite/objc.dg/attributes/method-unavailable-3.m
new file mode 100644
index 0000000..9e55ae1
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-unavailable-3.m
@@ -0,0 +1,22 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <objc/objc.h>
+
+/* Test that __attribute__ ((__unavailable__)) works as well as __attribute__ ((unavailable)). */
+@interface MyClass
+{
+ Class isa;
+}
++ (int) unavailableClassMethod: (id)firstObject, ... __attribute__((__unavailable__));
+- (int) unavailableInstanceMethod: (id)firstobject, ... __attribute__((__unavailable__));
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass unavailableClassMethod: object, nil]; /* { dg-error "is unavailable" } */
+ [object unavailableInstanceMethod: object, nil]; /* { dg-error "is unavailable" } */
+}
diff --git a/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c b/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c
index 824e4ba..ca24200 100644
--- a/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c
+++ b/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c
@@ -690,6 +690,8 @@ subvalues (struct entry *e, char *p, char *letter)
if (e[0].len != 0)
output_FNB ('B', e);
return 1;
+ default:
+ return 0;
}
}
diff --git a/gcc/testsuite/objc.dg/pr101666-0.m b/gcc/testsuite/objc.dg/pr101666-0.m
new file mode 100644
index 0000000..5f87f60
--- /dev/null
+++ b/gcc/testsuite/objc.dg/pr101666-0.m
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+/* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
+/* { dg-skip-if "ABI 2 only" { *-*-* && { ! objc2 } } { "*" } { "" } } */
+/* { dg-additional-options "-fobjc-nilcheck -Wno-objc-root-class" } */
+
+#include "pr101666.inc"
+
diff --git a/gcc/testsuite/objc.dg/pr101666-1.m b/gcc/testsuite/objc.dg/pr101666-1.m
new file mode 100644
index 0000000..41ef370
--- /dev/null
+++ b/gcc/testsuite/objc.dg/pr101666-1.m
@@ -0,0 +1,10 @@
+/* Later versions of Darwin can compile for 10.5, but cannot link it so we
+ can only run this test up to 10.13. */
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-do run { target *-*-darwin[89]* *-*-darwin1[0-7]* } } */
+/* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
+/* { dg-skip-if "ABI 2 only" { *-*-* && { ! objc2 } } { "*" } { "" } } */
+/* { dg-additional-options "-fobjc-nilcheck -mmacosx-version-min=10.5 " } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
+
+#include "pr101666.inc"
diff --git a/gcc/testsuite/objc.dg/pr101666.inc b/gcc/testsuite/objc.dg/pr101666.inc
new file mode 100644
index 0000000..f1dddca
--- /dev/null
+++ b/gcc/testsuite/objc.dg/pr101666.inc
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+struct point { double x, y, z; };
+
+@interface Foo
+- (struct point)bar;
+- (struct point)baz;
+@end
+
+@implementation Foo
+- (struct point)bar { struct point q = { 1.0, 2.0, 3.0 }; return q; };
+- (struct point)baz { struct point q = { 4.0, 5.0, 6.0 }; return q; };
+@end
+
+/* Cases where a check for nil should be inserted by the compiler, when
+ -fobjc-nilcheck is in force. We should not attempt the calls, and the
+ result should be 0-filled. */
+
+Foo *f;
+
+int main(void) {
+ struct point p = [f bar];
+ if (p.x != 0.0 || p.y != 0.0 || p.z != 0.0)
+ abort ();
+ id nilobj = (id)0;
+ p = [nilobj baz];
+ if (p.x != 0.0 || p.y != 0.0 || p.z != 0.0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/property/at-property-unavailable-1.m b/gcc/testsuite/objc.dg/property/at-property-unavailable-1.m
new file mode 100644
index 0000000..c33e1b6
--- /dev/null
+++ b/gcc/testsuite/objc.dg/property/at-property-unavailable-1.m
@@ -0,0 +1,39 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
+
+/* Test that properties can be unavailable. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int a;
+}
+@property int a __attribute__((unavailable));
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+@end
+
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+@synthesize a;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+
+ object.a = 40; /* { dg-error "is unavailable" } */
+ if (object.a != 40) /* { dg-error "is unavailable" } */
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/property/at-property-unavailable-2.m b/gcc/testsuite/objc.dg/property/at-property-unavailable-2.m
new file mode 100644
index 0000000..5edc162
--- /dev/null
+++ b/gcc/testsuite/objc.dg/property/at-property-unavailable-2.m
@@ -0,0 +1,26 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Test that unavailability errors are produced when a setter/getter of
+ a @property is used directly. */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+ int variable;
+}
+@property (assign, nonatomic) int property __attribute__ ((unavailable));
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+ if ([object property] > 0) /* { dg-error "is unavailable" } */
+ {
+ [object setProperty: 43]; /* { dg-error "is unavailable" } */
+ }
+}
diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-unavailable-1.m b/gcc/testsuite/objc.dg/property/dotsyntax-unavailable-1.m
new file mode 100644
index 0000000..e2ef2a5
--- /dev/null
+++ b/gcc/testsuite/objc.dg/property/dotsyntax-unavailable-1.m
@@ -0,0 +1,42 @@
+/* Test __attribute__ ((unavailable)) */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Test the 'dot syntax' with unavailable methods. */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) classCount __attribute__ ((unavailable));
++ (void) setClassCount: (int)value __attribute__ ((unavailable));
+
+- (int) count __attribute__ ((unavailable));
+- (void) setCount: (int)value __attribute__ ((unavailable));
+
+- (int) classCount2;
+- (void) setClassCount2: (int)value;
+
+- (int) count2;
+- (void) setCount2: (int)value;
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+
+ if (object.count > 0) /* { dg-error "is unavailable" } */
+ object.count = 20; /* { dg-error "is unavailable" } */
+
+ if (MyClass.classCount < -7) /* { dg-error "is unavailable" } */
+ MyClass.classCount = 11; /* { dg-error "is unavailable" } */
+
+ if (object.classCount2 > 0)
+ object.classCount2 = 19;
+
+ if (object.count2 < -7)
+ object.count2 = 74;
+}
diff --git a/gcc/testsuite/objc.dg/unnamed-parms.m b/gcc/testsuite/objc.dg/unnamed-parms.m
new file mode 100644
index 0000000..22426cf
--- /dev/null
+++ b/gcc/testsuite/objc.dg/unnamed-parms.m
@@ -0,0 +1,28 @@
+/* Only needs to compile [see PR 49070 for C++ issue]. */
+
+__attribute__((__objc_root_class__))
+@interface A
+- (id) :(id)arg0 :(id)arg1;
+- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3;
+@end
+
+@implementation A
+- (id) :(id)arg0 :(id)arg1
+{
+ return arg1;
+}
+- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3
+{
+ return arg2;
+}
+@end
+
+id f1 (A *x)
+{
+ return [x:x:x];
+}
+
+id f2 (A *x)
+{
+ return [x m:x:x:x:x];
+}