aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-10-31 22:18:58 -0400
committerJason Merrill <jason@redhat.com>2022-10-31 22:18:58 -0400
commitbfcb6e7373095d776eeb505f6d1a7d04ada21a3c (patch)
tree624e70539be037cfae295e95257dde4ac9abd416
parent2031dff9d921dbec9065c5b7d3ef3ac97adf18b2 (diff)
parentaf6d747df7e311a6555dda3a75f6724ecc4481bd (diff)
downloadgcc-bfcb6e7373095d776eeb505f6d1a7d04ada21a3c.zip
gcc-bfcb6e7373095d776eeb505f6d1a7d04ada21a3c.tar.gz
gcc-bfcb6e7373095d776eeb505f6d1a7d04ada21a3c.tar.bz2
Merge remote-tracking branch 'origin/master' into devel/c++-contracts
-rw-r--r--ChangeLog4
-rw-r--r--MAINTAINERS2
-rw-r--r--gcc/ChangeLog831
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/alias.cc19
-rw-r--r--gcc/analyzer/ChangeLog11
-rw-r--r--gcc/analyzer/sm-fd.cc34
-rw-r--r--gcc/analyzer/sm-fd.dot109
-rw-r--r--gcc/auto-profile.cc5
-rw-r--r--gcc/btfout.cc30
-rw-r--r--gcc/builtin-types.def184
-rw-r--r--gcc/builtins.cc142
-rw-r--r--gcc/builtins.def123
-rw-r--r--gcc/c-family/ChangeLog22
-rw-r--r--gcc/c-family/c-common.cc11
-rw-r--r--gcc/c-family/c-common.h24
-rw-r--r--gcc/c-family/c-warn.cc3
-rw-r--r--gcc/c-family/c.opt8
-rw-r--r--gcc/c/ChangeLog83
-rw-r--r--gcc/c/c-convert.cc8
-rw-r--r--gcc/c/c-decl.cc338
-rw-r--r--gcc/c/c-objc-common.cc8
-rw-r--r--gcc/c/c-parser.cc225
-rw-r--r--gcc/c/c-tree.h27
-rw-r--r--gcc/c/c-typeck.cc76
-rw-r--r--gcc/common/config/i386/cpuinfo.h40
-rw-r--r--gcc/common/config/i386/i386-common.cc21
-rw-r--r--gcc/common/config/i386/i386-cpuinfo.h1
-rw-r--r--gcc/common/config/i386/i386-isas.h2
-rw-r--r--gcc/common/config/riscv/riscv-common.cc47
-rw-r--r--gcc/config.gcc28
-rw-r--r--gcc/config/aarch64/aarch64-protos.h6
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins-base.cc56
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins-functions.h28
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins-shapes.cc8
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins-sve2.cc12
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins.cc8
-rw-r--r--gcc/config/aarch64/aarch64.cc5
-rw-r--r--gcc/config/aarch64/aarch64.h4
-rw-r--r--gcc/config/aarch64/driver-aarch64.cc4
-rw-r--r--gcc/config/alpha/alpha.cc5
-rw-r--r--gcc/config/arc/arc.cc3
-rw-r--r--gcc/config/arm/arm.cc3
-rw-r--r--gcc/config/arm/linux-eabi.h3
-rw-r--r--gcc/config/bpf/bpf.cc402
-rw-r--r--gcc/config/bpf/coreout.cc5
-rw-r--r--gcc/config/bpf/coreout.h2
-rw-r--r--gcc/config/csky/csky.cc3
-rw-r--r--gcc/config/darwin-d.cc8
-rw-r--r--gcc/config/elfos.h6
-rw-r--r--gcc/config/epiphany/epiphany.cc8
-rw-r--r--gcc/config/fr30/fr30.cc23
-rw-r--r--gcc/config/frv/frv.cc3
-rw-r--r--gcc/config/ft32/ft32.cc6
-rw-r--r--gcc/config/gcn/gcn-valu.md139
-rw-r--r--gcc/config/gcn/gcn.cc29
-rw-r--r--gcc/config/gcn/gcn.md5
-rw-r--r--gcc/config/gnu-d.cc (renamed from gcc/config/glibc-d.cc)30
-rw-r--r--gcc/config/gnu.h6
-rw-r--r--gcc/config/h8300/h8300-protos.h2
-rw-r--r--gcc/config/h8300/h8300.cc2
-rw-r--r--gcc/config/i386/avx512bf16intrin.h12
-rw-r--r--gcc/config/i386/avx512bf16vlintrin.h48
-rw-r--r--gcc/config/i386/avxneconvertintrin.h140
-rw-r--r--gcc/config/i386/cpuid.h1
-rw-r--r--gcc/config/i386/cygwin-d.cc72
-rw-r--r--gcc/config/i386/cygwin.h9
-rw-r--r--gcc/config/i386/i386-builtin-types.def66
-rw-r--r--gcc/config/i386/i386-builtin.def68
-rw-r--r--gcc/config/i386/i386-c.cc2
-rw-r--r--gcc/config/i386/i386-expand.cc69
-rw-r--r--gcc/config/i386/i386-isa.def1
-rw-r--r--gcc/config/i386/i386-modes.def1
-rw-r--r--gcc/config/i386/i386-options.cc4
-rw-r--r--gcc/config/i386/i386.cc9
-rw-r--r--gcc/config/i386/i386.h9
-rw-r--r--gcc/config/i386/i386.md55
-rw-r--r--gcc/config/i386/i386.opt5
-rw-r--r--gcc/config/i386/immintrin.h4
-rw-r--r--gcc/config/i386/linux-common.h3
-rw-r--r--gcc/config/i386/mingw32.h12
-rw-r--r--gcc/config/i386/mmx.md26
-rw-r--r--gcc/config/i386/sse.md195
-rw-r--r--gcc/config/i386/t-cygming4
-rw-r--r--gcc/config/i386/winnt-d.cc21
-rw-r--r--gcc/config/ia64/ia64.cc5
-rw-r--r--gcc/config/kfreebsd-d.cc65
-rw-r--r--gcc/config/kfreebsd-gnu.h6
-rw-r--r--gcc/config/kopensolaris-d.cc65
-rw-r--r--gcc/config/kopensolaris-gnu.h6
-rw-r--r--gcc/config/linux-android.h6
-rw-r--r--gcc/config/linux-d.cc78
-rw-r--r--gcc/config/linux.h13
-rw-r--r--gcc/config/loongarch/loongarch.cc3
-rw-r--r--gcc/config/m32r/m32r.cc12
-rw-r--r--gcc/config/mcore/mcore.cc5
-rw-r--r--gcc/config/mips/linux-common.h3
-rw-r--r--gcc/config/mips/mips.cc3
-rw-r--r--gcc/config/mmix/mmix.cc3
-rw-r--r--gcc/config/nds32/nds32.cc9
-rw-r--r--gcc/config/nios2/nios2.cc3
-rwxr-xr-xgcc/config/riscv/arch-canonicalize5
-rw-r--r--gcc/config/riscv/constraints.md27
-rw-r--r--gcc/config/riscv/iterators.md6
-rw-r--r--gcc/config/riscv/predicates.md23
-rw-r--r--gcc/config/riscv/riscv-builtins.cc4
-rw-r--r--gcc/config/riscv/riscv-c.cc2
-rw-r--r--gcc/config/riscv/riscv-modes.def109
-rw-r--r--gcc/config/riscv/riscv-opts.h16
-rw-r--r--gcc/config/riscv/riscv-protos.h16
-rw-r--r--gcc/config/riscv/riscv-v.cc180
-rw-r--r--gcc/config/riscv/riscv-vector-builtins-bases.cc18
-rw-r--r--gcc/config/riscv/riscv-vector-builtins-shapes.cc2
-rw-r--r--gcc/config/riscv/riscv-vector-builtins.cc18
-rw-r--r--gcc/config/riscv/riscv-vector-builtins.h2
-rw-r--r--gcc/config/riscv/riscv.cc128
-rw-r--r--gcc/config/riscv/riscv.h3
-rw-r--r--gcc/config/riscv/riscv.md87
-rw-r--r--gcc/config/riscv/riscv.opt6
-rw-r--r--gcc/config/riscv/t-riscv4
-rw-r--r--gcc/config/riscv/vector-iterators.md58
-rw-r--r--gcc/config/riscv/vector.md279
-rw-r--r--gcc/config/rs6000/rs6000-call.cc7
-rw-r--r--gcc/config/rs6000/rs6000.cc7
-rw-r--r--gcc/config/sh/sh.cc9
-rw-r--r--gcc/config/t-glibc10
-rw-r--r--gcc/config/t-linux4
-rw-r--r--gcc/config/visium/visium.cc3
-rw-r--r--gcc/config/vms/vms-c.cc3
-rw-r--r--gcc/config/xtensa/xtensa.md7
-rwxr-xr-xgcc/configure8
-rw-r--r--gcc/configure.ac1
-rw-r--r--gcc/cp/ChangeLog124
-rw-r--r--gcc/cp/call.cc155
-rw-r--r--gcc/cp/constraint.cc6
-rw-r--r--gcc/cp/cp-tree.h32
-rw-r--r--gcc/cp/mangle.cc68
-rw-r--r--gcc/cp/module.cc39
-rw-r--r--gcc/cp/name-lookup.cc7
-rw-r--r--gcc/cp/parser.cc101
-rw-r--r--gcc/cp/pt.cc107
-rw-r--r--gcc/cp/typeck.cc14
-rw-r--r--gcc/ctfc.cc13
-rw-r--r--gcc/ctfc.h5
-rw-r--r--gcc/d/ChangeLog29
-rw-r--r--gcc/d/d-attribs.cc5
-rw-r--r--gcc/d/d-builtins.cc3
-rw-r--r--gcc/d/d-lang.cc10
-rw-r--r--gcc/d/d-target.def23
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/VERSION2
-rw-r--r--gcc/d/dmd/aggregate.d2
-rw-r--r--gcc/d/dmd/aggregate.h4
-rw-r--r--gcc/d/dmd/attrib.d41
-rw-r--r--gcc/d/dmd/attrib.h1
-rw-r--r--gcc/d/dmd/clone.d22
-rw-r--r--gcc/d/dmd/common/bitfields.d9
-rw-r--r--gcc/d/dmd/common/file.d11
-rw-r--r--gcc/d/dmd/cparse.d39
-rw-r--r--gcc/d/dmd/cppmangle.d10
-rw-r--r--gcc/d/dmd/dcast.d114
-rw-r--r--gcc/d/dmd/declaration.d59
-rw-r--r--gcc/d/dmd/declaration.h66
-rw-r--r--gcc/d/dmd/dinterpret.d6
-rw-r--r--gcc/d/dmd/dmodule.d435
-rw-r--r--gcc/d/dmd/dscope.d6
-rw-r--r--gcc/d/dmd/dstruct.d33
-rw-r--r--gcc/d/dmd/dsymbol.d54
-rw-r--r--gcc/d/dmd/dsymbol.h16
-rw-r--r--gcc/d/dmd/dsymbolsem.d204
-rw-r--r--gcc/d/dmd/dtemplate.d4
-rw-r--r--gcc/d/dmd/entity.d236
-rw-r--r--gcc/d/dmd/escape.d369
-rw-r--r--gcc/d/dmd/expression.d2
-rw-r--r--gcc/d/dmd/expression.h1
-rw-r--r--gcc/d/dmd/expressionsem.d173
-rw-r--r--gcc/d/dmd/func.d276
-rw-r--r--gcc/d/dmd/globals.d5
-rw-r--r--gcc/d/dmd/globals.h6
-rw-r--r--gcc/d/dmd/hdrgen.d27
-rw-r--r--gcc/d/dmd/lexer.d48
-rw-r--r--gcc/d/dmd/module.h2
-rw-r--r--gcc/d/dmd/mtype.d69
-rw-r--r--gcc/d/dmd/mtype.h5
-rw-r--r--gcc/d/dmd/nogc.d4
-rw-r--r--gcc/d/dmd/parse.d6
-rw-r--r--gcc/d/dmd/printast.d7
-rw-r--r--gcc/d/dmd/root/utf.d2
-rw-r--r--gcc/d/dmd/safe.d10
-rw-r--r--gcc/d/dmd/semantic3.d44
-rw-r--r--gcc/d/dmd/statementsem.d188
-rw-r--r--gcc/d/dmd/templateparamsem.d9
-rw-r--r--gcc/d/dmd/transitivevisitor.d9
-rw-r--r--gcc/d/expr.cc9
-rw-r--r--gcc/d/gdc.texi8
-rw-r--r--gcc/d/lang.opt4
-rw-r--r--gcc/d/modules.cc4
-rw-r--r--gcc/doc/extend.texi82
-rw-r--r--gcc/doc/invoke.texi74
-rw-r--r--gcc/doc/makefile.texi10
-rw-r--r--gcc/doc/sourcebuild.texi3
-rw-r--r--gcc/doc/tm.texi20
-rw-r--r--gcc/doc/tm.texi.in4
-rw-r--r--gcc/dwarf2ctf.cc5
-rw-r--r--gcc/expr.cc3
-rw-r--r--gcc/fold-const-call.cc58
-rw-r--r--gcc/fold-const.cc64
-rw-r--r--gcc/fortran/ChangeLog11
-rw-r--r--gcc/fortran/symbol.cc4
-rw-r--r--gcc/fortran/trans-types.cc4
-rw-r--r--gcc/function.cc6
-rw-r--r--gcc/gimple-range-fold.cc8
-rw-r--r--gcc/gimple-ssa-backprop.cc6
-rw-r--r--gcc/ginclude/stdarg.h4
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/ipa-inline-analysis.cc13
-rw-r--r--gcc/ipa-visibility.cc8
-rw-r--r--gcc/ira.cc1
-rw-r--r--gcc/lto/ChangeLog22
-rw-r--r--gcc/lto/lang.opt15
-rw-r--r--gcc/lto/lto-common.cc1
-rw-r--r--gcc/lto/lto-dump.cc22
-rw-r--r--gcc/objc/ChangeLog5
-rw-r--r--gcc/objc/objc-next-runtime-abi-01.cc2
-rw-r--r--gcc/omp-low.cc22
-rw-r--r--gcc/optc-save-gen.awk31
-rw-r--r--gcc/target.def4
-rw-r--r--gcc/testsuite/ChangeLog321
-rw-r--r--gcc/testsuite/c-c++-common/gomp/clauses-6.c604
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-variant-2.c3
-rw-r--r--gcc/testsuite/c-c++-common/gomp/directive-1.c28
-rw-r--r--gcc/testsuite/g++.dg/abi/lambda-ctx1-18.C4
-rw-r--r--gcc/testsuite/g++.dg/abi/lambda-ctx1-18vs17.C4
-rw-r--r--gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C20
-rw-r--r--gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C25
-rw-r--r--gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C16
-rw-r--r--gcc/testsuite/g++.dg/abi/lambda-tpl1.h59
-rw-r--r--gcc/testsuite/g++.dg/cpp23/elision4.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp23/elision7.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp23/ext-floating12.C182
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/bad-binary-ops2.C26
-rw-r--r--gcc/testsuite/g++.dg/gomp/clause-4.C2
-rw-r--r--gcc/testsuite/g++.dg/modules/enum-10_a.H5
-rw-r--r--gcc/testsuite/g++.dg/modules/enum-10_b.C6
-rw-r--r--gcc/testsuite/g++.dg/modules/enum-11_a.H5
-rw-r--r--gcc/testsuite/g++.dg/modules/enum-11_b.C8
-rw-r--r--gcc/testsuite/g++.dg/modules/enum-9_a.H13
-rw-r--r--gcc/testsuite/g++.dg/modules/enum-9_b.C6
-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/warn/Wdangling-pointer-2.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wdangling-reference1.C144
-rw-r--r--gcc/testsuite/g++.dg/warn/Wdangling-reference2.C28
-rw-r--r--gcc/testsuite/g++.dg/warn/Wdangling-reference3.C24
-rw-r--r--gcc/testsuite/g++.dg/warn/Wdangling-reference4.C14
-rw-r--r--gcc/testsuite/gcc.dg/Wold-style-definition-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fd-3.c18
-rw-r--r--gcc/testsuite/gcc.dg/c11-enum-4.c7
-rw-r--r--gcc/testsuite/gcc.dg/c11-enum-5.c7
-rw-r--r--gcc/testsuite/gcc.dg/c11-enum-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/c11-stdarg-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/c11-stdarg-2.c7
-rw-r--r--gcc/testsuite/gcc.dg/c11-stdarg-3.c8
-rw-r--r--gcc/testsuite/gcc.dg/c2x-enum-6.c167
-rw-r--r--gcc/testsuite/gcc.dg/c2x-enum-7.c97
-rw-r--r--gcc/testsuite/gcc.dg/c2x-enum-8.c7
-rw-r--r--gcc/testsuite/gcc.dg/c2x-nullptr-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/c2x-stdarg-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/c2x-stdarg-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/c2x-stdarg-3.c16
-rw-r--r--gcc/testsuite/gcc.dg/c2x-stdarg-4.c164
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/diagnostic-token-ranges.c4
-rw-r--r--gcc/testsuite/gcc.dg/format/sentinel-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gnu2x-enum-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/gnu2x-stdarg-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/gomp/clause-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-6.c47
-rw-r--r--gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1a.c37
-rw-r--r--gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1b.c147
-rw-r--r--gcc/testsuite/gcc.dg/torture/floatn-builtin.h154
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr107407.c26
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr107435.c23
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr107447.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107394.c22
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr100756.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bitfield-read-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bitfield-read-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bitfield-read-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bitfield-read-4.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bitfield-read-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bitfield-read-6.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-bitfield-read-7.c1
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-1.c23
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-2.c23
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-existence-1.c34
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-be.c37
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-le.c37
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-2.c37
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-offset-1.c56
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-1.c36
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-2.c35
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-1.c33
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-2.c45
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-size-1.c43
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-check.h3
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-1.c45
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnebf162ps-2.c54
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnesh2ps-2.c42
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneebf162ps-2.c73
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneeph2ps-2.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneobf162ps-2.c75
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneoph2ps-2.c66
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneps2bf16-2.c58
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bf16-vdpbf16ps-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bf16vl-cvtness2sbh-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1a.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1b.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-56.inc2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr107172.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/pr107261.c38
-rw-r--r--gcc/testsuite/gcc.target/i386/pr107304.c39
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-12.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-13.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-14.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-22.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-23.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr106460.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c10
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zhinx-2.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zhinx-3.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-1.c10
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-2.c10
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-3.c10
-rw-r--r--gcc/testsuite/gcc.target/riscv/arch-18.c5
-rw-r--r--gcc/testsuite/gcc.target/riscv/arch-5.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-23.c63
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-24.c47
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-25.c47
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-1.c179
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-10.c385
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-11.c385
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-12.c159
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-13.c14
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-2.c153
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-3.c127
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-4.c101
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-5.c66
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-6.c53
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-7.c13
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-8.c96
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/mov-9.c44
-rw-r--r--gcc/testsuite/gdc.dg/simd18867.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd19630.d10
-rw-r--r--gcc/testsuite/gdc.dg/simd19630b.d17
-rw-r--r--gcc/testsuite/gdc.dg/simd19630c.d15
-rw-r--r--gcc/testsuite/gdc.dg/simd19788.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd21469.d9
-rw-r--r--gcc/testsuite/gdc.dg/simd21672.d17
-rw-r--r--gcc/testsuite/gdc.dg/simd23077.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd23084.d17
-rw-r--r--gcc/testsuite/gdc.dg/simd23085.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd_ctfe.d88
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd19632.d15
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd20041.d22
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd21673.d20
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd21676.d36
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd22438.d18
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd23009.d22
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd23077.d11
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd8.d26
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd9.d46
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd_prefetch.d21
-rw-r--r--gcc/testsuite/gdc.test/compilable/cdcmp.d14
-rw-r--r--gcc/testsuite/gdc.test/compilable/extra-files/header2.d19
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/cimports2a.i7
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/cimports2b.i8
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/pkg22952/package.d1
-rw-r--r--gcc/testsuite/gdc.test/compilable/noreturn3.d257
-rw-r--r--gcc/testsuite/gdc.test/compilable/scope_tuple_expansion.d21
-rw-r--r--gcc/testsuite/gdc.test/compilable/shortened_methods.d2
-rw-r--r--gcc/testsuite/gdc.test/compilable/test11980.d5
-rw-r--r--gcc/testsuite/gdc.test/compilable/test22674.d7
-rw-r--r--gcc/testsuite/gdc.test/compilable/test22784.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/test22952.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23380.d9
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23386.d12
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag23384.d29
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail10905.d22
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail19898a.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail19898b.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail22366.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail23406.d40
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/issue21378.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/lexer1.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/pragmainline.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/pragmas.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/previewin.d6
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/reserved_version.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/retscope.d6
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/retscope2.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/retscope6.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/systemvariables.d48
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d28
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d60
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d32
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/templatethis.d37
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test14496.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test17764.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test19097.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test22145.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test22680.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/warn14905.d23
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/xmmslice.d22
-rw-r--r--gcc/testsuite/gdc.test/runnable/cdcmp.d146
-rw-r--r--gcc/testsuite/gdc.test/runnable/lexer.d4
-rw-r--r--gcc/testsuite/gdc.test/runnable/test20734.d8
-rw-r--r--gcc/testsuite/gdc.test/runnable/test23337.d182
-rw-r--r--gcc/testsuite/gfortran.dg/illegal_boz_arg_4.f9013
-rw-r--r--gcc/testsuite/lib/profopt.exp2
-rw-r--r--gcc/testsuite/lib/target-supports.exp12
-rw-r--r--gcc/tree-call-cdce.cc20
-rw-r--r--gcc/tree-core.h3
-rw-r--r--gcc/tree-ssa-dse.cc17
-rw-r--r--gcc/tree-ssa-loop-im.cc13
-rw-r--r--gcc/tree-ssa-phiopt.cc35
-rw-r--r--gcc/tree-streamer-in.cc1
-rw-r--r--gcc/tree-streamer-out.cc1
-rw-r--r--gcc/tree-vect-data-refs.cc5
-rw-r--r--gcc/tree-vect-loop.cc6
-rw-r--r--gcc/tree.cc31
-rw-r--r--gcc/tree.h8
-rw-r--r--gcc/value-range-storage.cc33
-rw-r--r--gcc/value-range.cc8
-rw-r--r--gcc/value-range.h12
-rw-r--r--include/ChangeLog12
-rw-r--r--include/btf.h19
-rw-r--r--include/vtv-change-permission.h4
-rw-r--r--libgo/go/runtime/mem_gccgo.go6
-rw-r--r--libgomp/ChangeLog10
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/declare-1.f902
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F9024
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/if-1.f9012
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/print-1.f9013
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f908
-rw-r--r--libitm/ChangeLog7
-rw-r--r--libitm/config/riscv/asm.h63
-rw-r--r--libitm/config/riscv/sjlj.S144
-rw-r--r--libitm/config/riscv/target.h64
-rw-r--r--libitm/configure.tgt2
-rw-r--r--libphobos/ChangeLog5
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/core/stdc/fenv.d1
-rw-r--r--libphobos/libdruntime/core/stdc/signal.d1
-rw-r--r--libphobos/libdruntime/core/stdc/stdarg.d1
-rw-r--r--libphobos/libdruntime/core/stdc/stdio.d1
-rw-r--r--libphobos/libdruntime/core/stdc/stdlib.d1
-rw-r--r--libphobos/libdruntime/core/stdc/string.d1
-rw-r--r--libphobos/libdruntime/core/stdc/wchar_.d1
-rw-r--r--libphobos/libdruntime/core/sys/darwin/fcntl.d1
-rw-r--r--libphobos/libdruntime/core/sys/darwin/ifaddrs.d1
-rw-r--r--libphobos/libdruntime/core/sys/elf/package.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/dlfcn.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/elf.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/epoll.d2
-rw-r--r--libphobos/libdruntime/core/sys/linux/err.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/errno.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/execinfo.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/fcntl.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/fs.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/ifaddrs.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/io_uring.d2
-rw-r--r--libphobos/libdruntime/core/sys/linux/link.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/perf_event.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sched.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/stdio.d3
-rw-r--r--libphobos/libdruntime/core/sys/linux/string.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/eventfd.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/inotify.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/mman.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/prctl.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/signalfd.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/sysinfo.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/xattr.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/timerfd.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/tipc.d1
-rw-r--r--libphobos/libdruntime/core/sys/linux/unistd.d1
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/sys/mman.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/aio.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/config.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/dirent.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/dlfcn.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/fcntl.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/grp.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/iconv.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/inttypes.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/libgen.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/locale.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/mqueue.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/netdb.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/poll.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/pthread.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/pwd.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sched.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/semaphore.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/setjmp.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/spawn.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/stdio.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/stdlib.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/string.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/strings.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/filio.d1
-rwxr-xr-xlibphobos/libdruntime/core/sys/posix/sys/ioccom.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/ioctl.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/ipc.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/mman.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/msg.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/resource.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/select.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/shm.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/socket.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/stat.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/statvfs.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/time.d1
-rwxr-xr-xlibphobos/libdruntime/core/sys/posix/sys/ttycom.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/types.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/uio.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/un.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/utsname.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/wait.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/syslog.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/termios.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/time.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/ucontext.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/unistd.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/utime.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/aclapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/aclui.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/basetsd.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/basetyps.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/com.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/comcat.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/commctrl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/commdlg.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/cpl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/cplext.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/custcntl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/dbghelp.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/dbghelp_types.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/dbt.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/dde.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ddeml.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/dhcpcsdk.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/dlgs.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/dll.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/docobj.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/errorrep.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/exdisp.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/httpext.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/imagehlp.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/imm.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/intshcut.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ipexport.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/iphlpapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/iprtrmib.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/iptypes.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lm.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmaccess.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmalert.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmat.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmaudit.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmbrowsr.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmchdev.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmconfig.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmcons.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmerr.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmerrlog.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmmsg.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmremutl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmrepl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmserver.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmshare.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmsname.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmstats.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmsvc.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmuse.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmwksta.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/lzexpand.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/mapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/mciavi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/mcx.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/mgmtapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/mmsystem.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/msacm.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/mshtml.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/mswsock.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/nb30.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/nddeapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/nspapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntdef.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntdll.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntldap.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntsecapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntsecpkg.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/oaidl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/objbase.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/objfwd.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/objidl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/objsafe.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ocidl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/odbcinst.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ole.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ole2.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/oleacc.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/oleauto.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/olectl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/oledlg.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/oleidl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/pbt.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/powrprof.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/prsht.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/psapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/ras.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rasdlg.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/raserror.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rassapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/reason.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/regstr.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/richedit.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/richole.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpc.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcdce.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcdce2.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcdcep.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcndr.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcnsi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcnsip.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcnterr.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/schannel.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/sdkddkver.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/secext.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/security.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/servprov.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/setupapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/shellapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/shldisp.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/shlguid.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/shlobj.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/shlwapi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/snmp.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/sql.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/sqlext.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/sqltypes.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/sqlucode.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/sspi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/stacktrace.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/stat.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/stdc/malloc.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/subauth.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/threadaux.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/tlhelp32.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/tmschema.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/unknwn.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/uuid.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/vfw.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/w32api.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winbase.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winber.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/wincon.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/wincrypt.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/windef.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/windows.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winerror.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/wingdi.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winhttp.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/wininet.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winioctl.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winldap.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winnetwk.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winnls.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winnt.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winperf.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winreg.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winsock2.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winspool.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winsvc.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winuser.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/winver.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/wtsapi32.d1
-rw-r--r--libphobos/libdruntime/core/sys/windows/wtypes.d1
-rw-r--r--libphobos/libdruntime/rt/dmain2.d2
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/std/algorithm/iteration.d25
-rw-r--r--libphobos/src/std/algorithm/mutation.d1
-rw-r--r--libphobos/src/std/array.d3
-rw-r--r--libphobos/src/std/ascii.d6
-rw-r--r--libphobos/src/std/base64.d4
-rw-r--r--libphobos/src/std/bitmanip.d98
-rw-r--r--libphobos/src/std/container/binaryheap.d2
-rw-r--r--libphobos/src/std/digest/murmurhash.d10
-rw-r--r--libphobos/src/std/exception.d203
-rw-r--r--libphobos/src/std/experimental/allocator/common.d20
-rw-r--r--libphobos/src/std/file.d55
-rw-r--r--libphobos/src/std/format/internal/write.d40
-rw-r--r--libphobos/src/std/internal/windows/advapi32.d4
-rw-r--r--libphobos/src/std/json.d3
-rw-r--r--libphobos/src/std/net/curl.d2
-rw-r--r--libphobos/src/std/random.d24
-rw-r--r--libphobos/src/std/stdio.d6
-rw-r--r--libphobos/src/std/string.d1
-rw-r--r--libphobos/src/std/traits.d8
-rw-r--r--libphobos/src/std/typecons.d790
-rw-r--r--libphobos/src/std/uni/package.d11
-rw-r--r--libstdc++-v3/ChangeLog85
-rw-r--r--libstdc++-v3/Makefile.in1
-rw-r--r--libstdc++-v3/aclocal.m41
-rw-r--r--libstdc++-v3/config.h.in15
-rw-r--r--libstdc++-v3/config/os/gnu-linux/os_defines.h2
-rwxr-xr-xlibstdc++-v3/configure867
-rw-r--r--libstdc++-v3/configure.ac6
-rw-r--r--libstdc++-v3/doc/Makefile.in1
-rw-r--r--libstdc++-v3/include/Makefile.in1
-rw-r--r--libstdc++-v3/include/bits/cpp_type_traits.h45
-rw-r--r--libstdc++-v3/include/bits/fs_path.h6
-rw-r--r--libstdc++-v3/include/bits/locale_classes.tcc3
-rw-r--r--libstdc++-v3/include/bits/regex_executor.h17
-rw-r--r--libstdc++-v3/include/bits/regex_executor.tcc3
-rw-r--r--libstdc++-v3/include/c_global/cmath8
-rw-r--r--libstdc++-v3/include/std/complex641
-rw-r--r--libstdc++-v3/include/std/functional66
-rw-r--r--libstdc++-v3/libsupc++/Makefile.in1
-rw-r--r--libstdc++-v3/po/Makefile.in1
-rw-r--r--libstdc++-v3/python/Makefile.in1
-rw-r--r--libstdc++-v3/src/Makefile.in1
-rw-r--r--libstdc++-v3/src/c++11/Makefile.in1
-rw-r--r--libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc8
-rw-r--r--libstdc++-v3/src/c++17/Makefile.in1
-rw-r--r--libstdc++-v3/src/c++20/Makefile.in1
-rw-r--r--libstdc++-v3/src/c++98/Makefile.in1
-rw-r--r--libstdc++-v3/src/filesystem/Makefile.in1
-rw-r--r--libstdc++-v3/src/libbacktrace/Makefile.in1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/ext_c++23.cc89
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc2
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/107376.cc76
-rw-r--r--libstdc++-v3/testsuite/Makefile.in1
-rw-r--r--libvtv/ChangeLog5
-rw-r--r--libvtv/configure.tgt3
753 files changed, 16466 insertions, 4448 deletions
diff --git a/ChangeLog b/ChangeLog
index f55adfb..f99789e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-10-31 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+
+ * MAINTAINERS: Update email address.
+
2022-10-21 Дилян Палаузов <dilyan.palauzov@aegee.org>
* configure.ac: Don't configure readline if --with-system-readline is
diff --git a/MAINTAINERS b/MAINTAINERS
index e4e7349..55c5ef9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -60,7 +60,7 @@ arc port Joern Rennecke <gnu@amylaar.uk>
arc port Claudiu Zissulescu <claziss@synopsys.com>
arm port Nick Clifton <nickc@redhat.com>
arm port Richard Earnshaw <richard.earnshaw@arm.com>
-arm port Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+arm port Ramana Radhakrishnan <ramana.gcc@gmail.com>
arm port Kyrylo Tkachov <kyrylo.tkachov@arm.com>
avr port Denis Chertykov <chertykov@gmail.com>
bfin port Jie Zhang <jzhang918@gmail.com>
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b79620c..f7ab7da 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,834 @@
+2022-10-31 Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
+
+ * btfout.cc (btf_calc_num_vbytes): Compute enumeration size depending of
+ enumerator type btf_enum{,64}.
+ (btf_asm_type): Update btf_kflag according to enumeration type sign
+ using dtd_enum_unsigned field for both: BTF_KIND_ENUM{,64}.
+ (btf_asm_enum_const): New argument to represent the size of
+ the BTF enum type, writing the enumerator constant value for
+ 32 bits, if it's 64 bits then explicitly writes lower 32-bits
+ value and higher 32-bits value.
+ (output_asm_btf_enum_list): Add enumeration size argument.
+ * ctfc.cc (ctf_add_enum): New argument to represent CTF enum
+ basic information.
+ (ctf_add_generic): Use of ei_{name. size, unsigned} to build the
+ dtd structure containing enumeration information.
+ (ctf_add_enumerator): Update comment mention support for BTF
+ enumeration in 64-bits.
+ * dwarf2ctf.cc (gen_ctf_enumeration_type): Extract signedness
+ for enumeration type and use it in ctf_add_enum.
+ * ctfc.h (ctf_dmdef): Update dmd_value to HOST_WIDE_INT to allow
+ use 32/64 bits enumerators.
+ information.
+ (ctf_dtdef): New field to describe enum signedness.
+
+2022-10-31 Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
+
+ * config/riscv/riscv-vector-builtins-bases.cc: Change constexpr back to CONSTEXPR.
+ * config/riscv/riscv-vector-builtins-shapes.cc (SHAPE): Ditto.
+ * config/riscv/riscv-vector-builtins.cc (struct registered_function_hasher): Ditto.
+ * config/riscv/riscv-vector-builtins.h (struct rvv_arg_type_info): Ditto.
+
+2022-10-31 Andrew Stubbs <ams@codesourcery.com>
+
+ * config/gcn/gcn-valu.md (fminmaxop): New iterator.
+ (<fexpander><mode>3): New define_expand.
+ (<fexpander><mode>3<exec>): Likewise.
+ (reduc_<fexpander>_scal_<mode>): Likewise.
+ * config/gcn/gcn.md (fexpander): New attribute.
+
+2022-10-31 Andrew Stubbs <ams@codesourcery.com>
+
+ * config/gcn/gcn-valu.md (V64_SI): Delete iterator.
+ (V64_DI): Likewise.
+ (V64_1REG): Likewise.
+ (V64_INT_1REG): Likewise.
+ (V64_2REG): Likewise.
+ (V64_ALL): Likewise.
+ (V64_FP): Likewise.
+ (reduc_<reduc_op>_scal_<mode>): Use V_ALL. Use gen_vec_extract.
+ (fold_left_plus_<mode>): Use V_FP.
+ (*<reduc_op>_dpp_shr_<mode>): Use V_1REG.
+ (*<reduc_op>_dpp_shr_<mode>): Use V_DI.
+ (*plus_carry_dpp_shr_<mode>): Use V_INT_1REG.
+ (*plus_carry_in_dpp_shr_<mode>): Use V_SI.
+ (*plus_carry_dpp_shr_<mode>): Use V_DI.
+ (mov_from_lane63_<mode>): Delete.
+ (mov_from_lane63_<mode>): Delete.
+ * config/gcn/gcn.cc (gcn_expand_reduc_scalar): Support partial vectors.
+ * config/gcn/gcn.md (unspec): Remove UNSPEC_MOV_FROM_LANE63.
+
+2022-10-31 Andrew Stubbs <ams@codesourcery.com>
+
+ * config/gcn/gcn.cc (gcn_simd_clone_compute_vecsize_and_simdlen):
+ Set base_type as ARG_UNUSED.
+
+2022-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * builtin-types.def (BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT32,
+ BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT32X,
+ BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT128X,
+ BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
+ BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
+ BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
+ BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
+ BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_FN_FLOAT16_COMPLEX_FLOAT16, BT_FN_FLOAT32_COMPLEX_FLOAT32,
+ BT_FN_FLOAT64_COMPLEX_FLOAT64, BT_FN_FLOAT128_COMPLEX_FLOAT128,
+ BT_FN_FLOAT32X_COMPLEX_FLOAT32X, BT_FN_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_FN_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
+ BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
+ BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
+ BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
+ BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X): New.
+ * builtins.def (CABS_TYPE, CACOSH_TYPE, CARG_TYPE, CASINH_TYPE,
+ CPOW_TYPE, CPROJ_TYPE): Define and undefine later.
+ (BUILT_IN_CABS, BUILT_IN_CACOSH, BUILT_IN_CACOS, BUILT_IN_CARG,
+ BUILT_IN_CASINH, BUILT_IN_CASIN, BUILT_IN_CATANH, BUILT_IN_CATAN,
+ BUILT_IN_CCOSH, BUILT_IN_CCOS, BUILT_IN_CEXP, BUILT_IN_CLOG,
+ BUILT_IN_CPOW, BUILT_IN_CPROJ, BUILT_IN_CSINH, BUILT_IN_CSIN,
+ BUILT_IN_CSQRT, BUILT_IN_CTANH, BUILT_IN_CTAN): Add
+ DEF_EXT_LIB_FLOATN_NX_BUILTINS.
+ * fold-const-call.cc (fold_const_call_sc, fold_const_call_cc,
+ fold_const_call_ccc): Add various CASE_CFN_*_FN: cases when
+ CASE_CFN_* is present.
+ * gimple-ssa-backprop.cc (backprop::process_builtin_call_use):
+ Likewise.
+ * builtins.cc (expand_builtin, fold_builtin_1): Likewise.
+ * fold-const.cc (negate_mathfn_p, tree_expr_finite_p,
+ tree_expr_maybe_signaling_nan_p, tree_expr_maybe_nan_p,
+ tree_expr_maybe_real_minus_zero_p, tree_call_nonnegative_warnv_p):
+ Likewise.
+
+2022-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * builtin-types.def (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16): New.
+ * builtins.def (BUILT_IN_NEXTAFTERF16B): New builtin.
+ * fold-const-call.cc (fold_const_call_sss): Handle
+ CFN_BUILT_IN_NEXTAFTERF16B.
+
+2022-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * builtin-types.def (BT_FLOAT16_PTR, BT_FLOAT32_PTR, BT_FLOAT64_PTR,
+ BT_FLOAT128_PTR, BT_FLOAT32X_PTR, BT_FLOAT64X_PTR, BT_FLOAT128X_PTR):
+ New DEF_PRIMITIVE_TYPE.
+ (BT_FN_INT_FLOAT16, BT_FN_INT_FLOAT32, BT_FN_INT_FLOAT64,
+ BT_FN_INT_FLOAT128, BT_FN_INT_FLOAT32X, BT_FN_INT_FLOAT64X,
+ BT_FN_INT_FLOAT128X, BT_FN_LONG_FLOAT16, BT_FN_LONG_FLOAT32,
+ BT_FN_LONG_FLOAT64, BT_FN_LONG_FLOAT128, BT_FN_LONG_FLOAT32X,
+ BT_FN_LONG_FLOAT64X, BT_FN_LONG_FLOAT128X, BT_FN_LONGLONG_FLOAT16,
+ BT_FN_LONGLONG_FLOAT32, BT_FN_LONGLONG_FLOAT64,
+ BT_FN_LONGLONG_FLOAT128, BT_FN_LONGLONG_FLOAT32X,
+ BT_FN_LONGLONG_FLOAT64X, BT_FN_LONGLONG_FLOAT128X): New
+ DEF_FUNCTION_TYPE_1.
+ (BT_FN_FLOAT16_FLOAT16_FLOAT16PTR, BT_FN_FLOAT32_FLOAT32_FLOAT32PTR,
+ BT_FN_FLOAT64_FLOAT64_FLOAT64PTR, BT_FN_FLOAT128_FLOAT128_FLOAT128PTR,
+ BT_FN_FLOAT32X_FLOAT32X_FLOAT32XPTR,
+ BT_FN_FLOAT64X_FLOAT64X_FLOAT64XPTR,
+ BT_FN_FLOAT128X_FLOAT128X_FLOAT128XPTR, BT_FN_FLOAT16_FLOAT16_INT,
+ BT_FN_FLOAT32_FLOAT32_INT, BT_FN_FLOAT64_FLOAT64_INT,
+ BT_FN_FLOAT128_FLOAT128_INT, BT_FN_FLOAT32X_FLOAT32X_INT,
+ BT_FN_FLOAT64X_FLOAT64X_INT, BT_FN_FLOAT128X_FLOAT128X_INT,
+ BT_FN_FLOAT16_FLOAT16_INTPTR, BT_FN_FLOAT32_FLOAT32_INTPTR,
+ BT_FN_FLOAT64_FLOAT64_INTPTR, BT_FN_FLOAT128_FLOAT128_INTPTR,
+ BT_FN_FLOAT32X_FLOAT32X_INTPTR, BT_FN_FLOAT64X_FLOAT64X_INTPTR,
+ BT_FN_FLOAT128X_FLOAT128X_INTPTR, BT_FN_FLOAT16_FLOAT16_LONG,
+ BT_FN_FLOAT32_FLOAT32_LONG, BT_FN_FLOAT64_FLOAT64_LONG,
+ BT_FN_FLOAT128_FLOAT128_LONG, BT_FN_FLOAT32X_FLOAT32X_LONG,
+ BT_FN_FLOAT64X_FLOAT64X_LONG, BT_FN_FLOAT128X_FLOAT128X_LONG): New
+ DEF_FUNCTION_TYPE_2.
+ (BT_FN_FLOAT16_FLOAT16_FLOAT16_INTPTR,
+ BT_FN_FLOAT32_FLOAT32_FLOAT32_INTPTR,
+ BT_FN_FLOAT64_FLOAT64_FLOAT64_INTPTR,
+ BT_FN_FLOAT128_FLOAT128_FLOAT128_INTPTR,
+ BT_FN_FLOAT32X_FLOAT32X_FLOAT32X_INTPTR,
+ BT_FN_FLOAT64X_FLOAT64X_FLOAT64X_INTPTR,
+ BT_FN_FLOAT128X_FLOAT128X_FLOAT128X_INTPTR): New DEF_FUNCTION_TYPE_3.
+ * builtins.def (ACOSH_TYPE, ATAN2_TYPE, ATANH_TYPE, COSH_TYPE,
+ FDIM_TYPE, HUGE_VAL_TYPE, HYPOT_TYPE, ILOGB_TYPE, LDEXP_TYPE,
+ LGAMMA_TYPE, LLRINT_TYPE, LOG10_TYPE, LRINT_TYPE, MODF_TYPE,
+ NEXTAFTER_TYPE, REMQUO_TYPE, SCALBLN_TYPE, SCALBN_TYPE, SINH_TYPE):
+ Define and undefine later.
+ (FMIN_TYPE, SQRT_TYPE): Undefine at a later line.
+ (INF_TYPE): Define at a later line.
+ (BUILT_IN_ACOSH, BUILT_IN_ACOS, BUILT_IN_ASINH, BUILT_IN_ASIN,
+ BUILT_IN_ATAN2, BUILT_IN_ATANH, BUILT_IN_ATAN, BUILT_IN_CBRT,
+ BUILT_IN_COSH, BUILT_IN_COS, BUILT_IN_ERFC, BUILT_IN_ERF,
+ BUILT_IN_EXP2, BUILT_IN_EXP, BUILT_IN_EXPM1, BUILT_IN_FDIM,
+ BUILT_IN_FMOD, BUILT_IN_FREXP, BUILT_IN_HYPOT, BUILT_IN_ILOGB,
+ BUILT_IN_LDEXP, BUILT_IN_LGAMMA, BUILT_IN_LLRINT, BUILT_IN_LLROUND,
+ BUILT_IN_LOG10, BUILT_IN_LOG1P, BUILT_IN_LOG2, BUILT_IN_LOGB,
+ BUILT_IN_LOG, BUILT_IN_LRINT, BUILT_IN_LROUND, BUILT_IN_MODF,
+ BUILT_IN_NEXTAFTER, BUILT_IN_POW, BUILT_IN_REMAINDER, BUILT_IN_REMQUO,
+ BUILT_IN_SCALBLN, BUILT_IN_SCALBN, BUILT_IN_SINH, BUILT_IN_SIN,
+ BUILT_IN_TANH, BUILT_IN_TAN, BUILT_IN_TGAMMA): Add
+ DEF_EXT_LIB_FLOATN_NX_BUILTINS.
+ (BUILT_IN_HUGE_VAL): Use HUGE_VAL_TYPE instead of INF_TYPE in
+ DEF_GCC_FLOATN_NX_BUILTINS.
+ * fold-const-call.cc (fold_const_call_ss): Add various CASE_CFN_*_FN:
+ cases when CASE_CFN_* is present.
+ (fold_const_call_sss): Likewise.
+ * builtins.cc (mathfn_built_in_2): Use CASE_MATHFN_FLOATN instead of
+ CASE_MATHFN for various builtins in SEQ_OF_CASE_MATHFN macro.
+ (builtin_with_linkage_p): Add CASE_FLT_FN_FLOATN_NX for various
+ builtins next to CASE_FLT_FN.
+ * fold-const.cc (tree_call_nonnegative_warnv_p): Add CASE_CFN_*_FN:
+ next to CASE_CFN_*: for various builtins.
+ * tree-call-cdce.cc (can_test_argument_range): Add
+ CASE_FLT_FN_FLOATN_NX next to CASE_FLT_FN for various builtins.
+ (edom_only_function): Likewise.
+
+2022-10-31 konglin1 <lingling.kong@intel.com>
+
+ * common/config/i386/i386-common.cc
+ (OPTION_MASK_ISA2_AVXNECONVERT_SET,
+ OPTION_MASK_ISA2_AVXNECONVERT_UNSET): New.
+ (ix86_handle_option): Handle -mavxneconvert, unset
+ avxneconvert when avx2 is disabled.
+ * common/config/i386/i386-cpuinfo.h (processor_types): Add
+ FEATURE_AVXNECONVERT.
+ * common/config/i386/i386-isas.h: Add ISA_NAME_TABLE_ENTRY for
+ avxneconvert.
+ * common/config/i386/cpuinfo.h (get_available_features):
+ Detect avxneconvert.
+ * config.gcc: Add avxneconvertintrin.h
+ * config/i386/avxneconvertintrin.h: New.
+ * config/i386/avx512bf16vlintrin.h (_mm256_cvtneps_pbh):
+ Unified builtin with avxneconvert.
+ (_mm_cvtneps_pbh): Ditto.
+ * config/i386/cpuid.h (bit_AVXNECONVERT): New.
+ * config/i386/i386-builtin-types.def: Add
+ DEF_POINTER_TYPE (PCV8HF, V8HF, CONST),
+ DEF_POINTER_TYPE (PCV8BF, V8BF, CONST),
+ DEF_POINTER_TYPE (PCV16HF, V16HF, CONST),
+ DEF_POINTER_TYPE (PCV16BF, V16BF, CONST),
+ DEF_FUNCTION_TYPE (V4SF, PCBFLOAT16),
+ DEF_FUNCTION_TYPE (V4SF, PCFLOAT16),
+ DEF_FUNCTION_TYPE (V8SF, PCBFLOAT16),
+ DEF_FUNCTION_TYPE (V8SF, PCFLOAT16),
+ DEF_FUNCTION_TYPE (V4SF, PCV8BF),
+ DEF_FUNCTION_TYPE (V4SF, PCV8HF),
+ DEF_FUNCTION_TYPE (V8SF, PCV16HF),
+ DEF_FUNCTION_TYPE (V8SF, PCV16BF),
+ * config/i386/i386-builtin.def: Add new builtins.
+ * config/i386/i386-c.cc (ix86_target_macros_internal): Define
+ __AVXNECONVERT__.
+ * config/i386/i386-expand.cc (ix86_expand_special_args_builtin):
+ Handle V4SF_FTYPE_PCBFLOAT16,V8SF_FTYPE_PCBFLOAT16, V4SF_FTYPE_PCFLOAT16,
+ V8SF_FTYPE_PCFLOAT16,V4SF_FTYPE_PCV8BF,
+ V4SF_FTYPE_PCV8HF,V8SF_FTYPE_PCV16BF,V8SF_FTYPE_PCV16HF.
+ * config/i386/i386-isa.def : Add DEF_PTA(AVXNECONVERT) New.
+ * config/i386/i386-options.cc (isa2_opts): Add -mavxneconvert.
+ (ix86_valid_target_attribute_inner_p): Handle avxneconvert.
+ * config/i386/i386.md: Add attr avx512bf16vl and avxneconvert.
+ * config/i386/i386.opt: Add option -mavxneconvert.
+ * config/i386/immintrin.h: Inculde avxneconvertintrin.h.
+ * config/i386/sse.md (vbcstnebf162ps_<mode>): New define_insn.
+ (vbcstnesh2ps_<mode>): Ditto.
+ (vcvtnee<bf16_ph>2ps_<mode>):Ditto.
+ (vcvtneo<bf16_ph>2ps_<mode>):Ditto.
+ (vcvtneps2bf16_v4sf): Ditto.
+ (*vcvtneps2bf16_v4sf): Ditto.
+ (vcvtneps2bf16_v8sf): Ditto.
+ * doc/invoke.texi: Document -mavxneconvert.
+ * doc/extend.texi: Document avxneconvert.
+ * doc/sourcebuild.texi: Document target avxneconvert.
+
+2022-10-31 konglin1 <lingling.kong@intel.com>
+
+ * config/i386/avx512bf16intrin.h (__attribute__): Change short to bf16.
+ (_mm_cvtsbh_ss): Ditto.
+ (_mm512_cvtne2ps_pbh): Ditto.
+ (_mm512_mask_cvtne2ps_pbh): Ditto.
+ (_mm512_maskz_cvtne2ps_pbh): Ditto.
+ * config/i386/avx512bf16vlintrin.h (__attribute__): Ditto.
+ (_mm256_cvtne2ps_pbh): Ditto.
+ (_mm256_mask_cvtne2ps_pbh): Ditto.
+ (_mm256_maskz_cvtne2ps_pbh): Ditto.
+ (_mm_cvtne2ps_pbh): Ditto.
+ (_mm_mask_cvtne2ps_pbh): Ditto.
+ (_mm_maskz_cvtne2ps_pbh): Ditto.
+ (_mm_cvtness_sbh): Ditto.
+ * config/i386/i386-builtin-types.def (V8BF): Add new
+ DEF_VECTOR_TYPE for BFmode.
+ (V16BF): Ditto.
+ (V32BF): Ditto.
+ * config/i386/i386-builtin.def (BDESC): Fixed builtins.
+ * config/i386/i386-expand.cc (ix86_expand_args_builtin): Changed
+ avx512bf16 ix86_builtin_func_type included HI to BF.
+ * config/i386/immintrin.h: Add SSE2 depend for avx512bf16.
+ * config/i386/sse.md (TARGET_AVX512VL): Changed HI vector to BF
+ vector.
+ (avx512f_cvtneps2bf16_v4sf): New define_expand.
+ (*avx512f_cvtneps2bf16_v4sf): New define_insn.
+ (avx512f_cvtneps2bf16_v4sf_maskz):Ditto.
+ (avx512f_cvtneps2bf16_v4sf_mask): Ditto.
+ (avx512f_cvtneps2bf16_v4sf_mask_1): Ditto.
+
+2022-10-31 liuhongt <hongtao.liu@intel.com>
+
+ PR target/107261
+ * config/i386/i386-modes.def (VECTOR_MODE): Support V2BFmode.
+ * config/i386/i386.cc (classify_argument): Handle V4BFmode and
+ V2BFmode.
+ (ix86_convert_const_vector_to_integer): Ditto.
+ * config/i386/i386.h (VALID_AVX512FP16_REG_MODE): Remove
+ V2BFmode.
+ (VALID_SSE2_REG_MODE): Add V4BFmode and V2BFmode.
+ (VALID_MMX_REG_MODE): Add V4BFmode.
+ * config/i386/i386.md (mode): Add V4BF and V2BF.
+ (MODE_SIZE): Ditto.
+ * config/i386/mmx.md (MMXMODE) Add V4BF.
+ (V_32): Add V2BF.
+ (V_16_32_64): Add V4BF and V2BF.
+ (mmxinsnmode): Add V4BF and V2BF.
+ (*mov<mode>_internal): Hanlde V4BFmode and V2BFmode.
+
+2022-10-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * configure.ac (sjlj-exceptions): Restore dropped line.
+ * configure: Regenerate.
+
+2022-10-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * alias.cc (init_alias_analysis): Do not record sets to the hard
+ frame pointer if the frame pointer has not been eliminated.
+
+2022-10-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * config/darwin-d.cc (TARGET_D_MINFO_START_NAME): Rename to ...
+ (TARGET_D_MINFO_SECTION_START): ...this.
+ (TARGET_D_MINFO_END_NAME): Rename to ...
+ (TARGET_D_MINFO_SECTION_END): ... this.
+ * config/elfos.h (TARGET_D_MINFO_SECTION): Remove.
+ (TARGET_D_MINFO_START_NAME): Remove.
+ (TARGET_D_MINFO_END_NAME): Remove.
+ * config/i386/cygwin-d.cc (TARGET_D_MINFO_SECTION): Remove.
+ (TARGET_D_MINFO_START_NAME): Remove.
+ (TARGET_D_MINFO_END_NAME): Remove.
+ * config/i386/winnt-d.cc (TARGET_D_MINFO_SECTION): Remove.
+ (TARGET_D_MINFO_START_NAME): Remove.
+ (TARGET_D_MINFO_END_NAME): Remove.
+ * doc/tm.texi: Regenerate.
+ * doc/tm.texi.in (TARGET_D_MINFO_START_NAME): Rename to ...
+ (TARGET_D_MINFO_SECTION_START): ...this.
+ (TARGET_D_MINFO_END_NAME): Rename to ...
+ (TARGET_D_MINFO_SECTION_END): ...this.
+
+2022-10-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * config.gcc: Split out glibc-d.o into linux-d.o, kfreebsd-d.o,
+ kopensolaris-d.o, and gnu-d.o. Split out cygwin-d.o from winnt-d.o.
+ * config/arm/linux-eabi.h (EXTRA_TARGET_D_OS_VERSIONS): Remove.
+ * config/gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Remove.
+ * config/i386/cygwin.h (EXTRA_TARGET_D_OS_VERSIONS): Remove.
+ * config/i386/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS): Remove.
+ * config/i386/mingw32.h (EXTRA_TARGET_D_OS_VERSIONS): Remove.
+ * config/i386/t-cygming: Add cygwin-d.o.
+ * config/i386/winnt-d.cc (winnt_d_os_builtins): Only add
+ MinGW-specific version condition.
+ * config/kfreebsd-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Remove.
+ * config/kopensolaris-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Remove.
+ * config/linux-android.h (ANDROID_TARGET_D_OS_VERSIONS): Remove.
+ * config/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Remove.
+ * config/mips/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS): Remove.
+ * config/t-glibc: Remove glibc-d.o, add gnu-d.o, kfreebsd-d.o,
+ kopensolaris-d.o.
+ * config/t-linux: Add linux-d.o.
+ * config/glibc-d.cc: Remove file.
+ * config/gnu-d.cc: New file.
+ * config/i386/cygwin-d.cc: New file.
+ * config/kfreebsd-d.cc: New file.
+ * config/kopensolaris-d.cc: New file.
+ * config/linux-d.cc: New file.
+
+2022-10-29 Jeff Law <jeffreyalaw@gmail.com>
+
+ * config/h8300/h8300.cc (pre_incdec_with_reg): Make reg argument
+ an unsigned int
+ * config/h8300/h8300-protos.h (pre_incdec_with_reg): Adjust prototype.
+
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * config/aarch64/aarch64.cc (aarch64_setup_incoming_varargs):
+ Check TYPE_NO_NAMED_ARGS_STDARG_P.
+ * config/alpha/alpha.cc (alpha_setup_incoming_varargs): Likewise.
+ * config/arc/arc.cc (arc_setup_incoming_varargs): Likewise.
+ * config/arm/arm.cc (arm_setup_incoming_varargs): Likewise.
+ * config/csky/csky.cc (csky_setup_incoming_varargs): Likewise.
+ * config/epiphany/epiphany.cc (epiphany_setup_incoming_varargs):
+ Likewise.
+ * config/fr30/fr30.cc (fr30_setup_incoming_varargs): Likewise.
+ * config/frv/frv.cc (frv_setup_incoming_varargs): Likewise.
+ * config/ft32/ft32.cc (ft32_setup_incoming_varargs): Likewise.
+ * config/i386/i386.cc (ix86_setup_incoming_varargs): Likewise.
+ * config/ia64/ia64.cc (ia64_setup_incoming_varargs): Likewise.
+ * config/loongarch/loongarch.cc
+ (loongarch_setup_incoming_varargs): Likewise.
+ * config/m32r/m32r.cc (m32r_setup_incoming_varargs): Likewise.
+ * config/mcore/mcore.cc (mcore_setup_incoming_varargs): Likewise.
+ * config/mips/mips.cc (mips_setup_incoming_varargs): Likewise.
+ * config/mmix/mmix.cc (mmix_setup_incoming_varargs): Likewise.
+ * config/nds32/nds32.cc (nds32_setup_incoming_varargs): Likewise.
+ * config/nios2/nios2.cc (nios2_setup_incoming_varargs): Likewise.
+ * config/riscv/riscv.cc (riscv_setup_incoming_varargs): Likewise.
+ * config/rs6000/rs6000-call.cc (setup_incoming_varargs): Likewise.
+ * config/sh/sh.cc (sh_setup_incoming_varargs): Likewise.
+ * config/visium/visium.cc (visium_setup_incoming_varargs):
+ Likewise.
+ * config/vms/vms-c.cc (vms_c_common_override_options): Do not set
+ flag_allow_parameterless_variadic_functions.
+ * doc/invoke.texi (-fallow-parameterless-variadic-functions): Do
+ not document option.
+ * function.cc (assign_parms): Call assign_parms_setup_varargs for
+ TYPE_NO_NAMED_ARGS_STDARG_P case.
+ * ginclude/stdarg.h [__STDC_VERSION__ > 201710L] (va_start): Make
+ variadic macro. Pass second argument of 0 to __builtin_va_start.
+ * target.def (setup_incoming_varargs): Update documentation.
+ * doc/tm.texi: Regenerate.
+ * tree-core.h (struct tree_type_common): Add
+ no_named_args_stdarg_p.
+ * tree-streamer-in.cc (unpack_ts_type_common_value_fields): Unpack
+ TYPE_NO_NAMED_ARGS_STDARG_P.
+ * tree-streamer-out.cc (pack_ts_type_common_value_fields): Pack
+ TYPE_NO_NAMED_ARGS_STDARG_P.
+ * tree.cc (type_cache_hasher::equal): Compare
+ TYPE_NO_NAMED_ARGS_STDARG_P.
+ (build_function_type): Add argument no_named_args_stdarg_p.
+ (build_function_type_list_1, build_function_type_array_1)
+ (reconstruct_complex_type): Update calls to build_function_type.
+ (stdarg_p, prototype_p): Return true for (...) functions.
+ (gimple_canonical_types_compatible_p): Compare
+ TYPE_NO_NAMED_ARGS_STDARG_P.
+ * tree.h (TYPE_NO_NAMED_ARGS_STDARG_P): New.
+ (build_function_type): Update prototype.
+
+2022-10-28 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ PR tree-optimization/107346
+ * tree-vect-data-refs.cc (vect_check_gather_scatter): Reject offsets
+ that aren't multiples of BITS_PER_UNIT.
+
+2022-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107407
+ * tree-ssa-dse.cc (dse_classify_store): Perform backedge
+ varying index check when collecting PHI uses rather than
+ after optimizing processing of the candidate defs.
+
+2022-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107447
+ * tree-ssa-loop-im.cc (determine_max_movement): Do not
+ hoist returns-twice calls.
+
+2022-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107435
+ * tree-vect-loop.cc (vectorizable_recurr): Convert initial
+ value to vector component type.
+
+2022-10-28 Julian Brown <julian@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+
+ PR middle-end/90115
+ * omp-low.cc (oacc_privatization_candidate_p): Artificial vars are not
+ privatization candidates.
+
+2022-10-28 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/107298
+ * doc/invoke.texi: Document sanitizers can trigger warnings.
+
+2022-10-28 Thomas Schwinge <thomas@codesourcery.com>
+
+ * doc/makefile.texi (Makefile Targets): Document
+ 'distclean-stage[N]'.
+
+2022-10-28 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.cc (range_tests_floats): Use HONOR_INFINITIES.
+
+2022-10-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/aarch64/aarch64.h (DONT_USE_BUILTIN_SETJMP): Delete.
+
+2022-10-27 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/107172
+ * config/i386/i386.md (UNSPEC_CC_NE): New.
+ Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns.
+
+2022-10-27 Andrew Pinski <apinski@marvell.com>
+
+ * tree-ssa-phiopt.cc: Include tree-ssa-dce.h
+ (replace_phi_edge_with_variable):
+ New argument, dce_ssa_names. Call simple_dce_from_worklist.
+ (match_simplify_replacement): If we inserted a sequence,
+ mark the lhs of the new sequence to be possible dce.
+ Always move the statement and mark the lhs (if it is a name)
+ as possible to remove.
+
+2022-10-27 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/aarch64/aarch64-protos.h: Replace constexpr with
+ CONSTEXPR.
+ * config/aarch64/aarch64-sve-builtins-base.cc: Likewise.
+ * config/aarch64/aarch64-sve-builtins-functions.h: Likewise.
+ * config/aarch64/aarch64-sve-builtins-shapes.cc: Likewise.
+ * config/aarch64/aarch64-sve-builtins-sve2.cc: Likewise.
+ * config/aarch64/aarch64-sve-builtins.cc: Likewise.
+ * config/aarch64/aarch64.cc: Likewise.
+ * config/aarch64/driver-aarch64.cc: Likewise
+
+2022-10-27 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/107394
+ * value-range-storage.cc (frange_storage_slot::get_frange): Use
+ frange constructor.
+
+2022-10-27 Thomas Schwinge <thomas@codesourcery.com>
+
+ * optc-save-gen.awk: Clarify 'Init' option property usage for
+ streaming optimization.
+
+2022-10-27 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
+ Yvan ROUX <yvan.roux@foss.st.com>
+
+ * ira.cc: Resize array after reg number increased.
+
+2022-10-27 Jiawei <jiawei@iscas.ac.cn>
+ Sinan Lin <sinan@isrc.iscas.ac.cn>
+
+ * config/riscv/constraints.md (TARGET_ZFINX ? GR_REGS): Set GPRS
+ use while Zfinx is enable.
+ * config/riscv/riscv.cc (riscv_hard_regno_mode_ok): Limit odd
+ registers use when Zdinx enable in RV32 cases.
+ (riscv_option_override): New target enable MASK_FDIV.
+ (riscv_libgcc_floating_mode_supported_p): New error info when
+ use incompatible arch&abi.
+ (riscv_excess_precision): New target enable FLOAT16.
+
+2022-10-27 Jiawei <jiawei@iscas.ac.cn>
+
+ * config/riscv/iterators.md (TARGET_ZFINX):New target.
+ (TARGET_ZDINX): Ditto.
+ (TARGET_ZHINX): Ditto.
+ * config/riscv/riscv-builtins.cc (AVAIL): Ditto.
+ (riscv_atomic_assign_expand_fenv): Ditto.
+ * config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Ditto.
+ * config/riscv/riscv.md: Ditto.
+
+2022-10-27 Jiawei <jiawei@iscas.ac.cn>
+ Sinan Lin <sinan@isrc.iscas.ac.cn>
+
+ * common/config/riscv/riscv-common.cc: New extensions.
+ * config/riscv/arch-canonicalize: New imply relations.
+ * config/riscv/riscv-opts.h (MASK_ZFINX): New mask.
+ (MASK_ZDINX): Ditto.
+ (MASK_ZHINX): Ditto.
+ (MASK_ZHINXMIN): Ditto.
+ (TARGET_ZFINX): New target.
+ (TARGET_ZDINX): Ditto.
+ (TARGET_ZHINX): Ditto.
+ (TARGET_ZHINXMIN): Ditto.
+ * config/riscv/riscv.opt: New target variable.
+
+2022-10-26 David Faust <david.faust@oracle.com>
+
+ * config/bpf/bpf.cc: Support __builtin_preserve_field_info.
+ (enum bpf_builtins): Add new builtin.
+ (bpf_init_builtins): Likewise.
+ (bpf_core_field_info): New function.
+ (bpf_expand_builtin): Accomodate new builtin. Refactor adding new
+ relocation to...
+ (maybe_make_core_relo): ... here. New function.
+ (bpf_resolve_overloaded_builtin): Accomodate new builtin.
+ (bpf_core_newdecl): Likewise.
+ (bpf_core_walk): Likewise.
+ (bpf_core_is_maybe_aggregate_access): Improve logic.
+ (struct core_walk_data): New.
+ * config/bpf/coreout.cc (bpf_core_reloc_add): Allow adding different
+ relocation kinds.
+ * config/bpf/coreout.h: Analogous change.
+ * doc/extend.texi: Document BPF __builtin_preserve_field_info.
+
+2022-10-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106393
+ * doc/invoke.texi: Document -Wdangling-reference.
+
+2022-10-26 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * config/xtensa/xtensa.md (movdi):
+ Copy operands[0...1] to ops[0...3] and then use the latter before
+ calling xtensa_split_DI_reg_imm() and emitting insns.
+
+2022-10-26 Alexander Monakov <amonakov@ispras.ru>
+
+ PR other/107353
+ * ipa-visibility.cc (function_and_variable_visibility):
+ Conditionally upgrade TLS model instead of asserting.
+
+2022-10-26 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple-range-fold.cc (fold_using_range::fold_stmt): Check if
+ stmt is non-negative and adjust the range.
+
+2022-10-26 Martin Liska <mliska@suse.cz>
+
+ * common/config/i386/cpuinfo.h (has_cpu_feature): Add comment.
+ (reset_cpu_feature): New.
+ (get_zhaoxin_cpu): Use reset_cpu_feature.
+
+2022-10-26 Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
+
+ * config/riscv/riscv.cc (riscv_expand_epilogue): Fix statement.
+
+2022-10-26 Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
+
+ PR target/107357
+ * config/riscv/riscv-modes.def (VECTOR_BOOL_MODE): Set to minimum size.
+ (ADJUST_NUNITS): Adjust according to -march.
+ (ADJUST_BYTESIZE): Ditto.
+ * config/riscv/riscv-protos.h (riscv_v_ext_enabled_vector_mode_p):
+ Remove.
+ (riscv_v_ext_vector_mode_p): Change function implementation.
+ * config/riscv/riscv-vector-builtins.cc (rvv_switcher::rvv_switcher):
+ Change to riscv_v_ext_vector_mode_p.
+ (register_builtin_type): Ditto.
+ * config/riscv/riscv.cc (riscv_v_ext_vector_mode_p): Change to enabled
+ modes.
+ (ENTRY): Ditto.
+ (riscv_v_ext_enabled_vector_mode_p): Remove.
+ (riscv_v_adjust_nunits): New function.
+ (riscv_vector_mode_supported_p): Use riscv_v_ext_vector_mode_p instead.
+ * config/riscv/riscv.h (riscv_v_adjust_nunits): New function.
+
+2022-10-26 Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
+
+ * config.gcc (riscv*): Add riscv-v.o to extra_objs.
+ * config/riscv/constraints.md (vu): New constraint.
+ (vi): Ditto.
+ (Wc0): Ditto.
+ (Wc1): Ditto.
+ * config/riscv/predicates.md (vector_length_operand): New.
+ (reg_or_mem_operand): Ditto.
+ (vector_move_operand): Ditto.
+ (vector_mask_operand): Ditto.
+ (vector_merge_operand): Ditto.
+ * config/riscv/riscv-protos.h (riscv_regmode_natural_size) New.
+ (riscv_vector::const_vec_all_same_in_range_p): Ditto.
+ (riscv_vector::legitimize_move): Ditto.
+ (tail_policy): Ditto.
+ (mask_policy): Ditto.
+ * config/riscv/riscv-v.cc: New.
+ * config/riscv/riscv-vector-builtins-bases.cc
+ (vsetvl::expand): Refactor how LMUL encoding.
+ * config/riscv/riscv.cc (riscv_print_operand): Update how LMUL
+ print and mask operand print.
+ (riscv_regmode_natural_size): New.
+ * config/riscv/riscv.h (REGMODE_NATURAL_SIZE): New.
+ * config/riscv/riscv.md (mode): Add vector modes.
+ * config/riscv/t-riscv (riscv-v.o) New.
+ * config/riscv/vector-iterators.md: New.
+ * config/riscv/vector.md (vundefined<mode>): New.
+ (mov<mode>): New.
+ (*mov<mode>): New.
+ (@vsetvl<mode>_no_side_effects): New.
+ (@pred_mov<mode>): New.
+
+2022-10-26 Monk Chiang <monk.chiang@sifive.com>
+
+ * common/config/riscv/riscv-common.cc (riscv_ext_version_table):
+ Add svinval and svnapot extension.
+ (riscv_ext_flag_table): Ditto.
+ * config/riscv/riscv-opts.h (MASK_SVINVAL): New.
+ (MASK_SVNAPOT): Ditto.
+ (TARGET_SVINVAL): Ditto.
+ (TARGET_SVNAPOT): Ditto.
+ * config/riscv/riscv.opt (riscv_sv_subext): New.
+
+2022-10-26 Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
+
+ * config/riscv/riscv-modes.def: Adjust table indentation in commnet.
+
+2022-10-26 Martin Liska <mliska@suse.cz>
+
+ * configure: Regenerate.
+
+2022-10-26 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.cc (frange::set): Use HONOR_*.
+ (frange::verify_range): Same.
+ * value-range.h (frange_val_min): Same.
+ (frange_val_max): Same.
+
+2022-10-26 Jiufu Guo <guojiufu@linux.ibm.com>
+
+ PR target/106460
+ * config/rs6000/rs6000.cc (rs6000_cannot_force_const_mem): Return true
+ for HIGH code rtx.
+
+2022-10-26 Kito Cheng <kito.cheng@sifive.com>
+
+ * common/config/riscv/riscv-common.cc (riscv_ext_version_table):
+ Add `h`.
+ (riscv_supported_std_ext): Ditto.
+ (multi_letter_subset_rank): Remove `h`.
+ (riscv_subset_list::parse_std_ext): Handle `h` as single letter
+ extension.
+ (riscv_subset_list::parse): Ditto.
+
+2022-10-25 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * auto-profile.cc (get_combined_location): Include discriminator in the
+ returned combined location.
+ (read_function_instance): Read discriminators from profiles.
+
+2022-10-25 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/107304
+ * expr.cc (get_inner_reference): Always use TYPE_MODE for vector
+ field with vector raw mode.
+
+2022-10-25 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/rs6000/rs6000.md (CCEITHER): Delete.
+ (CCANY): New.
+ (un): Delete.
+ (isel_<un>signed_<GPR:mode>): Rename to...
+ (isel_<CCANY:mode>_<GPR:mode>): ... this. Adjust.
+ (*isel_reversed_<un>signed_<GPR:mode>): Rename to...
+ (*isel_reversed_<CCANY:mode>_<GPR:mode>): ... this. Adjust.
+ (setbc_<un>signed_<GPR:mode>): Rename to...
+ (setbc_<CCANY:mode>_<GPR:mode>C): ... this. Adjust."
+ (*setbcr_<un>signed_<GPR:mode>): Rename to ...
+ (*setbcr_<CCANY:mode>_<GPR:mode>): ... this. Adjust.
+ (*setnbc_<un>signed_<GPR:mode>): Rename to ...
+ (*setnbc_<CCANY:mode>_<GPR:mode>): ... this. Adjust.
+ (*setnbcr_<un>signed_<GPR:mode>): Rename to ...
+ (*setnbcr_<CCANY:mode>_<GPR:mode>): ... this. Adjust.
+ (eq<mode>3 for GPR): Adjust.
+ (ne<mode>3 for GPR): Adjust.
+ * config/rs6000/rs6000-string.cc (do_isel): Adjust.
+ * config/rs6000/rs6000.cc (rs6000_emit_int_cmove): Adjust.
+
+2022-10-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107176
+ PR tree-optimization/66375
+ PR tree-optimization/42512
+ * tree-scalar-evolution.cc (follow_ssa_edge_expr): Revert
+ the PR66375 fix, do not not associate PLUS_EXPR to be able
+ to use tail-recursion.
+ (follow_ssa_edge_binary): Likewise.
+ (interpret_loop_phi): Revert PR42512 fix, do not throw
+ away analyze_evolution_in_loop result after the fact.
+ (follow_ssa_edge_expr): When reaching halting_phi initalize
+ the evolution to the symbolic value of the PHI result.
+ (add_to_evolution_1): When adding the first evolution verify
+ we can handle the expression wrapping the symbolic evolution
+ and replace that in full using the initial condition.
+ (class scev_dfs): New, contains ...
+ (follow_ssa_edge_expr, follow_ssa_edge_binary,
+ follow_ssa_edge_in_condition_phi_branch,
+ follow_ssa_edge_in_condition_phi,
+ follow_ssa_edge_inner_loop_phi,
+ add_to_evolution, add_to_evolution_1): ... these with
+ loop and halting_phi arguments in class data.
+ (scev_dfs::get_ev): New toplevel DFS entry, start with
+ a chrec_dont_know evolution.
+ (analyze_evolution_in_loop): Use scev_dfs.
+
+2022-10-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * profile.cc (branch_prob): Be prepared for ignored functions with
+ DECL_SOURCE_LOCATION set to UNKNOWN_LOCATION.
+
+2022-10-25 Richard Biener <rguenther@suse.de>
+
+ * tree-scalar-evolution.cc (follow_ssa_edge_expr): Move
+ STRIP_USELESS_TYPE_CONVERSIONS to where it matters.
+
+2022-10-25 Tejas Joshi <TejasSanjay.Joshi@amd.com>
+
+ * common/config/i386/i386-common.cc (processor_alias_table): Use
+ CPU_ZNVER3 for znver4.
+ * config/i386/znver.md: Remove znver4 reservations.
+
+2022-10-25 Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.cc (gimple_boolify): Fix comment typos, prduce -> produce
+ and There -> These.
+
+2022-10-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/107368
+ * gimplify.cc (gimplify_call_expr): For complex IFN_ASSUME
+ conditions call gimple_boolify on the condition.
+
+2022-10-25 YunQiang Su <yunqiang.su@cipunited.com>
+
+ * config.gcc: add -with-compact-branches=policy build option.
+ * doc/install.texi: Likewise.
+ * config/mips/mips.h: Likewise.
+
+2022-10-25 YunQiang Su <yunqiang.su@cipunited.com>
+
+ * config/mips/mips.cc (mips_option_override): not trigger error
+ for compact-branches=always for pre-R6.
+ * config/mips/mips.h (TARGET_RTP_PIC): not trigger error for
+ compact-branches=always for pre-R6.
+ (TARGET_CB_NEVER): Likewise.
+ (TARGET_CB_ALWAYS): Likewise.
+ (struct mips_cpu_info): define macros for compact branch policy.
+ * doc/invoke.texi: Document "always" with pre-R6.
+
+2022-10-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/107369
+ * gimplify.cc (gimplify_call_expr): If seen_error, handle complex
+ IFN_ASSUME the same as for -O0.
+
+2022-10-25 YunQiang Su <yunqiang.su@cipunited.com>
+
+ * configure.ac: AC_DEFINE(ENABLE_MULTIARCH, 1)
+ * configure: Regenerated.
+ * config.in: Regenerated.
+ * config/mips/mips.h: don't define STANDARD_STARTFILE_PREFIX_1
+ if ENABLE_MULTIARCH is defined.
+ * config/mips/t-linux64: define correct multiarch path when
+ multiarch is enabled.
+
+2022-10-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100756
+ * tree-ssa-loop-niter.cc (expand_simple_operations): Also
+ expand multiplications by invariants.
+
+2022-10-25 Kewen Lin <linkw@linux.ibm.com>
+
+ PR tree-optimization/107338
+ * tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern): Move
+ shfit_n calculation before the adjustments for widening loads.
+
+2022-10-25 Martin Liska <mliska@suse.cz>
+
+ * common/config/riscv/riscv-common.cc
+ (riscv_get_valid_option_values): Get out of ifdef.
+
+2022-10-25 Martin Liska <mliska@suse.cz>
+
+ PR target/107364
+ * common/config/i386/i386-cpuinfo.h (enum processor_vendor):
+ Fix pedantic warning.
+
2022-10-24 Martin Liska <mliska@suse.cz>
PR analyzer/107366
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index c75820c..3950253 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20221025
+20221101
diff --git a/gcc/alias.cc b/gcc/alias.cc
index d54feb1..c62837d 100644
--- a/gcc/alias.cc
+++ b/gcc/alias.cc
@@ -3369,6 +3369,10 @@ memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
void
init_alias_analysis (void)
{
+ const bool frame_pointer_eliminated
+ = reload_completed
+ && !frame_pointer_needed
+ && targetm.can_eliminate (FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM);
unsigned int maxreg = max_reg_num ();
int changed, pass;
int i;
@@ -3446,12 +3450,8 @@ init_alias_analysis (void)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (static_reg_base_value[i]
/* Don't treat the hard frame pointer as special if we
- eliminated the frame pointer to the stack pointer instead. */
- && !(i == HARD_FRAME_POINTER_REGNUM
- && reload_completed
- && !frame_pointer_needed
- && targetm.can_eliminate (FRAME_POINTER_REGNUM,
- STACK_POINTER_REGNUM)))
+ eliminated the frame pointer to the stack pointer. */
+ && !(i == HARD_FRAME_POINTER_REGNUM && frame_pointer_eliminated))
{
new_reg_base_value[i] = static_reg_base_value[i];
bitmap_set_bit (reg_seen, i);
@@ -3467,10 +3467,15 @@ init_alias_analysis (void)
{
rtx note, set;
+ /* Treat the hard frame pointer as special unless we
+ eliminated the frame pointer to the stack pointer. */
+ if (!frame_pointer_eliminated
+ && modified_in_p (hard_frame_pointer_rtx, insn))
+ continue;
+
/* If this insn has a noalias note, process it, Otherwise,
scan for sets. A simple set will have no side effects
which could change the base value of any other register. */
-
if (GET_CODE (PATTERN (insn)) == SET
&& REG_NOTES (insn) != 0
&& find_reg_note (insn, REG_NOALIAS, NULL_RTX))
diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog
index 733580a..6e6b056 100644
--- a/gcc/analyzer/ChangeLog
+++ b/gcc/analyzer/ChangeLog
@@ -1,3 +1,14 @@
+2022-10-26 David Malcolm <dmalcolm@redhat.com>
+
+ * sm-fd.cc (fd_state_machine::on_open): Transition to "unchecked"
+ when the mode is symbolic, rather than just on integer constants.
+ (fd_state_machine::check_for_open_fd): Don't complain about
+ unchecked values in the start state.
+
+2022-10-26 David Malcolm <dmalcolm@redhat.com>
+
+ * sm-fd.dot: New file.
+
2022-10-24 David Malcolm <dmalcolm@redhat.com>
PR analyzer/107349
diff --git a/gcc/analyzer/sm-fd.cc b/gcc/analyzer/sm-fd.cc
index 8a4c208..ae846cd 100644
--- a/gcc/analyzer/sm-fd.cc
+++ b/gcc/analyzer/sm-fd.cc
@@ -940,25 +940,25 @@ fd_state_machine::on_open (sm_context *sm_ctxt, const supernode *node,
if (lhs)
{
tree arg = gimple_call_arg (call, 1);
+ enum access_mode mode = READ_WRITE;
if (TREE_CODE (arg) == INTEGER_CST)
{
int flag = TREE_INT_CST_LOW (arg);
- enum access_mode mode = get_access_mode_from_flag (flag);
-
- switch (mode)
- {
- case READ_ONLY:
- sm_ctxt->on_transition (node, stmt, lhs, m_start,
- m_unchecked_read_only);
- break;
- case WRITE_ONLY:
- sm_ctxt->on_transition (node, stmt, lhs, m_start,
- m_unchecked_write_only);
- break;
- default:
- sm_ctxt->on_transition (node, stmt, lhs, m_start,
- m_unchecked_read_write);
- }
+ mode = get_access_mode_from_flag (flag);
+ }
+ switch (mode)
+ {
+ case READ_ONLY:
+ sm_ctxt->on_transition (node, stmt, lhs, m_start,
+ m_unchecked_read_only);
+ break;
+ case WRITE_ONLY:
+ sm_ctxt->on_transition (node, stmt, lhs, m_start,
+ m_unchecked_write_only);
+ break;
+ default:
+ sm_ctxt->on_transition (node, stmt, lhs, m_start,
+ m_unchecked_read_write);
}
}
else
@@ -1096,7 +1096,7 @@ fd_state_machine::check_for_open_fd (
else
{
- if (!(is_valid_fd_p (state) || (state == m_stop)))
+ if (!(is_valid_fd_p (state) || state == m_start || state == m_stop))
{
if (!is_constant_fd_p (state))
sm_ctxt->warn (
diff --git a/gcc/analyzer/sm-fd.dot b/gcc/analyzer/sm-fd.dot
new file mode 100644
index 0000000..175daae
--- /dev/null
+++ b/gcc/analyzer/sm-fd.dot
@@ -0,0 +1,109 @@
+/* An overview of the state machine from sm-fd.cc.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>.
+
+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/>. */
+
+/* Keep this in-sync with sm-dot.cc */
+
+digraph "fd" {
+
+ /* STATES. */
+
+ /* Start state. */
+ start;
+
+ /* States representing a file descriptor that hasn't yet been
+ checked for validity after opening, for three different
+ access modes. */
+ unchecked_read_write;
+ unchecked_read_only;
+ unchecked_write_only;
+
+ /* States for representing a file descriptor that is known to be valid (>=
+ 0), for three different access modes. */
+ valid_read_write;
+ valid_read_only;
+ valid_write_only;
+
+ /* State for a file descriptor that is known to be invalid (< 0). */
+ invalid;
+
+ /* State for a file descriptor that has been closed. */
+ closed;
+
+ /* State for a file descriptor that we do not want to track anymore . */
+ stop;
+
+ /* TRANSITIONS. */
+
+ /* On "open". */
+ start -> unchecked_read_only [label="on 'X = open(..., O_RDONLY);'"];
+ start -> unchecked_write_only [label="on 'X = open(..., O_WRONLY);'"];
+ start -> unchecked_read_write [label="on 'X = open(..., ...);'"];
+
+ /* On "creat". */
+ start -> unchecked_write_only [label="on 'X = create(...);'"];
+
+ /* On "close". */
+ start -> closed [label="on 'close(X);'"];
+ unchecked_read_write -> closed [label="on 'close(X);'"];
+ unchecked_read_only -> closed [label="on 'close(X);'"];
+ unchecked_write_only -> closed [label="on 'close(X);'"];
+ valid_read_write -> closed [label="on 'close(X);'"];
+ valid_read_only -> closed [label="on 'close(X);'"];
+ valid_write_only -> closed [label="on 'close(X);'"];
+ constant_fd -> closed [label="on 'close(X);'"];
+ closed -> stop [label="on 'close(X);':\nWarn('double close')"];
+
+ /* On "read". */
+ closed -> closed [label="on 'read(X);':\nWarn('use after close')"];
+ unchecked_read_write -> unchecked_read_write [label="on 'read(X);:\nWarn('use without check')'"];
+ unchecked_read_only -> unchecked_read_only [label="on 'read(X);:\nWarn('use without check')'"];
+ unchecked_write_only -> unchecked_write_only [label="on 'read(X);:\nWarn('use without check')'"];
+ valid_write_only -> valid_write_only [label="on 'read(X);:\nWarn('access mode mismatch')'"];
+
+ /* On "write". */
+ closed -> closed [label="on 'write(X);':\nWarn('use after close')"];
+ unchecked_read_write -> unchecked_read_write [label="on 'write(X);:\nWarn('use without check')'"];
+ unchecked_read_only -> unchecked_read_only [label="on 'write(X);:\nWarn('use without check')'"];
+ unchecked_write_only -> unchecked_write_only [label="on 'write(X);:\nWarn('use without check')'"];
+ valid_read_only -> valid_read_only [label="on 'write(X);:\nWarn('access mode mismatch')'"];
+
+ /* On "dup". */
+ closed -> closed [label="on 'dup(X);':\nWarn('use after close')"];
+ /* plus stuff for the new fd. */
+
+ /* On "pipe". */
+ start -> valid_read_write [label="when 'pipe()' succeeds"];
+
+ /* on_condition. */
+ unchecked_read_write -> valid_read_write [label="on 'X >= 0'"];
+ unchecked_read_only -> valid_read_only [label="on 'X >= 0'"];
+ unchecked_write_only -> valid_write_only [label="on 'X >= 0'"];
+ unchecked_read_write -> invalid [label="on 'X < 0'"];
+ unchecked_read_only -> invalid [label="on 'X < 0'"];
+ unchecked_write_only -> invalid [label="on 'X < 0'"];
+
+ /* Leaks. */
+ unchecked_read_write -> stop [label="on leak:\nWarn('leak')"];
+ unchecked_read_only -> stop [label="on leak:\nWarn('leak')"];
+ unchecked_write_only -> stop [label="on leak:\nWarn('leak')"];
+ valid_read_write -> stop [label="on leak:\nWarn('leak')"];
+ valid_read_only -> stop [label="on leak:\nWarn('leak')"];
+ valid_write_only -> stop [label="on leak:\nWarn('leak')"];
+}
diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index ca48404..9730732 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -363,7 +363,8 @@ get_combined_location (location_t loc, tree decl)
/* TODO: allow more bits for line and less bits for discriminator. */
if (LOCATION_LINE (loc) - DECL_SOURCE_LINE (decl) >= (1<<16))
warning_at (loc, OPT_Woverflow, "offset exceeds 16 bytes");
- return ((LOCATION_LINE (loc) - DECL_SOURCE_LINE (decl)) << 16);
+ return ((LOCATION_LINE (loc) - DECL_SOURCE_LINE (decl)) << 16)
+ | get_discriminator_from_loc (loc);
}
/* Return the function decl of a given lexical BLOCK. */
@@ -652,7 +653,7 @@ function_instance::read_function_instance (function_instance_stack *stack,
for (unsigned i = 0; i < num_pos_counts; i++)
{
- unsigned offset = gcov_read_unsigned () & 0xffff0000;
+ unsigned offset = gcov_read_unsigned ();
unsigned num_targets = gcov_read_unsigned ();
gcov_type count = gcov_read_counter ();
s->pos_counts[offset].count = count;
diff --git a/gcc/btfout.cc b/gcc/btfout.cc
index 997a33f..aef9fd7 100644
--- a/gcc/btfout.cc
+++ b/gcc/btfout.cc
@@ -223,7 +223,9 @@ btf_calc_num_vbytes (ctf_dtdef_ref dtd)
break;
case BTF_KIND_ENUM:
- vlen_bytes += vlen * sizeof (struct btf_enum);
+ vlen_bytes += (dtd->dtd_data.ctti_size == 0x8)
+ ? vlen * sizeof (struct btf_enum64)
+ : vlen * sizeof (struct btf_enum);
break;
case BTF_KIND_FUNC_PROTO:
@@ -622,6 +624,15 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
btf_size_type = 0;
}
+ if (btf_kind == BTF_KIND_ENUM)
+ {
+ btf_kflag = dtd->dtd_enum_unsigned
+ ? BTF_KF_ENUM_UNSIGNED
+ : BTF_KF_ENUM_SIGNED;
+ if (dtd->dtd_data.ctti_size == 0x8)
+ btf_kind = BTF_KIND_ENUM64;
+ }
+
dw2_asm_output_data (4, dtd->dtd_data.ctti_name, "btt_name");
dw2_asm_output_data (4, BTF_TYPE_INFO (btf_kind, btf_kflag, btf_vlen),
"btt_info: kind=%u, kflag=%u, vlen=%u",
@@ -634,6 +645,7 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
case BTF_KIND_UNION:
case BTF_KIND_ENUM:
case BTF_KIND_DATASEC:
+ case BTF_KIND_ENUM64:
dw2_asm_output_data (4, dtd->dtd_data.ctti_size, "btt_size: %uB",
dtd->dtd_data.ctti_size);
return;
@@ -707,13 +719,19 @@ btf_asm_sou_member (ctf_container_ref ctfc, ctf_dmdef_t * dmd)
}
}
-/* Asm'out an enum constant following a BTF_KIND_ENUM. */
+/* Asm'out an enum constant following a BTF_KIND_ENUM{,64}. */
static void
-btf_asm_enum_const (ctf_dmdef_t * dmd)
+btf_asm_enum_const (unsigned int size, ctf_dmdef_t * dmd)
{
dw2_asm_output_data (4, dmd->dmd_name_offset, "bte_name");
- dw2_asm_output_data (4, dmd->dmd_value, "bte_value");
+ if (size == 4)
+ dw2_asm_output_data (size, dmd->dmd_value, "bte_value");
+ else
+ {
+ dw2_asm_output_data (4, dmd->dmd_value & 0xffffffff, "bte_value_lo32");
+ dw2_asm_output_data (4, (dmd->dmd_value >> 32) & 0xffffffff, "bte_value_hi32");
+ }
}
/* Asm'out a function parameter description following a BTF_KIND_FUNC_PROTO. */
@@ -871,7 +889,7 @@ output_asm_btf_sou_fields (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
btf_asm_sou_member (ctfc, dmd);
}
-/* Output all enumerator constants following a BTF_KIND_ENUM. */
+/* Output all enumerator constants following a BTF_KIND_ENUM{,64}. */
static void
output_asm_btf_enum_list (ctf_container_ref ARG_UNUSED (ctfc),
@@ -881,7 +899,7 @@ output_asm_btf_enum_list (ctf_container_ref ARG_UNUSED (ctfc),
for (dmd = dtd->dtd_u.dtu_members;
dmd != NULL; dmd = (ctf_dmdef_t *) ctf_dmd_list_next (dmd))
- btf_asm_enum_const (dmd);
+ btf_asm_enum_const (dtd->dtd_data.ctti_size, dmd);
}
/* Output all function arguments following a BTF_KIND_FUNC_PROTO. */
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index df3a88f2..e1e25e9 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -109,6 +109,34 @@ DEF_PRIMITIVE_TYPE (BT_FLOAT128X, (float128x_type_node
DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT, complex_float_type_node)
DEF_PRIMITIVE_TYPE (BT_COMPLEX_DOUBLE, complex_double_type_node)
DEF_PRIMITIVE_TYPE (BT_COMPLEX_LONGDOUBLE, complex_long_double_type_node)
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT16, (float16_type_node
+ ? build_complex_type
+ (float16_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT32, (float32_type_node
+ ? build_complex_type
+ (float32_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT64, (float64_type_node
+ ? build_complex_type
+ (float64_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT128, (float128_type_node
+ ? build_complex_type
+ (float128_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT32X, (float32x_type_node
+ ? build_complex_type
+ (float32x_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT64X, (float64x_type_node
+ ? build_complex_type
+ (float64x_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT128X, (float128x_type_node
+ ? build_complex_type
+ (float128x_type_node)
+ : error_mark_node))
DEF_PRIMITIVE_TYPE (BT_PTR, ptr_type_node)
DEF_PRIMITIVE_TYPE (BT_FILEPTR, fileptr_type_node)
@@ -135,6 +163,27 @@ DEF_PRIMITIVE_TYPE (BT_CONST_DOUBLE_PTR,
(build_qualified_type (double_type_node,
TYPE_QUAL_CONST)))
DEF_PRIMITIVE_TYPE (BT_LONGDOUBLE_PTR, long_double_ptr_type_node)
+DEF_PRIMITIVE_TYPE (BT_FLOAT16_PTR, (float16_type_node
+ ? build_pointer_type (float16_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT32_PTR, (float32_type_node
+ ? build_pointer_type (float32_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT64_PTR, (float64_type_node
+ ? build_pointer_type (float64_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT128_PTR, (float128_type_node
+ ? build_pointer_type (float128_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT32X_PTR, (float32x_type_node
+ ? build_pointer_type (float32x_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT64X_PTR, (float64x_type_node
+ ? build_pointer_type (float64x_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT128X_PTR, (float128x_type_node
+ ? build_pointer_type (float128x_type_node)
+ : error_mark_node))
DEF_PRIMITIVE_TYPE (BT_PID, pid_type_node)
DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node)
DEF_PRIMITIVE_TYPE (BT_CONST_SIZE,
@@ -221,12 +270,40 @@ DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE,
BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
+ BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
+ BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
+ BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
+ BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X)
DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT_COMPLEX_FLOAT,
BT_FLOAT, BT_COMPLEX_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_DOUBLE_COMPLEX_DOUBLE,
BT_DOUBLE, BT_COMPLEX_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE,
BT_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT16_COMPLEX_FLOAT16,
+ BT_FLOAT16, BT_COMPLEX_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT32_COMPLEX_FLOAT32,
+ BT_FLOAT32, BT_COMPLEX_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT64_COMPLEX_FLOAT64,
+ BT_FLOAT64, BT_COMPLEX_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT128_COMPLEX_FLOAT128,
+ BT_FLOAT128, BT_COMPLEX_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_FLOAT32X, BT_COMPLEX_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_FLOAT64X, BT_COMPLEX_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_FLOAT128X, BT_COMPLEX_FLOAT128X)
DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT_FLOAT,
BT_COMPLEX_FLOAT, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_DOUBLE_DOUBLE,
@@ -247,15 +324,36 @@ DEF_FUNCTION_TYPE_1 (BT_FN_INT_PTR, BT_INT, BT_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT, BT_INT, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_DOUBLE, BT_INT, BT_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_LONGDOUBLE, BT_INT, BT_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT16, BT_INT, BT_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT32, BT_INT, BT_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT64, BT_INT, BT_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT128, BT_INT, BT_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT32X, BT_INT, BT_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT64X, BT_INT, BT_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT128X, BT_INT, BT_FLOAT128X)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_DFLOAT32, BT_INT, BT_DFLOAT32)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_DFLOAT64, BT_INT, BT_DFLOAT64)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_DFLOAT128, BT_INT, BT_DFLOAT128)
DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT, BT_LONG, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_LONG_DOUBLE, BT_LONG, BT_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONG_LONGDOUBLE, BT_LONG, BT_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT16, BT_LONG, BT_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT32, BT_LONG, BT_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT64, BT_LONG, BT_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT128, BT_LONG, BT_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT32X, BT_LONG, BT_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT64X, BT_LONG, BT_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT128X, BT_LONG, BT_FLOAT128X)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT, BT_LONGLONG, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_DOUBLE, BT_LONGLONG, BT_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_LONGDOUBLE, BT_LONGLONG, BT_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT16, BT_LONGLONG, BT_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT32, BT_LONGLONG, BT_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT64, BT_LONGLONG, BT_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT128, BT_LONGLONG, BT_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT32X, BT_LONGLONG, BT_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT64X, BT_LONGLONG, BT_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT128X, BT_LONGLONG, BT_FLOAT128X)
DEF_FUNCTION_TYPE_1 (BT_FN_VOID_PTR, BT_VOID, BT_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_SIZE_CONST_STRING, BT_SIZE, BT_CONST_STRING)
DEF_FUNCTION_TYPE_1 (BT_FN_INT_CONST_STRING, BT_INT, BT_CONST_STRING)
@@ -419,12 +517,28 @@ DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_FLOAT64X,
BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128X,
BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X)
+DEF_FUNCTION_TYPE_2 (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16,
+ BT_BFLOAT16, BT_BFLOAT16, BT_BFLOAT16)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_FLOATPTR,
BT_FLOAT, BT_FLOAT, BT_FLOAT_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_DOUBLEPTR,
BT_DOUBLE, BT_DOUBLE, BT_DOUBLE_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_FLOAT16PTR,
+ BT_FLOAT16, BT_FLOAT16, BT_FLOAT16_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_FLOAT32PTR,
+ BT_FLOAT32, BT_FLOAT32, BT_FLOAT32_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_FLOAT64PTR,
+ BT_FLOAT64, BT_FLOAT64, BT_FLOAT64_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_FLOAT128PTR,
+ BT_FLOAT128, BT_FLOAT128, BT_FLOAT128_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_FLOAT32XPTR,
+ BT_FLOAT32X, BT_FLOAT32X, BT_FLOAT32X_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_FLOAT64XPTR,
+ BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128XPTR,
+ BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_LONGDOUBLE,
BT_FLOAT, BT_FLOAT, BT_LONGDOUBLE)
DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_LONGDOUBLE,
@@ -435,12 +549,40 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_INT,
BT_DOUBLE, BT_DOUBLE, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_INT,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_INT,
+ BT_FLOAT16, BT_FLOAT16, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_INT,
+ BT_FLOAT32, BT_FLOAT32, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_INT,
+ BT_FLOAT64, BT_FLOAT64, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_INT,
+ BT_FLOAT128, BT_FLOAT128, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_INT,
+ BT_FLOAT32X, BT_FLOAT32X, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_INT,
+ BT_FLOAT64X, BT_FLOAT64X, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_INT,
+ BT_FLOAT128X, BT_FLOAT128X, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_INTPTR,
BT_FLOAT, BT_FLOAT, BT_INT_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_INTPTR,
BT_DOUBLE, BT_DOUBLE, BT_INT_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_INTPTR,
+ BT_FLOAT16, BT_FLOAT16, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_INTPTR,
+ BT_FLOAT32, BT_FLOAT32, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_INTPTR,
+ BT_FLOAT64, BT_FLOAT64, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_INTPTR,
+ BT_FLOAT128, BT_FLOAT128, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_INTPTR,
+ BT_FLOAT32X, BT_FLOAT32X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_INTPTR,
+ BT_FLOAT64X, BT_FLOAT64X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_INTPTR,
+ BT_FLOAT128X, BT_FLOAT128X, BT_INT_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_INT_FLOAT,
BT_FLOAT, BT_INT, BT_FLOAT)
DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_INT_DOUBLE,
@@ -453,6 +595,20 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_LONG,
BT_DOUBLE, BT_DOUBLE, BT_LONG)
DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONG,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_LONG,
+ BT_FLOAT16, BT_FLOAT16, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_LONG,
+ BT_FLOAT32, BT_FLOAT32, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_LONG,
+ BT_FLOAT64, BT_FLOAT64, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_LONG,
+ BT_FLOAT128, BT_FLOAT128, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_LONG,
+ BT_FLOAT32X, BT_FLOAT32X, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_LONG,
+ BT_FLOAT64X, BT_FLOAT64X, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_LONG,
+ BT_FLOAT128X, BT_FLOAT128X, BT_LONG)
DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_VALIST_ARG,
BT_INT, BT_CONST_STRING, BT_VALIST_ARG)
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_SIZE_SIZE,
@@ -465,6 +621,20 @@ DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE)
DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE,
BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
+ BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
+ BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
+ BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
+ BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X)
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTR, BT_VOID, BT_PTR, BT_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_PTR_CONST_STRING,
BT_INT, BT_CONST_STRING, BT_PTR_CONST_STRING)
@@ -578,6 +748,20 @@ DEF_FUNCTION_TYPE_3 (BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR,
BT_DOUBLE, BT_DOUBLE, BT_DOUBLE, BT_INT_PTR)
DEF_FUNCTION_TYPE_3 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR,
BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT16_FLOAT16_FLOAT16_INTPTR,
+ BT_FLOAT16, BT_FLOAT16, BT_FLOAT16, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT32_FLOAT32_FLOAT32_INTPTR,
+ BT_FLOAT32, BT_FLOAT32, BT_FLOAT32, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT64_FLOAT64_FLOAT64_INTPTR,
+ BT_FLOAT64, BT_FLOAT64, BT_FLOAT64, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT128_FLOAT128_FLOAT128_INTPTR,
+ BT_FLOAT128, BT_FLOAT128, BT_FLOAT128, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT32X_FLOAT32X_FLOAT32X_INTPTR,
+ BT_FLOAT32X, BT_FLOAT32X, BT_FLOAT32X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT64X_FLOAT64X_FLOAT64X_INTPTR,
+ BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128X_INTPTR,
+ BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X, BT_INT_PTR)
DEF_FUNCTION_TYPE_3 (BT_FN_VOID_FLOAT_FLOATPTR_FLOATPTR,
BT_VOID, BT_FLOAT, BT_FLOAT_PTR, BT_FLOAT_PTR)
DEF_FUNCTION_TYPE_3 (BT_FN_VOID_DOUBLE_DOUBLEPTR_DOUBLEPTR,
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 26898d7..b359ce2 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1934,42 +1934,42 @@ mathfn_built_in_2 (tree type, combined_fn fn)
switch (fn)
{
#define SEQ_OF_CASE_MATHFN \
- CASE_MATHFN (ACOS) \
- CASE_MATHFN (ACOSH) \
- CASE_MATHFN (ASIN) \
- CASE_MATHFN (ASINH) \
- CASE_MATHFN (ATAN) \
- CASE_MATHFN (ATAN2) \
- CASE_MATHFN (ATANH) \
- CASE_MATHFN (CBRT) \
+ CASE_MATHFN_FLOATN (ACOS) \
+ CASE_MATHFN_FLOATN (ACOSH) \
+ CASE_MATHFN_FLOATN (ASIN) \
+ CASE_MATHFN_FLOATN (ASINH) \
+ CASE_MATHFN_FLOATN (ATAN) \
+ CASE_MATHFN_FLOATN (ATAN2) \
+ CASE_MATHFN_FLOATN (ATANH) \
+ CASE_MATHFN_FLOATN (CBRT) \
CASE_MATHFN_FLOATN (CEIL) \
CASE_MATHFN (CEXPI) \
CASE_MATHFN_FLOATN (COPYSIGN) \
- CASE_MATHFN (COS) \
- CASE_MATHFN (COSH) \
+ CASE_MATHFN_FLOATN (COS) \
+ CASE_MATHFN_FLOATN (COSH) \
CASE_MATHFN (DREM) \
- CASE_MATHFN (ERF) \
- CASE_MATHFN (ERFC) \
- CASE_MATHFN (EXP) \
+ CASE_MATHFN_FLOATN (ERF) \
+ CASE_MATHFN_FLOATN (ERFC) \
+ CASE_MATHFN_FLOATN (EXP) \
CASE_MATHFN (EXP10) \
- CASE_MATHFN (EXP2) \
- CASE_MATHFN (EXPM1) \
- CASE_MATHFN (FABS) \
- CASE_MATHFN (FDIM) \
+ CASE_MATHFN_FLOATN (EXP2) \
+ CASE_MATHFN_FLOATN (EXPM1) \
+ CASE_MATHFN_FLOATN (FABS) \
+ CASE_MATHFN_FLOATN (FDIM) \
CASE_MATHFN_FLOATN (FLOOR) \
CASE_MATHFN_FLOATN (FMA) \
CASE_MATHFN_FLOATN (FMAX) \
CASE_MATHFN_FLOATN (FMIN) \
- CASE_MATHFN (FMOD) \
- CASE_MATHFN (FREXP) \
+ CASE_MATHFN_FLOATN (FMOD) \
+ CASE_MATHFN_FLOATN (FREXP) \
CASE_MATHFN (GAMMA) \
CASE_MATHFN_REENT (GAMMA) /* GAMMA_R */ \
- CASE_MATHFN (HUGE_VAL) \
- CASE_MATHFN (HYPOT) \
- CASE_MATHFN (ILOGB) \
+ CASE_MATHFN_FLOATN (HUGE_VAL) \
+ CASE_MATHFN_FLOATN (HYPOT) \
+ CASE_MATHFN_FLOATN (ILOGB) \
CASE_MATHFN (ICEIL) \
CASE_MATHFN (IFLOOR) \
- CASE_MATHFN (INF) \
+ CASE_MATHFN_FLOATN (INF) \
CASE_MATHFN (IRINT) \
CASE_MATHFN (IROUND) \
CASE_MATHFN (ISINF) \
@@ -1977,47 +1977,47 @@ mathfn_built_in_2 (tree type, combined_fn fn)
CASE_MATHFN (J1) \
CASE_MATHFN (JN) \
CASE_MATHFN (LCEIL) \
- CASE_MATHFN (LDEXP) \
+ CASE_MATHFN_FLOATN (LDEXP) \
CASE_MATHFN (LFLOOR) \
- CASE_MATHFN (LGAMMA) \
+ CASE_MATHFN_FLOATN (LGAMMA) \
CASE_MATHFN_REENT (LGAMMA) /* LGAMMA_R */ \
CASE_MATHFN (LLCEIL) \
CASE_MATHFN (LLFLOOR) \
- CASE_MATHFN (LLRINT) \
- CASE_MATHFN (LLROUND) \
- CASE_MATHFN (LOG) \
- CASE_MATHFN (LOG10) \
- CASE_MATHFN (LOG1P) \
- CASE_MATHFN (LOG2) \
- CASE_MATHFN (LOGB) \
- CASE_MATHFN (LRINT) \
- CASE_MATHFN (LROUND) \
- CASE_MATHFN (MODF) \
- CASE_MATHFN (NAN) \
- CASE_MATHFN (NANS) \
+ CASE_MATHFN_FLOATN (LLRINT) \
+ CASE_MATHFN_FLOATN (LLROUND) \
+ CASE_MATHFN_FLOATN (LOG) \
+ CASE_MATHFN_FLOATN (LOG10) \
+ CASE_MATHFN_FLOATN (LOG1P) \
+ CASE_MATHFN_FLOATN (LOG2) \
+ CASE_MATHFN_FLOATN (LOGB) \
+ CASE_MATHFN_FLOATN (LRINT) \
+ CASE_MATHFN_FLOATN (LROUND) \
+ CASE_MATHFN_FLOATN (MODF) \
+ CASE_MATHFN_FLOATN (NAN) \
+ CASE_MATHFN_FLOATN (NANS) \
CASE_MATHFN_FLOATN (NEARBYINT) \
- CASE_MATHFN (NEXTAFTER) \
+ CASE_MATHFN_FLOATN (NEXTAFTER) \
CASE_MATHFN (NEXTTOWARD) \
- CASE_MATHFN (POW) \
+ CASE_MATHFN_FLOATN (POW) \
CASE_MATHFN (POWI) \
CASE_MATHFN (POW10) \
- CASE_MATHFN (REMAINDER) \
- CASE_MATHFN (REMQUO) \
+ CASE_MATHFN_FLOATN (REMAINDER) \
+ CASE_MATHFN_FLOATN (REMQUO) \
CASE_MATHFN_FLOATN (RINT) \
CASE_MATHFN_FLOATN (ROUND) \
CASE_MATHFN_FLOATN (ROUNDEVEN) \
CASE_MATHFN (SCALB) \
- CASE_MATHFN (SCALBLN) \
- CASE_MATHFN (SCALBN) \
+ CASE_MATHFN_FLOATN (SCALBLN) \
+ CASE_MATHFN_FLOATN (SCALBN) \
CASE_MATHFN (SIGNBIT) \
CASE_MATHFN (SIGNIFICAND) \
- CASE_MATHFN (SIN) \
+ CASE_MATHFN_FLOATN (SIN) \
CASE_MATHFN (SINCOS) \
- CASE_MATHFN (SINH) \
+ CASE_MATHFN_FLOATN (SINH) \
CASE_MATHFN_FLOATN (SQRT) \
- CASE_MATHFN (TAN) \
- CASE_MATHFN (TANH) \
- CASE_MATHFN (TGAMMA) \
+ CASE_MATHFN_FLOATN (TAN) \
+ CASE_MATHFN_FLOATN (TANH) \
+ CASE_MATHFN_FLOATN (TGAMMA) \
CASE_MATHFN_FLOATN (TRUNC) \
CASE_MATHFN (Y0) \
CASE_MATHFN (Y1) \
@@ -7393,6 +7393,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode,
/* Just do a normal library call if we were unable to fold
the values. */
CASE_FLT_FN (BUILT_IN_CABS):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_CABS):
break;
CASE_FLT_FN (BUILT_IN_FMA):
@@ -9661,6 +9662,7 @@ fold_builtin_1 (location_t loc, tree expr, tree fndecl, tree arg0)
break;
CASE_FLT_FN (BUILT_IN_CARG):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_CARG):
return fold_builtin_carg (loc, arg0, type);
case BUILT_IN_ISASCII:
@@ -11350,27 +11352,43 @@ builtin_with_linkage_p (tree decl)
switch (DECL_FUNCTION_CODE (decl))
{
CASE_FLT_FN (BUILT_IN_ACOS):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOS):
CASE_FLT_FN (BUILT_IN_ACOSH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOSH):
CASE_FLT_FN (BUILT_IN_ASIN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASIN):
CASE_FLT_FN (BUILT_IN_ASINH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASINH):
CASE_FLT_FN (BUILT_IN_ATAN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATAN):
CASE_FLT_FN (BUILT_IN_ATANH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATANH):
CASE_FLT_FN (BUILT_IN_ATAN2):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATAN2):
CASE_FLT_FN (BUILT_IN_CBRT):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_CBRT):
CASE_FLT_FN (BUILT_IN_CEIL):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_CEIL):
CASE_FLT_FN (BUILT_IN_COPYSIGN):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_COPYSIGN):
CASE_FLT_FN (BUILT_IN_COS):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_COS):
CASE_FLT_FN (BUILT_IN_COSH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_COSH):
CASE_FLT_FN (BUILT_IN_ERF):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ERF):
CASE_FLT_FN (BUILT_IN_ERFC):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ERFC):
CASE_FLT_FN (BUILT_IN_EXP):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP):
CASE_FLT_FN (BUILT_IN_EXP2):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP2):
CASE_FLT_FN (BUILT_IN_EXPM1):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXPM1):
CASE_FLT_FN (BUILT_IN_FABS):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_FABS):
CASE_FLT_FN (BUILT_IN_FDIM):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_FDIM):
CASE_FLT_FN (BUILT_IN_FLOOR):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_FLOOR):
CASE_FLT_FN (BUILT_IN_FMA):
@@ -11380,43 +11398,71 @@ builtin_with_linkage_p (tree decl)
CASE_FLT_FN (BUILT_IN_FMIN):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_FMIN):
CASE_FLT_FN (BUILT_IN_FMOD):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_FMOD):
CASE_FLT_FN (BUILT_IN_FREXP):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_FREXP):
CASE_FLT_FN (BUILT_IN_HYPOT):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_HYPOT):
CASE_FLT_FN (BUILT_IN_ILOGB):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ILOGB):
CASE_FLT_FN (BUILT_IN_LDEXP):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LDEXP):
CASE_FLT_FN (BUILT_IN_LGAMMA):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LGAMMA):
CASE_FLT_FN (BUILT_IN_LLRINT):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LLRINT):
CASE_FLT_FN (BUILT_IN_LLROUND):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LLROUND):
CASE_FLT_FN (BUILT_IN_LOG):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG):
CASE_FLT_FN (BUILT_IN_LOG10):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG10):
CASE_FLT_FN (BUILT_IN_LOG1P):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG1P):
CASE_FLT_FN (BUILT_IN_LOG2):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG2):
CASE_FLT_FN (BUILT_IN_LOGB):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOGB):
CASE_FLT_FN (BUILT_IN_LRINT):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LRINT):
CASE_FLT_FN (BUILT_IN_LROUND):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LROUND):
CASE_FLT_FN (BUILT_IN_MODF):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_MODF):
CASE_FLT_FN (BUILT_IN_NAN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_NAN):
CASE_FLT_FN (BUILT_IN_NEARBYINT):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_NEARBYINT):
CASE_FLT_FN (BUILT_IN_NEXTAFTER):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_NEXTAFTER):
CASE_FLT_FN (BUILT_IN_NEXTTOWARD):
CASE_FLT_FN (BUILT_IN_POW):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_POW):
CASE_FLT_FN (BUILT_IN_REMAINDER):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_REMAINDER):
CASE_FLT_FN (BUILT_IN_REMQUO):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_REMQUO):
CASE_FLT_FN (BUILT_IN_RINT):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_RINT):
CASE_FLT_FN (BUILT_IN_ROUND):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_ROUND):
CASE_FLT_FN (BUILT_IN_SCALBLN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_SCALBLN):
CASE_FLT_FN (BUILT_IN_SCALBN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_SCALBN):
CASE_FLT_FN (BUILT_IN_SIN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_SIN):
CASE_FLT_FN (BUILT_IN_SINH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_SINH):
CASE_FLT_FN (BUILT_IN_SINCOS):
CASE_FLT_FN (BUILT_IN_SQRT):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_SQRT):
CASE_FLT_FN (BUILT_IN_TAN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_TAN):
CASE_FLT_FN (BUILT_IN_TANH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_TANH):
CASE_FLT_FN (BUILT_IN_TGAMMA):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_TGAMMA):
CASE_FLT_FN (BUILT_IN_TRUNC):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_TRUNC):
return true;
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 5f2e627..0ea8a2b 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -292,26 +292,40 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_ACOSF, "acosf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_
DEF_C99_BUILTIN (BUILT_IN_ACOSH, "acosh", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ACOSHF, "acoshf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ACOSHL, "acoshl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ACOSH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ACOSH, "acosh", ACOSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_ACOSL, "acosl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ACOS, "acos", ACOSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C11_BUILTIN (BUILT_IN_ALIGNED_ALLOC, "aligned_alloc", BT_FN_PTR_SIZE_SIZE, ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST)
DEF_LIB_BUILTIN (BUILT_IN_ASIN, "asin", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_ASINF, "asinf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ASINH, "asinh", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_ASINHF, "asinhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_ASINHL, "asinhl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ASINH, "asinh", ACOSH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN (BUILT_IN_ASINL, "asinl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ASIN, "asin", ACOSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef ACOSH_TYPE
DEF_LIB_BUILTIN (BUILT_IN_ATAN, "atan", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_LIB_BUILTIN (BUILT_IN_ATAN2, "atan2", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_ATAN2F, "atan2f", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_ATAN2L, "atan2l", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ATAN2_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ATAN2, "atan2", ATAN2_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef ATAN2_TYPE
DEF_C99_C90RES_BUILTIN (BUILT_IN_ATANF, "atanf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_ATANH, "atanh", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ATANHF, "atanhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ATANHL, "atanhl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ATANH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ATANH, "atanh", ATANH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_ATANL, "atanl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ATAN, "atan", ATANH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CBRT, "cbrt", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CBRTF, "cbrtf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_CBRTL, "cbrtl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CBRT, "cbrt", ATANH_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef ATANH_TYPE
DEF_LIB_BUILTIN (BUILT_IN_CEIL, "ceil", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_C90RES_BUILTIN (BUILT_IN_CEILF, "ceilf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_C90RES_BUILTIN (BUILT_IN_CEILL, "ceill", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -329,7 +343,10 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_COSF, "cosf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FP
DEF_LIB_BUILTIN (BUILT_IN_COSH, "cosh", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_COSHF, "coshf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_COSHL, "coshl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define COSH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_COSH, "cosh", COSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_COSL, "cosl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_COS, "cos", COSH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_EXT_LIB_BUILTIN (BUILT_IN_DREM, "drem", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_EXT_LIB_BUILTIN (BUILT_IN_DREMF, "dremf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_EXT_LIB_BUILTIN (BUILT_IN_DREML, "dreml", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
@@ -337,8 +354,10 @@ DEF_C99_BUILTIN (BUILT_IN_ERF, "erf", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FP
DEF_C99_BUILTIN (BUILT_IN_ERFC, "erfc", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ERFCF, "erfcf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ERFCL, "erfcl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ERFC, "erfc", COSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ERFF, "erff", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_ERFL, "erfl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ERF, "erf", COSH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_LIB_BUILTIN (BUILT_IN_EXP, "exp", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C2X_BUILTIN (BUILT_IN_EXP10, "exp10", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C2X_BUILTIN (BUILT_IN_EXP10F, "exp10f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
@@ -346,9 +365,13 @@ DEF_C2X_BUILTIN (BUILT_IN_EXP10L, "exp10l", BT_FN_LONGDOUBLE_LONGDOUBLE,
DEF_C99_BUILTIN (BUILT_IN_EXP2, "exp2", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_EXP2F, "exp2f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_EXP2L, "exp2l", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_EXP2, "exp2", COSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_EXPF, "expf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_EXPL, "expl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_EXP, "exp", COSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_EXPM1, "expm1", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_EXPM1, "expm1", COSH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef COSH_TYPE
DEF_C99_BUILTIN (BUILT_IN_EXPM1F, "expm1f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_EXPM1L, "expm1l", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_LIB_BUILTIN (BUILT_IN_FABS, "fabs", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -363,6 +386,9 @@ DEF_C2X_BUILTIN (BUILT_IN_FABSD128, "fabsd128", BT_FN_DFLOAT128_DFLOAT128
DEF_C99_BUILTIN (BUILT_IN_FDIM, "fdim", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_FDIMF, "fdimf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_FDIML, "fdiml", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define FDIM_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FDIM, "fdim", FDIM_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef FDIM_TYPE
DEF_C99_BUILTIN (BUILT_IN_FECLEAREXCEPT, "feclearexcept", BT_FN_INT_INT, ATTR_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_FEGETENV, "fegetenv", BT_FN_INT_FENV_T_PTR, ATTR_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_FEGETEXCEPTFLAG, "fegetexceptflag", BT_FN_INT_FEXCEPT_T_PTR_INT, ATTR_NOTHROW_LEAF_LIST)
@@ -397,13 +423,17 @@ DEF_C99_BUILTIN (BUILT_IN_FMINF, "fminf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_C
DEF_C99_BUILTIN (BUILT_IN_FMINL, "fminl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
#define FMIN_TYPE(F) BT_FN_##F##_##F##_##F
DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FMIN, "fmin", FMIN_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
-#undef FMIN_TYPE
DEF_LIB_BUILTIN (BUILT_IN_FMOD, "fmod", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_FMODF, "fmodf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_FMODL, "fmodl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FMOD, "fmod", FMIN_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef FMIN_TYPE
DEF_LIB_BUILTIN (BUILT_IN_FREXP, "frexp", BT_FN_DOUBLE_DOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPF, "frexpf", BT_FN_FLOAT_FLOAT_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPL, "frexpl", BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
+#define FREXP_TYPE(F) BT_FN_##F##_##F##_INTPTR
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FREXP, "frexp", FREXP_TYPE, ATTR_MATHFN_FPROUNDING_STORE)
+#undef FREXP_TYPE
DEF_EXT_LIB_BUILTIN (BUILT_IN_GAMMA, "gamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
DEF_EXT_LIB_BUILTIN (BUILT_IN_GAMMAF, "gammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_STORE)
DEF_EXT_LIB_BUILTIN (BUILT_IN_GAMMAL, "gammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
@@ -413,11 +443,15 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_GAMMAL_R, "gammal_r", BT_FN_LONGDOUBLE_LONGDOUB
DEF_GCC_BUILTIN (BUILT_IN_HUGE_VAL, "huge_val", BT_FN_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_HUGE_VALF, "huge_valf", BT_FN_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_HUGE_VALL, "huge_vall", BT_FN_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-#define INF_TYPE(F) BT_FN_##F
-DEF_GCC_FLOATN_NX_BUILTINS (BUILT_IN_HUGE_VAL, "huge_val", INF_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
+#define HUGE_VAL_TYPE(F) BT_FN_##F
+DEF_GCC_FLOATN_NX_BUILTINS (BUILT_IN_HUGE_VAL, "huge_val", HUGE_VAL_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
+#undef HUGE_VAL_TYPE
DEF_C99_BUILTIN (BUILT_IN_HYPOT, "hypot", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_HYPOTF, "hypotf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_HYPOTL, "hypotl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define HYPOT_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_HYPOT, "hypot", HYPOT_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef HYPOT_TYPE
DEF_GCC_BUILTIN (BUILT_IN_ICEIL, "iceil", BT_FN_INT_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_ICEILF, "iceilf", BT_FN_INT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_ICEILL, "iceill", BT_FN_INT_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -427,9 +461,13 @@ DEF_GCC_BUILTIN (BUILT_IN_IFLOORL, "ifloorl", BT_FN_INT_LONGDOUBLE, ATTR_
DEF_C99_BUILTIN (BUILT_IN_ILOGB, "ilogb", BT_FN_INT_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ILOGBF, "ilogbf", BT_FN_INT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_ILOGBL, "ilogbl", BT_FN_INT_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ILOGB_TYPE(F) BT_FN_INT_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ILOGB, "ilogb", ILOGB_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef ILOGB_TYPE
DEF_GCC_BUILTIN (BUILT_IN_INF, "inf", BT_FN_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_INFF, "inff", BT_FN_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_INFL, "infl", BT_FN_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+#define INF_TYPE(F) BT_FN_##F
DEF_GCC_FLOATN_NX_BUILTINS (BUILT_IN_INF, "inf", INF_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
#undef INF_TYPE
DEF_GCC_BUILTIN (BUILT_IN_INFD32, "infd32", BT_FN_DFLOAT32, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -456,12 +494,18 @@ DEF_GCC_BUILTIN (BUILT_IN_LCEILL, "lceill", BT_FN_LONG_LONGDOUBLE, ATTR_C
DEF_LIB_BUILTIN (BUILT_IN_LDEXP, "ldexp", BT_FN_DOUBLE_DOUBLE_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_LDEXPF, "ldexpf", BT_FN_FLOAT_FLOAT_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_LDEXPL, "ldexpl", BT_FN_LONGDOUBLE_LONGDOUBLE_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LDEXP_TYPE(F) BT_FN_##F##_##F##_INT
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LDEXP, "ldexp", LDEXP_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LDEXP_TYPE
DEF_GCC_BUILTIN (BUILT_IN_LFLOOR, "lfloor", BT_FN_LONG_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_LFLOORF, "lfloorf", BT_FN_LONG_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_GCC_BUILTIN (BUILT_IN_LFLOORL, "lfloorl", BT_FN_LONG_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_LGAMMA, "lgamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_BUILTIN (BUILT_IN_LGAMMAF, "lgammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_BUILTIN (BUILT_IN_LGAMMAL, "lgammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
+#define LGAMMA_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LGAMMA, "lgamma", LGAMMA_TYPE, ATTR_MATHFN_FPROUNDING_STORE)
+#undef LGAMMA_TYPE
DEF_EXT_LIB_BUILTIN (BUILT_IN_LGAMMA_R, "lgamma_r", BT_FN_DOUBLE_DOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_EXT_LIB_BUILTIN (BUILT_IN_LGAMMAF_R, "lgammaf_r", BT_FN_FLOAT_FLOAT_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_EXT_LIB_BUILTIN (BUILT_IN_LGAMMAL_R, "lgammal_r", BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
@@ -474,33 +518,51 @@ DEF_GCC_BUILTIN (BUILT_IN_LLFLOORL, "llfloorl", BT_FN_LONGLONG_LONGDOUBLE
DEF_C99_BUILTIN (BUILT_IN_LLRINT, "llrint", BT_FN_LONGLONG_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LLRINTF, "llrintf", BT_FN_LONGLONG_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LLRINTL, "llrintl", BT_FN_LONGLONG_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LLRINT_TYPE(F) BT_FN_LONGLONG_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LLRINT, "llrint", LLRINT_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LLROUND, "llround", BT_FN_LONGLONG_DOUBLE, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LLROUNDF, "llroundf", BT_FN_LONGLONG_FLOAT, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LLROUNDL, "llroundl", BT_FN_LONGLONG_LONGDOUBLE, ATTR_MATHFN_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LLROUND, "llround", LLRINT_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LLRINT_TYPE
DEF_LIB_BUILTIN (BUILT_IN_LOG, "log", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_LIB_BUILTIN (BUILT_IN_LOG10, "log10", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_LOG10F, "log10f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_LOG10L, "log10l", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LOG10_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG10, "log10", LOG10_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOG1P, "log1p", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOG1PF, "log1pf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOG1PL, "log1pl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG1P, "log1p", LOG10_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOG2, "log2", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOG2F, "log2f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOG2L, "log2l", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG2, "log2", LOG10_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOGB, "logb", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOGBF, "logbf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LOGBL, "logbl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOGB, "logb", LOG10_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_LOGF, "logf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_LOGL, "logl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG, "log", LOG10_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LOG10_TYPE
DEF_C99_BUILTIN (BUILT_IN_LRINT, "lrint", BT_FN_LONG_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LRINTF, "lrintf", BT_FN_LONG_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LRINTL, "lrintl", BT_FN_LONG_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LRINT_TYPE(F) BT_FN_LONG_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LRINT, "lrint", LRINT_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LROUND, "lround", BT_FN_LONG_DOUBLE, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LROUNDF, "lroundf", BT_FN_LONG_FLOAT, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_LROUNDL, "lroundl", BT_FN_LONG_LONGDOUBLE, ATTR_MATHFN_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LROUND, "lround", LRINT_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LRINT_TYPE
DEF_LIB_BUILTIN (BUILT_IN_MODF, "modf", BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFF, "modff", BT_FN_FLOAT_FLOAT_FLOATPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFL, "modfl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR, ATTR_MATHFN_FPROUNDING_STORE)
+#define MODF_TYPE(F) BT_FN_##F##_##F##_##F##PTR
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_MODF, "modf", MODF_TYPE, ATTR_MATHFN_FPROUNDING_STORE)
+#undef MODF_TYPE
DEF_C99_BUILTIN (BUILT_IN_NAN, "nan", BT_FN_DOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
DEF_C99_BUILTIN (BUILT_IN_NANF, "nanf", BT_FN_FLOAT_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
DEF_C99_BUILTIN (BUILT_IN_NANL, "nanl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
@@ -527,6 +589,9 @@ DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_NEARBYINT, "nearbyint", NEARBYINT_TYPE,
DEF_C99_BUILTIN (BUILT_IN_NEXTAFTER, "nextafter", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_NEXTAFTERF, "nextafterf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_NEXTAFTERL, "nextafterl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO)
+#define NEXTAFTER_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_NEXTAFTER, "nextafter", NEXTAFTER_TYPE, ATTR_MATHFN_ERRNO)
+DEF_GCC_BUILTIN (BUILT_IN_NEXTAFTERF16B, "nextafterf16b", BT_FN_BFLOAT16_BFLOAT16_BFLOAT16, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARD, "nexttoward", BT_FN_DOUBLE_DOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDF, "nexttowardf", BT_FN_FLOAT_FLOAT_LONGDOUBLE, ATTR_MATHFN_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDL, "nexttowardl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO)
@@ -539,12 +604,18 @@ DEF_GCC_BUILTIN (BUILT_IN_POWI, "powi", BT_FN_DOUBLE_DOUBLE_INT, ATTR_MAT
DEF_GCC_BUILTIN (BUILT_IN_POWIF, "powif", BT_FN_FLOAT_FLOAT_INT, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_POWIL, "powil", BT_FN_LONGDOUBLE_LONGDOUBLE_INT, ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN (BUILT_IN_POWL, "powl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_POW, "pow", NEXTAFTER_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_REMAINDER, "remainder", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_REMAINDERF, "remainderf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_REMAINDERL, "remainderl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_REMAINDER, "remainder", NEXTAFTER_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef NEXTAFTER_TYPE
DEF_C99_BUILTIN (BUILT_IN_REMQUO, "remquo", BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_BUILTIN (BUILT_IN_REMQUOF, "remquof", BT_FN_FLOAT_FLOAT_FLOAT_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_BUILTIN (BUILT_IN_REMQUOL, "remquol", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
+#define REMQUO_TYPE(F) BT_FN_##F##_##F##_##F##_INTPTR
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_REMQUO, "remquo", REMQUO_TYPE, ATTR_MATHFN_FPROUNDING_STORE)
+#undef REMQUO_TYPE
DEF_C99_BUILTIN (BUILT_IN_RINT, "rint", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_RINTF, "rintf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_RINTL, "rintl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
@@ -569,9 +640,15 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_SCALBL, "scalbl", BT_FN_LONGDOUBLE_LONGDOUBLE_L
DEF_C99_BUILTIN (BUILT_IN_SCALBLN, "scalbln", BT_FN_DOUBLE_DOUBLE_LONG, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_SCALBLNF, "scalblnf", BT_FN_FLOAT_FLOAT_LONG, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_SCALBLNL, "scalblnl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONG, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define SCALBLN_TYPE(F) BT_FN_##F##_##F##_LONG
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SCALBLN, "scalbln", SCALBLN_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef SCALBLN_TYPE
DEF_C99_BUILTIN (BUILT_IN_SCALBN, "scalbn", BT_FN_DOUBLE_DOUBLE_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_SCALBNF, "scalbnf", BT_FN_FLOAT_FLOAT_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_SCALBNL, "scalbnl", BT_FN_LONGDOUBLE_LONGDOUBLE_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define SCALBN_TYPE(F) BT_FN_##F##_##F##_INT
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SCALBN, "scalbn", SCALBN_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef SCALBN_TYPE
DEF_EXT_LIB_BUILTIN (BUILT_IN_SIGNBIT, "signbit", BT_FN_INT_VAR, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_SIGNBITF, "signbitf", BT_FN_INT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_EXT_LIB_BUILTIN (BUILT_IN_SIGNBITL, "signbitl", BT_FN_INT_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -589,22 +666,29 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_SINF, "sinf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FP
DEF_LIB_BUILTIN (BUILT_IN_SINH, "sinh", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_SINHF, "sinhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_SINHL, "sinhl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define SINH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SINH, "sinh", SINH_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_SINL, "sinl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SIN, "sin", SINH_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef SINH_TYPE
DEF_LIB_BUILTIN (BUILT_IN_SQRT, "sqrt", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_SQRTF, "sqrtf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_SQRTL, "sqrtl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
#define SQRT_TYPE(F) BT_FN_##F##_##F
DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SQRT, "sqrt", SQRT_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
-#undef SQRT_TYPE
DEF_LIB_BUILTIN (BUILT_IN_TAN, "tan", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN (BUILT_IN_TANF, "tanf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_LIB_BUILTIN (BUILT_IN_TANH, "tanh", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN (BUILT_IN_TANHF, "tanhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN (BUILT_IN_TANHL, "tanhl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_TANH, "tanh", SQRT_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN (BUILT_IN_TANL, "tanl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_TAN, "tan", SQRT_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN (BUILT_IN_TGAMMA, "tgamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_TGAMMAF, "tgammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN (BUILT_IN_TGAMMAL, "tgammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_TGAMMA, "tgamma", SQRT_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef SQRT_TYPE
DEF_C99_BUILTIN (BUILT_IN_TRUNC, "trunc", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_TRUNCF, "truncf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_TRUNCL, "truncl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -625,36 +709,54 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_YNL, "ynl", BT_FN_LONGDOUBLE_INT_LONGDOUBLE, AT
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABS, "cabs", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSF, "cabsf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSL, "cabsl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CABS_TYPE(F) BT_FN_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CABS, "cabs", CABS_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CABS_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOS, "cacos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSF, "cacosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSH, "cacosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHL, "cacoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CACOSH_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CACOSH, "cacosh", CACOSH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSL, "cacosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CACOS, "cacos", CACOSH_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CACOSH_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARG, "carg", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGF, "cargf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGL, "cargl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CARG_TYPE(F) BT_FN_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CARG, "carg", CARG_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CARG_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASIN, "casin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINF, "casinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINH, "casinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHL, "casinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CASINH_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CASINH, "casinh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINL, "casinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CASIN, "casin", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATAN, "catan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANF, "catanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANH, "catanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHL, "catanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CATANH, "catanh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANL, "catanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CATAN, "catan", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOS, "ccos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSF, "ccosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSH, "ccosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHL, "ccoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CCOSH, "ccosh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSL, "ccosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CCOS, "ccos", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXP, "cexp", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPF, "cexpf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPL, "cexpl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CEXP, "cexp", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPI, "cexpi", BT_FN_COMPLEX_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIF, "cexpif", BT_FN_COMPLEX_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIL, "cexpil", BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
@@ -664,6 +766,8 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_CIMAGL, "cimagl", BT_FN_LONGDOUBLE_COMPLE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOG, "clog", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGF, "clogf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGL, "clogl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CLOG, "clog", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CASINH_TYPE
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10, "clog10", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10F, "clog10f", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10L, "clog10l", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
@@ -673,9 +777,14 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_CONJL, "conjl", BT_FN_COMPLEX_LONGDOUBLE_
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOW, "cpow", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWF, "cpowf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWL, "cpowl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CPOW_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CPOW, "cpow", CPOW_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CPOW_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJ, "cproj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJF, "cprojf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJL, "cprojl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+#define CPROJ_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CPROJ, "cproj", CPROJ_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREAL, "creal", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALF, "crealf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALL, "creall", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -684,16 +793,22 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINF, "csinf", BT_FN_COMPLEX_FLOAT_COMPL
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINH, "csinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHL, "csinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSINH, "csinh", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINL, "csinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSIN, "csin", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRT, "csqrt", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTF, "csqrtf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTL, "csqrtl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSQRT, "csqrt", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTAN, "ctan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANF, "ctanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANH, "ctanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHL, "ctanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CTANH, "ctanh", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANL, "ctanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CTAN, "ctan", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CPROJ_TYPE
/* Category: string/memory builtins. */
DEF_EXT_LIB_BUILTIN (BUILT_IN_BCMP, "bcmp", BT_FN_INT_CONST_PTR_CONST_PTR_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index bb85e78..32e8fb1 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,25 @@
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * c-common.cc (def_fn_type): Call build_function_type for
+ zero-argument variable-argument function.
+ (c_common_nodes_and_builtins): Build default_function_type with
+ build_function_type.
+ * c.opt (fallow-parameterless-variadic-functions): Mark as ignored
+ option.
+
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/61469
+ * c-common.h (ENUM_UNDERLYING_TYPE, ENUM_FIXED_UNDERLYING_TYPE_P):
+ New. Moved from cp/cp-tree.h.
+ * c-warn.cc (warnings_for_convert_and_check): Do not consider
+ conversions to enum with underlying type bool to overflow.
+
+2022-10-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106393
+ * c.opt (Wdangling-reference): New.
+
2022-10-19 Joseph Myers <joseph@codesourcery.com>
* c-format.h (enum format_lengths): Add FMT_LEN_w8, FMT_LEN_w16,
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index cd54c51..5890c18 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -4064,7 +4064,8 @@ static tree builtin_types[(int) BT_LAST + 1];
/* A helper function for c_common_nodes_and_builtins. Build function type
for DEF with return type RET and N arguments. If VAR is true, then the
- function should be variadic after those N arguments.
+ function should be variadic after those N arguments, or, if N is zero,
+ unprototyped.
Takes special care not to ICE if any of the types involved are
error_mark_node, which indicates that said type is not in fact available
@@ -4093,7 +4094,10 @@ def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
if (t == error_mark_node)
goto egress;
if (var)
- t = build_varargs_function_type_array (t, n, args);
+ if (n == 0)
+ t = build_function_type (t, NULL_TREE);
+ else
+ t = build_varargs_function_type_array (t, n, args);
else
t = build_function_type_array (t, n, args);
@@ -4661,8 +4665,7 @@ c_common_nodes_and_builtins (void)
uintptr_type_node =
TREE_TYPE (identifier_global_value (c_get_ident (UINTPTR_TYPE)));
- default_function_type
- = build_varargs_function_type_list (integer_type_node, NULL_TREE);
+ default_function_type = build_function_type (integer_type_node, NULL_TREE);
unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node);
lang_hooks.decls.pushdecl
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 62ab4ba..f9d0d29 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1004,6 +1004,30 @@ extern void c_parse_final_cleanups (void);
/* True iff TYPE is cv decltype(nullptr). */
#define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE)
+/* Returns the underlying type of the given enumeration type. The
+ underlying type is determined in different ways, depending on the
+ properties of the enum:
+
+ - In C++0x or C2x, the underlying type can be explicitly specified, e.g.,
+
+ enum E1 : char { ... } // underlying type is char
+
+ - In a C++0x scoped enumeration, the underlying type is int
+ unless otherwises specified:
+
+ enum class E2 { ... } // underlying type is int
+
+ - Otherwise, the underlying type is determined based on the
+ values of the enumerators. In this case, the
+ ENUM_UNDERLYING_TYPE will not be set until after the definition
+ of the enumeration is completed by finish_enum. */
+#define ENUM_UNDERLYING_TYPE(TYPE) \
+ TREE_TYPE (ENUMERAL_TYPE_CHECK (TYPE))
+
+/* Determines whether an ENUMERAL_TYPE has an explicit
+ underlying type. */
+#define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_5 (NODE))
+
extern tree do_case (location_t, tree, tree, tree);
extern tree build_stmt (location_t, enum tree_code, ...);
extern tree build_real_imag_expr (location_t, enum tree_code, tree);
diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc
index 6742f44..cd59c3c 100644
--- a/gcc/c-family/c-warn.cc
+++ b/gcc/c-family/c-warn.cc
@@ -1415,7 +1415,8 @@ warnings_for_convert_and_check (location_t loc, tree type, tree expr,
if (TREE_CODE (expr) == INTEGER_CST
&& (TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
+ || (TREE_CODE (type) == ENUMERAL_TYPE
+ && TREE_CODE (ENUM_UNDERLYING_TYPE (type)) != BOOLEAN_TYPE))
&& !int_fits_type_p (expr, type))
{
/* Do not diagnose overflow in a constant expression merely
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 13f0d63..f08d38d 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -555,6 +555,10 @@ Wdangling-pointer=
C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_dangling_pointer) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 2, 0) IntegerRange(0, 2)
Warn for uses of pointers to auto variables whose lifetime has ended.
+Wdangling-reference
+C++ ObjC++ Var(warn_dangling_reference) Warning LangEnabledBy(C++ ObjC++, Wall)
+Warn when a reference is bound to a temporary whose lifetime has ended.
+
Wdate-time
C ObjC C++ ObjC++ CPP(warn_date_time) CppReason(CPP_W_DATE_TIME) Var(cpp_warn_date_time) Init(0) Warning
Warn about __TIME__, __DATE__ and __TIMESTAMP__ usage.
@@ -1508,8 +1512,8 @@ fall-virtual
C++ ObjC++ WarnRemoved
fallow-parameterless-variadic-functions
-C ObjC Var(flag_allow_parameterless_variadic_functions)
-Allow variadic functions without named parameter.
+C ObjC Ignore
+Does nothing. Preserved for backward compatibility.
falt-external-templates
C++ ObjC++ WarnRemoved
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 2ac8eaa..4e71198 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,86 @@
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * c-decl.cc (grokdeclarator): Pass
+ arg_info->no_named_args_stdarg_p to build_function_type.
+ (grokparms): Check arg_info->no_named_args_stdarg_p before
+ converting () to (void).
+ (build_arg_info): Initialize no_named_args_stdarg_p.
+ (get_parm_info): Set no_named_args_stdarg_p.
+ (start_function): Pass TYPE_NO_NAMED_ARGS_STDARG_P to
+ build_function_type.
+ (store_parm_decls): Count (...) functions as prototyped.
+ * c-parser.cc (c_parser_direct_declarator): Allow '...' after open
+ parenthesis to start parameter list.
+ (c_parser_parms_list_declarator): Always allow '...' with no
+ arguments, call pedwarn_c11 and set no_named_args_stdarg_p.
+ * c-tree.h (struct c_arg_info): Add field no_named_args_stdarg_p.
+ * c-typeck.cc (composite_type): Handle
+ TYPE_NO_NAMED_ARGS_STDARG_P.
+ (function_types_compatible_p): Compare
+ TYPE_NO_NAMED_ARGS_STDARG_P.
+
+2022-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * c-parser.cc (c_parser_omp_all_clauses): Allow optional
+ comma before the first clause.
+ (c_parser_omp_allocate, c_parser_omp_atomic, c_parser_omp_depobj,
+ c_parser_omp_flush, c_parser_omp_scan_loop_body,
+ c_parser_omp_ordered, c_finish_omp_declare_variant,
+ c_parser_omp_declare_target, c_parser_omp_declare_reduction,
+ c_parser_omp_requires, c_parser_omp_error,
+ c_parser_omp_assumption_clauses): Likewise.
+
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/61469
+ * c-convert.cc (c_convert): Handle enums with underlying boolean
+ type like bool.
+ * c-decl.cc (shadow_tag_warned): Allow shadowing declarations for
+ enums with enum type specifier, but give errors for storage class
+ specifiers, qualifiers or alignment specifiers in non-definition
+ declarations of such enums.
+ (grokdeclarator): Give error for non-definition use of type
+ specifier with an enum type specifier.
+ (parser_xref_tag): Add argument has_enum_type_specifier. Pass it
+ to lookup_tag and use it to set ENUM_FIXED_UNDERLYING_TYPE_P.
+ (xref_tag): Update call to parser_xref_tag.
+ (start_enum): Add argument fixed_underlying_type. Complete enum
+ type with a fixed underlying type given in the definition. Give
+ error for defining without a fixed underlying type in the
+ definition if one was given in a prior declaration. Do not mark
+ enums with fixed underlying type as packed for -fshort-enums.
+ Store the enum type in the_enum.
+ (finish_enum): Do not adjust types of values or check their range
+ for an enum with a fixed underlying type. Set underlying type of
+ enum and variants.
+ (build_enumerator): Check enumeration constants for enum with
+ fixed underlying type against that type and convert to that type.
+ Increment in the underlying integer type, with handling for bool.
+ (c_simulate_enum_decl): Update call to start_enum.
+ (declspecs_add_type): Set specs->enum_type_specifier_ref_p.
+ * c-objc-common.cc (c_get_alias_set): Use ENUM_UNDERLYING_TYPE
+ rather than recomputing an underlying type based on size.
+ * c-parser.cc (c_parser_declspecs)
+ (c_parser_struct_or_union_specifier, c_parser_typeof_specifier):
+ Set has_enum_type_specifier for type specifiers.
+ (c_parser_enum_specifier): Handle enum type specifiers.
+ (c_parser_struct_or_union_specifier): Update call to
+ parser_xref_tag.
+ (c_parser_omp_atomic): Check for boolean increment or decrement
+ using C_BOOLEAN_TYPE_P.
+ * c-tree.h (C_BOOLEAN_TYPE_P): New.
+ (struct c_typespec): Add has_enum_type_specifier.
+ (struct c_declspecs): Add enum_type_specifier_ref_p.
+ (struct c_enum_contents): Add enum_type.
+ (start_enum, parser_xref_tag): Update prototypes.
+ * c-typeck.cc (composite_type): Allow for enumerated types
+ compatible with bool.
+ (common_type, comptypes_internal, perform_integral_promotions):
+ Use ENUM_UNDERLYING_TYPE.
+ (parser_build_binary_op, build_unary_op, convert_for_assignment)
+ (c_finish_return, c_start_switch, build_binary_op): Check for
+ boolean types using C_BOOLEAN_TYPE_P.
+
2022-10-24 Jakub Jelinek <jakub@redhat.com>
PR c++/107358
diff --git a/gcc/c/c-convert.cc b/gcc/c/c-convert.cc
index 6e74913..8a43e5f 100644
--- a/gcc/c/c-convert.cc
+++ b/gcc/c/c-convert.cc
@@ -110,8 +110,13 @@ c_convert (tree type, tree expr, bool init_const)
case VOID_TYPE:
return fold_convert_loc (loc, type, e);
- case INTEGER_TYPE:
case ENUMERAL_TYPE:
+ if (ENUM_UNDERLYING_TYPE (type) != NULL_TREE
+ && TREE_CODE (ENUM_UNDERLYING_TYPE (type)) == BOOLEAN_TYPE)
+ goto convert_to_boolean;
+ gcc_fallthrough ();
+
+ case INTEGER_TYPE:
if (sanitize_flags_p (SANITIZE_FLOAT_CAST)
&& current_function_decl != NULL_TREE
&& TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
@@ -129,6 +134,7 @@ c_convert (tree type, tree expr, bool init_const)
goto maybe_fold;
case BOOLEAN_TYPE:
+ convert_to_boolean:
return fold_convert_loc
(loc, type, c_objc_common_truthvalue_conversion (input_location, expr));
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index 4746e31..795c971 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -4817,7 +4817,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
else if (declspecs->typespec_kind != ctsk_tagdef
&& declspecs->typespec_kind != ctsk_tagfirstref
&& declspecs->typespec_kind != ctsk_tagfirstref_attrs
- && code == ENUMERAL_TYPE)
+ && code == ENUMERAL_TYPE
+ && !declspecs->enum_type_specifier_ref_p)
{
bool warned_enum = false;
if (warned != 1)
@@ -4883,6 +4884,38 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
warned = 1;
}
+ if (declspecs->enum_type_specifier_ref_p && !warned)
+ {
+ if (declspecs->storage_class != csc_none)
+ {
+ error ("storage class specifier in empty declaration with %<enum%> "
+ "underlying type");
+ warned = 1;
+ }
+ else if (declspecs->thread_p)
+ {
+ error ("%qs in empty declaration with %<enum%> underlying type",
+ declspecs->thread_gnu_p ? "__thread" : "_Thread_local");
+ warned = 1;
+ }
+ else if (declspecs->const_p
+ || declspecs->volatile_p
+ || declspecs->atomic_p
+ || declspecs->restrict_p
+ || declspecs->address_space)
+ {
+ error ("type qualifier in empty declaration with %<enum%> "
+ "underlying type");
+ warned = 1;
+ }
+ else if (declspecs->alignas_p)
+ {
+ error ("%<alignas%> in empty declaration with %<enum%> "
+ "underlying type");
+ warned = 1;
+ }
+ }
+
if (!warned && !in_system_header_at (input_location)
&& declspecs->storage_class != csc_none)
{
@@ -6496,6 +6529,16 @@ grokdeclarator (const struct c_declarator *declarator,
}
}
+ /* An enum type specifier (": specifier-qualifier-list") may only be
+ specified when the enum is being defined or in an empty
+ declaration of the form "enum identifier enum-type-specifier;".
+ Except for the case of an empty declaration that has additional
+ declaration specifiers, all invalid contexts (declarations that
+ aren't empty, type names, parameter declarations, member
+ declarations) pass through grokdeclarator. */
+ if (declspecs->enum_type_specifier_ref_p)
+ error_at (loc, "%<enum%> underlying type may not be specified here");
+
/* A function definition's declarator must have the form of
a function declarator. */
@@ -7252,7 +7295,8 @@ grokdeclarator (const struct c_declarator *declarator,
}
type_quals = TYPE_UNQUALIFIED;
- type = build_function_type (type, arg_types);
+ type = build_function_type (type, arg_types,
+ arg_info->no_named_args_stdarg_p);
declarator = declarator->declarator;
/* Set the TYPE_CONTEXTs for each tagged type which is local to
@@ -8017,7 +8061,8 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
/* In C2X, convert () to (void). */
if (flag_isoc2x
&& !arg_types
- && !arg_info->parms)
+ && !arg_info->parms
+ && !arg_info->no_named_args_stdarg_p)
arg_types = arg_info->types = void_list_node;
/* If there is a parameter of incomplete type in a definition,
@@ -8087,6 +8132,7 @@ build_arg_info (void)
ret->others = NULL_TREE;
ret->pending_sizes = NULL;
ret->had_vla_unspec = 0;
+ ret->no_named_args_stdarg_p = 0;
return ret;
}
@@ -8278,6 +8324,7 @@ get_parm_info (bool ellipsis, tree expr)
arg_info->types = types;
arg_info->others = others;
arg_info->pending_sizes = expr;
+ arg_info->no_named_args_stdarg_p = ellipsis && !types;
return arg_info;
}
@@ -8285,12 +8332,15 @@ get_parm_info (bool ellipsis, tree expr)
Define the tag as a forward-reference with location LOC if it is
not defined. HAVE_STD_ATTRS says whether any standard attributes
were present after the struct, union or enum keyword; ATTRS are the
- standard attributes present there. Return a c_typespec structure
- for the type specifier. */
+ standard attributes present there. HAS_ENUM_TYPE_SPECIFIER says
+ whether an enum type specifier (": specifier-qualifier-list") is
+ present; if so, this is called before that specifier is parsed, so
+ that the tag is in scope for that specifier. Return a c_typespec
+ structure for the type specifier. */
struct c_typespec
parser_xref_tag (location_t loc, enum tree_code code, tree name,
- bool have_std_attrs, tree attrs)
+ bool have_std_attrs, tree attrs, bool has_enum_type_specifier)
{
struct c_typespec ret;
tree ref;
@@ -8298,11 +8348,13 @@ parser_xref_tag (location_t loc, enum tree_code code, tree name,
ret.expr = NULL_TREE;
ret.expr_const_operands = true;
+ ret.has_enum_type_specifier = has_enum_type_specifier;
- /* If a cross reference is requested, look up the type
- already defined for this tag and return it. */
+ /* If a cross reference is requested, look up the type already
+ defined for this tag and return it. If an enum type specifier is
+ present, only a definition in the current scope is relevant. */
- ref = lookup_tag (code, name, false, &refloc);
+ ref = lookup_tag (code, name, has_enum_type_specifier, &refloc);
/* If this is the right type of tag, return what we found.
(This reference will be shadowed by shadow_tag later if appropriate.)
If this is the wrong type of tag, do not return it. If it was the
@@ -8371,6 +8423,7 @@ parser_xref_tag (location_t loc, enum tree_code code, tree name,
TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node);
TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node);
TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node);
+ ENUM_FIXED_UNDERLYING_TYPE_P (ref) = has_enum_type_specifier;
}
pushtag (loc, name, ref);
@@ -8387,7 +8440,8 @@ parser_xref_tag (location_t loc, enum tree_code code, tree name,
tree
xref_tag (enum tree_code code, tree name)
{
- return parser_xref_tag (input_location, code, name, false, NULL_TREE).spec;
+ return parser_xref_tag (input_location, code, name, false, NULL_TREE,
+ false).spec;
}
/* Make sure that the tag NAME is defined *in the current scope*
@@ -9288,12 +9342,15 @@ layout_array_type (tree t)
/* Begin compiling the definition of an enumeration type.
NAME is its name (or null if anonymous).
LOC is the enum's location.
+ FIXED_UNDERLYING_TYPE is the (C2x) underlying type specified in the
+ definition.
Returns the type object, as yet incomplete.
Also records info about it so that build_enumerator
may be used to declare the individual values as they are read. */
tree
-start_enum (location_t loc, struct c_enum_contents *the_enum, tree name)
+start_enum (location_t loc, struct c_enum_contents *the_enum, tree name,
+ tree fixed_underlying_type)
{
tree enumtype = NULL_TREE;
location_t enumloc = UNKNOWN_LOCATION;
@@ -9309,6 +9366,23 @@ start_enum (location_t loc, struct c_enum_contents *the_enum, tree name)
{
enumtype = make_node (ENUMERAL_TYPE);
pushtag (loc, name, enumtype);
+ if (fixed_underlying_type != NULL_TREE)
+ {
+ /* For an enum definition with a fixed underlying type, the
+ type is complete during the definition and the
+ enumeration constants have that type. If there was a
+ tag, the type was completed in c_parser_enum_specifier.
+ If not, it must be completed here. */
+ ENUM_FIXED_UNDERLYING_TYPE_P (enumtype) = true;
+ TYPE_MIN_VALUE (enumtype) = TYPE_MIN_VALUE (fixed_underlying_type);
+ TYPE_MAX_VALUE (enumtype) = TYPE_MAX_VALUE (fixed_underlying_type);
+ TYPE_UNSIGNED (enumtype) = TYPE_UNSIGNED (fixed_underlying_type);
+ SET_TYPE_ALIGN (enumtype, TYPE_ALIGN (fixed_underlying_type));
+ TYPE_SIZE (enumtype) = NULL_TREE;
+ TYPE_PRECISION (enumtype) = TYPE_PRECISION (fixed_underlying_type);
+ ENUM_UNDERLYING_TYPE (enumtype) = fixed_underlying_type;
+ layout_type (enumtype);
+ }
}
/* Update type location to the one of the definition, instead of e.g.
a forward declaration. */
@@ -9336,10 +9410,16 @@ start_enum (location_t loc, struct c_enum_contents *the_enum, tree name)
TYPE_VALUES (enumtype) = NULL_TREE;
}
+ if (ENUM_FIXED_UNDERLYING_TYPE_P (enumtype)
+ && fixed_underlying_type == NULL_TREE)
+ error_at (loc, "%<enum%> declared with but defined without "
+ "fixed underlying type");
+
the_enum->enum_next_value = integer_zero_node;
+ the_enum->enum_type = enumtype;
the_enum->enum_overflow = 0;
- if (flag_short_enums)
+ if (flag_short_enums && !ENUM_FIXED_UNDERLYING_TYPE_P (enumtype))
for (tree v = TYPE_MAIN_VARIANT (enumtype); v; v = TYPE_NEXT_VARIANT (v))
TYPE_PACKED (v) = 1;
@@ -9403,54 +9483,61 @@ finish_enum (tree enumtype, tree values, tree attributes)
(tree_int_cst_lt (minnode, TYPE_MIN_VALUE (integer_type_node))
|| tree_int_cst_lt (TYPE_MAX_VALUE (integer_type_node), maxnode));
- /* If the precision of the type was specified with an attribute and it
- was too small, give an error. Otherwise, use it. */
- if (TYPE_PRECISION (enumtype) && lookup_attribute ("mode", attributes))
+
+ if (!ENUM_FIXED_UNDERLYING_TYPE_P (enumtype))
{
- if (precision > TYPE_PRECISION (enumtype))
+ /* If the precision of the type was specified with an attribute and it
+ was too small, give an error. Otherwise, use it. */
+ if (TYPE_PRECISION (enumtype) && lookup_attribute ("mode", attributes))
{
- TYPE_PRECISION (enumtype) = 0;
- error ("specified mode too small for enumerated values");
+ if (precision > TYPE_PRECISION (enumtype))
+ {
+ TYPE_PRECISION (enumtype) = 0;
+ error ("specified mode too small for enumerated values");
+ }
+ else
+ precision = TYPE_PRECISION (enumtype);
}
else
- precision = TYPE_PRECISION (enumtype);
- }
- else
- TYPE_PRECISION (enumtype) = 0;
-
- if (TYPE_PACKED (enumtype)
- || precision > TYPE_PRECISION (integer_type_node)
- || TYPE_PRECISION (enumtype))
- {
- tem = c_common_type_for_size (precision, sign == UNSIGNED ? 1 : 0);
- if (tem == NULL)
- {
- /* This should only occur when both signed and unsigned
- values of maximum precision occur among the
- enumerators. */
- pedwarn (input_location, 0,
- "enumeration values exceed range of largest integer");
- tem = widest_integer_literal_type_node;
- }
- else if (precision > TYPE_PRECISION (intmax_type_node)
- && !tree_int_cst_lt (minnode, TYPE_MIN_VALUE (intmax_type_node))
- && !tree_int_cst_lt (TYPE_MAX_VALUE (uintmax_type_node),
- maxnode))
- pedwarn (input_location, OPT_Wpedantic,
- "enumeration values exceed range of %qs",
- sign == UNSIGNED ? "uintmax_t" : "intmax_t");
- }
- else
- tem = sign == UNSIGNED ? unsigned_type_node : integer_type_node;
+ TYPE_PRECISION (enumtype) = 0;
+
+ if (TYPE_PACKED (enumtype)
+ || precision > TYPE_PRECISION (integer_type_node)
+ || TYPE_PRECISION (enumtype))
+ {
+ tem = c_common_type_for_size (precision, sign == UNSIGNED ? 1 : 0);
+ if (tem == NULL)
+ {
+ /* This should only occur when both signed and unsigned
+ values of maximum precision occur among the
+ enumerators. */
+ pedwarn (input_location, 0,
+ "enumeration values exceed range of largest integer");
+ tem = widest_integer_literal_type_node;
+ }
+ else if (precision > TYPE_PRECISION (intmax_type_node)
+ && !tree_int_cst_lt (minnode,
+ TYPE_MIN_VALUE (intmax_type_node))
+ && !tree_int_cst_lt (TYPE_MAX_VALUE (uintmax_type_node),
+ maxnode))
+ pedwarn (input_location, OPT_Wpedantic,
+ "enumeration values exceed range of %qs",
+ sign == UNSIGNED ? "uintmax_t" : "intmax_t");
+ }
+ else
+ tem = sign == UNSIGNED ? unsigned_type_node : integer_type_node;
- TYPE_MIN_VALUE (enumtype) = TYPE_MIN_VALUE (tem);
- TYPE_MAX_VALUE (enumtype) = TYPE_MAX_VALUE (tem);
- TYPE_UNSIGNED (enumtype) = TYPE_UNSIGNED (tem);
- SET_TYPE_ALIGN (enumtype, TYPE_ALIGN (tem));
- TYPE_SIZE (enumtype) = NULL_TREE;
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (tem);
+ TYPE_MIN_VALUE (enumtype) = TYPE_MIN_VALUE (tem);
+ TYPE_MAX_VALUE (enumtype) = TYPE_MAX_VALUE (tem);
+ TYPE_UNSIGNED (enumtype) = TYPE_UNSIGNED (tem);
+ SET_TYPE_ALIGN (enumtype, TYPE_ALIGN (tem));
+ TYPE_SIZE (enumtype) = NULL_TREE;
+ TYPE_PRECISION (enumtype) = TYPE_PRECISION (tem);
+ ENUM_UNDERLYING_TYPE (enumtype) =
+ c_common_type_for_size (TYPE_PRECISION (tem), TYPE_UNSIGNED (tem));
- layout_type (enumtype);
+ layout_type (enumtype);
+ }
if (values != error_mark_node)
{
@@ -9477,8 +9564,10 @@ finish_enum (tree enumtype, tree values, tree attributes)
fit in int are given type int in build_enumerator (which
is the correct type while the enumeration is being
parsed), so no conversions are needed here if all
- enumerators fit in int. */
- if (wider_than_int)
+ enumerators fit in int. If the enum has a fixed
+ underlying type, the correct type was also given in
+ build_enumerator. */
+ if (!ENUM_FIXED_UNDERLYING_TYPE_P (enumtype) && wider_than_int)
ini = convert (enumtype, ini);
DECL_INITIAL (enu) = ini;
@@ -9516,6 +9605,7 @@ finish_enum (tree enumtype, tree values, tree attributes)
TYPE_USER_ALIGN (tem) = TYPE_USER_ALIGN (enumtype);
TYPE_UNSIGNED (tem) = TYPE_UNSIGNED (enumtype);
TYPE_LANG_SPECIFIC (tem) = TYPE_LANG_SPECIFIC (enumtype);
+ ENUM_UNDERLYING_TYPE (tem) = ENUM_UNDERLYING_TYPE (enumtype);
}
/* Finish debugging output for this type. */
@@ -9595,56 +9685,89 @@ build_enumerator (location_t decl_loc, location_t loc,
if (the_enum->enum_overflow)
error_at (loc, "overflow in enumeration values");
}
- /* Even though the underlying type of an enum is unspecified, the
- type of enumeration constants is explicitly defined as int
- (6.4.4.3/2 in the C99 Standard). C2X allows any integer type, and
- GCC allows such types for older standards as an extension. */
- bool warned_range = false;
- if (!int_fits_type_p (value,
- (TYPE_UNSIGNED (TREE_TYPE (value))
- ? uintmax_type_node
- : intmax_type_node)))
- /* GCC does not consider its types larger than intmax_t to be
- extended integer types (although C2X would permit such types to
- be considered extended integer types if all the features
- required by <stdint.h> and <inttypes.h> macros, such as support
- for integer constants and I/O, were present), so diagnose if
- such a wider type is used. (If the wider type arose from a
- constant of such a type, that will also have been diagnosed,
- but this is the only diagnostic in the case where it arises
- from choosing a wider type automatically when adding 1
- overflows.) */
- warned_range = pedwarn (loc, OPT_Wpedantic,
- "enumerator value outside the range of %qs",
+ if (ENUM_FIXED_UNDERLYING_TYPE_P (the_enum->enum_type))
+ {
+ /* Enumeration constants must fit in the fixed underlying type. */
+ if (!int_fits_type_p (value, ENUM_UNDERLYING_TYPE (the_enum->enum_type)))
+ error_at (loc,
+ "enumerator value outside the range of underlying type");
+ /* Enumeration constants for an enum with fixed underlying type
+ have the enum type, both inside and outside the
+ definition. */
+ value = convert (the_enum->enum_type, value);
+ }
+ else
+ {
+ /* Even though the underlying type of an enum is unspecified, the
+ type of enumeration constants is explicitly defined as int
+ (6.4.4.3/2 in the C99 Standard). C2X allows any integer type, and
+ GCC allows such types for older standards as an extension. */
+ bool warned_range = false;
+ if (!int_fits_type_p (value,
(TYPE_UNSIGNED (TREE_TYPE (value))
- ? "uintmax_t"
- : "intmax_t"));
- if (!warned_range && !int_fits_type_p (value, integer_type_node))
- pedwarn_c11 (loc, OPT_Wpedantic,
- "ISO C restricts enumerator values to range of %<int%> "
- "before C2X");
-
- /* The ISO C Standard mandates enumerators to have type int before
- C2X, even though the underlying type of an enum type is
- unspecified. C2X allows enumerators of any integer type. During
- the parsing of the enumeration, C2X specifies that constants
- representable in int have type int, constants not representable
- in int have the type of the given expression if any, and
- constants not representable in int and derived by adding 1 to the
- previous constant have the type of that constant unless the
- addition would overflow or wraparound, in which case a wider type
- of the same signedness is chosen automatically; after the
- enumeration is parsed, all the constants have the type of the
- enumeration if any do not fit in int. */
- if (int_fits_type_p (value, integer_type_node))
- value = convert (integer_type_node, value);
+ ? uintmax_type_node
+ : intmax_type_node)))
+ /* GCC does not consider its types larger than intmax_t to be
+ extended integer types (although C2X would permit such types to
+ be considered extended integer types if all the features
+ required by <stdint.h> and <inttypes.h> macros, such as support
+ for integer constants and I/O, were present), so diagnose if
+ such a wider type is used. (If the wider type arose from a
+ constant of such a type, that will also have been diagnosed,
+ but this is the only diagnostic in the case where it arises
+ from choosing a wider type automatically when adding 1
+ overflows.) */
+ warned_range = pedwarn (loc, OPT_Wpedantic,
+ "enumerator value outside the range of %qs",
+ (TYPE_UNSIGNED (TREE_TYPE (value))
+ ? "uintmax_t"
+ : "intmax_t"));
+ if (!warned_range && !int_fits_type_p (value, integer_type_node))
+ pedwarn_c11 (loc, OPT_Wpedantic,
+ "ISO C restricts enumerator values to range of %<int%> "
+ "before C2X");
+
+ /* The ISO C Standard mandates enumerators to have type int before
+ C2X, even though the underlying type of an enum type is
+ unspecified. C2X allows enumerators of any integer type. During
+ the parsing of the enumeration, C2X specifies that constants
+ representable in int have type int, constants not representable
+ in int have the type of the given expression if any, and
+ constants not representable in int and derived by adding 1 to the
+ previous constant have the type of that constant unless the
+ addition would overflow or wraparound, in which case a wider type
+ of the same signedness is chosen automatically; after the
+ enumeration is parsed, all the constants have the type of the
+ enumeration if any do not fit in int. */
+ if (int_fits_type_p (value, integer_type_node))
+ value = convert (integer_type_node, value);
+ }
/* Set basis for default for next value. */
- the_enum->enum_next_value
- = build_binary_op (EXPR_LOC_OR_LOC (value, input_location),
- PLUS_EXPR, value, integer_one_node, false);
+ if (ENUM_FIXED_UNDERLYING_TYPE_P (the_enum->enum_type))
+ {
+ tree underlying_type = ENUM_UNDERLYING_TYPE (the_enum->enum_type);
+ if (TREE_CODE (underlying_type) == BOOLEAN_TYPE)
+ /* A value of 2 following a value of 1 overflows bool, but we
+ cannot carry out addition directly on bool without
+ promotion, and converting the result of arithmetic in a
+ wider type back to bool would not produce the right result
+ for this overflow check. */
+ the_enum->enum_next_value = invert_truthvalue_loc (loc, value);
+ else
+ the_enum->enum_next_value
+ = build_binary_op (EXPR_LOC_OR_LOC (value, input_location),
+ PLUS_EXPR, convert (underlying_type, value),
+ convert (underlying_type, integer_one_node),
+ false);
+ }
+ else
+ the_enum->enum_next_value
+ = build_binary_op (EXPR_LOC_OR_LOC (value, input_location),
+ PLUS_EXPR, value, integer_one_node, false);
the_enum->enum_overflow = tree_int_cst_lt (the_enum->enum_next_value, value);
- if (the_enum->enum_overflow)
+ if (the_enum->enum_overflow
+ && !ENUM_FIXED_UNDERLYING_TYPE_P (the_enum->enum_type))
{
/* Choose a wider type with the same signedness if
available. */
@@ -9691,7 +9814,8 @@ c_simulate_enum_decl (location_t loc, const char *name,
input_location = loc;
struct c_enum_contents the_enum;
- tree enumtype = start_enum (loc, &the_enum, get_identifier (name));
+ tree enumtype = start_enum (loc, &the_enum, get_identifier (name),
+ NULL_TREE);
tree value_chain = NULL_TREE;
string_int_pair *value;
@@ -9815,7 +9939,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
/* Make it return void instead. */
TREE_TYPE (decl1)
= build_function_type (void_type_node,
- TYPE_ARG_TYPES (TREE_TYPE (decl1)));
+ TYPE_ARG_TYPES (TREE_TYPE (decl1)),
+ TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (decl1)));
}
if (warn_about_return_type)
@@ -10414,7 +10539,7 @@ store_parm_decls (void)
empty argument list was converted to (void) in grokparms; in
older C standard versions, it does not give the function a type
with a prototype for future calls. */
- proto = arg_info->types != 0;
+ proto = arg_info->types != 0 || arg_info->no_named_args_stdarg_p;
if (proto)
store_parm_decls_newstyle (fndecl, arg_info);
@@ -11980,6 +12105,9 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
}
}
specs->type = type;
+ if (spec.has_enum_type_specifier
+ && spec.kind != ctsk_tagdef)
+ specs->enum_type_specifier_ref_p = true;
}
return specs;
diff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc
index b468091..1a8b162 100644
--- a/gcc/c/c-objc-common.cc
+++ b/gcc/c/c-objc-common.cc
@@ -387,13 +387,7 @@ c_get_alias_set (tree t)
/* Allow aliasing between enumeral types and the underlying
integer type. This is required since those are compatible types. */
if (TREE_CODE (t) == ENUMERAL_TYPE)
- {
- tree t1 = c_common_type_for_size (tree_to_uhwi (TYPE_SIZE (t)),
- /* short-cut commoning to signed
- type. */
- false);
- return get_alias_set (t1);
- }
+ return get_alias_set (ENUM_UNDERLYING_TYPE (t));
return c_common_get_alias_set (t);
}
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 602e023..ca533c9 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -3011,6 +3011,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
}
t.expr = NULL_TREE;
t.expr_const_operands = true;
+ t.has_enum_type_specifier = false;
declspecs_add_type (name_token->location, specs, t);
continue;
}
@@ -3027,6 +3028,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
t.spec = objc_get_protocol_qualified_type (NULL_TREE, proto);
t.expr = NULL_TREE;
t.expr_const_operands = true;
+ t.has_enum_type_specifier = false;
declspecs_add_type (loc, specs, t);
continue;
}
@@ -3087,6 +3089,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
t.spec = c_parser_peek_token (parser)->value;
t.expr = NULL_TREE;
t.expr_const_operands = true;
+ t.has_enum_type_specifier = false;
declspecs_add_type (loc, specs, t);
c_parser_consume_token (parser);
break;
@@ -3151,6 +3154,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
t.spec = error_mark_node;
t.expr = NULL_TREE;
t.expr_const_operands = true;
+ t.has_enum_type_specifier = false;
if (type != NULL)
t.spec = groktypename (type, &t.expr,
&t.expr_const_operands);
@@ -3218,17 +3222,20 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
/* Parse an enum specifier (C90 6.5.2.2, C99 6.7.2.2, C11 6.7.2.2).
enum-specifier:
- enum gnu-attributes[opt] identifier[opt] { enumerator-list }
- gnu-attributes[opt]
- enum gnu-attributes[opt] identifier[opt] { enumerator-list , }
- gnu-attributes[opt]
+ enum gnu-attributes[opt] identifier[opt] enum-type-specifier[opt]
+ { enumerator-list } gnu-attributes[opt]
+ enum gnu-attributes[opt] identifier[opt] enum-type-specifier[opt]
+ { enumerator-list , } gnu-attributes[opt] enum-type-specifier[opt]
enum gnu-attributes[opt] identifier
- The form with trailing comma is new in C99. The forms with
- gnu-attributes are GNU extensions. In GNU C, we accept any expression
- without commas in the syntax (assignment expressions, not just
- conditional expressions); assignment expressions will be diagnosed
- as non-constant.
+ The form with trailing comma is new in C99; enum-type-specifiers
+ are new in C2x. The forms with gnu-attributes are GNU extensions.
+ In GNU C, we accept any expression without commas in the syntax
+ (assignment expressions, not just conditional expressions);
+ assignment expressions will be diagnosed as non-constant.
+
+ enum-type-specifier:
+ : specifier-qualifier-list
enumerator-list:
enumerator
@@ -3256,6 +3263,7 @@ c_parser_enum_specifier (c_parser *parser)
tree std_attrs = NULL_TREE;
tree attrs;
tree ident = NULL_TREE;
+ tree fixed_underlying_type = NULL_TREE;
location_t enum_loc;
location_t ident_loc = UNKNOWN_LOCATION; /* Quiet warning. */
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ENUM));
@@ -3274,6 +3282,83 @@ c_parser_enum_specifier (c_parser *parser)
enum_loc = ident_loc;
c_parser_consume_token (parser);
}
+ if (c_parser_next_token_is (parser, CPP_COLON)
+ /* Distinguish an enum-type-specifier from a bit-field
+ declaration of the form "enum e : constant-expression;". */
+ && c_token_starts_typename (c_parser_peek_2nd_token (parser)))
+ {
+ pedwarn_c11 (enum_loc, OPT_Wpedantic,
+ "ISO C does not support specifying %<enum%> underlying "
+ "types before C2X");
+ if (ident)
+ {
+ /* The tag is in scope during the enum-type-specifier (which
+ may refer to the tag inside typeof). */
+ ret = parser_xref_tag (ident_loc, ENUMERAL_TYPE, ident,
+ have_std_attrs, std_attrs, true);
+ if (!ENUM_FIXED_UNDERLYING_TYPE_P (ret.spec))
+ error_at (enum_loc, "%<enum%> declared both with and without "
+ "fixed underlying type");
+ }
+ else
+ {
+ /* There must be an enum definition, so this initialization
+ (to avoid possible warnings about uninitialized data)
+ will be replaced later (either with the results of that
+ definition, or with the results of error handling for the
+ case of no tag and no definition). */
+ ret.spec = NULL_TREE;
+ ret.kind = ctsk_tagdef;
+ ret.expr = NULL_TREE;
+ ret.expr_const_operands = true;
+ ret.has_enum_type_specifier = true;
+ }
+ c_parser_consume_token (parser);
+ struct c_declspecs *specs = build_null_declspecs ();
+ c_parser_declspecs (parser, specs, false, true, false, false, false,
+ false, true, cla_prefer_id);
+ finish_declspecs (specs);
+ if (specs->default_int_p)
+ error_at (enum_loc, "no %<enum%> underlying type specified");
+ else if (TREE_CODE (specs->type) != INTEGER_TYPE
+ && TREE_CODE (specs->type) != BOOLEAN_TYPE)
+ {
+ error_at (enum_loc, "invalid %<enum%> underlying type");
+ specs->type = integer_type_node;
+ }
+ else if (specs->restrict_p)
+ error_at (enum_loc, "invalid use of %<restrict%>");
+ fixed_underlying_type = TYPE_MAIN_VARIANT (specs->type);
+ if (ident)
+ {
+ /* The type specified must be consistent with any previously
+ specified underlying type. If this is a newly declared
+ type, it is now a complete type. */
+ if (ENUM_FIXED_UNDERLYING_TYPE_P (ret.spec)
+ && ENUM_UNDERLYING_TYPE (ret.spec) == NULL_TREE)
+ {
+ TYPE_MIN_VALUE (ret.spec) =
+ TYPE_MIN_VALUE (fixed_underlying_type);
+ TYPE_MAX_VALUE (ret.spec) =
+ TYPE_MAX_VALUE (fixed_underlying_type);
+ TYPE_UNSIGNED (ret.spec) = TYPE_UNSIGNED (fixed_underlying_type);
+ SET_TYPE_ALIGN (ret.spec, TYPE_ALIGN (fixed_underlying_type));
+ TYPE_SIZE (ret.spec) = NULL_TREE;
+ TYPE_PRECISION (ret.spec) =
+ TYPE_PRECISION (fixed_underlying_type);
+ ENUM_UNDERLYING_TYPE (ret.spec) = fixed_underlying_type;
+ layout_type (ret.spec);
+ }
+ else if (ENUM_FIXED_UNDERLYING_TYPE_P (ret.spec)
+ && !comptypes (fixed_underlying_type,
+ ENUM_UNDERLYING_TYPE (ret.spec)))
+ {
+ error_at (enum_loc, "%<enum%> underlying type incompatible with "
+ "previous declaration");
+ fixed_underlying_type = ENUM_UNDERLYING_TYPE (ret.spec);
+ }
+ }
+ }
if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
{
/* Parse an enum definition. */
@@ -3284,7 +3369,7 @@ c_parser_enum_specifier (c_parser *parser)
forward order at the end. */
tree values;
timevar_push (TV_PARSE_ENUM);
- type = start_enum (enum_loc, &the_enum, ident);
+ type = start_enum (enum_loc, &the_enum, ident, fixed_underlying_type);
values = NULL_TREE;
c_parser_consume_token (parser);
while (true)
@@ -3368,6 +3453,7 @@ c_parser_enum_specifier (c_parser *parser)
ret.kind = ctsk_tagdef;
ret.expr = NULL_TREE;
ret.expr_const_operands = true;
+ ret.has_enum_type_specifier = fixed_underlying_type != NULL_TREE;
timevar_pop (TV_PARSE_ENUM);
return ret;
}
@@ -3378,6 +3464,7 @@ c_parser_enum_specifier (c_parser *parser)
ret.kind = ctsk_tagref;
ret.expr = NULL_TREE;
ret.expr_const_operands = true;
+ ret.has_enum_type_specifier = false;
return ret;
}
/* Attributes may only appear when the members are defined or in
@@ -3386,15 +3473,18 @@ c_parser_enum_specifier (c_parser *parser)
standard C). */
if (have_std_attrs && c_parser_next_token_is_not (parser, CPP_SEMICOLON))
c_parser_error (parser, "expected %<;%>");
- ret = parser_xref_tag (ident_loc, ENUMERAL_TYPE, ident, have_std_attrs,
- std_attrs);
- /* In ISO C, enumerated types can be referred to only if already
- defined. */
- if (pedantic && !COMPLETE_TYPE_P (ret.spec))
+ if (fixed_underlying_type == NULL_TREE)
{
- gcc_assert (ident);
- pedwarn (enum_loc, OPT_Wpedantic,
- "ISO C forbids forward references to %<enum%> types");
+ ret = parser_xref_tag (ident_loc, ENUMERAL_TYPE, ident, have_std_attrs,
+ std_attrs, false);
+ /* In ISO C, enumerated types without a fixed underlying type
+ can be referred to only if already defined. */
+ if (pedantic && !COMPLETE_TYPE_P (ret.spec))
+ {
+ gcc_assert (ident);
+ pedwarn (enum_loc, OPT_Wpedantic,
+ "ISO C forbids forward references to %<enum%> types");
+ }
}
return ret;
}
@@ -3590,6 +3680,7 @@ c_parser_struct_or_union_specifier (c_parser *parser)
ret.kind = ctsk_tagdef;
ret.expr = NULL_TREE;
ret.expr_const_operands = true;
+ ret.has_enum_type_specifier = false;
timevar_pop (TV_PARSE_STRUCT);
return ret;
}
@@ -3600,6 +3691,7 @@ c_parser_struct_or_union_specifier (c_parser *parser)
ret.kind = ctsk_tagref;
ret.expr = NULL_TREE;
ret.expr_const_operands = true;
+ ret.has_enum_type_specifier = false;
return ret;
}
/* Attributes may only appear when the members are defined or in
@@ -3608,7 +3700,8 @@ c_parser_struct_or_union_specifier (c_parser *parser)
c_parser_error (parser, "expected %<;%>");
/* ??? Existing practice is that GNU attributes are ignored after
the struct or union keyword when not defining the members. */
- ret = parser_xref_tag (ident_loc, code, ident, have_std_attrs, std_attrs);
+ ret = parser_xref_tag (ident_loc, code, ident, have_std_attrs, std_attrs,
+ false);
return ret;
}
@@ -3817,6 +3910,7 @@ c_parser_typeof_specifier (c_parser *parser)
ret.spec = error_mark_node;
ret.expr = NULL_TREE;
ret.expr_const_operands = true;
+ ret.has_enum_type_specifier = false;
if (c_parser_next_token_is_keyword (parser, RID_TYPEOF))
{
is_unqual = false;
@@ -4119,7 +4213,8 @@ c_parser_direct_declarator (c_parser *parser, bool type_seen_p, c_dtr_syn kind,
if (kind != C_DTR_NORMAL
&& (c_parser_next_token_starts_declspecs (parser)
|| (!have_gnu_attrs
- && c_parser_nth_token_starts_std_attributes (parser, 1))
+ && (c_parser_nth_token_starts_std_attributes (parser, 1)
+ || c_parser_next_token_is (parser, CPP_ELLIPSIS)))
|| c_parser_next_token_is (parser, CPP_CLOSE_PAREN)))
{
struct c_arg_info *args
@@ -4395,25 +4490,18 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs, tree expr,
c_parser_consume_token (parser);
return ret;
}
- if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
+ if (c_parser_next_token_is (parser, CPP_ELLIPSIS) && !have_gnu_attrs)
{
struct c_arg_info *ret = build_arg_info ();
- if (flag_allow_parameterless_variadic_functions)
- {
- /* F (...) is allowed. */
- ret->types = NULL_TREE;
- }
- else
- {
- /* Suppress -Wold-style-definition for this case. */
- ret->types = error_mark_node;
- error_at (c_parser_peek_token (parser)->location,
- "ISO C requires a named argument before %<...%>");
- }
+ ret->types = NULL_TREE;
+ pedwarn_c11 (c_parser_peek_token (parser)->location, OPT_Wpedantic,
+ "ISO C requires a named argument before %<...%> "
+ "before C2X");
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
+ ret->no_named_args_stdarg_p = true;
c_parser_consume_token (parser);
return ret;
}
@@ -17366,7 +17454,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
if (nested && c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
break;
- if (!first)
+ if (!first || nested != 2)
{
if (c_parser_next_token_is (parser, CPP_COMMA))
c_parser_consume_token (parser);
@@ -18453,6 +18541,9 @@ c_parser_omp_allocate (location_t loc, c_parser *parser)
{
tree allocator = NULL_TREE;
tree nl = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ALLOCATE, NULL_TREE);
+ if (c_parser_next_token_is (parser, CPP_COMMA)
+ && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+ c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_NAME))
{
matching_parens parens;
@@ -18591,7 +18682,6 @@ c_parser_omp_atomic (location_t loc, c_parser *parser, bool openacc)
bool structured_block = false;
bool swapped = false;
bool non_lvalue_p;
- bool first = true;
tree clauses = NULL_TREE;
bool capture = false;
bool compare = false;
@@ -18602,13 +18692,10 @@ c_parser_omp_atomic (location_t loc, c_parser *parser, bool openacc)
while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
{
- if (!first
- && c_parser_next_token_is (parser, CPP_COMMA)
+ if (c_parser_next_token_is (parser, CPP_COMMA)
&& c_parser_peek_2nd_token (parser)->type == CPP_NAME)
c_parser_consume_token (parser);
- first = false;
-
if (c_parser_next_token_is (parser, CPP_NAME))
{
const char *p
@@ -19153,15 +19240,14 @@ restart:
&& TREE_CODE (TREE_OPERAND (lhs, 1)) == COMPOUND_EXPR
&& TREE_CODE (TREE_OPERAND (TREE_OPERAND (lhs, 1), 0)) == MODIFY_EXPR
&& TREE_OPERAND (TREE_OPERAND (lhs, 1), 1) == TREE_OPERAND (lhs, 0)
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND
- (TREE_OPERAND (lhs, 1), 0), 0)))
- == BOOLEAN_TYPE)
+ && C_BOOLEAN_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND
+ (TREE_OPERAND (lhs, 1), 0), 0))))
/* Undo effects of boolean_increment for post {in,de}crement. */
lhs = TREE_OPERAND (TREE_OPERAND (lhs, 1), 0);
/* FALLTHRU */
case MODIFY_EXPR:
if (TREE_CODE (lhs) == MODIFY_EXPR
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (lhs, 0))) == BOOLEAN_TYPE)
+ && C_BOOLEAN_TYPE_P (TREE_TYPE (TREE_OPERAND (lhs, 0))))
{
/* Undo effects of boolean_increment. */
if (integer_onep (TREE_OPERAND (lhs, 1)))
@@ -19553,6 +19639,8 @@ c_parser_omp_depobj (c_parser *parser)
parens.skip_until_found_close (parser);
tree clause = NULL_TREE;
enum omp_clause_depend_kind kind = OMP_CLAUSE_DEPEND_INVALID;
+ if (c_parser_next_token_is (parser, CPP_COMMA))
+ c_parser_consume_token (parser);
location_t c_loc = c_parser_peek_token (parser)->location;
if (c_parser_next_token_is (parser, CPP_NAME))
{
@@ -19629,6 +19717,9 @@ c_parser_omp_flush (c_parser *parser)
location_t loc = c_parser_peek_token (parser)->location;
c_parser_consume_pragma (parser);
enum memmodel mo = MEMMODEL_LAST;
+ if (c_parser_next_token_is (parser, CPP_COMMA)
+ && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+ c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_NAME))
{
const char *p
@@ -19721,6 +19812,9 @@ c_parser_omp_scan_loop_body (c_parser *parser, bool open_brace_parsed)
c_parser_consume_pragma (parser);
+ if (c_parser_next_token_is (parser, CPP_COMMA))
+ c_parser_consume_token (parser);
+
if (c_parser_next_token_is (parser, CPP_NAME))
{
const char *p
@@ -20504,9 +20598,14 @@ c_parser_omp_ordered (c_parser *parser, enum pragma_context context,
return false;
}
- if (c_parser_next_token_is (parser, CPP_NAME))
+ int n = 1;
+ if (c_parser_next_token_is (parser, CPP_COMMA))
+ n = 2;
+
+ if (c_parser_peek_nth_token (parser, n)->type == CPP_NAME)
{
- const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+ const char *p
+ = IDENTIFIER_POINTER (c_parser_peek_nth_token (parser, n)->value);
if (!strcmp ("depend", p) || !strcmp ("doacross", p))
{
@@ -22379,6 +22478,10 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms)
parens.require_close (parser);
+ if (c_parser_next_token_is (parser, CPP_COMMA)
+ && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+ c_parser_consume_token (parser);
+
const char *clause = "";
location_t match_loc = c_parser_peek_token (parser)->location;
if (c_parser_next_token_is (parser, CPP_NAME))
@@ -22548,7 +22651,9 @@ c_parser_omp_declare_target (c_parser *parser)
tree clauses = NULL_TREE;
int device_type = 0;
bool only_device_type = true;
- if (c_parser_next_token_is (parser, CPP_NAME))
+ if (c_parser_next_token_is (parser, CPP_NAME)
+ || (c_parser_next_token_is (parser, CPP_COMMA)
+ && c_parser_peek_2nd_token (parser)->type == CPP_NAME))
clauses = c_parser_omp_all_clauses (parser, OMP_DECLARE_TARGET_CLAUSE_MASK,
"#pragma omp declare target");
else if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
@@ -22969,10 +23074,14 @@ c_parser_omp_declare_reduction (c_parser *parser, enum pragma_context context)
initializer.set_error ();
if (!c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
bad = true;
- else if (c_parser_next_token_is (parser, CPP_NAME)
- && strcmp (IDENTIFIER_POINTER
+ else if (c_parser_next_token_is (parser, CPP_COMMA)
+ && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+ c_parser_consume_token (parser);
+ if (!bad
+ && (c_parser_next_token_is (parser, CPP_NAME)
+ && strcmp (IDENTIFIER_POINTER
(c_parser_peek_token (parser)->value),
- "initializer") == 0)
+ "initializer") == 0))
{
c_parser_consume_token (parser);
pop_scope ();
@@ -23165,7 +23274,6 @@ c_parser_omp_declare (c_parser *parser, enum pragma_context context)
static void
c_parser_omp_requires (c_parser *parser)
{
- bool first = true;
enum omp_requires new_req = (enum omp_requires) 0;
c_parser_consume_pragma (parser);
@@ -23173,13 +23281,10 @@ c_parser_omp_requires (c_parser *parser)
location_t loc = c_parser_peek_token (parser)->location;
while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
{
- if (!first
- && c_parser_next_token_is (parser, CPP_COMMA)
+ if (c_parser_next_token_is (parser, CPP_COMMA)
&& c_parser_peek_2nd_token (parser)->type == CPP_NAME)
c_parser_consume_token (parser);
- first = false;
-
if (c_parser_next_token_is (parser, CPP_NAME))
{
const char *p
@@ -23450,7 +23555,6 @@ c_parser_omp_error (c_parser *parser, enum pragma_context context)
int at_compilation = -1;
int severity_fatal = -1;
tree message = NULL_TREE;
- bool first = true;
bool bad = false;
location_t loc = c_parser_peek_token (parser)->location;
@@ -23458,13 +23562,10 @@ c_parser_omp_error (c_parser *parser, enum pragma_context context)
while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
{
- if (!first
- && c_parser_next_token_is (parser, CPP_COMMA)
+ if (c_parser_next_token_is (parser, CPP_COMMA)
&& c_parser_peek_2nd_token (parser)->type == CPP_NAME)
c_parser_consume_token (parser);
- first = false;
-
if (!c_parser_next_token_is (parser, CPP_NAME))
break;
@@ -23620,7 +23721,6 @@ c_parser_omp_error (c_parser *parser, enum pragma_context context)
static void
c_parser_omp_assumption_clauses (c_parser *parser, bool is_assume)
{
- bool first = true;
bool no_openmp = false;
bool no_openmp_routines = false;
bool no_parallelism = false;
@@ -23636,13 +23736,10 @@ c_parser_omp_assumption_clauses (c_parser *parser, bool is_assume)
while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
{
- if (!first
- && c_parser_next_token_is (parser, CPP_COMMA)
+ if (c_parser_next_token_is (parser, CPP_COMMA)
&& c_parser_peek_2nd_token (parser)->type == CPP_NAME)
c_parser_consume_token (parser);
- first = false;
-
if (!c_parser_next_token_is (parser, CPP_NAME))
break;
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index e7cdd2f..facfc12 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -122,6 +122,14 @@ along with GCC; see the file COPYING3. If not see
been folded. */
#define SAVE_EXPR_FOLDED_P(EXP) TREE_LANG_FLAG_1 (SAVE_EXPR_CHECK (EXP))
+/* Whether a type has boolean semantics: either a boolean type or an
+ enumeration type with a boolean type as its underlying type. */
+#define C_BOOLEAN_TYPE_P(TYPE) \
+ (TREE_CODE (TYPE) == BOOLEAN_TYPE \
+ || (TREE_CODE (TYPE) == ENUMERAL_TYPE \
+ && ENUM_UNDERLYING_TYPE (TYPE) != NULL_TREE \
+ && TREE_CODE (ENUM_UNDERLYING_TYPE (TYPE)) == BOOLEAN_TYPE))
+
/* Record parser information about an expression that is irrelevant
for code generation alongside a tree representing its value. */
struct c_expr
@@ -216,6 +224,10 @@ struct c_typespec {
/* Whether the expression has operands suitable for use in constant
expressions. */
bool expr_const_operands;
+ /* Whether the type specifier includes an enum type specifier (that
+ is, ": specifier-qualifier-list" in a declaration using
+ "enum"). */
+ bool has_enum_type_specifier;
/* The specifier itself. */
tree spec;
/* An expression to be evaluated before the type specifier, in the
@@ -412,6 +424,12 @@ struct c_declspecs {
/* Whether any alignment specifier (even with zero alignment) was
specified. */
BOOL_BITFIELD alignas_p : 1;
+ /* Whether an enum type specifier (": specifier-qualifier-list") was
+ specified other than in a definition of that enum (if so, this is
+ invalid unless it is an empty declaration "enum identifier
+ enum-type-specifier;", but such an empty declaration is valid in
+ C2x when "enum identifier;" would not be). */
+ BOOL_BITFIELD enum_type_specifier_ref_p : 1;
/* The address space that the declaration belongs to. */
addr_space_t address_space;
};
@@ -457,6 +475,8 @@ struct c_arg_info {
tree pending_sizes;
/* True when these arguments had [*]. */
BOOL_BITFIELD had_vla_unspec : 1;
+ /* True when the arguments are a (...) prototype. */
+ BOOL_BITFIELD no_named_args_stdarg_p : 1;
};
/* A declarator. */
@@ -525,6 +545,9 @@ struct c_enum_contents
constant value. */
tree enum_next_value;
+ /* The enumeration type itself. */
+ tree enum_type;
+
/* Nonzero means that there was overflow computing enum_next_value. */
int enum_overflow;
};
@@ -625,7 +648,7 @@ extern void c_warn_unused_attributes (tree);
extern tree c_warn_type_attributes (tree);
extern void shadow_tag (const struct c_declspecs *);
extern void shadow_tag_warned (const struct c_declspecs *, int);
-extern tree start_enum (location_t, struct c_enum_contents *, tree);
+extern tree start_enum (location_t, struct c_enum_contents *, tree, tree);
extern bool start_function (struct c_declspecs *, struct c_declarator *, tree);
extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
tree, location_t * = NULL);
@@ -637,7 +660,7 @@ extern void temp_store_parm_decls (tree, tree);
extern void temp_pop_parm_decls (void);
extern tree xref_tag (enum tree_code, tree);
extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree,
- bool, tree);
+ bool, tree, bool);
extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
struct c_declarator *, location_t);
extern struct c_declarator *build_attrs_declarator (tree,
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 92f3afc..052ae6d 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -420,9 +420,11 @@ composite_type (tree t1, tree t2)
(DR#013 question 3). For consistency, use the enumerated type as
the composite type. */
- if (code1 == ENUMERAL_TYPE && code2 == INTEGER_TYPE)
+ if (code1 == ENUMERAL_TYPE
+ && (code2 == INTEGER_TYPE || code2 == BOOLEAN_TYPE))
return t1;
- if (code2 == ENUMERAL_TYPE && code1 == INTEGER_TYPE)
+ if (code2 == ENUMERAL_TYPE
+ && (code1 == INTEGER_TYPE || code1 == BOOLEAN_TYPE))
return t2;
gcc_assert (code1 == code2);
@@ -542,17 +544,19 @@ composite_type (tree t1, tree t2)
/* Simple way if one arg fails to specify argument types. */
if (TYPE_ARG_TYPES (t1) == NULL_TREE)
- {
- t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2));
+ {
+ t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2),
+ TYPE_NO_NAMED_ARGS_STDARG_P (t2));
t1 = build_type_attribute_variant (t1, attributes);
return qualify_type (t1, t2);
}
if (TYPE_ARG_TYPES (t2) == NULL_TREE)
- {
- t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1));
- t1 = build_type_attribute_variant (t1, attributes);
- return qualify_type (t1, t2);
- }
+ {
+ t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1),
+ TYPE_NO_NAMED_ARGS_STDARG_P (t1));
+ t1 = build_type_attribute_variant (t1, attributes);
+ return qualify_type (t1, t2);
+ }
/* If both args specify argument types, we must merge the two
lists, argument by argument. */
@@ -1025,9 +1029,9 @@ tree
common_type (tree t1, tree t2)
{
if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = c_common_type_for_size (TYPE_PRECISION (t1), 1);
+ t1 = ENUM_UNDERLYING_TYPE (t1);
if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = c_common_type_for_size (TYPE_PRECISION (t2), 1);
+ t2 = ENUM_UNDERLYING_TYPE (t2);
/* If both types are BOOLEAN_TYPE, then return boolean_type_node. */
if (TREE_CODE (t1) == BOOLEAN_TYPE
@@ -1125,7 +1129,7 @@ comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p,
&& COMPLETE_TYPE_P (t1)
&& TREE_CODE (t2) != ENUMERAL_TYPE)
{
- t1 = c_common_type_for_size (TYPE_PRECISION (t1), TYPE_UNSIGNED (t1));
+ t1 = ENUM_UNDERLYING_TYPE (t1);
if (TREE_CODE (t2) != VOID_TYPE)
{
if (enum_and_int_p != NULL)
@@ -1138,7 +1142,7 @@ comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p,
&& COMPLETE_TYPE_P (t2)
&& TREE_CODE (t1) != ENUMERAL_TYPE)
{
- t2 = c_common_type_for_size (TYPE_PRECISION (t2), TYPE_UNSIGNED (t2));
+ t2 = ENUM_UNDERLYING_TYPE (t2);
if (TREE_CODE (t1) != VOID_TYPE)
{
if (enum_and_int_p != NULL)
@@ -1700,6 +1704,8 @@ function_types_compatible_p (const_tree f1, const_tree f2,
if (args1 == NULL_TREE)
{
+ if (TYPE_NO_NAMED_ARGS_STDARG_P (f1) != TYPE_NO_NAMED_ARGS_STDARG_P (f2))
+ return 0;
if (!self_promoting_args_p (args2))
return 0;
/* If one of these types comes from a non-prototype fn definition,
@@ -1713,6 +1719,8 @@ function_types_compatible_p (const_tree f1, const_tree f2,
}
if (args2 == NULL_TREE)
{
+ if (TYPE_NO_NAMED_ARGS_STDARG_P (f1) != TYPE_NO_NAMED_ARGS_STDARG_P (f2))
+ return 0;
if (!self_promoting_args_p (args1))
return 0;
if (TYPE_ACTUAL_ARG_TYPES (f2)
@@ -2193,15 +2201,19 @@ perform_integral_promotions (tree exp)
gcc_assert (INTEGRAL_TYPE_P (type));
- /* Normally convert enums to int,
- but convert wide enums to something wider. */
+ /* Convert enums to the result of applying the integer promotions to
+ their underlying type. */
if (code == ENUMERAL_TYPE)
{
- type = c_common_type_for_size (MAX (TYPE_PRECISION (type),
- TYPE_PRECISION (integer_type_node)),
- ((TYPE_PRECISION (type)
- >= TYPE_PRECISION (integer_type_node))
- && TYPE_UNSIGNED (type)));
+ type = ENUM_UNDERLYING_TYPE (type);
+ if (c_promoting_integer_type_p (type))
+ {
+ if (TYPE_UNSIGNED (type)
+ && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
+ type = unsigned_type_node;
+ else
+ type = integer_type_node;
+ }
return convert (type, exp);
}
@@ -3932,7 +3944,7 @@ parser_build_binary_op (location_t location, enum tree_code code,
}
while (1);
}
- if (TREE_CODE (TREE_TYPE (t)) != BOOLEAN_TYPE)
+ if (!C_BOOLEAN_TYPE_P (TREE_TYPE (t)))
warn_logical_not_parentheses (location, code, arg1.value, arg2.value);
}
@@ -4537,7 +4549,7 @@ build_unary_op (location_t location, enum tree_code code, tree xarg,
while (TREE_CODE (e) == COMPOUND_EXPR)
e = TREE_OPERAND (e, 1);
- if ((TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE
+ if ((C_BOOLEAN_TYPE_P (TREE_TYPE (arg))
|| truth_value_p (TREE_CODE (e))))
{
auto_diagnostic_group d;
@@ -4669,7 +4681,7 @@ build_unary_op (location_t location, enum tree_code code, tree xarg,
"decrement of enumeration value is invalid in C++");
}
- if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
+ if (C_BOOLEAN_TYPE_P (TREE_TYPE (arg)))
{
if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
warning_at (location, OPT_Wbool_operation,
@@ -4831,7 +4843,7 @@ build_unary_op (location_t location, enum tree_code code, tree xarg,
goto return_build_unary_op;
}
- if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
+ if (C_BOOLEAN_TYPE_P (TREE_TYPE (arg)))
val = boolean_increment (code, arg);
else
val = build2 (code, TREE_TYPE (arg), arg, inc);
@@ -7087,7 +7099,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
rhstype);
bool save = in_late_binary_op;
- if (codel == BOOLEAN_TYPE || codel == COMPLEX_TYPE
+ if (C_BOOLEAN_TYPE_P (type) || codel == COMPLEX_TYPE
|| (coder == REAL_TYPE
&& (codel == INTEGER_TYPE || codel == ENUMERAL_TYPE)
&& sanitize_flags_p (SANITIZE_FLOAT_CAST)))
@@ -7734,7 +7746,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
return convert (type, rhs);
}
- else if (codel == BOOLEAN_TYPE
+ else if (C_BOOLEAN_TYPE_P (type)
/* The type nullptr_t may be converted to bool. The
result is false. */
&& (coder == POINTER_TYPE || coder == NULLPTR_TYPE))
@@ -11002,7 +11014,7 @@ c_finish_return (location_t loc, tree retval, tree origtype)
return NULL_TREE;
save = in_late_binary_op;
- if (TREE_CODE (TREE_TYPE (res)) == BOOLEAN_TYPE
+ if (C_BOOLEAN_TYPE_P (TREE_TYPE (res))
|| TREE_CODE (TREE_TYPE (res)) == COMPLEX_TYPE
|| (TREE_CODE (TREE_TYPE (t)) == REAL_TYPE
&& (TREE_CODE (TREE_TYPE (res)) == INTEGER_TYPE
@@ -11164,7 +11176,7 @@ c_start_switch (location_t switch_loc,
while (TREE_CODE (e) == COMPOUND_EXPR)
e = TREE_OPERAND (e, 1);
- if ((TREE_CODE (type) == BOOLEAN_TYPE
+ if ((C_BOOLEAN_TYPE_P (type)
|| truth_value_p (TREE_CODE (e)))
/* Explicit cast to int suppresses this warning. */
&& !(TREE_CODE (type) == INTEGER_TYPE
@@ -12493,9 +12505,9 @@ build_binary_op (location_t location, enum tree_code code,
else if (code1 == NULLPTR_TYPE && null_pointer_constant_p (orig_op0))
result_type = (INTEGRAL_TYPE_P (type0)
? build_pointer_type (type0) : type0);
- if ((TREE_CODE (TREE_TYPE (orig_op0)) == BOOLEAN_TYPE
+ if ((C_BOOLEAN_TYPE_P (TREE_TYPE (orig_op0))
|| truth_value_p (TREE_CODE (orig_op0)))
- ^ (TREE_CODE (TREE_TYPE (orig_op1)) == BOOLEAN_TYPE
+ ^ (C_BOOLEAN_TYPE_P (TREE_TYPE (orig_op1))
|| truth_value_p (TREE_CODE (orig_op1))))
maybe_warn_bool_compare (location, code, orig_op0, orig_op1);
break;
@@ -12638,9 +12650,9 @@ build_binary_op (location_t location, enum tree_code code,
instrument_expr = build_call_expr_loc (location, tt, 2, op0, op1);
}
- if ((TREE_CODE (TREE_TYPE (orig_op0)) == BOOLEAN_TYPE
+ if ((C_BOOLEAN_TYPE_P (TREE_TYPE (orig_op0))
|| truth_value_p (TREE_CODE (orig_op0)))
- ^ (TREE_CODE (TREE_TYPE (orig_op1)) == BOOLEAN_TYPE
+ ^ (C_BOOLEAN_TYPE_P (TREE_TYPE (orig_op1))
|| truth_value_p (TREE_CODE (orig_op1))))
maybe_warn_bool_compare (location, code, orig_op0, orig_op1);
break;
diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index d45451c..62c3d1b 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -76,6 +76,8 @@ has_cpu_feature (struct __processor_model *cpu_model,
}
}
+/* Save FEATURE to either CPU_MODEL or CPU_FEATURES2. */
+
static inline void
set_cpu_feature (struct __processor_model *cpu_model,
unsigned int *cpu_features2,
@@ -100,6 +102,32 @@ set_cpu_feature (struct __processor_model *cpu_model,
}
}
+/* Drop FEATURE from either CPU_MODEL or CPU_FEATURES2. */
+
+static inline void
+reset_cpu_feature (struct __processor_model *cpu_model,
+ unsigned int *cpu_features2,
+ enum processor_features feature)
+{
+ unsigned index, offset;
+ unsigned f = feature;
+
+ if (f < 32)
+ {
+ /* The first 32 features. */
+ cpu_model->__cpu_features[0] &= ~(1U << f);
+ }
+ else
+ {
+ /* The rest of features. cpu_features2[i] contains features from
+ (32 + i * 32) to (31 + 32 + i * 32), inclusively. */
+ f -= 32;
+ index = f / 32;
+ offset = f % 32;
+ cpu_features2[index] &= ~(1U << offset);
+ }
+}
+
/* Get the specific type of AMD CPU and return AMD CPU name. Return
NULL for unknown AMD CPU. */
@@ -565,11 +593,11 @@ get_zhaoxin_cpu (struct __processor_model *cpu_model,
cpu_model->__cpu_type = ZHAOXIN_FAM7H;
if (model == 0x3b)
{
- cpu = "lujiazui";
- CHECK___builtin_cpu_is ("lujiazui");
- cpu_model->__cpu_features[0] &= ~(1U <<(FEATURE_AVX & 31));
- cpu_features2[0] &= ~(1U <<((FEATURE_F16C - 32) & 31));
- cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_LUJIAZUI;
+ cpu = "lujiazui";
+ CHECK___builtin_cpu_is ("lujiazui");
+ reset_cpu_feature (cpu_model, cpu_features2, FEATURE_AVX);
+ reset_cpu_feature (cpu_model, cpu_features2, FEATURE_F16C);
+ cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_LUJIAZUI;
}
break;
default:
@@ -811,6 +839,8 @@ get_available_features (struct __processor_model *cpu_model,
set_feature (FEATURE_AVXIFMA);
if (edx & bit_AVXVNNIINT8)
set_feature (FEATURE_AVXVNNIINT8);
+ if (edx & bit_AVXNECONVERT)
+ set_feature (FEATURE_AVXNECONVERT);
}
if (avx512_usable)
{
diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc
index f66bdd5..cd6ad2c 100644
--- a/gcc/common/config/i386/i386-common.cc
+++ b/gcc/common/config/i386/i386-common.cc
@@ -109,6 +109,7 @@ along with GCC; see the file COPYING3. If not see
#define OPTION_MASK_ISA2_AMX_INT8_SET OPTION_MASK_ISA2_AMX_INT8
#define OPTION_MASK_ISA2_AMX_BF16_SET OPTION_MASK_ISA2_AMX_BF16
#define OPTION_MASK_ISA2_AVXVNNIINT8_SET OPTION_MASK_ISA2_AVXVNNIINT8
+#define OPTION_MASK_ISA2_AVXNECONVERT_SET OPTION_MASK_ISA2_AVXNECONVERT
/* SSE4 includes both SSE4.1 and SSE4.2. -msse4 should be the same
as -msse4.2. */
@@ -215,7 +216,8 @@ along with GCC; see the file COPYING3. If not see
(OPTION_MASK_ISA_AVX2 | OPTION_MASK_ISA_AVX512F_UNSET)
#define OPTION_MASK_ISA2_AVX2_UNSET \
(OPTION_MASK_ISA2_AVXIFMA_UNSET | OPTION_MASK_ISA2_AVXVNNI_UNSET \
- | OPTION_MASK_ISA2_AVXVNNIINT8_UNSET | OPTION_MASK_ISA2_AVX512F_UNSET)
+ | OPTION_MASK_ISA2_AVXVNNIINT8_UNSET | OPTION_MASK_ISA2_AVXNECONVERT_UNSET \
+ | OPTION_MASK_ISA2_AVX512F_UNSET)
#define OPTION_MASK_ISA_AVX512F_UNSET \
(OPTION_MASK_ISA_AVX512F | OPTION_MASK_ISA_AVX512CD_UNSET \
| OPTION_MASK_ISA_AVX512PF_UNSET | OPTION_MASK_ISA_AVX512ER_UNSET \
@@ -280,6 +282,7 @@ along with GCC; see the file COPYING3. If not see
(OPTION_MASK_ISA2_KL | OPTION_MASK_ISA2_WIDEKL_UNSET)
#define OPTION_MASK_ISA2_WIDEKL_UNSET OPTION_MASK_ISA2_WIDEKL
#define OPTION_MASK_ISA2_AVXVNNIINT8_UNSET OPTION_MASK_ISA2_AVXVNNIINT8
+#define OPTION_MASK_ISA2_AVXNECONVERT_UNSET OPTION_MASK_ISA2_AVXNECONVERT
/* SSE4 includes both SSE4.1 and SSE4.2. -mno-sse4 should the same
as -mno-sse4.1. */
@@ -1162,6 +1165,22 @@ ix86_handle_option (struct gcc_options *opts,
}
return true;
+ case OPT_mavxneconvert:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AVXNECONVERT_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVXNECONVERT_SET;
+ opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX2_SET;
+ opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_AVX2_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVXNECONVERT_UNSET;
+ opts->x_ix86_isa_flags2_explicit
+ |= OPTION_MASK_ISA2_AVXNECONVERT_UNSET;
+ }
+ return true;
+
case OPT_mfma:
if (value)
{
diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h
index 761af27..4fbbfa5 100644
--- a/gcc/common/config/i386/i386-cpuinfo.h
+++ b/gcc/common/config/i386/i386-cpuinfo.h
@@ -245,6 +245,7 @@ enum processor_features
FEATURE_X86_64_V4,
FEATURE_AVXIFMA,
FEATURE_AVXVNNIINT8,
+ FEATURE_AVXNECONVERT,
CPU_FEATURE_MAX
};
diff --git a/gcc/common/config/i386/i386-isas.h b/gcc/common/config/i386/i386-isas.h
index 8c1f351..bceaee5 100644
--- a/gcc/common/config/i386/i386-isas.h
+++ b/gcc/common/config/i386/i386-isas.h
@@ -178,4 +178,6 @@ ISA_NAMES_TABLE_START
ISA_NAMES_TABLE_ENTRY("avxifma", FEATURE_AVXIFMA, P_NONE, "-mavxifma")
ISA_NAMES_TABLE_ENTRY("avxvnniint8", FEATURE_AVXVNNIINT8,
P_NONE, "-mavxvnniint8")
+ ISA_NAMES_TABLE_ENTRY("avxneconvert", FEATURE_AVXNECONVERT,
+ P_NONE, "-mavxneconvert")
ISA_NAMES_TABLE_END
diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index dead3802..d6404a0 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -51,6 +51,11 @@ static const riscv_implied_info_t riscv_implied_info[] =
{"d", "f"},
{"f", "zicsr"},
{"d", "zicsr"},
+
+ {"zdinx", "zfinx"},
+ {"zfinx", "zicsr"},
+ {"zdinx", "zicsr"},
+
{"zk", "zkn"},
{"zk", "zkr"},
{"zk", "zkt"},
@@ -99,6 +104,9 @@ static const riscv_implied_info_t riscv_implied_info[] =
{"zfh", "zfhmin"},
{"zfhmin", "f"},
+
+ {"zhinx", "zhinxmin"},
+ {"zhinxmin", "zfinx"},
{NULL, NULL}
};
@@ -145,6 +153,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
{"c", ISA_SPEC_CLASS_20190608, 2, 0},
{"c", ISA_SPEC_CLASS_2P2, 2, 0},
+ {"h", ISA_SPEC_CLASS_NONE, 1, 0},
+
{"v", ISA_SPEC_CLASS_NONE, 1, 0},
{"zicsr", ISA_SPEC_CLASS_20191213, 2, 0},
@@ -158,6 +168,11 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
{"zbc", ISA_SPEC_CLASS_NONE, 1, 0},
{"zbs", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"zfinx", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"zdinx", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"zhinx", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"zhinxmin", ISA_SPEC_CLASS_NONE, 1, 0},
+
{"zbkb", ISA_SPEC_CLASS_NONE, 1, 0},
{"zbkc", ISA_SPEC_CLASS_NONE, 1, 0},
{"zbkx", ISA_SPEC_CLASS_NONE, 1, 0},
@@ -202,6 +217,9 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
{"zmmul", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"svinval", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"svnapot", ISA_SPEC_CLASS_NONE, 1, 0},
+
/* Terminate the list. */
{NULL, ISA_SPEC_CLASS_NONE, 0, 0}
};
@@ -361,21 +379,18 @@ multi_letter_subset_rank (const std::string &subset)
gcc_assert (subset.length () >= 2);
int high_order = -1;
int low_order = 0;
- /* The order between multi-char extensions: s -> h -> z -> x. */
+ /* The order between multi-char extensions: s -> z -> x. */
char multiletter_class = subset[0];
switch (multiletter_class)
{
case 's':
high_order = 0;
break;
- case 'h':
- high_order = 1;
- break;
case 'z':
- high_order = 2;
+ high_order = 1;
break;
case 'x':
- high_order = 3;
+ high_order = 2;
break;
default:
gcc_unreachable ();
@@ -671,7 +686,7 @@ riscv_subset_list::lookup (const char *subset, int major_version,
static const char *
riscv_supported_std_ext (void)
{
- return "mafdqlcbkjtpvn";
+ return "mafdqlcbkjtpvnh";
}
/* Parsing subset version.
@@ -830,7 +845,7 @@ riscv_subset_list::parse_std_ext (const char *p)
{
char subset[2] = {0, 0};
- if (*p == 'x' || *p == 's' || *p == 'h' || *p == 'z')
+ if (*p == 'x' || *p == 's' || *p == 'z')
break;
if (*p == '_')
@@ -955,7 +970,7 @@ riscv_subset_list::handle_combine_ext ()
Arguments:
`p`: Current parsing position.
- `ext_type`: What kind of extensions, 's', 'h', 'z' or 'x'.
+ `ext_type`: What kind of extensions, 's', 'z' or 'x'.
`ext_type_str`: Full name for kind of extension. */
const char *
@@ -1097,12 +1112,6 @@ riscv_subset_list::parse (const char *arch, location_t loc)
if (p == NULL)
goto fail;
- /* Parsing hypervisor extension. */
- p = subset_list->parse_multiletter_ext (p, "h", "hypervisor extension");
-
- if (p == NULL)
- goto fail;
-
/* Parsing sub-extensions. */
p = subset_list->parse_multiletter_ext (p, "z", "sub-extension");
@@ -1176,6 +1185,11 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
{"zbc", &gcc_options::x_riscv_zb_subext, MASK_ZBC},
{"zbs", &gcc_options::x_riscv_zb_subext, MASK_ZBS},
+ {"zfinx", &gcc_options::x_riscv_zinx_subext, MASK_ZFINX},
+ {"zdinx", &gcc_options::x_riscv_zinx_subext, MASK_ZDINX},
+ {"zhinx", &gcc_options::x_riscv_zinx_subext, MASK_ZHINX},
+ {"zhinxmin", &gcc_options::x_riscv_zinx_subext, MASK_ZHINXMIN},
+
{"zbkb", &gcc_options::x_riscv_zk_subext, MASK_ZBKB},
{"zbkc", &gcc_options::x_riscv_zk_subext, MASK_ZBKC},
{"zbkx", &gcc_options::x_riscv_zk_subext, MASK_ZBKX},
@@ -1226,6 +1240,9 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
{"zmmul", &gcc_options::x_riscv_zm_subext, MASK_ZMMUL},
+ {"svinval", &gcc_options::x_riscv_sv_subext, MASK_SVINVAL},
+ {"svnapot", &gcc_options::x_riscv_sv_subext, MASK_SVNAPOT},
+
{NULL, NULL, 0}
};
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 52f9e98..c2f8aab 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -422,7 +422,7 @@ i[34567]86-*-* | x86_64-*-*)
amxbf16intrin.h x86gprintrin.h uintrintrin.h
hresetintrin.h keylockerintrin.h avxvnniintrin.h
mwaitintrin.h avx512fp16intrin.h avx512fp16vlintrin.h
- avxifmaintrin.h avxvnniint8intrin.h"
+ avxifmaintrin.h avxvnniint8intrin.h avxneconvertintrin.h"
;;
ia64-*-*)
extra_headers=ia64intrin.h
@@ -516,7 +516,7 @@ pru-*-*)
;;
riscv*)
cpu_type=riscv
- extra_objs="riscv-builtins.o riscv-c.o riscv-sr.o riscv-shorten-memrefs.o riscv-selftests.o"
+ extra_objs="riscv-builtins.o riscv-c.o riscv-sr.o riscv-shorten-memrefs.o riscv-selftests.o riscv-v.o"
extra_objs="${extra_objs} riscv-vector-builtins.o riscv-vector-builtins-shapes.o riscv-vector-builtins-bases.o"
d_target_objs="riscv-d.o"
extra_headers="riscv_vector.h"
@@ -882,10 +882,8 @@ case ${target} in
esac
c_target_objs="${c_target_objs} glibc-c.o"
cxx_target_objs="${cxx_target_objs} glibc-c.o"
- d_target_objs="${d_target_objs} glibc-d.o"
tmake_file="${tmake_file} t-glibc"
target_has_targetcm=yes
- target_has_targetdm=yes
case $target in
*-*-*uclibc* | *-*-uclinuxfdpiceabi)
;;
@@ -894,6 +892,24 @@ case ${target} in
gcc_cv_initfini_array=yes
;;
esac
+ case $target in
+ *-*-*linux*)
+ d_target_objs="${d_target_objs} linux-d.o"
+ target_has_targetdm=yes
+ ;;
+ *-*-kfreebsd*-gnu)
+ d_target_objs="${d_target_objs} kfreebsd-d.o"
+ target_has_targetdm=yes
+ ;;
+ *-*-kopensolaris*-gnu)
+ d_target_objs="${d_target_objs} kopensolaris-d.o"
+ target_has_targetdm=yes
+ ;;
+ *-*-gnu*)
+ d_target_objs="${d_target_objs} gnu-d.o"
+ target_has_targetdm=yes
+ ;;
+ esac
;;
*-*-netbsd*)
tm_p_file="${tm_p_file} netbsd-protos.h"
@@ -2054,7 +2070,7 @@ i[34567]86-*-cygwin*)
extra_objs="${extra_objs} winnt.o winnt-stubs.o"
c_target_objs="${c_target_objs} msformat-c.o"
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
- d_target_objs="${d_target_objs} winnt-d.o"
+ d_target_objs="${d_target_objs} cygwin-d.o"
target_has_targetdm="yes"
if test x$enable_threads = xyes; then
thread_file='posix'
@@ -2072,7 +2088,7 @@ x86_64-*-cygwin*)
extra_objs="${extra_objs} winnt.o winnt-stubs.o"
c_target_objs="${c_target_objs} msformat-c.o"
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
- d_target_objs="${d_target_objs} winnt-d.o"
+ d_target_objs="${d_target_objs} cygwin-d.o"
target_has_targetdm="yes"
if test x$enable_threads = xyes; then
thread_file='posix'
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 1a71f02..2388205 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -254,7 +254,7 @@ typedef struct simd_vec_cost advsimd_vec_cost;
/* SVE-specific extensions to the information provided by simd_vec_cost. */
struct sve_vec_cost : simd_vec_cost
{
- constexpr sve_vec_cost (const simd_vec_cost &base,
+ CONSTEXPR sve_vec_cost (const simd_vec_cost &base,
unsigned int clast_cost,
unsigned int fadda_f16_cost,
unsigned int fadda_f32_cost,
@@ -354,7 +354,7 @@ using aarch64_scalar_vec_issue_info = aarch64_base_vec_issue_info;
Advanced SIMD and SVE. */
struct aarch64_simd_vec_issue_info : aarch64_base_vec_issue_info
{
- constexpr aarch64_simd_vec_issue_info (aarch64_base_vec_issue_info base,
+ CONSTEXPR aarch64_simd_vec_issue_info (aarch64_base_vec_issue_info base,
unsigned int ld2_st2_general_ops,
unsigned int ld3_st3_general_ops,
unsigned int ld4_st4_general_ops)
@@ -382,7 +382,7 @@ using aarch64_advsimd_vec_issue_info = aarch64_simd_vec_issue_info;
is a concept of "predicate operations". */
struct aarch64_sve_vec_issue_info : aarch64_simd_vec_issue_info
{
- constexpr aarch64_sve_vec_issue_info
+ CONSTEXPR aarch64_sve_vec_issue_info
(aarch64_simd_vec_issue_info base,
unsigned int pred_ops_per_cycle,
unsigned int while_pred_ops,
diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
index 23b4d42..6347407 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
@@ -177,7 +177,7 @@ public:
class svac_impl : public function_base
{
public:
- constexpr svac_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svac_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -209,7 +209,7 @@ public:
class svadr_bhwd_impl : public function_base
{
public:
- constexpr svadr_bhwd_impl (unsigned int shift) : m_shift (shift) {}
+ CONSTEXPR svadr_bhwd_impl (unsigned int shift) : m_shift (shift) {}
rtx
expand (function_expander &e) const override
@@ -259,7 +259,7 @@ public:
class svbrk_binary_impl : public function_base
{
public:
- constexpr svbrk_binary_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svbrk_binary_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -275,7 +275,7 @@ public:
class svbrk_unary_impl : public function_base
{
public:
- constexpr svbrk_unary_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svbrk_unary_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -309,7 +309,7 @@ public:
class svclast_impl : public quiet<function_base>
{
public:
- constexpr svclast_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svclast_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -381,7 +381,7 @@ public:
class svcmp_impl : public function_base
{
public:
- constexpr svcmp_impl (tree_code code, int unspec_for_fp)
+ CONSTEXPR svcmp_impl (tree_code code, int unspec_for_fp)
: m_code (code), m_unspec_for_fp (unspec_for_fp) {}
gimple *
@@ -437,7 +437,7 @@ public:
class svcmp_wide_impl : public function_base
{
public:
- constexpr svcmp_wide_impl (tree_code code, int unspec_for_sint,
+ CONSTEXPR svcmp_wide_impl (tree_code code, int unspec_for_sint,
int unspec_for_uint)
: m_code (code), m_unspec_for_sint (unspec_for_sint),
m_unspec_for_uint (unspec_for_uint) {}
@@ -512,7 +512,7 @@ public:
class svcnt_bhwd_impl : public function_base
{
public:
- constexpr svcnt_bhwd_impl (machine_mode ref_mode) : m_ref_mode (ref_mode) {}
+ CONSTEXPR svcnt_bhwd_impl (machine_mode ref_mode) : m_ref_mode (ref_mode) {}
gimple *
fold (gimple_folder &f) const override
@@ -949,7 +949,7 @@ public:
class svext_bhw_impl : public function_base
{
public:
- constexpr svext_bhw_impl (scalar_int_mode from_mode)
+ CONSTEXPR svext_bhw_impl (scalar_int_mode from_mode)
: m_from_mode (from_mode) {}
rtx
@@ -1053,7 +1053,7 @@ public:
class svlast_impl : public quiet<function_base>
{
public:
- constexpr svlast_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svlast_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -1399,7 +1399,7 @@ public:
class svldxf1_impl : public full_width_access
{
public:
- constexpr svldxf1_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svldxf1_impl (int unspec) : m_unspec (unspec) {}
unsigned int
call_properties (const function_instance &) const override
@@ -1426,7 +1426,7 @@ public:
class svldxf1_extend_impl : public extending_load
{
public:
- constexpr svldxf1_extend_impl (type_suffix_index memory_type, int unspec)
+ CONSTEXPR svldxf1_extend_impl (type_suffix_index memory_type, int unspec)
: extending_load (memory_type), m_unspec (unspec) {}
unsigned int
@@ -1616,7 +1616,7 @@ public:
class svnot_impl : public rtx_code_function
{
public:
- constexpr svnot_impl () : rtx_code_function (NOT, NOT, -1) {}
+ CONSTEXPR svnot_impl () : rtx_code_function (NOT, NOT, -1) {}
rtx
expand (function_expander &e) const override
@@ -1664,7 +1664,7 @@ public:
class svpfirst_svpnext_impl : public function_base
{
public:
- constexpr svpfirst_svpnext_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svpfirst_svpnext_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -1682,7 +1682,7 @@ public:
class svprf_bhwd_impl : public function_base
{
public:
- constexpr svprf_bhwd_impl (machine_mode mode) : m_mode (mode) {}
+ CONSTEXPR svprf_bhwd_impl (machine_mode mode) : m_mode (mode) {}
unsigned int
call_properties (const function_instance &) const override
@@ -1706,7 +1706,7 @@ public:
class svprf_bhwd_gather_impl : public function_base
{
public:
- constexpr svprf_bhwd_gather_impl (machine_mode mode) : m_mode (mode) {}
+ CONSTEXPR svprf_bhwd_gather_impl (machine_mode mode) : m_mode (mode) {}
unsigned int
call_properties (const function_instance &) const override
@@ -1744,7 +1744,7 @@ public:
class svptest_impl : public function_base
{
public:
- constexpr svptest_impl (rtx_code compare) : m_compare (compare) {}
+ CONSTEXPR svptest_impl (rtx_code compare) : m_compare (compare) {}
rtx
expand (function_expander &e) const override
@@ -1849,7 +1849,7 @@ public:
class svqdec_svqinc_bhwd_impl : public function_base
{
public:
- constexpr svqdec_svqinc_bhwd_impl (rtx_code code_for_sint,
+ CONSTEXPR svqdec_svqinc_bhwd_impl (rtx_code code_for_sint,
rtx_code code_for_uint,
scalar_int_mode elem_mode)
: m_code_for_sint (code_for_sint),
@@ -1896,7 +1896,7 @@ public:
class svqdec_bhwd_impl : public svqdec_svqinc_bhwd_impl
{
public:
- constexpr svqdec_bhwd_impl (scalar_int_mode elem_mode)
+ CONSTEXPR svqdec_bhwd_impl (scalar_int_mode elem_mode)
: svqdec_svqinc_bhwd_impl (SS_MINUS, US_MINUS, elem_mode) {}
};
@@ -1904,7 +1904,7 @@ public:
class svqinc_bhwd_impl : public svqdec_svqinc_bhwd_impl
{
public:
- constexpr svqinc_bhwd_impl (scalar_int_mode elem_mode)
+ CONSTEXPR svqinc_bhwd_impl (scalar_int_mode elem_mode)
: svqdec_svqinc_bhwd_impl (SS_PLUS, US_PLUS, elem_mode) {}
};
@@ -1912,7 +1912,7 @@ public:
class svqdecp_svqincp_impl : public function_base
{
public:
- constexpr svqdecp_svqincp_impl (rtx_code code_for_sint,
+ CONSTEXPR svqdecp_svqincp_impl (rtx_code code_for_sint,
rtx_code code_for_uint)
: m_code_for_sint (code_for_sint),
m_code_for_uint (code_for_uint)
@@ -2275,7 +2275,7 @@ public:
class svsub_impl : public rtx_code_function
{
public:
- constexpr svsub_impl ()
+ CONSTEXPR svsub_impl ()
: rtx_code_function (MINUS, MINUS, UNSPEC_COND_FSUB) {}
rtx
@@ -2304,7 +2304,7 @@ public:
class svtrn_impl : public binary_permute
{
public:
- constexpr svtrn_impl (int base)
+ CONSTEXPR svtrn_impl (int base)
: binary_permute (base ? UNSPEC_TRN2 : UNSPEC_TRN1), m_base (base) {}
gimple *
@@ -2345,7 +2345,7 @@ public:
class svunpk_impl : public quiet<function_base>
{
public:
- constexpr svunpk_impl (bool high_p) : m_high_p (high_p) {}
+ CONSTEXPR svunpk_impl (bool high_p) : m_high_p (high_p) {}
gimple *
fold (gimple_folder &f) const override
@@ -2387,7 +2387,7 @@ public:
class svusdot_impl : public function_base
{
public:
- constexpr svusdot_impl (bool su) : m_su (su) {}
+ CONSTEXPR svusdot_impl (bool su) : m_su (su) {}
rtx
expand (function_expander &e) const override
@@ -2415,7 +2415,7 @@ private:
class svuzp_impl : public binary_permute
{
public:
- constexpr svuzp_impl (unsigned int base)
+ CONSTEXPR svuzp_impl (unsigned int base)
: binary_permute (base ? UNSPEC_UZP2 : UNSPEC_UZP1), m_base (base) {}
gimple *
@@ -2438,7 +2438,7 @@ public:
class svwhilelx_impl : public while_comparison
{
public:
- constexpr svwhilelx_impl (int unspec_for_sint, int unspec_for_uint, bool eq_p)
+ CONSTEXPR svwhilelx_impl (int unspec_for_sint, int unspec_for_uint, bool eq_p)
: while_comparison (unspec_for_sint, unspec_for_uint), m_eq_p (eq_p)
{}
@@ -2525,7 +2525,7 @@ public:
class svzip_impl : public binary_permute
{
public:
- constexpr svzip_impl (unsigned int base)
+ CONSTEXPR svzip_impl (unsigned int base)
: binary_permute (base ? UNSPEC_ZIP2 : UNSPEC_ZIP1), m_base (base) {}
gimple *
diff --git a/gcc/config/aarch64/aarch64-sve-builtins-functions.h b/gcc/config/aarch64/aarch64-sve-builtins-functions.h
index ec943c5..472e26c 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins-functions.h
+++ b/gcc/config/aarch64/aarch64-sve-builtins-functions.h
@@ -44,7 +44,7 @@ public:
class multi_vector_function : public function_base
{
public:
- constexpr multi_vector_function (unsigned int vectors_per_tuple)
+ CONSTEXPR multi_vector_function (unsigned int vectors_per_tuple)
: m_vectors_per_tuple (vectors_per_tuple) {}
unsigned int
@@ -63,7 +63,7 @@ public:
class full_width_access : public multi_vector_function
{
public:
- constexpr full_width_access (unsigned int vectors_per_tuple = 1)
+ CONSTEXPR full_width_access (unsigned int vectors_per_tuple = 1)
: multi_vector_function (vectors_per_tuple) {}
tree
@@ -88,7 +88,7 @@ public:
class extending_load : public function_base
{
public:
- constexpr extending_load (type_suffix_index memory_type)
+ CONSTEXPR extending_load (type_suffix_index memory_type)
: m_memory_type (memory_type) {}
unsigned int
@@ -131,7 +131,7 @@ public:
class truncating_store : public function_base
{
public:
- constexpr truncating_store (scalar_int_mode to_mode) : m_to_mode (to_mode) {}
+ CONSTEXPR truncating_store (scalar_int_mode to_mode) : m_to_mode (to_mode) {}
unsigned int
call_properties (const function_instance &) const override
@@ -168,7 +168,7 @@ public:
class rtx_code_function_base : public function_base
{
public:
- constexpr rtx_code_function_base (rtx_code code_for_sint,
+ CONSTEXPR rtx_code_function_base (rtx_code code_for_sint,
rtx_code code_for_uint,
int unspec_for_fp = -1)
: m_code_for_sint (code_for_sint), m_code_for_uint (code_for_uint),
@@ -227,7 +227,7 @@ public:
class unspec_based_function_base : public function_base
{
public:
- constexpr unspec_based_function_base (int unspec_for_sint,
+ CONSTEXPR unspec_based_function_base (int unspec_for_sint,
int unspec_for_uint,
int unspec_for_fp)
: m_unspec_for_sint (unspec_for_sint),
@@ -434,7 +434,7 @@ public:
class fixed_insn_function : public function_base
{
public:
- constexpr fixed_insn_function (insn_code code) : m_code (code) {}
+ CONSTEXPR fixed_insn_function (insn_code code) : m_code (code) {}
rtx
expand (function_expander &e) const override
@@ -476,7 +476,7 @@ public:
class binary_permute : public permute
{
public:
- constexpr binary_permute (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR binary_permute (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -493,13 +493,13 @@ public:
class reduction : public function_base
{
public:
- constexpr reduction (int unspec)
+ CONSTEXPR reduction (int unspec)
: m_unspec_for_sint (unspec),
m_unspec_for_uint (unspec),
m_unspec_for_fp (unspec)
{}
- constexpr reduction (int unspec_for_sint, int unspec_for_uint,
+ CONSTEXPR reduction (int unspec_for_sint, int unspec_for_uint,
int unspec_for_fp)
: m_unspec_for_sint (unspec_for_sint),
m_unspec_for_uint (unspec_for_uint),
@@ -532,7 +532,7 @@ public:
class shift_wide : public function_base
{
public:
- constexpr shift_wide (rtx_code code, int wide_unspec)
+ CONSTEXPR shift_wide (rtx_code code, int wide_unspec)
: m_code (code), m_wide_unspec (wide_unspec) {}
rtx
@@ -567,7 +567,7 @@ public:
class unary_count : public quiet<function_base>
{
public:
- constexpr unary_count (rtx_code code) : m_code (code) {}
+ CONSTEXPR unary_count (rtx_code code) : m_code (code) {}
rtx
expand (function_expander &e) const override
@@ -590,7 +590,7 @@ public:
class while_comparison : public function_base
{
public:
- constexpr while_comparison (int unspec_for_sint, int unspec_for_uint)
+ CONSTEXPR while_comparison (int unspec_for_sint, int unspec_for_uint)
: m_unspec_for_sint (unspec_for_sint),
m_unspec_for_uint (unspec_for_uint)
{}
@@ -619,7 +619,7 @@ public:
/* Declare the global function base NAME, creating it from an instance
of class CLASS with constructor arguments ARGS. */
#define FUNCTION(NAME, CLASS, ARGS) \
- namespace { static constexpr const CLASS NAME##_obj ARGS; } \
+ namespace { static CONSTEXPR const CLASS NAME##_obj ARGS; } \
namespace functions { const function_base *const NAME = &NAME##_obj; }
#endif
diff --git a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc
index bf1d05e..8e26bd8 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc
@@ -447,7 +447,7 @@ long_type_suffix (function_resolver &r, type_suffix_index type)
/* Declare the function shape NAME, pointing it to an instance
of class <NAME>_def. */
#define SHAPE(NAME) \
- static constexpr const NAME##_def NAME##_obj; \
+ static CONSTEXPR const NAME##_def NAME##_obj; \
namespace shapes { const function_shape *const NAME = &NAME##_obj; }
/* Base class for functions that are not overloaded. */
@@ -587,7 +587,7 @@ struct binary_imm_long_base : public overloaded_base<0>
/* Base class for inc_dec and inc_dec_pat. */
struct inc_dec_base : public overloaded_base<0>
{
- constexpr inc_dec_base (bool pat_p) : m_pat_p (pat_p) {}
+ CONSTEXPR inc_dec_base (bool pat_p) : m_pat_p (pat_p) {}
/* Resolve based on the first argument only, which must be either a
scalar or a vector. If it's a scalar, it must be a 32-bit or
@@ -1924,7 +1924,7 @@ SHAPE (get)
whose size is tied to the [bhwd] suffix of "svfoo". */
struct inc_dec_def : public inc_dec_base
{
- constexpr inc_dec_def () : inc_dec_base (false) {}
+ CONSTEXPR inc_dec_def () : inc_dec_base (false) {}
void
build (function_builder &b, const function_group_info &group) const override
@@ -1949,7 +1949,7 @@ SHAPE (inc_dec)
whose size is tied to the [bhwd] suffix of "svfoo". */
struct inc_dec_pat_def : public inc_dec_base
{
- constexpr inc_dec_pat_def () : inc_dec_base (true) {}
+ CONSTEXPR inc_dec_pat_def () : inc_dec_base (true) {}
void
build (function_builder &b, const function_group_info &group) const override
diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc
index ca8f20d..a7d7435 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc
@@ -158,7 +158,7 @@ public:
class svmatch_svnmatch_impl : public function_base
{
public:
- constexpr svmatch_svnmatch_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svmatch_svnmatch_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
@@ -233,7 +233,7 @@ public:
class svqrshl_impl : public unspec_based_function
{
public:
- constexpr svqrshl_impl ()
+ CONSTEXPR svqrshl_impl ()
: unspec_based_function (UNSPEC_SQRSHL, UNSPEC_UQRSHL, -1) {}
gimple *
@@ -267,7 +267,7 @@ public:
class svqshl_impl : public unspec_based_function
{
public:
- constexpr svqshl_impl ()
+ CONSTEXPR svqshl_impl ()
: unspec_based_function (UNSPEC_SQSHL, UNSPEC_UQSHL, -1) {}
gimple *
@@ -303,7 +303,7 @@ public:
class svrshl_impl : public unspec_based_function
{
public:
- constexpr svrshl_impl ()
+ CONSTEXPR svrshl_impl ()
: unspec_based_function (UNSPEC_SRSHL, UNSPEC_URSHL, -1) {}
gimple *
@@ -403,7 +403,7 @@ public:
class svtbl2_impl : public quiet<multi_vector_function>
{
public:
- constexpr svtbl2_impl () : quiet<multi_vector_function> (2) {}
+ CONSTEXPR svtbl2_impl () : quiet<multi_vector_function> (2) {}
rtx
expand (function_expander &e) const override
@@ -431,7 +431,7 @@ public:
class svwhilerw_svwhilewr_impl : public full_width_access
{
public:
- constexpr svwhilerw_svwhilewr_impl (int unspec) : m_unspec (unspec) {}
+ CONSTEXPR svwhilerw_svwhilewr_impl (int unspec) : m_unspec (unspec) {}
rtx
expand (function_expander &e) const override
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 37228f6..e168c83 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -99,7 +99,7 @@ struct registered_function_hasher : nofree_ptr_hash <registered_function>
};
/* Information about each single-predicate or single-vector type. */
-static constexpr const vector_type_info vector_types[] = {
+static CONSTEXPR const vector_type_info vector_types[] = {
#define DEF_SVE_TYPE(ACLE_NAME, NCHARS, ABI_NAME, SCALAR_TYPE) \
{ #ACLE_NAME, #ABI_NAME, "u" #NCHARS #ABI_NAME },
#include "aarch64-sve-builtins.def"
@@ -116,7 +116,7 @@ static const char *const pred_suffixes[NUM_PREDS + 1] = {
};
/* Static information about each mode_suffix_index. */
-constexpr const mode_suffix_info mode_suffixes[] = {
+CONSTEXPR const mode_suffix_info mode_suffixes[] = {
#define VECTOR_TYPE_none NUM_VECTOR_TYPES
#define DEF_SVE_MODE(NAME, BASE, DISPLACEMENT, UNITS) \
{ "_" #NAME, VECTOR_TYPE_##BASE, VECTOR_TYPE_##DISPLACEMENT, UNITS_##UNITS },
@@ -126,7 +126,7 @@ constexpr const mode_suffix_info mode_suffixes[] = {
};
/* Static information about each type_suffix_index. */
-constexpr const type_suffix_info type_suffixes[NUM_TYPE_SUFFIXES + 1] = {
+CONSTEXPR const type_suffix_info type_suffixes[NUM_TYPE_SUFFIXES + 1] = {
#define DEF_SVE_TYPE_SUFFIX(NAME, ACLE_TYPE, CLASS, BITS, MODE) \
{ "_" #NAME, \
VECTOR_TYPE_##ACLE_TYPE, \
@@ -522,7 +522,7 @@ static const predication_index preds_z_or_none[] = {
static const predication_index preds_z[] = { PRED_z, NUM_PREDS };
/* A list of all SVE ACLE functions. */
-static constexpr const function_group_info function_groups[] = {
+static CONSTEXPR const function_group_info function_groups[] = {
#define DEF_SVE_FUNCTION(NAME, SHAPE, TYPES, PREDS) \
{ #NAME, &functions::NAME, &shapes::SHAPE, types_##TYPES, preds_##PREDS, \
REQUIRED_EXTENSIONS | AARCH64_FL_SVE },
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 5d1ab5a..d1f979eb 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -2679,7 +2679,7 @@ struct processor
};
/* Architectures implementing AArch64. */
-static constexpr processor all_architectures[] =
+static CONSTEXPR const processor all_architectures[] =
{
#define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, D, E) \
{NAME, CORE, CORE, AARCH64_ARCH_##ARCH_IDENT, \
@@ -19891,7 +19891,8 @@ aarch64_setup_incoming_varargs (cumulative_args_t cum_v,
argument. Advance a local copy of CUM past the last "real" named
argument, to find out how many registers are left over. */
local_cum = *cum;
- aarch64_function_arg_advance (pack_cumulative_args(&local_cum), arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ aarch64_function_arg_advance (pack_cumulative_args(&local_cum), arg);
/* Found out how many registers we need to save.
Honor tree-stdvar analysis results. */
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 05da9af..e60f9bc 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -571,10 +571,6 @@ enum class aarch64_feature : unsigned char {
#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, R4_REGNUM)
#define EH_RETURN_HANDLER_RTX aarch64_eh_return_handler_rtx ()
-/* Don't use __builtin_setjmp until we've defined it. */
-#undef DONT_USE_BUILTIN_SETJMP
-#define DONT_USE_BUILTIN_SETJMP 1
-
#undef TARGET_COMPUTE_FRAME_LAYOUT
#define TARGET_COMPUTE_FRAME_LAYOUT aarch64_layout_frame
diff --git a/gcc/config/aarch64/driver-aarch64.cc b/gcc/config/aarch64/driver-aarch64.cc
index 2ae47c0..a1d412c 100644
--- a/gcc/config/aarch64/driver-aarch64.cc
+++ b/gcc/config/aarch64/driver-aarch64.cc
@@ -64,7 +64,7 @@ struct aarch64_core_data
#define AARCH64_CORE(CORE_NAME, CORE_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \
{ CORE_NAME, #ARCH, IMP, PART, VARIANT, feature_deps::cpu_##CORE_IDENT },
-static constexpr aarch64_core_data aarch64_cpu_data[] =
+static CONSTEXPR const aarch64_core_data aarch64_cpu_data[] =
{
#include "aarch64-cores.def"
{ NULL, NULL, INVALID_IMP, INVALID_CORE, ALL_VARIANTS, 0 }
@@ -82,7 +82,7 @@ struct aarch64_arch_driver_info
#define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, ARCH_REV, FLAGS) \
{ #ARCH_IDENT + 1, NAME, feature_deps::ARCH_IDENT ().enable },
-static constexpr aarch64_arch_driver_info aarch64_arches[] =
+static CONSTEXPR const aarch64_arch_driver_info aarch64_arches[] =
{
#include "aarch64-arches.def"
{NULL, NULL, 0}
diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc
index 66c1714..333f2c6 100644
--- a/gcc/config/alpha/alpha.cc
+++ b/gcc/config/alpha/alpha.cc
@@ -6084,8 +6084,9 @@ alpha_setup_incoming_varargs (cumulative_args_t pcum,
{
CUMULATIVE_ARGS cum = *get_cumulative_args (pcum);
- /* Skip the current argument. */
- targetm.calls.function_arg_advance (pack_cumulative_args (&cum), arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ /* Skip the current argument. */
+ targetm.calls.function_arg_advance (pack_cumulative_args (&cum), arg);
#if TARGET_ABI_OPEN_VMS
/* For VMS, we allocate space for all 6 arg registers plus a count.
diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
index e6f52d8..604a116 100644
--- a/gcc/config/arc/arc.cc
+++ b/gcc/config/arc/arc.cc
@@ -2450,7 +2450,8 @@ arc_setup_incoming_varargs (cumulative_args_t args_so_far,
/* We must treat `__builtin_va_alist' as an anonymous arg. */
next_cum = *get_cumulative_args (args_so_far);
- arc_function_arg_advance (pack_cumulative_args (&next_cum), arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ arc_function_arg_advance (pack_cumulative_args (&next_cum), arg);
first_anon_arg = next_cum;
if (FUNCTION_ARG_REGNO_P (first_anon_arg))
diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index ee8f1ba..2eb4d51 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -29143,7 +29143,8 @@ arm_setup_incoming_varargs (cumulative_args_t pcum_v,
if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
{
nregs = pcum->aapcs_ncrn;
- if (nregs & 1)
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))
+ && (nregs & 1))
{
int res = arm_needs_doubleword_align (arg.mode, arg.type);
if (res < 0 && warn_psabi)
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 50cc0bc..6d803ce 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -30,9 +30,6 @@
} \
while (false)
-#define EXTRA_TARGET_D_OS_VERSIONS() \
- ANDROID_TARGET_D_OS_VERSIONS();
-
/* We default to a soft-float ABI so that binaries can run on all
target hardware. If you override this to use the hard-float ABI then
change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */
diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
index 5105565..ea8ca64 100644
--- a/gcc/config/bpf/bpf.cc
+++ b/gcc/config/bpf/bpf.cc
@@ -184,13 +184,13 @@ enum bpf_builtins
/* Compile Once - Run Everywhere (CO-RE) support. */
BPF_BUILTIN_PRESERVE_ACCESS_INDEX,
+ BPF_BUILTIN_PRESERVE_FIELD_INFO,
BPF_BUILTIN_MAX,
};
static GTY (()) tree bpf_builtins[(int) BPF_BUILTIN_MAX];
-
void bpf_register_coreattr_pass (void);
/* Initialize the per-function machine status. */
@@ -966,6 +966,9 @@ bpf_init_builtins (void)
def_builtin ("__builtin_preserve_access_index",
BPF_BUILTIN_PRESERVE_ACCESS_INDEX,
build_function_type_list (ptr_type_node, ptr_type_node, 0));
+ def_builtin ("__builtin_preserve_field_info",
+ BPF_BUILTIN_PRESERVE_FIELD_INFO,
+ build_function_type_list (unsigned_type_node, ptr_type_node, unsigned_type_node, 0));
}
#undef TARGET_INIT_BUILTINS
@@ -975,6 +978,199 @@ static tree bpf_core_compute (tree, vec<unsigned int> *);
static int bpf_core_get_index (const tree);
static bool is_attr_preserve_access (tree);
+/* BPF Compile Once - Run Everywhere (CO-RE) support. Construct a CO-RE
+ relocation record for EXPR of kind KIND to be emitted in the .BTF.ext
+ section. Does nothing if we are not targetting BPF CO-RE, or if the
+ constructed relocation would be a no-op. */
+
+static void
+maybe_make_core_relo (tree expr, enum btf_core_reloc_kind kind)
+{
+ /* If we are not targetting BPF CO-RE, do not make a relocation. We
+ might not be generating any debug info at all. */
+ if (!TARGET_BPF_CORE)
+ return;
+
+ auto_vec<unsigned int, 16> accessors;
+ tree container = bpf_core_compute (expr, &accessors);
+
+ /* Any valid use of the builtin must have at least one access. Otherwise,
+ there is nothing to record and nothing to do. This is primarily a
+ guard against optimizations leading to unexpected expressions in the
+ argument of the builtin. For example, if the builtin is used to read
+ a field of a structure which can be statically determined to hold a
+ constant value, the argument to the builtin will be optimized to that
+ constant. This is OK, and means the builtin call is superfluous.
+ e.g.
+ struct S foo;
+ foo.a = 5;
+ int x = __preserve_access_index (foo.a);
+ ... do stuff with x
+ 'foo.a' in the builtin argument will be optimized to '5' with -01+.
+ This sequence does not warrant recording a CO-RE relocation. */
+
+ if (accessors.length () < 1)
+ return;
+ accessors.reverse ();
+
+ rtx_code_label *label = gen_label_rtx ();
+ LABEL_PRESERVE_P (label) = 1;
+ emit_label (label);
+
+ /* Determine what output section this relocation will apply to.
+ If this function is associated with a section, use that. Otherwise,
+ fall back on '.text'. */
+ const char * section_name;
+ if (current_function_decl && DECL_SECTION_NAME (current_function_decl))
+ section_name = DECL_SECTION_NAME (current_function_decl);
+ else
+ section_name = ".text";
+
+ /* Add the CO-RE relocation information to the BTF container. */
+ bpf_core_reloc_add (TREE_TYPE (container), section_name, &accessors, label,
+ kind);
+}
+
+/* Expand a call to __builtin_preserve_field_info by evaluating the requested
+ information about SRC according to KIND, and return a tree holding
+ the result. */
+
+static tree
+bpf_core_field_info (tree src, enum btf_core_reloc_kind kind)
+{
+ unsigned int result;
+ poly_int64 bitsize, bitpos;
+ tree var_off = NULL_TREE;
+ machine_mode mode;
+ int unsignedp, reversep, volatilep;
+ location_t loc = EXPR_LOCATION (src);
+
+ get_inner_reference (src, &bitsize, &bitpos, &var_off, &mode, &unsignedp,
+ &reversep, &volatilep);
+
+ /* Note: Use DECL_BIT_FIELD_TYPE rather than DECL_BIT_FIELD here, because it
+ remembers whether the field in question was originally declared as a
+ bitfield, regardless of how it has been optimized. */
+ bool bitfieldp = (TREE_CODE (src) == COMPONENT_REF
+ && DECL_BIT_FIELD_TYPE (TREE_OPERAND (src, 1)));
+
+ unsigned int align = TYPE_ALIGN (TREE_TYPE (src));
+ if (TREE_CODE (src) == COMPONENT_REF)
+ {
+ tree field = TREE_OPERAND (src, 1);
+ if (DECL_BIT_FIELD_TYPE (field))
+ align = TYPE_ALIGN (DECL_BIT_FIELD_TYPE (field));
+ else
+ align = TYPE_ALIGN (TREE_TYPE (field));
+ }
+
+ unsigned int start_bitpos = bitpos & ~(align - 1);
+ unsigned int end_bitpos = start_bitpos + align;
+
+ switch (kind)
+ {
+ case BPF_RELO_FIELD_BYTE_OFFSET:
+ {
+ if (var_off != NULL_TREE)
+ {
+ error_at (loc, "unsupported variable field offset");
+ return error_mark_node;
+ }
+
+ if (bitfieldp)
+ result = start_bitpos / 8;
+ else
+ result = bitpos / 8;
+ }
+ break;
+
+ case BPF_RELO_FIELD_BYTE_SIZE:
+ {
+ if (mode == BLKmode && bitsize == -1)
+ {
+ error_at (loc, "unsupported variable size field access");
+ return error_mark_node;
+ }
+
+ if (bitfieldp)
+ {
+ /* To match LLVM behavior, byte size of bitfields is recorded as
+ the full size of the base type. A 3-bit bitfield of type int is
+ therefore recorded as having a byte size of 4 bytes. */
+ result = end_bitpos - start_bitpos;
+ if (result & (result - 1))
+ {
+ error_at (loc, "unsupported field expression");
+ return error_mark_node;
+ }
+ result = result / 8;
+ }
+ else
+ result = bitsize / 8;
+ }
+ break;
+
+ case BPF_RELO_FIELD_EXISTS:
+ /* The field always exists at compile time. */
+ result = 1;
+ break;
+
+ case BPF_RELO_FIELD_SIGNED:
+ result = !unsignedp;
+ break;
+
+ case BPF_RELO_FIELD_LSHIFT_U64:
+ case BPF_RELO_FIELD_RSHIFT_U64:
+ {
+ if (mode == BLKmode && bitsize == -1)
+ {
+ error_at (loc, "unsupported variable size field access");
+ return error_mark_node;
+ }
+ if (var_off != NULL_TREE)
+ {
+ error_at (loc, "unsupported variable field offset");
+ return error_mark_node;
+ }
+
+ if (!bitfieldp)
+ {
+ if (bitsize > 64)
+ {
+ error_at (loc, "field size too large");
+ return error_mark_node;
+ }
+ result = 64 - bitsize;
+ break;
+ }
+
+ if (end_bitpos - start_bitpos > 64)
+ {
+ error_at (loc, "field size too large");
+ return error_mark_node;
+ }
+
+ if (kind == BPF_RELO_FIELD_LSHIFT_U64)
+ {
+ if (TARGET_BIG_ENDIAN)
+ result = bitpos + 64 - start_bitpos - align;
+ else
+ result = start_bitpos + 64 - bitpos - bitsize;
+ }
+ else /* RSHIFT_U64 */
+ result = 64 - bitsize;
+ }
+ break;
+
+ default:
+ error ("invalid second argument to built-in function");
+ return error_mark_node;
+ break;
+ }
+
+ return build_int_cst (unsigned_type_node, result);
+}
+
/* Expand a call to a BPF-specific built-in function that was set up
with bpf_init_builtins. */
@@ -1025,17 +1221,15 @@ bpf_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
/* The result of the load is in R0. */
return gen_rtx_REG (ops[0].mode, BPF_R0);
}
+
else if (code == -1)
{
- /* A resolved overloaded builtin, e.g. __bpf_preserve_access_index_si */
+ /* A resolved overloaded __builtin_preserve_access_index. */
tree arg = CALL_EXPR_ARG (exp, 0);
if (arg == NULL_TREE)
return NULL_RTX;
- auto_vec<unsigned int, 16> accessors;
- tree container;
-
if (TREE_CODE (arg) == SSA_NAME)
{
gimple *def_stmt = SSA_NAME_DEF_STMT (arg);
@@ -1049,51 +1243,42 @@ bpf_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
/* Avoid double-recording information if the argument is an access to
a struct/union marked __attribute__((preserve_access_index)). This
Will be handled by the attribute handling pass. */
- if (is_attr_preserve_access (arg))
- return expand_normal (arg);
-
- container = bpf_core_compute (arg, &accessors);
-
- /* Any valid use of the builtin must have at least one access. Otherwise,
- there is nothing to record and nothing to do. This is primarily a
- guard against optimizations leading to unexpected expressions in the
- argument of the builtin. For example, if the builtin is used to read
- a field of a structure which can be statically determined to hold a
- constant value, the argument to the builtin will be optimized to that
- constant. This is OK, and means the builtin call is superfluous.
- e.g.
- struct S foo;
- foo.a = 5;
- int x = __preserve_access_index (foo.a);
- ... do stuff with x
- 'foo.a' in the builtin argument will be optimized to '5' with -01+.
- This sequence does not warrant recording a CO-RE relocation. */
-
- if (accessors.length () < 1)
- return expand_normal (arg);
-
- accessors.reverse ();
-
- container = TREE_TYPE (container);
-
- rtx_code_label *label = gen_label_rtx ();
- LABEL_PRESERVE_P (label) = 1;
- emit_label (label);
-
- /* Determine what output section this relocation will apply to.
- If this function is associated with a section, use that. Otherwise,
- fall back on '.text'. */
- const char * section_name;
- if (current_function_decl && DECL_SECTION_NAME (current_function_decl))
- section_name = DECL_SECTION_NAME (current_function_decl);
+ if (!is_attr_preserve_access (arg))
+ maybe_make_core_relo (arg, BPF_RELO_FIELD_BYTE_OFFSET);
+
+ return expand_normal (arg);
+ }
+
+ else if (code == -2)
+ {
+ /* A resolved overloaded __builtin_preserve_field_info. */
+ tree src = CALL_EXPR_ARG (exp, 0);
+ tree kind_tree = CALL_EXPR_ARG (exp, 1);
+ unsigned HOST_WIDE_INT kind_val;
+ if (tree_fits_uhwi_p (kind_tree))
+ kind_val = tree_to_uhwi (kind_tree);
else
- section_name = ".text";
+ error ("invalid argument to built-in function");
- /* Add the CO-RE relocation information to the BTF container. */
- bpf_core_reloc_add (container, section_name, &accessors, label);
+ enum btf_core_reloc_kind kind = (enum btf_core_reloc_kind) kind_val;
- return expand_normal (arg);
+ if (TREE_CODE (src) == SSA_NAME)
+ {
+ gimple *def_stmt = SSA_NAME_DEF_STMT (src);
+ if (is_gimple_assign (def_stmt))
+ src = gimple_assign_rhs1 (def_stmt);
+ }
+ if (TREE_CODE (src) == ADDR_EXPR)
+ src = TREE_OPERAND (src, 0);
+
+ tree result = bpf_core_field_info (src, kind);
+
+ if (result != error_mark_node)
+ maybe_make_core_relo (src, kind);
+
+ return expand_normal (result);
}
+
gcc_unreachable ();
}
@@ -1259,41 +1444,64 @@ bpf_core_get_index (const tree node)
__builtin_preserve_access_index. */
static tree
-bpf_core_newdecl (tree type)
+bpf_core_newdecl (tree type, bool is_pai)
{
- tree rettype = build_function_type_list (type, type, NULL);
+ tree rettype;
char name[80];
- int len = snprintf (name, sizeof (name), "%s", "__builtin_pai_");
+ static unsigned long pai_count = 0;
+ static unsigned long pfi_count = 0;
- static unsigned long cnt = 0;
- len = snprintf (name + len, sizeof (name) - len, "%lu", cnt++);
+ if (is_pai)
+ {
+ rettype = build_function_type_list (type, type, NULL);
+ int len = snprintf (name, sizeof (name), "%s", "__builtin_pai_");
+ len = snprintf (name + len, sizeof (name) - len, "%lu", pai_count++);
+ }
+ else
+ {
+ rettype = build_function_type_list (unsigned_type_node, type,
+ unsigned_type_node, NULL);
+ int len = snprintf (name, sizeof (name), "%s", "__builtin_pfi_");
+ len = snprintf (name + len, sizeof (name) - len, "%lu", pfi_count++);
+ }
- return add_builtin_function_ext_scope (name, rettype, -1, BUILT_IN_MD, NULL,
- NULL_TREE);
+ return add_builtin_function_ext_scope (name, rettype, is_pai ? -1 : -2,
+ BUILT_IN_MD, NULL, NULL_TREE);
}
/* Return whether EXPR could access some aggregate data structure that
BPF CO-RE support needs to know about. */
-static int
+static bool
bpf_core_is_maybe_aggregate_access (tree expr)
{
- enum tree_code code = TREE_CODE (expr);
- if (code == COMPONENT_REF || code == ARRAY_REF)
- return 1;
-
- if (code == ADDR_EXPR)
+ switch (TREE_CODE (expr))
+ {
+ case COMPONENT_REF:
+ case BIT_FIELD_REF:
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ return true;
+ case ADDR_EXPR:
+ case NOP_EXPR:
return bpf_core_is_maybe_aggregate_access (TREE_OPERAND (expr, 0));
-
- return 0;
+ default:
+ return false;
+ }
}
+struct core_walk_data {
+ location_t loc;
+ tree arg;
+};
+
/* Callback function used with walk_tree from bpf_resolve_overloaded_builtin. */
static tree
bpf_core_walk (tree *tp, int *walk_subtrees, void *data)
{
- location_t loc = *((location_t *) data);
+ struct core_walk_data *dat = (struct core_walk_data *) data;
+ bool is_pai = dat->arg == NULL_TREE;
/* If this is a type, don't do anything. */
if (TYPE_P (*tp))
@@ -1302,10 +1510,18 @@ bpf_core_walk (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
+ /* Build a new function call to a resolved builtin for the desired operation.
+ If this is a preserve_field_info call, pass along the argument to the
+ resolved builtin call. */
if (bpf_core_is_maybe_aggregate_access (*tp))
{
- tree newdecl = bpf_core_newdecl (TREE_TYPE (*tp));
- tree newcall = build_call_expr_loc (loc, newdecl, 1, *tp);
+ tree newdecl = bpf_core_newdecl (TREE_TYPE (*tp), is_pai);
+ tree newcall;
+ if (is_pai)
+ newcall = build_call_expr_loc (dat->loc, newdecl, 1, *tp);
+ else
+ newcall = build_call_expr_loc (dat->loc, newdecl, 2, *tp, dat->arg);
+
*tp = newcall;
*walk_subtrees = 0;
}
@@ -1330,6 +1546,30 @@ bpf_small_register_classes_for_mode_p (machine_mode mode)
#define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P \
bpf_small_register_classes_for_mode_p
+/* Return whether EXPR is a valid first argument for a call to
+ __builtin_preserve_field_info. */
+
+static bool
+bpf_is_valid_preserve_field_info_arg (tree expr)
+{
+ switch (TREE_CODE (expr))
+ {
+ case COMPONENT_REF:
+ case BIT_FIELD_REF:
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ return true;
+ case NOP_EXPR:
+ return bpf_is_valid_preserve_field_info_arg (TREE_OPERAND (expr, 0));
+ case ADDR_EXPR:
+ /* Do not accept ADDR_EXPRs like &foo.bar, but do accept accesses like
+ foo.baz where baz is an array. */
+ return (TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == ARRAY_TYPE);
+ default:
+ return false;
+ }
+}
+
/* Implement TARGET_RESOLVE_OVERLOADED_BUILTIN (see gccint manual section
Target Macros::Misc.).
We use this for the __builtin_preserve_access_index builtin for CO-RE
@@ -1344,7 +1584,12 @@ bpf_small_register_classes_for_mode_p (machine_mode mode)
static tree
bpf_resolve_overloaded_builtin (location_t loc, tree fndecl, void *arglist)
{
- if (DECL_MD_FUNCTION_CODE (fndecl) != BPF_BUILTIN_PRESERVE_ACCESS_INDEX)
+ bool is_pai = DECL_MD_FUNCTION_CODE (fndecl)
+ == BPF_BUILTIN_PRESERVE_ACCESS_INDEX;
+ bool is_pfi = DECL_MD_FUNCTION_CODE (fndecl)
+ == BPF_BUILTIN_PRESERVE_FIELD_INFO;
+
+ if (!is_pai && !is_pfi)
return NULL_TREE;
/* We only expect one argument, but it may be an arbitrarily-complicated
@@ -1352,18 +1597,26 @@ bpf_resolve_overloaded_builtin (location_t loc, tree fndecl, void *arglist)
vec<tree, va_gc> *params = static_cast<vec<tree, va_gc> *> (arglist);
unsigned n_params = params ? params->length() : 0;
- if (n_params != 1)
+ if ((is_pai && n_params != 1) || (is_pfi && n_params != 2))
{
- error_at (loc, "expected exactly 1 argument");
- return NULL_TREE;
+ error_at (loc, "wrong number of arguments");
+ return error_mark_node;
}
tree param = (*params)[0];
- /* If not generating BPF_CORE information, the builtin does nothing. */
- if (!TARGET_BPF_CORE)
+ /* If not generating BPF_CORE information, preserve_access_index does nothing,
+ and simply "resolves to" the argument. */
+ if (!TARGET_BPF_CORE && is_pai)
return param;
+ if (is_pfi && !bpf_is_valid_preserve_field_info_arg (param))
+ {
+ error_at (EXPR_LOC_OR_LOC (param, loc),
+ "argument is not a field access");
+ return error_mark_node;
+ }
+
/* Do remove_c_maybe_const_expr for the arg.
TODO: WHY do we have to do this here? Why doesn't c-typeck take care
of it before or after this hook? */
@@ -1387,7 +1640,11 @@ bpf_resolve_overloaded_builtin (location_t loc, tree fndecl, void *arglist)
This ensures that all the relevant information remains within the
expression trees the builtin finally gets. */
- walk_tree (&param, bpf_core_walk, (void *) &loc, NULL);
+ struct core_walk_data data;
+ data.loc = loc;
+ data.arg = is_pai ? NULL_TREE : (*params)[1];
+
+ walk_tree (&param, bpf_core_walk, (void *) &data, NULL);
return param;
}
@@ -1524,7 +1781,8 @@ handle_attr_preserve (function *fn)
emit_label (label);
/* Add the CO-RE relocation information to the BTF container. */
- bpf_core_reloc_add (container, section_name, &accessors, label);
+ bpf_core_reloc_add (container, section_name, &accessors, label,
+ BPF_RELO_FIELD_BYTE_OFFSET);
}
}
}
diff --git a/gcc/config/bpf/coreout.cc b/gcc/config/bpf/coreout.cc
index 8897a04..9f71040 100644
--- a/gcc/config/bpf/coreout.cc
+++ b/gcc/config/bpf/coreout.cc
@@ -152,7 +152,8 @@ static GTY (()) vec<bpf_core_section_ref, va_gc> *bpf_core_sections;
void
bpf_core_reloc_add (const tree type, const char * section_name,
- vec<unsigned int> *accessors, rtx_code_label *label)
+ vec<unsigned int> *accessors, rtx_code_label *label,
+ enum btf_core_reloc_kind kind)
{
char buf[40];
unsigned int i, n = 0;
@@ -173,7 +174,7 @@ bpf_core_reloc_add (const tree type, const char * section_name,
bpfcr->bpfcr_type = get_btf_id (ctf_lookup_tree_type (ctfc, type));
bpfcr->bpfcr_insn_label = label;
- bpfcr->bpfcr_kind = BPF_RELO_FIELD_BYTE_OFFSET;
+ bpfcr->bpfcr_kind = kind;
/* Add the CO-RE reloc to the appropriate section. */
bpf_core_section_ref sec;
diff --git a/gcc/config/bpf/coreout.h b/gcc/config/bpf/coreout.h
index 3c7bdfd..498853f 100644
--- a/gcc/config/bpf/coreout.h
+++ b/gcc/config/bpf/coreout.h
@@ -103,7 +103,7 @@ extern void btf_ext_init (void);
extern void btf_ext_output (void);
extern void bpf_core_reloc_add (const tree, const char *, vec<unsigned int> *,
- rtx_code_label *);
+ rtx_code_label *, enum btf_core_reloc_kind);
extern int bpf_core_get_sou_member_index (ctf_container_ref, const tree);
#ifdef __cplusplus
diff --git a/gcc/config/csky/csky.cc b/gcc/config/csky/csky.cc
index f7b2bf8..537eee6 100644
--- a/gcc/config/csky/csky.cc
+++ b/gcc/config/csky/csky.cc
@@ -2086,7 +2086,8 @@ csky_setup_incoming_varargs (cumulative_args_t pcum_v,
cfun->machine->uses_anonymous_args = 1;
local_cum = *pcum;
- csky_function_arg_advance (local_cum_v, arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ csky_function_arg_advance (local_cum_v, arg);
regs_to_push = CSKY_NPARM_REGS - local_cum.reg;
if (regs_to_push)
*pretend_size = regs_to_push * UNITS_PER_WORD;
diff --git a/gcc/config/darwin-d.cc b/gcc/config/darwin-d.cc
index 2ceebc4..9730494 100644
--- a/gcc/config/darwin-d.cc
+++ b/gcc/config/darwin-d.cc
@@ -67,10 +67,10 @@ darwin_d_register_target_info (void)
#undef TARGET_D_MINFO_SECTION
#define TARGET_D_MINFO_SECTION "__DATA,__minfodata"
-#undef TARGET_D_MINFO_START_NAME
-#define TARGET_D_MINFO_START_NAME "*section$start$__DATA$__minfodata"
+#undef TARGET_D_MINFO_SECTION_START
+#define TARGET_D_MINFO_SECTION_START "*section$start$__DATA$__minfodata"
-#undef TARGET_D_MINFO_END_NAME
-#define TARGET_D_MINFO_END_NAME "*section$end$__DATA$__minfodata"
+#undef TARGET_D_MINFO_SECTION_END
+#define TARGET_D_MINFO_SECTION_END "*section$end$__DATA$__minfodata"
struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h
index acb3762..f8b3be4 100644
--- a/gcc/config/elfos.h
+++ b/gcc/config/elfos.h
@@ -482,9 +482,3 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
-
-/* ELF support needed only by D front-end. */
-
-#define TARGET_D_MINFO_SECTION "minfo"
-#define TARGET_D_MINFO_START_NAME "__start_minfo"
-#define TARGET_D_MINFO_END_NAME "__stop_minfo"
diff --git a/gcc/config/epiphany/epiphany.cc b/gcc/config/epiphany/epiphany.cc
index f8c0493..c4e3cea 100644
--- a/gcc/config/epiphany/epiphany.cc
+++ b/gcc/config/epiphany/epiphany.cc
@@ -727,11 +727,13 @@ epiphany_setup_incoming_varargs (cumulative_args_t cum,
machine_function_t *mf = MACHINE_FUNCTION (cfun);
/* All BLKmode values are passed by reference. */
- gcc_assert (arg.mode != BLKmode);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ gcc_assert (arg.mode != BLKmode);
next_cum = *get_cumulative_args (cum);
- next_cum = (ROUND_ADVANCE_CUM (next_cum, arg.mode, arg.type)
- + ROUND_ADVANCE_ARG (arg.mode, arg.type));
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ next_cum = (ROUND_ADVANCE_CUM (next_cum, arg.mode, arg.type)
+ + ROUND_ADVANCE_ARG (arg.mode, arg.type));
first_anon_arg = next_cum;
if (first_anon_arg < MAX_EPIPHANY_PARM_REGS && !no_rtl)
diff --git a/gcc/config/fr30/fr30.cc b/gcc/config/fr30/fr30.cc
index c9b061d..334bb44 100644
--- a/gcc/config/fr30/fr30.cc
+++ b/gcc/config/fr30/fr30.cc
@@ -471,16 +471,19 @@ fr30_setup_incoming_varargs (cumulative_args_t arg_regs_used_so_far_v,
= get_cumulative_args (arg_regs_used_so_far_v);
int size;
- /* All BLKmode values are passed by reference. */
- gcc_assert (arg.mode != BLKmode);
-
- /* ??? This run-time test as well as the code inside the if
- statement is probably unnecessary. */
- if (targetm.calls.strict_argument_naming (arg_regs_used_so_far_v))
- /* If TARGET_STRICT_ARGUMENT_NAMING returns true, then the last named
- arg must not be treated as an anonymous arg. */
- /* ??? This is a pointer increment, which makes no sense. */
- arg_regs_used_so_far += fr30_num_arg_regs (arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ {
+ /* All BLKmode values are passed by reference. */
+ gcc_assert (arg.mode != BLKmode);
+
+ /* ??? This run-time test as well as the code inside the if
+ statement is probably unnecessary. */
+ if (targetm.calls.strict_argument_naming (arg_regs_used_so_far_v))
+ /* If TARGET_STRICT_ARGUMENT_NAMING returns true, then the last named
+ arg must not be treated as an anonymous arg. */
+ /* ??? This is a pointer increment, which makes no sense. */
+ arg_regs_used_so_far += fr30_num_arg_regs (arg);
+ }
size = FR30_NUM_ARG_REGS - (* arg_regs_used_so_far);
diff --git a/gcc/config/frv/frv.cc b/gcc/config/frv/frv.cc
index 6f1904b..5cdb0bf 100644
--- a/gcc/config/frv/frv.cc
+++ b/gcc/config/frv/frv.cc
@@ -2104,7 +2104,8 @@ frv_setup_incoming_varargs (cumulative_args_t cum_v,
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- if (TARGET_DEBUG_ARG)
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))
+ && TARGET_DEBUG_ARG)
fprintf (stderr,
"setup_vararg: words = %2d, mode = %4s, pretend_size = %d, second_time = %d\n",
*cum, GET_MODE_NAME (arg.mode), *pretend_size, second_time);
diff --git a/gcc/config/ft32/ft32.cc b/gcc/config/ft32/ft32.cc
index ed2d122..d6b73d4 100644
--- a/gcc/config/ft32/ft32.cc
+++ b/gcc/config/ft32/ft32.cc
@@ -634,8 +634,10 @@ ft32_setup_incoming_varargs (cumulative_args_t cum_v,
int *pretend_size, int no_rtl ATTRIBUTE_UNUSED)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- int named_size =
- GET_MODE_SIZE (SImode) * (*cum - FT32_R0) + GET_MODE_SIZE (arg.mode);
+ int named_size = 0;
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ named_size =
+ GET_MODE_SIZE (SImode) * (*cum - FT32_R0) + GET_MODE_SIZE (arg.mode);
if (named_size < 24)
*pretend_size = 24 - named_size;
diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md
index 00c0e3b..3b61951 100644
--- a/gcc/config/gcn/gcn-valu.md
+++ b/gcc/config/gcn/gcn-valu.md
@@ -32,11 +32,6 @@
(define_mode_iterator V_DF
[V2DF V4DF V8DF V16DF V32DF V64DF])
-(define_mode_iterator V64_SI
- [V64SI])
-(define_mode_iterator V64_DI
- [V64DI])
-
; Vector modes for sub-dword modes
(define_mode_iterator V_QIHI
[V2QI V2HI
@@ -77,13 +72,6 @@
V32HF V32SF
V64HF V64SF])
-; V64_* modes are for where more general support is unimplemented
-; (e.g. reductions)
-(define_mode_iterator V64_1REG
- [V64QI V64HI V64SI V64HF V64SF])
-(define_mode_iterator V64_INT_1REG
- [V64QI V64HI V64SI])
-
; Vector modes for two vector registers
(define_mode_iterator V_2REG
[V2DI V2DF
@@ -93,9 +81,6 @@
V32DI V32DF
V64DI V64DF])
-(define_mode_iterator V64_2REG
- [V64DI V64DF])
-
; Vector modes with native support
(define_mode_iterator V_noQI
[V2HI V2HF V2SI V2SF V2DI V2DF
@@ -158,11 +143,6 @@
V32HF V32SF V32DF
V64HF V64SF V64DF])
-(define_mode_iterator V64_ALL
- [V64QI V64HI V64HF V64SI V64SF V64DI V64DF])
-(define_mode_iterator V64_FP
- [V64HF V64SF V64DF])
-
(define_mode_attr scalar_mode
[(V2QI "qi") (V2HI "hi") (V2SI "si")
(V2HF "hf") (V2SF "sf") (V2DI "di") (V2DF "df")
@@ -2486,6 +2466,23 @@
[(set_attr "type" "vop2")
(set_attr "length" "8,8")])
+(define_code_iterator fminmaxop [smin smax])
+(define_expand "<fexpander><mode>3"
+ [(set (match_operand:FP 0 "gcn_valu_dst_operand")
+ (fminmaxop:FP
+ (match_operand:FP 1 "gcn_valu_src0_operand")
+ (match_operand:FP 2 "gcn_valu_src1_operand")))]
+ ""
+ {})
+
+(define_expand "<fexpander><mode>3<exec>"
+ [(set (match_operand:V_FP 0 "gcn_valu_dst_operand")
+ (fminmaxop:V_FP
+ (match_operand:V_FP 1 "gcn_valu_src0_operand")
+ (match_operand:V_FP 2 "gcn_valu_src1_operand")))]
+ ""
+ {})
+
;; }}}
;; {{{ FP unops
@@ -3528,26 +3525,38 @@
(define_expand "reduc_<reduc_op>_scal_<mode>"
[(set (match_operand:<SCALAR_MODE> 0 "register_operand")
(unspec:<SCALAR_MODE>
- [(match_operand:V64_ALL 1 "register_operand")]
+ [(match_operand:V_ALL 1 "register_operand")]
REDUC_UNSPEC))]
""
{
rtx tmp = gcn_expand_reduc_scalar (<MODE>mode, operands[1],
<reduc_unspec>);
- /* The result of the reduction is in lane 63 of tmp. */
- emit_insn (gen_mov_from_lane63_<mode> (operands[0], tmp));
+ rtx last_lane = GEN_INT (GET_MODE_NUNITS (<MODE>mode) - 1);
+ emit_insn (gen_vec_extract<mode><scalar_mode> (operands[0], tmp,
+ last_lane));
DONE;
})
+(define_expand "reduc_<fexpander>_scal_<mode>"
+ [(match_operand:<SCALAR_MODE> 0 "register_operand")
+ (fminmaxop:V_FP
+ (match_operand:V_FP 1 "register_operand"))]
+ ""
+ {
+ /* fmin/fmax are identical to smin/smax. */
+ emit_insn (gen_reduc_<expander>_scal_<mode> (operands[0], operands[1]));
+ DONE;
+ })
+
;; Warning: This "-ffast-math" implementation converts in-order reductions
;; into associative reductions. It's also used where OpenMP or
;; OpenACC paralellization has already broken the in-order semantics.
(define_expand "fold_left_plus_<mode>"
[(match_operand:<SCALAR_MODE> 0 "register_operand")
(match_operand:<SCALAR_MODE> 1 "gcn_alu_operand")
- (match_operand:V64_FP 2 "gcn_alu_operand")]
+ (match_operand:V_FP 2 "gcn_alu_operand")]
"can_create_pseudo_p ()
&& (flag_openacc || flag_openmp
|| flag_associative_math)"
@@ -3563,11 +3572,11 @@
})
(define_insn "*<reduc_op>_dpp_shr_<mode>"
- [(set (match_operand:V64_1REG 0 "register_operand" "=v")
- (unspec:V64_1REG
- [(match_operand:V64_1REG 1 "register_operand" "v")
- (match_operand:V64_1REG 2 "register_operand" "v")
- (match_operand:SI 3 "const_int_operand" "n")]
+ [(set (match_operand:V_1REG 0 "register_operand" "=v")
+ (unspec:V_1REG
+ [(match_operand:V_1REG 1 "register_operand" "v")
+ (match_operand:V_1REG 2 "register_operand" "v")
+ (match_operand:SI 3 "const_int_operand" "n")]
REDUC_UNSPEC))]
; GCN3 requires a carry out, GCN5 not
"!(TARGET_GCN3 && SCALAR_INT_MODE_P (<SCALAR_MODE>mode)
@@ -3580,11 +3589,11 @@
(set_attr "length" "8")])
(define_insn_and_split "*<reduc_op>_dpp_shr_<mode>"
- [(set (match_operand:V64_DI 0 "register_operand" "=v")
- (unspec:V64_DI
- [(match_operand:V64_DI 1 "register_operand" "v")
- (match_operand:V64_DI 2 "register_operand" "v")
- (match_operand:SI 3 "const_int_operand" "n")]
+ [(set (match_operand:V_DI 0 "register_operand" "=v")
+ (unspec:V_DI
+ [(match_operand:V_DI 1 "register_operand" "v")
+ (match_operand:V_DI 2 "register_operand" "v")
+ (match_operand:SI 3 "const_int_operand" "n")]
REDUC_2REG_UNSPEC))]
""
"#"
@@ -3609,10 +3618,10 @@
; Special cases for addition.
(define_insn "*plus_carry_dpp_shr_<mode>"
- [(set (match_operand:V64_INT_1REG 0 "register_operand" "=v")
- (unspec:V64_INT_1REG
- [(match_operand:V64_INT_1REG 1 "register_operand" "v")
- (match_operand:V64_INT_1REG 2 "register_operand" "v")
+ [(set (match_operand:V_INT_1REG 0 "register_operand" "=v")
+ (unspec:V_INT_1REG
+ [(match_operand:V_INT_1REG 1 "register_operand" "v")
+ (match_operand:V_INT_1REG 2 "register_operand" "v")
(match_operand:SI 3 "const_int_operand" "n")]
UNSPEC_PLUS_CARRY_DPP_SHR))
(clobber (reg:DI VCC_REG))]
@@ -3626,12 +3635,12 @@
(set_attr "length" "8")])
(define_insn "*plus_carry_in_dpp_shr_<mode>"
- [(set (match_operand:V64_SI 0 "register_operand" "=v")
- (unspec:V64_SI
- [(match_operand:V64_SI 1 "register_operand" "v")
- (match_operand:V64_SI 2 "register_operand" "v")
- (match_operand:SI 3 "const_int_operand" "n")
- (match_operand:DI 4 "register_operand" "cV")]
+ [(set (match_operand:V_SI 0 "register_operand" "=v")
+ (unspec:V_SI
+ [(match_operand:V_SI 1 "register_operand" "v")
+ (match_operand:V_SI 2 "register_operand" "v")
+ (match_operand:SI 3 "const_int_operand" "n")
+ (match_operand:DI 4 "register_operand" "cV")]
UNSPEC_PLUS_CARRY_IN_DPP_SHR))
(clobber (reg:DI VCC_REG))]
""
@@ -3644,11 +3653,11 @@
(set_attr "length" "8")])
(define_insn_and_split "*plus_carry_dpp_shr_<mode>"
- [(set (match_operand:V64_DI 0 "register_operand" "=v")
- (unspec:V64_DI
- [(match_operand:V64_DI 1 "register_operand" "v")
- (match_operand:V64_DI 2 "register_operand" "v")
- (match_operand:SI 3 "const_int_operand" "n")]
+ [(set (match_operand:V_DI 0 "register_operand" "=v")
+ (unspec:V_DI
+ [(match_operand:V_DI 1 "register_operand" "v")
+ (match_operand:V_DI 2 "register_operand" "v")
+ (match_operand:SI 3 "const_int_operand" "n")]
UNSPEC_PLUS_CARRY_DPP_SHR))
(clobber (reg:DI VCC_REG))]
""
@@ -3675,38 +3684,6 @@
[(set_attr "type" "vmult")
(set_attr "length" "16")])
-; Instructions to move a scalar value from lane 63 of a vector register.
-(define_insn "mov_from_lane63_<mode>"
- [(set (match_operand:<SCALAR_MODE> 0 "register_operand" "=Sg,v")
- (unspec:<SCALAR_MODE>
- [(match_operand:V64_1REG 1 "register_operand" " v,v")]
- UNSPEC_MOV_FROM_LANE63))]
- ""
- "@
- v_readlane_b32\t%0, %1, 63
- v_mov_b32\t%0, %1 wave_ror:1"
- [(set_attr "type" "vop3a,vop_dpp")
- (set_attr "exec" "none,*")
- (set_attr "length" "8")])
-
-(define_insn "mov_from_lane63_<mode>"
- [(set (match_operand:<SCALAR_MODE> 0 "register_operand" "=Sg,v")
- (unspec:<SCALAR_MODE>
- [(match_operand:V64_2REG 1 "register_operand" " v,v")]
- UNSPEC_MOV_FROM_LANE63))]
- ""
- "@
- v_readlane_b32\t%L0, %L1, 63\;v_readlane_b32\t%H0, %H1, 63
- * if (REGNO (operands[0]) <= REGNO (operands[1])) \
- return \"v_mov_b32\t%L0, %L1 wave_ror:1\;\" \
- \"v_mov_b32\t%H0, %H1 wave_ror:1\"; \
- else \
- return \"v_mov_b32\t%H0, %H1 wave_ror:1\;\" \
- \"v_mov_b32\t%L0, %L1 wave_ror:1\";"
- [(set_attr "type" "vop3a,vop_dpp")
- (set_attr "exec" "none,*")
- (set_attr "length" "8")])
-
;; }}}
;; {{{ Miscellaneous
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index a9ef5c3..b9d9170f 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -4918,23 +4918,25 @@ gcn_expand_dpp_shr_insn (machine_mode mode, const char *insn,
The vector register SRC of mode MODE is reduced using the operation given
by UNSPEC, and the scalar result is returned in lane 63 of a vector
- register. */
-/* FIXME: Implement reductions for sizes other than V64.
- (They're currently disabled in the machine description.) */
+ register (or lane 31, 15, 7, 3, 1 for partial vectors). */
rtx
gcn_expand_reduc_scalar (machine_mode mode, rtx src, int unspec)
{
machine_mode orig_mode = mode;
+ machine_mode scalar_mode = GET_MODE_INNER (mode);
+ int vf = GET_MODE_NUNITS (mode);
bool use_moves = (((unspec == UNSPEC_SMIN_DPP_SHR
+ || unspec == UNSPEC_SMIN_DPP_SHR
|| unspec == UNSPEC_SMAX_DPP_SHR
|| unspec == UNSPEC_UMIN_DPP_SHR
|| unspec == UNSPEC_UMAX_DPP_SHR)
- && (mode == V64DImode
- || mode == V64DFmode))
+ && (scalar_mode == DImode
+ || scalar_mode == DFmode))
|| (unspec == UNSPEC_PLUS_DPP_SHR
- && mode == V64DFmode));
+ && scalar_mode == DFmode));
rtx_code code = (unspec == UNSPEC_SMIN_DPP_SHR ? SMIN
+ : unspec == UNSPEC_SMIN_DPP_SHR ? SMIN
: unspec == UNSPEC_SMAX_DPP_SHR ? SMAX
: unspec == UNSPEC_UMIN_DPP_SHR ? UMIN
: unspec == UNSPEC_UMAX_DPP_SHR ? UMAX
@@ -4944,23 +4946,23 @@ gcn_expand_reduc_scalar (machine_mode mode, rtx src, int unspec)
|| unspec == UNSPEC_SMAX_DPP_SHR
|| unspec == UNSPEC_UMIN_DPP_SHR
|| unspec == UNSPEC_UMAX_DPP_SHR)
- && (mode == V64QImode
- || mode == V64HImode));
+ && (scalar_mode == QImode
+ || scalar_mode == HImode));
bool unsignedp = (unspec == UNSPEC_UMIN_DPP_SHR
|| unspec == UNSPEC_UMAX_DPP_SHR);
bool use_plus_carry = unspec == UNSPEC_PLUS_DPP_SHR
&& GET_MODE_CLASS (mode) == MODE_VECTOR_INT
- && (TARGET_GCN3 || mode == V64DImode);
+ && (TARGET_GCN3 || scalar_mode == DImode);
if (use_plus_carry)
unspec = UNSPEC_PLUS_CARRY_DPP_SHR;
if (use_extends)
{
- rtx tmp = gen_reg_rtx (V64SImode);
+ mode = VnMODE (vf, SImode);
+ rtx tmp = gen_reg_rtx (mode);
convert_move (tmp, src, unsignedp);
src = tmp;
- mode = V64SImode;
}
/* Perform reduction by first performing the reduction operation on every
@@ -4968,7 +4970,8 @@ gcn_expand_reduc_scalar (machine_mode mode, rtx src, int unspec)
iteration (thereby effectively reducing every 4 lanes) and so on until
all lanes are reduced. */
rtx in, out = force_reg (mode, src);
- for (int i = 0, shift = 1; i < 6; i++, shift <<= 1)
+ int iterations = exact_log2 (vf);
+ for (int i = 0, shift = 1; i < iterations; i++, shift <<= 1)
{
rtx shift_val = gen_rtx_CONST_INT (VOIDmode, shift);
in = out;
@@ -5026,7 +5029,7 @@ gcn_vectorization_cost (enum vect_cost_for_stmt ARG_UNUSED (type_of_cost),
static int
gcn_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *ARG_UNUSED (node),
struct cgraph_simd_clone *clonei,
- tree base_type,
+ tree ARG_UNUSED (base_type),
int ARG_UNUSED (num))
{
if (known_eq (clonei->simdlen, 0U))
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index a3c9523..987b763 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -78,7 +78,6 @@
UNSPEC_PLUS_CARRY_DPP_SHR UNSPEC_PLUS_CARRY_IN_DPP_SHR
UNSPEC_AND_DPP_SHR UNSPEC_IOR_DPP_SHR UNSPEC_XOR_DPP_SHR
UNSPEC_MOV_DPP_SHR
- UNSPEC_MOV_FROM_LANE63
UNSPEC_GATHER
UNSPEC_SCATTER
UNSPEC_RCP
@@ -373,6 +372,10 @@
(sign_extend "extend")
(zero_extend "zero_extend")])
+(define_code_attr fexpander
+ [(smin "fmin")
+ (smax "fmax")])
+
;; }}}
;; {{{ Miscellaneous instructions
diff --git a/gcc/config/glibc-d.cc b/gcc/config/gnu-d.cc
index 1411f19..1c0dff2 100644
--- a/gcc/config/glibc-d.cc
+++ b/gcc/config/gnu-d.cc
@@ -1,4 +1,4 @@
-/* Glibc support needed only by D front-end.
+/* GNU system support needed only by D front-end.
Copyright (C) 2017-2022 Free Software Foundation, Inc.
GCC is free software; you can redistribute it and/or modify it under
@@ -23,41 +23,33 @@ along with GCC; see the file COPYING3. If not see
#include "d/d-target.h"
#include "d/d-target-def.h"
-/* Implement TARGET_D_OS_VERSIONS for Glibc targets. */
+/* Implement TARGET_D_OS_VERSIONS for GNU targets. */
static void
-glibc_d_os_builtins (void)
+gnu_d_os_builtins (void)
{
d_add_builtin_version ("Posix");
-
-#define builtin_version(TXT) d_add_builtin_version (TXT)
-
-#ifdef GNU_USER_TARGET_D_OS_VERSIONS
- GNU_USER_TARGET_D_OS_VERSIONS ();
-#endif
-
-#ifdef EXTRA_TARGET_D_OS_VERSIONS
- EXTRA_TARGET_D_OS_VERSIONS ();
-#endif
+ d_add_builtin_version ("Hurd");
+ d_add_builtin_version ("CRuntime_Glibc");
}
/* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
static tree
-glibc_d_handle_target_object_format (void)
+gnu_d_handle_target_object_format (void)
{
const char *objfmt = "elf";
return build_string_literal (strlen (objfmt) + 1, objfmt);
}
-/* Implement TARGET_D_REGISTER_OS_TARGET_INFO for Glibc targets. */
+/* Implement TARGET_D_REGISTER_OS_TARGET_INFO for GNU targets. */
static void
-glibc_d_register_target_info (void)
+gnu_d_register_target_info (void)
{
const struct d_target_info_spec handlers[] = {
- { "objectFormat", glibc_d_handle_target_object_format },
+ { "objectFormat", gnu_d_handle_target_object_format },
{ NULL, NULL },
};
@@ -65,9 +57,9 @@ glibc_d_register_target_info (void)
}
#undef TARGET_D_OS_VERSIONS
-#define TARGET_D_OS_VERSIONS glibc_d_os_builtins
+#define TARGET_D_OS_VERSIONS gnu_d_os_builtins
#undef TARGET_D_REGISTER_OS_TARGET_INFO
-#define TARGET_D_REGISTER_OS_TARGET_INFO glibc_d_register_target_info
+#define TARGET_D_REGISTER_OS_TARGET_INFO gnu_d_register_target_info
struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h
index de2ead8..e8d72463a 100644
--- a/gcc/config/gnu.h
+++ b/gcc/config/gnu.h
@@ -31,9 +31,3 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} while (0)
-
-#define GNU_USER_TARGET_D_OS_VERSIONS() \
- do { \
- builtin_version ("Hurd"); \
- builtin_version ("CRuntime_Glibc"); \
- } while (0)
diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h
index 8c98949..77adfab 100644
--- a/gcc/config/h8300/h8300-protos.h
+++ b/gcc/config/h8300/h8300-protos.h
@@ -100,7 +100,7 @@ extern int h8300_initial_elimination_offset (int, int);
extern int h8300_regs_ok_for_stm (int, rtx[]);
extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int);
extern bool h8300_move_ok (rtx, rtx);
-extern bool pre_incdec_with_reg (rtx, int);
+extern bool pre_incdec_with_reg (rtx, unsigned int);
struct cpp_reader;
extern void h8300_pr_interrupt (struct cpp_reader *);
diff --git a/gcc/config/h8300/h8300.cc b/gcc/config/h8300/h8300.cc
index ce0702e..cd7975e 100644
--- a/gcc/config/h8300/h8300.cc
+++ b/gcc/config/h8300/h8300.cc
@@ -5536,7 +5536,7 @@ h8300_ok_for_sibcall_p (tree fndecl, tree)
instruction using REG, FALSE otherwise. */
bool
-pre_incdec_with_reg (rtx op, int reg)
+pre_incdec_with_reg (rtx op, unsigned int reg)
{
/* OP must be a MEM. */
if (GET_CODE (op) != MEM)
diff --git a/gcc/config/i386/avx512bf16intrin.h b/gcc/config/i386/avx512bf16intrin.h
index b6e9dda..ea1d012 100644
--- a/gcc/config/i386/avx512bf16intrin.h
+++ b/gcc/config/i386/avx512bf16intrin.h
@@ -35,16 +35,16 @@
#endif /* __AVX512BF16__ */
/* Internal data types for implementing the intrinsics. */
-typedef short __v32bh __attribute__ ((__vector_size__ (64)));
+typedef __bf16 __v32bf __attribute__ ((__vector_size__ (64)));
/* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components. */
-typedef short __m512bh __attribute__ ((__vector_size__ (64), __may_alias__));
+typedef __bf16 __m512bh __attribute__ ((__vector_size__ (64), __may_alias__));
/* Convert One BF16 Data to One Single Float Data. */
extern __inline float
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_cvtsbh_ss (__bfloat16 __A)
+_mm_cvtsbh_ss (__bf16 __A)
{
union{ float a; unsigned int b;} __tmp;
__tmp.b = ((unsigned int)(__A)) << 16;
@@ -57,21 +57,21 @@ extern __inline __m512bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm512_cvtne2ps_pbh (__m512 __A, __m512 __B)
{
- return (__m512bh)__builtin_ia32_cvtne2ps2bf16_v32hi(__A, __B);
+ return (__m512bh)__builtin_ia32_cvtne2ps2bf16_v32bf(__A, __B);
}
extern __inline __m512bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_cvtne2ps_pbh (__m512bh __A, __mmask32 __B, __m512 __C, __m512 __D)
{
- return (__m512bh)__builtin_ia32_cvtne2ps2bf16_v32hi_mask(__C, __D, __A, __B);
+ return (__m512bh)__builtin_ia32_cvtne2ps2bf16_v32bf_mask(__C, __D, __A, __B);
}
extern __inline __m512bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm512_maskz_cvtne2ps_pbh (__mmask32 __A, __m512 __B, __m512 __C)
{
- return (__m512bh)__builtin_ia32_cvtne2ps2bf16_v32hi_maskz(__B, __C, __A);
+ return (__m512bh)__builtin_ia32_cvtne2ps2bf16_v32bf_maskz(__B, __C, __A);
}
/* vcvtneps2bf16 */
diff --git a/gcc/config/i386/avx512bf16vlintrin.h b/gcc/config/i386/avx512bf16vlintrin.h
index 969335f..e706903 100644
--- a/gcc/config/i386/avx512bf16vlintrin.h
+++ b/gcc/config/i386/avx512bf16vlintrin.h
@@ -35,70 +35,69 @@
#endif /* __AVX512BF16__ */
/* Internal data types for implementing the intrinsics. */
-typedef short __v16bh __attribute__ ((__vector_size__ (32)));
-typedef short __v8bh __attribute__ ((__vector_size__ (16)));
+typedef __bf16 __v16bf __attribute__ ((__vector_size__ (32)));
+typedef __bf16 __v8bf __attribute__ ((__vector_size__ (16)));
/* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components. */
-typedef short __m256bh __attribute__ ((__vector_size__ (32), __may_alias__));
-typedef short __m128bh __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef __bf16 __m256bh __attribute__ ((__vector_size__ (32), __may_alias__));
+typedef __bf16 __m128bh __attribute__ ((__vector_size__ (16), __may_alias__));
+
+typedef __bf16 __bfloat16;
+
+#define _mm256_cvtneps_pbh(A) \
+ (__m128bh) __builtin_ia32_cvtneps2bf16_v8sf (A)
+#define _mm_cvtneps_pbh(A) \
+ (__m128bh) __builtin_ia32_cvtneps2bf16_v4sf (A)
-typedef unsigned short __bfloat16;
/* vcvtne2ps2bf16 */
extern __inline __m256bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm256_cvtne2ps_pbh (__m256 __A, __m256 __B)
{
- return (__m256bh)__builtin_ia32_cvtne2ps2bf16_v16hi(__A, __B);
+ return (__m256bh)__builtin_ia32_cvtne2ps2bf16_v16bf(__A, __B);
}
extern __inline __m256bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_cvtne2ps_pbh (__m256bh __A, __mmask16 __B, __m256 __C, __m256 __D)
{
- return (__m256bh)__builtin_ia32_cvtne2ps2bf16_v16hi_mask(__C, __D, __A, __B);
+ return (__m256bh)__builtin_ia32_cvtne2ps2bf16_v16bf_mask(__C, __D, __A, __B);
}
extern __inline __m256bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm256_maskz_cvtne2ps_pbh (__mmask16 __A, __m256 __B, __m256 __C)
{
- return (__m256bh)__builtin_ia32_cvtne2ps2bf16_v16hi_maskz(__B, __C, __A);
+ return (__m256bh)__builtin_ia32_cvtne2ps2bf16_v16bf_maskz(__B, __C, __A);
}
extern __inline __m128bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_cvtne2ps_pbh (__m128 __A, __m128 __B)
{
- return (__m128bh)__builtin_ia32_cvtne2ps2bf16_v8hi(__A, __B);
+ return (__m128bh)__builtin_ia32_cvtne2ps2bf16_v8bf(__A, __B);
}
extern __inline __m128bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_cvtne2ps_pbh (__m128bh __A, __mmask8 __B, __m128 __C, __m128 __D)
{
- return (__m128bh)__builtin_ia32_cvtne2ps2bf16_v8hi_mask(__C, __D, __A, __B);
+ return (__m128bh)__builtin_ia32_cvtne2ps2bf16_v8bf_mask(__C, __D, __A, __B);
}
extern __inline __m128bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_maskz_cvtne2ps_pbh (__mmask8 __A, __m128 __B, __m128 __C)
{
- return (__m128bh)__builtin_ia32_cvtne2ps2bf16_v8hi_maskz(__B, __C, __A);
+ return (__m128bh)__builtin_ia32_cvtne2ps2bf16_v8bf_maskz(__B, __C, __A);
}
/* vcvtneps2bf16 */
extern __inline __m128bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_cvtneps_pbh (__m256 __A)
-{
- return (__m128bh)__builtin_ia32_cvtneps2bf16_v8sf(__A);
-}
-
-extern __inline __m128bh
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_cvtneps_pbh (__m128bh __A, __mmask8 __B, __m256 __C)
{
return (__m128bh)__builtin_ia32_cvtneps2bf16_v8sf_mask(__C, __A, __B);
@@ -113,13 +112,6 @@ _mm256_maskz_cvtneps_pbh (__mmask8 __A, __m256 __B)
extern __inline __m128bh
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_cvtneps_pbh (__m128 __A)
-{
- return (__m128bh)__builtin_ia32_cvtneps2bf16_v4sf(__A);
-}
-
-extern __inline __m128bh
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_cvtneps_pbh (__m128bh __A, __mmask8 __B, __m128 __C)
{
return (__m128bh)__builtin_ia32_cvtneps2bf16_v4sf_mask(__C, __A, __B);
@@ -176,13 +168,13 @@ _mm_maskz_dpbf16_ps (__mmask8 __A, __m128 __B, __m128bh __C, __m128bh __D)
return (__m128)__builtin_ia32_dpbf16ps_v4sf_maskz(__B, __C, __D, __A);
}
-extern __inline __bfloat16
+extern __inline __bf16
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_cvtness_sbh (float __A)
{
__v4sf __V = {__A, 0, 0, 0};
- __v8hi __R = __builtin_ia32_cvtneps2bf16_v4sf_mask ((__v4sf)__V,
- (__v8hi)_mm_undefined_si128 (), (__mmask8)-1);
+ __v8bf __R = __builtin_ia32_cvtneps2bf16_v4sf_mask ((__v4sf)__V,
+ (__v8bf)_mm_undefined_si128 (), (__mmask8)-1);
return __R[0];
}
diff --git a/gcc/config/i386/avxneconvertintrin.h b/gcc/config/i386/avxneconvertintrin.h
new file mode 100644
index 0000000..916f00a
--- /dev/null
+++ b/gcc/config/i386/avxneconvertintrin.h
@@ -0,0 +1,140 @@
+/* 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _IMMINTRIN_H_INCLUDED
+#error "Never use <avxneconvertintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef _AVXNECONVERTINTRIN_H_INCLUDED
+#define _AVXNECONVERTINTRIN_H_INCLUDED
+
+#ifndef __AVXNECONVERT__
+#pragma GCC push_options
+#pragma GCC target ("avxneconvert")
+#define __DISABLE_AVXNECONVERT__
+#endif /* __AVXNECONVERT__ */
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_bcstnebf16_ps (const void *__P)
+{
+ return (__m128) __builtin_ia32_vbcstnebf162ps128 ((const __bf16 *) __P);
+}
+
+extern __inline __m256
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_bcstnebf16_ps (const void *__P)
+{
+ return (__m256) __builtin_ia32_vbcstnebf162ps256 ((const __bf16 *) __P);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_bcstnesh_ps (const void *__P)
+{
+ return (__m128) __builtin_ia32_vbcstnesh2ps128 ((const _Float16 *) __P);
+}
+
+extern __inline __m256
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_bcstnesh_ps (const void *__P)
+{
+ return (__m256) __builtin_ia32_vbcstnesh2ps256 ((const _Float16 *) __P);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtneebf16_ps (const __m128bh *__A)
+{
+ return (__m128) __builtin_ia32_vcvtneebf162ps128 ((const __v8bf *) __A);
+}
+
+extern __inline __m256
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtneebf16_ps (const __m256bh *__A)
+{
+ return (__m256) __builtin_ia32_vcvtneebf162ps256 ((const __v16bf *) __A);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtneeph_ps (const __m128h *__A)
+{
+ return (__m128) __builtin_ia32_vcvtneeph2ps128 ((const __v8hf *) __A);
+}
+
+extern __inline __m256
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtneeph_ps (const __m256h *__A)
+{
+ return (__m256) __builtin_ia32_vcvtneeph2ps256 ((const __v16hf *) __A);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtneobf16_ps (const __m128bh *__A)
+{
+ return (__m128) __builtin_ia32_vcvtneobf162ps128 ((const __v8bf *) __A);
+}
+
+extern __inline __m256
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtneobf16_ps (const __m256bh *__A)
+{
+ return (__m256) __builtin_ia32_vcvtneobf162ps256 ((const __v16bf *) __A);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtneoph_ps (const __m128h *__A)
+{
+ return (__m128) __builtin_ia32_vcvtneoph2ps128 ((const __v8hf *) __A);
+}
+
+extern __inline __m256
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtneoph_ps (const __m256h *__A)
+{
+ return (__m256) __builtin_ia32_vcvtneoph2ps256 ((const __v16hf *) __A);
+}
+
+extern __inline __m128bh
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtneps_avx_pbh (__m128 __A)
+{
+ return (__m128bh) __builtin_ia32_cvtneps2bf16_v4sf (__A);
+}
+
+extern __inline __m128bh
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtneps_avx_pbh (__m256 __A)
+{
+ return (__m128bh) __builtin_ia32_cvtneps2bf16_v8sf (__A);
+}
+
+#ifdef __DISABLE_AVXNECONVERT__
+#undef __DISABLE_AVXNECONVERT__
+#pragma GCC pop_options
+#endif /* __DISABLE_AVXNECONVERT__ */
+
+#endif /* _AVXNECONVERTINTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
index f5fad22..18bbc0c 100644
--- a/gcc/config/i386/cpuid.h
+++ b/gcc/config/i386/cpuid.h
@@ -50,6 +50,7 @@
/* %edx */
#define bit_AVXVNNIINT8 (1 << 4)
+#define bit_AVXNECONVERT (1 << 5)
#define bit_CMPXCHG8B (1 << 8)
#define bit_CMOV (1 << 15)
#define bit_MMX (1 << 23)
diff --git a/gcc/config/i386/cygwin-d.cc b/gcc/config/i386/cygwin-d.cc
new file mode 100644
index 0000000..6d70d49
--- /dev/null
+++ b/gcc/config/i386/cygwin-d.cc
@@ -0,0 +1,72 @@
+/* Cygwin support needed only by D front-end.
+ Copyright (C) 2021-2022 Free Software Foundation, Inc.
+
+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/>. */
+
+#define IN_TARGET_CODE 1
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "target.h"
+#include "tm_d.h"
+#include "d/d-target.h"
+#include "d/d-target-def.h"
+
+/* Implement TARGET_D_OS_VERSIONS for Cygwin targets. */
+
+static void
+cygwin_d_os_builtins (void)
+{
+ d_add_builtin_version ("Windows");
+ d_add_builtin_version ("Cygwin");
+ d_add_builtin_version ("Posix");
+ d_add_builtin_version ("CRuntime_Newlib");
+}
+
+/* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
+
+static tree
+cygwin_d_handle_target_object_format (void)
+{
+ const char *objfmt = "coff";
+
+ return build_string_literal (strlen (objfmt) + 1, objfmt);
+}
+
+/* Implement TARGET_D_REGISTER_OS_TARGET_INFO for Cygwin targets. */
+
+static void
+cygwin_d_register_target_info (void)
+{
+ const struct d_target_info_spec handlers[] = {
+ { "objectFormat", cygwin_d_handle_target_object_format },
+ { NULL, NULL },
+ };
+
+ d_add_target_info_handlers (handlers);
+}
+#undef TARGET_D_OS_VERSIONS
+#define TARGET_D_OS_VERSIONS cygwin_d_os_builtins
+
+#undef TARGET_D_REGISTER_OS_TARGET_INFO
+#define TARGET_D_REGISTER_OS_TARGET_INFO cygwin_d_register_target_info
+
+/* Define TARGET_D_TEMPLATES_ALWAYS_COMDAT for Cygwin targets. */
+
+#undef TARGET_D_TEMPLATES_ALWAYS_COMDAT
+#define TARGET_D_TEMPLATES_ALWAYS_COMDAT true
+
+struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index d06eda3..0a604d6 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -29,15 +29,6 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-#define EXTRA_TARGET_D_OS_VERSIONS() \
- do \
- { \
- builtin_version ("Cygwin"); \
- builtin_version ("Posix"); \
- builtin_version ("CRuntime_Newlib"); \
- } \
- while (0)
-
#undef CPP_SPEC
#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
%{!ansi:-Dunix} \
diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def
index 63a360b..abbb50b 100644
--- a/gcc/config/i386/i386-builtin-types.def
+++ b/gcc/config/i386/i386-builtin-types.def
@@ -87,6 +87,7 @@ DEF_VECTOR_TYPE (V8QI, QI)
DEF_VECTOR_TYPE (V2DF, DOUBLE)
DEF_VECTOR_TYPE (V4SF, FLOAT)
DEF_VECTOR_TYPE (V8HF, FLOAT16)
+DEF_VECTOR_TYPE (V8BF, BFLOAT16)
DEF_VECTOR_TYPE (V2DI, DI)
DEF_VECTOR_TYPE (V4SI, SI)
DEF_VECTOR_TYPE (V8HI, HI)
@@ -100,6 +101,7 @@ DEF_VECTOR_TYPE (V16UQI, UQI, V16QI)
DEF_VECTOR_TYPE (V4DF, DOUBLE)
DEF_VECTOR_TYPE (V8SF, FLOAT)
DEF_VECTOR_TYPE (V16HF, FLOAT16)
+DEF_VECTOR_TYPE (V16BF, BFLOAT16)
DEF_VECTOR_TYPE (V4DI, DI)
DEF_VECTOR_TYPE (V8SI, SI)
DEF_VECTOR_TYPE (V16HI, HI)
@@ -111,6 +113,7 @@ DEF_VECTOR_TYPE (V16UHI, UHI, V16HI)
# AVX512F vectors
DEF_VECTOR_TYPE (V32SF, FLOAT)
DEF_VECTOR_TYPE (V32HF, FLOAT16)
+DEF_VECTOR_TYPE (V32BF, BFLOAT16)
DEF_VECTOR_TYPE (V16SF, FLOAT)
DEF_VECTOR_TYPE (V8DF, DOUBLE)
DEF_VECTOR_TYPE (V8DI, DI)
@@ -136,6 +139,7 @@ DEF_POINTER_TYPE (PVOID, VOID)
DEF_POINTER_TYPE (PDOUBLE, DOUBLE)
DEF_POINTER_TYPE (PFLOAT, FLOAT)
DEF_POINTER_TYPE (PCFLOAT16, FLOAT16, CONST)
+DEF_POINTER_TYPE (PCBFLOAT16, BFLOAT16, CONST)
DEF_POINTER_TYPE (PSHORT, SHORT)
DEF_POINTER_TYPE (PUSHORT, USHORT)
DEF_POINTER_TYPE (PINT, INT)
@@ -179,6 +183,10 @@ DEF_POINTER_TYPE (PCV4DF, V4DF, CONST)
DEF_POINTER_TYPE (PCV4SF, V4SF, CONST)
DEF_POINTER_TYPE (PCV8DF, V8DF, CONST)
DEF_POINTER_TYPE (PCV8SF, V8SF, CONST)
+DEF_POINTER_TYPE (PCV8HF, V8HF, CONST)
+DEF_POINTER_TYPE (PCV8BF, V8BF, CONST)
+DEF_POINTER_TYPE (PCV16HF, V16HF, CONST)
+DEF_POINTER_TYPE (PCV16BF, V16BF, CONST)
DEF_POINTER_TYPE (PCV16SF, V16SF, CONST)
DEF_POINTER_TYPE (PCV2DI, V2DI, CONST)
@@ -1273,30 +1281,30 @@ DEF_FUNCTION_TYPE (V4SI, V4SI, V4SI, UHI)
DEF_FUNCTION_TYPE (V8SI, V8SI, V8SI, UHI)
# BF16 builtins
-DEF_FUNCTION_TYPE (V32HI, V16SF, V16SF)
-DEF_FUNCTION_TYPE (V32HI, V16SF, V16SF, V32HI, USI)
-DEF_FUNCTION_TYPE (V32HI, V16SF, V16SF, USI)
-DEF_FUNCTION_TYPE (V16HI, V8SF, V8SF)
-DEF_FUNCTION_TYPE (V16HI, V8SF, V8SF, V16HI, UHI)
-DEF_FUNCTION_TYPE (V16HI, V8SF, V8SF, UHI)
-DEF_FUNCTION_TYPE (V8HI, V4SF, V4SF)
-DEF_FUNCTION_TYPE (V8HI, V4SF, V4SF, V8HI, UQI)
-DEF_FUNCTION_TYPE (V8HI, V4SF, V4SF, UQI)
-DEF_FUNCTION_TYPE (V16HI, V16SF)
-DEF_FUNCTION_TYPE (V16HI, V16SF, V16HI, UHI)
-DEF_FUNCTION_TYPE (V16HI, V16SF, UHI)
-DEF_FUNCTION_TYPE (V8HI, V8SF)
-DEF_FUNCTION_TYPE (V8HI, V8SF, V8HI, UQI)
-DEF_FUNCTION_TYPE (V8HI, V8SF, UQI)
-DEF_FUNCTION_TYPE (V8HI, V4SF)
-DEF_FUNCTION_TYPE (V8HI, V4SF, V8HI, UQI)
-DEF_FUNCTION_TYPE (V8HI, V4SF, UQI)
-DEF_FUNCTION_TYPE (V16SF, V16SF, V32HI, V32HI)
-DEF_FUNCTION_TYPE (V16SF, V16SF, V32HI, V32HI, UHI)
-DEF_FUNCTION_TYPE (V8SF, V8SF, V16HI, V16HI)
-DEF_FUNCTION_TYPE (V8SF, V8SF, V16HI, V16HI, UQI)
-DEF_FUNCTION_TYPE (V4SF, V4SF, V8HI, V8HI)
-DEF_FUNCTION_TYPE (V4SF, V4SF, V8HI, V8HI, UQI)
+DEF_FUNCTION_TYPE (V32BF, V16SF, V16SF)
+DEF_FUNCTION_TYPE (V32BF, V16SF, V16SF, V32BF, USI)
+DEF_FUNCTION_TYPE (V32BF, V16SF, V16SF, USI)
+DEF_FUNCTION_TYPE (V16BF, V8SF, V8SF)
+DEF_FUNCTION_TYPE (V16BF, V8SF, V8SF, V16BF, UHI)
+DEF_FUNCTION_TYPE (V16BF, V8SF, V8SF, UHI)
+DEF_FUNCTION_TYPE (V8BF, V4SF, V4SF)
+DEF_FUNCTION_TYPE (V8BF, V4SF, V4SF, V8BF, UQI)
+DEF_FUNCTION_TYPE (V8BF, V4SF, V4SF, UQI)
+DEF_FUNCTION_TYPE (V16BF, V16SF)
+DEF_FUNCTION_TYPE (V16BF, V16SF, V16BF, UHI)
+DEF_FUNCTION_TYPE (V16BF, V16SF, UHI)
+DEF_FUNCTION_TYPE (V8BF, V8SF)
+DEF_FUNCTION_TYPE (V8BF, V8SF, V8BF, UQI)
+DEF_FUNCTION_TYPE (V8BF, V8SF, UQI)
+DEF_FUNCTION_TYPE (V8BF, V4SF)
+DEF_FUNCTION_TYPE (V8BF, V4SF, V8BF, UQI)
+DEF_FUNCTION_TYPE (V8BF, V4SF, UQI)
+DEF_FUNCTION_TYPE (V16SF, V16SF, V32BF, V32BF)
+DEF_FUNCTION_TYPE (V16SF, V16SF, V32BF, V32BF, UHI)
+DEF_FUNCTION_TYPE (V8SF, V8SF, V16BF, V16BF)
+DEF_FUNCTION_TYPE (V8SF, V8SF, V16BF, V16BF, UQI)
+DEF_FUNCTION_TYPE (V4SF, V4SF, V8BF, V8BF)
+DEF_FUNCTION_TYPE (V4SF, V4SF, V8BF, V8BF, UQI)
# KEYLOCKER builtins
DEF_FUNCTION_TYPE (UINT, UINT, V2DI, V2DI, PVOID)
@@ -1389,3 +1397,13 @@ DEF_FUNCTION_TYPE (V32HF, V32HF)
DEF_FUNCTION_TYPE_ALIAS (V8HF_FTYPE_V8HF, ROUND)
DEF_FUNCTION_TYPE_ALIAS (V16HF_FTYPE_V16HF, ROUND)
DEF_FUNCTION_TYPE_ALIAS (V32HF_FTYPE_V32HF, ROUND)
+
+# AVXNECONVERT builtins
+DEF_FUNCTION_TYPE (V4SF, PCBFLOAT16)
+DEF_FUNCTION_TYPE (V8SF, PCBFLOAT16)
+DEF_FUNCTION_TYPE (V4SF, PCFLOAT16)
+DEF_FUNCTION_TYPE (V8SF, PCFLOAT16)
+DEF_FUNCTION_TYPE (V4SF, PCV8HF)
+DEF_FUNCTION_TYPE (V8SF, PCV16HF)
+DEF_FUNCTION_TYPE (V4SF, PCV8BF)
+DEF_FUNCTION_TYPE (V8SF, PCV16BF)
diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def
index e35306e..9345b8c 100644
--- a/gcc/config/i386/i386-builtin.def
+++ b/gcc/config/i386/i386-builtin.def
@@ -274,6 +274,20 @@ BDESC (OPTION_MASK_ISA_RTM, 0, CODE_FOR_xbegin, "__builtin_ia32_xbegin", IX86_BU
BDESC (OPTION_MASK_ISA_RTM, 0, CODE_FOR_xend, "__builtin_ia32_xend", IX86_BUILTIN_XEND, UNKNOWN, (int) VOID_FTYPE_VOID)
BDESC (OPTION_MASK_ISA_RTM, 0, CODE_FOR_xtest, "__builtin_ia32_xtest", IX86_BUILTIN_XTEST, UNKNOWN, (int) INT_FTYPE_VOID)
+/* AVX-NE-CONVERT */
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vbcstnebf162ps_v4sf, "__builtin_ia32_vbcstnebf162ps128", IX86_BUILTIN_VBCSTNEBF162PS128, UNKNOWN, (int) V4SF_FTYPE_PCBFLOAT16)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vbcstnebf162ps_v8sf, "__builtin_ia32_vbcstnebf162ps256", IX86_BUILTIN_VBCSTNEBF162PS256, UNKNOWN, (int) V8SF_FTYPE_PCBFLOAT16)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vbcstnesh2ps_v4sf, "__builtin_ia32_vbcstnesh2ps128", IX86_BUILTIN_VBCSTNESH2PS128, UNKNOWN, (int) V4SF_FTYPE_PCFLOAT16)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vbcstnesh2ps_v8sf, "__builtin_ia32_vbcstnesh2ps256", IX86_BUILTIN_VBCSTNESH2PS256, UNKNOWN, (int) V8SF_FTYPE_PCFLOAT16)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneebf162ps_v8bf, "__builtin_ia32_vcvtneebf162ps128", IX86_BUILTIN_VCVTNEEBF162PS128, UNKNOWN, (int) V4SF_FTYPE_PCV8BF)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneebf162ps_v16bf, "__builtin_ia32_vcvtneebf162ps256", IX86_BUILTIN_VCVTNEEBF162PS256, UNKNOWN, (int) V8SF_FTYPE_PCV16BF)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneeph2ps_v8hf, "__builtin_ia32_vcvtneeph2ps128", IX86_BUILTIN_VCVTNEEPH2PS128, UNKNOWN, (int) V4SF_FTYPE_PCV8HF)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneeph2ps_v16hf, "__builtin_ia32_vcvtneeph2ps256", IX86_BUILTIN_VCVTNEEPH2PS256, UNKNOWN, (int) V8SF_FTYPE_PCV16HF)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneobf162ps_v8bf, "__builtin_ia32_vcvtneobf162ps128", IX86_BUILTIN_VCVTNEOBF162PS128, UNKNOWN, (int) V4SF_FTYPE_PCV8BF)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneobf162ps_v16bf, "__builtin_ia32_vcvtneobf162ps256", IX86_BUILTIN_VCVTNEOBF162PS256, UNKNOWN, (int) V8SF_FTYPE_PCV16BF)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneoph2ps_v8hf, "__builtin_ia32_vcvtneoph2ps128", IX86_BUILTIN_VCVTNEOPH2PS128, UNKNOWN, (int) V4SF_FTYPE_PCV8HF)
+BDESC (0, OPTION_MASK_ISA2_AVXNECONVERT, CODE_FOR_vcvtneoph2ps_v16hf, "__builtin_ia32_vcvtneoph2ps256", IX86_BUILTIN_VCVTNEOPH2PS256, UNKNOWN, (int) V8SF_FTYPE_PCV16HF)
+
/* AVX512BW */
BDESC (OPTION_MASK_ISA_AVX512BW, 0, CODE_FOR_avx512bw_loadv32hi_mask, "__builtin_ia32_loaddquhi512_mask", IX86_BUILTIN_LOADDQUHI512_MASK, UNKNOWN, (int) V32HI_FTYPE_PCSHORT_V32HI_USI)
BDESC (OPTION_MASK_ISA_AVX512BW, 0, CODE_FOR_avx512bw_loadv64qi_mask, "__builtin_ia32_loaddquqi512_mask", IX86_BUILTIN_LOADDQUQI512_MASK, UNKNOWN, (int) V64QI_FTYPE_PCCHAR_V64QI_UDI)
@@ -2779,33 +2793,33 @@ BDESC (0, OPTION_MASK_ISA2_VAES, CODE_FOR_vaesenclast_v32qi, "__builtin_ia32_vae
BDESC (0, OPTION_MASK_ISA2_VAES, CODE_FOR_vaesenclast_v64qi, "__builtin_ia32_vaesenclast_v64qi", IX86_BUILTIN_VAESENCLAST64, UNKNOWN, (int) V64QI_FTYPE_V64QI_V64QI)
/* BF16 */
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v32hi, "__builtin_ia32_cvtne2ps2bf16_v32hi", IX86_BUILTIN_CVTNE2PS2HI16_V32HI, UNKNOWN, (int) V32HI_FTYPE_V16SF_V16SF)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v32hi_mask, "__builtin_ia32_cvtne2ps2bf16_v32hi_mask", IX86_BUILTIN_CVTNE2PS2HI16_V32HI_MASK, UNKNOWN, (int) V32HI_FTYPE_V16SF_V16SF_V32HI_USI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v32hi_maskz, "__builtin_ia32_cvtne2ps2bf16_v32hi_maskz", IX86_BUILTIN_CVTNE2PS2HI16_V32HI_MASKZ, UNKNOWN, (int) V32HI_FTYPE_V16SF_V16SF_USI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v16hi, "__builtin_ia32_cvtne2ps2bf16_v16hi", IX86_BUILTIN_CVTNE2PS2HI16_V16HI, UNKNOWN, (int) V16HI_FTYPE_V8SF_V8SF)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v16hi_mask, "__builtin_ia32_cvtne2ps2bf16_v16hi_mask", IX86_BUILTIN_CVTNE2PS2HI16_V16HI_MASK, UNKNOWN, (int) V16HI_FTYPE_V8SF_V8SF_V16HI_UHI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v16hi_maskz, "__builtin_ia32_cvtne2ps2bf16_v16hi_maskz", IX86_BUILTIN_CVTNE2PS2HI16_V16HI_MASKZ, UNKNOWN, (int) V16HI_FTYPE_V8SF_V8SF_UHI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v8hi, "__builtin_ia32_cvtne2ps2bf16_v8hi", IX86_BUILTIN_CVTNE2PS2HI16_V8HI, UNKNOWN, (int) V8HI_FTYPE_V4SF_V4SF)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v8hi_mask, "__builtin_ia32_cvtne2ps2bf16_v8hi_mask", IX86_BUILTIN_CVTNE2PS2HI16_V8HI_MASK, UNKNOWN, (int) V8HI_FTYPE_V4SF_V4SF_V8HI_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v8hi_maskz, "__builtin_ia32_cvtne2ps2bf16_v8hi_maskz", IX86_BUILTIN_CVTNE2PS2HI16_V8HI_MASKZ, UNKNOWN, (int) V8HI_FTYPE_V4SF_V4SF_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v16sf, "__builtin_ia32_cvtneps2bf16_v16sf", IX86_BUILTIN_CVTNEPS2HI16_V16SF, UNKNOWN, (int) V16HI_FTYPE_V16SF)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v16sf_mask, "__builtin_ia32_cvtneps2bf16_v16sf_mask", IX86_BUILTIN_CVTNEPS2HI16_V16SF_MASK, UNKNOWN, (int) V16HI_FTYPE_V16SF_V16HI_UHI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v16sf_maskz, "__builtin_ia32_cvtneps2bf16_v16sf_maskz", IX86_BUILTIN_CVTNE2PS2HI16_V16SF_MASKZ, UNKNOWN, (int) V16HI_FTYPE_V16SF_UHI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v8sf, "__builtin_ia32_cvtneps2bf16_v8sf", IX86_BUILTIN_CVTNEPS2HI16_V8SF, UNKNOWN, (int) V8HI_FTYPE_V8SF)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v8sf_mask, "__builtin_ia32_cvtneps2bf16_v8sf_mask", IX86_BUILTIN_CVTNEPS2HI16_V8SF_MASK, UNKNOWN, (int) V8HI_FTYPE_V8SF_V8HI_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v8sf_maskz, "__builtin_ia32_cvtneps2bf16_v8sf_maskz", IX86_BUILTIN_CVTNE2PS2HI16_V8SF_MASKZ, UNKNOWN, (int) V8HI_FTYPE_V8SF_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v4sf, "__builtin_ia32_cvtneps2bf16_v4sf", IX86_BUILTIN_CVTNEPS2HI16_V4SF, UNKNOWN, (int) V8HI_FTYPE_V4SF)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v4sf_mask, "__builtin_ia32_cvtneps2bf16_v4sf_mask", IX86_BUILTIN_CVTNEPS2HI16_V4SF_MASK, UNKNOWN, (int) V8HI_FTYPE_V4SF_V8HI_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v4sf_maskz, "__builtin_ia32_cvtneps2bf16_v4sf_maskz", IX86_BUILTIN_CVTNE2PS2HI16_V4SF_MASKZ, UNKNOWN, (int) V8HI_FTYPE_V4SF_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v16sf, "__builtin_ia32_dpbf16ps_v16sf", IX86_BUILTIN_DPHI16PS_V16SF, UNKNOWN, (int) V16SF_FTYPE_V16SF_V32HI_V32HI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v16sf_mask, "__builtin_ia32_dpbf16ps_v16sf_mask", IX86_BUILTIN_DPHI16PS_V16SF_MASK, UNKNOWN, (int) V16SF_FTYPE_V16SF_V32HI_V32HI_UHI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v16sf_maskz, "__builtin_ia32_dpbf16ps_v16sf_maskz", IX86_BUILTIN_DPHI16PS_V16SF_MASKZ, UNKNOWN, (int) V16SF_FTYPE_V16SF_V32HI_V32HI_UHI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v8sf, "__builtin_ia32_dpbf16ps_v8sf", IX86_BUILTIN_DPHI16PS_V8SF, UNKNOWN, (int) V8SF_FTYPE_V8SF_V16HI_V16HI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v8sf_mask, "__builtin_ia32_dpbf16ps_v8sf_mask", IX86_BUILTIN_DPHI16PS_V8SF_MASK, UNKNOWN, (int) V8SF_FTYPE_V8SF_V16HI_V16HI_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v8sf_maskz, "__builtin_ia32_dpbf16ps_v8sf_maskz", IX86_BUILTIN_DPHI16PS_V8SF_MASKZ, UNKNOWN, (int) V8SF_FTYPE_V8SF_V16HI_V16HI_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v4sf, "__builtin_ia32_dpbf16ps_v4sf", IX86_BUILTIN_DPHI16PS_V4SF, UNKNOWN, (int) V4SF_FTYPE_V4SF_V8HI_V8HI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v4sf_mask, "__builtin_ia32_dpbf16ps_v4sf_mask", IX86_BUILTIN_DPHI16PS_V4SF_MASK, UNKNOWN, (int) V4SF_FTYPE_V4SF_V8HI_V8HI_UQI)
-BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v4sf_maskz, "__builtin_ia32_dpbf16ps_v4sf_maskz", IX86_BUILTIN_DPHI16PS_V4SF_MASKZ, UNKNOWN, (int) V4SF_FTYPE_V4SF_V8HI_V8HI_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v32bf, "__builtin_ia32_cvtne2ps2bf16_v32bf", IX86_BUILTIN_CVTNE2PS2BF16_V32BF, UNKNOWN, (int) V32BF_FTYPE_V16SF_V16SF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v32bf_mask, "__builtin_ia32_cvtne2ps2bf16_v32bf_mask", IX86_BUILTIN_CVTNE2PS2BF16_V32BF_MASK, UNKNOWN, (int) V32BF_FTYPE_V16SF_V16SF_V32BF_USI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v32bf_maskz, "__builtin_ia32_cvtne2ps2bf16_v32bf_maskz", IX86_BUILTIN_CVTNE2PS2BF16_V32BF_MASKZ, UNKNOWN, (int) V32BF_FTYPE_V16SF_V16SF_USI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v16bf, "__builtin_ia32_cvtne2ps2bf16_v16bf", IX86_BUILTIN_CVTNE2PS2BF16_V16BF, UNKNOWN, (int) V16BF_FTYPE_V8SF_V8SF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v16bf_mask, "__builtin_ia32_cvtne2ps2bf16_v16bf_mask", IX86_BUILTIN_CVTNE2PS2BF16_V16BF_MASK, UNKNOWN, (int) V16BF_FTYPE_V8SF_V8SF_V16BF_UHI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v16bf_maskz, "__builtin_ia32_cvtne2ps2bf16_v16bf_maskz", IX86_BUILTIN_CVTNE2PS2BF16_V16BF_MASKZ, UNKNOWN, (int) V16BF_FTYPE_V8SF_V8SF_UHI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v8bf, "__builtin_ia32_cvtne2ps2bf16_v8bf", IX86_BUILTIN_CVTNE2PS2BF16_V8BF, UNKNOWN, (int) V8BF_FTYPE_V4SF_V4SF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v8bf_mask, "__builtin_ia32_cvtne2ps2bf16_v8bf_mask", IX86_BUILTIN_CVTNE2PS2BF16_V8BF_MASK, UNKNOWN, (int) V8BF_FTYPE_V4SF_V4SF_V8BF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtne2ps2bf16_v8bf_maskz, "__builtin_ia32_cvtne2ps2bf16_v8bf_maskz", IX86_BUILTIN_CVTNE2PS2BF16_V8BF_MASKZ, UNKNOWN, (int) V8BF_FTYPE_V4SF_V4SF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v16sf, "__builtin_ia32_cvtneps2bf16_v16sf", IX86_BUILTIN_CVTNEPS2BF16_V16SF, UNKNOWN, (int) V16BF_FTYPE_V16SF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v16sf_mask, "__builtin_ia32_cvtneps2bf16_v16sf_mask", IX86_BUILTIN_CVTNEPS2BF16_V16SF_MASK, UNKNOWN, (int) V16BF_FTYPE_V16SF_V16BF_UHI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v16sf_maskz, "__builtin_ia32_cvtneps2bf16_v16sf_maskz", IX86_BUILTIN_CVTNE2PS2BF16_V16SF_MASKZ, UNKNOWN, (int) V16BF_FTYPE_V16SF_UHI)
+BDESC (OPTION_MASK_ISA_AVX512VL, OPTION_MASK_ISA2_AVXNECONVERT | OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_vcvtneps2bf16_v8sf, "__builtin_ia32_cvtneps2bf16_v8sf", IX86_BUILTIN_CVTNEPS2BF16_V8SF, UNKNOWN, (int) V8BF_FTYPE_V8SF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v8sf_mask, "__builtin_ia32_cvtneps2bf16_v8sf_mask", IX86_BUILTIN_CVTNEPS2BF16_V8SF_MASK, UNKNOWN, (int) V8BF_FTYPE_V8SF_V8BF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v8sf_maskz, "__builtin_ia32_cvtneps2bf16_v8sf_maskz", IX86_BUILTIN_CVTNE2PS2BF16_V8SF_MASKZ, UNKNOWN, (int) V8BF_FTYPE_V8SF_UQI)
+BDESC (OPTION_MASK_ISA_AVX512VL, OPTION_MASK_ISA2_AVXNECONVERT | OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_vcvtneps2bf16_v4sf, "__builtin_ia32_cvtneps2bf16_v4sf", IX86_BUILTIN_CVTNEPS2BF16_V4SF, UNKNOWN, (int) V8BF_FTYPE_V4SF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v4sf_mask, "__builtin_ia32_cvtneps2bf16_v4sf_mask", IX86_BUILTIN_CVTNEPS2BF16_V4SF_MASK, UNKNOWN, (int) V8BF_FTYPE_V4SF_V8BF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_cvtneps2bf16_v4sf_maskz, "__builtin_ia32_cvtneps2bf16_v4sf_maskz", IX86_BUILTIN_CVTNE2PS2BF16_V4SF_MASKZ, UNKNOWN, (int) V8BF_FTYPE_V4SF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v16sf, "__builtin_ia32_dpbf16ps_v16sf", IX86_BUILTIN_DPBF16PS_V16SF, UNKNOWN, (int) V16SF_FTYPE_V16SF_V32BF_V32BF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v16sf_mask, "__builtin_ia32_dpbf16ps_v16sf_mask", IX86_BUILTIN_DPBF16PS_V16SF_MASK, UNKNOWN, (int) V16SF_FTYPE_V16SF_V32BF_V32BF_UHI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v16sf_maskz, "__builtin_ia32_dpbf16ps_v16sf_maskz", IX86_BUILTIN_DPBF16PS_V16SF_MASKZ, UNKNOWN, (int) V16SF_FTYPE_V16SF_V32BF_V32BF_UHI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v8sf, "__builtin_ia32_dpbf16ps_v8sf", IX86_BUILTIN_DPBF16PS_V8SF, UNKNOWN, (int) V8SF_FTYPE_V8SF_V16BF_V16BF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v8sf_mask, "__builtin_ia32_dpbf16ps_v8sf_mask", IX86_BUILTIN_DPBF16PS_V8SF_MASK, UNKNOWN, (int) V8SF_FTYPE_V8SF_V16BF_V16BF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v8sf_maskz, "__builtin_ia32_dpbf16ps_v8sf_maskz", IX86_BUILTIN_DPBF16PS_V8SF_MASKZ, UNKNOWN, (int) V8SF_FTYPE_V8SF_V16BF_V16BF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v4sf, "__builtin_ia32_dpbf16ps_v4sf", IX86_BUILTIN_DPBF16PS_V4SF, UNKNOWN, (int) V4SF_FTYPE_V4SF_V8BF_V8BF)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v4sf_mask, "__builtin_ia32_dpbf16ps_v4sf_mask", IX86_BUILTIN_DPBF16PS_V4SF_MASK, UNKNOWN, (int) V4SF_FTYPE_V4SF_V8BF_V8BF_UQI)
+BDESC (0, OPTION_MASK_ISA2_AVX512BF16, CODE_FOR_avx512f_dpbf16ps_v4sf_maskz, "__builtin_ia32_dpbf16ps_v4sf_maskz", IX86_BUILTIN_DPBF16PS_V4SF_MASKZ, UNKNOWN, (int) V4SF_FTYPE_V4SF_V8BF_V8BF_UQI)
/* AVX512FP16. */
BDESC (OPTION_MASK_ISA_AVX512VL, OPTION_MASK_ISA2_AVX512FP16, CODE_FOR_addv8hf3_mask, "__builtin_ia32_addph128_mask", IX86_BUILTIN_ADDPH128_MASK, UNKNOWN, (int) V8HF_FTYPE_V8HF_V8HF_V8HF_UQI)
diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc
index f70f891..fa195e73 100644
--- a/gcc/config/i386/i386-c.cc
+++ b/gcc/config/i386/i386-c.cc
@@ -644,6 +644,8 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
def_or_undef (parse_in, "__AVXIFMA__");
if (isa_flag2 & OPTION_MASK_ISA2_AVXVNNIINT8)
def_or_undef (parse_in, "__AVXVNNIINT8__");
+ if (isa_flag2 & OPTION_MASK_ISA2_AVXNECONVERT)
+ def_or_undef (parse_in, "__AVXNECONVERT__");
if (TARGET_IAMCU)
{
def_or_undef (parse_in, "__iamcu");
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 5d9e5a1..7d17bfe 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -10462,9 +10462,9 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case V8DF_FTYPE_V2DF:
case V8DF_FTYPE_V8DF:
case V4DI_FTYPE_V4DI:
- case V16HI_FTYPE_V16SF:
- case V8HI_FTYPE_V8SF:
- case V8HI_FTYPE_V4SF:
+ case V16BF_FTYPE_V16SF:
+ case V8BF_FTYPE_V8SF:
+ case V8BF_FTYPE_V4SF:
nargs = 1;
break;
case V4SF_FTYPE_V4SF_VEC_MERGE:
@@ -10592,12 +10592,12 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case USI_FTYPE_USI_USI:
case UDI_FTYPE_UDI_UDI:
case V16SI_FTYPE_V8DF_V8DF:
- case V32HI_FTYPE_V16SF_V16SF:
- case V16HI_FTYPE_V8SF_V8SF:
- case V8HI_FTYPE_V4SF_V4SF:
- case V16HI_FTYPE_V16SF_UHI:
- case V8HI_FTYPE_V8SF_UQI:
- case V8HI_FTYPE_V4SF_UQI:
+ case V32BF_FTYPE_V16SF_V16SF:
+ case V16BF_FTYPE_V8SF_V8SF:
+ case V8BF_FTYPE_V4SF_V4SF:
+ case V16BF_FTYPE_V16SF_UHI:
+ case V8BF_FTYPE_V8SF_UQI:
+ case V8BF_FTYPE_V4SF_UQI:
nargs = 2;
break;
case V2DI_FTYPE_V2DI_INT_CONVERT:
@@ -10803,15 +10803,15 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case V16HI_FTYPE_V16HI_V16HI_V16HI:
case V8SI_FTYPE_V8SI_V8SI_V8SI:
case V8HI_FTYPE_V8HI_V8HI_V8HI:
- case V32HI_FTYPE_V16SF_V16SF_USI:
- case V16HI_FTYPE_V8SF_V8SF_UHI:
- case V8HI_FTYPE_V4SF_V4SF_UQI:
- case V16HI_FTYPE_V16SF_V16HI_UHI:
- case V8HI_FTYPE_V8SF_V8HI_UQI:
- case V8HI_FTYPE_V4SF_V8HI_UQI:
- case V16SF_FTYPE_V16SF_V32HI_V32HI:
- case V8SF_FTYPE_V8SF_V16HI_V16HI:
- case V4SF_FTYPE_V4SF_V8HI_V8HI:
+ case V32BF_FTYPE_V16SF_V16SF_USI:
+ case V16BF_FTYPE_V8SF_V8SF_UHI:
+ case V8BF_FTYPE_V4SF_V4SF_UQI:
+ case V16BF_FTYPE_V16SF_V16BF_UHI:
+ case V8BF_FTYPE_V8SF_V8BF_UQI:
+ case V8BF_FTYPE_V4SF_V8BF_UQI:
+ case V16SF_FTYPE_V16SF_V32BF_V32BF:
+ case V8SF_FTYPE_V8SF_V16BF_V16BF:
+ case V4SF_FTYPE_V4SF_V8BF_V8BF:
nargs = 3;
break;
case V32QI_FTYPE_V32QI_V32QI_INT:
@@ -10958,9 +10958,9 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case V16HI_FTYPE_V32QI_V32QI_V16HI_UHI:
case V8SI_FTYPE_V16HI_V16HI_V8SI_UQI:
case V4SI_FTYPE_V8HI_V8HI_V4SI_UQI:
- case V32HI_FTYPE_V16SF_V16SF_V32HI_USI:
- case V16HI_FTYPE_V8SF_V8SF_V16HI_UHI:
- case V8HI_FTYPE_V4SF_V4SF_V8HI_UQI:
+ case V32BF_FTYPE_V16SF_V16SF_V32BF_USI:
+ case V16BF_FTYPE_V8SF_V8SF_V16BF_UHI:
+ case V8BF_FTYPE_V4SF_V4SF_V8BF_UQI:
nargs = 4;
break;
case V2DF_FTYPE_V2DF_V2DF_V2DI_INT:
@@ -10998,9 +10998,9 @@ ix86_expand_args_builtin (const struct builtin_description *d,
break;
case UCHAR_FTYPE_UCHAR_UINT_UINT_PUNSIGNED:
case UCHAR_FTYPE_UCHAR_ULONGLONG_ULONGLONG_PULONGLONG:
- case V16SF_FTYPE_V16SF_V32HI_V32HI_UHI:
- case V8SF_FTYPE_V8SF_V16HI_V16HI_UQI:
- case V4SF_FTYPE_V4SF_V8HI_V8HI_UQI:
+ case V16SF_FTYPE_V16SF_V32BF_V32BF_UHI:
+ case V8SF_FTYPE_V8SF_V16BF_V16BF_UQI:
+ case V4SF_FTYPE_V4SF_V8BF_V8BF_UQI:
nargs = 4;
break;
case UQI_FTYPE_V8DI_V8DI_INT_UQI:
@@ -11897,6 +11897,14 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
case V8SF_FTYPE_PCV4SF:
case V8SF_FTYPE_PCFLOAT:
case V4SF_FTYPE_PCFLOAT:
+ case V4SF_FTYPE_PCFLOAT16:
+ case V4SF_FTYPE_PCBFLOAT16:
+ case V4SF_FTYPE_PCV8BF:
+ case V4SF_FTYPE_PCV8HF:
+ case V8SF_FTYPE_PCFLOAT16:
+ case V8SF_FTYPE_PCBFLOAT16:
+ case V8SF_FTYPE_PCV16HF:
+ case V8SF_FTYPE_PCV16BF:
case V4DF_FTYPE_PCV2DF:
case V4DF_FTYPE_PCDOUBLE:
case V2DF_FTYPE_PCDOUBLE:
@@ -12406,6 +12414,8 @@ ix86_check_builtin_isa_match (unsigned int fcode,
OPTION_MASK_ISA2_AVXVNNI
(OPTION_MASK_ISA_AVX512IFMA | OPTION_MASK_ISA_AVX512IFMA) or
OPTION_MASK_ISA2_AVXIFMA
+ (OPTION_MASK_ISA_AVXNECONVERT | OPTION_MASK_ISA2_AVX512BF16) or
+ OPTION_MASK_ISA2_AVXNECONVERT
where for each such pair it is sufficient if either of the ISAs is
enabled, plus if it is ored with other options also those others.
OPTION_MASK_ISA_MMX in bisa is satisfied also if TARGET_MMX_WITH_SSE. */
@@ -12446,6 +12456,17 @@ ix86_check_builtin_isa_match (unsigned int fcode,
isa2 |= OPTION_MASK_ISA2_AVXIFMA;
}
+ if ((((bisa & OPTION_MASK_ISA_AVX512VL) != 0
+ && (bisa2 & OPTION_MASK_ISA2_AVX512BF16) != 0)
+ && (bisa2 & OPTION_MASK_ISA2_AVXNECONVERT) != 0)
+ && (((isa & OPTION_MASK_ISA_AVX512VL) != 0
+ && (isa2 & OPTION_MASK_ISA2_AVX512BF16) != 0)
+ || (isa2 & OPTION_MASK_ISA2_AVXNECONVERT) != 0))
+ {
+ isa |= OPTION_MASK_ISA_AVX512VL;
+ isa2 |= OPTION_MASK_ISA2_AVXNECONVERT | OPTION_MASK_ISA2_AVX512BF16;
+ }
+
if ((bisa & OPTION_MASK_ISA_MMX) && !TARGET_MMX && TARGET_MMX_WITH_SSE
/* __builtin_ia32_maskmovq requires MMX registers. */
&& fcode != IX86_BUILTIN_MASKMOVQ)
diff --git a/gcc/config/i386/i386-isa.def b/gcc/config/i386/i386-isa.def
index c95b917..4ea3f96 100644
--- a/gcc/config/i386/i386-isa.def
+++ b/gcc/config/i386/i386-isa.def
@@ -111,3 +111,4 @@ DEF_PTA(AVXVNNI)
DEF_PTA(AVX512FP16)
DEF_PTA(AVXIFMA)
DEF_PTA(AVXVNNIINT8)
+DEF_PTA(AVXNECONVERT)
diff --git a/gcc/config/i386/i386-modes.def b/gcc/config/i386/i386-modes.def
index b49daae..dbc3165 100644
--- a/gcc/config/i386/i386-modes.def
+++ b/gcc/config/i386/i386-modes.def
@@ -93,6 +93,7 @@ VECTOR_MODES (FLOAT, 64); /* V32HF V16SF V8DF V4TF */
VECTOR_MODES (FLOAT, 128); /* V64HF V32SF V16DF V8TF */
VECTOR_MODES (FLOAT, 256); /* V128HF V64SF V32DF V16TF */
VECTOR_MODE (FLOAT, HF, 2); /* V2HF */
+VECTOR_MODE (FLOAT, BF, 2); /* V2BF */
VECTOR_MODE (FLOAT, HF, 6); /* V6HF */
VECTOR_MODE (INT, TI, 1); /* V1TI */
VECTOR_MODE (INT, DI, 1); /* V1DI */
diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 1f14d69..ef9c888 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -229,7 +229,8 @@ static struct ix86_target_opts isa2_opts[] =
{ "-mavxvnni", OPTION_MASK_ISA2_AVXVNNI },
{ "-mavx512fp16", OPTION_MASK_ISA2_AVX512FP16 },
{ "-mavxifma", OPTION_MASK_ISA2_AVXIFMA },
- { "-mavxvnniint8", OPTION_MASK_ISA2_AVXVNNIINT8 }
+ { "-mavxvnniint8", OPTION_MASK_ISA2_AVXVNNIINT8 },
+ { "-mavxneconvert", OPTION_MASK_ISA2_AVXNECONVERT }
};
static struct ix86_target_opts isa_opts[] =
{
@@ -1078,6 +1079,7 @@ ix86_valid_target_attribute_inner_p (tree fndecl, tree args, char *p_strings[],
IX86_ATTR_ISA ("avx512fp16", OPT_mavx512fp16),
IX86_ATTR_ISA ("avxifma", OPT_mavxifma),
IX86_ATTR_ISA ("avxvnniint8", OPT_mavxvnniint8),
+ IX86_ATTR_ISA ("avxneconvert", OPT_mavxneconvert),
/* enum options */
IX86_ATTR_ENUM ("fpmath=", OPT_mfpmath_),
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index aeea26e..c0f3714 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -2507,7 +2507,9 @@ classify_argument (machine_mode mode, const_tree type,
case E_V2SImode:
case E_V4HImode:
case E_V4HFmode:
+ case E_V4BFmode:
case E_V2HFmode:
+ case E_V2BFmode:
case E_V8QImode:
classes[0] = X86_64_SSE_CLASS;
return 1;
@@ -2991,6 +2993,7 @@ pass_in_reg:
case E_V8QImode:
case E_V4HImode:
case E_V4HFmode:
+ case E_V4BFmode:
case E_V2SImode:
case E_V2SFmode:
case E_V1TImode:
@@ -3240,6 +3243,7 @@ pass_in_reg:
case E_V8QImode:
case E_V4HImode:
case E_V4HFmode:
+ case E_V4BFmode:
case E_V2SImode:
case E_V2SFmode:
case E_V1TImode:
@@ -4559,7 +4563,8 @@ ix86_setup_incoming_varargs (cumulative_args_t cum_v,
/* For varargs, we do not want to skip the dummy va_dcl argument.
For stdargs, we do want to skip the last named argument. */
next_cum = *cum;
- if (stdarg_p (fntype))
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))
+ && stdarg_p (fntype))
ix86_function_arg_advance (pack_cumulative_args (&next_cum), arg);
if (cum->call_abi == MS_ABI)
@@ -15810,7 +15815,9 @@ ix86_convert_const_vector_to_integer (rtx op, machine_mode mode)
}
break;
case E_V2HFmode:
+ case E_V2BFmode:
case E_V4HFmode:
+ case E_V4BFmode:
case E_V2SFmode:
for (int i = 0; i < nunits; ++i)
{
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index fd7c9df..16d9c60 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1033,13 +1033,12 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
|| (MODE) == V8BFmode || (MODE) == TImode)
#define VALID_AVX512FP16_REG_MODE(MODE) \
- ((MODE) == V8HFmode || (MODE) == V16HFmode || (MODE) == V32HFmode \
- || (MODE) == V2HFmode)
+ ((MODE) == V8HFmode || (MODE) == V16HFmode || (MODE) == V32HFmode)
#define VALID_SSE2_REG_MODE(MODE) \
((MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DFmode \
|| (MODE) == V8HFmode || (MODE) == V4HFmode || (MODE) == V2HFmode \
- || (MODE) == V8BFmode \
+ || (MODE) == V8BFmode || (MODE) == V4BFmode || (MODE) == V2BFmode \
|| (MODE) == V4QImode || (MODE) == V2HImode || (MODE) == V1SImode \
|| (MODE) == V2DImode || (MODE) == V2QImode || (MODE) == DFmode \
|| (MODE) == HFmode || (MODE) == BFmode)
@@ -1057,7 +1056,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
((MODE) == V1DImode || (MODE) == DImode \
|| (MODE) == V2SImode || (MODE) == SImode \
|| (MODE) == V4HImode || (MODE) == V8QImode \
- || (MODE) == V4HFmode)
+ || (MODE) == V4HFmode || (MODE) == V4BFmode)
#define VALID_MASK_REG_MODE(MODE) ((MODE) == HImode || (MODE) == QImode)
@@ -1074,7 +1073,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
|| (MODE) == CSImode || (MODE) == CDImode \
|| (MODE) == SDmode || (MODE) == DDmode \
|| (MODE) == HFmode || (MODE) == HCmode || (MODE) == BFmode \
- || (MODE) == V2HImode || (MODE) == V2HFmode \
+ || (MODE) == V2HImode || (MODE) == V2HFmode || (MODE) == V2BFmode \
|| (MODE) == V1SImode || (MODE) == V4QImode || (MODE) == V2QImode \
|| (TARGET_64BIT \
&& ((MODE) == TImode || (MODE) == CTImode \
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index baf1f1f..f28c2a1 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -113,6 +113,7 @@
UNSPEC_PEEPSIB
UNSPEC_INSN_FALSE_DEP
UNSPEC_SBB
+ UNSPEC_CC_NE
;; For SSE/MMX support:
UNSPEC_FIX_NOTRUNC
@@ -500,7 +501,7 @@
;; Main data type used by the insn
(define_attr "mode"
"unknown,none,QI,HI,SI,DI,TI,OI,XI,HF,BF,SF,DF,XF,TF,V32HF,V16HF,V8HF,
- V16SF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF,V8DF,V4HF,V2HF"
+ V16SF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF,V8DF,V4HF,V4BF,V2HF,V2BF"
(const_string "unknown"))
;; The CPU unit operations uses.
@@ -836,7 +837,7 @@
avx,noavx,avx2,noavx2,bmi,bmi2,fma4,fma,avx512f,noavx512f,
avx512bw,noavx512bw,avx512dq,noavx512dq,fma_or_avx512vl,
avx512vl,noavx512vl,avxvnni,avx512vnnivl,avx512fp16,avxifma,
- avx512ifmavl"
+ avx512ifmavl,avxneconvert,avx512bf16vl"
(const_string "base"))
;; Define instruction set of MMX instructions
@@ -895,6 +896,9 @@
(eq_attr "isa" "avxifma") (symbol_ref "TARGET_AVXIFMA")
(eq_attr "isa" "avx512ifmavl")
(symbol_ref "TARGET_AVX512IFMA && TARGET_AVX512VL")
+ (eq_attr "isa" "avxneconvert") (symbol_ref "TARGET_AVXNECONVERT")
+ (eq_attr "isa" "avx512bf16vl")
+ (symbol_ref "TARGET_AVX512BF16 && TARGET_AVX512VL")
(eq_attr "mmx_isa" "native")
(symbol_ref "!TARGET_MMX_WITH_SSE")
@@ -1119,7 +1123,8 @@
(V4SF "16") (V8SF "32") (V16SF "64")
(V8HF "16") (V16HF "32") (V32HF "64")
(V4HF "8") (V2HF "4")
- (V8BF "16") (V16BF "32") (V32BF "64")])
+ (V8BF "16") (V16BF "32") (V32BF "64")
+ (V4BF "8") (V2BF "4")])
;; Double word integer modes as mode attribute.
(define_mode_attr DWI [(QI "HI") (HI "SI") (SI "DI") (DI "TI") (TI "OI")])
@@ -11470,7 +11475,7 @@
"&& reload_completed"
[(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_dup 1) (const_int 0)))
+ (unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 0) (neg:DWIH (match_dup 1)))])
(parallel
[(set (match_dup 2)
@@ -11499,7 +11504,8 @@
(match_operand:SWI48 1 "nonimmediate_gr_operand"))
(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_operand:SWI48 2 "general_reg_operand") (const_int 0)))
+ (unspec:CCC [(match_operand:SWI48 2 "general_reg_operand")
+ (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 2) (neg:SWI48 (match_dup 2)))])
(parallel
[(set (match_dup 0)
@@ -11517,7 +11523,7 @@
&& !reg_mentioned_p (operands[2], operands[1])"
[(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_dup 2) (const_int 0)))
+ (unspec:CCC [(match_dup 2) (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 2) (neg:SWI48 (match_dup 2)))])
(parallel
[(set (match_dup 0)
@@ -11543,7 +11549,8 @@
(clobber (reg:CC FLAGS_REG))])
(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0)))
+ (unspec:CCC [(match_operand:SWI48 1 "general_reg_operand")
+ (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 1) (neg:SWI48 (match_dup 1)))])
(parallel
[(set (match_dup 0)
@@ -11559,7 +11566,7 @@
"REGNO (operands[0]) != REGNO (operands[1])"
[(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_dup 1) (const_int 0)))
+ (unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 1) (neg:SWI48 (match_dup 1)))])
(parallel
[(set (match_dup 0)
@@ -11635,9 +11642,9 @@
(define_insn "*neg<mode>_ccc_1"
[(set (reg:CCC FLAGS_REG)
- (ne:CCC
- (match_operand:SWI 1 "nonimmediate_operand" "0")
- (const_int 0)))
+ (unspec:CCC
+ [(match_operand:SWI 1 "nonimmediate_operand" "0")
+ (const_int 0)] UNSPEC_CC_NE))
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m")
(neg:SWI (match_dup 1)))]
""
@@ -11647,9 +11654,9 @@
(define_insn "*neg<mode>_ccc_2"
[(set (reg:CCC FLAGS_REG)
- (ne:CCC
- (match_operand:SWI 1 "nonimmediate_operand" "0")
- (const_int 0)))
+ (unspec:CCC
+ [(match_operand:SWI 1 "nonimmediate_operand" "0")
+ (const_int 0)] UNSPEC_CC_NE))
(clobber (match_scratch:SWI 0 "=<r>"))]
""
"neg{<imodesuffix>}\t%0"
@@ -11659,8 +11666,8 @@
(define_expand "x86_neg<mode>_ccc"
[(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_operand:SWI48 1 "register_operand")
- (const_int 0)))
+ (unspec:CCC [(match_operand:SWI48 1 "register_operand")
+ (const_int 0)] UNSPEC_CC_NE))
(set (match_operand:SWI48 0 "register_operand")
(neg:SWI48 (match_dup 1)))])])
@@ -11686,8 +11693,9 @@
;; Negate with jump on overflow.
(define_expand "negv<mode>3"
[(parallel [(set (reg:CCO FLAGS_REG)
- (ne:CCO (match_operand:SWI 1 "register_operand")
- (match_dup 3)))
+ (unspec:CCO
+ [(match_operand:SWI 1 "register_operand")
+ (match_dup 3)] UNSPEC_CC_NE))
(set (match_operand:SWI 0 "register_operand")
(neg:SWI (match_dup 1)))])
(set (pc) (if_then_else
@@ -11703,8 +11711,9 @@
(define_insn "*negv<mode>3"
[(set (reg:CCO FLAGS_REG)
- (ne:CCO (match_operand:SWI 1 "nonimmediate_operand" "0")
- (match_operand:SWI 2 "const_int_operand")))
+ (unspec:CCO [(match_operand:SWI 1 "nonimmediate_operand" "0")
+ (match_operand:SWI 2 "const_int_operand")]
+ UNSPEC_CC_NE))
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m")
(neg:SWI (match_dup 1)))]
"ix86_unary_operator_ok (NEG, <MODE>mode, operands)
@@ -11770,7 +11779,7 @@
"&& 1"
[(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_dup 1) (const_int 0)))
+ (unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 2) (neg:DWIH (match_dup 1)))])
(parallel
[(set (match_dup 5)
@@ -11814,7 +11823,7 @@
"&& 1"
[(parallel
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_dup 1) (const_int 0)))
+ (unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 2) (neg:DWIH (match_dup 1)))])
(parallel
[(set (match_dup 5)
@@ -21456,7 +21465,7 @@
(const_int 0))))]
""
[(set (reg:CCC FLAGS_REG)
- (ne:CCC (match_dup 1) (const_int 0)))
+ (unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE))
(set (match_dup 0)
(neg:SWI (ltu:SWI (reg:CCC FLAGS_REG) (const_int 0))))])
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 53d534f..6e07b89 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -1224,3 +1224,8 @@ mavxvnniint8
Target Mask(ISA2_AVXVNNIINT8) Var(ix86_isa_flags2) Save
Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and
AVXVNNIINT8 built-in functions and code generation.
+
+mavxneconvert
+Target Mask(ISA2_AVXNECONVERT) Var(ix86_isa_flags2) Save
+Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, and
+AVXNECONVERT build-in functions and code generation.
diff --git a/gcc/config/i386/immintrin.h b/gcc/config/i386/immintrin.h
index ddea249..8629aba 100644
--- a/gcc/config/i386/immintrin.h
+++ b/gcc/config/i386/immintrin.h
@@ -118,10 +118,14 @@
#include <vpclmulqdqintrin.h>
+#ifdef __SSE2__
#include <avx512bf16vlintrin.h>
#include <avx512bf16intrin.h>
+#include <avxneconvertintrin.h>
+#endif
+
#include <amxtileintrin.h>
#include <amxint8intrin.h>
diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
index efa7fb2..53cf86f 100644
--- a/gcc/config/i386/linux-common.h
+++ b/gcc/config/i386/linux-common.h
@@ -27,9 +27,6 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-#define EXTRA_TARGET_D_OS_VERSIONS() \
- ANDROID_TARGET_D_OS_VERSIONS();
-
#undef CC1_SPEC
#define CC1_SPEC \
LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index b5f31c3..19a98c3 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -59,18 +59,6 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-#define EXTRA_TARGET_D_OS_VERSIONS() \
- do \
- { \
- builtin_version ("MinGW"); \
- if (TARGET_64BIT && ix86_abi == MS_ABI) \
- builtin_version ("Win64"); \
- else if (!TARGET_64BIT) \
- builtin_version ("Win32"); \
- builtin_version ("CRuntime_Microsoft"); \
- } \
- while (0)
-
#ifndef TARGET_USE_PTHREAD_BY_DEFAULT
#define SPEC_PTHREAD1 "pthread"
#define SPEC_PTHREAD2 "!no-pthread"
diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index c359e2d..d5134cc 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -48,7 +48,7 @@
(define_mode_iterator MMXMODEI8 [V8QI V4HI V2SI (V1DI "TARGET_SSE2")])
;; All 8-byte vector modes handled by MMX
-(define_mode_iterator MMXMODE [V8QI V4HI V2SI V1DI V2SF V4HF])
+(define_mode_iterator MMXMODE [V8QI V4HI V2SI V1DI V2SF V4HF V4BF])
(define_mode_iterator MMXMODE124 [V8QI V4HI V2SI V2SF])
;; Mix-n-match
@@ -58,7 +58,7 @@
(define_mode_iterator MMXMODE248 [V4HI V2SI V1DI])
;; All 4-byte integer/float16 vector modes
-(define_mode_iterator V_32 [V4QI V2HI V1SI V2HF])
+(define_mode_iterator V_32 [V4QI V2HI V1SI V2HF V2BF])
;; 4-byte integer vector modes
(define_mode_iterator VI_32 [V4QI V2HI])
@@ -72,7 +72,8 @@
;; All 2-byte, 4-byte and 8-byte vector modes with more than 1 element
(define_mode_iterator V_16_32_64
[V2QI V4QI V2HI V2HF
- (V8QI "TARGET_64BIT") (V4HI "TARGET_64BIT") (V4HF "TARGET_64BIT")
+ (V8QI "TARGET_64BIT") (V4HI "TARGET_64BIT")
+ (V4HF "TARGET_64BIT") (V4BF "TARGET_64BIT")
(V2SI "TARGET_64BIT") (V2SF "TARGET_64BIT")])
;; V2S* modes
@@ -92,6 +93,7 @@
(V4HI "DI") (V2HI "SI")
(V2SI "DI")
(V4HF "DI") (V2HF "SI")
+ (V4BF "DI") (V2BF "SI")
(V2SF "DI")])
(define_mode_attr mmxdoublemode
@@ -213,9 +215,9 @@
(cond [(eq_attr "alternative" "2")
(const_string "SI")
(eq_attr "alternative" "11,12")
- (cond [(match_test "<MODE>mode == V2SFmode")
- (const_string "V4SF")
- (match_test "<MODE>mode == V4HFmode")
+ (cond [(match_test "<MODE>mode == V2SFmode
+ || <MODE>mode == V4HFmode
+ || <MODE>mode == V4BFmode")
(const_string "V4SF")
(ior (not (match_test "TARGET_SSE2"))
(match_test "optimize_function_for_size_p (cfun)"))
@@ -227,13 +229,15 @@
(ior (ior (and (match_test "<MODE>mode == V2SFmode")
(not (match_test "TARGET_MMX_WITH_SSE")))
(not (match_test "TARGET_SSE2")))
- (match_test "<MODE>mode == V4HFmode")))
+ (match_test "<MODE>mode == V4HFmode
+ || <MODE>mode == V4BFmode")))
(const_string "V2SF")
(and (eq_attr "alternative" "14")
(ior (ior (match_test "<MODE>mode == V2SFmode")
(not (match_test "TARGET_SSE2")))
- (match_test "<MODE>mode == V4HFmode")))
+ (match_test "<MODE>mode == V4HFmode
+ || <MODE>mode == V4BFmode")))
(const_string "V2SF")
]
(const_string "DI")))
@@ -321,7 +325,8 @@
(const_string "*")))
(set (attr "mode")
(cond [(eq_attr "alternative" "2,3")
- (cond [(match_test "<MODE>mode == V2HFmode")
+ (cond [(match_test "<MODE>mode == V2HFmode
+ || <MODE>mode == V2BFmode")
(const_string "V4SF")
(match_test "TARGET_AVX")
(const_string "TI")
@@ -332,7 +337,8 @@
(const_string "TI"))
(and (eq_attr "alternative" "4,5")
- (ior (match_test "<MODE>mode == V2HFmode")
+ (ior (match_test "<MODE>mode == V2HFmode
+ || <MODE>mode == V2BFmode")
(not (match_test "TARGET_SSE2"))))
(const_string "SF")
]
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index f4b5506..3df9e07 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -187,8 +187,6 @@
UNSPEC_VP2INTERSECT
;; For AVX512BF16 support
- UNSPEC_VCVTNE2PS2BF16
- UNSPEC_VCVTNEPS2BF16
UNSPEC_VDPBF16PS
;; For AVX512FP16 suppport
@@ -28918,41 +28916,105 @@
"vp2intersectd\t{%2, %1, %0|%0, %1, %2}"
[(set_attr ("prefix") ("evex"))])
-(define_mode_iterator BF16 [V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
+(define_mode_iterator VF_AVX512BF16VL
+ [V32BF (V16BF "TARGET_AVX512VL") (V8BF "TARGET_AVX512VL")])
;; Converting from BF to SF
(define_mode_attr bf16_cvt_2sf
- [(V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")])
+ [(V32BF "V16SF") (V16BF "V8SF") (V8BF "V4SF")])
;; Converting from SF to BF
(define_mode_attr sf_cvt_bf16
- [(V4SF "V8HI") (V8SF "V8HI") (V16SF "V16HI")])
+ [(V8SF "V8BF") (V16SF "V16BF")])
;; Mapping from BF to SF
(define_mode_attr sf_bf16
- [(V4SF "V8HI") (V8SF "V16HI") (V16SF "V32HI")])
+ [(V4SF "V8BF") (V8SF "V16BF") (V16SF "V32BF")])
(define_expand "avx512f_cvtne2ps2bf16_<mode>_maskz"
- [(match_operand:BF16 0 "register_operand")
+ [(match_operand:VF_AVX512BF16VL 0 "register_operand")
(match_operand:<bf16_cvt_2sf> 1 "register_operand")
- (match_operand:<bf16_cvt_2sf> 2 "register_operand")
+ (match_operand:<bf16_cvt_2sf> 2 "nonimmediate_operand")
(match_operand:<avx512fmaskmode> 3 "register_operand")]
"TARGET_AVX512BF16"
{
- emit_insn (gen_avx512f_cvtne2ps2bf16_<mode>_mask(operands[0], operands[1],
- operands[2], CONST0_RTX(<MODE>mode), operands[3]));
+ emit_insn (gen_avx512f_cvtne2ps2bf16_<mode>_mask(operands[0], operands[2],
+ operands[1], CONST0_RTX(<MODE>mode), operands[3]));
DONE;
})
(define_insn "avx512f_cvtne2ps2bf16_<mode><mask_name>"
- [(set (match_operand:BF16 0 "register_operand" "=v")
- (unspec:BF16
- [(match_operand:<bf16_cvt_2sf> 1 "register_operand" "v")
- (match_operand:<bf16_cvt_2sf> 2 "register_operand" "v")]
- UNSPEC_VCVTNE2PS2BF16))]
+ [(set (match_operand:VF_AVX512BF16VL 0 "register_operand" "=v")
+ (vec_concat:VF_AVX512BF16VL
+ (float_truncate:<ssehalfvecmode>
+ (match_operand:<bf16_cvt_2sf> 2 "nonimmediate_operand" "vm"))
+ (float_truncate:<ssehalfvecmode>
+ (match_operand:<bf16_cvt_2sf> 1 "register_operand" "v"))))]
"TARGET_AVX512BF16"
"vcvtne2ps2bf16\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}")
+(define_expand "vcvtneps2bf16_v4sf"
+ [(set (match_operand:V8BF 0 "register_operand")
+ (vec_concat:V8BF
+ (float_truncate:V4BF
+ (match_operand:V4SF 1 "nonimmediate_operand"))
+ (match_dup 2)))]
+ "TARGET_AVXNECONVERT || (TARGET_AVX512BF16 && TARGET_AVX512VL)"
+ "operands[2] = CONST0_RTX (V4BFmode);")
+
+(define_insn "*vcvtneps2bf16_v4sf"
+ [(set (match_operand:V8BF 0 "register_operand" "=x,v")
+ (vec_concat:V8BF
+ (float_truncate:V4BF
+ (match_operand:V4SF 1 "nonimmediate_operand" "xm,vm"))
+ (match_operand:V4BF 2 "const0_operand")))]
+ "TARGET_AVXNECONVERT || (TARGET_AVX512BF16 && TARGET_AVX512VL)"
+ "@
+ %{vex%} vcvtneps2bf16{x}\t{%1, %0|%0, %1}
+ vcvtneps2bf16{x}\t{%1, %0|%0, %1}"
+ [(set_attr "isa" "avxneconvert,avx512bf16vl")
+ (set_attr "prefix" "vex,evex")])
+
+(define_expand "avx512f_cvtneps2bf16_v4sf_maskz"
+ [(match_operand:V8BF 0 "register_operand")
+ (match_operand:V4SF 1 "nonimmediate_operand")
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512BF16 && TARGET_AVX512VL"
+{
+ emit_insn (gen_avx512f_cvtneps2bf16_v4sf_mask_1(operands[0], operands[1],
+ CONST0_RTX(V8BFmode), operands[2], CONST0_RTX(V4BFmode)));
+ DONE;
+})
+
+(define_expand "avx512f_cvtneps2bf16_v4sf_mask"
+ [(match_operand:V8BF 0 "register_operand")
+ (match_operand:V4SF 1 "nonimmediate_operand")
+ (match_operand:V8BF 2 "nonimm_or_0_operand")
+ (match_operand:QI 3 "register_operand")]
+ "TARGET_AVX512BF16 && TARGET_AVX512VL"
+{
+ emit_insn (gen_avx512f_cvtneps2bf16_v4sf_mask_1(operands[0], operands[1],
+ operands[2], operands[3], CONST0_RTX(V4BFmode)));
+ DONE;
+})
+
+(define_insn "avx512f_cvtneps2bf16_v4sf_mask_1"
+ [(set (match_operand:V8BF 0 "register_operand" "=v")
+ (vec_concat:V8BF
+ (vec_merge:V4BF
+ (float_truncate:V4BF
+ (match_operand:V4SF 1 "nonimmediate_operand" "vm"))
+ (vec_select:V4BF
+ (match_operand:V8BF 2 "nonimm_or_0_operand" "0C")
+ (parallel [(const_int 0) (const_int 1)
+ (const_int 2) (const_int 3)]))
+ (match_operand:QI 3 "register_operand" "Yk"))
+ (match_operand:V4BF 4 "const0_operand")))]
+ "TARGET_AVX512BF16 && TARGET_AVX512VL"
+ "vcvtneps2bf16{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}")
+
+(define_mode_iterator VF1_AVX512_256 [V16SF (V8SF "TARGET_AVX512VL")])
+
(define_expand "avx512f_cvtneps2bf16_<mode>_maskz"
[(match_operand:<sf_cvt_bf16> 0 "register_operand")
- (match_operand:VF1_AVX512VL 1 "register_operand")
+ (match_operand:VF1_AVX512_256 1 "nonimmediate_operand")
(match_operand:<avx512fmaskmode> 2 "register_operand")]
"TARGET_AVX512BF16"
{
@@ -28961,13 +29023,24 @@
DONE;
})
+(define_insn "vcvtneps2bf16_v8sf"
+ [(set (match_operand:V8BF 0 "register_operand" "=x,v")
+ (float_truncate:V8BF
+ (match_operand:V8SF 1 "nonimmediate_operand" "xm,vm")))]
+ "TARGET_AVXNECONVERT || (TARGET_AVX512BF16 && TARGET_AVX512VL)"
+ "@
+ %{vex%} vcvtneps2bf16{y}\t{%1, %0|%0, %1}
+ vcvtneps2bf16{y}\t{%1, %0|%0, %1}"
+ [(set_attr "isa" "avxneconvert,avx512bf16vl")
+ (set_attr "prefix" "vex,evex")])
+
+
(define_insn "avx512f_cvtneps2bf16_<mode><mask_name>"
[(set (match_operand:<sf_cvt_bf16> 0 "register_operand" "=v")
- (unspec:<sf_cvt_bf16>
- [(match_operand:VF1_AVX512VL 1 "register_operand" "v")]
- UNSPEC_VCVTNEPS2BF16))]
+ (float_truncate:<sf_cvt_bf16>
+ (match_operand:VF1_AVX512_256 1 "nonimmediate_operand" "vm")))]
"TARGET_AVX512BF16"
- "vcvtneps2bf16\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
+ "vcvtneps2bf16<qq2phsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
(define_expand "avx512f_dpbf16ps_<mode>_maskz"
[(match_operand:VF1_AVX512VL 0 "register_operand")
@@ -28987,7 +29060,7 @@
(unspec:VF1_AVX512VL
[(match_operand:VF1_AVX512VL 1 "register_operand" "0")
(match_operand:<sf_bf16> 2 "register_operand" "v")
- (match_operand:<sf_bf16> 3 "register_operand" "v")]
+ (match_operand:<sf_bf16> 3 "nonimmediate_operand" "vm")]
UNSPEC_VDPBF16PS))]
"TARGET_AVX512BF16"
"vdpbf16ps\t{%3, %2, %0<maskz_half_operand4>|%0<maskz_half_operand4>, %2, %3}")
@@ -28998,7 +29071,7 @@
(unspec:VF1_AVX512VL
[(match_operand:VF1_AVX512VL 1 "register_operand" "0")
(match_operand:<sf_bf16> 2 "register_operand" "v")
- (match_operand:<sf_bf16> 3 "register_operand" "v")]
+ (match_operand:<sf_bf16> 3 "nonimmediate_operand" "vm")]
UNSPEC_VDPBF16PS)
(match_dup 1)
(match_operand:<avx512fmaskhalfmode> 4 "register_operand" "Yk")))]
@@ -29305,3 +29378,81 @@
"TARGET_AVXVNNIINT8"
"vpdp<vpdotprodtype>\t{%3, %2, %0|%0, %2, %3}"
[(set_attr "prefix" "vex")])
+
+(define_insn "vbcstnebf162ps_<mode>"
+ [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
+ (vec_duplicate:VF1_128_256
+ (float_extend:SF
+ (match_operand:BF 1 "memory_operand" "m"))))]
+ "TARGET_AVXNECONVERT"
+ "vbcstnebf162ps\t{%1, %0|%0, %1}"
+ [(set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
+
+(define_insn "vbcstnesh2ps_<mode>"
+ [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
+ (vec_duplicate:VF1_128_256
+ (float_extend:SF
+ (match_operand:HF 1 "memory_operand" "m"))))]
+ "TARGET_AVXNECONVERT"
+ "vbcstnesh2ps\t{%1, %0|%0, %1}"
+ [(set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
+
+(define_mode_iterator V16BFH_256 [V16HF V16BF])
+
+(define_mode_attr bf16_ph
+ [(V8HF "ph") (V16HF "ph")
+ (V8BF "bf16") (V16BF "bf16")])
+
+(define_insn "vcvtnee<bf16_ph>2ps_<mode>"
+ [(set (match_operand:V4SF 0 "register_operand" "=x")
+ (float_extend:V4SF
+ (vec_select:<ssehalfvecmode>
+ (match_operand:V8BFH_128 1 "memory_operand" "m")
+ (parallel [(const_int 0) (const_int 2)
+ (const_int 4) (const_int 6)]))))]
+ "TARGET_AVXNECONVERT"
+ "vcvtnee<bf16_ph>2ps\t{%1, %0|%0, %1}"
+ [(set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
+
+(define_insn "vcvtnee<bf16_ph>2ps_<mode>"
+ [(set (match_operand:V8SF 0 "register_operand" "=x")
+ (float_extend:V8SF
+ (vec_select:<ssehalfvecmode>
+ (match_operand:V16BFH_256 1 "memory_operand" "m")
+ (parallel [(const_int 0) (const_int 2)
+ (const_int 4) (const_int 6)
+ (const_int 8) (const_int 10)
+ (const_int 12) (const_int 14)]))))]
+ "TARGET_AVXNECONVERT"
+ "vcvtnee<bf16_ph>2ps\t{%1, %0|%0, %1}"
+ [(set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
+
+(define_insn "vcvtneo<bf16_ph>2ps_<mode>"
+ [(set (match_operand:V4SF 0 "register_operand" "=x")
+ (float_extend:V4SF
+ (vec_select:<ssehalfvecmode>
+ (match_operand:V8BFH_128 1 "memory_operand" "m")
+ (parallel [(const_int 1) (const_int 3)
+ (const_int 5) (const_int 7)]))))]
+ "TARGET_AVXNECONVERT"
+ "vcvtneo<bf16_ph>2ps\t{%1, %0|%0, %1}"
+ [(set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
+
+(define_insn "vcvtneo<bf16_ph>2ps_<mode>"
+ [(set (match_operand:V8SF 0 "register_operand" "=x")
+ (float_extend:V8SF
+ (vec_select:<ssehalfvecmode>
+ (match_operand:V16BFH_256 1 "memory_operand" "m")
+ (parallel [(const_int 1) (const_int 3)
+ (const_int 5) (const_int 7)
+ (const_int 9) (const_int 11)
+ (const_int 13) (const_int 15)]))))]
+ "TARGET_AVXNECONVERT"
+ "vcvtneo<bf16_ph>2ps\t{%1, %0|%0, %1}"
+ [(set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming
index d4803de..f892c27 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/i386/t-cygming
@@ -39,6 +39,10 @@ winnt-stubs.o: $(srcdir)/config/i386/winnt-stubs.cc $(CONFIG_H) $(SYSTEM_H) core
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/i386/winnt-stubs.cc
+cygwin-d.o: $(srcdir)/config/i386/cygwin-d.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
winnt-d.o: $(srcdir)/config/i386/winnt-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
diff --git a/gcc/config/i386/winnt-d.cc b/gcc/config/i386/winnt-d.cc
index 00c28c3..843c713 100644
--- a/gcc/config/i386/winnt-d.cc
+++ b/gcc/config/i386/winnt-d.cc
@@ -31,12 +31,14 @@ static void
winnt_d_os_builtins (void)
{
d_add_builtin_version ("Windows");
+ d_add_builtin_version ("MinGW");
-#define builtin_version(TXT) d_add_builtin_version (TXT)
+ if (TARGET_64BIT && ix86_abi == MS_ABI)
+ d_add_builtin_version ("Win64");
+ else if (!TARGET_64BIT)
+ d_add_builtin_version ("Win32");
-#ifdef EXTRA_TARGET_D_OS_VERSIONS
- EXTRA_TARGET_D_OS_VERSIONS ();
-#endif
+ d_add_builtin_version ("CRuntime_Microsoft");
}
/* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
@@ -67,17 +69,6 @@ winnt_d_register_target_info (void)
#undef TARGET_D_REGISTER_OS_TARGET_INFO
#define TARGET_D_REGISTER_OS_TARGET_INFO winnt_d_register_target_info
-/* Define TARGET_D_MINFO_SECTION for Windows targets. */
-
-#undef TARGET_D_MINFO_SECTION
-#define TARGET_D_MINFO_SECTION "minfo"
-
-#undef TARGET_D_MINFO_START_NAME
-#define TARGET_D_MINFO_START_NAME "__start_minfo"
-
-#undef TARGET_D_MINFO_END_NAME
-#define TARGET_D_MINFO_END_NAME "__stop_minfo"
-
/* Define TARGET_D_TEMPLATES_ALWAYS_COMDAT for Windows targets. */
#undef TARGET_D_TEMPLATES_ALWAYS_COMDAT
diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
index 995ff90..6df1ce7 100644
--- a/gcc/config/ia64/ia64.cc
+++ b/gcc/config/ia64/ia64.cc
@@ -4596,8 +4596,9 @@ ia64_setup_incoming_varargs (cumulative_args_t cum,
{
CUMULATIVE_ARGS next_cum = *get_cumulative_args (cum);
- /* Skip the current argument. */
- ia64_function_arg_advance (pack_cumulative_args (&next_cum), arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ /* Skip the current argument. */
+ ia64_function_arg_advance (pack_cumulative_args (&next_cum), arg);
if (next_cum.words < MAX_ARGUMENT_SLOTS)
{
diff --git a/gcc/config/kfreebsd-d.cc b/gcc/config/kfreebsd-d.cc
new file mode 100644
index 0000000..0bfa6bd
--- /dev/null
+++ b/gcc/config/kfreebsd-d.cc
@@ -0,0 +1,65 @@
+/* kFreeBSD-based GNU systems support needed only by D front-end.
+ Copyright (C) 2017-2022 Free Software Foundation, Inc.
+
+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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_d.h"
+#include "d/d-target.h"
+#include "d/d-target-def.h"
+
+/* Implement TARGET_D_OS_VERSIONS for kFreeBSD targets. */
+
+static void
+kfreebsd_d_os_builtins (void)
+{
+ d_add_builtin_version ("Posix");
+ d_add_builtin_version ("FreeBSD");
+ d_add_builtin_version ("CRuntime_Glibc");
+}
+
+/* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
+
+static tree
+kfreebsd_d_handle_target_object_format (void)
+{
+ const char *objfmt = "elf";
+
+ return build_string_literal (strlen (objfmt) + 1, objfmt);
+}
+
+/* Implement TARGET_D_REGISTER_OS_TARGET_INFO for kFreeBSD targets. */
+
+static void
+kfreebsd_d_register_target_info (void)
+{
+ const struct d_target_info_spec handlers[] = {
+ { "objectFormat", kfreebsd_d_handle_target_object_format },
+ { NULL, NULL },
+ };
+
+ d_add_target_info_handlers (handlers);
+}
+
+#undef TARGET_D_OS_VERSIONS
+#define TARGET_D_OS_VERSIONS kfreebsd_d_os_builtins
+
+#undef TARGET_D_REGISTER_OS_TARGET_INFO
+#define TARGET_D_REGISTER_OS_TARGET_INFO kfreebsd_d_register_target_info
+
+struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/kfreebsd-gnu.h b/gcc/config/kfreebsd-gnu.h
index f74a627..c28fcaf 100644
--- a/gcc/config/kfreebsd-gnu.h
+++ b/gcc/config/kfreebsd-gnu.h
@@ -29,12 +29,6 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-#define GNU_USER_TARGET_D_OS_VERSIONS() \
- do { \
- builtin_version ("FreeBSD"); \
- builtin_version ("CRuntime_Glibc"); \
- } while (0)
-
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
#define GNU_USER_DYNAMIC_LINKER32 GLIBC_DYNAMIC_LINKER32
#define GNU_USER_DYNAMIC_LINKER64 GLIBC_DYNAMIC_LINKER64
diff --git a/gcc/config/kopensolaris-d.cc b/gcc/config/kopensolaris-d.cc
new file mode 100644
index 0000000..197471a
--- /dev/null
+++ b/gcc/config/kopensolaris-d.cc
@@ -0,0 +1,65 @@
+/* kOpenSolaris-based GNU systems support needed only by D front-end.
+ Copyright (C) 2017-2022 Free Software Foundation, Inc.
+
+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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_d.h"
+#include "d/d-target.h"
+#include "d/d-target-def.h"
+
+/* Implement TARGET_D_OS_VERSIONS for kOpenSolaris targets. */
+
+static void
+kopensolaris_d_os_builtins (void)
+{
+ d_add_builtin_version ("Posix");
+ d_add_builtin_version ("Solaris");
+ d_add_builtin_version ("CRuntime_Glibc");
+}
+
+/* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
+
+static tree
+kopensolaris_d_handle_target_object_format (void)
+{
+ const char *objfmt = "elf";
+
+ return build_string_literal (strlen (objfmt) + 1, objfmt);
+}
+
+/* Implement TARGET_D_REGISTER_OS_TARGET_INFO for kOpenSolaris targets. */
+
+static void
+kopensolaris_d_register_target_info (void)
+{
+ const struct d_target_info_spec handlers[] = {
+ { "objectFormat", kopensolaris_d_handle_target_object_format },
+ { NULL, NULL },
+ };
+
+ d_add_target_info_handlers (handlers);
+}
+
+#undef TARGET_D_OS_VERSIONS
+#define TARGET_D_OS_VERSIONS kopensolaris_d_os_builtins
+
+#undef TARGET_D_REGISTER_OS_TARGET_INFO
+#define TARGET_D_REGISTER_OS_TARGET_INFO kopensolaris_d_register_target_info
+
+struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/kopensolaris-gnu.h b/gcc/config/kopensolaris-gnu.h
index 8379f96..3929d4b 100644
--- a/gcc/config/kopensolaris-gnu.h
+++ b/gcc/config/kopensolaris-gnu.h
@@ -30,11 +30,5 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-#define GNU_USER_TARGET_D_OS_VERSIONS() \
- do { \
- builtin_version ("Solaris"); \
- builtin_version ("CRuntime_Glibc"); \
- } while (0)
-
#undef GNU_USER_DYNAMIC_LINKER
#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
index cf34066..f335cea 100644
--- a/gcc/config/linux-android.h
+++ b/gcc/config/linux-android.h
@@ -25,12 +25,6 @@
builtin_define ("__ANDROID__"); \
} while (0)
-#define ANDROID_TARGET_D_OS_VERSIONS() \
- do { \
- if (TARGET_ANDROID) \
- builtin_version ("Android"); \
- } while (0)
-
#if ANDROID_DEFAULT
# define NOANDROID "mno-android"
#else
diff --git a/gcc/config/linux-d.cc b/gcc/config/linux-d.cc
new file mode 100644
index 0000000..f2ef2f0
--- /dev/null
+++ b/gcc/config/linux-d.cc
@@ -0,0 +1,78 @@
+/* Linux support needed only by D front-end.
+ Copyright (C) 2017-2022 Free Software Foundation, Inc.
+
+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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_d.h"
+#include "d/d-target.h"
+#include "d/d-target-def.h"
+
+/* Implement TARGET_D_OS_VERSIONS for Linux targets. */
+
+static void
+linux_d_os_builtins (void)
+{
+ d_add_builtin_version ("Posix");
+
+ d_add_builtin_version ("linux");
+#ifdef TARGET_ANDROID
+ if (TARGET_ANDROID)
+ d_add_builtin_version ("Android");
+#endif
+
+ if (OPTION_GLIBC)
+ d_add_builtin_version ("CRuntime_Glibc");
+ else if (OPTION_UCLIBC)
+ d_add_builtin_version ("CRuntime_UClibc");
+ else if (OPTION_BIONIC)
+ d_add_builtin_version ("CRuntime_Bionic");
+ else if (OPTION_MUSL)
+ d_add_builtin_version ("CRuntime_Musl");
+}
+
+/* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
+
+static tree
+linux_d_handle_target_object_format (void)
+{
+ const char *objfmt = "elf";
+
+ return build_string_literal (strlen (objfmt) + 1, objfmt);
+}
+
+/* Implement TARGET_D_REGISTER_OS_TARGET_INFO for Linux targets. */
+
+static void
+linux_d_register_target_info (void)
+{
+ const struct d_target_info_spec handlers[] = {
+ { "objectFormat", linux_d_handle_target_object_format },
+ { NULL, NULL },
+ };
+
+ d_add_target_info_handlers (handlers);
+}
+
+#undef TARGET_D_OS_VERSIONS
+#define TARGET_D_OS_VERSIONS linux_d_os_builtins
+
+#undef TARGET_D_REGISTER_OS_TARGET_INFO
+#define TARGET_D_REGISTER_OS_TARGET_INFO linux_d_register_target_info
+
+struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 74f7079..d1d6753 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -58,19 +58,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
builtin_assert ("system=posix"); \
} while (0)
-#define GNU_USER_TARGET_D_OS_VERSIONS() \
- do { \
- builtin_version ("linux"); \
- if (OPTION_GLIBC) \
- builtin_version ("CRuntime_Glibc"); \
- else if (OPTION_UCLIBC) \
- builtin_version ("CRuntime_UClibc"); \
- else if (OPTION_BIONIC) \
- builtin_version ("CRuntime_Bionic"); \
- else if (OPTION_MUSL) \
- builtin_version ("CRuntime_Musl"); \
- } while (0)
-
/* Determine which dynamic linker to use depending on whether GLIBC or
uClibc or Bionic or musl is the default C library and whether
-muclibc or -mglibc or -mbionic or -mmusl has been passed to change
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index e9ba337..f54c233 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -756,7 +756,8 @@ loongarch_setup_incoming_varargs (cumulative_args_t cum,
argument. Advance a local copy of CUM past the last "real" named
argument, to find out how many registers are left over. */
local_cum = *get_cumulative_args (cum);
- loongarch_function_arg_advance (pack_cumulative_args (&local_cum), arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ loongarch_function_arg_advance (pack_cumulative_args (&local_cum), arg);
/* Found out how many registers we need to save. */
gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs;
diff --git a/gcc/config/m32r/m32r.cc b/gcc/config/m32r/m32r.cc
index bca7681..e3489fb 100644
--- a/gcc/config/m32r/m32r.cc
+++ b/gcc/config/m32r/m32r.cc
@@ -1287,11 +1287,15 @@ m32r_setup_incoming_varargs (cumulative_args_t cum,
return;
/* All BLKmode values are passed by reference. */
- gcc_assert (arg.mode != BLKmode);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ gcc_assert (arg.mode != BLKmode);
- first_anon_arg = (ROUND_ADVANCE_CUM (*get_cumulative_args (cum),
- arg.mode, arg.type)
- + ROUND_ADVANCE_ARG (arg.mode, arg.type));
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ first_anon_arg = (ROUND_ADVANCE_CUM (*get_cumulative_args (cum),
+ arg.mode, arg.type)
+ + ROUND_ADVANCE_ARG (arg.mode, arg.type));
+ else
+ first_anon_arg = *get_cumulative_args (cum);
if (first_anon_arg < M32R_MAX_PARM_REGS)
{
diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc
index 28e7074..605d63b 100644
--- a/gcc/config/mcore/mcore.cc
+++ b/gcc/config/mcore/mcore.cc
@@ -1953,8 +1953,9 @@ mcore_setup_incoming_varargs (cumulative_args_t args_so_far_v,
/* We need to know how many argument registers are used before
the varargs start, so that we can push the remaining argument
registers during the prologue. */
- number_of_regs_before_varargs
- = *args_so_far + mcore_num_arg_regs (arg.mode, arg.type);
+ number_of_regs_before_varargs = *args_so_far;
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ number_of_regs_before_varargs += mcore_num_arg_regs (arg.mode, arg.type);
/* There is a bug somewhere in the arg handling code.
Until I can find it this workaround always pushes the
diff --git a/gcc/config/mips/linux-common.h b/gcc/config/mips/linux-common.h
index cf7713b..b29f4aa 100644
--- a/gcc/config/mips/linux-common.h
+++ b/gcc/config/mips/linux-common.h
@@ -27,9 +27,6 @@ along with GCC; see the file COPYING3. If not see
ANDROID_TARGET_OS_CPP_BUILTINS(); \
} while (0)
-#define EXTRA_TARGET_D_OS_VERSIONS() \
- ANDROID_TARGET_D_OS_VERSIONS();
-
#undef LINK_SPEC
#define LINK_SPEC \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index 699ea6c..0ac0248 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -6683,7 +6683,8 @@ mips_setup_incoming_varargs (cumulative_args_t cum,
argument. Advance a local copy of CUM past the last "real" named
argument, to find out how many registers are left over. */
local_cum = *get_cumulative_args (cum);
- mips_function_arg_advance (pack_cumulative_args (&local_cum), arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ mips_function_arg_advance (pack_cumulative_args (&local_cum), arg);
/* Found out how many registers we need to save. */
gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs;
diff --git a/gcc/config/mmix/mmix.cc b/gcc/config/mmix/mmix.cc
index ffdd8c7..1ac7b88 100644
--- a/gcc/config/mmix/mmix.cc
+++ b/gcc/config/mmix/mmix.cc
@@ -999,7 +999,8 @@ mmix_setup_incoming_varargs (cumulative_args_t args_so_farp_v,
/* We assume that one argument takes up one register here. That should
be true until we start messing with multi-reg parameters. */
- if ((7 + (MMIX_FUNCTION_ARG_SIZE (arg.mode, arg.type))) / 8 != 1)
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))
+ && (7 + (MMIX_FUNCTION_ARG_SIZE (arg.mode, arg.type))) / 8 != 1)
internal_error ("MMIX Internal: Last named vararg would not fit in a register");
}
diff --git a/gcc/config/nds32/nds32.cc b/gcc/config/nds32/nds32.cc
index 67a6121..639baef 100644
--- a/gcc/config/nds32/nds32.cc
+++ b/gcc/config/nds32/nds32.cc
@@ -2377,9 +2377,12 @@ nds32_setup_incoming_varargs (cumulative_args_t ca,
for varargs. */
total_args_regs
= NDS32_MAX_GPR_REGS_FOR_ARGS + NDS32_GPR_ARG_FIRST_REGNUM;
- num_of_used_regs
- = NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG (cum->gpr_offset, arg.mode, arg.type)
- + NDS32_NEED_N_REGS_FOR_ARG (arg.mode, arg.type);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ num_of_used_regs
+ = NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG (cum->gpr_offset, arg.mode, arg.type)
+ + NDS32_NEED_N_REGS_FOR_ARG (arg.mode, arg.type);
+ else
+ num_of_used_regs = cum->gpr_offset + NDS32_GPR_ARG_FIRST_REGNUM;
remaining_reg_count = total_args_regs - num_of_used_regs;
*pretend_args_size = remaining_reg_count * UNITS_PER_WORD;
diff --git a/gcc/config/nios2/nios2.cc b/gcc/config/nios2/nios2.cc
index 1a33c88..6a894ec 100644
--- a/gcc/config/nios2/nios2.cc
+++ b/gcc/config/nios2/nios2.cc
@@ -3524,7 +3524,8 @@ nios2_setup_incoming_varargs (cumulative_args_t cum_v,
cfun->machine->uses_anonymous_args = 1;
local_cum = *cum;
- nios2_function_arg_advance (local_cum_v, arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ nios2_function_arg_advance (local_cum_v, arg);
regs_to_push = NUM_ARG_REGS - local_cum.regs_used;
diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize
index fd7651a..2498db5 100755
--- a/gcc/config/riscv/arch-canonicalize
+++ b/gcc/config/riscv/arch-canonicalize
@@ -41,6 +41,11 @@ LONG_EXT_PREFIXES = ['z', 's', 'h', 'x']
IMPLIED_EXT = {
"d" : ["f", "zicsr"],
"f" : ["zicsr"],
+ "zdinx" : ["zfinx", "zicsr"],
+ "zfinx" : ["zicsr"],
+ "zhinx" : ["zhinxmin", "zfinx", "zicsr"],
+ "zhinxmin" : ["zfinx", "zicsr"],
+
"zk" : ["zkn", "zkr", "zkt"],
"zkn" : ["zbkb", "zbkc", "zbkx", "zkne", "zknd", "zknh"],
"zks" : ["zbkb", "zbkc", "zbkx", "zksed", "zksh"],
diff --git a/gcc/config/riscv/constraints.md b/gcc/config/riscv/constraints.md
index 8997284..4088c48 100644
--- a/gcc/config/riscv/constraints.md
+++ b/gcc/config/riscv/constraints.md
@@ -21,8 +21,9 @@
;; Register constraints
-(define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
- "A floating-point register (if available).")
+(define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS :
+ (TARGET_ZFINX ? GR_REGS : NO_REGS)"
+ "A floating-point register (if available, reuse GPR as FPR when use zfinx).")
(define_register_constraint "j" "SIBCALL_REGS"
"@internal")
@@ -128,3 +129,25 @@
"POLY_INT"
(and (match_code "const_poly_int")
(match_test "known_eq (rtx_to_poly_int64 (op), BYTES_PER_RISCV_VECTOR)")))
+
+(define_constraint "vu"
+ "A undefined vector value."
+ (and (match_code "unspec")
+ (match_test "XINT (op, 1) == UNSPEC_VUNDEF")))
+
+(define_constraint "vi"
+ "A vector 5-bit signed immediate."
+ (and (match_code "const_vector")
+ (match_test "riscv_vector::const_vec_all_same_in_range_p (op, -16, 15)")))
+
+(define_constraint "Wc0"
+ "@internal
+ A constraint that matches a vector of immediate all zeros."
+ (and (match_code "const_vector")
+ (match_test "op == CONST0_RTX (GET_MODE (op))")))
+
+(define_constraint "Wc1"
+ "@internal
+ A constraint that matches a vector of immediate all ones."
+ (and (match_code "const_vector")
+ (match_test "op == CONSTM1_RTX (GET_MODE (op))")))
diff --git a/gcc/config/riscv/iterators.md b/gcc/config/riscv/iterators.md
index 39dffab..50380ec 100644
--- a/gcc/config/riscv/iterators.md
+++ b/gcc/config/riscv/iterators.md
@@ -59,9 +59,9 @@
(define_mode_iterator ANYI [QI HI SI (DI "TARGET_64BIT")])
;; Iterator for hardware-supported floating-point modes.
-(define_mode_iterator ANYF [(SF "TARGET_HARD_FLOAT")
- (DF "TARGET_DOUBLE_FLOAT")
- (HF "TARGET_ZFH")])
+(define_mode_iterator ANYF [(SF "TARGET_HARD_FLOAT || TARGET_ZFINX")
+ (DF "TARGET_DOUBLE_FLOAT || TARGET_ZDINX")
+ (HF "TARGET_ZFH || TARGET_ZHINX")])
;; Iterator for floating-point modes that can be loaded into X registers.
(define_mode_iterator SOFTF [SF (DF "TARGET_64BIT") (HF "TARGET_ZFHMIN")])
diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md
index 5e149b3..c2ff41b 100644
--- a/gcc/config/riscv/predicates.md
+++ b/gcc/config/riscv/predicates.md
@@ -262,3 +262,26 @@
return true;
})
+
+;; Predicates for the V extension.
+(define_special_predicate "vector_length_operand"
+ (ior (match_operand 0 "pmode_register_operand")
+ (match_operand 0 "const_csr_operand")))
+
+(define_predicate "reg_or_mem_operand"
+ (ior (match_operand 0 "register_operand")
+ (match_operand 0 "memory_operand")))
+
+(define_predicate "vector_move_operand"
+ (ior (match_operand 0 "nonimmediate_operand")
+ (match_code "const_vector")))
+
+(define_predicate "vector_mask_operand"
+ (ior (match_operand 0 "register_operand")
+ (match_test "op == CONSTM1_RTX (GET_MODE (op))")))
+
+(define_predicate "vector_merge_operand"
+ (ior (match_operand 0 "memory_operand")
+ (ior (match_operand 0 "register_operand")
+ (match_test "GET_CODE (op) == UNSPEC
+ && (XINT (op, 1) == UNSPEC_VUNDEF)"))))
diff --git a/gcc/config/riscv/riscv-builtins.cc b/gcc/config/riscv/riscv-builtins.cc
index 9fa4d6c..021f6c6 100644
--- a/gcc/config/riscv/riscv-builtins.cc
+++ b/gcc/config/riscv/riscv-builtins.cc
@@ -87,7 +87,7 @@ struct riscv_builtin_description {
unsigned int (*avail) (void);
};
-AVAIL (hard_float, TARGET_HARD_FLOAT)
+AVAIL (hard_float, TARGET_HARD_FLOAT || TARGET_ZFINX)
AVAIL (clean32, TARGET_ZICBOM && !TARGET_64BIT)
@@ -342,7 +342,7 @@ riscv_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
void
riscv_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
{
- if (!TARGET_HARD_FLOAT)
+ if (!(TARGET_HARD_FLOAT || TARGET_ZFINX))
return;
tree frflags = GET_BUILTIN_DECL (CODE_FOR_riscv_frflags);
diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc
index 78f6eac..826ae00 100644
--- a/gcc/config/riscv/riscv-c.cc
+++ b/gcc/config/riscv/riscv-c.cc
@@ -61,7 +61,7 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
if (TARGET_HARD_FLOAT)
builtin_define_with_int_value ("__riscv_flen", UNITS_PER_FP_REG * 8);
- if (TARGET_HARD_FLOAT && TARGET_FDIV)
+ if ((TARGET_HARD_FLOAT || TARGET_ZFINX) && TARGET_FDIV)
{
builtin_define ("__riscv_fdiv");
builtin_define ("__riscv_fsqrt");
diff --git a/gcc/config/riscv/riscv-modes.def b/gcc/config/riscv/riscv-modes.def
index 95f69e8..556b5c5 100644
--- a/gcc/config/riscv/riscv-modes.def
+++ b/gcc/config/riscv/riscv-modes.def
@@ -37,21 +37,24 @@ FLOAT_MODE (TF, 16, ieee_quad_format);
| VNx32BI | 1 | 2 |
| VNx64BI | N/A | 1 | */
-VECTOR_BOOL_MODE (VNx1BI, 1, BI, 8);
-VECTOR_BOOL_MODE (VNx2BI, 2, BI, 8);
-VECTOR_BOOL_MODE (VNx4BI, 4, BI, 8);
-VECTOR_BOOL_MODE (VNx8BI, 8, BI, 8);
-VECTOR_BOOL_MODE (VNx16BI, 16, BI, 8);
-VECTOR_BOOL_MODE (VNx32BI, 32, BI, 8);
+/* For RVV modes, each boolean value occupies 1-bit.
+ 4th argument is specify the minmial possible size of the vector mode,
+ and will adjust to the right size by ADJUST_BYTESIZE. */
+VECTOR_BOOL_MODE (VNx1BI, 1, BI, 1);
+VECTOR_BOOL_MODE (VNx2BI, 2, BI, 1);
+VECTOR_BOOL_MODE (VNx4BI, 4, BI, 1);
+VECTOR_BOOL_MODE (VNx8BI, 8, BI, 1);
+VECTOR_BOOL_MODE (VNx16BI, 16, BI, 2);
+VECTOR_BOOL_MODE (VNx32BI, 32, BI, 4);
VECTOR_BOOL_MODE (VNx64BI, 64, BI, 8);
-ADJUST_NUNITS (VNx1BI, riscv_vector_chunks * 1);
-ADJUST_NUNITS (VNx2BI, riscv_vector_chunks * 2);
-ADJUST_NUNITS (VNx4BI, riscv_vector_chunks * 4);
-ADJUST_NUNITS (VNx8BI, riscv_vector_chunks * 8);
-ADJUST_NUNITS (VNx16BI, riscv_vector_chunks * 16);
-ADJUST_NUNITS (VNx32BI, riscv_vector_chunks * 32);
-ADJUST_NUNITS (VNx64BI, riscv_vector_chunks * 64);
+ADJUST_NUNITS (VNx1BI, riscv_v_adjust_nunits (VNx1BImode, 1));
+ADJUST_NUNITS (VNx2BI, riscv_v_adjust_nunits (VNx2BImode, 2));
+ADJUST_NUNITS (VNx4BI, riscv_v_adjust_nunits (VNx4BImode, 4));
+ADJUST_NUNITS (VNx8BI, riscv_v_adjust_nunits (VNx8BImode, 8));
+ADJUST_NUNITS (VNx16BI, riscv_v_adjust_nunits (VNx16BImode, 16));
+ADJUST_NUNITS (VNx32BI, riscv_v_adjust_nunits (VNx32BImode, 32));
+ADJUST_NUNITS (VNx64BI, riscv_v_adjust_nunits (VNx64BImode, 64));
ADJUST_ALIGNMENT (VNx1BI, 1);
ADJUST_ALIGNMENT (VNx2BI, 1);
@@ -67,33 +70,33 @@ ADJUST_BYTESIZE (VNx4BI, riscv_vector_chunks * riscv_bytes_per_vector_chunk);
ADJUST_BYTESIZE (VNx8BI, riscv_vector_chunks * riscv_bytes_per_vector_chunk);
ADJUST_BYTESIZE (VNx16BI, riscv_vector_chunks * riscv_bytes_per_vector_chunk);
ADJUST_BYTESIZE (VNx32BI, riscv_vector_chunks * riscv_bytes_per_vector_chunk);
-ADJUST_BYTESIZE (VNx64BI, riscv_vector_chunks * riscv_bytes_per_vector_chunk);
+ADJUST_BYTESIZE (VNx64BI, riscv_v_adjust_nunits (VNx64BImode, 8));
/*
| Mode | MIN_VLEN=32 | MIN_VLEN=32 | MIN_VLEN=64 | MIN_VLEN=64 |
- | | LMUL | SEW/LMUL | LMUL | SEW/LMUL |
- | VNx1QI | MF4 | 32 | MF8 | 64 |
- | VNx2QI | MF2 | 16 | MF4 | 32 |
- | VNx4QI | M1 | 8 | MF2 | 16 |
- | VNx8QI | M2 | 4 | M1 | 8 |
- | VNx16QI | M4 | 2 | M2 | 4 |
- | VNx32QI | M8 | 1 | M4 | 2 |
- | VNx64QI | N/A | N/A | M8 | 1 |
- | VNx1(HI|HF) | MF2 | 32 | MF4 | 64 |
- | VNx2(HI|HF) | M1 | 16 | MF2 | 32 |
- | VNx4(HI|HF) | M2 | 8 | M1 | 16 |
- | VNx8(HI|HF) | M4 | 4 | M2 | 8 |
- | VNx16(HI|HF)| M8 | 2 | M4 | 4 |
- | VNx32(HI|HF)| N/A | N/A | M8 | 2 |
- | VNx1(SI|SF) | M1 | 32 | MF2 | 64 |
- | VNx2(SI|SF) | M2 | 16 | M1 | 32 |
- | VNx4(SI|SF) | M4 | 8 | M2 | 16 |
- | VNx8(SI|SF) | M8 | 4 | M4 | 8 |
- | VNx16(SI|SF)| N/A | N/A | M8 | 4 |
- | VNx1(DI|DF) | N/A | N/A | M1 | 64 |
- | VNx2(DI|DF) | N/A | N/A | M2 | 32 |
- | VNx4(DI|DF) | N/A | N/A | M4 | 16 |
- | VNx8(DI|DF) | N/A | N/A | M8 | 8 |
+ | | LMUL | SEW/LMUL | LMUL | SEW/LMUL |
+ | VNx1QI | MF4 | 32 | MF8 | 64 |
+ | VNx2QI | MF2 | 16 | MF4 | 32 |
+ | VNx4QI | M1 | 8 | MF2 | 16 |
+ | VNx8QI | M2 | 4 | M1 | 8 |
+ | VNx16QI | M4 | 2 | M2 | 4 |
+ | VNx32QI | M8 | 1 | M4 | 2 |
+ | VNx64QI | N/A | N/A | M8 | 1 |
+ | VNx1(HI|HF) | MF2 | 32 | MF4 | 64 |
+ | VNx2(HI|HF) | M1 | 16 | MF2 | 32 |
+ | VNx4(HI|HF) | M2 | 8 | M1 | 16 |
+ | VNx8(HI|HF) | M4 | 4 | M2 | 8 |
+ | VNx16(HI|HF)| M8 | 2 | M4 | 4 |
+ | VNx32(HI|HF)| N/A | N/A | M8 | 2 |
+ | VNx1(SI|SF) | M1 | 32 | MF2 | 64 |
+ | VNx2(SI|SF) | M2 | 16 | M1 | 32 |
+ | VNx4(SI|SF) | M4 | 8 | M2 | 16 |
+ | VNx8(SI|SF) | M8 | 4 | M4 | 8 |
+ | VNx16(SI|SF)| N/A | N/A | M8 | 4 |
+ | VNx1(DI|DF) | N/A | N/A | M1 | 64 |
+ | VNx2(DI|DF) | N/A | N/A | M2 | 32 |
+ | VNx4(DI|DF) | N/A | N/A | M4 | 16 |
+ | VNx8(DI|DF) | N/A | N/A | M8 | 8 |
*/
/* Define RVV modes whose sizes are multiples of 64-bit chunks. */
@@ -101,13 +104,13 @@ ADJUST_BYTESIZE (VNx64BI, riscv_vector_chunks * riscv_bytes_per_vector_chunk);
VECTOR_MODES_WITH_PREFIX (VNx, INT, 8 * NVECS, 0); \
VECTOR_MODES_WITH_PREFIX (VNx, FLOAT, 8 * NVECS, 0); \
\
- ADJUST_NUNITS (VB##QI, riscv_vector_chunks * NVECS * 8); \
- ADJUST_NUNITS (VH##HI, riscv_vector_chunks * NVECS * 4); \
- ADJUST_NUNITS (VS##SI, riscv_vector_chunks * NVECS * 2); \
- ADJUST_NUNITS (VD##DI, riscv_vector_chunks * NVECS); \
- ADJUST_NUNITS (VH##HF, riscv_vector_chunks * NVECS * 4); \
- ADJUST_NUNITS (VS##SF, riscv_vector_chunks * NVECS * 2); \
- ADJUST_NUNITS (VD##DF, riscv_vector_chunks * NVECS); \
+ ADJUST_NUNITS (VB##QI, riscv_v_adjust_nunits (VB##QI##mode, NVECS * 8)); \
+ ADJUST_NUNITS (VH##HI, riscv_v_adjust_nunits (VH##HI##mode, NVECS * 4)); \
+ ADJUST_NUNITS (VS##SI, riscv_v_adjust_nunits (VS##SI##mode, NVECS * 2)); \
+ ADJUST_NUNITS (VD##DI, riscv_v_adjust_nunits (VD##DI##mode, NVECS)); \
+ ADJUST_NUNITS (VH##HF, riscv_v_adjust_nunits (VH##HF##mode, NVECS * 4)); \
+ ADJUST_NUNITS (VS##SF, riscv_v_adjust_nunits (VS##SF##mode, NVECS * 2)); \
+ ADJUST_NUNITS (VD##DF, riscv_v_adjust_nunits (VD##DF##mode, NVECS)); \
\
ADJUST_ALIGNMENT (VB##QI, 1); \
ADJUST_ALIGNMENT (VH##HI, 2); \
@@ -128,9 +131,9 @@ RVV_MODES (8, VNx64, VNx32, VNx16, VNx8)
VECTOR_MODES_WITH_PREFIX (VNx, INT, 4, 0);
VECTOR_MODES_WITH_PREFIX (VNx, FLOAT, 4, 0);
-ADJUST_NUNITS (VNx4QI, riscv_vector_chunks * 4);
-ADJUST_NUNITS (VNx2HI, riscv_vector_chunks * 2);
-ADJUST_NUNITS (VNx2HF, riscv_vector_chunks * 2);
+ADJUST_NUNITS (VNx4QI, riscv_v_adjust_nunits (VNx4QImode, 4));
+ADJUST_NUNITS (VNx2HI, riscv_v_adjust_nunits (VNx2HImode, 2));
+ADJUST_NUNITS (VNx2HF, riscv_v_adjust_nunits (VNx2HFmode, 2));
ADJUST_ALIGNMENT (VNx4QI, 1);
ADJUST_ALIGNMENT (VNx2HI, 2);
ADJUST_ALIGNMENT (VNx2HF, 2);
@@ -139,28 +142,28 @@ ADJUST_ALIGNMENT (VNx2HF, 2);
So we use 'VECTOR_MODE_WITH_PREFIX' to define VNx1SImode and VNx1SFmode. */
VECTOR_MODE_WITH_PREFIX (VNx, INT, SI, 1, 0);
VECTOR_MODE_WITH_PREFIX (VNx, FLOAT, SF, 1, 0);
-ADJUST_NUNITS (VNx1SI, riscv_vector_chunks);
-ADJUST_NUNITS (VNx1SF, riscv_vector_chunks);
+ADJUST_NUNITS (VNx1SI, riscv_v_adjust_nunits (VNx1SImode, 1));
+ADJUST_NUNITS (VNx1SF, riscv_v_adjust_nunits (VNx1SFmode, 1));
ADJUST_ALIGNMENT (VNx1SI, 4);
ADJUST_ALIGNMENT (VNx1SF, 4);
VECTOR_MODES_WITH_PREFIX (VNx, INT, 2, 0);
-ADJUST_NUNITS (VNx2QI, riscv_vector_chunks * 2);
+ADJUST_NUNITS (VNx2QI, riscv_v_adjust_nunits (VNx2QImode, 2));
ADJUST_ALIGNMENT (VNx2QI, 1);
/* 'VECTOR_MODES_WITH_PREFIX' does not allow ncomponents < 2.
So we use 'VECTOR_MODE_WITH_PREFIX' to define VNx1HImode and VNx1HFmode. */
VECTOR_MODE_WITH_PREFIX (VNx, INT, HI, 1, 0);
VECTOR_MODE_WITH_PREFIX (VNx, FLOAT, HF, 1, 0);
-ADJUST_NUNITS (VNx1HI, riscv_vector_chunks);
-ADJUST_NUNITS (VNx1HF, riscv_vector_chunks);
+ADJUST_NUNITS (VNx1HI, riscv_v_adjust_nunits (VNx1HImode, 1));
+ADJUST_NUNITS (VNx1HF, riscv_v_adjust_nunits (VNx1HFmode, 1));
ADJUST_ALIGNMENT (VNx1HI, 2);
ADJUST_ALIGNMENT (VNx1HF, 2);
/* 'VECTOR_MODES_WITH_PREFIX' does not allow ncomponents < 2.
So we use 'VECTOR_MODE_WITH_PREFIX' to define VNx1QImode. */
VECTOR_MODE_WITH_PREFIX (VNx, INT, QI, 1, 0);
-ADJUST_NUNITS (VNx1QI, riscv_vector_chunks);
+ADJUST_NUNITS (VNx1QI, riscv_v_adjust_nunits (VNx1QImode, 1));
ADJUST_ALIGNMENT (VNx1QI, 1);
/* TODO: According to RISC-V 'V' ISA spec, the maximun vector length can
diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h
index 55e0bc0..1dfe8c8 100644
--- a/gcc/config/riscv/riscv-opts.h
+++ b/gcc/config/riscv/riscv-opts.h
@@ -83,6 +83,16 @@ enum stack_protector_guard {
#define TARGET_ZBC ((riscv_zb_subext & MASK_ZBC) != 0)
#define TARGET_ZBS ((riscv_zb_subext & MASK_ZBS) != 0)
+#define MASK_ZFINX (1 << 0)
+#define MASK_ZDINX (1 << 1)
+#define MASK_ZHINX (1 << 2)
+#define MASK_ZHINXMIN (1 << 3)
+
+#define TARGET_ZFINX ((riscv_zinx_subext & MASK_ZFINX) != 0)
+#define TARGET_ZDINX ((riscv_zinx_subext & MASK_ZDINX) != 0)
+#define TARGET_ZHINX ((riscv_zinx_subext & MASK_ZHINX) != 0)
+#define TARGET_ZHINXMIN ((riscv_zinx_subext & MASK_ZHINXMIN) != 0)
+
#define MASK_ZBKB (1 << 0)
#define MASK_ZBKC (1 << 1)
#define MASK_ZBKX (1 << 2)
@@ -162,6 +172,12 @@ enum stack_protector_guard {
#define MASK_ZMMUL (1 << 0)
#define TARGET_ZMMUL ((riscv_zm_subext & MASK_ZMMUL) != 0)
+#define MASK_SVINVAL (1 << 0)
+#define MASK_SVNAPOT (1 << 1)
+
+#define TARGET_SVINVAL ((riscv_sv_subext & MASK_SVINVAL) != 0)
+#define TARGET_SVNAPOT ((riscv_sv_subext & MASK_SVNAPOT) != 0)
+
/* Bit of riscv_zvl_flags will set contintuly, N-1 bit will set if N-bit is
set, e.g. MASK_ZVL64B has set then MASK_ZVL32B is set, so we can use
popcount to caclulate the minimal VLEN. */
diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h
index f8c9932..5a718bb 100644
--- a/gcc/config/riscv/riscv-protos.h
+++ b/gcc/config/riscv/riscv-protos.h
@@ -75,7 +75,8 @@ extern bool riscv_store_data_bypass_p (rtx_insn *, rtx_insn *);
extern rtx riscv_gen_gpr_save_insn (struct riscv_frame_info *);
extern bool riscv_gpr_save_operation_p (rtx);
extern void riscv_reinit (void);
-extern bool riscv_v_ext_enabled_vector_mode_p (machine_mode);
+extern poly_uint64 riscv_regmode_natural_size (machine_mode);
+extern bool riscv_v_ext_vector_mode_p (machine_mode);
/* Routines implemented in riscv-c.cc. */
void riscv_cpu_cpp_builtins (cpp_reader *);
@@ -126,6 +127,19 @@ extern bool verify_type_context (location_t, type_context_kind, const_tree, bool
extern void handle_pragma_vector (void);
extern tree builtin_decl (unsigned, bool);
extern rtx expand_builtin (unsigned int, tree, rtx);
+extern bool const_vec_all_same_in_range_p (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
+extern bool legitimize_move (rtx, rtx, machine_mode);
+enum tail_policy
+{
+ TAIL_UNDISTURBED = 0,
+ TAIL_AGNOSTIC = 1,
+};
+
+enum mask_policy
+{
+ MASK_UNDISTURBED = 0,
+ MASK_AGNOSTIC = 1,
+};
}
/* We classify builtin types into two classes:
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
new file mode 100644
index 0000000..6615a5c
--- /dev/null
+++ b/gcc/config/riscv/riscv-v.cc
@@ -0,0 +1,180 @@
+/* Subroutines used for code generation for RISC-V 'V' Extension for GNU
+ compiler. Copyright (C) 2022-2022 Free Software Foundation, Inc. Contributed
+ by Juzhe Zhong (juzhe.zhong@rivai.ai), RiVAI Technologies Ltd.
+
+ 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/>. */
+
+#define IN_TARGET_CODE 1
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "backend.h"
+#include "rtl.h"
+#include "insn-config.h"
+#include "insn-attr.h"
+#include "recog.h"
+#include "alias.h"
+#include "tree.h"
+#include "stringpool.h"
+#include "attribs.h"
+#include "explow.h"
+#include "memmodel.h"
+#include "emit-rtl.h"
+#include "tm_p.h"
+#include "target.h"
+#include "expr.h"
+#include "optabs.h"
+
+using namespace riscv_vector;
+
+namespace riscv_vector {
+
+template <int MAX_OPERANDS> class insn_expander
+{
+public:
+ insn_expander () : m_opno (0) {}
+ void add_output_operand (rtx x, machine_mode mode)
+ {
+ create_output_operand (&m_ops[m_opno++], x, mode);
+ gcc_assert (m_opno <= MAX_OPERANDS);
+ }
+ void add_input_operand (rtx x, machine_mode mode)
+ {
+ create_input_operand (&m_ops[m_opno++], x, mode);
+ gcc_assert (m_opno <= MAX_OPERANDS);
+ }
+ void add_all_one_mask_operand (machine_mode mode)
+ {
+ add_input_operand (CONSTM1_RTX (mode), mode);
+ }
+ void add_vundef_operand (machine_mode mode)
+ {
+ add_input_operand (gen_rtx_UNSPEC (mode, gen_rtvec (1, const0_rtx),
+ UNSPEC_VUNDEF),
+ mode);
+ }
+ void add_policy_operand (enum tail_policy vta, enum mask_policy vma)
+ {
+ rtx tail_policy_rtx = vta == TAIL_UNDISTURBED ? const0_rtx : const1_rtx;
+ rtx mask_policy_rtx = vma == MASK_UNDISTURBED ? const0_rtx : const1_rtx;
+ add_input_operand (tail_policy_rtx, Pmode);
+ add_input_operand (mask_policy_rtx, Pmode);
+ }
+
+ void expand (enum insn_code icode, bool temporary_volatile_p = false)
+ {
+ if (temporary_volatile_p)
+ {
+ temporary_volatile_ok v (true);
+ expand_insn (icode, m_opno, m_ops);
+ }
+ else
+ expand_insn (icode, m_opno, m_ops);
+ }
+
+private:
+ int m_opno;
+ expand_operand m_ops[MAX_OPERANDS];
+};
+
+/* Return true if X is a const_vector with all duplicate elements, which is in
+ the range between MINVAL and MAXVAL. */
+bool
+const_vec_all_same_in_range_p (rtx x, HOST_WIDE_INT minval,
+ HOST_WIDE_INT maxval)
+{
+ rtx elt;
+ return (const_vec_duplicate_p (x, &elt) && CONST_INT_P (elt)
+ && IN_RANGE (INTVAL (elt), minval, maxval));
+}
+
+/* Emit an RVV unmask && vl mov from SRC to DEST. */
+static void
+emit_pred_move (rtx dest, rtx src, rtx vl, machine_mode mask_mode)
+{
+ insn_expander<7> e;
+
+ machine_mode mode = GET_MODE (dest);
+ if (register_operand (src, mode) && register_operand (dest, mode))
+ {
+ emit_move_insn (dest, src);
+ return;
+ }
+
+ e.add_output_operand (dest, mode);
+ e.add_all_one_mask_operand (mask_mode);
+ /* For load operation, we create undef operand.
+ For store operation, we make it depend on the dest memory to
+ avoid potential bugs. */
+ if (MEM_P (src))
+ e.add_vundef_operand (mode);
+ else
+ e.add_input_operand (dest, mode);
+
+ e.add_input_operand (src, mode);
+ e.add_input_operand (vl, Pmode);
+
+ e.add_policy_operand (TAIL_AGNOSTIC, MASK_AGNOSTIC);
+
+ enum insn_code icode;
+ icode = code_for_pred_mov (mode);
+ e.expand (icode, true);
+}
+
+/* Expand a pre-RA RVV data move from SRC to DEST.
+ It expands move for RVV fractional vector modes. */
+bool
+legitimize_move (rtx dest, rtx src, machine_mode mask_mode)
+{
+ machine_mode mode = GET_MODE (dest);
+ /* For whole registers load/store or register-register move,
+ we don't need to specially handle them, just let them go
+ through "*mov<mode>" and then use the codegen directly. */
+ if ((known_ge (GET_MODE_SIZE (mode), BYTES_PER_RISCV_VECTOR)
+ && (GET_MODE_CLASS (mode) != MODE_VECTOR_BOOL))
+ || (register_operand (src, mode) && register_operand (dest, mode)))
+ {
+ /* Need to force register if mem <- !reg. */
+ if (MEM_P (dest) && !REG_P (src))
+ src = force_reg (mode, src);
+ return false;
+ }
+
+ rtx vlmax = gen_reg_rtx (Pmode);
+ unsigned int sew = GET_MODE_CLASS (mode) == MODE_VECTOR_BOOL
+ ? 8
+ : GET_MODE_BITSIZE (GET_MODE_INNER (mode));
+ emit_insn (gen_vsetvl_no_side_effects (
+ Pmode, vlmax, gen_rtx_REG (Pmode, 0), gen_int_mode (sew, Pmode),
+ gen_int_mode ((unsigned int) mode, Pmode), const1_rtx, const1_rtx));
+
+ if (!register_operand (src, mode) && !register_operand (dest, mode))
+ {
+ rtx tmp = gen_reg_rtx (mode);
+ if (MEM_P (src))
+ emit_pred_move (tmp, src, vlmax, mask_mode);
+ else
+ emit_move_insn (tmp, src);
+ src = tmp;
+ }
+ emit_pred_move (dest, src, vlmax, mask_mode);
+ return true;
+}
+
+} // namespace riscv_vector
diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc
index ca6e33d..231b63a 100644
--- a/gcc/config/riscv/riscv-vector-builtins-bases.cc
+++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc
@@ -72,18 +72,8 @@ public:
e.add_input_operand (Pmode,
gen_int_mode (GET_MODE_BITSIZE (inner_mode), Pmode));
- /* LMUL. Define the bitmap rule as follows:
- | 4 | 3 2 1 0 |
- | fractional_p | factor |
- */
- bool fractional_p = known_lt (GET_MODE_SIZE (mode), BYTES_PER_RISCV_VECTOR);
- unsigned int factor
- = fractional_p ? exact_div (BYTES_PER_RISCV_VECTOR, GET_MODE_SIZE (mode))
- .to_constant ()
- : exact_div (GET_MODE_SIZE (mode), BYTES_PER_RISCV_VECTOR)
- .to_constant ();
- e.add_input_operand (Pmode,
- gen_int_mode ((fractional_p << 4) | factor, Pmode));
+ /* LMUL. */
+ e.add_input_operand (Pmode, gen_int_mode ((unsigned int) mode, Pmode));
/* TA. */
e.add_input_operand (Pmode, gen_int_mode (1, Pmode));
@@ -94,8 +84,8 @@ public:
}
};
-static constexpr const vsetvl<false> vsetvl_obj;
-static constexpr const vsetvl<true> vsetvlmax_obj;
+static CONSTEXPR const vsetvl<false> vsetvl_obj;
+static CONSTEXPR const vsetvl<true> vsetvlmax_obj;
namespace bases {
const function_base *const vsetvl = &vsetvl_obj;
const function_base *const vsetvlmax = &vsetvlmax_obj;
diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
index 14c5969..24fc1c0 100644
--- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc
+++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
@@ -71,7 +71,7 @@ build_all (function_builder &b, const function_group_info &group)
/* Declare the function shape NAME, pointing it to an instance
of class <NAME>_def. */
#define SHAPE(DEF, VAR) \
- static constexpr const DEF##_def VAR##_obj; \
+ static CONSTEXPR const DEF##_def VAR##_obj; \
namespace shapes { const function_shape *const VAR = &VAR##_obj; }
/* Base class for for build. */
diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc
index caeb972..43150aa 100644
--- a/gcc/config/riscv/riscv-vector-builtins.cc
+++ b/gcc/config/riscv/riscv-vector-builtins.cc
@@ -88,7 +88,7 @@ struct registered_function_hasher : nofree_ptr_hash<registered_function>
};
/* Static information about each RVV type. */
-static constexpr const vector_type_info vector_types[] = {
+static CONSTEXPR const vector_type_info vector_types[] = {
#define DEF_RVV_TYPE(NAME, NCHARS, ABI_NAME, ARGS...) \
{#NAME, #ABI_NAME, "u" #NCHARS #ABI_NAME},
#include "riscv-vector-builtins.def"
@@ -123,23 +123,23 @@ static const rvv_type_info i_ops[] = {
#include "riscv-vector-builtins-types.def"
{NUM_VECTOR_TYPES, 0}};
-static constexpr const rvv_arg_type_info rvv_arg_type_info_end
+static CONSTEXPR const rvv_arg_type_info rvv_arg_type_info_end
= rvv_arg_type_info (NUM_BASE_TYPES);
/* A list of args for size_t func (void) function. */
-static constexpr const rvv_arg_type_info void_args[]
+static CONSTEXPR const rvv_arg_type_info void_args[]
= {rvv_arg_type_info (RVV_BASE_void), rvv_arg_type_info_end};
/* A list of args for size_t func (size_t) function. */
-static constexpr const rvv_arg_type_info size_args[]
+static CONSTEXPR const rvv_arg_type_info size_args[]
= {rvv_arg_type_info (RVV_BASE_size), rvv_arg_type_info_end};
/* A list of none preds that will be registered for intrinsic functions. */
-static constexpr const predication_type_index none_preds[]
+static CONSTEXPR const predication_type_index none_preds[]
= {PRED_TYPE_none, NUM_PRED_TYPES};
/* A static operand information for size_t func (void) function registration. */
-static constexpr const rvv_op_info i_none_size_void_ops
+static CONSTEXPR const rvv_op_info i_none_size_void_ops
= {i_ops, /* Types */
OP_TYPE_none, /* Suffix */
rvv_arg_type_info (RVV_BASE_size), /* Return type */
@@ -147,7 +147,7 @@ static constexpr const rvv_op_info i_none_size_void_ops
/* A static operand information for size_t func (size_t) function registration.
*/
-static constexpr const rvv_op_info i_none_size_size_ops
+static CONSTEXPR const rvv_op_info i_none_size_size_ops
= {i_ops, /* Types */
OP_TYPE_none, /* Suffix */
rvv_arg_type_info (RVV_BASE_size), /* Return type */
@@ -202,7 +202,7 @@ rvv_switcher::rvv_switcher ()
memcpy (m_old_have_regs_of_mode, have_regs_of_mode,
sizeof (have_regs_of_mode));
for (int i = 0; i < NUM_MACHINE_MODES; ++i)
- if (riscv_v_ext_enabled_vector_mode_p ((machine_mode) i))
+ if (riscv_v_ext_vector_mode_p ((machine_mode) i))
have_regs_of_mode[i] = true;
}
@@ -271,7 +271,7 @@ register_builtin_type (vector_type_index type, tree eltype, machine_mode mode)
builtin_types[type].scalar = eltype;
builtin_types[type].scalar_ptr = build_pointer_type (eltype);
builtin_types[type].scalar_const_ptr = build_const_pointer (eltype);
- if (!riscv_v_ext_enabled_vector_mode_p (mode))
+ if (!riscv_v_ext_vector_mode_p (mode))
return;
tree vectype = build_vector_type_for_mode (eltype, mode);
diff --git a/gcc/config/riscv/riscv-vector-builtins.h b/gcc/config/riscv/riscv-vector-builtins.h
index e5636e2..425da12 100644
--- a/gcc/config/riscv/riscv-vector-builtins.h
+++ b/gcc/config/riscv/riscv-vector-builtins.h
@@ -171,7 +171,7 @@ struct rvv_builtin_suffixes
/* RVV Builtin argument information. */
struct rvv_arg_type_info
{
- constexpr rvv_arg_type_info (rvv_base_type base_type_in)
+ CONSTEXPR rvv_arg_type_info (rvv_base_type base_type_in)
: base_type (base_type_in)
{}
enum rvv_base_type base_type;
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 4e18a43..32f9ef9 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -941,30 +941,12 @@ riscv_valid_lo_sum_p (enum riscv_symbol_type sym_type, machine_mode mode,
return true;
}
-/* Return true if mode is the RVV mode. */
-
-static bool
-riscv_v_ext_vector_mode_p (machine_mode mode)
-{
-#define ENTRY(MODE, REQUIREMENT) \
- case MODE##mode: \
- return true;
- switch (mode)
- {
-#include "riscv-vector-switch.def"
- default:
- return false;
- }
-
- return false;
-}
-
/* Return true if mode is the RVV enabled mode.
For example: 'VNx1DI' mode is disabled if MIN_VLEN == 32.
'VNx1SI' mode is enabled if MIN_VLEN == 32. */
bool
-riscv_v_ext_enabled_vector_mode_p (machine_mode mode)
+riscv_v_ext_vector_mode_p (machine_mode mode)
{
#define ENTRY(MODE, REQUIREMENT) \
case MODE##mode: \
@@ -979,6 +961,17 @@ riscv_v_ext_enabled_vector_mode_p (machine_mode mode)
return false;
}
+/* Call from ADJUST_NUNITS in riscv-modes.def. Return the correct
+ NUNITS size for corresponding machine_mode. */
+
+poly_int64
+riscv_v_adjust_nunits (machine_mode mode, int scale)
+{
+ if (riscv_v_ext_vector_mode_p (mode))
+ return riscv_vector_chunks * scale;
+ return scale;
+}
+
/* Return true if X is a valid address for machine mode MODE. If it is,
fill in INFO appropriately. STRICT_P is true if REG_OK_STRICT is in
effect. */
@@ -3737,7 +3730,8 @@ riscv_setup_incoming_varargs (cumulative_args_t cum,
argument. Advance a local copy of CUM past the last "real" named
argument, to find out how many registers are left over. */
local_cum = *get_cumulative_args (cum);
- riscv_function_arg_advance (pack_cumulative_args (&local_cum), arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ riscv_function_arg_advance (pack_cumulative_args (&local_cum), arg);
/* Found out how many registers we need to save. */
gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs;
@@ -4145,14 +4139,42 @@ riscv_print_operand (FILE *file, rtx op, int letter)
switch (letter)
{
case 'm': {
- if (code == CONST_INT)
+ if (riscv_v_ext_vector_mode_p (mode))
+ {
+ /* Calculate lmul according to mode and print the value. */
+ poly_int64 size = GET_MODE_SIZE (mode);
+ unsigned int lmul;
+ if (known_lt (size, BYTES_PER_RISCV_VECTOR))
+ lmul = 1;
+ else
+ lmul = exact_div (size, BYTES_PER_RISCV_VECTOR).to_constant ();
+ asm_fprintf (file, "%d", lmul);
+ }
+ else if (code == CONST_INT)
{
- /* LMUL. Define the bitmap rule as follows:
- | 4 | 3 2 1 0 |
- | fractional_p | factor |
- */
- bool fractional_p = (UINTVAL (op) >> 4) & 0x1;
- unsigned int factor = UINTVAL (op) & 0xf;
+ /* The value in the operand is the unsigned int value
+ converted from (enum machine_mode).
+ This RTX is generated as follows:
+
+ machine_mode mode = XXXmode;
+ operand = gen_int_mode ((unsigned int)mode, Pmode);
+
+ So we convert it back into machine_mode and then calculate
+ the LMUL according to GET_MODE_SIZE. */
+
+ machine_mode rvv_mode = (machine_mode) UINTVAL (op);
+ /* For rvv mask modes, we can not calculate LMUL simpily according
+ to BYTES_PER_RISCV_VECTOR. When rvv_mode = VNx4BImode.
+ Set SEW = 8, LMUL = 1 by default if TARGET_MIN_VLEN == 32.
+ Set SEW = 8, LMUL = 1 / 2 by default if TARGET_MIN_VLEN > 32. */
+ bool bool_p = GET_MODE_CLASS (rvv_mode) == MODE_VECTOR_BOOL;
+ poly_int64 m1_size = BYTES_PER_RISCV_VECTOR;
+ poly_int64 rvv_size
+ = bool_p ? GET_MODE_NUNITS (rvv_mode) : GET_MODE_SIZE (rvv_mode);
+ bool fractional_p = known_lt (rvv_size, BYTES_PER_RISCV_VECTOR);
+ unsigned int factor
+ = fractional_p ? exact_div (m1_size, rvv_size).to_constant ()
+ : exact_div (rvv_size, m1_size).to_constant ();
asm_fprintf (file, "%s%d", fractional_p ? "mf" : "m", factor);
}
else
@@ -4160,7 +4182,15 @@ riscv_print_operand (FILE *file, rtx op, int letter)
break;
}
case 'p': {
- if (code == CONST_INT)
+ if (GET_MODE_CLASS (mode) == MODE_VECTOR_BOOL)
+ {
+ /* Print for RVV mask operand.
+ If op is reg, print ",v0.t".
+ Otherwise, don't print anything. */
+ if (code == REG)
+ fprintf (file, ",%s.t", reg_names[REGNO (op)]);
+ }
+ else if (code == CONST_INT)
{
/* Tail && Mask policy. */
bool agnostic_p = UINTVAL (op) & 0x1;
@@ -4996,8 +5026,8 @@ riscv_expand_epilogue (int style)
rtx insn;
/* We need to add memory barrier to prevent read from deallocated stack. */
- bool need_barrier_p
- = known_ne (get_frame_size (), cfun->machine->frame.arg_pointer_offset);
+ bool need_barrier_p = known_ne (get_frame_size ()
+ + cfun->machine->frame.arg_pointer_offset, 0);
if (cfun->machine->naked_p)
{
@@ -5391,6 +5421,13 @@ riscv_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
!= call_used_or_fixed_reg_p (regno + i))
return false;
+ /* Only use even registers in RV32 ZDINX */
+ if (!TARGET_64BIT && TARGET_ZDINX){
+ if (GET_MODE_CLASS (mode) == MODE_FLOAT &&
+ GET_MODE_UNIT_SIZE (mode) == GET_MODE_SIZE (DFmode))
+ return !(regno & 1);
+ }
+
return true;
}
@@ -5630,7 +5667,7 @@ riscv_option_override (void)
error ("%<-mdiv%> requires %<-march%> to subsume the %<M%> extension");
/* Likewise floating-point division and square root. */
- if (TARGET_HARD_FLOAT && (target_flags_explicit & MASK_FDIV) == 0)
+ if ((TARGET_HARD_FLOAT || TARGET_ZFINX) && (target_flags_explicit & MASK_FDIV) == 0)
target_flags |= MASK_FDIV;
/* Handle -mtune, use -mcpu if -mtune is not given, and use default -mtune
@@ -5676,6 +5713,11 @@ riscv_option_override (void)
if (TARGET_RVE && riscv_abi != ABI_ILP32E)
error ("rv32e requires ilp32e ABI");
+ // Zfinx require abi ilp32,ilp32e or lp64.
+ if (TARGET_ZFINX && riscv_abi != ABI_ILP32
+ && riscv_abi != ABI_LP64 && riscv_abi != ABI_ILP32E)
+ error ("z*inx requires ABI ilp32, ilp32e or lp64");
+
/* We do not yet support ILP32 on RV64. */
if (BITS_PER_WORD != POINTER_SIZE)
error ("ABI requires %<-march=rv%d%>", POINTER_SIZE);
@@ -6308,7 +6350,7 @@ riscv_libgcc_floating_mode_supported_p (scalar_float_mode mode)
precision of the _FloatN type; evaluate all other operations and
constants to the range and precision of the semantic type;
- If we have the zfh extensions then we support _Float16 in native
+ If we have the zfh/zhinx extensions then we support _Float16 in native
precision, so we should set this to 16. */
static enum flt_eval_method
riscv_excess_precision (enum excess_precision_type type)
@@ -6317,8 +6359,9 @@ riscv_excess_precision (enum excess_precision_type type)
{
case EXCESS_PRECISION_TYPE_FAST:
case EXCESS_PRECISION_TYPE_STANDARD:
- return (TARGET_ZFH ? FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16
- : FLT_EVAL_METHOD_PROMOTE_TO_FLOAT);
+ return ((TARGET_ZFH || TARGET_ZHINX)
+ ? FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16
+ : FLT_EVAL_METHOD_PROMOTE_TO_FLOAT);
case EXCESS_PRECISION_TYPE_IMPLICIT:
case EXCESS_PRECISION_TYPE_FLOAT16:
return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16;
@@ -6384,7 +6427,7 @@ static bool
riscv_vector_mode_supported_p (machine_mode mode)
{
if (TARGET_VECTOR)
- return riscv_v_ext_enabled_vector_mode_p (mode);
+ return riscv_v_ext_vector_mode_p (mode);
return false;
}
@@ -6416,6 +6459,21 @@ riscv_vector_alignment (const_tree type)
return wi::umin (min_size, 128).to_uhwi ();
}
+/* Implement REGMODE_NATURAL_SIZE. */
+
+poly_uint64
+riscv_regmode_natural_size (machine_mode mode)
+{
+ /* The natural size for RVV data modes is one RVV data vector,
+ and similarly for predicates. We can't independently modify
+ anything smaller than that. */
+ /* ??? For now, only do this for variable-width RVV registers.
+ Doing it for constant-sized registers breaks lower-subreg.c. */
+ if (!riscv_vector_chunks.is_constant () && riscv_v_ext_vector_mode_p (mode))
+ return BYTES_PER_RISCV_VECTOR;
+ return UNITS_PER_WORD;
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index 37363e9..1385f0a 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -1019,6 +1019,7 @@ extern bool riscv_slow_unaligned_access_p;
extern unsigned riscv_stack_boundary;
extern unsigned riscv_bytes_per_vector_chunk;
extern poly_uint16 riscv_vector_chunks;
+extern poly_int64 riscv_v_adjust_nunits (enum machine_mode, int);
/* The number of bits and bytes in a RVV vector. */
#define BITS_PER_RISCV_VECTOR (poly_uint16 (riscv_vector_chunks * riscv_bytes_per_vector_chunk * 8))
#define BYTES_PER_RISCV_VECTOR (poly_uint16 (riscv_vector_chunks * riscv_bytes_per_vector_chunk))
@@ -1080,4 +1081,6 @@ extern void riscv_remove_unneeded_save_restore_calls (void);
#define REGISTER_TARGET_PRAGMAS() riscv_register_pragmas ()
+#define REGMODE_NATURAL_SIZE(MODE) riscv_regmode_natural_size (MODE)
+
#endif /* ! GCC_RISCV_H */
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index 9384ced..798f737 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -152,7 +152,14 @@
(const_string "unknown"))
;; Main data type used by the insn
-(define_attr "mode" "unknown,none,QI,HI,SI,DI,TI,HF,SF,DF,TF"
+(define_attr "mode" "unknown,none,QI,HI,SI,DI,TI,HF,SF,DF,TF,
+ VNx1BI,VNx2BI,VNx4BI,VNx8BI,VNx16BI,VNx32BI,VNx64BI,
+ VNx1QI,VNx2QI,VNx4QI,VNx8QI,VNx16QI,VNx32QI,VNx64QI,
+ VNx1HI,VNx2HI,VNx4HI,VNx8HI,VNx16HI,VNx32HI,
+ VNx1SI,VNx2SI,VNx4SI,VNx8SI,VNx16SI,
+ VNx1DI,VNx2DI,VNx4DI,VNx8DI,
+ VNx1SF,VNx2SF,VNx4SF,VNx8SF,VNx16SF,
+ VNx1DF,VNx2DF,VNx4DF,VNx8DF"
(const_string "unknown"))
;; True if the main data type is twice the size of a word.
@@ -434,7 +441,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(plus:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fadd.<fmt>\t%0,%1,%2"
[(set_attr "type" "fadd")
(set_attr "mode" "<UNITMODE>")])
@@ -565,7 +572,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(minus:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fsub.<fmt>\t%0,%1,%2"
[(set_attr "type" "fadd")
(set_attr "mode" "<UNITMODE>")])
@@ -735,7 +742,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(mult:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fmul.<fmt>\t%0,%1,%2"
[(set_attr "type" "fmul")
(set_attr "mode" "<UNITMODE>")])
@@ -1042,7 +1049,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(div:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")))]
- "TARGET_HARD_FLOAT && TARGET_FDIV"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && TARGET_FDIV"
"fdiv.<fmt>\t%0,%1,%2"
[(set_attr "type" "fdiv")
(set_attr "mode" "<UNITMODE>")])
@@ -1057,7 +1064,7 @@
(define_insn "sqrt<mode>2"
[(set (match_operand:ANYF 0 "register_operand" "=f")
(sqrt:ANYF (match_operand:ANYF 1 "register_operand" " f")))]
- "TARGET_HARD_FLOAT && TARGET_FDIV"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && TARGET_FDIV"
{
return "fsqrt.<fmt>\t%0,%1";
}
@@ -1072,7 +1079,7 @@
(fma:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")
(match_operand:ANYF 3 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fmadd.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1083,7 +1090,7 @@
(fma:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")
(neg:ANYF (match_operand:ANYF 3 "register_operand" " f"))))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fmsub.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1095,7 +1102,7 @@
(neg:ANYF (match_operand:ANYF 1 "register_operand" " f"))
(match_operand:ANYF 2 "register_operand" " f")
(neg:ANYF (match_operand:ANYF 3 "register_operand" " f"))))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fnmadd.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1107,7 +1114,7 @@
(neg:ANYF (match_operand:ANYF 1 "register_operand" " f"))
(match_operand:ANYF 2 "register_operand" " f")
(match_operand:ANYF 3 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fnmsub.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1120,7 +1127,7 @@
(neg:ANYF (match_operand:ANYF 1 "register_operand" " f"))
(match_operand:ANYF 2 "register_operand" " f")
(neg:ANYF (match_operand:ANYF 3 "register_operand" " f")))))]
- "TARGET_HARD_FLOAT && !HONOR_SIGNED_ZEROS (<MODE>mode)"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && !HONOR_SIGNED_ZEROS (<MODE>mode)"
"fmadd.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1133,7 +1140,7 @@
(neg:ANYF (match_operand:ANYF 1 "register_operand" " f"))
(match_operand:ANYF 2 "register_operand" " f")
(match_operand:ANYF 3 "register_operand" " f"))))]
- "TARGET_HARD_FLOAT && !HONOR_SIGNED_ZEROS (<MODE>mode)"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && !HONOR_SIGNED_ZEROS (<MODE>mode)"
"fmsub.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1146,7 +1153,7 @@
(match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")
(match_operand:ANYF 3 "register_operand" " f"))))]
- "TARGET_HARD_FLOAT && !HONOR_SIGNED_ZEROS (<MODE>mode)"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && !HONOR_SIGNED_ZEROS (<MODE>mode)"
"fnmadd.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1159,7 +1166,7 @@
(match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")
(neg:ANYF (match_operand:ANYF 3 "register_operand" " f")))))]
- "TARGET_HARD_FLOAT && !HONOR_SIGNED_ZEROS (<MODE>mode)"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && !HONOR_SIGNED_ZEROS (<MODE>mode)"
"fnmsub.<fmt>\t%0,%1,%2,%3"
[(set_attr "type" "fmadd")
(set_attr "mode" "<UNITMODE>")])
@@ -1174,7 +1181,7 @@
(define_insn "abs<mode>2"
[(set (match_operand:ANYF 0 "register_operand" "=f")
(abs:ANYF (match_operand:ANYF 1 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fabs.<fmt>\t%0,%1"
[(set_attr "type" "fmove")
(set_attr "mode" "<UNITMODE>")])
@@ -1184,7 +1191,7 @@
(unspec:ANYF [(match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")]
UNSPEC_COPYSIGN))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fsgnj.<fmt>\t%0,%1,%2"
[(set_attr "type" "fmove")
(set_attr "mode" "<UNITMODE>")])
@@ -1192,7 +1199,7 @@
(define_insn "neg<mode>2"
[(set (match_operand:ANYF 0 "register_operand" "=f")
(neg:ANYF (match_operand:ANYF 1 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fneg.<fmt>\t%0,%1"
[(set_attr "type" "fmove")
(set_attr "mode" "<UNITMODE>")])
@@ -1209,7 +1216,7 @@
(unspec:ANYF [(use (match_operand:ANYF 1 "register_operand" " f"))
(use (match_operand:ANYF 2 "register_operand" " f"))]
UNSPEC_FMIN))]
- "TARGET_HARD_FLOAT && !HONOR_SNANS (<MODE>mode)"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && !HONOR_SNANS (<MODE>mode)"
"fmin.<fmt>\t%0,%1,%2"
[(set_attr "type" "fmove")
(set_attr "mode" "<UNITMODE>")])
@@ -1219,7 +1226,7 @@
(unspec:ANYF [(use (match_operand:ANYF 1 "register_operand" " f"))
(use (match_operand:ANYF 2 "register_operand" " f"))]
UNSPEC_FMAX))]
- "TARGET_HARD_FLOAT && !HONOR_SNANS (<MODE>mode)"
+ "(TARGET_HARD_FLOAT || TARGET_ZFINX) && !HONOR_SNANS (<MODE>mode)"
"fmax.<fmt>\t%0,%1,%2"
[(set_attr "type" "fmove")
(set_attr "mode" "<UNITMODE>")])
@@ -1228,7 +1235,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(smin:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fmin.<fmt>\t%0,%1,%2"
[(set_attr "type" "fmove")
(set_attr "mode" "<UNITMODE>")])
@@ -1237,7 +1244,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(smax:ANYF (match_operand:ANYF 1 "register_operand" " f")
(match_operand:ANYF 2 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fmax.<fmt>\t%0,%1,%2"
[(set_attr "type" "fmove")
(set_attr "mode" "<UNITMODE>")])
@@ -1298,7 +1305,7 @@
[(set (match_operand:SF 0 "register_operand" "=f")
(float_truncate:SF
(match_operand:DF 1 "register_operand" " f")))]
- "TARGET_DOUBLE_FLOAT"
+ "TARGET_DOUBLE_FLOAT || TARGET_ZDINX"
"fcvt.s.d\t%0,%1"
[(set_attr "type" "fcvt")
(set_attr "mode" "SF")])
@@ -1307,7 +1314,7 @@
[(set (match_operand:HF 0 "register_operand" "=f")
(float_truncate:HF
(match_operand:SF 1 "register_operand" " f")))]
- "TARGET_ZFHMIN"
+ "TARGET_ZFHMIN || TARGET_ZHINXMIN"
"fcvt.h.s\t%0,%1"
[(set_attr "type" "fcvt")
(set_attr "mode" "HF")])
@@ -1316,7 +1323,8 @@
[(set (match_operand:HF 0 "register_operand" "=f")
(float_truncate:HF
(match_operand:DF 1 "register_operand" " f")))]
- "TARGET_ZFHMIN && TARGET_DOUBLE_FLOAT"
+ "(TARGET_ZFHMIN && TARGET_DOUBLE_FLOAT) ||
+ (TARGET_ZHINXMIN && TARGET_ZDINX)"
"fcvt.h.d\t%0,%1"
[(set_attr "type" "fcvt")
(set_attr "mode" "HF")])
@@ -1442,7 +1450,7 @@
[(set (match_operand:SF 0 "register_operand" "=f")
(float_extend:SF
(match_operand:HF 1 "register_operand" " f")))]
- "TARGET_ZFHMIN"
+ "TARGET_ZFHMIN || TARGET_ZHINXMIN"
"fcvt.s.h\t%0,%1"
[(set_attr "type" "fcvt")
(set_attr "mode" "SF")])
@@ -1451,7 +1459,7 @@
[(set (match_operand:DF 0 "register_operand" "=f")
(float_extend:DF
(match_operand:SF 1 "register_operand" " f")))]
- "TARGET_DOUBLE_FLOAT"
+ "TARGET_DOUBLE_FLOAT || TARGET_ZDINX"
"fcvt.d.s\t%0,%1"
[(set_attr "type" "fcvt")
(set_attr "mode" "DF")])
@@ -1460,7 +1468,8 @@
[(set (match_operand:DF 0 "register_operand" "=f")
(float_extend:DF
(match_operand:HF 1 "register_operand" " f")))]
- "TARGET_ZFHMIN && TARGET_DOUBLE_FLOAT"
+ "(TARGET_ZFHMIN && TARGET_DOUBLE_FLOAT) ||
+ (TARGET_ZHINXMIN && TARGET_ZDINX)"
"fcvt.d.h\t%0,%1"
[(set_attr "type" "fcvt")
(set_attr "mode" "DF")])
@@ -1506,7 +1515,7 @@
[(set (match_operand:GPR 0 "register_operand" "=r")
(fix:GPR
(match_operand:ANYF 1 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fcvt.<GPR:ifmt>.<ANYF:fmt> %0,%1,rtz"
[(set_attr "type" "fcvt")
(set_attr "mode" "<ANYF:MODE>")])
@@ -1515,7 +1524,7 @@
[(set (match_operand:GPR 0 "register_operand" "=r")
(unsigned_fix:GPR
(match_operand:ANYF 1 "register_operand" " f")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fcvt.<GPR:ifmt>u.<ANYF:fmt> %0,%1,rtz"
[(set_attr "type" "fcvt")
(set_attr "mode" "<ANYF:MODE>")])
@@ -1524,7 +1533,7 @@
[(set (match_operand:ANYF 0 "register_operand" "= f")
(float:ANYF
(match_operand:GPR 1 "reg_or_0_operand" " rJ")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fcvt.<ANYF:fmt>.<GPR:ifmt>\t%0,%z1"
[(set_attr "type" "fcvt")
(set_attr "mode" "<ANYF:MODE>")])
@@ -1533,7 +1542,7 @@
[(set (match_operand:ANYF 0 "register_operand" "= f")
(unsigned_float:ANYF
(match_operand:GPR 1 "reg_or_0_operand" " rJ")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fcvt.<ANYF:fmt>.<GPR:ifmt>u\t%0,%z1"
[(set_attr "type" "fcvt")
(set_attr "mode" "<ANYF:MODE>")])
@@ -1543,7 +1552,7 @@
(unspec:GPR
[(match_operand:ANYF 1 "register_operand" " f")]
RINT))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fcvt.<GPR:ifmt>.<ANYF:fmt> %0,%1,<rint_rm>"
[(set_attr "type" "fcvt")
(set_attr "mode" "<ANYF:MODE>")])
@@ -2271,7 +2280,7 @@
(match_operand:ANYF 2 "register_operand")])
(label_ref (match_operand 3 ""))
(pc)))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
{
riscv_expand_conditional_branch (operands[3], GET_CODE (operands[0]),
operands[1], operands[2]);
@@ -2360,7 +2369,7 @@
(match_operator:SI 1 "fp_scc_comparison"
[(match_operand:ANYF 2 "register_operand")
(match_operand:ANYF 3 "register_operand")]))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
{
riscv_expand_float_scc (operands[0], GET_CODE (operands[1]), operands[2],
operands[3]);
@@ -2372,7 +2381,7 @@
(match_operator:X 1 "fp_native_comparison"
[(match_operand:ANYF 2 "register_operand" " f")
(match_operand:ANYF 3 "register_operand" " f")]))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"f%C1.<fmt>\t%0,%2,%3"
[(set_attr "type" "fcmp")
(set_attr "mode" "<UNITMODE>")])
@@ -2382,7 +2391,7 @@
(unspec:X [(match_operand:ANYF 1 "register_operand")
(match_operand:ANYF 2 "register_operand")]
QUIET_COMPARISON))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
{
rtx op0 = operands[0];
rtx op1 = operands[1];
@@ -2802,19 +2811,19 @@
(define_insn "riscv_frflags"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec_volatile [(const_int 0)] UNSPECV_FRFLAGS))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"frflags\t%0")
(define_insn "riscv_fsflags"
[(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FSFLAGS)]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"fsflags\t%0")
(define_insn "*riscv_fsnvsnan<mode>2"
[(unspec_volatile [(match_operand:ANYF 0 "register_operand" "f")
(match_operand:ANYF 1 "register_operand" "f")]
UNSPECV_FSNVSNAN)]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT || TARGET_ZFINX"
"feq.<fmt>\tzero,%0,%1"
[(set_attr "type" "fcmp")
(set_attr "mode" "<UNITMODE>")])
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 8923a11..426ea95 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -207,6 +207,9 @@ TargetVariable
int riscv_zb_subext
TargetVariable
+int riscv_zinx_subext
+
+TargetVariable
int riscv_zk_subext
TargetVariable
@@ -224,6 +227,9 @@ int riscv_zf_subext
TargetVariable
int riscv_zm_subext
+TargetVariable
+int riscv_sv_subext
+
Enum
Name(isa_spec_class) Type(enum riscv_isa_spec_class)
Supported ISA specs (for use with the -misa-spec= option):
diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv
index 8f67676..7997db3 100644
--- a/gcc/config/riscv/t-riscv
+++ b/gcc/config/riscv/t-riscv
@@ -63,6 +63,10 @@ riscv-selftests.o: $(srcdir)/config/riscv/riscv-selftests.cc
$(COMPILE) $<
$(POSTCOMPILE)
+riscv-v.o: $(srcdir)/config/riscv/riscv-v.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
PASSES_EXTRA += $(srcdir)/config/riscv/riscv-passes.def
$(common_out_file): $(srcdir)/config/riscv/riscv-cores.def \
diff --git a/gcc/config/riscv/vector-iterators.md b/gcc/config/riscv/vector-iterators.md
new file mode 100644
index 0000000..627e2f7
--- /dev/null
+++ b/gcc/config/riscv/vector-iterators.md
@@ -0,0 +1,58 @@
+;; Iterators for RISC-V 'V' Extension for GNU compiler.
+;; Copyright (C) 2022-2022 Free Software Foundation, Inc.
+;; Contributed by Juzhe Zhong (juzhe.zhong@rivai.ai), RiVAI Technologies Ltd.
+
+;; 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/>.
+
+(define_mode_iterator V [
+ VNx1QI VNx2QI VNx4QI VNx8QI VNx16QI VNx32QI (VNx64QI "TARGET_MIN_VLEN > 32")
+ VNx1HI VNx2HI VNx4HI VNx8HI VNx16HI (VNx32HI "TARGET_MIN_VLEN > 32")
+ VNx1SI VNx2SI VNx4SI VNx8SI (VNx16SI "TARGET_MIN_VLEN > 32")
+ VNx1DI VNx2DI VNx4DI (VNx8DI "TARGET_MIN_VLEN > 32")
+ (VNx1SF "TARGET_VECTOR_ELEN_FP_32")
+ (VNx2SF "TARGET_VECTOR_ELEN_FP_32")
+ (VNx4SF "TARGET_VECTOR_ELEN_FP_32")
+ (VNx8SF "TARGET_VECTOR_ELEN_FP_32")
+ (VNx16SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN > 32")
+ (VNx1DF "TARGET_VECTOR_ELEN_FP_64")
+ (VNx2DF "TARGET_VECTOR_ELEN_FP_64")
+ (VNx4DF "TARGET_VECTOR_ELEN_FP_64")
+ (VNx8DF "TARGET_VECTOR_ELEN_FP_64")
+])
+
+(define_mode_iterator VB [
+ VNx1BI VNx2BI VNx4BI VNx8BI VNx16BI VNx32BI
+ (VNx64BI "TARGET_MIN_VLEN > 32")
+])
+
+(define_mode_attr VM [
+ (VNx1QI "VNx1BI") (VNx2QI "VNx2BI") (VNx4QI "VNx4BI") (VNx8QI "VNx8BI") (VNx16QI "VNx16BI") (VNx32QI "VNx32BI") (VNx64QI "VNx64BI")
+ (VNx1HI "VNx1BI") (VNx2HI "VNx2BI") (VNx4HI "VNx4BI") (VNx8HI "VNx8BI") (VNx16HI "VNx16BI") (VNx32HI "VNx32BI")
+ (VNx1SI "VNx1BI") (VNx2SI "VNx2BI") (VNx4SI "VNx4BI") (VNx8SI "VNx8BI") (VNx16SI "VNx16BI")
+ (VNx1DI "VNx1BI") (VNx2DI "VNx2BI") (VNx4DI "VNx4BI") (VNx8DI "VNx8BI")
+ (VNx1SF "VNx1BI") (VNx2SF "VNx2BI") (VNx4SF "VNx4BI") (VNx8SF "VNx8BI") (VNx16SF "VNx16BI")
+ (VNx1DF "VNx1BI") (VNx2DF "VNx2BI") (VNx4DF "VNx4BI") (VNx8DF "VNx8BI")
+])
+
+(define_mode_attr sew [
+ (VNx1QI "8") (VNx2QI "8") (VNx4QI "8") (VNx8QI "8") (VNx16QI "8") (VNx32QI "8") (VNx64QI "8")
+ (VNx1HI "16") (VNx2HI "16") (VNx4HI "16") (VNx8HI "16") (VNx16HI "16") (VNx32HI "16")
+ (VNx1SI "32") (VNx2SI "32") (VNx4SI "32") (VNx8SI "32") (VNx16SI "32")
+ (VNx1DI "64") (VNx2DI "64") (VNx4DI "64") (VNx8DI "64")
+ (VNx1SF "32") (VNx2SF "32") (VNx4SF "32") (VNx8SF "32") (VNx16SF "32")
+ (VNx1DF "64") (VNx2DF "64") (VNx4DF "64") (VNx8DF "64")
+])
diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index 82ce902..451ed23 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -26,11 +26,72 @@
;; - Auto-vectorization (TBD)
;; - Combine optimization (TBD)
+(include "vector-iterators.md")
+
(define_c_enum "unspec" [
UNSPEC_VSETVL
+ UNSPEC_VUNDEF
+ UNSPEC_VPREDICATE
])
;; -----------------------------------------------------------------
+;; ---- Miscellaneous Operations
+;; -----------------------------------------------------------------
+
+(define_insn "vundefined<mode>"
+ [(set (match_operand:V 0 "register_operand" "=vr")
+ (unspec:V [(const_int 0)] UNSPEC_VUNDEF))]
+ "TARGET_VECTOR"
+ "")
+
+;; -----------------------------------------------------------------
+;; ---- Moves Operations
+;; -----------------------------------------------------------------
+
+(define_expand "mov<mode>"
+ [(set (match_operand:V 0 "reg_or_mem_operand")
+ (match_operand:V 1 "vector_move_operand"))]
+ "TARGET_VECTOR"
+{
+ if (riscv_vector::legitimize_move (operands[0], operands[1], <VM>mode))
+ DONE;
+})
+
+;; This pattern is used for code-gen for whole register load/stores.
+;; Also applicable for all register moves.
+;; Fractional vector modes load/store are not allowed to match this pattern.
+;; Mask modes load/store are not allowed to match this pattern.
+(define_insn "*mov<mode>"
+ [(set (match_operand:V 0 "reg_or_mem_operand" "=vr,m,vr")
+ (match_operand:V 1 "reg_or_mem_operand" "m,vr,vr"))]
+ "TARGET_VECTOR && ((register_operand (operands[0], <MODE>mode)
+ && register_operand (operands[1], <MODE>mode))
+ || known_ge (GET_MODE_SIZE (<MODE>mode), BYTES_PER_RISCV_VECTOR))"
+ "@
+ vl%m1re<sew>.v\t%0,%1
+ vs%m1r.v\t%1,%0
+ vmv%m1r.v\t%0,%1"
+ [(set_attr "type" "vldr,vstr,vmov")
+ (set_attr "mode" "<MODE>")])
+
+(define_expand "mov<mode>"
+ [(set (match_operand:VB 0 "reg_or_mem_operand")
+ (match_operand:VB 1 "vector_move_operand"))]
+ "TARGET_VECTOR"
+{
+ if (riscv_vector::legitimize_move (operands[0], operands[1], <MODE>mode))
+ DONE;
+})
+
+(define_insn "*mov<mode>"
+ [(set (match_operand:VB 0 "register_operand" "=vr")
+ (match_operand:VB 1 "register_operand" "vr"))]
+ "TARGET_VECTOR"
+ "vmv1r.v\t%0,%1"
+ [(set_attr "type" "vmov")
+ (set_attr "mode" "<MODE>")])
+
+;; -----------------------------------------------------------------
;; ---- 6. Configuration-Setting Instructions
;; -----------------------------------------------------------------
;; Includes:
@@ -50,13 +111,98 @@
;; operands[3]: LMUL
;; operands[4]: Tail policy 0 or 1 (undisturbed/agnostic)
;; operands[5]: Mask policy 0 or 1 (undisturbed/agnostic)
+
+;; We define 2 types of "vsetvl*" instruction patterns:
+
+;; - "@vsetvl<mode>" is a parallel format which has side effects.
+
+;; - "@vsetvl<mode>_no_side_effects" has no side effects.
+
+;; - "@vsetvl<mode>" is used by "vsetvl" intrinsics and "insert-vsetvl" PASS.
+
+;; - "@vsetvl<mode>_no_side_effects" is used by GCC standard patterns.
+
+;; - "@vsetvl<mode>" includes VL/VTYPE global registers status (define set)
+;; and each RVV instruction includes VL/VTYPE global registers status (use)
+;; so that we can guarantee each RVV instruction can execute with correct
+;; VL/VTYPE global registers status after "insert-vsetvl" PASS.
+
+;; - "@vsetvl<mode>_no_side_effects" has no side effects and excludes VL/VTYPE
+;; global registers status (define set). It's only used by GCC standard pattern
+;; expansion. For example: "mov<mode>" pattern for fractional vector modes which
+;; need to set VL/VTYPE. Then we could manually call this pattern to gain benefits
+;; from the optimization of each GCC internal PASS.
+
+;; 1. void foo (float *in, float *out)
+;; {
+;; vfloat32mf2_t v = *(vfloat32mf2_t*)in;
+;; *(vfloat32mf2_t*)out = v;
+;; }
+;; We could eliminate the second "vsetvl" by calling "@vsetvl<mode>_no_side_effects".
+;;
+;; "@vsetvl<mode>": ;; "@vsetvl<mode>_no_side_effects":
+;; vsetvli a4,zero,e32,mf2,ta,ma ;; vsetvli a4,zero,e32,mf2,ta,ma
+;; vle32.v v24,(a0) ;; vle32.v v24,(a0)
+;; vsetvli a4,zero,e32,mf2,ta,ma ;; --
+;; vse32.v v24,(a1) ;; vse32.v v24,(a1)
+;; ret ;; ret
+
+;; 2. void foo (int8_t *in, int8_t *out, int M)
+;; {
+;; for (int i = 0; i < M; i++){
+;; vint8mf2_t v = *(vint8mf2_t*)(in + i);
+;; *(vint8mf2_t*)(out + i) = v;
+;; }
+;; }
+;;
+;; Hoist "vsetvl" instruction in LICM:
+;; "@vsetvl<mode>": ;; "@vsetvl<mode>_no_side_effects":
+;; - ;; vsetvli a4,zero,e32,mf2,ta,ma
+;; LOOP: ;; LOOP:
+;; vsetvli a4,zero,e32,mf2,ta,ma ;; -
+;; vle32.v v24,(a0) ;; vle32.v v24,(a0)
+;; vsetvli a4,zero,e32,mf2,ta,ma ;; -
+;; vse32.v v24,(a1) ;; vse32.v v24,(a1)
+
+;; However, it may produce wrong codegen if we exclude VL/VTYPE in "vsevl<mode>".
+;; 3. void foo (int8_t *in, int8_t *out, int32_t *in2, int32_t *out2, int M)
+;; {
+;; for (int i = 0; i < M; i++){
+;; vint8mf2_t v = *(vint8mf2_t*)(in + i);
+;; vint32mf2_t v2 = *(vint32mf2_t*)(in + i + i);
+;; *(vint8mf2_t*)(out + i) = v;
+;; *(vint32mf2_t*)(out + i + i) = v2;
+;; }
+;; }
+;;
+;; vsetvli a6,zero,e8,mf2,ta,ma
+;; vsetvli a2,zero,e32,mf2,ta,ma
+;; LOOP:
+;; vle8.v v25,(a0)
+;; vle32.v v24,(a5)
+;; addi a0,a0,1
+;; vse8.v v25,(a1)
+;; vse32.v v24,(a3)
+;;
+;; Both vle8.v and vle32.v are using the wrong VL/VTYPE status.
+;; We leave it to "insert-vsetvl" PASS to correct this situation.
+
+;; The "insert-vsetvl" PASS mechanism:
+;; 1. Before "insert-vsetvl" PASS, only RVV instructions are generated
+;; by GCC standard pattern expansion has the corresponding "vsetvl".
+;; We exploit each GCC internal optimization pass to optimize the "vsetvl".
+;; 2. Correct the VL/VTYPE status for each GCC standard pattern RVV instructions.
+;; Insert vsetvl for each RVV instructions that has no VL/VTYPE status if necessary.
+;; For example: RVV intrinsics.
+;; 3. Optimize "vsetvl" instructions.
+
(define_insn "@vsetvl<mode>"
- [(set (match_operand:P 0 "register_operand" "=r,r")
- (unspec:P [(match_operand:P 1 "csr_operand" "r,K")
- (match_operand 2 "const_int_operand" "i,i")
- (match_operand 3 "const_int_operand" "i,i")
- (match_operand 4 "const_int_operand" "i,i")
- (match_operand 5 "const_int_operand" "i,i")] UNSPEC_VSETVL))
+ [(set (match_operand:P 0 "register_operand" "=r")
+ (unspec:P [(match_operand:P 1 "csr_operand" "rK")
+ (match_operand 2 "const_int_operand" "i")
+ (match_operand 3 "const_int_operand" "i")
+ (match_operand 4 "const_int_operand" "i")
+ (match_operand 5 "const_int_operand" "i")] UNSPEC_VSETVL))
(set (reg:SI VL_REGNUM)
(unspec:SI [(match_dup 1)
(match_dup 2)
@@ -70,3 +216,124 @@
"vset%i1vli\t%0,%1,e%2,%m3,t%p4,m%p5"
[(set_attr "type" "vsetvl")
(set_attr "mode" "<MODE>")])
+
+;; We keep it as no side effects before reload_completed.
+;; In this case, we can gain benefits from different GCC
+;; internal PASS such as cprop, fwprop, combine,...etc.
+
+;; Then recover it for "insert-vsetvl" and "sched2" PASS
+;; in order to get correct codegen.
+(define_insn_and_split "@vsetvl<mode>_no_side_effects"
+ [(set (match_operand:P 0 "register_operand" "=r")
+ (unspec:P [(match_operand:P 1 "csr_operand" "rK")
+ (match_operand 2 "const_int_operand" "i")
+ (match_operand 3 "const_int_operand" "i")
+ (match_operand 4 "const_int_operand" "i")
+ (match_operand 5 "const_int_operand" "i")] UNSPEC_VSETVL))]
+ "TARGET_VECTOR"
+ "#"
+ "&& reload_completed"
+ [(parallel
+ [(set (match_dup 0)
+ (unspec:P [(match_dup 1) (match_dup 2) (match_dup 3)
+ (match_dup 4) (match_dup 5)] UNSPEC_VSETVL))
+ (set (reg:SI VL_REGNUM)
+ (unspec:SI [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPEC_VSETVL))
+ (set (reg:SI VTYPE_REGNUM)
+ (unspec:SI [(match_dup 2) (match_dup 3) (match_dup 4)
+ (match_dup 5)] UNSPEC_VSETVL))])]
+ ""
+ [(set_attr "type" "vsetvl")
+ (set_attr "mode" "<MODE>")])
+
+;; RVV machine description matching format
+;; (define_insn ""
+;; [(set (match_operand:MODE 0)
+;; (if_then_else:MODE
+;; (unspec:<MODE:VM>
+;; [(match_operand:<VM> 1 "vector_mask_operand")
+;; (match_operand N + 4 "vector_length_operand")
+;; (match_operand N + 5 "const_int_operand")
+;; (match_operand N + 6 "const_int_operand")
+;; (reg:SI VL_REGNUM)
+;; (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+;; (instruction operation:MODE
+;; (match_operand 3
+;; (match_operand 4
+;; (match_operand 5
+;; ................
+;; (match_operand N + 3)
+;; (match_operand:MODE 2 "vector_reg_or_const0_operand")))]
+;;
+;; (unspec:[........] UNSPEC_VPREDICATE) is a predicate wrapper.
+;; Include mask predicate && length predicate && vector policy.
+
+;; -------------------------------------------------------------------------------
+;; ---- Predicated Mov
+;; -------------------------------------------------------------------------------
+;; Includes:
+;; - 7.4. Vector Unit-Stride Instructions
+;; - 11.16 Vector Integer Move Instructions
+;; - 13.16 Vector Floating-Point Move Instruction
+;; - 15.1 Vector Mask-Register Logical Instructions
+;; -------------------------------------------------------------------------------
+
+;; vle.v/vse.v/vmv.v.v/vmv.v.x/vmv.v.i/vfmv.v.f.
+;; For vle.v/vmv.v.v/vmv.v.x/vmv.v.i/vfmv.v.f, we may need merge and mask operand.
+;; For vse.v, we don't need merge operand, so it should always match "vu".
+;; constraint alternative 0 ~ 1 match vle.v.
+;; constraint alternative 2 match vse.v.
+;; constraint alternative 3 match vmv.v.v.
+;; constraint alternative 4 match vmv.v.i.
+;; For vmv.v.i, we allow 2 following cases:
+;; 1. (const_vector:VNx1QI repeat [
+;; (const_int:QI N)]), -15 <= N < 16.
+;; 2. (const_vector:VNx1SF repeat [
+;; (const_double:SF 0.0 [0x0.0p+0])]).
+(define_insn "@pred_mov<mode>"
+ [(set (match_operand:V 0 "nonimmediate_operand" "=vd, vr, m, vr, vr")
+ (if_then_else:V
+ (unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" " vm, Wc1, vmWc1, vmWc1, Wc1")
+ (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK")
+ (match_operand 5 "const_int_operand" " i, i, i, i, i")
+ (match_operand 6 "const_int_operand" " i, i, i, i, i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (match_operand:V 3 "vector_move_operand" " m, m, vr, vr, viWc0")
+ (match_operand:V 2 "vector_merge_operand" " 0, vu, 0, vu0, vu0")))]
+ "TARGET_VECTOR"
+ "@
+ vle<sew>.v\t%0,%3%p1
+ vle<sew>.v\t%0,%3%p1
+ vse<sew>.v\t%3,%0%p1
+ vmv.v.v\t%0,%3
+ vmv.v.i\t%0,v%3"
+ [(set_attr "type" "vlde,vlde,vste,vimov,vimov")
+ (set_attr "mode" "<MODE>")])
+
+;; vlm.v/vsm.v/vmclr.m/vmset.m.
+;; constraint alternative 0 match vlm.v.
+;; constraint alternative 2 match vsm.v.
+;; constraint alternative 3 match vmclr.m.
+;; constraint alternative 4 match vmset.m.
+(define_insn "@pred_mov<mode>"
+ [(set (match_operand:VB 0 "nonimmediate_operand" "=vr, m, vr, vr")
+ (if_then_else:VB
+ (unspec:VB
+ [(match_operand:VB 1 "vector_mask_operand" "Wc1, Wc1, Wc1, Wc1")
+ (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
+ (match_operand 5 "const_int_operand" " i, i, i, i")
+ (match_operand 6 "const_int_operand" " i, i, i, i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (match_operand:VB 3 "vector_move_operand" " m, vr, Wc0, Wc1")
+ (match_operand:VB 2 "vector_merge_operand" " vu, 0, vu, vu")))]
+ "TARGET_VECTOR"
+ "@
+ vlm.v\t%0,%3
+ vsm.v\t%3,%0
+ vmclr.m\t%0
+ vmset.m\t%0"
+ [(set_attr "type" "vldm,vstm,vmalu,vmalu")
+ (set_attr "mode" "<MODE>")])
diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc
index ac3cb7e..6da4de6 100644
--- a/gcc/config/rs6000/rs6000-call.cc
+++ b/gcc/config/rs6000/rs6000-call.cc
@@ -2253,7 +2253,9 @@ setup_incoming_varargs (cumulative_args_t cum,
/* Skip the last named argument. */
next_cum = *get_cumulative_args (cum);
- rs6000_function_arg_advance_1 (&next_cum, arg.mode, arg.type, arg.named, 0);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ rs6000_function_arg_advance_1 (&next_cum, arg.mode, arg.type, arg.named,
+ 0);
if (DEFAULT_ABI == ABI_V4)
{
@@ -2327,7 +2329,8 @@ setup_incoming_varargs (cumulative_args_t cum,
first_reg_offset = next_cum.words;
save_area = crtl->args.internal_arg_pointer;
- if (targetm.calls.must_pass_in_stack (arg))
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))
+ && targetm.calls.must_pass_in_stack (arg))
first_reg_offset += rs6000_arg_size (TYPE_MODE (arg.type), arg.type);
}
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 01e5bbc..a85d7630 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -9759,8 +9759,11 @@ rs6000_init_stack_protect_guard (void)
static bool
rs6000_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
{
- if (GET_CODE (x) == HIGH
- && GET_CODE (XEXP (x, 0)) == UNSPEC)
+ /* If GET_CODE (x) is HIGH, the 'X' represets the high part of a symbol_ref.
+ It can not be put into a constant pool. e.g.
+ (high:DI (unspec:DI [(symbol_ref/u:DI ("*.LC0")..)
+ (high:DI (symbol_ref:DI ("var")..)). */
+ if (GET_CODE (x) == HIGH)
return true;
/* A TLS symbol in the TOC cannot contain a sum. */
diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc
index 9bee618..1aec70a 100644
--- a/gcc/config/sh/sh.cc
+++ b/gcc/config/sh/sh.cc
@@ -8183,11 +8183,12 @@ sh_setup_incoming_varargs (cumulative_args_t ca,
gcc_assert (cfun->stdarg);
if (TARGET_VARARGS_PRETEND_ARGS (current_function_decl))
{
- int named_parm_regs, anon_parm_regs;
+ int named_parm_regs = 0, anon_parm_regs;
- named_parm_regs = (sh_round_reg (*get_cumulative_args (ca), arg.mode)
- + CEIL (arg.promoted_size_in_bytes (),
- UNITS_PER_WORD));
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ named_parm_regs = (sh_round_reg (*get_cumulative_args (ca), arg.mode)
+ + CEIL (arg.promoted_size_in_bytes (),
+ UNITS_PER_WORD));
anon_parm_regs = NPARM_REGS (SImode) - named_parm_regs;
if (anon_parm_regs > 0)
*pretend_arg_size = anon_parm_regs * 4;
diff --git a/gcc/config/t-glibc b/gcc/config/t-glibc
index c8b7d4e..f26c37a 100644
--- a/gcc/config/t-glibc
+++ b/gcc/config/t-glibc
@@ -20,6 +20,14 @@ glibc-c.o: config/glibc-c.cc
$(COMPILE) $<
$(POSTCOMPILE)
-glibc-d.o: config/glibc-d.cc
+gnu-d.o: config/gnu-d.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+kfreebsd-d.o: config/kfreebsd-d.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+kopensolaris-d.o: config/kopensolaris-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
diff --git a/gcc/config/t-linux b/gcc/config/t-linux
index d9bc9b8..830b987 100644
--- a/gcc/config/t-linux
+++ b/gcc/config/t-linux
@@ -19,3 +19,7 @@
linux.o: $(srcdir)/config/linux.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+linux-d.o: $(srcdir)/config/linux-d.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/visium/visium.cc b/gcc/config/visium/visium.cc
index 03c1a33..e7d1596 100644
--- a/gcc/config/visium/visium.cc
+++ b/gcc/config/visium/visium.cc
@@ -1481,7 +1481,8 @@ visium_setup_incoming_varargs (cumulative_args_t pcum_v,
/* The caller has advanced ARGS_SO_FAR up to, but not beyond, the last named
argument. Advance a local copy of ARGS_SO_FAR past the last "real" named
argument, to find out how many registers are left over. */
- TARGET_FUNCTION_ARG_ADVANCE (local_args_so_far, arg);
+ if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+ TARGET_FUNCTION_ARG_ADVANCE (local_args_so_far, arg);
/* Find how many registers we need to save. */
locargs = get_cumulative_args (local_args_so_far);
diff --git a/gcc/config/vms/vms-c.cc b/gcc/config/vms/vms-c.cc
index 2f74fb5..ccf6d5f 100644
--- a/gcc/config/vms/vms-c.cc
+++ b/gcc/config/vms/vms-c.cc
@@ -455,9 +455,6 @@ vms_c_register_includes (const char *sysroot,
void
vms_c_common_override_options (void)
{
- /* Allow variadic functions without parameters (as declared in starlet). */
- flag_allow_parameterless_variadic_functions = TRUE;
-
/* Initialize c_default_pointer_mode. */
switch (flag_vms_pointer_size)
{
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 2e7f76a..de9bcbf 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -940,9 +940,10 @@
because of offering further optimization opportunities. */
if (register_operand (operands[0], DImode))
{
- xtensa_split_DI_reg_imm (operands);
- emit_move_insn (operands[0], operands[1]);
- emit_move_insn (operands[2], operands[3]);
+ rtx ops[4] = { operands[0], operands[1] };
+ xtensa_split_DI_reg_imm (ops);
+ emit_move_insn (ops[0], ops[1]);
+ emit_move_insn (ops[2], ops[3]);
DONE;
}
diff --git a/gcc/configure b/gcc/configure
index 8e3c89b..0ee4be4 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -12684,7 +12684,9 @@ objext='.o'
# With Setjmp/Longjmp based exception handling.
# Check whether --enable-sjlj-exceptions was given.
if test "${enable_sjlj_exceptions+set}" = set; then :
- enableval=$enable_sjlj_exceptions; case $target in
+ enableval=$enable_sjlj_exceptions; force_sjlj_exceptions=yes
+else
+ case $target in
lm32*-*-*)
force_sjlj_exceptions=yes
enableval=yes
@@ -19718,7 +19720,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19717 "configure"
+#line 19723 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19824,7 +19826,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19823 "configure"
+#line 19829 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index eb92a37..4ecccff 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1805,6 +1805,7 @@ AC_SUBST(objext)
AC_ARG_ENABLE(sjlj-exceptions,
[AS_HELP_STRING([--enable-sjlj-exceptions],
[arrange to use setjmp/longjmp exception handling])],
+[force_sjlj_exceptions=yes],
[case $target in
lm32*-*-*)
force_sjlj_exceptions=yes
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 04c8216..82629ef 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,127 @@
+2022-10-28 Marek Polacek <polacek@redhat.com>
+
+ * call.cc (maybe_warn_dangling_reference): Enable the warning in
+ system headers if the decl isn't in a system header.
+
+2022-10-28 Jason Merrill <jason@redhat.com>
+
+ * decl.cc (grokdeclarator): Call decl_attributes before do_friend.
+
+2022-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * parser.cc (cp_parser_omp_all_clauses): Allow optional comma
+ before the first clause even in pragma syntax.
+ (cp_parser_omp_allocate, cp_parser_omp_atomic, cp_parser_omp_depobj,
+ cp_parser_omp_flush, cp_parser_omp_scan_loop_body,
+ cp_parser_omp_ordered, cp_parser_omp_assumption_clauses,
+ cp_finish_omp_declare_variant, cp_parser_omp_declare_target,
+ cp_parser_omp_declare_reduction_exprs, cp_parser_omp_requires,
+ cp_parser_omp_error): Likewise.
+
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/61469
+ * cp-tree.h (ENUM_FIXED_UNDERLYING_TYPE_P, ENUM_UNDERLYING_TYPE):
+ Remove. Moved to c-common.h.
+
+2022-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/107379
+ * name-lookup.cc (push_namespace): Call find_namespace_slot again
+ after pushdecl as the hash table might be expanded during pushdecl.
+
+2022-10-27 Nathan Sidwell <nathan@acm.org>
+
+ * mangle.cc (write_closure_template_head): New.
+ (write_closure_type_name): Call it.
+
+2022-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/107382
+ PR c++/107383
+ * typeck.cc (cp_build_binary_op): Don't compute semantic_result_type
+ if result_type is NULL.
+
+2022-10-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106393
+ * call.cc (expr_represents_temporary_p): New, factored out of...
+ (conv_binds_ref_to_temporary): ...here. Don't return false just
+ because a ck_base is missing. Use expr_represents_temporary_p.
+ (do_warn_dangling_reference): New.
+ (maybe_warn_dangling_reference): New.
+ (extend_ref_init_temps): Call maybe_warn_dangling_reference.
+ * cp-tree.h: Adjust comment.
+ * typeck.cc (check_return_expr): Suppress -Wdangling-reference
+ warnings.
+
+2022-10-25 Nathan Sidwell <nathan@acm.org>
+
+ * parser.cc (synthesize_implicit_template_parm): Fix thinko about
+ mark the new parm DECL_VIRTUAL_P. Avoid unneccessary tree_last call.
+
+2022-10-25 Patrick Palka <ppalka@redhat.com>
+
+ * constraint.cc (resolve_function_concept_overload): Explicitly
+ pass complain=tf_none to coerce_template_parms.
+ (resolve_concept_check): Likewise.
+ (normalize_concept_check): Likewise.
+ * cp-tree.h (coerce_template_parms): Declare the main overload
+ and default its last parameter to true. Remove wrapper overloads.
+ * pt.cc (determine_specialization): Adjust calls to
+ coerce_template_parms and coerce_innermost_template_parms after
+ removing their last parameter.
+ (coerce_template_args_for_ttp): Likewise.
+ (coerce_ttp_args_for_tta): Likewise.
+ (coerce_template_template_parms): Likewise.
+ (coerce_template_parms): Remove use_default_args parameter and
+ adjust function comment. Document default argument. Remove
+ wrapper overloads. No longer static.
+ (coerce_innermost_template_parms): Remove use_default_args
+ parameter. Default require_all_args to true.
+ (lookup_template_class): As with determine_specialization.
+ (finish_template_variable): Likewise.
+ (tsubst_decl): Likewise.
+ (instantiate_alias_template): Likewise.
+ (fn_type_unification): Likewise.
+ (resolve_overloaded_unification): Likewise.
+ (resolve_nondeduced_context): Likewise.
+ (get_partial_spec_bindings): Likewise.
+
+2022-10-25 Jason Merrill <jason@redhat.com>
+
+ * constexpr.cc (find_failing_clause_r): Re-add the call to
+ contextual_conv_bool.
+
+2022-10-25 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/106848
+ PR c++/102600
+ * module.cc (trees_out::core_vals): Stream TYPE_MAX_VALUE and
+ TYPE_MIN_VALUE of ENUMERAL_TYPE.
+ (trees_in::core_vals): Likewise.
+ (trees_out::write_enum_def): Don't stream them here.
+ (trees_in::read_enum_def): Likewise.
+
+2022-10-25 Jason Merrill <jason@redhat.com>
+
+ * constexpr.cc (class constexpr_global_ctx): Add modifiable field,
+ get_value, get_value_ptr, put_value, remove_value, flush_modifiable
+ member functions.
+ (class modifiable_tracker): New.
+ (cxx_eval_internal_function): Use it.
+ (diagnose_failing_condition): Strip CLEANUP_POINT_EXPR.
+
+2022-10-25 Jason Merrill <jason@redhat.com>
+
+ * constexpr.cc (fold_operand): New function.
+ (find_failing_clause_r): Add const.
+ (find_failing_clause): Add const.
+ (diagnose_failing_condition): Add ctx parameter.
+ (cxx_eval_internal_function): Pass it.
+ * semantics.cc (diagnose_failing_condition): Move to constexpr.cc.
+ * cp-tree.h: Adjust.
+
2022-10-24 Jason Merrill <jason@redhat.com>
* cp-gimplify.cc (fold_builtin_source_location)
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index 6a34e9c..c7c7a12 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -9313,6 +9313,16 @@ conv_binds_ref_to_prvalue (conversion *c)
return conv_is_prvalue (next_conversion (c));
}
+/* True iff EXPR represents a (subobject of a) temporary. */
+
+static bool
+expr_represents_temporary_p (tree expr)
+{
+ while (handled_component_p (expr))
+ expr = TREE_OPERAND (expr, 0);
+ return TREE_CODE (expr) == TARGET_EXPR;
+}
+
/* True iff C is a conversion that binds a reference to a temporary.
This is a superset of conv_binds_ref_to_prvalue: here we're also
interested in xvalues. */
@@ -9330,18 +9340,14 @@ conv_binds_ref_to_temporary (conversion *c)
struct Derived : Base {};
const Base& b(Derived{});
where we bind 'b' to the Base subobject of a temporary object of type
- Derived. The subobject is an xvalue; the whole object is a prvalue. */
- if (c->kind != ck_base)
- return false;
- c = next_conversion (c);
- if (c->kind == ck_identity && c->u.expr)
- {
- tree expr = c->u.expr;
- while (handled_component_p (expr))
- expr = TREE_OPERAND (expr, 0);
- if (TREE_CODE (expr) == TARGET_EXPR)
- return true;
- }
+ Derived. The subobject is an xvalue; the whole object is a prvalue.
+
+ The ck_base doesn't have to be present for cases like X{}.m. */
+ if (c->kind == ck_base)
+ c = next_conversion (c);
+ if (c->kind == ck_identity && c->u.expr
+ && expr_represents_temporary_p (c->u.expr))
+ return true;
return false;
}
@@ -13428,6 +13434,128 @@ initialize_reference (tree type, tree expr,
return expr;
}
+/* Helper for maybe_warn_dangling_reference to find a problematic CALL_EXPR
+ that initializes the LHS (and at least one of its arguments represents
+ a temporary, as outlined in maybe_warn_dangling_reference), or NULL_TREE
+ if none found. For instance:
+
+ const S& s = S().self(); // S::self (&TARGET_EXPR <...>)
+ const int& r = (42, f(1)); // f(1)
+ const int& t = b ? f(1) : f(2); // f(1)
+ const int& u = b ? f(1) : f(g); // f(1)
+ const int& v = b ? f(g) : f(2); // f(2)
+ const int& w = b ? f(g) : f(g); // NULL_TREE
+ const int& y = (f(1), 42); // NULL_TREE
+ const int& z = f(f(1)); // f(f(1))
+
+ EXPR is the initializer. */
+
+static tree
+do_warn_dangling_reference (tree expr)
+{
+ STRIP_NOPS (expr);
+ switch (TREE_CODE (expr))
+ {
+ case CALL_EXPR:
+ {
+ tree fndecl = cp_get_callee_fndecl_nofold (expr);
+ if (!fndecl
+ || warning_suppressed_p (fndecl, OPT_Wdangling_reference)
+ || !warning_enabled_at (DECL_SOURCE_LOCATION (fndecl),
+ OPT_Wdangling_reference)
+ /* If the function doesn't return a reference, don't warn. This
+ can be e.g.
+ const int& z = std::min({1, 2, 3, 4, 5, 6, 7});
+ which doesn't dangle: std::min here returns an int. */
+ || !TYPE_REF_OBJ_P (TREE_TYPE (TREE_TYPE (fndecl))))
+ return NULL_TREE;
+
+ /* Here we're looking to see if any of the arguments is a temporary
+ initializing a reference parameter. */
+ for (int i = 0; i < call_expr_nargs (expr); ++i)
+ {
+ tree arg = CALL_EXPR_ARG (expr, i);
+ /* Check that this argument initializes a reference, except for
+ the argument initializing the object of a member function. */
+ if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
+ && !TYPE_REF_P (TREE_TYPE (arg)))
+ continue;
+ /* It could also be another call taking a temporary and returning
+ it and initializing this reference parameter. */
+ if (do_warn_dangling_reference (arg))
+ return expr;
+ STRIP_NOPS (arg);
+ if (TREE_CODE (arg) == ADDR_EXPR)
+ arg = TREE_OPERAND (arg, 0);
+ if (expr_represents_temporary_p (arg))
+ return expr;
+ /* Don't warn about member function like:
+ std::any a(...);
+ S& s = a.emplace<S>({0}, 0);
+ which constructs a new object and returns a reference to it, but
+ we still want to detect:
+ struct S { const S& self () { return *this; } };
+ const S& s = S().self();
+ where 's' dangles. If we've gotten here, the object this function
+ is invoked on is not a temporary. */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl))
+ break;
+ }
+ return NULL_TREE;
+ }
+ case COMPOUND_EXPR:
+ return do_warn_dangling_reference (TREE_OPERAND (expr, 1));
+ case COND_EXPR:
+ if (tree t = do_warn_dangling_reference (TREE_OPERAND (expr, 1)))
+ return t;
+ return do_warn_dangling_reference (TREE_OPERAND (expr, 2));
+ case PAREN_EXPR:
+ return do_warn_dangling_reference (TREE_OPERAND (expr, 0));
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Implement -Wdangling-reference, to detect cases like
+
+ int n = 1;
+ const int& r = std::max(n - 1, n + 1); // r is dangling
+
+ This creates temporaries from the arguments, returns a reference to
+ one of the temporaries, but both temporaries are destroyed at the end
+ of the full expression.
+
+ This works by checking if a reference is initialized with a function
+ that returns a reference, and at least one parameter of the function
+ is a reference that is bound to a temporary. It assumes that such a
+ function actually returns one of its arguments.
+
+ DECL is the reference being initialized, INIT is the initializer. */
+
+static void
+maybe_warn_dangling_reference (const_tree decl, tree init)
+{
+ if (!warn_dangling_reference)
+ return;
+ if (!TYPE_REF_P (TREE_TYPE (decl)))
+ return;
+ /* Don't suppress the diagnostic just because the call comes from
+ a system header. If the DECL is not in a system header, or if
+ -Wsystem-headers was provided, warn. */
+ auto wsh
+ = make_temp_override (global_dc->dc_warn_system_headers,
+ (!in_system_header_at (DECL_SOURCE_LOCATION (decl))
+ || global_dc->dc_warn_system_headers));
+ if (tree call = do_warn_dangling_reference (init))
+ {
+ auto_diagnostic_group d;
+ if (warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wdangling_reference,
+ "possibly dangling reference to a temporary"))
+ inform (EXPR_LOCATION (call), "the temporary was destroyed at "
+ "the end of the full expression %qE", call);
+ }
+}
+
/* If *P is an xvalue expression, prevent temporary lifetime extension if it
gets used to initialize a reference. */
@@ -13525,6 +13653,9 @@ extend_ref_init_temps (tree decl, tree init, vec<tree, va_gc> **cleanups,
tree type = TREE_TYPE (init);
if (processing_template_decl)
return init;
+
+ maybe_warn_dangling_reference (decl, init);
+
if (TYPE_REF_P (type))
init = extend_ref_init_temps_1 (decl, init, cleanups, cond_guard);
else
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 74898ca..5e6a3bc 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -323,7 +323,7 @@ resolve_function_concept_overload (tree ovl, tree args)
/* Remember the candidate if we can deduce a substitution. */
++processing_template_decl;
tree parms = TREE_VALUE (DECL_TEMPLATE_PARMS (tmpl));
- if (tree subst = coerce_template_parms (parms, args, tmpl))
+ if (tree subst = coerce_template_parms (parms, args, tmpl, tf_none))
{
if (subst == error_mark_node)
++nerrs;
@@ -404,7 +404,7 @@ resolve_concept_check (tree check)
tree args = TREE_OPERAND (id, 1);
tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (tmpl));
++processing_template_decl;
- tree result = coerce_template_parms (parms, args, tmpl);
+ tree result = coerce_template_parms (parms, args, tmpl, tf_none);
--processing_template_decl;
if (result == error_mark_node)
return error_mark_node;
@@ -726,7 +726,7 @@ normalize_concept_check (tree check, tree args, norm_info info)
/* Turn on template processing; coercing non-type template arguments
will automatically assume they're non-dependent. */
++processing_template_decl;
- tree subst = coerce_template_parms (parms, targs, tmpl);
+ tree subst = coerce_template_parms (parms, targs, tmpl, tf_none);
--processing_template_decl;
if (subst == error_mark_node)
return error_mark_node;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4b5d14f..f4104c8 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -464,7 +464,6 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
TI_PENDING_TEMPLATE_FLAG.
TEMPLATE_PARMS_FOR_INLINE.
DELETE_EXPR_USE_VEC (in DELETE_EXPR).
- (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
ICS_ELLIPSIS_FLAG (in _CONV)
DECL_INITIALIZED_P (in VAR_DECL)
TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
@@ -4606,30 +4605,6 @@ get_vec_init_expr (tree t)
#define OPAQUE_ENUM_P(TYPE) \
(TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_OPAQUE (TYPE))
-/* Determines whether an ENUMERAL_TYPE has an explicit
- underlying type. */
-#define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_5 (NODE))
-
-/* Returns the underlying type of the given enumeration type. The
- underlying type is determined in different ways, depending on the
- properties of the enum:
-
- - In C++0x, the underlying type can be explicitly specified, e.g.,
-
- enum E1 : char { ... } // underlying type is char
-
- - In a C++0x scoped enumeration, the underlying type is int
- unless otherwises specified:
-
- enum class E2 { ... } // underlying type is int
-
- - Otherwise, the underlying type is determined based on the
- values of the enumerators. In this case, the
- ENUM_UNDERLYING_TYPE will not be set until after the definition
- of the enumeration is completed by finish_enum. */
-#define ENUM_UNDERLYING_TYPE(TYPE) \
- TREE_TYPE (ENUMERAL_TYPE_CHECK (TYPE))
-
/* [dcl.init.aggr]
An aggregate is an array or a class with no user-provided
@@ -4665,6 +4640,9 @@ get_vec_init_expr (tree t)
When appearing in a CONSTRUCTOR, the expression is an unconverted
compound literal.
+ When appearing in a CALL_EXPR, it means that it is a call to
+ a constructor.
+
When appearing in a FIELD_DECL, it means that this field
has been duly initialized in its constructor. */
#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
@@ -7572,8 +7550,8 @@ extern tree get_function_template_decl (const_tree);
extern tree resolve_nondeduced_context (tree, tsubst_flags_t);
extern tree resolve_nondeduced_context_or_error (tree, tsubst_flags_t);
extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val);
-extern tree coerce_template_parms (tree, tree, tree);
-extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t);
+extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t,
+ bool = true);
extern tree canonicalize_type_argument (tree, tsubst_flags_t);
extern void register_local_identity (tree);
extern void register_local_specialization (tree, tree);
diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 311ba02..573961a 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -1734,6 +1734,66 @@ write_unnamed_type_name (const tree type)
write_compact_number (discriminator);
}
+// A template head, for templated lambdas.
+// <template-head> ::= Tp* Ty
+// Tp* Tn <type>
+// Tp* Tt <template-head> E
+// New in ABI=18. Returns true iff we emitted anything -- used for ABI
+// version warning.
+
+static bool
+write_closure_template_head (tree tmpl)
+{
+ bool any = false;
+
+ // We only need one level of template parms
+ tree inner = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (tmpl));
+
+ for (int ix = 0, len = TREE_VEC_LENGTH (inner); ix != len; ix++)
+ {
+ tree parm = TREE_VEC_ELT (inner, ix);
+ if (parm == error_mark_node)
+ continue;
+ parm = TREE_VALUE (parm);
+
+ if (DECL_VIRTUAL_P (parm))
+ // A synthetic parm, we're done.
+ break;
+
+ any = true;
+ if (abi_version_at_least (18))
+ {
+ if (TREE_CODE (parm) == PARM_DECL
+ ? TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))
+ : TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (parm)))
+ write_string ("Tp");
+
+ switch (TREE_CODE (parm))
+ {
+ default:
+ gcc_unreachable ();
+
+ case TYPE_DECL:
+ write_string ("Ty");
+ break;
+
+ case PARM_DECL:
+ write_string ("Tn");
+ write_type (TREE_TYPE (parm));
+ break;
+
+ case TEMPLATE_DECL:
+ write_string ("Tt");
+ write_closure_template_head (parm);
+ write_string ("E");
+ break;
+ }
+ }
+ }
+
+ return any;
+}
+
/* <closure-type-name> ::= Ul <lambda-sig> E [ <nonnegative number> ] _
<lambda-sig> ::= <parameter type>+ # Parameter types or "v" if the lambda has no parameters */
@@ -1747,6 +1807,14 @@ write_closure_type_name (const tree type)
MANGLE_TRACE_TREE ("closure-type-name", type);
write_string ("Ul");
+
+ if (auto ti = maybe_template_info (fn))
+ if (write_closure_template_head (TI_TEMPLATE (ti)))
+ // If there were any explicit template parms, we may need to
+ // issue a mangling diagnostic.
+ if (abi_warn_or_compat_version_crosses (18))
+ G.need_abi_warning = true;
+
write_method_parms (parms, /*method_p=*/1, fn);
write_char ('E');
write_compact_number (LAMBDA_EXPR_DISCRIMINATOR (lambda));
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 1ceac77..90f945a 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -6017,9 +6017,17 @@ trees_out::core_vals (tree t)
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
{
+ if (code == ENUMERAL_TYPE)
+ {
+ /* These fields get set even for opaque enums that lack a
+ definition, so we stream them directly for each ENUMERAL_TYPE.
+ We stream TYPE_VALUES as part of the definition. */
+ WT (t->type_non_common.maxval);
+ WT (t->type_non_common.minval);
+ }
/* Records and unions hold FIELDS, VFIELD & BINFO on these
things. */
- if (!RECORD_OR_UNION_CODE_P (code) && code != ENUMERAL_TYPE)
+ else if (!RECORD_OR_UNION_CODE_P (code))
{
// FIXME: These are from tpl_parm_value's 'type' writing.
// Perhaps it should just be doing them directly?
@@ -6530,9 +6538,17 @@ trees_in::core_vals (tree t)
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
{
+ if (code == ENUMERAL_TYPE)
+ {
+ /* These fields get set even for opaque enums that lack a
+ definition, so we stream them directly for each ENUMERAL_TYPE.
+ We stream TYPE_VALUES as part of the definition. */
+ RT (t->type_non_common.maxval);
+ RT (t->type_non_common.minval);
+ }
/* Records and unions hold FIELDS, VFIELD & BINFO on these
things. */
- if (!RECORD_OR_UNION_CODE_P (code) && code != ENUMERAL_TYPE)
+ else if (!RECORD_OR_UNION_CODE_P (code))
{
/* This is not clobbering TYPE_CACHED_VALUES, because this
is a type that doesn't have any. */
@@ -12244,8 +12260,8 @@ trees_out::write_enum_def (tree decl)
tree type = TREE_TYPE (decl);
tree_node (TYPE_VALUES (type));
- tree_node (TYPE_MIN_VALUE (type));
- tree_node (TYPE_MAX_VALUE (type));
+ /* Note that we stream TYPE_MIN/MAX_VALUE directly as part of the
+ ENUMERAL_TYPE. */
}
void
@@ -12269,8 +12285,6 @@ trees_in::read_enum_def (tree defn, tree maybe_template)
{
tree type = TREE_TYPE (defn);
tree values = tree_node ();
- tree min = tree_node ();
- tree max = tree_node ();
if (get_overrun ())
return false;
@@ -12281,8 +12295,8 @@ trees_in::read_enum_def (tree defn, tree maybe_template)
if (installing)
{
TYPE_VALUES (type) = values;
- TYPE_MIN_VALUE (type) = min;
- TYPE_MAX_VALUE (type) = max;
+ /* Note that we stream TYPE_MIN/MAX_VALUE directly as part of the
+ ENUMERAL_TYPE. */
rest_of_type_compilation (type, DECL_NAMESPACE_SCOPE_P (defn));
}
@@ -12296,22 +12310,17 @@ trees_in::read_enum_def (tree defn, tree maybe_template)
tree new_decl = TREE_VALUE (values);
if (DECL_NAME (known_decl) != DECL_NAME (new_decl))
- goto bad;
+ break;
new_decl = maybe_duplicate (new_decl);
if (!cp_tree_equal (DECL_INITIAL (known_decl),
DECL_INITIAL (new_decl)))
- goto bad;
+ break;
}
if (known || values)
- goto bad;
-
- if (!cp_tree_equal (TYPE_MIN_VALUE (type), min)
- || !cp_tree_equal (TYPE_MAX_VALUE (type), max))
{
- bad:;
error_at (DECL_SOURCE_LOCATION (maybe_dup),
"definition of %qD does not match", maybe_dup);
inform (DECL_SOURCE_LOCATION (defn),
diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
index 14e937d..dfa6fb4 100644
--- a/gcc/cp/name-lookup.cc
+++ b/gcc/cp/name-lookup.cc
@@ -8596,6 +8596,13 @@ push_namespace (tree name, bool make_inline)
/* This should find the slot created by pushdecl. */
gcc_checking_assert (slot && *slot == ns);
}
+ else
+ {
+ /* pushdecl could have expanded the hash table, so
+ slot might be invalid. */
+ slot = find_namespace_slot (current_namespace, name);
+ gcc_checking_assert (slot);
+ }
make_namespace_finish (ns, slot);
/* Add the anon using-directive here, we don't do it in
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index a0a1988..96e1537 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -1782,7 +1782,7 @@ make_ptrmem_declarator (cp_cv_quals cv_qualifiers, tree class_type,
indicated PARMS. The CV_QUALIFIERS apply to the function, as in
"const"-qualified member function. The EXCEPTION_SPECIFICATION
indicates what exceptions can be thrown. STD_ATTRS contains
- attributes and any contracts that apply to the function. */
+ attributes that appertain to the function type. */
cp_declarator *
make_call_declarator (cp_declarator *target,
@@ -40957,12 +40957,7 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
if (nested && cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN))
break;
- if (!first
- /* OpenMP 5.1 allows optional comma in between directive-name and
- clauses everywhere, but as we aren't done with OpenMP 5.0
- implementation yet, let's allow it for now only in C++11
- attributes. */
- || (parser->lexer->in_omp_attribute_pragma && nested != 2))
+ if (!first || nested != 2)
{
if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
cp_lexer_consume_token (parser->lexer);
@@ -41395,9 +41390,7 @@ cp_parser_omp_allocate (cp_parser *parser, cp_token *pragma_tok)
location_t loc = pragma_tok->location;
tree nl = cp_parser_omp_var_list (parser, OMP_CLAUSE_ALLOCATE, NULL_TREE);
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
@@ -41518,7 +41511,6 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok, bool openacc)
enum tree_code code = ERROR_MARK, opcode = NOP_EXPR;
enum omp_memory_order memory_order = OMP_MEMORY_ORDER_UNSPECIFIED;
bool structured_block = false;
- bool first = true;
tree clauses = NULL_TREE;
bool capture = false;
bool compare = false;
@@ -41529,14 +41521,10 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok, bool openacc)
while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
{
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if ((!first || parser->lexer->in_omp_attribute_pragma)
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
- first = false;
-
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@@ -42490,11 +42478,9 @@ cp_parser_omp_depobj (cp_parser *parser, cp_token *pragma_tok)
tree clause = NULL_TREE;
enum omp_clause_depend_kind kind = OMP_CLAUSE_DEPEND_INVALID;
- location_t c_loc = cp_lexer_peek_token (parser->lexer)->location;
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
cp_lexer_consume_token (parser->lexer);
+ location_t c_loc = cp_lexer_peek_token (parser->lexer)->location;
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@@ -42577,9 +42563,7 @@ static void
cp_parser_omp_flush (cp_parser *parser, cp_token *pragma_tok)
{
enum memmodel mo = MEMMODEL_LAST;
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
@@ -43304,8 +43288,7 @@ cp_parser_omp_scan_loop_body (cp_parser *parser)
cp_lexer_consume_token (parser->lexer);
- if (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
cp_lexer_consume_token (parser->lexer);
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
@@ -44107,9 +44090,7 @@ cp_parser_omp_ordered (cp_parser *parser, cp_token *pragma_tok,
location_t loc = pragma_tok->location;
int n = 1;
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
n = 2;
if (cp_lexer_nth_token_is (parser->lexer, n, CPP_NAME))
@@ -46463,7 +46444,6 @@ static void
cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
bool is_assume)
{
- bool first = true;
bool no_openmp = false;
bool no_openmp_routines = false;
bool no_parallelism = false;
@@ -46479,14 +46459,10 @@ cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
{
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if ((!first || parser->lexer->in_omp_attribute_pragma)
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
- first = false;
-
if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME))
break;
@@ -46723,9 +46699,7 @@ cp_finish_omp_declare_variant (cp_parser *parser, cp_token *pragma_tok,
location_t finish_loc = get_finish (varid.get_location ());
location_t varid_loc = make_location (caret_loc, start_loc, finish_loc);
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
@@ -46801,11 +46775,6 @@ cp_parser_late_parsing_omp_declare_simd (cp_parser *parser, tree attrs)
cp_lexer_consume_token (parser->lexer);
if (strcmp (kind, "simd") == 0)
{
- /* For now only in C++ attributes, do it always for OpenMP 5.1.
- if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
- && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
- cp_lexer_consume_token (parser->lexer); */
-
cl = cp_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
"#pragma omp declare simd",
pragma_tok);
@@ -47063,9 +47032,7 @@ cp_parser_omp_declare_target (cp_parser *parser, cp_token *pragma_tok)
int device_type = 0;
bool only_device_type = true;
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- || (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ || (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME)))
clauses
= cp_parser_omp_all_clauses (parser, OMP_DECLARE_TARGET_CLAUSE_MASK,
@@ -47315,9 +47282,7 @@ cp_parser_omp_declare_reduction_exprs (tree fndecl, cp_parser *parser)
if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
return false;
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if (parser->lexer->in_omp_attribute_pragma
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
@@ -47749,20 +47714,15 @@ cp_parser_omp_declare (cp_parser *parser, cp_token *pragma_tok,
static bool
cp_parser_omp_requires (cp_parser *parser, cp_token *pragma_tok)
{
- bool first = true;
enum omp_requires new_req = (enum omp_requires) 0;
location_t loc = pragma_tok->location;
while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
{
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if ((!first || parser->lexer->in_omp_attribute_pragma)
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
- first = false;
-
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@@ -47916,20 +47876,15 @@ cp_parser_omp_error (cp_parser *parser, cp_token *pragma_tok,
int at_compilation = -1;
int severity_fatal = -1;
tree message = NULL_TREE;
- bool first = true;
bool bad = false;
location_t loc = pragma_tok->location;
while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
{
- /* For now only in C++ attributes, do it always for OpenMP 5.1. */
- if ((!first || parser->lexer->in_omp_attribute_pragma)
- && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
cp_lexer_consume_token (parser->lexer);
- first = false;
-
if (cp_lexer_next_token_is_not (parser->lexer, CPP_NAME))
break;
@@ -49510,12 +49465,11 @@ synthesize_implicit_template_parm (cp_parser *parser, tree constr)
tree proto = constr ? DECL_INITIAL (constr) : NULL_TREE;
tree synth_id = make_generic_type_name ();
- tree synth_tmpl_parm;
bool non_type = false;
/* Synthesize the type template parameter. */
gcc_assert(!proto || TREE_CODE (proto) == TYPE_DECL);
- synth_tmpl_parm = finish_template_type_parm (class_type_node, synth_id);
+ tree synth_tmpl_parm = finish_template_type_parm (class_type_node, synth_id);
if (become_template)
current_template_parms = tree_cons (size_int (current_template_depth + 1),
@@ -49530,22 +49484,27 @@ synthesize_implicit_template_parm (cp_parser *parser, tree constr)
node,
/*non_type=*/non_type,
/*param_pack=*/false);
+ // Process_template_parm returns the list of parms, and
+ // parser->implicit_template_parms holds the final node of the parm
+ // list. We really want to manipulate the newly appended element.
+ gcc_checking_assert (!parser->implicit_template_parms
+ || parser->implicit_template_parms == new_parm);
+ if (parser->implicit_template_parms)
+ new_parm = TREE_CHAIN (new_parm);
+ gcc_checking_assert (!TREE_CHAIN (new_parm));
+
+ // Record the last implicit parm node
+ parser->implicit_template_parms = new_parm;
/* Mark the synthetic declaration "virtual". This is used when
comparing template-heads to determine if whether an abbreviated
function template is equivalent to an explicit template.
- Note that DECL_ARTIFICIAL is used elsewhere for template parameters. */
+ Note that DECL_ARTIFICIAL is used elsewhere for template
+ parameters. */
if (TREE_VALUE (new_parm) != error_mark_node)
DECL_VIRTUAL_P (TREE_VALUE (new_parm)) = true;
- // Chain the new parameter to the list of implicit parameters.
- if (parser->implicit_template_parms)
- parser->implicit_template_parms
- = TREE_CHAIN (parser->implicit_template_parms);
- else
- parser->implicit_template_parms = new_parm;
-
tree new_decl = get_local_decls ();
if (non_type)
/* Return the TEMPLATE_PARM_INDEX, not the PARM_DECL. */
@@ -49573,7 +49532,7 @@ synthesize_implicit_template_parm (cp_parser *parser, tree constr)
/* If the new parameter was constrained, we need to add that to the
constraints in the template parameter list. */
- if (tree req = TEMPLATE_PARM_CONSTRAINTS (tree_last (new_parm)))
+ if (tree req = TEMPLATE_PARM_CONSTRAINTS (new_parm))
{
tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
reqs = combine_constraint_expressions (reqs, req);
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index a9f4d2f..4b7dae8 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -148,10 +148,8 @@ static void add_pending_template (tree);
static tree reopen_tinst_level (struct tinst_level *);
static tree tsubst_initializer_list (tree, tree);
static tree get_partial_spec_bindings (tree, tree, tree);
-static tree coerce_template_parms (tree, tree, tree, tsubst_flags_t,
- bool, bool);
static tree coerce_innermost_template_parms (tree, tree, tree, tsubst_flags_t,
- bool, bool);
+ bool = true);
static void tsubst_enum (tree, tree, tree);
static bool check_instantiated_args (tree, tree, tsubst_flags_t);
static int check_non_deducible_conversion (tree, tree, unification_kind_t, int,
@@ -2181,8 +2179,7 @@ determine_specialization (tree template_id,
{
tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (fns));
targs = coerce_template_parms (parms, explicit_targs, fns,
- tf_warning_or_error,
- /*req_all*/true, /*use_defarg*/true);
+ tf_warning_or_error);
if (targs != error_mark_node
&& constraints_satisfied_p (fns, targs))
templates = tree_cons (targs, fns, templates);
@@ -7873,10 +7870,7 @@ coerce_template_args_for_ttp (tree templ, tree arglist,
arglist = add_to_template_args (outer, arglist);
tree parmlist = DECL_INNERMOST_TEMPLATE_PARMS (templ);
- return coerce_template_parms (parmlist, arglist, templ,
- complain,
- /*require_all_args=*/true,
- /*use_default_args=*/true);
+ return coerce_template_parms (parmlist, arglist, templ, complain);
}
/* A cache of template template parameters with match-all default
@@ -7950,9 +7944,7 @@ coerce_ttp_args_for_tta (tree& arg, tree pargs, tsubst_flags_t complain)
{
tree aparms
= INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (arg_tmpl));
- pargs = coerce_template_parms (aparms, pargs, arg_tmpl, complain,
- /*require_all*/true,
- /*use_default*/true);
+ pargs = coerce_template_parms (aparms, pargs, arg_tmpl, complain);
}
--processing_template_decl;
return pargs;
@@ -8119,8 +8111,7 @@ coerce_template_template_parms (tree parm_parms_full,
pargs = add_to_template_args (outer_args, pargs);
}
- pargs = coerce_template_parms (arg_parms, pargs, NULL_TREE, tf_none,
- /*require_all*/true, /*use_default*/true);
+ pargs = coerce_template_parms (arg_parms, pargs, NULL_TREE, tf_none);
if (pargs != error_mark_node)
{
tree targs = make_tree_vec (nargs);
@@ -8880,19 +8871,16 @@ pack_expansion_args_count (tree args)
warning messages are issued under control of COMPLAIN.
If REQUIRE_ALL_ARGS is false, argument deduction will be performed
- for arguments not specified in ARGS. Otherwise, if
- USE_DEFAULT_ARGS is true, default arguments will be used to fill in
- unspecified arguments. If REQUIRE_ALL_ARGS is true, but
- USE_DEFAULT_ARGS is false, then all arguments must be specified in
- ARGS. */
+ for arguments not specified in ARGS. If REQUIRE_ALL_ARGS is true,
+ arguments not specified in ARGS must have default arguments which
+ we'll use to fill in ARGS. */
-static tree
+tree
coerce_template_parms (tree parms,
tree args,
tree in_decl,
tsubst_flags_t complain,
- bool require_all_args,
- bool use_default_args)
+ bool require_all_args /* = true */)
{
int nparms, nargs, parm_idx, arg_idx, lost = 0;
tree orig_inner_args;
@@ -8953,9 +8941,8 @@ coerce_template_parms (tree parms,
|| (nargs < nparms - variadic_p
&& require_all_args
&& !variadic_args_p
- && (!use_default_args
- || (TREE_VEC_ELT (parms, nargs) != error_mark_node
- && !TREE_PURPOSE (TREE_VEC_ELT (parms, nargs))))))
+ && (TREE_VEC_ELT (parms, nargs) != error_mark_node
+ && !TREE_PURPOSE (TREE_VEC_ELT (parms, nargs)))))
{
bad_nargs:
if (complain & tf_error)
@@ -9223,30 +9210,6 @@ coerce_template_parms (tree parms,
return new_inner_args;
}
-/* Convert all template arguments to their appropriate types, and
- return a vector containing the innermost resulting template
- arguments. If any error occurs, return error_mark_node. Error and
- warning messages are not issued.
-
- Note that no function argument deduction is performed, and default
- arguments are used to fill in unspecified arguments. */
-tree
-coerce_template_parms (tree parms, tree args, tree in_decl)
-{
- return coerce_template_parms (parms, args, in_decl, tf_none, true, true);
-}
-
-/* Convert all template arguments to their appropriate type, and
- instantiate default arguments as needed. This returns a vector
- containing the innermost resulting template arguments, or
- error_mark_node if unsuccessful. */
-tree
-coerce_template_parms (tree parms, tree args, tree in_decl,
- tsubst_flags_t complain)
-{
- return coerce_template_parms (parms, args, in_decl, complain, true, true);
-}
-
/* Like coerce_template_parms. If PARMS represents all template
parameters levels, this function returns a vector of vectors
representing all the resulting argument levels. Note that in this
@@ -9259,11 +9222,10 @@ coerce_template_parms (tree parms, tree args, tree in_decl,
static tree
coerce_innermost_template_parms (tree parms,
- tree args,
- tree in_decl,
- tsubst_flags_t complain,
- bool require_all_args,
- bool use_default_args)
+ tree args,
+ tree in_decl,
+ tsubst_flags_t complain,
+ bool require_all_args /* = true */)
{
int parms_depth = TMPL_PARMS_DEPTH (parms);
int args_depth = TMPL_ARGS_DEPTH (args);
@@ -9283,8 +9245,7 @@ coerce_innermost_template_parms (tree parms,
if (cur_depth == args_depth)
l = coerce_template_parms (TREE_VALUE (level),
args, in_decl, complain,
- require_all_args,
- use_default_args);
+ require_all_args);
else
l = TMPL_ARGS_LEVEL (args, cur_depth);
@@ -9297,8 +9258,7 @@ coerce_innermost_template_parms (tree parms,
else
coerced_args = coerce_template_parms (INNERMOST_TEMPLATE_PARMS (parms),
args, in_decl, complain,
- require_all_args,
- use_default_args);
+ require_all_args);
return coerced_args;
}
@@ -9993,9 +9953,7 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context,
actually tsubst'd into the definition to create the
instantiation. */
arglist = coerce_innermost_template_parms (parmlist, arglist, gen_tmpl,
- complain,
- /*require_all_args=*/true,
- /*use_default_args=*/true);
+ complain);
if (arglist == error_mark_node)
/* We were unable to bind the arguments. */
@@ -10411,9 +10369,7 @@ finish_template_variable (tree var, tsubst_flags_t complain)
tree arglist = TREE_OPERAND (var, 1);
tree parms = DECL_TEMPLATE_PARMS (templ);
- arglist = coerce_innermost_template_parms (parms, arglist, templ, complain,
- /*req_all*/true,
- /*use_default*/true);
+ arglist = coerce_innermost_template_parms (parms, arglist, templ, complain);
if (arglist == error_mark_node)
return error_mark_node;
@@ -15173,8 +15129,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
the template. */
argvec = (coerce_innermost_template_parms
(DECL_TEMPLATE_PARMS (gen_tmpl),
- argvec, t, complain,
- /*all*/true, /*defarg*/true));
+ argvec, t, complain));
if (argvec == error_mark_node)
RETURN (error_mark_node);
hash = spec_hasher::hash (gen_tmpl, argvec);
@@ -22122,11 +22077,8 @@ instantiate_alias_template (tree tmpl, tree args, tsubst_flags_t complain)
if (tmpl == error_mark_node || args == error_mark_node)
return error_mark_node;
- args =
- coerce_innermost_template_parms (DECL_TEMPLATE_PARMS (tmpl),
- args, tmpl, complain,
- /*require_all_args=*/true,
- /*use_default_args=*/true);
+ args = coerce_innermost_template_parms (DECL_TEMPLATE_PARMS (tmpl),
+ args, tmpl, complain);
/* FIXME check for satisfaction in check_instantiated_args. */
if (flag_concepts
@@ -22376,8 +22328,7 @@ fn_type_unification (tree fn,
explicit_targs
= (coerce_template_parms (tparms, explicit_targs, fn,
complain|tf_partial,
- /*require_all_args=*/false,
- /*use_default_args=*/false));
+ /*require_all_args=*/false));
if (explicit_targs == error_mark_node)
goto fail;
@@ -23470,9 +23421,7 @@ resolve_overloaded_unification (tree tparms,
continue;
subargs = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn),
- expl_subargs, NULL_TREE, tf_none,
- /*require_all_args=*/true,
- /*use_default_args=*/true);
+ expl_subargs, NULL_TREE, tf_none);
if (subargs != error_mark_node
&& !any_dependent_template_arguments_p (subargs))
{
@@ -23616,9 +23565,7 @@ resolve_nondeduced_context (tree orig_expr, tsubst_flags_t complain)
continue;
subargs = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn),
- expl_subargs, NULL_TREE, tf_none,
- /*require_all_args=*/true,
- /*use_default_args=*/true);
+ expl_subargs, NULL_TREE, tf_none);
if (subargs != error_mark_node
&& !any_dependent_template_arguments_p (subargs))
{
@@ -25747,7 +25694,7 @@ get_partial_spec_bindings (tree tmpl, tree spec_tmpl, tree args)
if (spec_args != error_mark_node)
spec_args = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (tmpl),
INNERMOST_TEMPLATE_ARGS (spec_args),
- tmpl, tf_none, false, false);
+ tmpl, tf_none, false);
pop_tinst_level ();
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 7a1ecb2..50185a0 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -6179,7 +6179,8 @@ cp_build_binary_op (const op_location_t &location,
}
if (may_need_excess_precision
&& (orig_type0 != type0 || orig_type1 != type1)
- && build_type == NULL_TREE)
+ && build_type == NULL_TREE
+ && result_type)
{
gcc_assert (common);
semantic_result_type = cp_common_type (orig_type0, orig_type1);
@@ -11246,6 +11247,17 @@ check_return_expr (tree retval, bool *no_warning)
if (processing_template_decl)
return saved_retval;
+ /* A naive attempt to reduce the number of -Wdangling-reference false
+ positives: if we know that this function can return a variable with
+ static storage duration rather than one of its parameters, suppress
+ the warning. */
+ if (warn_dangling_reference
+ && TYPE_REF_P (functype)
+ && bare_retval
+ && VAR_P (bare_retval)
+ && TREE_STATIC (bare_retval))
+ suppress_warning (current_function_decl, OPT_Wdangling_reference);
+
/* Actually copy the value returned into the appropriate location. */
if (retval && retval != result)
{
diff --git a/gcc/ctfc.cc b/gcc/ctfc.cc
index 0964543..11ec1f9 100644
--- a/gcc/ctfc.cc
+++ b/gcc/ctfc.cc
@@ -577,7 +577,7 @@ ctf_add_array (ctf_container_ref ctfc, uint32_t flag, const ctf_arinfo_t * arp,
ctf_id_t
ctf_add_enum (ctf_container_ref ctfc, uint32_t flag, const char * name,
- HOST_WIDE_INT size, dw_die_ref die)
+ HOST_WIDE_INT size, bool eunsigned, dw_die_ref die)
{
ctf_dtdef_ref dtd;
ctf_id_t type;
@@ -604,6 +604,7 @@ ctf_add_enum (ctf_container_ref ctfc, uint32_t flag, const char * name,
gcc_assert (size <= CTF_MAX_SIZE);
dtd->dtd_data.ctti_size = size;
+ dtd->dtd_enum_unsigned = eunsigned;
ctfc->ctfc_num_stypes++;
@@ -630,10 +631,12 @@ ctf_add_enumerator (ctf_container_ref ctfc, ctf_id_t enid, const char * name,
gcc_assert (kind == CTF_K_ENUM && vlen < CTF_MAX_VLEN);
- /* Enum value is of type HOST_WIDE_INT in the compiler, dmd_value is int32_t
- on the other hand. Check bounds and skip adding this enum value if out of
- bounds. */
- if ((value > INT_MAX) || (value < INT_MIN))
+ /* Enum value is of type HOST_WIDE_INT in the compiler, CTF enumerators
+ values in ctf_enum_t is limited to int32_t, BTF supports signed and
+ unsigned enumerators values of 32 and 64 bits, for both debug formats
+ we use ctf_dmdef_t.dmd_value entry of HOST_WIDE_INT type. So check
+ CTF bounds and skip adding this enum value if out of bounds. */
+ if (!btf_debuginfo_p() && ((value > INT_MAX) || (value < INT_MIN)))
{
/* FIXME - Note this TBD_CTF_REPRESENTATION_LIMIT. */
return (1);
diff --git a/gcc/ctfc.h b/gcc/ctfc.h
index bcf3a43..48c381a 100644
--- a/gcc/ctfc.h
+++ b/gcc/ctfc.h
@@ -133,7 +133,7 @@ typedef struct GTY ((chain_next ("%h.dmd_next"))) ctf_dmdef
ctf_id_t dmd_type; /* Type of this member (for sou). */
uint32_t dmd_name_offset; /* Offset of the name in str table. */
uint64_t dmd_offset; /* Offset of this member in bits (for sou). */
- int dmd_value; /* Value of this member (for enum). */
+ HOST_WIDE_INT dmd_value; /* Value of this member (for enum). */
struct ctf_dmdef * dmd_next; /* A list node. */
} ctf_dmdef_t;
@@ -162,6 +162,7 @@ struct GTY ((for_user)) ctf_dtdef
bool from_global_func; /* Whether this type was added from a global
function. */
uint32_t linkage; /* Used in function types. 0=local, 1=global. */
+ bool dtd_enum_unsigned; /* Enum signedness. */
union GTY ((desc ("ctf_dtu_d_union_selector (&%1)")))
{
/* struct, union, or enum. */
@@ -406,7 +407,7 @@ extern const char * ctf_add_string (ctf_container_ref, const char *,
extern ctf_id_t ctf_add_reftype (ctf_container_ref, uint32_t, ctf_id_t,
uint32_t, dw_die_ref);
extern ctf_id_t ctf_add_enum (ctf_container_ref, uint32_t, const char *,
- HOST_WIDE_INT, dw_die_ref);
+ HOST_WIDE_INT, bool, dw_die_ref);
extern ctf_id_t ctf_add_slice (ctf_container_ref, uint32_t, ctf_id_t,
uint32_t, uint32_t, dw_die_ref);
extern ctf_id_t ctf_add_float (ctf_container_ref, uint32_t, const char *,
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 434c1c6..888d82b 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,32 @@
+2022-10-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-attribs.cc (apply_user_attributes): Update for new front-end
+ interface.
+ * d-builtins.cc (d_init_versions): Predefine `D_Optimized' with
+ compiling with optimizations enabled.
+ * d-lang.cc (d_handle_option): Update for new front-end interface.
+ Handle new option `-fpreview=systemvariables'.
+ * dmd/MERGE: Merge upstream dmd e4f8919591.
+ * dmd/VERSION: Bump version to v2.101.0-beta.1.
+ * expr.cc (ExprVisitor::visit (AssignExp *)): Treat construction of
+ static arrays from a call expression as a simple assignment.
+ (ExprVisitor::visit (ArrayLiteralExp *)): Handle array literals with
+ `scope' storage.
+ * gdc.texi: Update documentation of `-fpreview=' options.
+ * lang.opt (fpreview=shortenedmethods): Remove.
+ (fpreview=systemvariables): New option.
+
+2022-10-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-target.def (d_minfo_section): Expand documentation of hook.
+ Default initialize to "minfo".
+ (d_minfo_start_name): Rename to ...
+ (d_minfo_section_start): ... this. Default initialize to
+ "__start_minfo".
+ (d_minfo_end_name): Rename to ...
+ (d_minfo_section_end): ... this. Default initialize to "__stop_minfo".
+ * modules.cc (register_moduleinfo): Use new targetdm hook names.
+
2022-09-27 Iain Buclaw <ibuclaw@gdcproject.org>
* dmd/MERGE: Merge upstream dmd d579c467c1.
diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc
index 04f7f16..90e72e3 100644
--- a/gcc/d/d-attribs.cc
+++ b/gcc/d/d-attribs.cc
@@ -426,7 +426,8 @@ build_attributes (Expressions *eattrs)
void
apply_user_attributes (Dsymbol *sym, tree node)
{
- if (!sym->userAttribDecl)
+ UserAttributeDeclaration *uda = sym->userAttribDecl ();
+ if (uda == NULL)
return;
location_t saved_location = input_location;
@@ -436,7 +437,7 @@ apply_user_attributes (Dsymbol *sym, tree node)
if (TYPE_P (node) && !COMPLETE_TYPE_P (node))
attr_flags |= ATTR_FLAG_TYPE_IN_PLACE;
- Expressions *attrs = sym->userAttribDecl->getAttributes ();
+ Expressions *attrs = uda->getAttributes ();
decl_attributes (&node, build_attributes (attrs), attr_flags);
input_location = saved_location;
diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc
index 5997e5d..51e562a 100644
--- a/gcc/d/d-builtins.cc
+++ b/gcc/d/d-builtins.cc
@@ -505,6 +505,9 @@ d_init_versions (void)
VersionCondition::addPredefinedGlobalIdent ("D_TypeInfo");
}
+ if (optimize)
+ VersionCondition::addPredefinedGlobalIdent ("D_Optimized");
+
VersionCondition::addPredefinedGlobalIdent ("all");
/* Emit all target-specific version identifiers. */
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index dcc465f..3b61301 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -567,10 +567,10 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
global.params.fixAliasThis = value;
global.params.previewIn = value;
global.params.fix16997 = value;
- global.params.noSharedAccess = value;
+ global.params.noSharedAccess = FeatureState::enabled;
global.params.rvalueRefParam = FeatureState::enabled;
global.params.inclusiveInContracts = value;
- global.params.shortenedMethods = value;
+ global.params.systemVariables = FeatureState::enabled;
global.params.fixImmutableConv = value;
break;
@@ -619,15 +619,15 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
break;
case OPT_fpreview_nosharedaccess:
- global.params.noSharedAccess = value;
+ global.params.noSharedAccess = FeatureState::enabled;
break;
case OPT_fpreview_rvaluerefparam:
global.params.rvalueRefParam = FeatureState::enabled;
break;
- case OPT_fpreview_shortenedmethods:
- global.params.shortenedMethods = value;
+ case OPT_fpreview_systemvariables:
+ global.params.systemVariables = FeatureState::enabled;
break;
case OPT_frelease:
diff --git a/gcc/d/d-target.def b/gcc/d/d-target.def
index 7805942..7d999d0 100644
--- a/gcc/d/d-target.def
+++ b/gcc/d/d-target.def
@@ -70,26 +70,29 @@ the target operating system.",
DEFHOOKPOD
(d_minfo_section,
"Contains the name of the section in which module info references should be\n\
-placed. This section is expected to be bracketed by two symbols to indicate\n\
-the start and end address of the section, so that the runtime library can\n\
-collect all modules for each loaded shared library and executable. The\n\
-default value of @code{NULL} disables the use of sections altogether.",
- const char *, NULL)
+placed. By default, the compiler puts all module info symbols in the\n\
+@code{\"minfo\"} section. Define this macro to override the string if a\n\
+different section name should be used. This section is expected to be\n\
+bracketed by two symbols @code{TARGET_D_MINFO_SECTION_START} and \n\
+@code{TARGET_D_MINFO_SECTION_END} to indicate the start and end address of\n\
+the section, so that the runtime library can collect all modules for each\n\
+loaded shared library and executable. Setting the value to @code{NULL}\n\
+disables the use of sections for storing module info altogether.",
+ const char *, "minfo")
DEFHOOKPOD
-(d_minfo_start_name,
+(d_minfo_section_start,
"If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\
as the name of the symbol indicating the start address of the module info\n\
section",
- const char *, NULL)
+ const char *, "__start_minfo")
-/* The name of the ModuleInfo section. */
DEFHOOKPOD
-(d_minfo_end_name,
+(d_minfo_section_end,
"If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\
as the name of the symbol indicating the end address of the module info\n\
section",
- const char *, NULL)
+ const char *, "__stop_minfo")
/* The "stdcall" convention is really supported on 32-bit x86/Windows only.
The following hook is a helper to determine whether to apply the attribute
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index a4c46f3..2398875 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-4219ba670ce9ff92f3e874f0f048f2c28134c008
+e4f89195913be1dc638707b1abb24c4f3ae7e0bf
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/VERSION b/gcc/d/dmd/VERSION
index 83a14f5..50adf9c 100644
--- a/gcc/d/dmd/VERSION
+++ b/gcc/d/dmd/VERSION
@@ -1 +1 @@
-v2.100.1
+v2.101.0-beta.1
diff --git a/gcc/d/dmd/aggregate.d b/gcc/d/dmd/aggregate.d
index edca17f..e9e8bbe 100644
--- a/gcc/d/dmd/aggregate.d
+++ b/gcc/d/dmd/aggregate.d
@@ -109,7 +109,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
CPPMANGLE cppmangle;
/// overridden symbol with pragma(mangle, "...") if not null
- MangleOverride* mangleOverride;
+ MangleOverride* pMangleOverride;
/**
* !=null if is nested
diff --git a/gcc/d/dmd/aggregate.h b/gcc/d/dmd/aggregate.h
index f0909e3..d4432b5 100644
--- a/gcc/d/dmd/aggregate.h
+++ b/gcc/d/dmd/aggregate.h
@@ -82,7 +82,7 @@ public:
CPPMANGLE cppmangle;
// overridden symbol with pragma(mangle, "...")
- MangleOverride *mangleOverride;
+ MangleOverride *pMangleOverride;
/* !=NULL if is nested
* pointing to the dsymbol that directly enclosing it.
* 1. The function that enclosing it (nested struct and class)
@@ -174,7 +174,7 @@ public:
structalign_t alignment; // alignment applied outside of the struct
ThreeState ispod; // if struct is POD
private:
- uint8_t bitFields;
+ uint16_t bitFields;
public:
static StructDeclaration *create(const Loc &loc, Identifier *id, bool inObject);
StructDeclaration *syntaxCopy(Dsymbol *s) override;
diff --git a/gcc/d/dmd/attrib.d b/gcc/d/dmd/attrib.d
index 3472d1c..3f27cb9 100644
--- a/gcc/d/dmd/attrib.d
+++ b/gcc/d/dmd/attrib.d
@@ -894,50 +894,9 @@ extern (C++) final class PragmaDeclaration : AttribDeclaration
// then it's evaluated on demand in function semantic
return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, sc.visibility, sc.explicitVisibility, sc.aligndecl, this);
}
- if (ident == Id.printf || ident == Id.scanf)
- {
- auto sc2 = sc.push();
-
- if (ident == Id.printf)
- // Override previous setting, never let both be set
- sc2.flags = (sc2.flags & ~SCOPE.scanf) | SCOPE.printf;
- else
- sc2.flags = (sc2.flags & ~SCOPE.printf) | SCOPE.scanf;
-
- return sc2;
- }
return sc;
}
- PINLINE evalPragmaInline(Scope* sc)
- {
- if (!args || args.dim == 0)
- return PINLINE.default_;
-
- Expression e = (*args)[0];
- if (!e.type)
- {
-
- sc = sc.startCTFE();
- e = e.expressionSemantic(sc);
- e = resolveProperties(sc, e);
- sc = sc.endCTFE();
- e = e.ctfeInterpret();
- e = e.toBoolean(sc);
- if (e.isErrorExp())
- error("pragma(`inline`, `true` or `false`) expected, not `%s`", (*args)[0].toChars());
- (*args)[0] = e;
- }
-
- const opt = e.toBool();
- if (opt.isEmpty())
- return PINLINE.default_;
- else if (opt.get())
- return PINLINE.always;
- else
- return PINLINE.never;
- }
-
override const(char)* kind() const
{
return "pragma";
diff --git a/gcc/d/dmd/attrib.h b/gcc/d/dmd/attrib.h
index 1fe33a6..b153229 100644
--- a/gcc/d/dmd/attrib.h
+++ b/gcc/d/dmd/attrib.h
@@ -154,7 +154,6 @@ public:
PragmaDeclaration *syntaxCopy(Dsymbol *s) override;
Scope *newScope(Scope *sc) override;
- PINLINE evalPragmaInline(Scope* sc);
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
diff --git a/gcc/d/dmd/clone.d b/gcc/d/dmd/clone.d
index ba7d590..c999048 100644
--- a/gcc/d/dmd/clone.d
+++ b/gcc/d/dmd/clone.d
@@ -300,7 +300,7 @@ FuncDeclaration buildOpAssign(StructDeclaration sd, Scope* sc)
auto tf = new TypeFunction(ParameterList(fparams), sd.handleType(), LINK.d, stc | STC.ref_);
auto fop = new FuncDeclaration(declLoc, Loc.initial, Id.assign, stc, tf);
fop.storage_class |= STC.inference;
- fop.flags |= FUNCFLAG.generated;
+ fop.isGenerated = true;
Expression e;
if (stc & STC.disable)
{
@@ -581,7 +581,7 @@ FuncDeclaration buildXopEquals(StructDeclaration sd, Scope* sc)
tf = tf.addSTC(STC.const_).toTypeFunction();
Identifier id = Id.xopEquals;
auto fop = new FuncDeclaration(declLoc, Loc.initial, id, 0, tf);
- fop.flags |= FUNCFLAG.generated;
+ fop.isGenerated = true;
fop.parent = sd;
Expression e1 = new IdentifierExp(loc, Id.This);
Expression e2 = new IdentifierExp(loc, Id.p);
@@ -705,7 +705,7 @@ FuncDeclaration buildXopCmp(StructDeclaration sd, Scope* sc)
tf = tf.addSTC(STC.const_).toTypeFunction();
Identifier id = Id.xopCmp;
auto fop = new FuncDeclaration(declLoc, Loc.initial, id, 0, tf);
- fop.flags |= FUNCFLAG.generated;
+ fop.isGenerated = true;
fop.parent = sd;
Expression e1 = new IdentifierExp(loc, Id.This);
Expression e2 = new IdentifierExp(loc, Id.p);
@@ -823,7 +823,7 @@ FuncDeclaration buildXtoHash(StructDeclaration sd, Scope* sc)
auto tf = new TypeFunction(ParameterList(parameters), Type.thash_t, LINK.d, STC.nothrow_ | STC.trusted);
Identifier id = Id.xtoHash;
auto fop = new FuncDeclaration(declLoc, Loc.initial, id, STC.static_, tf);
- fop.flags |= FUNCFLAG.generated;
+ fop.isGenerated = true;
/* Do memberwise hashing.
*
@@ -961,7 +961,7 @@ void buildDtors(AggregateDeclaration ad, Scope* sc)
{
//printf("Building __fieldDtor(), %s\n", e.toChars());
auto dd = new DtorDeclaration(declLoc, Loc.initial, stc, Id.__fieldDtor);
- dd.flags |= FUNCFLAG.generated;
+ dd.isGenerated = true;
dd.storage_class |= STC.inference;
dd.fbody = new ExpStatement(loc, e);
ad.members.push(dd);
@@ -1017,7 +1017,7 @@ void buildDtors(AggregateDeclaration ad, Scope* sc)
e = Expression.combine(e, ce);
}
auto dd = new DtorDeclaration(declLoc, Loc.initial, stc, Id.__aggrDtor);
- dd.flags |= FUNCFLAG.generated;
+ dd.isGenerated = true;
dd.storage_class |= STC.inference;
dd.fbody = new ExpStatement(loc, e);
ad.members.push(dd);
@@ -1088,7 +1088,7 @@ private DtorDeclaration buildWindowsCppDtor(AggregateDeclaration ad, DtorDeclara
stmts.push(new ExpStatement(loc, call));
stmts.push(new ReturnStatement(loc, new CastExp(loc, new ThisExp(loc), Type.tvoidptr)));
func.fbody = new CompoundStatement(loc, stmts);
- func.flags |= FUNCFLAG.generated;
+ func.isGenerated = true;
auto sc2 = sc.push();
sc2.stc &= ~STC.static_; // not a static destructor
@@ -1140,7 +1140,7 @@ private DtorDeclaration buildExternDDtor(AggregateDeclaration ad, Scope* sc)
auto call = new CallExp(dtor.loc, dtor, null);
call.directcall = true; // non-virtual call Class.__dtor();
func.fbody = new ExpStatement(dtor.loc, call);
- func.flags |= FUNCFLAG.generated;
+ func.isGenerated = true;
func.storage_class |= STC.inference;
auto sc2 = sc.push();
@@ -1416,7 +1416,7 @@ FuncDeclaration buildPostBlit(StructDeclaration sd, Scope* sc)
//printf("Building __fieldPostBlit()\n");
checkShared();
auto dd = new PostBlitDeclaration(declLoc, Loc.initial, stc, Id.__fieldPostblit);
- dd.flags |= FUNCFLAG.generated;
+ dd.isGenerated = true;
dd.storage_class |= STC.inference | STC.scope_;
dd.fbody = (stc & STC.disable) ? null : new CompoundStatement(loc, postblitCalls);
sd.postblits.shift(dd);
@@ -1454,7 +1454,7 @@ FuncDeclaration buildPostBlit(StructDeclaration sd, Scope* sc)
checkShared();
auto dd = new PostBlitDeclaration(declLoc, Loc.initial, stc, Id.__aggrPostblit);
- dd.flags |= FUNCFLAG.generated;
+ dd.isGenerated = true;
dd.storage_class |= STC.inference;
dd.fbody = new ExpStatement(loc, e);
sd.members.push(dd);
@@ -1517,7 +1517,7 @@ private CtorDeclaration generateCopyCtorDeclaration(StructDeclaration sd, const
auto ccd = new CtorDeclaration(sd.loc, Loc.initial, STC.ref_, tf, true);
ccd.storage_class |= funcStc;
ccd.storage_class |= STC.inference;
- ccd.flags |= FUNCFLAG.generated;
+ ccd.isGenerated = true;
return ccd;
}
diff --git a/gcc/d/dmd/common/bitfields.d b/gcc/d/dmd/common/bitfields.d
index cccaabd..bba61ad 100644
--- a/gcc/d/dmd/common/bitfields.d
+++ b/gcc/d/dmd/common/bitfields.d
@@ -23,6 +23,7 @@ if (__traits(isUnsigned, T))
string result = "extern (C++) pure nothrow @nogc @safe final {";
enum structName = __traits(identifier, S);
+ string initialValue = "";
foreach (size_t i, mem; __traits(allMembers, S))
{
static assert(is(typeof(__traits(getMember, S, mem)) == bool));
@@ -37,8 +38,10 @@ if (__traits(isUnsigned, T))
v ? (bitFields |= "~mask~") : (bitFields &= ~"~mask~");
return v;
}";
+
+ initialValue = (__traits(getMember, S.init, mem) ? "1" : "0") ~ initialValue;
}
- return result ~ "}\n private "~T.stringof~" bitFields;\n";
+ return result ~ "}\n private "~T.stringof~" bitFields = 0b" ~ initialValue ~ ";\n";
}
///
@@ -48,7 +51,7 @@ unittest
{
bool x;
bool y;
- bool z;
+ bool z = 1;
}
static struct S
@@ -66,5 +69,5 @@ unittest
s.y = true;
assert(s.y);
assert(!s.x);
- assert(!s.z);
+ assert(s.z);
}
diff --git a/gcc/d/dmd/common/file.d b/gcc/d/dmd/common/file.d
index 8f34b53..89e7027 100644
--- a/gcc/d/dmd/common/file.d
+++ b/gcc/d/dmd/common/file.d
@@ -144,9 +144,14 @@ struct FileMapping(Datum)
import core.stdc.string : strlen;
import core.stdc.stdlib : malloc;
import core.stdc.string : memcpy;
- auto totalNameLength = filename.strlen() + 1;
- name = cast(char*) memcpy(malloc(totalNameLength), filename, totalNameLength);
- name || assert(0, "FileMapping: Out of memory.");
+ const totalNameLength = filename.strlen() + 1;
+ auto namex = cast(char*) malloc(totalNameLength);
+ if (!namex)
+ {
+ fprintf(stderr, "FileMapping: Out of memory.");
+ exit(1);
+ }
+ name = cast(char*) memcpy(namex, filename, totalNameLength);
}
/**
diff --git a/gcc/d/dmd/cparse.d b/gcc/d/dmd/cparse.d
index 2c5a4f0..ad1ad67 100644
--- a/gcc/d/dmd/cparse.d
+++ b/gcc/d/dmd/cparse.d
@@ -1906,6 +1906,8 @@ final class CParser(AST) : Parser!AST
{
auto str = asmName.peekString();
p.mangleOverride = str;
+// p.adFlags |= AST.VarDeclaration.nounderscore;
+ p.adFlags |= 4; // cannot get above line to compile on Ubuntu
}
}
s = applySpecifier(s, specifier);
@@ -5164,18 +5166,40 @@ final class CParser(AST) : Parser!AST
if (n.value == TOK.identifier && n.ident == Id.pop)
{
scan(&n);
- while (n.value == TOK.comma)
+ size_t len = this.records.length;
+ if (n.value == TOK.rightParenthesis) // #pragma pack ( pop )
+ {
+ if (len == 0) // nothing to pop
+ return closingParen();
+
+ this.records.setDim(len - 1);
+ this.packs.setDim(len - 1);
+ if (len == 1) // stack is now empty
+ packalign.setDefault();
+ else
+ packalign = (*this.packs)[len - 1];
+ return closingParen();
+ }
+ while (n.value == TOK.comma) // #pragma pack ( pop ,
{
scan(&n);
if (n.value == TOK.identifier)
{
- for (size_t len = this.records.length; len; --len)
+ /* pragma pack(pop, identifier
+ * Pop until identifier is found, pop that one too, and set
+ * alignment to the new top of the stack.
+ * If identifier is not found, do nothing.
+ */
+ for ( ; len; --len)
{
if ((*this.records)[len - 1] == n.ident)
{
- packalign = (*this.packs)[len - 1];
this.records.setDim(len - 1);
this.packs.setDim(len - 1);
+ if (len > 1)
+ packalign = (*this.packs)[len - 2];
+ else
+ packalign.setDefault(); // stack empty, use default
break;
}
}
@@ -5184,14 +5208,18 @@ final class CParser(AST) : Parser!AST
else if (n.value == TOK.int32Literal)
{
setPackAlign(n);
- this.records.push(null);
- this.packs.push(packalign);
+ scan(&n);
+ }
+ else
+ {
+ error(loc, "identifier or alignment value expected following `#pragma pack(pop,` not `%s`", n.toChars());
scan(&n);
}
}
return closingParen();
}
/* # pragma pack ( integer )
+ * Sets alignment to integer
*/
if (n.value == TOK.int32Literal)
{
@@ -5200,6 +5228,7 @@ final class CParser(AST) : Parser!AST
return closingParen();
}
/* # pragma pack ( )
+ * Sets alignment to default
*/
if (n.value == TOK.rightParenthesis)
{
diff --git a/gcc/d/dmd/cppmangle.d b/gcc/d/dmd/cppmangle.d
index fed83b8..7c130e9 100644
--- a/gcc/d/dmd/cppmangle.d
+++ b/gcc/d/dmd/cppmangle.d
@@ -615,7 +615,7 @@ private final class CppMangleVisitor : Visitor
if (!ti)
{
auto ag = s.isAggregateDeclaration();
- const ident = (ag && ag.mangleOverride) ? ag.mangleOverride.id : s.ident;
+ const ident = (ag && ag.pMangleOverride) ? ag.pMangleOverride.id : s.ident;
this.writeNamespace(s.cppnamespace, () {
this.writeIdentifier(ident);
this.abiTags.writeSymbol(s, this);
@@ -654,14 +654,14 @@ private final class CppMangleVisitor : Visitor
}
auto ag = ti.aliasdecl ? ti.aliasdecl.isAggregateDeclaration() : null;
- if (ag && ag.mangleOverride)
+ if (ag && ag.pMangleOverride)
{
this.writeNamespace(
ti.toAlias().cppnamespace, () {
- this.writeIdentifier(ag.mangleOverride.id);
- if (ag.mangleOverride.agg && ag.mangleOverride.agg.isInstantiated())
+ this.writeIdentifier(ag.pMangleOverride.id);
+ if (ag.pMangleOverride.agg && ag.pMangleOverride.agg.isInstantiated())
{
- auto to = ag.mangleOverride.agg.isInstantiated();
+ auto to = ag.pMangleOverride.agg.isInstantiated();
append(to);
this.abiTags.writeSymbol(to.tempdecl, this);
template_args(to);
diff --git a/gcc/d/dmd/dcast.d b/gcc/d/dmd/dcast.d
index 8ab3873..ba3afb7 100644
--- a/gcc/d/dmd/dcast.d
+++ b/gcc/d/dmd/dcast.d
@@ -327,6 +327,45 @@ MATCH implicitConvTo(Expression e, Type t)
return MATCH.nomatch;
}
+ // Apply mod bits to each function parameter,
+ // and see if we can convert the function argument to the modded type
+ static bool parametersModMatch(Expressions* args, TypeFunction tf, MOD mod)
+ {
+ const size_t nparams = tf.parameterList.length;
+ const size_t j = tf.isDstyleVariadic(); // if TypeInfoArray was prepended
+ foreach (const i; j .. args.dim)
+ {
+ Expression earg = (*args)[i];
+ Type targ = earg.type.toBasetype();
+ static if (LOG)
+ {
+ printf("[%d] earg: %s, targ: %s\n", cast(int)i, earg.toChars(), targ.toChars());
+ }
+ if (i - j < nparams)
+ {
+ Parameter fparam = tf.parameterList[i - j];
+ if (fparam.isLazy())
+ return false; // not sure what to do with this
+ Type tparam = fparam.type;
+ if (!tparam)
+ continue;
+ if (fparam.isReference())
+ {
+ if (targ.constConv(tparam.castMod(mod)) == MATCH.nomatch)
+ return false;
+ continue;
+ }
+ }
+ static if (LOG)
+ {
+ printf("[%d] earg: %s, targm: %s\n", cast(int)i, earg.toChars(), targ.addMod(mod).toChars());
+ }
+ if (implicitMod(earg, targ, mod) == MATCH.nomatch)
+ return false;
+ }
+ return true;
+ }
+
MATCH visitAdd(AddExp e)
{
version (none)
@@ -894,9 +933,6 @@ MATCH implicitConvTo(Expression e, Type t)
/* Apply mod bits to each function parameter,
* and see if we can convert the function argument to the modded type
*/
-
- size_t nparams = tf.parameterList.length;
- size_t j = tf.isDstyleVariadic(); // if TypeInfoArray was prepended
if (auto dve = e.e1.isDotVarExp())
{
/* Treat 'this' as just another function argument
@@ -905,36 +941,9 @@ MATCH implicitConvTo(Expression e, Type t)
if (targ.constConv(targ.castMod(mod)) == MATCH.nomatch)
return result;
}
- foreach (const i; j .. e.arguments.dim)
- {
- Expression earg = (*e.arguments)[i];
- Type targ = earg.type.toBasetype();
- static if (LOG)
- {
- printf("[%d] earg: %s, targ: %s\n", cast(int)i, earg.toChars(), targ.toChars());
- }
- if (i - j < nparams)
- {
- Parameter fparam = tf.parameterList[i - j];
- if (fparam.isLazy())
- return result; // not sure what to do with this
- Type tparam = fparam.type;
- if (!tparam)
- continue;
- if (fparam.isReference())
- {
- if (targ.constConv(tparam.castMod(mod)) == MATCH.nomatch)
- return result;
- continue;
- }
- }
- static if (LOG)
- {
- printf("[%d] earg: %s, targm: %s\n", cast(int)i, earg.toChars(), targ.addMod(mod).toChars());
- }
- if (implicitMod(earg, targ, mod) == MATCH.nomatch)
- return result;
- }
+
+ if (!parametersModMatch(e.arguments, tf, mod))
+ return result;
/* Success
*/
@@ -1206,47 +1215,16 @@ MATCH implicitConvTo(Expression e, Type t)
if (tf.purity == PURE.impure)
return MATCH.nomatch; // impure
+ // Allow a conversion to immutable type, or
+ // conversions of mutable types between thread-local and shared.
if (e.type.immutableOf().implicitConvTo(t) < MATCH.constant && e.type.addMod(MODFlags.shared_).implicitConvTo(t) < MATCH.constant && e.type.implicitConvTo(t.addMod(MODFlags.shared_)) < MATCH.constant)
{
return MATCH.nomatch;
}
- // Allow a conversion to immutable type, or
- // conversions of mutable types between thread-local and shared.
-
- Expressions* args = e.arguments;
- size_t nparams = tf.parameterList.length;
- // if TypeInfoArray was prepended
- size_t j = tf.isDstyleVariadic();
- for (size_t i = j; i < e.arguments.dim; ++i)
+ if (!parametersModMatch(e.arguments, tf, mod))
{
- Expression earg = (*args)[i];
- Type targ = earg.type.toBasetype();
- static if (LOG)
- {
- printf("[%d] earg: %s, targ: %s\n", cast(int)i, earg.toChars(), targ.toChars());
- }
- if (i - j < nparams)
- {
- Parameter fparam = tf.parameterList[i - j];
- if (fparam.isLazy())
- return MATCH.nomatch; // not sure what to do with this
- Type tparam = fparam.type;
- if (!tparam)
- continue;
- if (fparam.isReference())
- {
- if (targ.constConv(tparam.castMod(mod)) == MATCH.nomatch)
- return MATCH.nomatch;
- continue;
- }
- }
- static if (LOG)
- {
- printf("[%d] earg: %s, targm: %s\n", cast(int)i, earg.toChars(), targ.addMod(mod).toChars());
- }
- if (implicitMod(earg, targ, mod) == MATCH.nomatch)
- return MATCH.nomatch;
+ return MATCH.nomatch;
}
}
diff --git a/gcc/d/dmd/declaration.d b/gcc/d/dmd/declaration.d
index ff27e37..07d58f0 100644
--- a/gcc/d/dmd/declaration.d
+++ b/gcc/d/dmd/declaration.d
@@ -227,6 +227,7 @@ extern (C++) abstract class Declaration : Dsymbol
ubyte adFlags; // control re-assignment of AliasDeclaration (put here for packing reasons)
enum wasRead = 1; // set if AliasDeclaration was read
enum ignoreRead = 2; // ignore any reads of AliasDeclaration
+ enum nounderscore = 4; // don't prepend _ to mangled name
Symbol* isym; // import version of csym
@@ -481,6 +482,11 @@ extern (C++) abstract class Declaration : Dsymbol
return (storage_class & STC.scope_) != 0;
}
+ final bool isReturn() const pure nothrow @nogc @safe
+ {
+ return (storage_class & STC.return_) != 0;
+ }
+
final bool isSynchronized() const pure nothrow @nogc @safe
{
return (storage_class & STC.synchronized_) != 0;
@@ -542,6 +548,11 @@ extern (C++) abstract class Declaration : Dsymbol
return (storage_class & STC.future) != 0;
}
+ final extern(D) bool isSystem() const pure nothrow @nogc @safe
+ {
+ return (storage_class & STC.system) != 0;
+ }
+
override final Visibility visible() pure nothrow @nogc @safe
{
return visibility;
@@ -780,7 +791,17 @@ extern (C++) final class AliasDeclaration : Declaration
* is not overloadable.
*/
if (type)
- return false;
+ {
+ /*
+ If type has been resolved already we could
+ still be inserting an alias from an import.
+
+ If we are handling an alias then pretend
+ it was inserting and return true, if not then
+ false since we didn't even pretend to insert something.
+ */
+ return this._import && this.equals(s);
+ }
/* When s is added in member scope by static if, mixin("code") or others,
* aliassym is determined already. See the case in: test/compilable/test61.d
@@ -1634,7 +1655,7 @@ extern (C++) class VarDeclaration : Declaration
// Add this VarDeclaration to fdv.closureVars[] if not already there
if (!sc.intypeof && !(sc.flags & SCOPE.compile) &&
// https://issues.dlang.org/show_bug.cgi?id=17605
- (fdv.flags & FUNCFLAG.compileTimeOnly || !(fdthis.flags & FUNCFLAG.compileTimeOnly))
+ (fdv.isCompileTimeOnly || !fdthis.isCompileTimeOnly)
)
{
if (!fdv.closureVars.contains(this))
@@ -1754,16 +1775,21 @@ extern (C++) class BitFieldDeclaration : VarDeclaration
override final void setFieldOffset(AggregateDeclaration ad, ref FieldState fieldState, bool isunion)
{
- //printf("BitFieldDeclaration::setFieldOffset(ad: %s, field: %s)\n", ad.toChars(), toChars());
- static void print(const ref FieldState fieldState)
+ enum log = false;
+ static if (log)
{
- printf("FieldState.offset = %d bytes\n", fieldState.offset);
- printf(" .fieldOffset = %d bytes\n", fieldState.fieldOffset);
- printf(" .bitOffset = %d bits\n", fieldState.bitOffset);
- printf(" .fieldSize = %d bytes\n", fieldState.fieldSize);
- printf(" .inFlight = %d\n\n", fieldState.inFlight);
+ printf("BitFieldDeclaration::setFieldOffset(ad: %s, field: %s)\n", ad.toChars(), toChars());
+ void print(const ref FieldState fieldState)
+ {
+ printf("FieldState.offset = %d bytes\n", fieldState.offset);
+ printf(" .fieldOffset = %d bytes\n", fieldState.fieldOffset);
+ printf(" .bitOffset = %d bits\n", fieldState.bitOffset);
+ printf(" .fieldSize = %d bytes\n", fieldState.fieldSize);
+ printf(" .inFlight = %d\n", fieldState.inFlight);
+ printf(" fieldWidth = %d bits\n", fieldWidth);
+ }
+ print(fieldState);
}
- //print(fieldState);
Type t = type.toBasetype();
const bool anon = isAnonymous();
@@ -1780,6 +1806,7 @@ extern (C++) class BitFieldDeclaration : VarDeclaration
assert(sz != SIZE_INVALID && sz < uint.max);
uint memsize = cast(uint)sz; // size of member
uint memalignsize = target.fieldalign(t); // size of member for alignment purposes
+ if (log) printf(" memsize: %u memalignsize: %u\n", memsize, memalignsize);
if (fieldWidth == 0 && !anon)
error(loc, "named bit fields cannot have 0 width");
@@ -1790,6 +1817,7 @@ extern (C++) class BitFieldDeclaration : VarDeclaration
void startNewField()
{
+ if (log) printf("startNewField()\n");
uint alignsize;
if (style == TargetC.BitFieldStyle.Gcc_Clang)
{
@@ -1881,15 +1909,15 @@ extern (C++) class BitFieldDeclaration : VarDeclaration
if (!fieldState.inFlight)
{
+ //printf("not in flight\n");
startNewField();
}
else if (style == TargetC.BitFieldStyle.Gcc_Clang)
{
- if (fieldState.bitOffset + fieldWidth > memsize * 8)
- {
- //printf("start1 fieldState.bitOffset:%u fieldWidth:%u memsize:%u\n", fieldState.bitOffset, fieldWidth, memsize);
- startNewField();
- }
+ // If the bit-field spans more units of alignment than its type,
+ // start a new field at the next alignment boundary.
+ if (fieldState.bitOffset == fieldState.fieldSize * 8)
+ startNewField(); // the bit field is full
else
{
// if alignment boundary is crossed
@@ -1909,6 +1937,7 @@ extern (C++) class BitFieldDeclaration : VarDeclaration
if (memsize != fieldState.fieldSize ||
fieldState.bitOffset + fieldWidth > fieldState.fieldSize * 8)
{
+ //printf("new field\n");
startNewField();
}
}
diff --git a/gcc/d/dmd/declaration.h b/gcc/d/dmd/declaration.h
index 5bce6b0..2668b6e 100644
--- a/gcc/d/dmd/declaration.h
+++ b/gcc/d/dmd/declaration.h
@@ -139,6 +139,7 @@ public:
bool isWild() const { return (storage_class & STCwild) != 0; }
bool isAuto() const { return (storage_class & STCauto) != 0; }
bool isScope() const { return (storage_class & STCscope) != 0; }
+ bool isReturn() const { return (storage_class & STCreturn) != 0; }
bool isSynchronized() const { return (storage_class & STCsynchronized) != 0; }
bool isParameter() const { return (storage_class & STCparameter) != 0; }
bool isDeprecated() const override final { return (storage_class & STCdeprecated) != 0; }
@@ -615,7 +616,54 @@ public:
AttributeViolation* safetyViolation;
- unsigned flags; // FUNCFLAGxxxxx
+ // Formerly FUNCFLAGS
+ uint32_t flags;
+ bool purityInprocess() const;
+ bool purityInprocess(bool v);
+ bool safetyInprocess() const;
+ bool safetyInprocess(bool v);
+ bool nothrowInprocess() const;
+ bool nothrowInprocess(bool v);
+ bool nogcInprocess() const;
+ bool nogcInprocess(bool v);
+ bool returnInprocess() const;
+ bool returnInprocess(bool v);
+ bool inlineScanned() const;
+ bool inlineScanned(bool v);
+ bool inferScope() const;
+ bool inferScope(bool v);
+ bool hasCatches() const;
+ bool hasCatches(bool v);
+ bool isCompileTimeOnly() const;
+ bool isCompileTimeOnly(bool v);
+ bool printf() const;
+ bool printf(bool v);
+ bool scanf() const;
+ bool scanf(bool v);
+ bool noreturn() const;
+ bool noreturn(bool v);
+ bool isNRVO() const;
+ bool isNRVO(bool v);
+ bool isNaked() const;
+ bool isNaked(bool v);
+ bool isGenerated() const;
+ bool isGenerated(bool v);
+ bool isIntroducing() const;
+ bool isIntroducing(bool v);
+ bool hasSemantic3Errors() const;
+ bool hasSemantic3Errors(bool v);
+ bool hasNoEH() const;
+ bool hasNoEH(bool v);
+ bool inferRetType() const;
+ bool inferRetType(bool v);
+ bool hasDualContext() const;
+ bool hasDualContext(bool v);
+ bool hasAlwaysInlines() const;
+ bool hasAlwaysInlines(bool v);
+ bool isCrtCtor() const;
+ bool isCrtCtor(bool v);
+ bool isCrtDtor() const;
+ bool isCrtDtor(bool v);
// Data for a function declaration that is needed for the Objective-C
// integration.
@@ -655,22 +703,6 @@ public:
bool isNogc();
bool isNogcBypassingInference();
- bool isNRVO() const;
- void isNRVO(bool v);
- bool isNaked() const;
- void isNaked(bool v);
- bool isGenerated() const;
- void isGenerated(bool v);
- bool isIntroducing() const;
- bool hasSemantic3Errors() const;
- bool hasNoEH() const;
- bool inferRetType() const;
- bool hasDualContext() const;
- bool hasAlwaysInlines() const;
- bool isCrtCtor() const;
- void isCrtCtor(bool v);
- bool isCrtDtor() const;
- void isCrtDtor(bool v);
virtual bool isNested() const;
AggregateDeclaration *isThis() override;
diff --git a/gcc/d/dmd/dinterpret.d b/gcc/d/dmd/dinterpret.d
index a95d9de..63b70009 100644
--- a/gcc/d/dmd/dinterpret.d
+++ b/gcc/d/dmd/dinterpret.d
@@ -2872,6 +2872,12 @@ public:
else
m = v.getConstInitializer(true);
}
+ else if (v.type.isTypeNoreturn())
+ {
+ // Noreturn field with default initializer
+ (*elems)[fieldsSoFar + i] = null;
+ continue;
+ }
else
m = v.type.defaultInitLiteral(e.loc);
if (exceptionOrCant(m))
diff --git a/gcc/d/dmd/dmodule.d b/gcc/d/dmd/dmodule.d
index 2cb1cc7..b2908ce 100644
--- a/gcc/d/dmd/dmodule.d
+++ b/gcc/d/dmd/dmodule.d
@@ -98,13 +98,13 @@ private const(char)[] getFilename(Identifier[] packages, Identifier ident) nothr
{
const(char)[] filename = ident.toString();
- if (packages.length == 0)
- return filename;
-
OutBuffer buf;
OutBuffer dotmods;
auto modAliases = &global.params.modFileAliasStrings;
+ if (packages.length == 0 && modAliases.length == 0)
+ return filename;
+
void checkModFileAlias(const(char)[] p)
{
/* Check and replace the contents of buf[] with
@@ -308,7 +308,7 @@ extern (C++) class Package : ScopeDsymbol
packages ~= s.ident;
reverse(packages);
- if (FileManager.lookForSourceFile(getFilename(packages, ident), global.path ? (*global.path)[] : null))
+ if (Module.find(getFilename(packages, ident)))
Module.load(Loc.initial, packages, this.ident);
else
isPkgMod = PKG.package_;
@@ -492,6 +492,16 @@ extern (C++) final class Module : Package
return new Module(Loc.initial, filename, ident, doDocComment, doHdrGen);
}
+ static const(char)* find(const(char)* filename)
+ {
+ return find(filename.toDString).ptr;
+ }
+
+ extern (D) static const(char)[] find(const(char)[] filename)
+ {
+ return FileManager.lookForSourceFile(filename, global.path ? (*global.path)[] : null);
+ }
+
extern (C++) static Module load(const ref Loc loc, Identifiers* packages, Identifier ident)
{
return load(loc, packages ? (*packages)[] : null, ident);
@@ -506,7 +516,7 @@ extern (C++) final class Module : Package
// foo\bar\baz
const(char)[] filename = getFilename(packages, ident);
// Look for the source file
- if (const result = FileManager.lookForSourceFile(filename, global.path ? (*global.path)[] : null))
+ if (const result = find(filename))
filename = result; // leaks
auto m = new Module(loc, filename, ident, 0, 0);
@@ -703,232 +713,12 @@ extern (C++) final class Module : Package
/// ditto
extern (D) Module parseModule(AST)()
{
- enum Endian { little, big}
- enum SourceEncoding { utf16, utf32}
-
- /*
- * Convert a buffer from UTF32 to UTF8
- * Params:
- * Endian = is the buffer big/little endian
- * buf = buffer of UTF32 data
- * Returns:
- * input buffer reencoded as UTF8
- */
-
- char[] UTF32ToUTF8(Endian endian)(const(char)[] buf)
- {
- static if (endian == Endian.little)
- alias readNext = Port.readlongLE;
- else
- alias readNext = Port.readlongBE;
-
- if (buf.length & 3)
- {
- error("odd length of UTF-32 char source %llu", cast(ulong) buf.length);
- return null;
- }
-
- const (uint)[] eBuf = cast(const(uint)[])buf;
-
- OutBuffer dbuf;
- dbuf.reserve(eBuf.length);
-
- foreach (i; 0 .. eBuf.length)
- {
- const u = readNext(&eBuf[i]);
- if (u & ~0x7F)
- {
- if (u > 0x10FFFF)
- {
- error("UTF-32 value %08x greater than 0x10FFFF", u);
- return null;
- }
- dbuf.writeUTF8(u);
- }
- else
- dbuf.writeByte(u);
- }
- dbuf.writeByte(0); //add null terminator
- return dbuf.extractSlice();
- }
-
- /*
- * Convert a buffer from UTF16 to UTF8
- * Params:
- * Endian = is the buffer big/little endian
- * buf = buffer of UTF16 data
- * Returns:
- * input buffer reencoded as UTF8
- */
-
- char[] UTF16ToUTF8(Endian endian)(const(char)[] buf)
- {
- static if (endian == Endian.little)
- alias readNext = Port.readwordLE;
- else
- alias readNext = Port.readwordBE;
-
- if (buf.length & 1)
- {
- error("odd length of UTF-16 char source %llu", cast(ulong) buf.length);
- return null;
- }
-
- const (ushort)[] eBuf = cast(const(ushort)[])buf;
-
- OutBuffer dbuf;
- dbuf.reserve(eBuf.length);
-
- //i will be incremented in the loop for high codepoints
- foreach (ref i; 0 .. eBuf.length)
- {
- uint u = readNext(&eBuf[i]);
- if (u & ~0x7F)
- {
- if (0xD800 <= u && u < 0xDC00)
- {
- i++;
- if (i >= eBuf.length)
- {
- error("surrogate UTF-16 high value %04x at end of file", u);
- return null;
- }
- const u2 = readNext(&eBuf[i]);
- if (u2 < 0xDC00 || 0xE000 <= u2)
- {
- error("surrogate UTF-16 low value %04x out of range", u2);
- return null;
- }
- u = (u - 0xD7C0) << 10;
- u |= (u2 - 0xDC00);
- }
- else if (u >= 0xDC00 && u <= 0xDFFF)
- {
- error("unpaired surrogate UTF-16 value %04x", u);
- return null;
- }
- else if (u == 0xFFFE || u == 0xFFFF)
- {
- error("illegal UTF-16 value %04x", u);
- return null;
- }
- dbuf.writeUTF8(u);
- }
- else
- dbuf.writeByte(u);
- }
- dbuf.writeByte(0); //add a terminating null byte
- return dbuf.extractSlice();
- }
-
const(char)* srcname = srcfile.toChars();
//printf("Module::parse(srcname = '%s')\n", srcname);
isPackageFile = isPackageFileName(srcfile);
- const(char)[] buf = cast(const(char)[]) this.src;
-
- bool needsReencoding = true;
- bool hasBOM = true; //assume there's a BOM
- Endian endian;
- SourceEncoding sourceEncoding;
-
- if (buf.length >= 2)
- {
- /* Convert all non-UTF-8 formats to UTF-8.
- * BOM : https://www.unicode.org/faq/utf_bom.html
- * 00 00 FE FF UTF-32BE, big-endian
- * FF FE 00 00 UTF-32LE, little-endian
- * FE FF UTF-16BE, big-endian
- * FF FE UTF-16LE, little-endian
- * EF BB BF UTF-8
- */
- if (buf[0] == 0xFF && buf[1] == 0xFE)
- {
- endian = Endian.little;
-
- sourceEncoding = buf.length >= 4 && buf[2] == 0 && buf[3] == 0
- ? SourceEncoding.utf32
- : SourceEncoding.utf16;
- }
- else if (buf[0] == 0xFE && buf[1] == 0xFF)
- {
- endian = Endian.big;
- sourceEncoding = SourceEncoding.utf16;
- }
- else if (buf.length >= 4 && buf[0] == 0 && buf[1] == 0 && buf[2] == 0xFE && buf[3] == 0xFF)
- {
- endian = Endian.big;
- sourceEncoding = SourceEncoding.utf32;
- }
- else if (buf.length >= 3 && buf[0] == 0xEF && buf[1] == 0xBB && buf[2] == 0xBF)
- {
- needsReencoding = false;//utf8 with BOM
- }
- else
- {
- /* There is no BOM. Make use of Arcane Jill's insight that
- * the first char of D source must be ASCII to
- * figure out the encoding.
- */
- hasBOM = false;
- if (buf.length >= 4 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0)
- {
- endian = Endian.little;
- sourceEncoding = SourceEncoding.utf32;
- }
- else if (buf.length >= 4 && buf[0] == 0 && buf[1] == 0 && buf[2] == 0)
- {
- endian = Endian.big;
- sourceEncoding = SourceEncoding.utf32;
- }
- else if (buf.length >= 2 && buf[1] == 0) //try to check for UTF-16
- {
- endian = Endian.little;
- sourceEncoding = SourceEncoding.utf16;
- }
- else if (buf[0] == 0)
- {
- endian = Endian.big;
- sourceEncoding = SourceEncoding.utf16;
- }
- else {
- // It's UTF-8
- needsReencoding = false;
- if (buf[0] >= 0x80)
- {
- error("source file must start with BOM or ASCII character, not \\x%02X", buf[0]);
- return null;
- }
- }
- }
- //throw away BOM
- if (hasBOM)
- {
- if (!needsReencoding) buf = buf[3..$];// utf-8 already
- else if (sourceEncoding == SourceEncoding.utf32) buf = buf[4..$];
- else buf = buf[2..$]; //utf 16
- }
- }
- // Assume the buffer is from memory and has not be read from disk. Assume UTF-8.
- else if (buf.length >= 1 && (buf[0] == '\0' || buf[0] == 0x1A))
- needsReencoding = false;
- //printf("%s, %d, %d, %d\n", srcfile.name.toChars(), needsReencoding, endian == Endian.little, sourceEncoding == SourceEncoding.utf16);
- if (needsReencoding)
- {
- if (sourceEncoding == SourceEncoding.utf16)
- {
- buf = endian == Endian.little
- ? UTF16ToUTF8!(Endian.little)(buf)
- : UTF16ToUTF8!(Endian.big)(buf);
- }
- else
- {
- buf = endian == Endian.little
- ? UTF32ToUTF8!(Endian.little)(buf)
- : UTF32ToUTF8!(Endian.big)(buf);
- }
- // an error happened on UTF conversion
- if (buf is null) return null;
- }
+ const(char)[] buf = processSource(src, this);
+ // an error happened on UTF conversion
+ if (buf is null) return null;
/* If it starts with the string "Ddoc", then it's a documentation
* source file.
@@ -1533,3 +1323,192 @@ extern (C++) struct ModuleDeclaration
return this.toChars().toDString;
}
}
+
+/**
+ * Process the content of a source file
+ *
+ * Attempts to find which encoding it is using, if it has BOM,
+ * and then normalize the source to UTF-8. If no encoding is required,
+ * a slice of `src` will be returned without extra allocation.
+ *
+ * Params:
+ * src = Content of the source file to process
+ * mod = Module matching `src`, used for error handling
+ *
+ * Returns:
+ * UTF-8 encoded variant of `src`, stripped of any BOM,
+ * or `null` if an error happened.
+ */
+private const(char)[] processSource (const(ubyte)[] src, Module mod)
+{
+ enum SourceEncoding { utf16, utf32}
+ enum Endian { little, big}
+
+ /*
+ * Convert a buffer from UTF32 to UTF8
+ * Params:
+ * Endian = is the buffer big/little endian
+ * buf = buffer of UTF32 data
+ * Returns:
+ * input buffer reencoded as UTF8
+ */
+
+ char[] UTF32ToUTF8(Endian endian)(const(char)[] buf)
+ {
+ static if (endian == Endian.little)
+ alias readNext = Port.readlongLE;
+ else
+ alias readNext = Port.readlongBE;
+
+ if (buf.length & 3)
+ {
+ mod.error("odd length of UTF-32 char source %llu", cast(ulong) buf.length);
+ return null;
+ }
+
+ const (uint)[] eBuf = cast(const(uint)[])buf;
+
+ OutBuffer dbuf;
+ dbuf.reserve(eBuf.length);
+
+ foreach (i; 0 .. eBuf.length)
+ {
+ const u = readNext(&eBuf[i]);
+ if (u & ~0x7F)
+ {
+ if (u > 0x10FFFF)
+ {
+ mod.error("UTF-32 value %08x greater than 0x10FFFF", u);
+ return null;
+ }
+ dbuf.writeUTF8(u);
+ }
+ else
+ dbuf.writeByte(u);
+ }
+ dbuf.writeByte(0); //add null terminator
+ return dbuf.extractSlice();
+ }
+
+ /*
+ * Convert a buffer from UTF16 to UTF8
+ * Params:
+ * Endian = is the buffer big/little endian
+ * buf = buffer of UTF16 data
+ * Returns:
+ * input buffer reencoded as UTF8
+ */
+
+ char[] UTF16ToUTF8(Endian endian)(const(char)[] buf)
+ {
+ static if (endian == Endian.little)
+ alias readNext = Port.readwordLE;
+ else
+ alias readNext = Port.readwordBE;
+
+ if (buf.length & 1)
+ {
+ mod.error("odd length of UTF-16 char source %llu", cast(ulong) buf.length);
+ return null;
+ }
+
+ const (ushort)[] eBuf = cast(const(ushort)[])buf;
+
+ OutBuffer dbuf;
+ dbuf.reserve(eBuf.length);
+
+ //i will be incremented in the loop for high codepoints
+ foreach (ref i; 0 .. eBuf.length)
+ {
+ uint u = readNext(&eBuf[i]);
+ if (u & ~0x7F)
+ {
+ if (0xD800 <= u && u < 0xDC00)
+ {
+ i++;
+ if (i >= eBuf.length)
+ {
+ mod.error("surrogate UTF-16 high value %04x at end of file", u);
+ return null;
+ }
+ const u2 = readNext(&eBuf[i]);
+ if (u2 < 0xDC00 || 0xE000 <= u2)
+ {
+ mod.error("surrogate UTF-16 low value %04x out of range", u2);
+ return null;
+ }
+ u = (u - 0xD7C0) << 10;
+ u |= (u2 - 0xDC00);
+ }
+ else if (u >= 0xDC00 && u <= 0xDFFF)
+ {
+ mod.error("unpaired surrogate UTF-16 value %04x", u);
+ return null;
+ }
+ else if (u == 0xFFFE || u == 0xFFFF)
+ {
+ mod.error("illegal UTF-16 value %04x", u);
+ return null;
+ }
+ dbuf.writeUTF8(u);
+ }
+ else
+ dbuf.writeByte(u);
+ }
+ dbuf.writeByte(0); //add a terminating null byte
+ return dbuf.extractSlice();
+ }
+
+ const(char)[] buf = cast(const(char)[]) src;
+
+ // Assume the buffer is from memory and has not be read from disk. Assume UTF-8.
+ if (buf.length < 2)
+ return buf;
+
+ /* Convert all non-UTF-8 formats to UTF-8.
+ * BOM : https://www.unicode.org/faq/utf_bom.html
+ * 00 00 FE FF UTF-32BE, big-endian
+ * FF FE 00 00 UTF-32LE, little-endian
+ * FE FF UTF-16BE, big-endian
+ * FF FE UTF-16LE, little-endian
+ * EF BB BF UTF-8
+ */
+ if (buf[0] == 0xFF && buf[1] == 0xFE)
+ {
+ if (buf.length >= 4 && buf[2] == 0 && buf[3] == 0)
+ return UTF32ToUTF8!(Endian.little)(buf[4 .. $]);
+ return UTF16ToUTF8!(Endian.little)(buf[2 .. $]);
+ }
+
+ if (buf[0] == 0xFE && buf[1] == 0xFF)
+ return UTF16ToUTF8!(Endian.big)(buf[2 .. $]);
+
+ if (buf.length >= 4 && buf[0] == 0 && buf[1] == 0 && buf[2] == 0xFE && buf[3] == 0xFF)
+ return UTF32ToUTF8!(Endian.big)(buf[4 .. $]);
+
+ if (buf.length >= 3 && buf[0] == 0xEF && buf[1] == 0xBB && buf[2] == 0xBF)
+ return buf[3 .. $];
+
+ /* There is no BOM. Make use of Arcane Jill's insight that
+ * the first char of D source must be ASCII to
+ * figure out the encoding.
+ */
+ if (buf.length >= 4 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0)
+ return UTF32ToUTF8!(Endian.little)(buf);
+ if (buf.length >= 4 && buf[0] == 0 && buf[1] == 0 && buf[2] == 0)
+ return UTF32ToUTF8!(Endian.big)(buf);
+ // try to check for UTF-16
+ if (buf.length >= 2 && buf[1] == 0)
+ return UTF16ToUTF8!(Endian.little)(buf);
+ if (buf[0] == 0)
+ return UTF16ToUTF8!(Endian.big)(buf);
+
+ // It's UTF-8
+ if (buf[0] >= 0x80)
+ {
+ mod.error("source file must start with BOM or ASCII character, not \\x%02X", buf[0]);
+ return null;
+ }
+
+ return buf;
+}
diff --git a/gcc/d/dmd/dscope.d b/gcc/d/dmd/dscope.d
index 9c30978..c816759 100644
--- a/gcc/d/dmd/dscope.d
+++ b/gcc/d/dmd/dscope.d
@@ -63,17 +63,13 @@ enum SCOPE
free = 0x8000, /// is on free list
fullinst = 0x10000, /// fully instantiate templates
-
- // The following are mutually exclusive
- printf = 0x4_0000, /// printf-style function
- scanf = 0x8_0000, /// scanf-style function
}
/// Flags that are carried along with a scope push()
private enum PersistentFlags =
SCOPE.contract | SCOPE.debug_ | SCOPE.ctfe | SCOPE.compile | SCOPE.constraint |
SCOPE.noaccesscheck | SCOPE.ignoresymbolvisibility |
- SCOPE.printf | SCOPE.scanf | SCOPE.Cfile;
+ SCOPE.Cfile;
struct Scope
{
diff --git a/gcc/d/dmd/dstruct.d b/gcc/d/dmd/dstruct.d
index 4126a8a..1c2f226 100644
--- a/gcc/d/dmd/dstruct.d
+++ b/gcc/d/dmd/dstruct.d
@@ -216,6 +216,11 @@ extern (C++) class StructDeclaration : AggregateDeclaration
bool hasIdentityEquals; // true if has identity opEquals
bool hasNoFields; // has no fields
bool hasCopyCtor; // copy constructor
+ bool hasPointerField; // members with indirections
+ bool hasVoidInitPointers; // void-initialized unsafe fields
+ bool hasSystemFields; // @system members
+ bool hasFieldWithInvariant; // invariants
+ bool computedTypeProperties;// the above 3 fields are computed
// Even if struct is defined as non-root symbol, some built-in operations
// (e.g. TypeidExp, NewExp, ArrayLiteralExp, etc) request its TypeInfo.
// For those, today TypeInfo_Struct is generated in COMDAT.
@@ -223,7 +228,7 @@ extern (C++) class StructDeclaration : AggregateDeclaration
}
import dmd.common.bitfields : generateBitFields;
- mixin(generateBitFields!(BitFields, ubyte));
+ mixin(generateBitFields!(BitFields, ushort));
extern (D) this(const ref Loc loc, Identifier id, bool inObject)
{
@@ -391,9 +396,35 @@ extern (C++) class StructDeclaration : AggregateDeclaration
}
}
+
argTypes = target.toArgTypes(type);
}
+ /// Compute cached type properties for `TypeStruct`
+ extern(D) final void determineTypeProperties()
+ {
+ if (computedTypeProperties)
+ return;
+ foreach (vd; fields)
+ {
+ if (vd.storage_class & STC.ref_ || vd.hasPointers())
+ hasPointerField = true;
+
+ if (vd._init && vd._init.isVoidInitializer() && vd.type.hasPointers())
+ hasVoidInitPointers = true;
+
+ if (vd.storage_class & STC.system || vd.type.hasSystemFields())
+ hasSystemFields = true;
+
+ if (!vd._init && vd.type.hasVoidInitPointers())
+ hasVoidInitPointers = true;
+
+ if (vd.type.hasInvariant())
+ hasFieldWithInvariant = true;
+ }
+ computedTypeProperties = true;
+ }
+
/***************************************
* Determine if struct is POD (Plain Old Data).
*
diff --git a/gcc/d/dmd/dsymbol.d b/gcc/d/dmd/dsymbol.d
index 7e2d02f..2f10e83 100644
--- a/gcc/d/dmd/dsymbol.d
+++ b/gcc/d/dmd/dsymbol.d
@@ -236,25 +236,33 @@ struct FieldState
bool inFlight; /// bit field is in flight
}
+// 99.9% of Dsymbols don't have attributes (at least in druntime and Phobos),
+// so save memory by grouping them into a separate struct
+private struct DsymbolAttributes
+{
+ /// C++ namespace this symbol belongs to
+ CPPNamespaceDeclaration cppnamespace;
+ /// customized deprecation message
+ DeprecatedDeclaration depdecl_;
+ /// user defined attributes
+ UserAttributeDeclaration userAttribDecl;
+}
+
/***********************************************************
*/
extern (C++) class Dsymbol : ASTNode
{
Identifier ident;
Dsymbol parent;
- /// C++ namespace this symbol belongs to
- CPPNamespaceDeclaration cppnamespace;
Symbol* csym; // symbol for code generator
const Loc loc; // where defined
Scope* _scope; // !=null means context to use for semantic()
const(char)* prettystring; // cached value of toPrettyChars()
+ private DsymbolAttributes* atts; /// attached attribute declarations
bool errors; // this symbol failed to pass semantic()
PASS semanticRun = PASS.initial;
ushort localNum; /// perturb mangled name to avoid collisions with those in FuncDeclaration.localsymtab
- DeprecatedDeclaration depdecl; // customized deprecation message
- UserAttributeDeclaration userAttribDecl; // user defined attributes
-
final extern (D) this() nothrow
{
//printf("Dsymbol::Dsymbol(%p)\n", this);
@@ -285,6 +293,42 @@ extern (C++) class Dsymbol : ASTNode
return ident ? ident.toChars() : "__anonymous";
}
+ // Getters / setters for fields stored in `DsymbolAttributes`
+ final nothrow pure @safe
+ {
+ private ref DsymbolAttributes getAtts()
+ {
+ if (!atts)
+ atts = new DsymbolAttributes();
+ return *atts;
+ }
+
+ inout(DeprecatedDeclaration) depdecl() inout { return atts ? atts.depdecl_ : null; }
+ inout(CPPNamespaceDeclaration) cppnamespace() inout { return atts ? atts.cppnamespace : null; }
+ inout(UserAttributeDeclaration) userAttribDecl() inout { return atts ? atts.userAttribDecl : null; }
+
+ DeprecatedDeclaration depdecl(DeprecatedDeclaration dd)
+ {
+ if (!dd && !atts)
+ return null;
+ return getAtts().depdecl_ = dd;
+ }
+
+ CPPNamespaceDeclaration cppnamespace(CPPNamespaceDeclaration ns)
+ {
+ if (!ns && !atts)
+ return null;
+ return getAtts().cppnamespace = ns;
+ }
+
+ UserAttributeDeclaration userAttribDecl(UserAttributeDeclaration uad)
+ {
+ if (!uad && !atts)
+ return null;
+ return getAtts().userAttribDecl = uad;
+ }
+ }
+
// helper to print fully qualified (template) arguments
const(char)* toPrettyCharsHelper()
{
diff --git a/gcc/d/dmd/dsymbol.h b/gcc/d/dmd/dsymbol.h
index acf0004..3e9b634 100644
--- a/gcc/d/dmd/dsymbol.h
+++ b/gcc/d/dmd/dsymbol.h
@@ -167,25 +167,31 @@ struct FieldState
bool inFlight;
};
+struct DsymbolAttributes;
+
class Dsymbol : public ASTNode
{
public:
Identifier *ident;
Dsymbol *parent;
- /// C++ namespace this symbol belongs to
- CPPNamespaceDeclaration *namespace_;
Symbol *csym; // symbol for code generator
Loc loc; // where defined
Scope *_scope; // !=NULL means context to use for semantic()
const utf8_t *prettystring;
+private:
+ DsymbolAttributes* atts;
+public:
bool errors; // this symbol failed to pass semantic()
PASS semanticRun;
unsigned short localNum; // perturb mangled name to avoid collisions with those in FuncDeclaration.localsymtab
- DeprecatedDeclaration *depdecl; // customized deprecation message
- UserAttributeDeclaration *userAttribDecl; // user defined attributes
-
static Dsymbol *create(Identifier *);
const char *toChars() const override;
+ DeprecatedDeclaration* depdecl();
+ CPPNamespaceDeclaration* cppnamespace();
+ UserAttributeDeclaration* userAttribDecl();
+ DeprecatedDeclaration* depdecl(DeprecatedDeclaration* dd);
+ CPPNamespaceDeclaration* cppnamespace(CPPNamespaceDeclaration* ns);
+ UserAttributeDeclaration* userAttribDecl(UserAttributeDeclaration* uad);
virtual const char *toPrettyCharsHelper(); // helper to print fully qualified (template) arguments
Loc getLoc();
const char *locToChars();
diff --git a/gcc/d/dmd/dsymbolsem.d b/gcc/d/dmd/dsymbolsem.d
index 701f06a..b877828 100644
--- a/gcc/d/dmd/dsymbolsem.d
+++ b/gcc/d/dmd/dsymbolsem.d
@@ -98,6 +98,29 @@ private uint setMangleOverride(Dsymbol s, const(char)[] sym)
return 0;
}
+/**
+ * Apply pragma printf/scanf to FuncDeclarations under `s`,
+ * poking through attribute declarations such as `extern(C)`
+ * but not through aggregates or function bodies.
+ *
+ * Params:
+ * s = symbol to apply
+ * printf = `true` for printf, `false` for scanf
+ */
+private void setPragmaPrintf(Dsymbol s, bool printf)
+{
+ if (auto fd = s.isFuncDeclaration())
+ {
+ fd.printf = printf;
+ fd.scanf = !printf;
+ }
+
+ if (auto ad = s.isAttribDeclaration())
+ {
+ ad.include(null).foreachDsymbol( (s) { setPragmaPrintf(s, printf); } );
+ }
+}
+
/*************************************
* Does semantic analysis on the public face of declarations.
*/
@@ -855,17 +878,20 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
// Calculate type size + safety checks
- if (1)
+ if (sc && sc.func)
{
- if (dsym._init && dsym._init.isVoidInitializer() &&
- (dsym.type.hasPointers() || dsym.type.hasInvariant())) // also computes type size
+ if (dsym._init && dsym._init.isVoidInitializer())
{
- if (dsym.type.hasPointers())
+
+ if (dsym.type.hasPointers()) // also computes type size
sc.setUnsafe(false, dsym.loc,
"`void` initializers for pointers not allowed in safe functions");
- else
+ else if (dsym.type.hasInvariant())
sc.setUnsafe(false, dsym.loc,
"`void` initializers for structs with invariants are not allowed in safe functions");
+ else if (dsym.type.hasSystemFields())
+ sc.setUnsafePreview(global.params.systemVariables, false, dsym.loc,
+ "`void` initializers for `@system` variables not allowed in safe functions");
}
else if (!dsym._init &&
!(dsym.storage_class & (STC.static_ | STC.extern_ | STC.gshared | STC.manifest | STC.field | STC.parameter)) &&
@@ -1036,6 +1062,12 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
if (f.tookAddressOf)
f.tookAddressOf--;
}
+ else if (auto ale = ex.isArrayLiteralExp())
+ {
+ // or an array literal assigned to a `scope` variable
+ if (!dsym.type.nextOf().needsDestruction())
+ ale.onstack = true;
+ }
}
Expression exp = ei.exp;
@@ -1200,7 +1232,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
override void visit(BitFieldDeclaration dsym)
{
- //printf("BitField::semantic('%s') %s\n", toPrettyChars(), id.toChars());
+ //printf("BitField::semantic('%s')\n", dsym.toChars());
if (dsym.semanticRun >= PASS.semanticdone)
return;
@@ -1558,6 +1590,12 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
foreach (s; (*pd.decl)[])
{
+ if (pd.ident == Id.printf || pd.ident == Id.scanf)
+ {
+ s.setPragmaPrintf(pd.ident == Id.printf);
+ continue;
+ }
+
s.dsymbolSemantic(sc2);
if (pd.ident != Id.mangle)
continue;
@@ -1574,13 +1612,13 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
agg = tc.sym;
else if (auto ts = e.type.isTypeStruct())
agg = ts.sym;
- ad.mangleOverride = new MangleOverride;
+ ad.pMangleOverride = new MangleOverride;
void setString(ref Expression e)
{
if (auto se = verifyMangleString(e))
{
const name = (cast(const(char)[])se.peekData()).xarraydup;
- ad.mangleOverride.id = Identifier.idPool(name);
+ ad.pMangleOverride.id = Identifier.idPool(name);
e = se;
}
else
@@ -1588,13 +1626,13 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
if (agg)
{
- ad.mangleOverride.agg = agg;
+ ad.pMangleOverride.agg = agg;
if (pd.args.dim == 2)
{
setString((*pd.args)[1]);
}
else
- ad.mangleOverride.id = agg.ident;
+ ad.pMangleOverride.id = agg.ident;
}
else
setString((*pd.args)[0]);
@@ -1649,29 +1687,8 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
if (!pd.args)
return noDeclarations();
- for (size_t i = 0; i < pd.args.dim; i++)
- {
- Expression e = (*pd.args)[i];
- sc = sc.startCTFE();
- e = e.expressionSemantic(sc);
- e = resolveProperties(sc, e);
- sc = sc.endCTFE();
- e = ctfeInterpretForPragmaMsg(e);
- if (e.op == EXP.error)
- {
- errorSupplemental(pd.loc, "while evaluating `pragma(msg, %s)`", (*pd.args)[i].toChars());
- return;
- }
- StringExp se = e.toStringExp();
- if (se)
- {
- se = se.toUTF8(sc);
- fprintf(stderr, "%.*s", cast(int)se.len, se.peekString().ptr);
- }
- else
- fprintf(stderr, "%s", e.toChars());
- }
- fprintf(stderr, "\n");
+ if (!pragmaMsgSemantic(pd.loc, sc, pd.args))
+ return;
return noDeclarations();
}
@@ -1707,33 +1724,11 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
else if (pd.ident == Id.startaddress)
{
- if (!pd.args || pd.args.dim != 1)
- pd.error("function name expected for start address");
- else
- {
- /* https://issues.dlang.org/show_bug.cgi?id=11980
- * resolveProperties and ctfeInterpret call are not necessary.
- */
- Expression e = (*pd.args)[0];
- sc = sc.startCTFE();
- e = e.expressionSemantic(sc);
- sc = sc.endCTFE();
- (*pd.args)[0] = e;
- Dsymbol sa = getDsymbol(e);
- if (!sa || !sa.isFuncDeclaration())
- pd.error("function name expected for start address, not `%s`", e.toChars());
- }
+ pragmaStartAddressSemantic(pd.loc, sc, pd.args);
return noDeclarations();
}
else if (pd.ident == Id.Pinline)
{
- if (pd.args && pd.args.dim > 1)
- {
- pd.error("one boolean expression expected for `pragma(inline)`, not %llu", cast(ulong) pd.args.dim);
- pd.args.setDim(1);
- (*pd.args)[0] = ErrorExp.get();
- }
-
// this pragma now gets evaluated on demand in function semantic
return declarations();
@@ -1774,7 +1769,11 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
else if (auto f = s.isFuncDeclaration())
{
- f.flags |= isCtor ? FUNCFLAG.CRTCtor : FUNCFLAG.CRTDtor;
+ if (isCtor)
+ f.isCrtCtor = true;
+ else
+ f.isCrtDtor = true;
+
return 1;
}
else
@@ -3048,7 +3047,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
//printf("function storage_class = x%llx, sc.stc = x%llx, %x\n", storage_class, sc.stc, Declaration.isFinal());
if (sc.flags & SCOPE.compile)
- funcdecl.flags |= FUNCFLAG.compileTimeOnly; // don't emit code for this function
+ funcdecl.isCompileTimeOnly = true; // don't emit code for this function
funcdecl._linkage = sc.linkage;
if (auto fld = funcdecl.isFuncLiteralDeclaration())
@@ -3069,7 +3068,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
// evaluate pragma(inline)
if (auto pragmadecl = sc.inlining)
- funcdecl.inlining = pragmadecl.evalPragmaInline(sc);
+ funcdecl.inlining = evalPragmaInline(pragmadecl.loc, sc, pragmadecl.args);
funcdecl.visibility = sc.visibility;
funcdecl.userAttribDecl = sc.userAttribDecl;
@@ -3269,9 +3268,9 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
// check pragma(crt_constructor) signature
- if (funcdecl.flags & (FUNCFLAG.CRTCtor | FUNCFLAG.CRTDtor))
+ if (funcdecl.isCrtCtor || funcdecl.isCrtDtor)
{
- const idStr = (funcdecl.flags & FUNCFLAG.CRTCtor) ? "crt_constructor" : "crt_destructor";
+ const idStr = funcdecl.isCrtCtor ? "crt_constructor" : "crt_destructor";
if (f.nextOf().ty != Tvoid)
funcdecl.error("must return `void` for `pragma(%s)`", idStr.ptr);
if (funcdecl._linkage != LINK.c && f.parameterList.length != 0)
@@ -3351,7 +3350,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
}
- if (const pors = sc.flags & (SCOPE.printf | SCOPE.scanf))
+ if (funcdecl.printf || funcdecl.scanf)
{
/* printf/scanf-like functions must be of the form:
* extern (C/C++) T printf([parameters...], const(char)* format, ...);
@@ -3387,11 +3386,11 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
)
)
{
- funcdecl.flags |= (pors == SCOPE.printf) ? FUNCFLAG.printf : FUNCFLAG.scanf;
+ // the signature is valid for printf/scanf, no error
}
else
{
- const p = (pors == SCOPE.printf ? Id.printf : Id.scanf).toChars();
+ const p = (funcdecl.printf ? Id.printf : Id.scanf).toChars();
if (f.parameterList.varargs == VarArg.variadic)
{
funcdecl.error("`pragma(%s)` functions must be `extern(C) %s %s([parameters...], const(char)*, ...)`"
@@ -3538,7 +3537,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
else
{
//printf("\tintroducing function %s\n", funcdecl.toChars());
- funcdecl.flags |= FUNCFLAG.introducing;
+ funcdecl.isIntroducing = true;
if (cd.classKind == ClassKind.cpp && target.cpp.reverseOverloads)
{
/* Overloaded functions with same name are grouped and in reverse order.
@@ -4555,13 +4554,16 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
if (sd.semanticRun == PASS.initial)
sd.type = sd.type.addSTC(sc.stc | sd.storage_class);
sd.type = sd.type.typeSemantic(sd.loc, sc);
- if (auto ts = sd.type.isTypeStruct())
+ auto ts = sd.type.isTypeStruct();
+ if (ts)
+ {
if (ts.sym != sd)
{
auto ti = ts.sym.isInstantiated();
if (ti && isError(ti))
ts.sym = sd;
}
+ }
// Ungag errors when not speculative
Ungag ungag = sd.ungagSpeculative();
@@ -4699,16 +4701,26 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
}
- if (sd.type.ty == Tstruct && (cast(TypeStruct)sd.type).sym != sd)
+ if (ts && ts.sym != sd)
{
- // https://issues.dlang.org/show_bug.cgi?id=19024
- StructDeclaration sym = (cast(TypeStruct)sd.type).sym;
- version (none)
+ StructDeclaration sym = ts.sym;
+ if (sd.isCsymbol() && sym.isCsymbol())
+ {
+ /* This is two structs imported from different C files.
+ * Just ignore sd, the second one. The first one will always
+ * be found when going through the type.
+ */
+ }
+ else
{
- printf("this = %p %s\n", sd, sd.toChars());
- printf("type = %d sym = %p, %s\n", sd.type.ty, sym, sym.toPrettyChars());
+ version (none)
+ {
+ printf("this = %p %s\n", sd, sd.toChars());
+ printf("type = %d sym = %p, %s\n", sd.type.ty, sym, sym.toPrettyChars());
+ }
+ // https://issues.dlang.org/show_bug.cgi?id=19024
+ sd.error("already exists at %s. Perhaps in another function with the same name?", sym.loc.toChars());
}
- sd.error("already exists at %s. Perhaps in another function with the same name?", sym.loc.toChars());
}
if (global.errors != errors)
@@ -5291,7 +5303,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
auto ctor = new CtorDeclaration(cldec.loc, Loc.initial, 0, tf);
ctor.storage_class |= STC.inference;
- ctor.flags |= FUNCFLAG.generated;
+ ctor.isGenerated = true;
ctor.fbody = new CompoundStatement(Loc.initial, new Statements());
cldec.members.push(ctor);
@@ -7099,3 +7111,47 @@ private CallExp doAtomicOp (string op, Identifier var, Expression arg)
return CallExp.create(loc, dti, args);
}
+
+/***************************************
+ * Interpret a `pragma(inline, x)`
+ *
+ * Params:
+ * loc = location for error messages
+ * sc = scope for evaluation of argument
+ * args = pragma arguments
+ * Returns: corresponding `PINLINE` state
+ */
+PINLINE evalPragmaInline(Loc loc, Scope* sc, Expressions* args)
+{
+ if (!args || args.dim == 0)
+ return PINLINE.default_;
+
+ if (args && args.dim > 1)
+ {
+ .error(loc, "one boolean expression expected for `pragma(inline)`, not %llu", cast(ulong) args.dim);
+ args.setDim(1);
+ (*args)[0] = ErrorExp.get();
+ }
+
+ Expression e = (*args)[0];
+ if (!e.type)
+ {
+ sc = sc.startCTFE();
+ e = e.expressionSemantic(sc);
+ e = resolveProperties(sc, e);
+ sc = sc.endCTFE();
+ e = e.ctfeInterpret();
+ e = e.toBoolean(sc);
+ if (e.isErrorExp())
+ .error(loc, "pragma(`inline`, `true` or `false`) expected, not `%s`", (*args)[0].toChars());
+ (*args)[0] = e;
+ }
+
+ const opt = e.toBool();
+ if (opt.isEmpty())
+ return PINLINE.default_;
+ else if (opt.get())
+ return PINLINE.always;
+ else
+ return PINLINE.never;
+}
diff --git a/gcc/d/dmd/dtemplate.d b/gcc/d/dmd/dtemplate.d
index 13efc1c..1f99c58 100644
--- a/gcc/d/dmd/dtemplate.d
+++ b/gcc/d/dmd/dtemplate.d
@@ -1173,7 +1173,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
fd = new FuncDeclaration(fd.loc, fd.endloc, fd.ident, fd.storage_class, tf);
fd.parent = ti;
- fd.flags |= FUNCFLAG.inferRetType;
+ fd.inferRetType = true;
// Shouldn't run semantic on default arguments and return type.
foreach (ref param; *tf.parameterList.parameters)
@@ -3901,7 +3901,7 @@ MATCH deduceType(RootObject o, Scope* sc, Type tparam, TemplateParameters* param
// https://issues.dlang.org/show_bug.cgi?id=2579
// Apply function parameter storage classes to parameter types
fparam.type = fparam.type.addStorageClass(fparam.storageClass);
- fparam.storageClass &= ~(STC.TYPECTOR | STC.in_);
+ fparam.storageClass &= ~STC.TYPECTOR;
// https://issues.dlang.org/show_bug.cgi?id=15243
// Resolve parameter type if it's not related with template parameters
diff --git a/gcc/d/dmd/entity.d b/gcc/d/dmd/entity.d
index c29d499..2b499c1 100644
--- a/gcc/d/dmd/entity.d
+++ b/gcc/d/dmd/entity.d
@@ -25,7 +25,7 @@ nothrow:
* code point corresponding to the named entity
* ~0 for not recognized as a named entity
*/
-public uint HtmlNamedEntity(scope const char[] name) pure @nogc @safe
+public uint[2] HtmlNamedEntity(scope const char[] name) pure @nogc @safe
{
const firstC = tolower(name[0]);
if (firstC >= 'a' && firstC <= 'z')
@@ -34,10 +34,10 @@ public uint HtmlNamedEntity(scope const char[] name) pure @nogc @safe
foreach (entity; namesTable[firstC - 'a'])
{
if (entity.name == name)
- return entity.value;
+ return [entity.value, entity.value2];
}
}
- return ~0;
+ return [0, 0];
}
private:
@@ -52,6 +52,7 @@ struct NameId
{
string name;
uint value;
+ uint value2;
}
// @todo@ order namesTable and names? by frequency
@@ -72,7 +73,7 @@ immutable NameId[] namesA =
{"abreve", 0x00103}, // LATIN SMALL LETTER A WITH BREVE
{"ac", 0x0223E}, // INVERTED LAZY S
{"acd", 0x0223F}, // SINE WAVE
-// {"acE", 0x0223E;0x00333}, // INVERTED LAZY S with double underline
+ {"acE", 0x0223E, 0x00333}, // INVERTED LAZY S with double underline
{"Acirc", 0x000C2}, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX
{"acirc", 0x000E2}, // LATIN SMALL LETTER A WITH CIRCUMFLEX
{"acute", 0x000B4}, // ACUTE ACCENT
@@ -157,42 +158,30 @@ immutable NameId[] namesB =
{"backsim", 0x0223D}, // REVERSED TILDE
{"backsimeq", 0x022CD}, // REVERSED TILDE EQUALS
{"Backslash", 0x02216}, // SET MINUS
-// "b.alpha", 0x1D6C2}, // MATHEMATICAL BOLD SMALL ALPHA
{"Barv", 0x02AE7}, // SHORT DOWN TACK WITH OVERBAR
{"barvee", 0x022BD}, // NOR
{"barwed", 0x02305}, // PROJECTIVE
{"Barwed", 0x02306}, // PERSPECTIVE
{"barwedge", 0x02305}, // PROJECTIVE
-// "b.beta", 0x1D6C3}, // MATHEMATICAL BOLD SMALL BETA
{"bbrk", 0x023B5}, // BOTTOM SQUARE BRACKET
{"bbrktbrk", 0x023B6}, // BOTTOM SQUARE BRACKET OVER TOP SQUARE BRACKET
-// "b.chi", 0x1D6D8}, // MATHEMATICAL BOLD SMALL CHI
{"bcong", 0x0224C}, // ALL EQUAL TO
{"Bcy", 0x00411}, // CYRILLIC CAPITAL LETTER BE
{"bcy", 0x00431}, // CYRILLIC SMALL LETTER BE
-// "b.Delta", 0x1D6AB}, // MATHEMATICAL BOLD CAPITAL DELTA
-// "b.delta", 0x1D6C5}, // MATHEMATICAL BOLD SMALL DELTA
{"bdquo", 0x0201E}, // DOUBLE LOW-9 QUOTATION MARK
{"becaus", 0x02235}, // BECAUSE
{"because", 0x02235}, // BECAUSE
{"Because", 0x02235}, // BECAUSE
{"bemptyv", 0x029B0}, // REVERSED EMPTY SET
{"bepsi", 0x003F6}, // GREEK REVERSED LUNATE EPSILON SYMBOL
-// "b.epsi", 0x1D6C6}, // MATHEMATICAL BOLD SMALL EPSILON
-// "b.epsiv", 0x1D6DC}, // MATHEMATICAL BOLD EPSILON SYMBOL
{"bernou", 0x0212C}, // SCRIPT CAPITAL B
{"Bernoullis", 0x0212C}, // SCRIPT CAPITAL B
{"Beta", 0x00392}, // GREEK CAPITAL LETTER BETA
{"beta", 0x003B2}, // GREEK SMALL LETTER BETA
-// "b.eta", 0x1D6C8}, // MATHEMATICAL BOLD SMALL ETA
{"beth", 0x02136}, // BET SYMBOL
{"between", 0x0226C}, // BETWEEN
{"Bfr", 0x1D505}, // MATHEMATICAL FRAKTUR CAPITAL B
{"bfr", 0x1D51F}, // MATHEMATICAL FRAKTUR SMALL B
-// "b.Gamma", 0x1D6AA}, // MATHEMATICAL BOLD CAPITAL GAMMA
-// "b.gamma", 0x1D6C4}, // MATHEMATICAL BOLD SMALL GAMMA
-// "b.Gammad", 0x1D7CA}, // MATHEMATICAL BOLD CAPITAL DIGAMMA
-// "b.gammad", 0x1D7CB}, // MATHEMATICAL BOLD SMALL DIGAMMA
{"Bgr", 0x00392}, // GREEK CAPITAL LETTER BETA
{"bgr", 0x003B2}, // GREEK SMALL LETTER BETA
{"bigcap", 0x022C2}, // N-ARY INTERSECTION
@@ -208,9 +197,6 @@ immutable NameId[] namesB =
{"biguplus", 0x02A04}, // N-ARY UNION OPERATOR WITH PLUS
{"bigvee", 0x022C1}, // N-ARY LOGICAL OR
{"bigwedge", 0x022C0}, // N-ARY LOGICAL AND
-// "b.iota", 0x1D6CA}, // MATHEMATICAL BOLD SMALL IOTA
-// "b.kappa", 0x1D6CB}, // MATHEMATICAL BOLD SMALL KAPPA
-// "b.kappav", 0x1D6DE}, // MATHEMATICAL BOLD KAPPA SYMBOL
{"bkarow", 0x0290D}, // RIGHTWARDS DOUBLE DASH ARROW
{"blacklozenge", 0x029EB}, // BLACK LOZENGE
{"blacksquare", 0x025AA}, // BLACK SMALL SQUARE
@@ -218,21 +204,15 @@ immutable NameId[] namesB =
{"blacktriangledown", 0x025BE}, // BLACK DOWN-POINTING SMALL TRIANGLE
{"blacktriangleleft", 0x025C2}, // BLACK LEFT-POINTING SMALL TRIANGLE
{"blacktriangleright", 0x025B8}, // BLACK RIGHT-POINTING SMALL TRIANGLE
-// "b.Lambda", 0x1D6B2}, // MATHEMATICAL BOLD CAPITAL LAMDA
-// "b.lambda", 0x1D6CC}, // MATHEMATICAL BOLD SMALL LAMDA
{"blank", 0x02423}, // OPEN BOX
{"blk12", 0x02592}, // MEDIUM SHADE
{"blk14", 0x02591}, // LIGHT SHADE
{"blk34", 0x02593}, // DARK SHADE
{"block", 0x02588}, // FULL BLOCK
-// "b.mu", 0x1D6CD}, // MATHEMATICAL BOLD SMALL MU
-// "bne", 0x0003D;0x020E5}, // EQUALS SIGN with reverse slash
-// "bnequiv", 0x02261;0x020E5}, // IDENTICAL TO with reverse slash
+ {"bne", 0x0003D, 0x020E5}, // EQUALS SIGN with reverse slash
+ {"bnequiv", 0x02261, 0x020E5}, // IDENTICAL TO with reverse slash
{"bnot", 0x02310}, // REVERSED NOT SIGN
{"bNot", 0x02AED}, // REVERSED DOUBLE STROKE NOT SIGN
-// "b.nu", 0x1D6CE}, // MATHEMATICAL BOLD SMALL NU
-// "b.Omega", 0x1D6C0}, // MATHEMATICAL BOLD CAPITAL OMEGA
-// "b.omega", 0x1D6DA}, // MATHEMATICAL BOLD SMALL OMEGA
{"Bopf", 0x1D539}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL B
{"bopf", 0x1D553}, // MATHEMATICAL DOUBLE-STRUCK SMALL B
{"bot", 0x022A5}, // UP TACK
@@ -282,35 +262,18 @@ immutable NameId[] namesB =
{"boxvR", 0x0255E}, // BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
{"boxVr", 0x0255F}, // BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
{"boxVR", 0x02560}, // BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
-// "b.Phi", 0x1D6BD}, // MATHEMATICAL BOLD CAPITAL PHI
-// "b.phi", 0x1D6D7}, // MATHEMATICAL BOLD SMALL PHI
-// "b.phiv", 0x1D6DF}, // MATHEMATICAL BOLD PHI SYMBOL
-// "b.Pi", 0x1D6B7}, // MATHEMATICAL BOLD CAPITAL PI
-// "b.pi", 0x1D6D1}, // MATHEMATICAL BOLD SMALL PI
-// "b.piv", 0x1D6E1}, // MATHEMATICAL BOLD PI SYMBOL
{"bprime", 0x02035}, // REVERSED PRIME
-// "b.Psi", 0x1D6BF}, // MATHEMATICAL BOLD CAPITAL PSI
-// "b.psi", 0x1D6D9}, // MATHEMATICAL BOLD SMALL PSI
{"breve", 0x002D8}, // BREVE
{"Breve", 0x002D8}, // BREVE
-// "b.rho", 0x1D6D2}, // MATHEMATICAL BOLD SMALL RHO
-// "b.rhov", 0x1D6E0}, // MATHEMATICAL BOLD RHO SYMBOL
{"brvbar", 0x000A6}, // BROKEN BAR
{"Bscr", 0x0212C}, // SCRIPT CAPITAL B
{"bscr", 0x1D4B7}, // MATHEMATICAL SCRIPT SMALL B
{"bsemi", 0x0204F}, // REVERSED SEMICOLON
-// "b.Sigma", 0x1D6BA}, // MATHEMATICAL BOLD CAPITAL SIGMA
-// "b.sigma", 0x1D6D4}, // MATHEMATICAL BOLD SMALL SIGMA
-// "b.sigmav", 0x1D6D3}, // MATHEMATICAL BOLD SMALL FINAL SIGMA
{"bsim", 0x0223D}, // REVERSED TILDE
{"bsime", 0x022CD}, // REVERSED TILDE EQUALS
{"bsol", 0x0005C}, // REVERSE SOLIDUS
{"bsolb", 0x029C5}, // SQUARED FALLING DIAGONAL SLASH
{"bsolhsub", 0x027C8}, // REVERSE SOLIDUS PRECEDING SUBSET
-// "b.tau", 0x1D6D5}, // MATHEMATICAL BOLD SMALL TAU
-// "b.Theta", 0x1D6AF}, // MATHEMATICAL BOLD CAPITAL THETA
-// "b.thetas", 0x1D6C9}, // MATHEMATICAL BOLD SMALL THETA
-// "b.thetav", 0x1D6DD}, // MATHEMATICAL BOLD THETA SYMBOL
{"bull", 0x02022}, // BULLET
{"bullet", 0x02022}, // BULLET
{"bump", 0x0224E}, // GEOMETRICALLY EQUIVALENT TO
@@ -318,11 +281,6 @@ immutable NameId[] namesB =
{"bumpE", 0x02AAE}, // EQUALS SIGN WITH BUMPY ABOVE
{"Bumpeq", 0x0224E}, // GEOMETRICALLY EQUIVALENT TO
{"bumpeq", 0x0224F}, // DIFFERENCE BETWEEN
-// "b.Upsi", 0x1D6BC}, // MATHEMATICAL BOLD CAPITAL UPSILON
-// "b.upsi", 0x1D6D6}, // MATHEMATICAL BOLD SMALL UPSILON
-// "b.Xi", 0x1D6B5}, // MATHEMATICAL BOLD CAPITAL XI
-// "b.xi", 0x1D6CF}, // MATHEMATICAL BOLD SMALL XI
-// "b.zeta", 0x1D6C7}, // MATHEMATICAL BOLD SMALL ZETA
];
immutable NameId[] namesC =
@@ -337,7 +295,7 @@ immutable NameId[] namesC =
{"capcup", 0x02A47}, // INTERSECTION ABOVE UNION
{"capdot", 0x02A40}, // INTERSECTION WITH DOT
{"CapitalDifferentialD", 0x02145}, // DOUBLE-STRUCK ITALIC CAPITAL D
-// "caps", 0x02229;0x0FE00}, // INTERSECTION with serifs
+ {"caps", 0x02229, 0x0FE00}, // INTERSECTION with serifs
{"caret", 0x02041}, // CARET INSERTION POINT
{"caron", 0x002C7}, // CARON
{"Cayleys", 0x0212D}, // BLACK-LETTER CAPITAL C
@@ -440,7 +398,7 @@ immutable NameId[] namesC =
{"cupcup", 0x02A4A}, // UNION BESIDE AND JOINED WITH UNION
{"cupdot", 0x0228D}, // MULTISET MULTIPLICATION
{"cupor", 0x02A45}, // UNION WITH LOGICAL OR
-// "cups", 0x0222A;0x0FE00}, // UNION with serifs
+ {"cups", 0x0222A, 0x0FE00}, // UNION with serifs
{"curarr", 0x021B7}, // CLOCKWISE TOP SEMICIRCLE ARROW
{"curarrm", 0x0293C}, // TOP ARC CLOCKWISE ARROW WITH MINUS
{"curlyeqprec", 0x022DE}, // EQUAL TO OR PRECEDES
@@ -694,7 +652,7 @@ immutable NameId[] namesF =
{"filig", 0x0FB01}, // LATIN SMALL LIGATURE FI
{"FilledSmallSquare", 0x025FC}, // BLACK MEDIUM SQUARE
{"FilledVerySmallSquare", 0x025AA}, // BLACK SMALL SQUARE
-// "fjlig", 0x00066;0x0006A}, // fj ligature
+ {"fjlig", 0x00066, 0x0006A}, // fj ligature
{"flat", 0x0266D}, // MUSIC FLAT SIGN
{"fllig", 0x0FB02}, // LATIN SMALL LIGATURE FL
{"fltns", 0x025B1}, // WHITE PARALLELOGRAM
@@ -757,7 +715,7 @@ immutable NameId[] namesG =
{"gesdot", 0x02A80}, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
{"gesdoto", 0x02A82}, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
{"gesdotol", 0x02A84}, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT
-// "gesl", 0x022DB;0x0FE00}, // GREATER-THAN slanted EQUAL TO OR LESS-THAN
+ {"gesl", 0x022DB, 0x0FE00}, // GREATER-THAN slanted EQUAL TO OR LESS-THAN
{"gesles", 0x02A94}, // GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL
{"Gfr", 0x1D50A}, // MATHEMATICAL FRAKTUR CAPITAL G
{"gfr", 0x1D524}, // MATHEMATICAL FRAKTUR SMALL G
@@ -810,8 +768,8 @@ immutable NameId[] namesG =
{"gtreqqless", 0x02A8C}, // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN
{"gtrless", 0x02277}, // GREATER-THAN OR LESS-THAN
{"gtrsim", 0x02273}, // GREATER-THAN OR EQUIVALENT TO
-// "gvertneqq", 0x02269;0x0FE00}, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke
-// "gvnE", 0x02269;0x0FE00}, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke
+ {"gvertneqq", 0x02269, 0x0FE00}, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke
+ {"gvnE", 0x02269, 0x0FE00}, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke
];
immutable NameId[] namesH =
@@ -1020,7 +978,7 @@ immutable NameId[] namesL =
{"latail", 0x02919}, // LEFTWARDS ARROW-TAIL
{"lAtail", 0x0291B}, // LEFTWARDS DOUBLE ARROW-TAIL
{"late", 0x02AAD}, // LARGER THAN OR EQUAL TO
-// "lates", 0x02AAD;0x0FE00}, // LARGER THAN OR slanted EQUAL
+ {"lates", 0x02AAD, 0x0FE00}, // LARGER THAN OR slanted EQUAL
{"lbarr", 0x0290C}, // LEFTWARDS DOUBLE DASH ARROW
{"lBarr", 0x0290E}, // LEFTWARDS TRIPLE DASH ARROW
{"lbbrk", 0x02772}, // LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT
@@ -1091,7 +1049,7 @@ immutable NameId[] namesL =
{"lesdot", 0x02A7F}, // LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
{"lesdoto", 0x02A81}, // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
{"lesdotor", 0x02A83}, // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT
-// "lesg", 0x022DA;0x0FE00}, // LESS-THAN slanted EQUAL TO OR GREATER-THAN
+ {"lesg", 0x022DA, 0x0FE00}, // LESS-THAN slanted EQUAL TO OR GREATER-THAN
{"lesges", 0x02A93}, // LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL
{"lessapprox", 0x02A85}, // LESS-THAN OR APPROXIMATE
{"lessdot", 0x022D6}, // LESS-THAN WITH DOT
@@ -1202,8 +1160,8 @@ immutable NameId[] namesL =
{"ltrPar", 0x02996}, // DOUBLE RIGHT ARC LESS-THAN BRACKET
{"lurdshar", 0x0294A}, // LEFT BARB UP RIGHT BARB DOWN HARPOON
{"luruhar", 0x02966}, // LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP
-// "lvertneqq", 0x02268;0x0FE00}, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke
-// "lvnE", 0x02268;0x0FE00}, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke
+ {"lvertneqq", 0x02268, 0x0FE00}, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke
+ {"lvnE", 0x02268, 0x0FE00}, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke
];
immutable NameId[] namesM =
@@ -1263,25 +1221,25 @@ immutable NameId[] namesN =
{"nabla", 0x02207}, // NABLA
{"Nacute", 0x00143}, // LATIN CAPITAL LETTER N WITH ACUTE
{"nacute", 0x00144}, // LATIN SMALL LETTER N WITH ACUTE
-// "nang", 0x02220;0x020D2}, // ANGLE with vertical line
+ {"nang", 0x02220, 0x020D2}, // ANGLE with vertical line
{"nap", 0x02249}, // NOT ALMOST EQUAL TO
-// "napE", 0x02A70;0x00338}, // APPROXIMATELY EQUAL OR EQUAL TO with slash
-// "napid", 0x0224B;0x00338}, // TRIPLE TILDE with slash
+ {"napE", 0x02A70, 0x00338}, // APPROXIMATELY EQUAL OR EQUAL TO with slash
+ {"napid", 0x0224B, 0x00338}, // TRIPLE TILDE with slash
{"napos", 0x00149}, // LATIN SMALL LETTER N PRECEDED BY APOSTROPHE
{"napprox", 0x02249}, // NOT ALMOST EQUAL TO
{"natur", 0x0266E}, // MUSIC NATURAL SIGN
{"natural", 0x0266E}, // MUSIC NATURAL SIGN
{"naturals", 0x02115}, // DOUBLE-STRUCK CAPITAL N
{"nbsp", 0x000A0}, // NO-BREAK SPACE
-// "nbump", 0x0224E;0x00338}, // GEOMETRICALLY EQUIVALENT TO with slash
-// "nbumpe", 0x0224F;0x00338}, // DIFFERENCE BETWEEN with slash
+ {"nbump", 0x0224E, 0x00338}, // GEOMETRICALLY EQUIVALENT TO with slash
+ {"nbumpe", 0x0224F, 0x00338}, // DIFFERENCE BETWEEN with slash
{"ncap", 0x02A43}, // INTERSECTION WITH OVERBAR
{"Ncaron", 0x00147}, // LATIN CAPITAL LETTER N WITH CARON
{"ncaron", 0x00148}, // LATIN SMALL LETTER N WITH CARON
{"Ncedil", 0x00145}, // LATIN CAPITAL LETTER N WITH CEDILLA
{"ncedil", 0x00146}, // LATIN SMALL LETTER N WITH CEDILLA
{"ncong", 0x02247}, // NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO
-// "ncongdot", 0x02A6D;0x00338}, // CONGRUENT WITH DOT ABOVE with slash
+ {"ncongdot", 0x02A6D, 0x00338}, // CONGRUENT WITH DOT ABOVE with slash
{"ncup", 0x02A42}, // UNION WITH OVERBAR
{"Ncy", 0x0041D}, // CYRILLIC CAPITAL LETTER EN
{"ncy", 0x0043D}, // CYRILLIC SMALL LETTER EN
@@ -1291,14 +1249,14 @@ immutable NameId[] namesN =
{"nearr", 0x02197}, // NORTH EAST ARROW
{"neArr", 0x021D7}, // NORTH EAST DOUBLE ARROW
{"nearrow", 0x02197}, // NORTH EAST ARROW
-// "nedot", 0x02250;0x00338}, // APPROACHES THE LIMIT with slash
+ {"nedot", 0x02250, 0x00338}, // APPROACHES THE LIMIT with slash
{"NegativeMediumSpace", 0x0200B}, // ZERO WIDTH SPACE
{"NegativeThickSpace", 0x0200B}, // ZERO WIDTH SPACE
{"NegativeThinSpace", 0x0200B}, // ZERO WIDTH SPACE
{"NegativeVeryThinSpace", 0x0200B}, // ZERO WIDTH SPACE
{"nequiv", 0x02262}, // NOT IDENTICAL TO
{"nesear", 0x02928}, // NORTH EAST ARROW AND SOUTH EAST ARROW
-// "nesim", 0x02242;0x00338}, // MINUS TILDE with slash
+ {"nesim", 0x02242, 0x00338}, // MINUS TILDE with slash
{"NestedGreaterGreater", 0x0226B}, // MUCH GREATER-THAN
{"NestedLessLess", 0x0226A}, // MUCH LESS-THAN
{"NewLine", 0x0000A}, // LINE FEED (LF)
@@ -1306,20 +1264,20 @@ immutable NameId[] namesN =
{"nexists", 0x02204}, // THERE DOES NOT EXIST
{"Nfr", 0x1D511}, // MATHEMATICAL FRAKTUR CAPITAL N
{"nfr", 0x1D52B}, // MATHEMATICAL FRAKTUR SMALL N
-// "ngE", 0x02267;0x00338}, // GREATER-THAN OVER EQUAL TO with slash
+ {"ngE", 0x02267, 0x00338}, // GREATER-THAN OVER EQUAL TO with slash
{"nge", 0x02271}, // NEITHER GREATER-THAN NOR EQUAL TO
{"ngeq", 0x02271}, // NEITHER GREATER-THAN NOR EQUAL TO
-// "ngeqq", 0x02267;0x00338}, // GREATER-THAN OVER EQUAL TO with slash
-// "ngeqslant", 0x02A7E;0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash
-// "nges", 0x02A7E;0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash
-// "nGg", 0x022D9;0x00338}, // VERY MUCH GREATER-THAN with slash
+ {"ngeqq", 0x02267, 0x00338}, // GREATER-THAN OVER EQUAL TO with slash
+ {"ngeqslant", 0x02A7E, 0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash
+ {"nges", 0x02A7E, 0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash
+ {"nGg", 0x022D9, 0x00338}, // VERY MUCH GREATER-THAN with slash
{"Ngr", 0x0039D}, // GREEK CAPITAL LETTER NU
{"ngr", 0x003BD}, // GREEK SMALL LETTER NU
{"ngsim", 0x02275}, // NEITHER GREATER-THAN NOR EQUIVALENT TO
-// "nGt", 0x0226B;0x020D2}, // MUCH GREATER THAN with vertical line
+ {"nGt", 0x0226B, 0x020D2}, // MUCH GREATER THAN with vertical line
{"ngt", 0x0226F}, // NOT GREATER-THAN
{"ngtr", 0x0226F}, // NOT GREATER-THAN
-// "nGtv", 0x0226B;0x00338}, // MUCH GREATER THAN with slash
+ {"nGtv", 0x0226B, 0x00338}, // MUCH GREATER THAN with slash
{"nharr", 0x021AE}, // LEFT RIGHT ARROW WITH STROKE
{"nhArr", 0x021CE}, // LEFT RIGHT DOUBLE ARROW WITH STROKE
{"nhpar", 0x02AF2}, // PARALLEL WITH HORIZONTAL STROKE
@@ -1332,24 +1290,24 @@ immutable NameId[] namesN =
{"nlarr", 0x0219A}, // LEFTWARDS ARROW WITH STROKE
{"nlArr", 0x021CD}, // LEFTWARDS DOUBLE ARROW WITH STROKE
{"nldr", 0x02025}, // TWO DOT LEADER
-// "nlE", 0x02266;0x00338}, // LESS-THAN OVER EQUAL TO with slash
+ {"nlE", 0x02266, 0x00338}, // LESS-THAN OVER EQUAL TO with slash
{"nle", 0x02270}, // NEITHER LESS-THAN NOR EQUAL TO
{"nleftarrow", 0x0219A}, // LEFTWARDS ARROW WITH STROKE
{"nLeftarrow", 0x021CD}, // LEFTWARDS DOUBLE ARROW WITH STROKE
{"nleftrightarrow", 0x021AE}, // LEFT RIGHT ARROW WITH STROKE
{"nLeftrightarrow", 0x021CE}, // LEFT RIGHT DOUBLE ARROW WITH STROKE
{"nleq", 0x02270}, // NEITHER LESS-THAN NOR EQUAL TO
-// "nleqq", 0x02266;0x00338}, // LESS-THAN OVER EQUAL TO with slash
-// "nleqslant", 0x02A7D;0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash
-// "nles", 0x02A7D;0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash
+ {"nleqq", 0x02266, 0x00338}, // LESS-THAN OVER EQUAL TO with slash
+ {"nleqslant", 0x02A7D, 0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash
+ {"nles", 0x02A7D, 0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash
{"nless", 0x0226E}, // NOT LESS-THAN
-// "nLl", 0x022D8;0x00338}, // VERY MUCH LESS-THAN with slash
+ {"nLl", 0x022D8, 0x00338}, // VERY MUCH LESS-THAN with slash
{"nlsim", 0x02274}, // NEITHER LESS-THAN NOR EQUIVALENT TO
-// "nLt", 0x0226A;0x020D2}, // MUCH LESS THAN with vertical line
+ {"nLt", 0x0226A, 0x020D2}, // MUCH LESS THAN with vertical line
{"nlt", 0x0226E}, // NOT LESS-THAN
{"nltri", 0x022EA}, // NOT NORMAL SUBGROUP OF
{"nltrie", 0x022EC}, // NOT NORMAL SUBGROUP OF OR EQUAL TO
-// "nLtv", 0x0226A;0x00338}, // MUCH LESS THAN with slash
+ {"nLtv", 0x0226A, 0x00338}, // MUCH LESS THAN with slash
{"nmid", 0x02224}, // DOES NOT DIVIDE
{"NoBreak", 0x02060}, // WORD JOINER
{"NonBreakingSpace", 0x000A0}, // NO-BREAK SPACE
@@ -1362,56 +1320,56 @@ immutable NameId[] namesN =
{"NotDoubleVerticalBar", 0x02226}, // NOT PARALLEL TO
{"NotElement", 0x02209}, // NOT AN ELEMENT OF
{"NotEqual", 0x02260}, // NOT EQUAL TO
-// "NotEqualTilde", 0x02242;0x00338}, // MINUS TILDE with slash
+ {"NotEqualTilde", 0x02242, 0x00338}, // MINUS TILDE with slash
{"NotExists", 0x02204}, // THERE DOES NOT EXIST
{"NotGreater", 0x0226F}, // NOT GREATER-THAN
{"NotGreaterEqual", 0x02271}, // NEITHER GREATER-THAN NOR EQUAL TO
-// "NotGreaterFullEqual", 0x02267;0x00338}, // GREATER-THAN OVER EQUAL TO with slash
-// "NotGreaterGreater", 0x0226B;0x00338}, // MUCH GREATER THAN with slash
+ {"NotGreaterFullEqual", 0x02267, 0x00338}, // GREATER-THAN OVER EQUAL TO with slash
+ {"NotGreaterGreater", 0x0226B, 0x00338}, // MUCH GREATER THAN with slash
{"NotGreaterLess", 0x02279}, // NEITHER GREATER-THAN NOR LESS-THAN
-// "NotGreaterSlantEqual", 0x02A7E;0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash
+ {"NotGreaterSlantEqual", 0x02A7E, 0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash
{"NotGreaterTilde", 0x02275}, // NEITHER GREATER-THAN NOR EQUIVALENT TO
-// "NotHumpDownHump", 0x0224E;0x00338}, // GEOMETRICALLY EQUIVALENT TO with slash
-// "NotHumpEqual", 0x0224F;0x00338}, // DIFFERENCE BETWEEN with slash
+ {"NotHumpDownHump", 0x0224E, 0x00338}, // GEOMETRICALLY EQUIVALENT TO with slash
+ {"NotHumpEqual", 0x0224F, 0x00338}, // DIFFERENCE BETWEEN with slash
{"notin", 0x02209}, // NOT AN ELEMENT OF
-// "notindot", 0x022F5;0x00338}, // ELEMENT OF WITH DOT ABOVE with slash
-// "notinE", 0x022F9;0x00338}, // ELEMENT OF WITH TWO HORIZONTAL STROKES with slash
+ {"notindot", 0x022F5, 0x00338}, // ELEMENT OF WITH DOT ABOVE with slash
+ {"notinE", 0x022F9, 0x00338}, // ELEMENT OF WITH TWO HORIZONTAL STROKES with slash
{"notinva", 0x02209}, // NOT AN ELEMENT OF
{"notinvb", 0x022F7}, // SMALL ELEMENT OF WITH OVERBAR
{"notinvc", 0x022F6}, // ELEMENT OF WITH OVERBAR
{"NotLeftTriangle", 0x022EA}, // NOT NORMAL SUBGROUP OF
-// "NotLeftTriangleBar", 0x029CF;0x00338}, // LEFT TRIANGLE BESIDE VERTICAL BAR with slash
+ {"NotLeftTriangleBar", 0x029CF, 0x00338}, // LEFT TRIANGLE BESIDE VERTICAL BAR with slash
{"NotLeftTriangleEqual", 0x022EC}, // NOT NORMAL SUBGROUP OF OR EQUAL TO
{"NotLess", 0x0226E}, // NOT LESS-THAN
{"NotLessEqual", 0x02270}, // NEITHER LESS-THAN NOR EQUAL TO
{"NotLessGreater", 0x02278}, // NEITHER LESS-THAN NOR GREATER-THAN
-// "NotLessLess", 0x0226A;0x00338}, // MUCH LESS THAN with slash
-// "NotLessSlantEqual", 0x02A7D;0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash
+ {"NotLessLess", 0x0226A, 0x00338}, // MUCH LESS THAN with slash
+ {"NotLessSlantEqual", 0x02A7D, 0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash
{"NotLessTilde", 0x02274}, // NEITHER LESS-THAN NOR EQUIVALENT TO
-// "NotNestedGreaterGreater", 0x02AA2;0x00338}, // DOUBLE NESTED GREATER-THAN with slash
-// "NotNestedLessLess", 0x02AA1;0x00338}, // DOUBLE NESTED LESS-THAN with slash
+ {"NotNestedGreaterGreater", 0x02AA2, 0x00338}, // DOUBLE NESTED GREATER-THAN with slash
+ {"NotNestedLessLess", 0x02AA1, 0x00338}, // DOUBLE NESTED LESS-THAN with slash
{"notni", 0x0220C}, // DOES NOT CONTAIN AS MEMBER
{"notniva", 0x0220C}, // DOES NOT CONTAIN AS MEMBER
{"notnivb", 0x022FE}, // SMALL CONTAINS WITH OVERBAR
{"notnivc", 0x022FD}, // CONTAINS WITH OVERBAR
{"NotPrecedes", 0x02280}, // DOES NOT PRECEDE
-// "NotPrecedesEqual", 0x02AAF;0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash
+ {"NotPrecedesEqual", 0x02AAF, 0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash
{"NotPrecedesSlantEqual", 0x022E0}, // DOES NOT PRECEDE OR EQUAL
{"NotReverseElement", 0x0220C}, // DOES NOT CONTAIN AS MEMBER
{"NotRightTriangle", 0x022EB}, // DOES NOT CONTAIN AS NORMAL SUBGROUP
-// "NotRightTriangleBar", 0x029D0;0x00338}, // VERTICAL BAR BESIDE RIGHT TRIANGLE with slash
+ {"NotRightTriangleBar", 0x029D0, 0x00338}, // VERTICAL BAR BESIDE RIGHT TRIANGLE with slash
{"NotRightTriangleEqual", 0x022ED}, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
-// "NotSquareSubset", 0x0228F;0x00338}, // SQUARE IMAGE OF with slash
+ {"NotSquareSubset", 0x0228F, 0x00338}, // SQUARE IMAGE OF with slash
{"NotSquareSubsetEqual", 0x022E2}, // NOT SQUARE IMAGE OF OR EQUAL TO
-// "NotSquareSuperset", 0x02290;0x00338}, // SQUARE ORIGINAL OF with slash
+ {"NotSquareSuperset", 0x02290, 0x00338}, // SQUARE ORIGINAL OF with slash
{"NotSquareSupersetEqual", 0x022E3}, // NOT SQUARE ORIGINAL OF OR EQUAL TO
-// "NotSubset", 0x02282;0x020D2}, // SUBSET OF with vertical line
+ {"NotSubset", 0x02282, 0x020D2}, // SUBSET OF with vertical line
{"NotSubsetEqual", 0x02288}, // NEITHER A SUBSET OF NOR EQUAL TO
{"NotSucceeds", 0x02281}, // DOES NOT SUCCEED
-// "NotSucceedsEqual", 0x02AB0;0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash
+ {"NotSucceedsEqual", 0x02AB0, 0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash
{"NotSucceedsSlantEqual", 0x022E1}, // DOES NOT SUCCEED OR EQUAL
-// "NotSucceedsTilde", 0x0227F;0x00338}, // SUCCEEDS OR EQUIVALENT TO with slash
-// "NotSuperset", 0x02283;0x020D2}, // SUPERSET OF with vertical line
+ {"NotSucceedsTilde", 0x0227F, 0x00338}, // SUCCEEDS OR EQUIVALENT TO with slash
+ {"NotSuperset", 0x02283, 0x020D2}, // SUPERSET OF with vertical line
{"NotSupersetEqual", 0x02289}, // NEITHER A SUPERSET OF NOR EQUAL TO
{"NotTilde", 0x02241}, // NOT TILDE
{"NotTildeEqual", 0x02244}, // NOT ASYMPTOTICALLY EQUAL TO
@@ -1420,25 +1378,25 @@ immutable NameId[] namesN =
{"NotVerticalBar", 0x02224}, // DOES NOT DIVIDE
{"npar", 0x02226}, // NOT PARALLEL TO
{"nparallel", 0x02226}, // NOT PARALLEL TO
-// "nparsl", 0x02AFD;0x020E5}, // DOUBLE SOLIDUS OPERATOR with reverse slash
-// "npart", 0x02202;0x00338}, // PARTIAL DIFFERENTIAL with slash
+ {"nparsl", 0x02AFD, 0x020E5}, // DOUBLE SOLIDUS OPERATOR with reverse slash
+ {"npart", 0x02202, 0x00338}, // PARTIAL DIFFERENTIAL with slash
{"npolint", 0x02A14}, // LINE INTEGRATION NOT INCLUDING THE POLE
{"npr", 0x02280}, // DOES NOT PRECEDE
{"nprcue", 0x022E0}, // DOES NOT PRECEDE OR EQUAL
-// "npre", 0x02AAF;0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash
+ {"npre", 0x02AAF, 0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash
{"nprec", 0x02280}, // DOES NOT PRECEDE
-// "npreceq", 0x02AAF;0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash
+ {"npreceq", 0x02AAF, 0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash
{"nrarr", 0x0219B}, // RIGHTWARDS ARROW WITH STROKE
{"nrArr", 0x021CF}, // RIGHTWARDS DOUBLE ARROW WITH STROKE
-// "nrarrc", 0x02933;0x00338}, // WAVE ARROW POINTING DIRECTLY RIGHT with slash
-// "nrarrw", 0x0219D;0x00338}, // RIGHTWARDS WAVE ARROW with slash
+ {"nrarrc", 0x02933, 0x00338}, // WAVE ARROW POINTING DIRECTLY RIGHT with slash
+ {"nrarrw", 0x0219D, 0x00338}, // RIGHTWARDS WAVE ARROW with slash
{"nrightarrow", 0x0219B}, // RIGHTWARDS ARROW WITH STROKE
{"nRightarrow", 0x021CF}, // RIGHTWARDS DOUBLE ARROW WITH STROKE
{"nrtri", 0x022EB}, // DOES NOT CONTAIN AS NORMAL SUBGROUP
{"nrtrie", 0x022ED}, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
{"nsc", 0x02281}, // DOES NOT SUCCEED
{"nsccue", 0x022E1}, // DOES NOT SUCCEED OR EQUAL
-// "nsce", 0x02AB0;0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash
+ {"nsce", 0x02AB0, 0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash
{"Nscr", 0x1D4A9}, // MATHEMATICAL SCRIPT CAPITAL N
{"nscr", 0x1D4C3}, // MATHEMATICAL SCRIPT SMALL N
{"nshortmid", 0x02224}, // DOES NOT DIVIDE
@@ -1452,18 +1410,18 @@ immutable NameId[] namesN =
{"nsqsupe", 0x022E3}, // NOT SQUARE ORIGINAL OF OR EQUAL TO
{"nsub", 0x02284}, // NOT A SUBSET OF
{"nsube", 0x02288}, // NEITHER A SUBSET OF NOR EQUAL TO
-// "nsubE", 0x02AC5;0x00338}, // SUBSET OF ABOVE EQUALS SIGN with slash
-// "nsubset", 0x02282;0x020D2}, // SUBSET OF with vertical line
+ {"nsubE", 0x02AC5, 0x00338}, // SUBSET OF ABOVE EQUALS SIGN with slash
+ {"nsubset", 0x02282, 0x020D2}, // SUBSET OF with vertical line
{"nsubseteq", 0x02288}, // NEITHER A SUBSET OF NOR EQUAL TO
-// "nsubseteqq", 0x02AC5;0x00338}, // SUBSET OF ABOVE EQUALS SIGN with slash
+ {"nsubseteqq", 0x02AC5, 0x00338}, // SUBSET OF ABOVE EQUALS SIGN with slash
{"nsucc", 0x02281}, // DOES NOT SUCCEED
-// "nsucceq", 0x02AB0;0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash
+ {"nsucceq", 0x02AB0, 0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash
{"nsup", 0x02285}, // NOT A SUPERSET OF
{"nsupe", 0x02289}, // NEITHER A SUPERSET OF NOR EQUAL TO
-// "nsupE", 0x02AC6;0x00338}, // SUPERSET OF ABOVE EQUALS SIGN with slash
-// "nsupset", 0x02283;0x020D2}, // SUPERSET OF with vertical line
+ {"nsupE", 0x02AC6, 0x00338}, // SUPERSET OF ABOVE EQUALS SIGN with slash
+ {"nsupset", 0x02283, 0x020D2}, // SUPERSET OF with vertical line
{"nsupseteq", 0x02289}, // NEITHER A SUPERSET OF NOR EQUAL TO
-// "nsupseteqq", 0x02AC6;0x00338}, // SUPERSET OF ABOVE EQUALS SIGN with slash
+ {"nsupseteqq", 0x02AC6, 0x00338}, // SUPERSET OF ABOVE EQUALS SIGN with slash
{"ntgl", 0x02279}, // NEITHER GREATER-THAN NOR LESS-THAN
{"Ntilde", 0x000D1}, // LATIN CAPITAL LETTER N WITH TILDE
{"ntilde", 0x000F1}, // LATIN SMALL LETTER N WITH TILDE
@@ -1477,22 +1435,22 @@ immutable NameId[] namesN =
{"num", 0x00023}, // NUMBER SIGN
{"numero", 0x02116}, // NUMERO SIGN
{"numsp", 0x02007}, // FIGURE SPACE
-// "nvap", 0x0224D;0x020D2}, // EQUIVALENT TO with vertical line
+ {"nvap", 0x0224D, 0x020D2}, // EQUIVALENT TO with vertical line
{"nvdash", 0x022AC}, // DOES NOT PROVE
{"nvDash", 0x022AD}, // NOT TRUE
{"nVdash", 0x022AE}, // DOES NOT FORCE
{"nVDash", 0x022AF}, // NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
-// "nvge", 0x02265;0x020D2}, // GREATER-THAN OR EQUAL TO with vertical line
-// "nvgt", 0x0003E;0x020D2}, // GREATER-THAN SIGN with vertical line
+ {"nvge", 0x02265, 0x020D2}, // GREATER-THAN OR EQUAL TO with vertical line
+ {"nvgt", 0x0003E, 0x020D2}, // GREATER-THAN SIGN with vertical line
{"nvHarr", 0x02904}, // LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE
{"nvinfin", 0x029DE}, // INFINITY NEGATED WITH VERTICAL BAR
{"nvlArr", 0x02902}, // LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE
-// "nvle", 0x02264;0x020D2}, // LESS-THAN OR EQUAL TO with vertical line
-// "nvlt", 0x0003C;0x020D2}, // LESS-THAN SIGN with vertical line
-// "nvltrie", 0x022B4;0x020D2}, // NORMAL SUBGROUP OF OR EQUAL TO with vertical line
+ {"nvle", 0x02264, 0x020D2}, // LESS-THAN OR EQUAL TO with vertical line
+ {"nvlt", 0x0003C, 0x020D2}, // LESS-THAN SIGN with vertical line
+ {"nvltrie", 0x022B4, 0x020D2}, // NORMAL SUBGROUP OF OR EQUAL TO with vertical line
{"nvrArr", 0x02903}, // RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE
-// "nvrtrie", 0x022B5;0x020D2}, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO with vertical line
-// "nvsim", 0x0223C;0x020D2}, // TILDE OPERATOR with vertical line
+ {"nvrtrie", 0x022B5, 0x020D2}, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO with vertical line
+ {"nvsim", 0x0223C, 0x020D2}, // TILDE OPERATOR with vertical line
{"nwarhk", 0x02923}, // NORTH WEST ARROW WITH HOOK
{"nwarr", 0x02196}, // NORTH WEST ARROW
{"nwArr", 0x021D6}, // NORTH WEST DOUBLE ARROW
@@ -1704,7 +1662,7 @@ immutable NameId[] namesQ =
immutable NameId[] namesR =
[
{"rAarr", 0x021DB}, // RIGHTWARDS TRIPLE ARROW
-// "race", 0x0223D;0x00331}, // REVERSED TILDE with underline
+ {"race", 0x0223D, 0x00331}, // REVERSED TILDE with underline
{"Racute", 0x00154}, // LATIN CAPITAL LETTER R WITH ACUTE
{"racute", 0x00155}, // LATIN SMALL LETTER R WITH ACUTE
{"radic", 0x0221A}, // SQUARE ROOT
@@ -1932,7 +1890,7 @@ immutable NameId[] namesS =
{"smile", 0x02323}, // SMILE
{"smt", 0x02AAA}, // SMALLER THAN
{"smte", 0x02AAC}, // SMALLER THAN OR EQUAL TO
-// "smtes", 0x02AAC;0x0FE00}, // SMALLER THAN OR slanted EQUAL
+ {"smtes", 0x02AAC, 0x0FE00}, // SMALLER THAN OR slanted EQUAL
{"SOFTcy", 0x0042C}, // CYRILLIC CAPITAL LETTER SOFT SIGN
{"softcy", 0x0044C}, // CYRILLIC SMALL LETTER SOFT SIGN
{"sol", 0x0002F}, // SOLIDUS
@@ -1944,9 +1902,9 @@ immutable NameId[] namesS =
{"spadesuit", 0x02660}, // BLACK SPADE SUIT
{"spar", 0x02225}, // PARALLEL TO
{"sqcap", 0x02293}, // SQUARE CAP
-// "sqcaps", 0x02293;0x0FE00}, // SQUARE CAP with serifs
+ {"sqcaps", 0x02293, 0x0FE00}, // SQUARE CAP with serifs
{"sqcup", 0x02294}, // SQUARE CUP
-// "sqcups", 0x02294;0x0FE00}, // SQUARE CUP with serifs
+ {"sqcups", 0x02294, 0x0FE00}, // SQUARE CUP with serifs
{"Sqrt", 0x0221A}, // SQUARE ROOT
{"sqsub", 0x0228F}, // SQUARE IMAGE OF
{"sqsube", 0x02291}, // SQUARE IMAGE OF OR EQUAL TO
@@ -2082,7 +2040,7 @@ immutable NameId[] namesT =
{"thgr", 0x003B8}, // GREEK SMALL LETTER THETA
{"thickapprox", 0x02248}, // ALMOST EQUAL TO
{"thicksim", 0x0223C}, // TILDE OPERATOR
-// "ThickSpace", 0x0205F;0x0200A}, // space of width 5/18 em
+ {"ThickSpace", 0x0205F, 0x0200A}, // space of width 5/18 em
{"thinsp", 0x02009}, // THIN SPACE
{"ThinSpace", 0x02009}, // THIN SPACE
{"thkap", 0x02248}, // ALMOST EQUAL TO
@@ -2245,10 +2203,10 @@ immutable NameId[] namesV =
{"vArr", 0x021D5}, // UP DOWN DOUBLE ARROW
{"varrho", 0x003F1}, // GREEK RHO SYMBOL
{"varsigma", 0x003C2}, // GREEK SMALL LETTER FINAL SIGMA
-// "varsubsetneq", 0x0228A;0x0FE00}, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
-// "varsubsetneqq", 0x02ACB;0x0FE00}, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
-// "varsupsetneq", 0x0228B;0x0FE00}, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
-// "varsupsetneqq", 0x02ACC;0x0FE00}, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
+ {"varsubsetneq", 0x0228A, 0x0FE00}, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
+ {"varsubsetneqq", 0x02ACB, 0x0FE00}, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
+ {"varsupsetneq", 0x0228B, 0x0FE00}, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
+ {"varsupsetneqq", 0x02ACC, 0x0FE00}, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
{"vartheta", 0x003D1}, // GREEK THETA SYMBOL
{"vartriangleleft", 0x022B2}, // NORMAL SUBGROUP OF
{"vartriangleright", 0x022B3}, // CONTAINS AS NORMAL SUBGROUP
@@ -2279,18 +2237,18 @@ immutable NameId[] namesV =
{"Vfr", 0x1D519}, // MATHEMATICAL FRAKTUR CAPITAL V
{"vfr", 0x1D533}, // MATHEMATICAL FRAKTUR SMALL V
{"vltri", 0x022B2}, // NORMAL SUBGROUP OF
-// "vnsub", 0x02282;0x020D2}, // SUBSET OF with vertical line
-// "vnsup", 0x02283;0x020D2}, // SUPERSET OF with vertical line
+ {"vnsub", 0x02282, 0x020D2}, // SUBSET OF with vertical line
+ {"vnsup", 0x02283, 0x020D2}, // SUPERSET OF with vertical line
{"Vopf", 0x1D54D}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL V
{"vopf", 0x1D567}, // MATHEMATICAL DOUBLE-STRUCK SMALL V
{"vprop", 0x0221D}, // PROPORTIONAL TO
{"vrtri", 0x022B3}, // CONTAINS AS NORMAL SUBGROUP
{"Vscr", 0x1D4B1}, // MATHEMATICAL SCRIPT CAPITAL V
{"vscr", 0x1D4CB}, // MATHEMATICAL SCRIPT SMALL V
-// "vsubne", 0x0228A;0x0FE00}, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
-// "vsubnE", 0x02ACB;0x0FE00}, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
-// "vsupne", 0x0228B;0x0FE00}, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
-// "vsupnE", 0x02ACC;0x0FE00}, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
+ {"vsubne", 0x0228A, 0x0FE00}, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
+ {"vsubnE", 0x02ACB, 0x0FE00}, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
+ {"vsupne", 0x0228B, 0x0FE00}, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members
+ {"vsupnE", 0x02ACC, 0x0FE00}, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members
{"Vvdash", 0x022AA}, // TRIPLE VERTICAL BAR RIGHT TURNSTILE
{"vzigzag", 0x0299A}, // VERTICAL ZIGZAG LINE
];
diff --git a/gcc/d/dmd/escape.d b/gcc/d/dmd/escape.d
index 7ba0a96..e7626b0 100644
--- a/gcc/d/dmd/escape.d
+++ b/gcc/d/dmd/escape.d
@@ -409,23 +409,9 @@ bool checkParamArgumentEscape(Scope* sc, FuncDeclaration fdc, Parameter par, Var
{
unsafeAssign!"scope variable"(v);
}
- else if (v.isTypesafeVariadicParameter && p == sc.func)
+ else if (v.isTypesafeVariadicArray && p == sc.func)
{
- Type tb = v.type.toBasetype();
- if (tb.ty == Tarray || tb.ty == Tsarray)
- {
- unsafeAssign!"variadic variable"(v);
- }
- }
- else
- {
- /* v is not 'scope', and is assigned to a parameter that may escape.
- * Therefore, v can never be 'scope'.
- */
- if (log) printf("no infer for %s in %s loc %s, fdc %s, %d\n",
- v.toChars(), sc.func.ident.toChars(), sc.func.loc.toChars(), fdc.ident.toChars(), __LINE__);
-
- doNotInferScope(v, vPar);
+ unsafeAssign!"variadic variable"(v);
}
}
@@ -673,9 +659,8 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
FuncDeclaration fd = sc.func;
- // Determine if va is a parameter that is an indirect reference
- const bool vaIsRef = va && va.storage_class & STC.parameter &&
- (va.isReference() || va.type.toBasetype().isTypeClass()); // ref, out, or class
+ // Determine if va is a `ref` parameter, so it has a lifetime exceding the function scope
+ const bool vaIsRef = va && va.isParameter() && va.isReference();
if (log && vaIsRef) printf("va is ref `%s`\n", va.toChars());
/* Determine if va is the first parameter, through which other 'return' parameters
@@ -717,7 +702,7 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
Dsymbol p = v.toParent2();
if (va && !vaIsRef && !va.isScope() && !v.isScope() &&
- !v.isTypesafeVariadicParameter && !va.isTypesafeVariadicParameter &&
+ !v.isTypesafeVariadicArray && !va.isTypesafeVariadicArray &&
(va.isParameter() && va.maybeScope && v.isParameter() && v.maybeScope) &&
p == fd)
{
@@ -727,16 +712,9 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
continue;
}
- if (vaIsFirstRef &&
- (v.isScope() || v.maybeScope) &&
- !(v.storage_class & STC.return_) &&
- v.isParameter() &&
- fd.flags & FUNCFLAG.returnInprocess &&
- p == fd &&
- !v.isTypesafeVariadicParameter)
+ if (vaIsFirstRef && p == fd)
{
- if (log) printf("inferring 'return' for parameter %s in function %s\n", v.toChars(), fd.toChars());
- inferReturn(fd, v, /*returnScope:*/ true); // infer addition of 'return' to make `return scope`
+ inferReturn(fd, v, /*returnScope:*/ true);
}
if (!(va && va.isScope()) || vaIsRef)
@@ -744,82 +722,66 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
if (v.isScope())
{
- if (vaIsFirstRef && v.isParameter() && v.storage_class & STC.return_)
+ if (vaIsFirstRef && v.isParameter() && v.isReturn())
{
// va=v, where v is `return scope`
- if (va.isScope())
+ if (inferScope(va))
continue;
-
- if (va.maybeScope)
- {
- if (log) printf("inferring scope for lvalue %s\n", va.toChars());
- va.storage_class |= STC.scope_ | STC.scopeinferred;
- continue;
- }
}
- if (va && va.isScope() && va.storage_class & STC.return_ && !(v.storage_class & STC.return_))
+ // If va's lifetime encloses v's, then error
+ if (EnclosedBy eb = va.enclosesLifetimeOf(v))
{
- // va may return its value, but v does not allow that, so this is an error
- if (sc.setUnsafeDIP1000(gag, ae.loc, "scope variable `%s` assigned to return scope `%s`", v, va))
+ const(char)* msg;
+ final switch (eb)
{
- result = true;
- continue;
+ case EnclosedBy.none: assert(0);
+ case EnclosedBy.returnScope:
+ msg = "scope variable `%s` assigned to return scope `%s`";
+ break;
+ case EnclosedBy.longerScope:
+ if (v.storage_class & STC.temp)
+ continue;
+ msg = "scope variable `%s` assigned to `%s` with longer lifetime";
+ break;
+ case EnclosedBy.refVar:
+ msg = "scope variable `%s` assigned to `ref` variable `%s` with longer lifetime";
+ break;
+ case EnclosedBy.global:
+ msg = "scope variable `%s` assigned to global variable `%s`";
+ break;
}
- }
- // If va's lifetime encloses v's, then error
- if (va && !va.isDataseg() &&
- ((va.enclosesLifetimeOf(v) && !(v.storage_class & STC.temp)) || vaIsRef))
- {
- if (sc.setUnsafeDIP1000(gag, ae.loc, "scope variable `%s` assigned to `%s` with longer lifetime", v, va))
+ if (sc.setUnsafeDIP1000(gag, ae.loc, msg, v, va))
{
result = true;
continue;
}
}
- if (va && !va.isDataseg() && (va.isScope() || va.maybeScope))
+ // v = scope, va should be scope as well
+ const vaWasScope = va && va.isScope();
+ if (inferScope(va))
{
- if (!va.isScope())
- { /* v is scope, and va is not scope, so va needs to
- * infer scope
- */
- if (log) printf("inferring scope for %s\n", va.toChars());
- va.storage_class |= STC.scope_ | STC.scopeinferred;
- /* v returns, and va does not return, so va needs
- * to infer return
- */
- if (v.storage_class & STC.return_ &&
- !(va.storage_class & STC.return_))
- {
- if (log) printf("infer return for %s\n", va.toChars());
- va.storage_class |= STC.return_ | STC.returninferred;
+ // In case of `scope local = returnScopeParam`, do not infer return scope for `x`
+ if (!vaWasScope && v.isReturn() && !va.isReturn())
+ {
+ if (log) printf("infer return for %s\n", va.toChars());
+ va.storage_class |= STC.return_ | STC.returninferred;
- // Added "return scope" so don't confuse it with "return ref"
- if (isRefReturnScope(va.storage_class))
- va.storage_class |= STC.returnScope;
- }
+ // Added "return scope" so don't confuse it with "return ref"
+ if (isRefReturnScope(va.storage_class))
+ va.storage_class |= STC.returnScope;
}
continue;
}
result |= sc.setUnsafeDIP1000(gag, ae.loc, "scope variable `%s` assigned to non-scope `%s`", v, e1);
}
- else if (v.isTypesafeVariadicParameter && p == fd)
+ else if (v.isTypesafeVariadicArray && p == fd)
{
- Type tb = v.type.toBasetype();
- if (tb.ty == Tarray || tb.ty == Tsarray)
- {
- if (va && !va.isDataseg() && (va.isScope() || va.maybeScope))
- {
- if (!va.isScope())
- { //printf("inferring scope for %s\n", va.toChars());
- va.storage_class |= STC.scope_ | STC.scopeinferred;
- }
- continue;
- }
- result |= sc.setUnsafeDIP1000(gag, ae.loc, "variadic variable `%s` assigned to non-scope `%s`", v, e1);
- }
+ if (inferScope(va))
+ continue;
+ result |= sc.setUnsafeDIP1000(gag, ae.loc, "variadic variable `%s` assigned to non-scope `%s`", v, e1);
}
else
{
@@ -845,7 +807,7 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
if (va && va.isScope() && !v.isReference())
{
- if (!(va.storage_class & STC.return_))
+ if (!va.isReturn())
{
va.doNotInferReturn = true;
}
@@ -858,19 +820,14 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
Dsymbol p = v.toParent2();
- if (vaIsFirstRef && v.isParameter() &&
- !(v.storage_class & STC.return_) &&
- fd.flags & FUNCFLAG.returnInprocess &&
- p == fd)
+ if (vaIsFirstRef && p == fd)
{
//if (log) printf("inferring 'return' for parameter %s in function %s\n", v.toChars(), fd.toChars());
inferReturn(fd, v, /*returnScope:*/ false);
}
// If va's lifetime encloses v's, then error
- if (va &&
- !(vaIsFirstRef && (v.storage_class & STC.return_)) &&
- (va.enclosesLifetimeOf(v) || (va.isReference() && !(va.storage_class & STC.temp)) || va.isDataseg()))
+ if (va && !(vaIsFirstRef && v.isReturn()) && va.enclosesLifetimeOf(v))
{
if (sc.setUnsafeDIP1000(gag, ae.loc, "address of variable `%s` assigned to `%s` with longer lifetime", v, va))
{
@@ -885,13 +842,9 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
if (p != sc.func)
continue;
- if (va && !va.isDataseg() && (va.isScope() || va.maybeScope))
+ if (inferScope(va))
{
- if (!va.isScope())
- { //printf("inferring scope for %s\n", va.toChars());
- va.storage_class |= STC.scope_ | STC.scopeinferred;
- }
- if (v.storage_class & STC.return_ && !(va.storage_class & STC.return_))
+ if (v.isReturn() && !va.isReturn())
va.storage_class |= STC.return_ | STC.returninferred;
continue;
}
@@ -912,7 +865,7 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
* then uncount that address of. This is so it won't cause a
* closure to be allocated.
*/
- if (va && va.isScope() && !(va.storage_class & STC.return_) && func.tookAddressOf)
+ if (va && va.isScope() && !va.isReturn() && func.tookAddressOf)
--func.tookAddressOf;
foreach (v; vars)
@@ -978,14 +931,8 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag, bool byRef)
}
}
- if (va && !va.isDataseg() && (va.isScope() || va.maybeScope))
- {
- if (!va.isScope())
- { //printf("inferring scope for %s\n", va.toChars());
- va.storage_class |= STC.scope_ | STC.scopeinferred;
- }
+ if (inferScope(va))
continue;
- }
result |= sc.setUnsafeDIP1000(gag, ee.loc,
"reference to stack allocated value returned by `%s` assigned to non-scope `%s`", ee, e1);
@@ -1091,14 +1038,10 @@ bool checkNewEscape(Scope* sc, Expression e, bool gag)
continue;
}
}
- else if (v.isTypesafeVariadicParameter && p == sc.func)
+ else if (v.isTypesafeVariadicArray && p == sc.func)
{
- Type tb = v.type.toBasetype();
- if (tb.ty == Tarray || tb.ty == Tsarray)
- {
- result |= sc.setUnsafeDIP1000(gag, e.loc,
- "copying `%s` into allocated memory escapes a reference to variadic parameter `%s`", e, v);
- }
+ result |= sc.setUnsafeDIP1000(gag, e.loc,
+ "copying `%s` into allocated memory escapes a reference to variadic parameter `%s`", e, v);
}
else
{
@@ -1258,15 +1201,8 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
Dsymbol p = v.toParent2();
- if ((v.isScope() || v.maybeScope) &&
- !(v.storage_class & STC.return_) &&
- v.isParameter() &&
- !v.doNotInferReturn &&
- sc.func.flags & FUNCFLAG.returnInprocess &&
- p == sc.func &&
- !v.isTypesafeVariadicParameter)
+ if (p == sc.func && inferReturn(sc.func, v, /*returnScope:*/ true))
{
- inferReturn(sc.func, v, /*returnScope:*/ true); // infer addition of 'return'
continue;
}
@@ -1300,7 +1236,7 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
!(!refs && sc.func.isFuncDeclaration().getLevel(pfunc, sc.intypeof) > 0)
)
{
- if (v.isParameter() && !(v.storage_class & STC.return_))
+ if (v.isParameter() && !v.isReturn())
{
// https://issues.dlang.org/show_bug.cgi?id=23191
if (!gag)
@@ -1320,15 +1256,11 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
}
}
}
- else if (v.isTypesafeVariadicParameter && p == sc.func)
+ else if (v.isTypesafeVariadicArray && p == sc.func)
{
- Type tb = v.type.toBasetype();
- if (tb.ty == Tarray || tb.ty == Tsarray)
- {
- if (!gag)
- error(e.loc, "returning `%s` escapes a reference to variadic parameter `%s`", e.toChars(), v.toChars());
- result = false;
- }
+ if (!gag)
+ error(e.loc, "returning `%s` escapes a reference to variadic parameter `%s`", e.toChars(), v.toChars());
+ result = false;
}
else
{
@@ -1414,7 +1346,7 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
continue;
}
FuncDeclaration fd = p.isFuncDeclaration();
- if (fd && sc.func.flags & FUNCFLAG.returnInprocess)
+ if (fd && sc.func.returnInprocess)
{
/* Code like:
* int x;
@@ -1435,10 +1367,10 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
vsr == ScopeRef.Ref_ReturnScope) &&
!(v.storage_class & STC.foreach_))
{
- if (sc.func.flags & FUNCFLAG.returnInprocess && p == sc.func &&
- (vsr == ScopeRef.Ref || vsr == ScopeRef.RefScope))
+ if (p == sc.func && (vsr == ScopeRef.Ref || vsr == ScopeRef.RefScope) &&
+ inferReturn(sc.func, v, /*returnScope:*/ false))
{
- inferReturn(sc.func, v, /*returnScope:*/ false); // infer addition of 'return'
+ continue;
}
else
{
@@ -1488,6 +1420,26 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
return result;
}
+/***********************************
+ * Infer `scope` for a variable
+ *
+ * Params:
+ * va = variable to infer scope for
+ * Returns: `true` if succesful or already `scope`
+ */
+bool inferScope(VarDeclaration va)
+{
+ if (!va)
+ return false;
+ if (!va.isDataseg() && va.maybeScope && !va.isScope())
+ {
+ //printf("inferring scope for %s\n", va.toChars());
+ va.maybeScope = false;
+ va.storage_class |= STC.scope_ | STC.scopeinferred;
+ return true;
+ }
+ return va.isScope();
+}
/*************************************
* Variable v needs to have 'return' inferred for it.
@@ -1495,10 +1447,22 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
* fd = function that v is a parameter to
* v = parameter that needs to be STC.return_
* returnScope = infer `return scope` instead of `return ref`
+ *
+ * Returns: whether the inference on `v` was successful or `v` already was `return`
*/
-private void inferReturn(FuncDeclaration fd, VarDeclaration v, bool returnScope)
+private bool inferReturn(FuncDeclaration fd, VarDeclaration v, bool returnScope)
{
- // v is a local in the current function
+ if (v.isReturn())
+ return !!(v.storage_class & STC.returnScope) == returnScope;
+
+ if (!v.isParameter() || v.isTypesafeVariadicArray || (returnScope && v.doNotInferReturn))
+ return false;
+
+ if (!fd.returnInprocess)
+ return false;
+
+ if (returnScope && !(v.isScope() || v.maybeScope))
+ return false;
//printf("for function '%s' inferring 'return' for variable '%s', returnScope: %d\n", fd.toChars(), v.toChars(), returnScope);
auto newStcs = STC.return_ | STC.returninferred | (returnScope ? STC.returnScope : 0);
@@ -1532,6 +1496,7 @@ private void inferReturn(FuncDeclaration fd, VarDeclaration v, bool returnScope)
}
}
}
+ return true;
}
@@ -1694,7 +1659,7 @@ void escapeByValue(Expression e, EscapeByResults* er, bool live = false, bool re
{
if (tb.ty == Tsarray)
return;
- if (v.isTypesafeVariadicParameter)
+ if (v.isTypesafeVariadicArray)
{
er.byvalue.push(v);
return;
@@ -2008,13 +1973,10 @@ void escapeByRef(Expression e, EscapeByResults* er, bool live = false, bool retR
if (auto ve = e.e1.isVarExp())
{
VarDeclaration v = ve.var.isVarDeclaration();
- if (tb.ty == Tarray || tb.ty == Tsarray)
+ if (v && v.isTypesafeVariadicArray)
{
- if (v && v.isTypesafeVariadicParameter)
- {
- er.pushRef(v, retRefTransition);
- return;
- }
+ er.pushRef(v, retRefTransition);
+ return;
}
}
if (tb.ty == Tsarray)
@@ -2339,9 +2301,9 @@ private void doNotInferScope(VarDeclaration v, RootObject o)
void finishScopeParamInference(FuncDeclaration funcdecl, ref TypeFunction f)
{
- if (funcdecl.flags & FUNCFLAG.returnInprocess)
+ if (funcdecl.returnInprocess)
{
- funcdecl.flags &= ~FUNCFLAG.returnInprocess;
+ funcdecl.returnInprocess = false;
if (funcdecl.storage_class & STC.return_)
{
if (funcdecl.type == f)
@@ -2353,9 +2315,9 @@ void finishScopeParamInference(FuncDeclaration funcdecl, ref TypeFunction f)
}
}
- if (!(funcdecl.flags & FUNCFLAG.inferScope))
+ if (!funcdecl.inferScope)
return;
- funcdecl.flags &= ~FUNCFLAG.inferScope;
+ funcdecl.inferScope = false;
// Eliminate maybescope's
{
@@ -2387,22 +2349,19 @@ void finishScopeParamInference(FuncDeclaration funcdecl, ref TypeFunction f)
foreach (u, p; f.parameterList)
{
auto v = (*funcdecl.parameters)[u];
- if (v.maybeScope)
+ if (!v.isScope() && inferScope(v))
{
//printf("Inferring scope for %s\n", v.toChars());
- notMaybeScope(v, null);
- v.storage_class |= STC.scope_ | STC.scopeinferred;
p.storageClass |= STC.scope_ | STC.scopeinferred;
}
}
}
- if (funcdecl.vthis && funcdecl.vthis.maybeScope)
+ if (funcdecl.vthis)
{
- notMaybeScope(funcdecl.vthis, null);
- funcdecl.vthis.storage_class |= STC.scope_ | STC.scopeinferred;
- f.isScopeQual = true;
- f.isscopeinferred = true;
+ inferScope(funcdecl.vthis);
+ f.isScopeQual = funcdecl.vthis.isScope();
+ f.isscopeinferred = !!(funcdecl.vthis.storage_class & STC.scopeinferred);
}
}
@@ -2542,20 +2501,45 @@ bool isReferenceToMutable(Parameter p, Type t)
return isReferenceToMutable(p.type);
}
+/// When checking lifetime for assignment `va=v`, the way `va` encloses `v`
+private enum EnclosedBy
+{
+ none = 0,
+ refVar, // `va` is a `ref` variable, which may link to a global variable
+ global, // `va` is a global variable
+ returnScope, // `va` is a scope variable that may be returned
+ longerScope, // `va` is another scope variable declared earlier than `v`
+}
+
/**********************************
-* Determine if `va` has a lifetime that lasts past
-* the destruction of `v`
-* Params:
-* va = variable assigned to
-* v = variable being assigned
-* Returns:
-* true if it does
-*/
-private bool enclosesLifetimeOf(const VarDeclaration va, const VarDeclaration v) pure
+ * Determine if `va` has a lifetime that lasts past
+ * the destruction of `v`
+ * Params:
+ * va = variable assigned to
+ * v = variable being assigned
+ * Returns:
+ * The way `va` encloses `v` (if any)
+ */
+private EnclosedBy enclosesLifetimeOf(VarDeclaration va, VarDeclaration v)
{
+ if (!va)
+ return EnclosedBy.none;
+
+ if (va.isDataseg())
+ return EnclosedBy.global;
+
+ if (va.isScope() && va.isReturn() && !v.isReturn())
+ return EnclosedBy.returnScope;
+
+ if (va.isReference() && va.isParameter())
+ return EnclosedBy.refVar;
+
assert(va.sequenceNumber != va.sequenceNumber.init);
assert(v.sequenceNumber != v.sequenceNumber.init);
- return va.sequenceNumber < v.sequenceNumber;
+ if (va.sequenceNumber < v.sequenceNumber)
+ return EnclosedBy.longerScope;
+
+ return EnclosedBy.none;
}
/***************************************
@@ -2576,53 +2560,6 @@ private void addMaybe(VarDeclaration va, VarDeclaration v)
va.maybes.push(v);
}
-/***************************************
- * Like `FuncDeclaration.setUnsafe`, but modified for dip25 / dip1000 by default transitions
- *
- * With `-preview=dip1000` it actually sets the function as unsafe / prints an error, while
- * without it, it only prints a deprecation in a `@safe` function.
- * With `-revert=preview=dip1000`, it doesn't do anything.
- *
- * Params:
- * sc = used for checking whether we are in a deprecated scope
- * fs = command line setting of dip1000 / dip25
- * gag = surpress error message
- * loc = location of error
- * fmt = printf-style format string
- * arg0 = (optional) argument for first %s format specifier
- * arg1 = (optional) argument for second %s format specifier
- * arg2 = (optional) argument for third %s format specifier
- * Returns: whether an actual safe error (not deprecation) occured
- */
-private bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char)* msg,
- RootObject arg0 = null, RootObject arg1 = null, RootObject arg2 = null)
-{
- if (fs == FeatureState.disabled)
- {
- return false;
- }
- else if (fs == FeatureState.enabled)
- {
- return sc.setUnsafe(gag, loc, msg, arg0, arg1, arg2);
- }
- else
- {
- if (sc.func.isSafeBypassingInference())
- {
- if (!gag)
- previewErrorFunc(sc.isDeprecated(), fs)(
- loc, msg, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""
- );
- }
- else if (!sc.func.safetyViolation)
- {
- import dmd.func : AttributeViolation;
- sc.func.safetyViolation = new AttributeViolation(loc, msg, arg0, arg1, arg2);
- }
- return false;
- }
-}
-
// `setUnsafePreview` partially evaluated for dip1000
private bool setUnsafeDIP1000(Scope* sc, bool gag, Loc loc, const(char)* msg,
RootObject arg0 = null, RootObject arg1 = null, RootObject arg2 = null)
@@ -2671,13 +2608,19 @@ private bool checkScopeVarAddr(VarDeclaration v, Expression e, Scope* sc, bool g
}
/****************************
- * Determine if `v` is a typesafe variadic parameter.
+ * Determine if `v` is a typesafe variadic array, which is implicitly `scope`
* Params:
* v = variable to check
* Returns:
* true if `v` is a variadic parameter
*/
-bool isTypesafeVariadicParameter(VarDeclaration v)
+private bool isTypesafeVariadicArray(VarDeclaration v)
{
- return !!(v.storage_class & STC.variadic);
+ if (v.storage_class & STC.variadic)
+ {
+ Type tb = v.type.toBasetype();
+ if (tb.ty == Tarray || tb.ty == Tsarray)
+ return true;
+ }
+ return false;
}
diff --git a/gcc/d/dmd/expression.d b/gcc/d/dmd/expression.d
index 42b4dd4..21f5cc7 100644
--- a/gcc/d/dmd/expression.d
+++ b/gcc/d/dmd/expression.d
@@ -2949,7 +2949,7 @@ extern (C++) final class ArrayLiteralExp : Expression
Expressions* elements;
OwnedBy ownedByCtfe = OwnedBy.code;
-
+ bool onstack = false;
extern (D) this(const ref Loc loc, Type type, Expressions* elements)
{
diff --git a/gcc/d/dmd/expression.h b/gcc/d/dmd/expression.h
index c9e3978..79bc528 100644
--- a/gcc/d/dmd/expression.h
+++ b/gcc/d/dmd/expression.h
@@ -419,6 +419,7 @@ public:
Expression *basis;
Expressions *elements;
OwnedBy ownedByCtfe;
+ bool onstack;
static ArrayLiteralExp *create(const Loc &loc, Expressions *elements);
static void emplace(UnionExp *pue, const Loc &loc, Expressions *elements);
diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d
index 8a4a13c..f899bd7 100644
--- a/gcc/d/dmd/expressionsem.d
+++ b/gcc/d/dmd/expressionsem.d
@@ -353,6 +353,37 @@ extern(D) bool arrayExpressionSemantic(
return err;
}
+/*
+Checks if `exp` contains a direct access to a `noreturn`
+variable. If that is the case, an `assert(0)` expression
+is generated and returned. This function should be called
+only after semantic analysis has been performed on `exp`.
+
+Params:
+ exp = expression that is checked
+
+Returns:
+ An `assert(0)` expression if `exp` contains a `noreturn`
+ variable access, `exp` otherwise.
+*/
+
+Expression checkNoreturnVarAccess(Expression exp)
+{
+ assert(exp.type);
+
+ Expression result = exp;
+ if (exp.type.isTypeNoreturn() && !exp.isAssertExp() &&
+ !exp.isThrowExp() && !exp.isCallExp())
+ {
+ auto msg = new StringExp(exp.loc, "Accessed expression of type `noreturn`");
+ msg.type = Type.tstring;
+ result = new AssertExp(exp.loc, IntegerExp.literal!0, msg);
+ result.type = exp.type;
+ }
+
+ return result;
+}
+
/******************************
* Check the tail CallExp is really property function call.
* Bugs:
@@ -848,6 +879,18 @@ Lagain:
if (d)
d.checkDisabled(loc, sc);
}
+
+ if (auto sd = s.isDeclaration())
+ {
+ if (sd.isSystem())
+ {
+ if (sc.setUnsafePreview(global.params.systemVariables, false, loc,
+ "cannot access `@system` variable `%s` in @safe code", sd))
+ {
+ return ErrorExp.get();
+ }
+ }
+ }
}
if (auto em = s.isEnumMember())
@@ -1714,7 +1757,7 @@ private bool functionParameters(const ref Loc loc, Scope* sc,
if (sc._module)
sc._module.hasAlwaysInlines = true;
if (sc.func)
- sc.func.flags |= FUNCFLAG.hasAlwaysInline;
+ sc.func.hasAlwaysInlines = true;
}
const isCtorCall = fd && fd.needThis() && fd.isCtorDeclaration();
@@ -2200,14 +2243,14 @@ private bool functionParameters(const ref Loc loc, Scope* sc,
/* If calling C scanf(), printf(), or any variants, check the format string against the arguments
*/
const isVa_list = tf.parameterList.varargs == VarArg.none;
- if (fd && fd.flags & FUNCFLAG.printf)
+ if (fd && fd.printf)
{
if (auto se = (*arguments)[nparams - 1 - isVa_list].isStringExp())
{
checkPrintfFormat(se.loc, se.peekString(), (*arguments)[nparams .. nargs], isVa_list);
}
}
- else if (fd && fd.flags & FUNCFLAG.scanf)
+ else if (fd && fd.scanf)
{
if (auto se = (*arguments)[nparams - 1 - isVa_list].isStringExp())
{
@@ -4628,8 +4671,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
else if (exp.arguments.dim == 1)
{
e = (*exp.arguments)[0];
- e = e.implicitCastTo(sc, t1);
- e = new CastExp(exp.loc, e, t1);
+ if (!e.type.isTypeNoreturn())
+ e = e.implicitCastTo(sc, t1);
}
else
{
@@ -7474,6 +7517,11 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return;
}
+ if (exp.e1.type.isTypeNoreturn() && (!exp.to || !exp.to.isTypeNoreturn()))
+ {
+ result = exp.e1;
+ return;
+ }
if (exp.to && !exp.to.isTypeSArray() && !exp.to.isTypeFunction())
exp.e1 = exp.e1.arrayFuncConv(sc);
@@ -7889,7 +7937,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return setError();
}
}
- else if (t1b.ty == Tvector)
+ else if (t1b.ty == Tvector && exp.e1.isLvalue())
{
// Convert e1 to corresponding static array
TypeVector tv1 = cast(TypeVector)t1b;
@@ -8896,7 +8944,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
exp.e1 = e1x;
assert(exp.e1.type);
}
- Type t1 = exp.e1.type.toBasetype();
+ Type t1 = exp.e1.type.isTypeEnum() ? exp.e1.type : exp.e1.type.toBasetype();
/* Run this.e2 semantic.
* Different from other binary expressions, the analysis of e2
@@ -8918,14 +8966,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
e2x.checkSharedAccess(sc))
return setError();
- if (e2x.type.isTypeNoreturn() && !e2x.isAssertExp() && !e2x.isThrowExp() && !e2x.isCallExp())
- {
- auto msg = new StringExp(e2x.loc, "Accessed expression of type `noreturn`");
- msg.type = Type.tstring;
- e2x = new AssertExp(e2x.loc, IntegerExp.literal!0, msg);
- e2x.type = Type.tnoreturn;
- return setResult(e2x);
- }
+ auto etmp = checkNoreturnVarAccess(e2x);
+ if (etmp != e2x)
+ return setResult(etmp);
+
exp.e2 = e2x;
}
@@ -9890,14 +9934,17 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
exp.type = exp.e1.type;
assert(exp.type);
+ auto assignElem = exp.e2;
auto res = exp.op == EXP.assign ? exp.reorderSettingAAElem(sc) : exp;
- Expression tmp;
/* https://issues.dlang.org/show_bug.cgi?id=22366
*
* `reorderSettingAAElem` creates a tree of comma expressions, however,
* `checkAssignExp` expects only AssignExps.
*/
- checkAssignEscape(sc, Expression.extractLast(res, tmp), false, false);
+ if (res == exp) // no `AA[k] = v` rewrite was performed
+ checkAssignEscape(sc, res, false, false);
+ else
+ checkNewEscape(sc, assignElem, false); // assigning to AA puts it on heap
if (auto ae = res.isConstructExp())
{
@@ -9905,40 +9952,48 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
if (t1b.ty != Tsarray && t1b.ty != Tarray)
return setResult(res);
- /* Do not lower Rvalues and references, as they need to be moved,
- * not copied.
- * Skip the lowering when the RHS is an array literal, as e2ir
- * already handles such cases more elegantly.
- */
- const isArrayCtor =
- (ae.e1.isSliceExp || ae.e1.type.ty == Tsarray) &&
- ae.e2.isLvalue &&
- !(ae.e1.isVarExp &&
- ae.e1.isVarExp.var.isVarDeclaration.isReference) &&
- (ae.e2.isVarExp ||
- ae.e2.isSliceExp ||
- (ae.e2.type.ty == Tsarray && !ae.e2.isArrayLiteralExp)) &&
- ae.e1.type.nextOf &&
- ae.e2.type.nextOf &&
- ae.e1.type.nextOf.mutableOf.equals(ae.e2.type.nextOf.mutableOf);
-
- /* Unlike isArrayCtor above, lower all Rvalues. If the RHS is a literal,
- * then we do want to make a temporary for it and call its destructor.
- */
- const isArraySetCtor =
- (ae.e1.isSliceExp || ae.e1.type.ty == Tsarray) &&
- (ae.e2.type.ty == Tstruct || ae.e2.type.ty == Tsarray) &&
- ae.e1.type.nextOf &&
- ae.e1.type.nextOf.equivalent(ae.e2.type);
+ // only non-trivial array constructions may need to be lowered (non-POD elements basically)
+ Type t1e = t1b.nextOf();
+ TypeStruct ts = t1e.baseElemOf().isTypeStruct();
+ if (!ts || (!ts.sym.postblit && !ts.sym.hasCopyCtor && !ts.sym.dtor))
+ return setResult(res);
- if (isArrayCtor || isArraySetCtor)
+ // don't lower ref-constructions etc.
+ if (!(t1b.ty == Tsarray || ae.e1.isSliceExp) ||
+ (ae.e1.isVarExp && ae.e1.isVarExp.var.isVarDeclaration.isReference))
+ return setResult(res);
+
+ // Construction from an equivalent other array?
+ // Only lower with lvalue RHS elements; let the glue layer move rvalue elements.
+ Type t2b = ae.e2.type.toBasetype();
+ // skip over a (possibly implicit) cast of a static array RHS to a slice
+ Expression rhs = ae.e2;
+ Type rhsType = t2b;
+ if (t2b.ty == Tarray)
{
- const ts = t1b.nextOf().baseElemOf().isTypeStruct();
- if (!ts || (!ts.sym.postblit && !ts.sym.hasCopyCtor && !ts.sym.dtor))
- return setResult(res);
+ if (auto ce = rhs.isCastExp())
+ {
+ auto ct = ce.e1.type.toBasetype();
+ if (ct.ty == Tsarray)
+ {
+ rhs = ce.e1;
+ rhsType = ct;
+ }
+ }
+ }
+ const lowerToArrayCtor =
+ ( (rhsType.ty == Tarray && !rhs.isArrayLiteralExp) ||
+ (rhsType.ty == Tsarray && rhs.isLvalue) ) &&
+ t1e.equivalent(t2b.nextOf);
+
+ // Construction from a single element?
+ // If the RHS is an rvalue, then we'll need to make a temporary for it (copied multiple times).
+ const lowerToArraySetCtor = !lowerToArrayCtor && t1e.equivalent(t2b);
- auto func = isArrayCtor ? Id._d_arrayctor : Id._d_arraysetctor;
- const other = isArrayCtor ? "other array" : "value";
+ if (lowerToArrayCtor || lowerToArraySetCtor)
+ {
+ auto func = lowerToArrayCtor ? Id._d_arrayctor : Id._d_arraysetctor;
+ const other = lowerToArrayCtor ? "other array" : "value";
if (!verifyHookExist(exp.loc, *sc, func, "construct array with " ~ other, Id.object))
return setError();
@@ -9948,18 +10003,18 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
id = new DotIdExp(exp.loc, id, func);
auto arguments = new Expressions();
- arguments.push(new CastExp(ae.loc, ae.e1, ae.e1.type.nextOf.arrayOf).expressionSemantic(sc));
- if (isArrayCtor)
+ arguments.push(new CastExp(ae.loc, ae.e1, t1e.arrayOf).expressionSemantic(sc));
+ if (lowerToArrayCtor)
{
- arguments.push(new CastExp(ae.loc, ae.e2, ae.e2.type.nextOf.arrayOf).expressionSemantic(sc));
+ arguments.push(new CastExp(ae.loc, rhs, t2b.nextOf.arrayOf).expressionSemantic(sc));
Expression ce = new CallExp(exp.loc, id, arguments);
res = ce.expressionSemantic(sc);
}
else
{
Expression e0;
- // If ae.e2 is not a variable, construct a temp variable, as _d_arraysetctor requires `ref` access
- if (!ae.e2.isVarExp)
+ // promote an rvalue RHS element to a temporary, it's passed by ref to _d_arraysetctor
+ if (!ae.e2.isLvalue)
{
auto vd = copyToTemp(STC.scope_, "__setctor", ae.e2);
e0 = new DeclarationExp(vd.loc, vd).expressionSemantic(sc);
@@ -11759,6 +11814,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
result = arrayLowering;
return;
}
+
+ if (t1.isTypeVector())
+ exp.type = t1;
+
result = exp;
return;
}
@@ -12038,6 +12097,9 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return;
}
+ if (t1.isTypeVector())
+ exp.type = t1;
+
result = exp;
}
@@ -12490,8 +12552,7 @@ Expression semanticX(DotIdExp exp, Scope* sc)
if (f.checkForwardRef(loc))
return ErrorExp.get();
- if (f.flags & (FUNCFLAG.purityInprocess | FUNCFLAG.safetyInprocess |
- FUNCFLAG.nothrowInprocess | FUNCFLAG.nogcInprocess))
+ if (f.purityInprocess || f.safetyInprocess || f.nothrowInprocess || f.nogcInprocess)
{
f.error(loc, "cannot retrieve its `.mangleof` while inferring attributes");
return ErrorExp.get();
@@ -13099,7 +13160,7 @@ Lerr:
*/
bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false)
{
- if (!global.params.noSharedAccess ||
+ if (global.params.noSharedAccess != FeatureState.enabled ||
sc.intypeof ||
sc.flags & SCOPE.ctfe)
{
diff --git a/gcc/d/dmd/func.d b/gcc/d/dmd/func.d
index bcae282..3b0b34e 100644
--- a/gcc/d/dmd/func.d
+++ b/gcc/d/dmd/func.d
@@ -182,7 +182,7 @@ public:
catches.push(ctch);
Statement s2 = new TryCatchStatement(Loc.initial, s._body, catches);
- fd.flags &= ~FUNCFLAG.noEH;
+ fd.hasNoEH = false;
replaceCurrent(s2);
s2.accept(this);
}
@@ -191,31 +191,31 @@ public:
}
}
-enum FUNCFLAG : uint
+private struct FUNCFLAG
{
- purityInprocess = 1, /// working on determining purity
- safetyInprocess = 2, /// working on determining safety
- nothrowInprocess = 4, /// working on determining nothrow
- nogcInprocess = 8, /// working on determining @nogc
- returnInprocess = 0x10, /// working on inferring 'return' for parameters
- inlineScanned = 0x20, /// function has been scanned for inline possibilities
- inferScope = 0x40, /// infer 'scope' for parameters
- hasCatches = 0x80, /// function has try-catch statements
- compileTimeOnly = 0x100, /// is a compile time only function; no code will be generated for it
- printf = 0x200, /// is a printf-like function
- scanf = 0x400, /// is a scanf-like function
- noreturn = 0x800, /// the function does not return
- NRVO = 0x1000, /// Support for named return value optimization
- naked = 0x2000, /// The function is 'naked' (see inline ASM)
- generated = 0x4000, /// The function is compiler generated (e.g. `opCmp`)
- introducing = 0x8000, /// If this function introduces the overload set
- semantic3Errors = 0x10000, /// If errors in semantic3 this function's frame ptr
- noEH = 0x20000, /// No exception unwinding is needed
- inferRetType = 0x40000, /// Return type is to be inferred
- dualContext = 0x80000, /// has a dual-context 'this' parameter
- hasAlwaysInline = 0x100000, /// Contains references to functions that must be inlined
- CRTCtor = 0x200000, /// Has attribute pragma(crt_constructor)
- CRTDtor = 0x400000, /// Has attribute pragma(crt_destructor)
+ bool purityInprocess; /// working on determining purity
+ bool safetyInprocess; /// working on determining safety
+ bool nothrowInprocess; /// working on determining nothrow
+ bool nogcInprocess; /// working on determining @nogc
+ bool returnInprocess; /// working on inferring 'return' for parameters
+ bool inlineScanned; /// function has been scanned for inline possibilities
+ bool inferScope; /// infer 'scope' for parameters
+ bool hasCatches; /// function has try-catch statements
+ bool isCompileTimeOnly; /// is a compile time only function; no code will be generated for it
+ bool printf; /// is a printf-like function
+ bool scanf; /// is a scanf-like function
+ bool noreturn; /// the function does not return
+ bool isNRVO = true; /// Support for named return value optimization
+ bool isNaked; /// The function is 'naked' (see inline ASM)
+ bool isGenerated; /// The function is compiler generated (e.g. `opCmp`)
+ bool isIntroducing; /// If this function introduces the overload set
+ bool hasSemantic3Errors; /// If errors in semantic3 this function's frame ptr
+ bool hasNoEH; /// No exception unwinding is needed
+ bool inferRetType; /// Return type is to be inferred
+ bool hasDualContext; /// has a dual-context 'this' parameter
+ bool hasAlwaysInlines; /// Contains references to functions that must be inlined
+ bool isCrtCtor; /// Has attribute pragma(crt_constructor)
+ bool isCrtDtor; /// Has attribute pragma(crt_destructor)
}
/***********************************************************
@@ -348,9 +348,9 @@ extern (C++) class FuncDeclaration : Declaration
/// better diagnostics
AttributeViolation* safetyViolation;
- /// Function flags: A collection of boolean packed for memory efficiency
- /// See the `FUNCFLAG` enum
- uint flags = FUNCFLAG.NRVO;
+ /// See the `FUNCFLAG` struct
+ import dmd.common.bitfields;
+ mixin(generateBitFields!(FUNCFLAG, uint));
/**
* Data for a function declaration that is needed for the Objective-C
@@ -373,13 +373,13 @@ extern (C++) class FuncDeclaration : Declaration
}
this.endloc = endloc;
if (noreturn)
- this.flags |= FUNCFLAG.noreturn;
+ this.noreturn = true;
/* The type given for "infer the return type" is a TypeFunction with
* NULL for the return type.
*/
if (type && type.nextOf() is null)
- this.flags |= FUNCFLAG.inferRetType;
+ this.inferRetType = true;
}
static FuncDeclaration create(const ref Loc loc, const ref Loc endloc, Identifier id, StorageClass storage_class, Type type, bool noreturn = false)
@@ -391,7 +391,7 @@ extern (C++) class FuncDeclaration : Declaration
{
//printf("FuncDeclaration::syntaxCopy('%s')\n", toChars());
FuncDeclaration f = s ? cast(FuncDeclaration)s
- : new FuncDeclaration(loc, endloc, ident, storage_class, type.syntaxCopy(), (flags & FUNCFLAG.noreturn) != 0);
+ : new FuncDeclaration(loc, endloc, ident, storage_class, type.syntaxCopy(), this.noreturn != 0);
f.frequires = frequires ? Statement.arraySyntaxCopy(frequires) : null;
f.fensures = fensures ? Ensure.arraySyntaxCopy(fensures) : null;
f.fbody = fbody ? fbody.syntaxCopy() : null;
@@ -522,7 +522,7 @@ extern (C++) class FuncDeclaration : Declaration
{
const bool dualCtx = (toParent2() != toParentLocal());
if (dualCtx)
- this.flags |= FUNCFLAG.dualContext;
+ this.hasDualContext = true;
auto ad = isThis();
if (!dualCtx && !ad && !isNested())
{
@@ -1376,29 +1376,29 @@ extern (C++) class FuncDeclaration : Declaration
//printf("initInferAttributes() for %s (%s)\n", toPrettyChars(), ident.toChars());
TypeFunction tf = type.toTypeFunction();
if (tf.purity == PURE.impure) // purity not specified
- flags |= FUNCFLAG.purityInprocess;
+ purityInprocess = true;
if (tf.trust == TRUST.default_)
- flags |= FUNCFLAG.safetyInprocess;
+ safetyInprocess = true;
if (!tf.isnothrow)
- flags |= FUNCFLAG.nothrowInprocess;
+ nothrowInprocess = true;
if (!tf.isnogc)
- flags |= FUNCFLAG.nogcInprocess;
+ nogcInprocess = true;
if (!isVirtual() || this.isIntroducing())
- flags |= FUNCFLAG.returnInprocess;
+ returnInprocess = true;
// Initialize for inferring STC.scope_
- flags |= FUNCFLAG.inferScope;
+ inferScope = true;
}
final PURE isPure()
{
//printf("FuncDeclaration::isPure() '%s'\n", toChars());
TypeFunction tf = type.toTypeFunction();
- if (flags & FUNCFLAG.purityInprocess)
+ if (purityInprocess)
setImpure();
if (tf.purity == PURE.fwdref)
tf.purityLevel();
@@ -1424,7 +1424,7 @@ extern (C++) class FuncDeclaration : Declaration
final PURE isPureBypassingInference()
{
- if (flags & FUNCFLAG.purityInprocess)
+ if (purityInprocess)
return PURE.fwdref;
else
return isPure();
@@ -1437,9 +1437,9 @@ extern (C++) class FuncDeclaration : Declaration
*/
extern (D) final bool setImpure()
{
- if (flags & FUNCFLAG.purityInprocess)
+ if (purityInprocess)
{
- flags &= ~FUNCFLAG.purityInprocess;
+ purityInprocess = false;
if (fes)
fes.func.setImpure();
}
@@ -1448,21 +1448,32 @@ extern (C++) class FuncDeclaration : Declaration
return false;
}
+ extern (D) final uint flags()
+ {
+ return bitFields;
+ }
+
+ extern (D) final uint flags(uint f)
+ {
+ bitFields = f;
+ return bitFields;
+ }
+
final bool isSafe()
{
- if (flags & FUNCFLAG.safetyInprocess)
+ if (safetyInprocess)
setUnsafe();
return type.toTypeFunction().trust == TRUST.safe;
}
final bool isSafeBypassingInference()
{
- return !(flags & FUNCFLAG.safetyInprocess) && isSafe();
+ return !(safetyInprocess) && isSafe();
}
final bool isTrusted()
{
- if (flags & FUNCFLAG.safetyInprocess)
+ if (safetyInprocess)
setUnsafe();
return type.toTypeFunction().trust == TRUST.trusted;
}
@@ -1483,9 +1494,9 @@ extern (C++) class FuncDeclaration : Declaration
bool gag = false, Loc loc = Loc.init, const(char)* fmt = null,
RootObject arg0 = null, RootObject arg1 = null, RootObject arg2 = null)
{
- if (flags & FUNCFLAG.safetyInprocess)
+ if (safetyInprocess)
{
- flags &= ~FUNCFLAG.safetyInprocess;
+ safetyInprocess = false;
type.toTypeFunction().trust = TRUST.system;
if (fmt || arg0)
safetyViolation = new AttributeViolation(loc, fmt, arg0, arg1, arg2);
@@ -1518,99 +1529,14 @@ extern (C++) class FuncDeclaration : Declaration
final bool isNogc()
{
//printf("isNogc() %s, inprocess: %d\n", toChars(), !!(flags & FUNCFLAG.nogcInprocess));
- if (flags & FUNCFLAG.nogcInprocess)
+ if (nogcInprocess)
setGC();
return type.toTypeFunction().isnogc;
}
final bool isNogcBypassingInference()
{
- return !(flags & FUNCFLAG.nogcInprocess) && isNogc();
- }
-
- final bool isNRVO() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.NRVO);
- }
-
- final void isNRVO(bool v) pure nothrow @safe @nogc
- {
- if (v) this.flags |= FUNCFLAG.NRVO;
- else this.flags &= ~FUNCFLAG.NRVO;
- }
-
- final bool isNaked() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.naked);
- }
-
- final void isNaked(bool v) @safe pure nothrow @nogc
- {
- if (v) this.flags |= FUNCFLAG.naked;
- else this.flags &= ~FUNCFLAG.naked;
- }
-
- final bool isGenerated() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.generated);
- }
-
- final void isGenerated(bool v) pure nothrow @safe @nogc
- {
- if (v) this.flags |= FUNCFLAG.generated;
- else this.flags &= ~FUNCFLAG.generated;
- }
-
- final bool isIntroducing() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.introducing);
- }
-
- final bool hasSemantic3Errors() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.semantic3Errors);
- }
-
- final bool hasNoEH() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.noEH);
- }
-
- final bool inferRetType() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.inferRetType);
- }
-
- final bool hasDualContext() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.dualContext);
- }
-
- final bool hasAlwaysInlines() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.hasAlwaysInline);
- }
-
- final bool isCrtCtor() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.CRTCtor);
- }
-
- final void isCrtCtor(bool v) @safe pure nothrow @nogc
- {
- if (v) this.flags |= FUNCFLAG.CRTCtor;
- else this.flags &= ~FUNCFLAG.CRTCtor;
- }
-
- final bool isCrtDtor() const scope @safe pure nothrow @nogc
- {
- return !!(this.flags & FUNCFLAG.CRTDtor);
- }
-
- final void isCrtDtor(bool v) @safe pure nothrow @nogc
- {
- if (v) this.flags |= FUNCFLAG.CRTDtor;
- else this.flags &= ~FUNCFLAG.CRTDtor;
+ return !nogcInprocess && isNogc();
}
/**************************************
@@ -1622,15 +1548,15 @@ extern (C++) class FuncDeclaration : Declaration
extern (D) final bool setGC()
{
//printf("setGC() %s\n", toChars());
- if (flags & FUNCFLAG.nogcInprocess && semanticRun < PASS.semantic3 && _scope)
+ if (nogcInprocess && semanticRun < PASS.semantic3 && _scope)
{
this.semantic2(_scope);
this.semantic3(_scope);
}
- if (flags & FUNCFLAG.nogcInprocess)
+ if (nogcInprocess)
{
- flags &= ~FUNCFLAG.nogcInprocess;
+ nogcInprocess = false;
type.toTypeFunction().isnogc = false;
if (fes)
fes.func.setGC();
@@ -3384,6 +3310,28 @@ FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s,
// re-resolve to check for supplemental message
if (!global.gag || global.params.showGaggedErrors)
{
+ if (tthis)
+ {
+ if (auto classType = tthis.isTypeClass())
+ {
+ if (auto baseClass = classType.sym.baseClass)
+ {
+ if (auto baseFunction = baseClass.search(baseClass.loc, fd.ident))
+ {
+ MatchAccumulator mErr;
+ functionResolve(mErr, baseFunction, loc, sc, tiargs, baseClass.type, fargs, null);
+ if (mErr.last > MATCH.nomatch && mErr.lastf)
+ {
+ errorSupplemental(loc, "%s `%s` hides base class function `%s`",
+ fd.kind, fd.toPrettyChars(), mErr.lastf.toPrettyChars());
+ errorSupplemental(loc, "add `alias %s = %s` to `%s`'s body to merge the overload sets",
+ fd.toChars(), mErr.lastf.toPrettyChars(), tthis.toChars());
+ return null;
+ }
+ }
+ }
+ }
+ }
const(char)* failMessage;
functionResolve(m, orig_s, loc, sc, tiargs, tthis, fargs, &failMessage);
if (failMessage)
@@ -3767,7 +3715,7 @@ extern (C++) final class FuncLiteralDeclaration : FuncDeclaration
this.fes = fes;
// Always infer scope for function literals
// See https://issues.dlang.org/show_bug.cgi?id=20362
- this.flags |= FUNCFLAG.inferScope;
+ this.inferScope = true;
//printf("FuncLiteralDeclaration() id = '%s', type = '%s'\n", this.ident.toChars(), type.toChars());
}
@@ -4431,6 +4379,58 @@ bool setUnsafe(Scope* sc,
return sc.func.setUnsafe(gag, loc, fmt, arg0, arg1, arg2);
}
+/***************************************
+ * Like `setUnsafe`, but for safety errors still behind preview switches
+ *
+ * Given a `FeatureState fs`, for example dip1000 / dip25 / systemVariables,
+ * the behavior changes based on the setting:
+ *
+ * - In case of `-revert=fs`, it does nothing.
+ * - In case of `-preview=fs`, it's the same as `setUnsafe`
+ * - By default, print a deprecation in `@safe` functions, or store an attribute violation in inferred functions.
+ *
+ * Params:
+ * sc = used to find affected function/variable, and for checking whether we are in a deprecated / speculative scope
+ * fs = feature state from the preview flag
+ * gag = surpress error message
+ * loc = location of error
+ * msg = printf-style format string
+ * arg0 = (optional) argument for first %s format specifier
+ * arg1 = (optional) argument for second %s format specifier
+ * arg2 = (optional) argument for third %s format specifier
+ * Returns: whether an actual safe error (not deprecation) occured
+ */
+bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char)* msg,
+ RootObject arg0 = null, RootObject arg1 = null, RootObject arg2 = null)
+{
+ if (fs == FeatureState.disabled)
+ {
+ return false;
+ }
+ else if (fs == FeatureState.enabled)
+ {
+ return sc.setUnsafe(gag, loc, msg, arg0, arg1, arg2);
+ }
+ else
+ {
+ if (!sc.func)
+ return false;
+ if (sc.func.isSafeBypassingInference())
+ {
+ if (!gag)
+ previewErrorFunc(sc.isDeprecated(), fs)(
+ loc, msg, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""
+ );
+ }
+ else if (!sc.func.safetyViolation)
+ {
+ import dmd.func : AttributeViolation;
+ sc.func.safetyViolation = new AttributeViolation(loc, msg, arg0, arg1, arg2);
+ }
+ return false;
+ }
+}
+
/// Stores a reason why a function failed to infer a function attribute like `@safe` or `pure`
///
/// Has two modes:
diff --git a/gcc/d/dmd/globals.d b/gcc/d/dmd/globals.d
index 745d5eb..2770f5a 100644
--- a/gcc/d/dmd/globals.d
+++ b/gcc/d/dmd/globals.d
@@ -160,15 +160,16 @@ extern (C++) struct Param
// https://gist.github.com/andralex/e5405a5d773f07f73196c05f8339435a
// https://digitalmars.com/d/archives/digitalmars/D/Binding_rvalues_to_ref_parameters_redux_325087.html
// Implementation: https://github.com/dlang/dmd/pull/9817
- bool noSharedAccess; // read/write access to shared memory objects
+ FeatureState noSharedAccess; // read/write access to shared memory objects
bool previewIn; // `in` means `[ref] scope const`, accepts rvalues
bool inclusiveInContracts; // 'in' contracts of overridden methods must be a superset of parent contract
- bool shortenedMethods; // allow => in normal function declarations
+ bool shortenedMethods = true; // allow => in normal function declarations
bool fixImmutableConv; // error on unsound immutable conversion - https://github.com/dlang/dmd/pull/14070
bool fix16997 = true; // fix integral promotions for unary + - ~ operators
// https://issues.dlang.org/show_bug.cgi?id=16997
FeatureState dtorFields; // destruct fields of partially constructed objects
// https://issues.dlang.org/show_bug.cgi?id=14246
+ FeatureState systemVariables; // limit access to variables marked @system from @safe code
CHECKENABLE useInvariants = CHECKENABLE._default; // generate class invariant checks
CHECKENABLE useIn = CHECKENABLE._default; // generate precondition checks
diff --git a/gcc/d/dmd/globals.h b/gcc/d/dmd/globals.h
index a6b1c90..d9cb76c 100644
--- a/gcc/d/dmd/globals.h
+++ b/gcc/d/dmd/globals.h
@@ -158,7 +158,7 @@ struct Param
// https://gist.github.com/andralex/e5405a5d773f07f73196c05f8339435a
// https://digitalmars.com/d/archives/digitalmars/D/Binding_rvalues_to_ref_parameters_redux_325087.html
// Implementation: https://github.com/dlang/dmd/pull/9817
- bool noSharedAccess; // read/write access to shared memory objects
+ FeatureState noSharedAccess; // read/write access to shared memory objects
bool previewIn; // `in` means `[ref] scope const`, accepts rvalues
bool inclusiveInContracts; // 'in' contracts of overridden methods must be a superset of parent contract
bool shortenedMethods; // allow => in normal function declarations
@@ -166,7 +166,9 @@ struct Param
bool fix16997; // fix integral promotions for unary + - ~ operators
// https://issues.dlang.org/show_bug.cgi?id=16997
FeatureState dtorFields; // destruct fields of partially constructed objects
- // https://issues.dlang.org/show_bug.cgi?id=14246
+ // https://issues.dlang.org/show_bug.cgi?id=14246
+ FeatureState systemVariables; // limit access to variables marked @system from @safe code
+
CHECKENABLE useInvariants; // generate class invariant checks
CHECKENABLE useIn; // generate precondition checks
CHECKENABLE useOut; // generate postcondition checks
diff --git a/gcc/d/dmd/hdrgen.d b/gcc/d/dmd/hdrgen.d
index 48995db..debf01d 100644
--- a/gcc/d/dmd/hdrgen.d
+++ b/gcc/d/dmd/hdrgen.d
@@ -64,6 +64,7 @@ struct HdrGenState
int tpltMember;
int autoMember;
int forStmtInit;
+ int insideFuncBody;
bool declstring; // set while declaring alias for string,wstring or dstring
EnumDeclaration inEnumDecl;
@@ -1045,8 +1046,18 @@ public:
buf.writestring(", ");
argsToBuffer(d.args, buf, hgs);
}
+
buf.writeByte(')');
+
+ // https://issues.dlang.org/show_bug.cgi?id=14690
+ // Unconditionally perform a full output dump
+ // for `pragma(inline)` declarations.
+ bool savedFullDump = global.params.dihdr.fullOutput;
+ if (d.ident == Id.Pinline)
+ global.params.dihdr.fullOutput = true;
+
visit(cast(AttribDeclaration)d);
+ global.params.dihdr.fullOutput = savedFullDump;
}
override void visit(ConditionalDeclaration d)
@@ -1549,7 +1560,7 @@ public:
bodyToBuffer(f);
hgs.autoMember--;
}
- else if (hgs.tpltMember == 0 && global.params.dihdr.fullOutput == false)
+ else if (hgs.tpltMember == 0 && global.params.dihdr.fullOutput == false && !hgs.insideFuncBody)
{
if (!f.fbody)
{
@@ -1634,7 +1645,7 @@ public:
void bodyToBuffer(FuncDeclaration f)
{
- if (!f.fbody || (hgs.hdrgen && global.params.dihdr.fullOutput == false && !hgs.autoMember && !hgs.tpltMember))
+ if (!f.fbody || (hgs.hdrgen && global.params.dihdr.fullOutput == false && !hgs.autoMember && !hgs.tpltMember && !hgs.insideFuncBody))
{
if (!f.fbody && (f.fensures || f.frequires))
{
@@ -1645,6 +1656,18 @@ public:
buf.writenl();
return;
}
+
+ // there is no way to know if a function is nested
+ // or not after parsing. We need scope information
+ // for that, which is avaible during semantic
+ // analysis. To overcome that, a simple mechanism
+ // is implemented: everytime we print a function
+ // body (templated or not) we increment a counter.
+ // We decredement the counter when we stop
+ // printing the function body.
+ ++hgs.insideFuncBody;
+ scope(exit) { --hgs.insideFuncBody; }
+
const savetlpt = hgs.tpltMember;
const saveauto = hgs.autoMember;
hgs.tpltMember = 0;
diff --git a/gcc/d/dmd/lexer.d b/gcc/d/dmd/lexer.d
index 1de89d4..451e227 100644
--- a/gcc/d/dmd/lexer.d
+++ b/gcc/d/dmd/lexer.d
@@ -1197,9 +1197,9 @@ class Lexer
/*******************************************
* Parse escape sequence.
*/
- private uint escapeSequence()
+ private uint escapeSequence(out dchar c2)
{
- return Lexer.escapeSequence(token.loc, p, Ccompile);
+ return Lexer.escapeSequence(token.loc, p, Ccompile, c2);
}
/********
@@ -1211,10 +1211,11 @@ class Lexer
* sequence = pointer to string with escape sequence to parse. Updated to
* point past the end of the escape sequence
* Ccompile = true for compile C11 escape sequences
+ * c2 = returns second `dchar` of html entity with 2 code units, otherwise stays `dchar.init`
* Returns:
* the escape sequence as a single character
*/
- private dchar escapeSequence(const ref Loc loc, ref const(char)* sequence, bool Ccompile)
+ private dchar escapeSequence(const ref Loc loc, ref const(char)* sequence, bool Ccompile, out dchar c2)
{
const(char)* p = sequence; // cache sequence reference on stack
scope(exit) sequence = p;
@@ -1326,12 +1327,16 @@ class Lexer
switch (*p)
{
case ';':
- c = HtmlNamedEntity(idstart[0 .. p - idstart]);
- if (c == ~0)
+ auto entity = HtmlNamedEntity(idstart[0 .. p - idstart]);
+ c = entity[0];
+ if (entity == entity.init)
{
error(loc, "unnamed character entity &%.*s;", cast(int)(p - idstart), idstart);
c = '?';
}
+ if (entity[1] != entity.init[1])
+ c2 = entity[1];
+
p++;
break;
default:
@@ -1665,6 +1670,7 @@ class Lexer
while (1)
{
dchar c = *p++;
+ dchar c2;
switch (c)
{
case '\\':
@@ -1673,15 +1679,19 @@ class Lexer
case '&':
if (Ccompile)
goto default;
- goto case;
+ c = escapeSequence(c2);
+ stringbuffer.writeUTF8(c);
+ if (c2 != dchar.init)
+ stringbuffer.writeUTF8(c2);
+ continue;
case 'u':
case 'U':
- c = escapeSequence();
+ c = escapeSequence(c2);
stringbuffer.writeUTF8(c);
continue;
default:
- c = escapeSequence();
+ c = escapeSequence(c2);
break;
}
break;
@@ -1746,22 +1756,26 @@ class Lexer
//printf("Lexer::charConstant\n");
p++;
dchar c = *p++;
+ dchar c2;
switch (c)
{
case '\\':
switch (*p)
{
case 'u':
- t.unsvalue = escapeSequence();
tk = TOK.wcharLiteral;
- break;
+ goto default;
case 'U':
case '&':
- t.unsvalue = escapeSequence();
tk = TOK.dcharLiteral;
- break;
+ goto default;
default:
- t.unsvalue = escapeSequence();
+ t.unsvalue = escapeSequence(c2);
+ if (c2 != c2.init)
+ {
+ error("html entity requires 2 code units, use a string instead of a character");
+ t.unsvalue = '?';
+ }
break;
}
break;
@@ -1978,8 +1992,6 @@ class Lexer
break;
case 'b':
case 'B':
- if (Ccompile)
- error("binary constants not allowed");
++p;
base = 2;
break;
@@ -3185,8 +3197,9 @@ unittest
static void test(T)(string sequence, T expected, bool Ccompile = false)
{
auto p = cast(const(char)*)sequence.ptr;
+ dchar c2;
Lexer lexer = new Lexer();
- assert(expected == lexer.escapeSequence(Loc.initial, p, Ccompile));
+ assert(expected == lexer.escapeSequence(Loc.initial, p, Ccompile, c2));
assert(p == sequence.ptr + sequence.length);
}
@@ -3253,7 +3266,8 @@ unittest
expected = expectedError;
auto p = cast(const(char)*)sequence.ptr;
Lexer lexer = new Lexer();
- auto actualReturnValue = lexer.escapeSequence(Loc.initial, p, Ccompile);
+ dchar c2;
+ auto actualReturnValue = lexer.escapeSequence(Loc.initial, p, Ccompile, c2);
assert(gotError);
assert(expectedReturnValue == actualReturnValue);
diff --git a/gcc/d/dmd/module.h b/gcc/d/dmd/module.h
index 341ce36..48046de 100644
--- a/gcc/d/dmd/module.h
+++ b/gcc/d/dmd/module.h
@@ -116,7 +116,7 @@ public:
size_t namelen; // length of module name in characters
static Module* create(const char *arg, Identifier *ident, int doDocComment, int doHdrGen);
-
+ static const char *find(const char *filename);
static Module *load(const Loc &loc, Identifiers *packages, Identifier *ident);
const char *kind() const override;
diff --git a/gcc/d/dmd/mtype.d b/gcc/d/dmd/mtype.d
index 1240f5a..265f731c 100644
--- a/gcc/d/dmd/mtype.d
+++ b/gcc/d/dmd/mtype.d
@@ -2488,6 +2488,16 @@ extern (C++) abstract class Type : ASTNode
return false;
}
+ /*************************************
+ * Detect if this is an unsafe type because of the presence of `@system` members
+ * Returns:
+ * true if so
+ */
+ bool hasSystemFields()
+ {
+ return false;
+ }
+
/***************************************
* Returns: true if type has any invariants
*/
@@ -3821,6 +3831,16 @@ extern (C++) final class TypeSArray : TypeArray
return next.hasPointers();
}
+ override bool hasSystemFields()
+ {
+ return next.hasSystemFields();
+ }
+
+ override bool hasVoidInitPointers()
+ {
+ return next.hasVoidInitPointers();
+ }
+
override bool hasInvariant()
{
return next.hasInvariant();
@@ -5532,52 +5552,32 @@ extern (C++) final class TypeStruct : Type
override bool hasPointers()
{
- // Probably should cache this information in sym rather than recompute
- StructDeclaration s = sym;
-
if (sym.members && !sym.determineFields() && sym.type != Type.terror)
error(sym.loc, "no size because of forward references");
- foreach (VarDeclaration v; s.fields)
- {
- if (v.storage_class & STC.ref_ || v.hasPointers())
- return true;
- }
- return false;
+ sym.determineTypeProperties();
+ return sym.hasPointerField;
}
override bool hasVoidInitPointers()
{
- // Probably should cache this information in sym rather than recompute
- StructDeclaration s = sym;
+ sym.size(Loc.initial); // give error for forward references
+ sym.determineTypeProperties();
+ return sym.hasVoidInitPointers;
+ }
+ override bool hasSystemFields()
+ {
sym.size(Loc.initial); // give error for forward references
- foreach (VarDeclaration v; s.fields)
- {
- if (v._init && v._init.isVoidInitializer() && v.type.hasPointers())
- return true;
- if (!v._init && v.type.hasVoidInitPointers())
- return true;
- }
- return false;
+ sym.determineTypeProperties();
+ return sym.hasSystemFields;
}
override bool hasInvariant()
{
- // Probably should cache this information in sym rather than recompute
- StructDeclaration s = sym;
-
sym.size(Loc.initial); // give error for forward references
-
- if (s.hasInvariant())
- return true;
-
- foreach (VarDeclaration v; s.fields)
- {
- if (v.type.hasInvariant())
- return true;
- }
- return false;
+ sym.determineTypeProperties();
+ return sym.hasInvariant() || sym.hasFieldWithInvariant;
}
extern (D) MATCH implicitConvToWithoutAliasThis(Type to)
@@ -5857,6 +5857,11 @@ extern (C++) final class TypeEnum : Type
return memType().hasVoidInitPointers();
}
+ override bool hasSystemFields()
+ {
+ return memType().hasSystemFields();
+ }
+
override bool hasInvariant()
{
return memType().hasInvariant();
diff --git a/gcc/d/dmd/mtype.h b/gcc/d/dmd/mtype.h
index 2b9c94c..c81c25a 100644
--- a/gcc/d/dmd/mtype.h
+++ b/gcc/d/dmd/mtype.h
@@ -311,6 +311,7 @@ public:
virtual int hasWild() const;
virtual bool hasPointers();
virtual bool hasVoidInitPointers();
+ virtual bool hasSystemFields();
virtual bool hasInvariant();
virtual Type *nextOf();
Type *baseElemOf();
@@ -458,6 +459,8 @@ public:
MATCH implicitConvTo(Type *to) override;
Expression *defaultInitLiteral(const Loc &loc) override;
bool hasPointers() override;
+ bool hasSystemFields() override;
+ bool hasVoidInitPointers() override;
bool hasInvariant() override;
bool needsDestruction() override;
bool needsCopyOrPostblit() override;
@@ -794,6 +797,7 @@ public:
bool needsNested() override;
bool hasPointers() override;
bool hasVoidInitPointers() override;
+ bool hasSystemFields() override;
bool hasInvariant() override;
MATCH implicitConvTo(Type *to) override;
MATCH constConv(Type *to) override;
@@ -832,6 +836,7 @@ public:
bool isZeroInit(const Loc &loc) override;
bool hasPointers() override;
bool hasVoidInitPointers() override;
+ bool hasSystemFields() override;
bool hasInvariant() override;
Type *nextOf() override;
diff --git a/gcc/d/dmd/nogc.d b/gcc/d/dmd/nogc.d
index 8cf3585..7ddeeec 100644
--- a/gcc/d/dmd/nogc.d
+++ b/gcc/d/dmd/nogc.d
@@ -99,7 +99,7 @@ public:
override void visit(ArrayLiteralExp e)
{
- if (e.type.ty != Tarray || !e.elements || !e.elements.dim)
+ if (e.type.ty != Tarray || !e.elements || !e.elements.dim || e.onstack)
return;
if (f.setGC())
{
@@ -221,7 +221,7 @@ Expression checkGC(Scope* sc, Expression e)
FuncDeclaration f = sc.func;
if (e && e.op != EXP.error && f && sc.intypeof != 1 && !(sc.flags & SCOPE.ctfe) &&
(f.type.ty == Tfunction &&
- (cast(TypeFunction)f.type).isnogc || (f.flags & FUNCFLAG.nogcInprocess) || global.params.vgc) &&
+ (cast(TypeFunction)f.type).isnogc || f.nogcInprocess || global.params.vgc) &&
!(sc.flags & SCOPE.debug_))
{
scope NOGCVisitor gcv = new NOGCVisitor(f);
diff --git a/gcc/d/dmd/parse.d b/gcc/d/dmd/parse.d
index ed85a5d..6fb542f 100644
--- a/gcc/d/dmd/parse.d
+++ b/gcc/d/dmd/parse.d
@@ -888,6 +888,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
error("redundant visibility attribute `%s`", AST.visibilityToChars(prot));
}
pAttrs.visibility.kind = prot;
+ const attrloc = token.loc;
nextToken();
@@ -908,7 +909,6 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
}
}
- const attrloc = token.loc;
a = parseBlock(pLastDecl, pAttrs);
if (pAttrs.visibility.kind != AST.Visibility.Kind.undefined)
{
@@ -3168,9 +3168,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
if (udas)
{
- auto s = new AST.Dsymbols();
- s.push(em);
- auto uad = new AST.UserAttributeDeclaration(udas, s);
+ auto uad = new AST.UserAttributeDeclaration(udas, new AST.Dsymbols());
em.userAttribDecl = uad;
}
diff --git a/gcc/d/dmd/printast.d b/gcc/d/dmd/printast.d
index bba3481..8c71a1a 100644
--- a/gcc/d/dmd/printast.d
+++ b/gcc/d/dmd/printast.d
@@ -203,6 +203,13 @@ extern (C++) final class PrintASTVisitor : Visitor
printf(".func: %s\n", e.func ? e.func.toChars() : "");
}
+ override void visit(CompoundLiteralExp e)
+ {
+ visit(cast(Expression)e);
+ printIndent(indent + 2);
+ printf(".init: %s\n", e.initializer ? e.initializer.toChars() : "");
+ }
+
static void printIndent(int indent)
{
foreach (i; 0 .. indent)
diff --git a/gcc/d/dmd/root/utf.d b/gcc/d/dmd/root/utf.d
index 15838e9..eb198fc 100644
--- a/gcc/d/dmd/root/utf.d
+++ b/gcc/d/dmd/root/utf.d
@@ -288,7 +288,7 @@ bool isUniAlpha(dchar c)
// Binary search
while (low <= high)
{
- size_t mid = (low + high) >> 1;
+ const size_t mid = low + ((high - low) >> 1);
if (c < ALPHA_TABLE[mid][0])
high = mid - 1;
else if (ALPHA_TABLE[mid][1] < c)
diff --git a/gcc/d/dmd/safe.d b/gcc/d/dmd/safe.d
index 4446b5e..397fd2ef 100644
--- a/gcc/d/dmd/safe.d
+++ b/gcc/d/dmd/safe.d
@@ -26,7 +26,7 @@ import dmd.identifier;
import dmd.mtype;
import dmd.target;
import dmd.tokens;
-import dmd.func : setUnsafe;
+import dmd.func : setUnsafe, setUnsafePreview;
/*************************************************************
* Check for unsafe access in @safe code:
@@ -57,6 +57,14 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg)
if (!ad)
return false;
+ import dmd.globals : global;
+ if (v.isSystem())
+ {
+ if (sc.setUnsafePreview(global.params.systemVariables, !printmsg, e.loc,
+ "cannot access `@system` field `%s.%s` in `@safe` code", ad, v))
+ return true;
+ }
+
// needed to set v.overlapped and v.overlapUnsafe
if (ad.sizeok != Sizeok.done)
ad.determineSize(ad.loc);
diff --git a/gcc/d/dmd/semantic3.d b/gcc/d/dmd/semantic3.d
index d2f9c0a..8ea419a 100644
--- a/gcc/d/dmd/semantic3.d
+++ b/gcc/d/dmd/semantic3.d
@@ -282,7 +282,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
// Disable generated opAssign, because some members forbid identity assignment.
funcdecl.storage_class |= STC.disable;
funcdecl.fbody = null; // remove fbody which contains the error
- funcdecl.flags &= ~FUNCFLAG.semantic3Errors;
+ funcdecl.hasSemantic3Errors = false;
}
return;
}
@@ -292,7 +292,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
if (funcdecl.semanticRun >= PASS.semantic3)
return;
funcdecl.semanticRun = PASS.semantic3;
- funcdecl.flags &= ~FUNCFLAG.semantic3Errors;
+ funcdecl.hasSemantic3Errors = false;
if (!funcdecl.type || funcdecl.type.ty != Tfunction)
return;
@@ -650,7 +650,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
// handle NRVO
if (!target.isReturnOnStack(f, funcdecl.needThis()) || !funcdecl.checkNRVO())
- funcdecl.flags &= ~FUNCFLAG.NRVO;
+ funcdecl.isNRVO = false;
if (funcdecl.fbody.isErrorStatement())
{
@@ -753,15 +753,15 @@ private extern(C++) final class Semantic3Visitor : Visitor
if (f.isnothrow && blockexit & BE.throw_)
error(funcdecl.loc, "%s `%s` may throw but is marked as `nothrow`", funcdecl.kind(), funcdecl.toPrettyChars());
- if (!(blockexit & (BE.throw_ | BE.halt) || funcdecl.flags & FUNCFLAG.hasCatches))
+ if (!(blockexit & (BE.throw_ | BE.halt) || funcdecl.hasCatches))
{
/* Don't generate unwind tables for this function
* https://issues.dlang.org/show_bug.cgi?id=17997
*/
- funcdecl.flags |= FUNCFLAG.noEH;
+ funcdecl.hasNoEH = true;
}
- if (funcdecl.flags & FUNCFLAG.nothrowInprocess)
+ if (funcdecl.nothrowInprocess)
{
if (funcdecl.type == f)
f = cast(TypeFunction)f.copy();
@@ -976,7 +976,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
/* Do the semantic analysis on the [in] preconditions and
* [out] postconditions.
*/
- immutable bool isnothrow = f.isnothrow && !(funcdecl.flags & FUNCFLAG.nothrowInprocess);
+ immutable bool isnothrow = f.isnothrow && !funcdecl.nothrowInprocess;
if (freq)
{
/* frequire is composed of the [in] contracts
@@ -1001,11 +1001,11 @@ private extern(C++) final class Semantic3Visitor : Visitor
// Deprecated in 2.101, can be made an error in 2.111
deprecation(funcdecl.loc, "`%s`: `in` contract may throw but function is marked as `nothrow`",
funcdecl.toPrettyChars());
- else if (funcdecl.flags & FUNCFLAG.nothrowInprocess)
+ else if (funcdecl.nothrowInprocess)
f.isnothrow = false;
}
- funcdecl.flags &= ~FUNCFLAG.noEH;
+ funcdecl.hasNoEH = false;
sc2 = sc2.pop();
@@ -1048,11 +1048,11 @@ private extern(C++) final class Semantic3Visitor : Visitor
// Deprecated in 2.101, can be made an error in 2.111
deprecation(funcdecl.loc, "`%s`: `out` contract may throw but function is marked as `nothrow`",
funcdecl.toPrettyChars());
- else if (funcdecl.flags & FUNCFLAG.nothrowInprocess)
+ else if (funcdecl.nothrowInprocess)
f.isnothrow = false;
}
- funcdecl.flags &= ~FUNCFLAG.noEH;
+ funcdecl.hasNoEH = false;
sc2 = sc2.pop();
@@ -1180,10 +1180,10 @@ private extern(C++) final class Semantic3Visitor : Visitor
const blockexit = s.blockExit(funcdecl, isnothrow);
if (blockexit & BE.throw_)
{
- funcdecl.flags &= ~FUNCFLAG.noEH;
+ funcdecl.hasNoEH = false;
if (isnothrow)
error(funcdecl.loc, "%s `%s` may throw but is marked as `nothrow`", funcdecl.kind(), funcdecl.toPrettyChars());
- else if (funcdecl.flags & FUNCFLAG.nothrowInprocess)
+ else if (funcdecl.nothrowInprocess)
f.isnothrow = false;
}
@@ -1195,7 +1195,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
}
}
// from this point on all possible 'throwers' are checked
- funcdecl.flags &= ~FUNCFLAG.nothrowInprocess;
+ funcdecl.nothrowInprocess = false;
if (funcdecl.isSynchronized())
{
@@ -1274,25 +1274,25 @@ private extern(C++) final class Semantic3Visitor : Visitor
/* If function survived being marked as impure, then it is pure
*/
- if (funcdecl.flags & FUNCFLAG.purityInprocess)
+ if (funcdecl.purityInprocess)
{
- funcdecl.flags &= ~FUNCFLAG.purityInprocess;
+ funcdecl.purityInprocess = false;
if (funcdecl.type == f)
f = cast(TypeFunction)f.copy();
f.purity = PURE.fwdref;
}
- if (funcdecl.flags & FUNCFLAG.safetyInprocess)
+ if (funcdecl.safetyInprocess)
{
- funcdecl.flags &= ~FUNCFLAG.safetyInprocess;
+ funcdecl.safetyInprocess = false;
if (funcdecl.type == f)
f = cast(TypeFunction)f.copy();
f.trust = TRUST.safe;
}
- if (funcdecl.flags & FUNCFLAG.nogcInprocess)
+ if (funcdecl.nogcInprocess)
{
- funcdecl.flags &= ~FUNCFLAG.nogcInprocess;
+ funcdecl.nogcInprocess = false;
if (funcdecl.type == f)
f = cast(TypeFunction)f.copy();
f.isnogc = true;
@@ -1395,9 +1395,9 @@ private extern(C++) final class Semantic3Visitor : Visitor
*/
funcdecl.semanticRun = PASS.semantic3done;
if ((global.errors != oldErrors) || (funcdecl.fbody && funcdecl.fbody.isErrorStatement()))
- funcdecl.flags |= FUNCFLAG.semantic3Errors;
+ funcdecl.hasSemantic3Errors = true;
else
- funcdecl.flags &= ~FUNCFLAG.semantic3Errors;
+ funcdecl.hasSemantic3Errors = false;
if (funcdecl.type.ty == Terror)
funcdecl.errors = true;
//printf("-FuncDeclaration::semantic3('%s.%s', sc = %p, loc = %s)\n", funcdecl.parent.toChars(), funcdecl.toChars(), sc, funcdecl.loc.toChars());
diff --git a/gcc/d/dmd/statementsem.d b/gcc/d/dmd/statementsem.d
index e5e5753..4f9baf8 100644
--- a/gcc/d/dmd/statementsem.d
+++ b/gcc/d/dmd/statementsem.d
@@ -2010,32 +2010,8 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor
//printf("body = %p\n", ps._body);
if (ps.ident == Id.msg)
{
- if (ps.args)
- {
- foreach (arg; *ps.args)
- {
- sc = sc.startCTFE();
- auto e = arg.expressionSemantic(sc);
- e = resolveProperties(sc, e);
- sc = sc.endCTFE();
-
- // pragma(msg) is allowed to contain types as well as expressions
- e = ctfeInterpretForPragmaMsg(e);
- if (e.op == EXP.error)
- {
- errorSupplemental(ps.loc, "while evaluating `pragma(msg, %s)`", arg.toChars());
- return setError();
- }
- if (auto se = e.toStringExp())
- {
- const slice = se.toUTF8(sc).peekString();
- fprintf(stderr, "%.*s", cast(int)slice.length, slice.ptr);
- }
- else
- fprintf(stderr, "%s", e.toChars());
- }
- fprintf(stderr, "\n");
- }
+ if (!pragmaMsgSemantic(ps.loc, sc, ps.args))
+ return setError();
}
else if (ps.ident == Id.lib)
{
@@ -2075,75 +2051,19 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor
}
else if (ps.ident == Id.startaddress)
{
- if (!ps.args || ps.args.dim != 1)
- ps.error("function name expected for start address");
- else
- {
- Expression e = (*ps.args)[0];
- sc = sc.startCTFE();
- e = e.expressionSemantic(sc);
- e = resolveProperties(sc, e);
- sc = sc.endCTFE();
-
- e = e.ctfeInterpret();
- (*ps.args)[0] = e;
- Dsymbol sa = getDsymbol(e);
- if (!sa || !sa.isFuncDeclaration())
- {
- ps.error("function name expected for start address, not `%s`", e.toChars());
- return setError();
- }
- if (ps._body)
- {
- ps._body = ps._body.statementSemantic(sc);
- if (ps._body.isErrorStatement())
- {
- result = ps._body;
- return;
- }
- }
- result = ps;
- return;
- }
+ if (!pragmaStartAddressSemantic(ps.loc, sc, ps.args))
+ return setError();
}
else if (ps.ident == Id.Pinline)
{
- PINLINE inlining = PINLINE.default_;
- if (!ps.args || ps.args.dim == 0)
- inlining = PINLINE.default_;
- else if (!ps.args || ps.args.dim != 1)
+ if (auto fd = sc.func)
{
- ps.error("boolean expression expected for `pragma(inline)`");
- return setError();
+ fd.inlining = evalPragmaInline(ps.loc, sc, ps.args);
}
else
{
- Expression e = (*ps.args)[0];
- sc = sc.startCTFE();
- e = e.expressionSemantic(sc);
- e = resolveProperties(sc, e);
- sc = sc.endCTFE();
- e = e.ctfeInterpret();
- e = e.toBoolean(sc);
- if (e.isErrorExp())
- {
- ps.error("pragma(`inline`, `true` or `false`) expected, not `%s`", (*ps.args)[0].toChars());
- return setError();
- }
-
- const opt = e.toBool();
- if (opt.hasValue(true))
- inlining = PINLINE.always;
- else if (opt.hasValue(false))
- inlining = PINLINE.never;
-
- FuncDeclaration fd = sc.func;
- if (!fd)
- {
- ps.error("`pragma(inline)` is not inside a function");
- return setError();
- }
- fd.inlining = inlining;
+ ps.error("`pragma(inline)` is not inside a function");
+ return setError();
}
}
else if (!global.params.ignoreUnsupportedPragmas)
@@ -2932,13 +2852,7 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor
}
// https://issues.dlang.org/show_bug.cgi?id=23063
- if (texp.isTypeNoreturn() && !rs.exp.isAssertExp() && !rs.exp.isThrowExp() && !rs.exp.isCallExp())
- {
- auto msg = new StringExp(rs.exp.loc, "Accessed expression of type `noreturn`");
- msg.type = Type.tstring;
- rs.exp = new AssertExp(rs.loc, IntegerExp.literal!0, msg);
- rs.exp.type = texp;
- }
+ rs.exp = checkNoreturnVarAccess(rs.exp);
// @@@DEPRECATED_2.111@@@
const olderrors = global.startGagging();
@@ -3022,7 +2936,7 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor
// If we previously assumed the function could be ref when
// checking for `shared`, make sure we were right
- if (global.params.noSharedAccess && rs.exp.type.isShared())
+ if (global.params.noSharedAccess == FeatureState.enabled && rs.exp.type.isShared())
{
fd.error("function returns `shared` but cannot be inferred `ref`");
supplemental();
@@ -3648,7 +3562,7 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor
if (sc.func)
{
- sc.func.flags |= FUNCFLAG.hasCatches;
+ sc.func.hasCatches = true;
if (flags == (FLAGcpp | FLAGd))
{
tcs.error("cannot mix catching D and C++ exceptions in the same try-catch");
@@ -4925,3 +4839,83 @@ private void debugThrowWalker(Statement s)
scope walker = new DebugWalker();
s.accept(walker);
}
+
+/***********************************************************
+ * Evaluate and print a `pragma(msg, args)`
+ *
+ * Params:
+ * loc = location for error messages
+ * sc = scope for argument interpretation
+ * args = expressions to print
+ * Returns:
+ * `true` on success
+ */
+bool pragmaMsgSemantic(Loc loc, Scope* sc, Expressions* args)
+{
+ if (!args)
+ return true;
+ foreach (arg; *args)
+ {
+ sc = sc.startCTFE();
+ auto e = arg.expressionSemantic(sc);
+ e = resolveProperties(sc, e);
+ sc = sc.endCTFE();
+
+ // pragma(msg) is allowed to contain types as well as expressions
+ e = ctfeInterpretForPragmaMsg(e);
+ if (e.op == EXP.error)
+ {
+ errorSupplemental(loc, "while evaluating `pragma(msg, %s)`", arg.toChars());
+ return false;
+ }
+ if (auto se = e.toStringExp())
+ {
+ const slice = se.toUTF8(sc).peekString();
+ fprintf(stderr, "%.*s", cast(int)slice.length, slice.ptr);
+ }
+ else
+ fprintf(stderr, "%s", e.toChars());
+ }
+ fprintf(stderr, "\n");
+ return true;
+}
+
+/***********************************************************
+ * Evaluate `pragma(startAddress, func)` and store the resolved symbol in `args`
+ *
+ * Params:
+ * loc = location for error messages
+ * sc = scope for argument interpretation
+ * args = pragma arguments
+ * Returns:
+ * `true` on success
+ */
+bool pragmaStartAddressSemantic(Loc loc, Scope* sc, Expressions* args)
+{
+ if (!args || args.dim != 1)
+ {
+ .error(loc, "function name expected for start address");
+ return false;
+ }
+ else
+ {
+ /* https://issues.dlang.org/show_bug.cgi?id=11980
+ * resolveProperties and ctfeInterpret call are not necessary.
+ */
+ Expression e = (*args)[0];
+ sc = sc.startCTFE();
+ e = e.expressionSemantic(sc);
+ // e = resolveProperties(sc, e);
+ sc = sc.endCTFE();
+
+ // e = e.ctfeInterpret();
+ (*args)[0] = e;
+ Dsymbol sa = getDsymbol(e);
+ if (!sa || !sa.isFuncDeclaration())
+ {
+ .error(loc, "function name expected for start address, not `%s`", e.toChars());
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/gcc/d/dmd/templateparamsem.d b/gcc/d/dmd/templateparamsem.d
index e093260..e79a9ec 100644
--- a/gcc/d/dmd/templateparamsem.d
+++ b/gcc/d/dmd/templateparamsem.d
@@ -73,6 +73,15 @@ private extern (C++) final class TemplateParameterSemanticVisitor : Visitor
result = !(ttp.specType && isError(ttp.specType));
}
+ override void visit(TemplateThisParameter ttp)
+ {
+ import dmd.errors;
+
+ if (!sc.getStructClassScope())
+ error(ttp.loc, "cannot use `this` outside an aggregate type");
+ visit(cast(TemplateTypeParameter)ttp);
+ }
+
override void visit(TemplateValueParameter tvp)
{
tvp.valType = tvp.valType.typeSemantic(tvp.loc, sc);
diff --git a/gcc/d/dmd/transitivevisitor.d b/gcc/d/dmd/transitivevisitor.d
index 0d7240f..cbe6daa 100644
--- a/gcc/d/dmd/transitivevisitor.d
+++ b/gcc/d/dmd/transitivevisitor.d
@@ -799,6 +799,15 @@ package mixin template ParseVisitMethods(AST)
s.accept(this);
}
+ override void visit(AST.InterfaceDeclaration d)
+ {
+ //printf("Visiting InterfaceDeclaration\n");
+ visitBaseClasses(d);
+ if (d.members)
+ foreach (s; *d.members)
+ s.accept(this);
+ }
+
override void visit(AST.AliasDeclaration d)
{
//printf("Visting AliasDeclaration\n");
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc
index fa5ec90..e939e77 100644
--- a/gcc/d/expr.cc
+++ b/gcc/d/expr.cc
@@ -1099,6 +1099,7 @@ public:
this assignment should call dtors on old assigned elements. */
if ((!postblit && !destructor)
|| (e->op == EXP::construct && e->e2->op == EXP::arrayLiteral)
+ || (e->op == EXP::construct && e->e2->op == EXP::call)
|| (e->op == EXP::construct && !lvalue && postblit)
|| (e->op == EXP::blit || e->e1->type->size () == 0))
{
@@ -2704,6 +2705,14 @@ public:
this->result_ = compound_expr (saved_elems, d_convert (type, ctor));
}
+ else if (e->onstack)
+ {
+ /* Array literal for a `scope' dynamic array. */
+ gcc_assert (tb->ty == TY::Tarray);
+ ctor = force_target_expr (ctor);
+ this->result_ = d_array_value (type, size_int (e->elements->length),
+ build_address (ctor));
+ }
else
{
/* Allocate space on the memory managed heap. */
diff --git a/gcc/d/gdc.texi b/gcc/d/gdc.texi
index 2bff627..d3bf75c 100644
--- a/gcc/d/gdc.texi
+++ b/gcc/d/gdc.texi
@@ -344,6 +344,9 @@ Turns on generation of struct equality to use field-wise comparisons.
@item fixaliasthis
Implements new lookup rules that check the current scope for @code{alias this}
before searching in upper scopes.
+@item fiximmutableconv
+Disallows unsound immutable conversions that were formerly incorrectly
+permitted.
@item in
Implements @code{in} parameters to mean @code{scope const [ref]} and accepts
rvalues.
@@ -357,9 +360,8 @@ expressions.
Turns off and disallows all access to shared memory objects.
@item rvaluerefparam
Implements rvalue arguments to @code{ref} parameters.
-@item shortenedmethods
-Implements use of @code{=>} for methods and top-level functions in addition to
-lambdas.
+@item systemvariables
+Disables access to variables marked @code{@@system} from @code{@@safe} code.
@end table
@item -frelease
diff --git a/gcc/d/lang.opt b/gcc/d/lang.opt
index da65239..15ab725 100644
--- a/gcc/d/lang.opt
+++ b/gcc/d/lang.opt
@@ -396,9 +396,9 @@ fpreview=rvaluerefparam
D RejectNegative
Enable rvalue arguments to ref parameters.
-fpreview=shortenedmethods
+fpreview=systemvariables
D RejectNegative
-Allow use of '=>' for methods and top-level functions in addition to lambdas.
+Disable access to variables marked `@system' from @safe code.
frelease
D
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc
index 0aac8fe..4f91853 100644
--- a/gcc/d/modules.cc
+++ b/gcc/d/modules.cc
@@ -438,11 +438,11 @@ register_moduleinfo (Module *decl, tree minfo)
if (!first_module)
return;
- start_minfo_node = build_dso_registry_var (targetdm.d_minfo_start_name,
+ start_minfo_node = build_dso_registry_var (targetdm.d_minfo_section_start,
ptr_type_node);
rest_of_decl_compilation (start_minfo_node, 1, 0);
- stop_minfo_node = build_dso_registry_var (targetdm.d_minfo_end_name,
+ stop_minfo_node = build_dso_registry_var (targetdm.d_minfo_section_end,
ptr_type_node);
rest_of_decl_compilation (stop_minfo_node, 1, 0);
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index ba90bfa..53478b7 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7070,6 +7070,11 @@ Enable/disable the generation of the AVXIFMA instructions.
@cindex @code{target("avxvnniint8")} function attribute, x86
Enable/disable the generation of the AVXVNNIINT8 instructions.
+@item avxneconvert
+@itemx no-avxneconvert
+@cindex @code{target("avxneconvert")} function attribute, x86
+Enable/disable the generation of the AVXNECONVERT instructions.
+
@item cld
@itemx no-cld
@cindex @code{target("cld")} function attribute, x86
@@ -15755,6 +15760,83 @@ Load 32-bits from the @code{struct sk_buff} packet data pointed by the register
BPF Compile Once-Run Everywhere (CO-RE) support. Instruct GCC to generate CO-RE relocation records for any accesses to aggregate data structures (struct, union, array types) in @var{expr}. This builtin is otherwise transparent, the return value is whatever @var{expr} evaluates to. It is also overloaded: @var{expr} may be of any type (not necessarily a pointer), the return type is the same. Has no effect if @code{-mco-re} is not in effect (either specified or implied).
@end deftypefn
+@deftypefn {Built-in Function} unsigned int __builtin_preserve_field_info (@var{expr}, unsigned int @var{kind})
+BPF Compile Once-Run Everywhere (CO-RE) support. This builtin is used to
+extract information to aid in struct/union relocations. @var{expr} is
+an access to a field of a struct or union. Depending on @var{kind}, different
+information is returned to the program. A CO-RE relocation for the access in
+@var{expr} with kind @var{kind} is recorded if @code{-mco-re} is in effect.
+
+The following values are supported for @var{kind}:
+@table @var
+@item FIELD_BYTE_OFFSET = 0
+The returned value is the offset, in bytes, of the field from the
+beginning of the containing structure. For bitfields, the byte offset
+of the containing word.
+
+@item FIELD_BYTE_SIZE = 1
+The returned value is the size, in bytes, of the field. For bitfields,
+the size in bytes of the containing word.
+
+@item FIELD_EXISTENCE = 2
+The returned value is 1 if the field exists, 0 otherwise. Always 1 at
+compile time.
+
+@item FIELD_SIGNEDNESS = 3
+The returned value is 1 if the field is signed, 0 otherwise.
+
+@item FIELD_LSHIFT_U64 = 4
+@itemx FIELD_RSHIFT_U64 = 5
+The returned value is the number of bits of left- or right-shifting
+respectively needed in order to recover the original value of the field,
+after it has been loaded by a read of FIELD_BYTE_SIZE bytes into an
+unsigned 64-bit value. Primarily useful for reading bitfield values
+from structures which may change between kernel versions.
+
+@end table
+
+Note that the return value is a constant which is known at
+compile-time. If the field has a variable offset then
+FIELD_BYTE_OFFSET, FIELD_LSHIFT_U64 and FIELD_RSHIFT_U64 are not
+supported. Similarly, if the field has a variable size then
+FIELD_BYTE_SIZE, FIELD_LSHIFT_U64 and FIELD_RSHIFT_U64 are not
+supported.
+
+For example, __builtin_preserve_field_info can be used to reliably
+extract bitfield values from a structure which may change between
+kernel versions:
+
+@example
+struct S
+@{
+ short a;
+ int x:7;
+ int y:5;
+@};
+
+int
+read_y (struct S *arg)
+@{
+ unsigned long long val;
+ unsigned int offset = __builtin_preserve_field_info (arg->y, FIELD_BYTE_OFFSET);
+ unsigned int size = __builtin_presrve_field_info (arg->y, FIELD_BYTE_SIZE);
+
+ /* Read size bytes from arg + offset into val. */
+ bpf_probe_read (&val, size, arg + offset);
+
+ val <<= __builtin_preserve_field_info (arg->y, FIELD_LSHIFT_U64);
+
+ if (__builtin_preserve_field_info (arg->y, FIELD_SIGNEDNESS))
+ val = ((long long) val >> __builtin_preserve_field_info (arg->y, FIELD_RSHIFT_U64));
+ else
+ val >>= __builtin_preserve_field_info (arg->y, FIELD_RSHIFT_U64);
+
+ return val;
+@}
+
+@end example
+@end deftypefn
+
@node FR-V Built-in Functions
@subsection FR-V Built-in Functions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 64f77e8..c6323a5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -198,7 +198,7 @@ in the following sections.
@item C Language Options
@xref{C Dialect Options,,Options Controlling C Dialect}.
@gccoptlist{-ansi -std=@var{standard} -aux-info @var{filename} @gol
--fallow-parameterless-variadic-functions -fno-asm @gol
+-fno-asm @gol
-fno-builtin -fno-builtin-@var{function} -fcond-mismatch @gol
-ffreestanding -fgimple -fgnu-tm -fgnu89-inline -fhosted @gol
-flax-vector-conversions -fms-extensions @gol
@@ -249,7 +249,8 @@ in the following sections.
-Wno-class-conversion -Wclass-memaccess @gol
-Wcomma-subscript -Wconditionally-supported @gol
-Wno-conversion-null -Wctad-maybe-unsupported @gol
--Wctor-dtor-privacy -Wno-delete-incomplete @gol
+-Wctor-dtor-privacy -Wdangling-reference @gol
+-Wno-delete-incomplete @gol
-Wdelete-non-virtual-dtor -Wno-deprecated-array-compare @gol
-Wdeprecated-copy -Wdeprecated-copy-dtor @gol
-Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol
@@ -1436,7 +1437,7 @@ See RS/6000 and PowerPC Options.
-mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
-mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
-mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol
--mavx512fp16 -mavxifma -mavxvnniint8 @gol
+-mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert @gol
-mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
-mkl -mwidekl @gol
@@ -2514,14 +2515,6 @@ character). In the case of function definitions, a K&R-style list of
arguments followed by their declarations is also provided, inside
comments, after the declaration.
-@item -fallow-parameterless-variadic-functions
-@opindex fallow-parameterless-variadic-functions
-Accept variadic functions without named parameters.
-
-Although it is possible to define such a function, this is not very
-useful as it is not possible to read the arguments. This is only
-supported for C as this construct is allowed by C++.
-
@item -fno-asm
@opindex fno-asm
@opindex fasm
@@ -3627,6 +3620,54 @@ public static member functions. Also warn if there are no non-private
methods, and there's at least one private member function that isn't
a constructor or destructor.
+@item -Wdangling-reference @r{(C++ and Objective-C++ only)}
+@opindex Wdangling-reference
+@opindex Wno-dangling-reference
+Warn when a reference is bound to a temporary whose lifetime has ended.
+For example:
+
+@smallexample
+int n = 1;
+const int& r = std::max(n - 1, n + 1); // r is dangling
+@end smallexample
+
+In the example above, two temporaries are created, one for each
+argument, and a reference to one of the temporaries is returned.
+However, both temporaries are destroyed at the end of the full
+expression, so the reference @code{r} is dangling. This warning
+also detects dangling references in member initializer lists:
+
+@smallexample
+const int& f(const int& i) @{ return i; @}
+struct S @{
+ const int &r; // r is dangling
+ S() : r(f(10)) @{ @}
+@};
+@end smallexample
+
+Member functions are checked as well, but only their object argument:
+
+@smallexample
+struct S @{
+ const S& self () @{ return *this; @}
+@};
+const S& s = S().self(); // s is dangling
+@end smallexample
+
+Certain functions are safe in this respect, for example @code{std::use_facet}:
+they take and return a reference, but they don't return one of its arguments,
+which can fool the warning. Such functions can be excluded from the warning
+by wrapping them in a @code{#pragma}:
+
+@smallexample
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-reference"
+const T& foo (const T&) @{ @dots{} @}
+#pragma GCC diagnostic pop
+@end smallexample
+
+This warning is enabled by @option{-Wall}.
+
@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
@opindex Wdelete-non-virtual-dtor
@opindex Wno-delete-non-virtual-dtor
@@ -16460,6 +16501,10 @@ by this option.
@end table
+Note the enabled sanitizer options tend to increase a false-positive rate
+of selected warnings, most notably @option{-Wmaybe-uninitialized}.
+And thus we recommend to disable @option{-Werror}.
+
While @option{-ftrapv} causes traps for signed overflows to be emitted,
@option{-fsanitize=undefined} gives a diagnostic message.
This currently works only for the C family of languages.
@@ -32922,6 +32967,9 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@need 200
@itemx -mavxvnniint8
@opindex mavxvnniint8
+@need 200
+@itemx -mavxneconvert
+@opindex mavxneconvert
These switches enable the use of instructions in the MMX, SSE,
SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
@@ -32932,8 +32980,8 @@ XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16,
-AVXIFMA, AVXVNNIINT8 or CLDEMOTE extended instruction sets. Each has a
-corresponding @option{-mno-} option to disable use of these instructions.
+AVXIFMA, AVXVNNIINT8, AVXNECONVERT or CLDEMOTE extended instruction sets. Each
+has a corresponding @option{-mno-} option to disable use of these instructions.
These extensions are also available as built-in functions: see
@ref{x86 Built-in Functions}, for details of the functions enabled and
diff --git a/gcc/doc/makefile.texi b/gcc/doc/makefile.texi
index fe0bbcd..5186c1c 100644
--- a/gcc/doc/makefile.texi
+++ b/gcc/doc/makefile.texi
@@ -135,6 +135,16 @@ Compares the results of stages 2 and 3. This ensures that the compiler
is running properly, since it should produce the same object files
regardless of how it itself was compiled.
+@item distclean-stage@var{N} (@var{N} = 1@dots{}4, profile, feedback)
+Wipe stage @var{N} and all the following ones.
+
+For example,
+@samp{make distclean-stage3} wipes stage 3 and all the following ones,
+so that another @command{make} then rebuilds them from scratch.
+This can be useful if you're doing changes where
+``bubbling'' the changes as described above is not sufficient,
+but a full @command{make restrap} isn't necessary either.
+
@item profiledbootstrap
Builds a compiler with profiling feedback information. In this case,
the second and third stages are named @samp{profile} and @samp{feedback},
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index e21a1d3..a12175b 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2493,6 +2493,9 @@ Target supports the execution of @code{avx512vp2intersect} instructions.
@item avxifma
Target supports the execution of @code{avxifma} instructions.
+@item avxneconvert
+Target supports the execution of @code{avxneconvert} instructions.
+
@item avxvnniint8
Target supports the execution of @code{avxvnniint8} instructions.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 110f8df..8572313 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5378,7 +5378,9 @@ pass all their arguments on the stack.
The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} data
structure, containing the values that are obtained after processing the
named arguments. The argument @var{arg} describes the last of these named
-arguments.
+arguments. The argument @var{arg} should not be used if the function type
+satisfies @code{TYPE_NO_NAMED_ARGS_STDARG_P}, since in that case there are
+no named arguments and all arguments are accessed with @code{va_arg}.
The target hook should do two things: first, push onto the stack all the
argument registers @emph{not} used for the named arguments, and second,
@@ -10848,19 +10850,23 @@ the target operating system.
@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_SECTION
Contains the name of the section in which module info references should be
-placed. This section is expected to be bracketed by two symbols to indicate
-the start and end address of the section, so that the runtime library can
-collect all modules for each loaded shared library and executable. The
-default value of @code{NULL} disables the use of sections altogether.
+placed. By default, the compiler puts all module info symbols in the
+@code{"minfo"} section. Define this macro to override the string if a
+different section name should be used. This section is expected to be
+bracketed by two symbols @code{TARGET_D_MINFO_SECTION_START} and
+@code{TARGET_D_MINFO_SECTION_END} to indicate the start and end address of
+the section, so that the runtime library can collect all modules for each
+loaded shared library and executable. Setting the value to @code{NULL}
+disables the use of sections for storing module info altogether.
@end deftypevr
-@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_START_NAME
+@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_SECTION_START
If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined
as the name of the symbol indicating the start address of the module info
section
@end deftypevr
-@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_END_NAME
+@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_SECTION_END
If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined
as the name of the symbol indicating the end address of the module info
section
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 501ddf1..986e8f0 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7117,9 +7117,9 @@ floating-point support; they are not included in this mechanism.
@hook TARGET_D_MINFO_SECTION
-@hook TARGET_D_MINFO_START_NAME
+@hook TARGET_D_MINFO_SECTION_START
-@hook TARGET_D_MINFO_END_NAME
+@hook TARGET_D_MINFO_SECTION_END
@hook TARGET_D_HAS_STDCALL_CONVENTION
diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc
index 3971000..748dd0c 100644
--- a/gcc/dwarf2ctf.cc
+++ b/gcc/dwarf2ctf.cc
@@ -736,6 +736,7 @@ gen_ctf_enumeration_type (ctf_container_ref ctfc, dw_die_ref enumeration)
{
const char *enum_name = get_AT_string (enumeration, DW_AT_name);
unsigned int bit_size = ctf_die_bitsize (enumeration);
+ unsigned int signedness = get_AT_unsigned (enumeration, DW_AT_encoding);
int declaration_p = get_AT_flag (enumeration, DW_AT_declaration);
ctf_id_t enumeration_type_id;
@@ -759,7 +760,9 @@ gen_ctf_enumeration_type (ctf_container_ref ctfc, dw_die_ref enumeration)
/* Generate a CTF type for the enumeration. */
enumeration_type_id = ctf_add_enum (ctfc, CTF_ADD_ROOT,
- enum_name, bit_size / 8, enumeration);
+ enum_name, bit_size / 8,
+ (signedness == DW_ATE_unsigned),
+ enumeration);
/* Process the enumerators. */
{
diff --git a/gcc/expr.cc b/gcc/expr.cc
index efe387e..9145193 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -7905,8 +7905,7 @@ get_inner_reference (tree exp, poly_int64_pod *pbitsize,
/* For vector fields re-check the target flags, as DECL_MODE
could have been set with different target flags than
the current function has. */
- if (mode == BLKmode
- && VECTOR_TYPE_P (TREE_TYPE (field))
+ if (VECTOR_TYPE_P (TREE_TYPE (field))
&& VECTOR_MODE_P (TYPE_MODE_RAW (TREE_TYPE (field))))
mode = TYPE_MODE (TREE_TYPE (field));
}
diff --git a/gcc/fold-const-call.cc b/gcc/fold-const-call.cc
index 7e0d671..8ceed8f 100644
--- a/gcc/fold-const-call.cc
+++ b/gcc/fold-const-call.cc
@@ -734,64 +734,82 @@ fold_const_call_ss (real_value *result, combined_fn fn,
&& do_mpfr_arg1 (result, mpfr_sqrt, arg, format));
CASE_CFN_CBRT:
+ CASE_CFN_CBRT_FN:
return do_mpfr_arg1 (result, mpfr_cbrt, arg, format);
CASE_CFN_ASIN:
+ CASE_CFN_ASIN_FN:
return (real_compare (GE_EXPR, arg, &dconstm1)
&& real_compare (LE_EXPR, arg, &dconst1)
&& do_mpfr_arg1 (result, mpfr_asin, arg, format));
CASE_CFN_ACOS:
+ CASE_CFN_ACOS_FN:
return (real_compare (GE_EXPR, arg, &dconstm1)
&& real_compare (LE_EXPR, arg, &dconst1)
&& do_mpfr_arg1 (result, mpfr_acos, arg, format));
CASE_CFN_ATAN:
+ CASE_CFN_ATAN_FN:
return do_mpfr_arg1 (result, mpfr_atan, arg, format);
CASE_CFN_ASINH:
+ CASE_CFN_ASINH_FN:
return do_mpfr_arg1 (result, mpfr_asinh, arg, format);
CASE_CFN_ACOSH:
+ CASE_CFN_ACOSH_FN:
return (real_compare (GE_EXPR, arg, &dconst1)
&& do_mpfr_arg1 (result, mpfr_acosh, arg, format));
CASE_CFN_ATANH:
+ CASE_CFN_ATANH_FN:
return (real_compare (GE_EXPR, arg, &dconstm1)
&& real_compare (LE_EXPR, arg, &dconst1)
&& do_mpfr_arg1 (result, mpfr_atanh, arg, format));
CASE_CFN_SIN:
+ CASE_CFN_SIN_FN:
return do_mpfr_arg1 (result, mpfr_sin, arg, format);
CASE_CFN_COS:
+ CASE_CFN_COS_FN:
return do_mpfr_arg1 (result, mpfr_cos, arg, format);
CASE_CFN_TAN:
+ CASE_CFN_TAN_FN:
return do_mpfr_arg1 (result, mpfr_tan, arg, format);
CASE_CFN_SINH:
+ CASE_CFN_SINH_FN:
return do_mpfr_arg1 (result, mpfr_sinh, arg, format);
CASE_CFN_COSH:
+ CASE_CFN_COSH_FN:
return do_mpfr_arg1 (result, mpfr_cosh, arg, format);
CASE_CFN_TANH:
+ CASE_CFN_TANH_FN:
return do_mpfr_arg1 (result, mpfr_tanh, arg, format);
CASE_CFN_ERF:
+ CASE_CFN_ERF_FN:
return do_mpfr_arg1 (result, mpfr_erf, arg, format);
CASE_CFN_ERFC:
+ CASE_CFN_ERFC_FN:
return do_mpfr_arg1 (result, mpfr_erfc, arg, format);
CASE_CFN_TGAMMA:
+ CASE_CFN_TGAMMA_FN:
return do_mpfr_arg1 (result, mpfr_gamma, arg, format);
CASE_CFN_EXP:
+ CASE_CFN_EXP_FN:
return do_mpfr_arg1 (result, mpfr_exp, arg, format);
CASE_CFN_EXP2:
+ CASE_CFN_EXP2_FN:
return do_mpfr_arg1 (result, mpfr_exp2, arg, format);
CASE_CFN_EXP10:
@@ -799,21 +817,26 @@ fold_const_call_ss (real_value *result, combined_fn fn,
return do_mpfr_arg1 (result, mpfr_exp10, arg, format);
CASE_CFN_EXPM1:
+ CASE_CFN_EXPM1_FN:
return do_mpfr_arg1 (result, mpfr_expm1, arg, format);
CASE_CFN_LOG:
+ CASE_CFN_LOG_FN:
return (real_compare (GT_EXPR, arg, &dconst0)
&& do_mpfr_arg1 (result, mpfr_log, arg, format));
CASE_CFN_LOG2:
+ CASE_CFN_LOG2_FN:
return (real_compare (GT_EXPR, arg, &dconst0)
&& do_mpfr_arg1 (result, mpfr_log2, arg, format));
CASE_CFN_LOG10:
+ CASE_CFN_LOG10_FN:
return (real_compare (GT_EXPR, arg, &dconst0)
&& do_mpfr_arg1 (result, mpfr_log10, arg, format));
CASE_CFN_LOG1P:
+ CASE_CFN_LOG1P_FN:
return (real_compare (GT_EXPR, arg, &dconstm1)
&& do_mpfr_arg1 (result, mpfr_log1p, arg, format));
@@ -877,6 +900,7 @@ fold_const_call_ss (real_value *result, combined_fn fn,
return false;
CASE_CFN_LOGB:
+ CASE_CFN_LOGB_FN:
return fold_const_logb (result, arg, format);
CASE_CFN_SIGNIFICAND:
@@ -909,6 +933,7 @@ fold_const_call_ss (wide_int *result, combined_fn fn,
return true;
CASE_CFN_ILOGB:
+ CASE_CFN_ILOGB_FN:
/* For ilogb we don't know FP_ILOGB0, so only handle normal values.
Proceed iff radix == 2. In GCC, normalized significands are in
the range [0.5, 1.0). We want the exponent as if they were
@@ -934,13 +959,17 @@ fold_const_call_ss (wide_int *result, combined_fn fn,
CASE_CFN_IROUND:
CASE_CFN_LROUND:
+ CASE_CFN_LROUND_FN:
CASE_CFN_LLROUND:
+ CASE_CFN_LLROUND_FN:
return fold_const_conversion (result, real_round, arg,
precision, format);
CASE_CFN_IRINT:
CASE_CFN_LRINT:
+ CASE_CFN_LRINT_FN:
CASE_CFN_LLRINT:
+ CASE_CFN_LLRINT_FN:
/* Not yet folded to a constant. */
return false;
@@ -1083,6 +1112,7 @@ fold_const_call_sc (real_value *result, combined_fn fn,
switch (fn)
{
CASE_CFN_CABS:
+ CASE_CFN_CABS_FN:
return do_mpfr_arg2 (result, mpfr_hypot, arg_real, arg_imag, format);
default:
@@ -1106,14 +1136,17 @@ fold_const_call_cc (real_value *result_real, real_value *result_imag,
switch (fn)
{
CASE_CFN_CCOS:
+ CASE_CFN_CCOS_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_cos,
arg_real, arg_imag, format);
CASE_CFN_CCOSH:
+ CASE_CFN_CCOSH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_cosh,
arg_real, arg_imag, format);
CASE_CFN_CPROJ:
+ CASE_CFN_CPROJ_FN:
if (real_isinf (arg_real) || real_isinf (arg_imag))
{
*result_real = dconstinf;
@@ -1128,54 +1161,67 @@ fold_const_call_cc (real_value *result_real, real_value *result_imag,
return true;
CASE_CFN_CSIN:
+ CASE_CFN_CSIN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_sin,
arg_real, arg_imag, format);
CASE_CFN_CSINH:
+ CASE_CFN_CSINH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_sinh,
arg_real, arg_imag, format);
CASE_CFN_CTAN:
+ CASE_CFN_CTAN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_tan,
arg_real, arg_imag, format);
CASE_CFN_CTANH:
+ CASE_CFN_CTANH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_tanh,
arg_real, arg_imag, format);
CASE_CFN_CLOG:
+ CASE_CFN_CLOG_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_log,
arg_real, arg_imag, format);
CASE_CFN_CSQRT:
+ CASE_CFN_CSQRT_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_sqrt,
arg_real, arg_imag, format);
CASE_CFN_CASIN:
+ CASE_CFN_CASIN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_asin,
arg_real, arg_imag, format);
CASE_CFN_CACOS:
+ CASE_CFN_CACOS_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_acos,
arg_real, arg_imag, format);
CASE_CFN_CATAN:
+ CASE_CFN_CATAN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_atan,
arg_real, arg_imag, format);
CASE_CFN_CASINH:
+ CASE_CFN_CASINH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_asinh,
arg_real, arg_imag, format);
CASE_CFN_CACOSH:
+ CASE_CFN_CACOSH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_acosh,
arg_real, arg_imag, format);
CASE_CFN_CATANH:
+ CASE_CFN_CATANH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_atanh,
arg_real, arg_imag, format);
CASE_CFN_CEXP:
+ CASE_CFN_CEXP_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_exp,
arg_real, arg_imag, format);
@@ -1370,18 +1416,23 @@ fold_const_call_sss (real_value *result, combined_fn fn,
{
CASE_CFN_DREM:
CASE_CFN_REMAINDER:
+ CASE_CFN_REMAINDER_FN:
return do_mpfr_arg2 (result, mpfr_remainder, arg0, arg1, format);
CASE_CFN_ATAN2:
+ CASE_CFN_ATAN2_FN:
return do_mpfr_arg2 (result, mpfr_atan2, arg0, arg1, format);
CASE_CFN_FDIM:
+ CASE_CFN_FDIM_FN:
return do_mpfr_arg2 (result, mpfr_dim, arg0, arg1, format);
CASE_CFN_FMOD:
+ CASE_CFN_FMOD_FN:
return do_mpfr_arg2 (result, mpfr_fmod, arg0, arg1, format);
CASE_CFN_HYPOT:
+ CASE_CFN_HYPOT_FN:
return do_mpfr_arg2 (result, mpfr_hypot, arg0, arg1, format);
CASE_CFN_COPYSIGN:
@@ -1399,9 +1450,12 @@ fold_const_call_sss (real_value *result, combined_fn fn,
return do_mpfr_arg2 (result, mpfr_max, arg0, arg1, format);
CASE_CFN_POW:
+ CASE_CFN_POW_FN:
return fold_const_pow (result, arg0, arg1, format);
CASE_CFN_NEXTAFTER:
+ CASE_CFN_NEXTAFTER_FN:
+ case CFN_BUILT_IN_NEXTAFTERF16B:
CASE_CFN_NEXTTOWARD:
return fold_const_nextafter (result, arg0, arg1, format);
@@ -1425,10 +1479,13 @@ fold_const_call_sss (real_value *result, combined_fn fn,
switch (fn)
{
CASE_CFN_LDEXP:
+ CASE_CFN_LDEXP_FN:
return fold_const_builtin_load_exponent (result, arg0, arg1, format);
CASE_CFN_SCALBN:
+ CASE_CFN_SCALBN_FN:
CASE_CFN_SCALBLN:
+ CASE_CFN_SCALBLN_FN:
return (format->b == 2
&& fold_const_builtin_load_exponent (result, arg0, arg1,
format));
@@ -1492,6 +1549,7 @@ fold_const_call_ccc (real_value *result_real, real_value *result_imag,
switch (fn)
{
CASE_CFN_CPOW:
+ CASE_CFN_CPOW_FN:
return do_mpc_arg2 (result_real, result_imag, mpc_pow,
arg0_real, arg0_imag, arg1_real, arg1_imag, format);
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 9f7beae..7e1ea58 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -322,36 +322,62 @@ negate_mathfn_p (combined_fn fn)
switch (fn)
{
CASE_CFN_ASIN:
+ CASE_CFN_ASIN_FN:
CASE_CFN_ASINH:
+ CASE_CFN_ASINH_FN:
CASE_CFN_ATAN:
+ CASE_CFN_ATAN_FN:
CASE_CFN_ATANH:
+ CASE_CFN_ATANH_FN:
CASE_CFN_CASIN:
+ CASE_CFN_CASIN_FN:
CASE_CFN_CASINH:
+ CASE_CFN_CASINH_FN:
CASE_CFN_CATAN:
+ CASE_CFN_CATAN_FN:
CASE_CFN_CATANH:
+ CASE_CFN_CATANH_FN:
CASE_CFN_CBRT:
+ CASE_CFN_CBRT_FN:
CASE_CFN_CPROJ:
+ CASE_CFN_CPROJ_FN:
CASE_CFN_CSIN:
+ CASE_CFN_CSIN_FN:
CASE_CFN_CSINH:
+ CASE_CFN_CSINH_FN:
CASE_CFN_CTAN:
+ CASE_CFN_CTAN_FN:
CASE_CFN_CTANH:
+ CASE_CFN_CTANH_FN:
CASE_CFN_ERF:
+ CASE_CFN_ERF_FN:
CASE_CFN_LLROUND:
+ CASE_CFN_LLROUND_FN:
CASE_CFN_LROUND:
+ CASE_CFN_LROUND_FN:
CASE_CFN_ROUND:
CASE_CFN_ROUNDEVEN:
CASE_CFN_ROUNDEVEN_FN:
CASE_CFN_SIN:
+ CASE_CFN_SIN_FN:
CASE_CFN_SINH:
+ CASE_CFN_SINH_FN:
CASE_CFN_TAN:
+ CASE_CFN_TAN_FN:
CASE_CFN_TANH:
+ CASE_CFN_TANH_FN:
CASE_CFN_TRUNC:
+ CASE_CFN_TRUNC_FN:
return true;
CASE_CFN_LLRINT:
+ CASE_CFN_LLRINT_FN:
CASE_CFN_LRINT:
+ CASE_CFN_LRINT_FN:
CASE_CFN_NEARBYINT:
+ CASE_CFN_NEARBYINT_FN:
CASE_CFN_RINT:
+ CASE_CFN_RINT_FN:
return !flag_rounding_math;
default:
@@ -14288,9 +14314,12 @@ tree_expr_finite_p (const_tree x)
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return tree_expr_finite_p (CALL_EXPR_ARG (x, 0));
CASE_CFN_FMAX:
+ CASE_CFN_FMAX_FN:
CASE_CFN_FMIN:
+ CASE_CFN_FMIN_FN:
return tree_expr_finite_p (CALL_EXPR_ARG (x, 0))
&& tree_expr_finite_p (CALL_EXPR_ARG (x, 1));
default:
@@ -14408,9 +14437,12 @@ tree_expr_maybe_signaling_nan_p (const_tree x)
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 0));
CASE_CFN_FMAX:
+ CASE_CFN_FMAX_FN:
CASE_CFN_FMIN:
+ CASE_CFN_FMIN_FN:
return tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 0))
|| tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 1));
default:
@@ -14481,9 +14513,12 @@ tree_expr_maybe_nan_p (const_tree x)
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 0));
CASE_CFN_FMAX:
+ CASE_CFN_FMAX_FN:
CASE_CFN_FMIN:
+ CASE_CFN_FMIN_FN:
return tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 0))
|| tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 1));
default:
@@ -14520,6 +14555,7 @@ tree_expr_maybe_real_minus_zero_p (const_tree x)
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return false;
default:
break;
@@ -14797,16 +14833,26 @@ tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
switch (fn)
{
CASE_CFN_ACOS:
+ CASE_CFN_ACOS_FN:
CASE_CFN_ACOSH:
+ CASE_CFN_ACOSH_FN:
CASE_CFN_CABS:
+ CASE_CFN_CABS_FN:
CASE_CFN_COSH:
+ CASE_CFN_COSH_FN:
CASE_CFN_ERFC:
+ CASE_CFN_ERFC_FN:
CASE_CFN_EXP:
+ CASE_CFN_EXP_FN:
CASE_CFN_EXP10:
CASE_CFN_EXP2:
+ CASE_CFN_EXP2_FN:
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
CASE_CFN_FDIM:
+ CASE_CFN_FDIM_FN:
CASE_CFN_HYPOT:
+ CASE_CFN_HYPOT_FN:
CASE_CFN_POW10:
CASE_CFN_FFS:
CASE_CFN_PARITY:
@@ -14828,17 +14874,25 @@ tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
return RECURSE (arg0);
CASE_CFN_ASINH:
+ CASE_CFN_ASINH_FN:
CASE_CFN_ATAN:
+ CASE_CFN_ATAN_FN:
CASE_CFN_ATANH:
+ CASE_CFN_ATANH_FN:
CASE_CFN_CBRT:
+ CASE_CFN_CBRT_FN:
CASE_CFN_CEIL:
CASE_CFN_CEIL_FN:
CASE_CFN_ERF:
+ CASE_CFN_ERF_FN:
CASE_CFN_EXPM1:
+ CASE_CFN_EXPM1_FN:
CASE_CFN_FLOOR:
CASE_CFN_FLOOR_FN:
CASE_CFN_FMOD:
+ CASE_CFN_FMOD_FN:
CASE_CFN_FREXP:
+ CASE_CFN_FREXP_FN:
CASE_CFN_ICEIL:
CASE_CFN_IFLOOR:
CASE_CFN_IRINT:
@@ -14849,10 +14903,15 @@ tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
CASE_CFN_LLCEIL:
CASE_CFN_LLFLOOR:
CASE_CFN_LLRINT:
+ CASE_CFN_LLRINT_FN:
CASE_CFN_LLROUND:
+ CASE_CFN_LLROUND_FN:
CASE_CFN_LRINT:
+ CASE_CFN_LRINT_FN:
CASE_CFN_LROUND:
+ CASE_CFN_LROUND_FN:
CASE_CFN_MODF:
+ CASE_CFN_MODF_FN:
CASE_CFN_NEARBYINT:
CASE_CFN_NEARBYINT_FN:
CASE_CFN_RINT:
@@ -14863,11 +14922,15 @@ tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
CASE_CFN_ROUNDEVEN_FN:
CASE_CFN_SCALB:
CASE_CFN_SCALBLN:
+ CASE_CFN_SCALBLN_FN:
CASE_CFN_SCALBN:
+ CASE_CFN_SCALBN_FN:
CASE_CFN_SIGNBIT:
CASE_CFN_SIGNIFICAND:
CASE_CFN_SINH:
+ CASE_CFN_SINH_FN:
CASE_CFN_TANH:
+ CASE_CFN_TANH_FN:
CASE_CFN_TRUNC:
CASE_CFN_TRUNC_FN:
/* True if the 1st argument is nonnegative. */
@@ -14907,6 +14970,7 @@ tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
return RECURSE (arg0);
CASE_CFN_POW:
+ CASE_CFN_POW_FN:
/* True if the 1st argument is nonnegative or the second
argument is an even integer valued real. */
if (TREE_CODE (arg1) == REAL_CST)
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f764113..7b2d93b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,14 @@
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * trans-types.cc (gfc_get_function_type): Do not use
+ build_varargs_function_type_vec for unprototyped function.
+
+2022-10-26 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/103413
+ * symbol.cc (gfc_type_compatible): A boz-literal-constant has no type
+ and thus is not considered compatible to any type.
+
2022-10-21 José Rui Faustino de Sousa <jrfsousa@gmail.com>
PR fortran/100097
diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index 6050359..49fb378 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -5139,6 +5139,10 @@ gfc_type_compatible (gfc_typespec *ts1, gfc_typespec *ts2)
bool is_union1 = (ts1->type == BT_UNION);
bool is_union2 = (ts2->type == BT_UNION);
+ /* A boz-literal-constant has no type. */
+ if (ts1->type == BT_BOZ || ts2->type == BT_BOZ)
+ return false;
+
if (is_class1
&& ts1->u.derived->components
&& ((ts1->u.derived->attr.is_class
diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index fdce56d..def7552 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -3297,7 +3297,9 @@ arg_type_list_done:
type = gfc_sym_type (sym);
if (is_varargs)
- type = build_varargs_function_type_vec (type, typelist);
+ /* This should be represented as an unprototyped type, not a type
+ with (...) prototype. */
+ type = build_function_type (type, NULL_TREE);
else
type = build_function_type_vec (type, typelist);
diff --git a/gcc/function.cc b/gcc/function.cc
index 6474a66..d3da20e 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -3647,6 +3647,12 @@ assign_parms (tree fndecl)
assign_parms_initialize_all (&all);
fnargs = assign_parms_augmented_arg_list (&all);
+ if (TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (fndecl)))
+ {
+ struct assign_parm_data_one data = {};
+ assign_parms_setup_varargs (&all, &data, false);
+ }
+
FOR_EACH_VEC_ELT (fnargs, i, parm)
{
struct assign_parm_data_one data;
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index f919237..a899d82 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -494,6 +494,14 @@ fold_using_range::fold_stmt (vrange &r, gimple *s, fur_source &src, tree name)
else if (is_a<gassign *> (s) && gimple_assign_rhs_code (s) == COND_EXPR)
res = range_of_cond_expr (r, as_a<gassign *> (s), src);
+ // If the result is varying, check for basic nonnegativeness.
+ // Specifically this helps for now with strict enum in cases like
+ // g++.dg/warn/pr33738.C.
+ bool so_p;
+ if (res && r.varying_p () && INTEGRAL_TYPE_P (r.type ())
+ && gimple_stmt_nonnegative_warnv_p (s, &so_p))
+ r.set_nonnegative (r.type ());
+
if (!res)
{
// If no name specified or range is unsupported, bail.
diff --git a/gcc/gimple-ssa-backprop.cc b/gcc/gimple-ssa-backprop.cc
index 55986dd..7de6e78 100644
--- a/gcc/gimple-ssa-backprop.cc
+++ b/gcc/gimple-ssa-backprop.cc
@@ -351,10 +351,15 @@ backprop::process_builtin_call_use (gcall *call, tree rhs, usage_info *info)
break;
CASE_CFN_COS:
+ CASE_CFN_COS_FN:
CASE_CFN_COSH:
+ CASE_CFN_COSH_FN:
CASE_CFN_CCOS:
+ CASE_CFN_CCOS_FN:
CASE_CFN_CCOSH:
+ CASE_CFN_CCOSH_FN:
CASE_CFN_HYPOT:
+ CASE_CFN_HYPOT_FN:
/* The signs of all inputs are ignored. */
info->flags.ignore_sign = true;
break;
@@ -367,6 +372,7 @@ backprop::process_builtin_call_use (gcall *call, tree rhs, usage_info *info)
break;
CASE_CFN_POW:
+ CASE_CFN_POW_FN:
{
/* The sign of the first input is ignored as long as the second
input is an even real. */
diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h
index 7545ed3..c704c9f 100644
--- a/gcc/ginclude/stdarg.h
+++ b/gcc/ginclude/stdarg.h
@@ -44,7 +44,11 @@ typedef __builtin_va_list __gnuc_va_list;
if this invocation was from the user program. */
#ifdef _STDARG_H
+#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
+#define va_start(v, ...) __builtin_va_start(v, 0)
+#else
#define va_start(v,l) __builtin_va_start(v,l)
+#endif
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L \
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 5b95b38..7e531c3 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-6c188108858e3ae8c8ea8e4cc55427d8cf01bbc8
+5e658f4659c551330ea68f5667e4f951b218f32d
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/ipa-inline-analysis.cc b/gcc/ipa-inline-analysis.cc
index 1ca685d..7bd29c3 100644
--- a/gcc/ipa-inline-analysis.cc
+++ b/gcc/ipa-inline-analysis.cc
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-utils.h"
#include "cfgexpand.h"
#include "gimplify.h"
+#include "attribs.h"
/* Cached node/edge growths. */
fast_call_summary<edge_growth_cache_entry *, va_heap> *edge_growth_cache = NULL;
@@ -249,15 +250,19 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
hints = estimates.hints;
}
- /* When we have profile feedback, we can quite safely identify hot
- edges and for those we disable size limits. Don't do that when
- probability that caller will call the callee is low however, since it
+ /* When we have profile feedback or function attribute, we can quite safely
+ identify hot edges and for those we disable size limits. Don't do that
+ when probability that caller will call the callee is low however, since it
may hurt optimization of the caller's hot path. */
- if (edge->count.ipa ().initialized_p () && edge->maybe_hot_p ()
+ if ((edge->count.ipa ().initialized_p () && edge->maybe_hot_p ()
&& (edge->count.ipa () * 2
> (edge->caller->inlined_to
? edge->caller->inlined_to->count.ipa ()
: edge->caller->count.ipa ())))
+ || (lookup_attribute ("hot", DECL_ATTRIBUTES (edge->caller->decl))
+ != NULL
+ && lookup_attribute ("hot", DECL_ATTRIBUTES (edge->callee->decl))
+ != NULL))
hints |= INLINE_HINT_known_hot;
gcc_checking_assert (size >= 0);
diff --git a/gcc/ipa-visibility.cc b/gcc/ipa-visibility.cc
index 3ed2b7c..238f7eb 100644
--- a/gcc/ipa-visibility.cc
+++ b/gcc/ipa-visibility.cc
@@ -886,8 +886,12 @@ function_and_variable_visibility (bool whole_program)
&& vnode->ref_list.referring.length ())
{
enum tls_model new_model = decl_default_tls_model (decl);
- gcc_checking_assert (new_model >= decl_tls_model (decl));
- set_decl_tls_model (decl, new_model);
+ STATIC_ASSERT (TLS_MODEL_GLOBAL_DYNAMIC < TLS_MODEL_LOCAL_DYNAMIC);
+ STATIC_ASSERT (TLS_MODEL_INITIAL_EXEC < TLS_MODEL_LOCAL_EXEC);
+ /* We'd prefer to assert that recomputed model is not weaker than
+ what the front-end assigned, but cannot: see PR 107353. */
+ if (new_model >= decl_tls_model (decl))
+ set_decl_tls_model (decl, new_model);
}
}
}
diff --git a/gcc/ira.cc b/gcc/ira.cc
index 42c9cea..d28a67b 100644
--- a/gcc/ira.cc
+++ b/gcc/ira.cc
@@ -5718,6 +5718,7 @@ ira (FILE *f)
regstat_free_ri ();
regstat_init_n_sets_and_refs ();
regstat_compute_ri ();
+ resize_reg_info ();
};
int max_regno_before_rm = max_reg_num ();
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 84fc5a4..3ede467 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,25 @@
+2022-10-29 Thomas Schwinge <thomas@codesourcery.com>
+
+ * lang.opt: Better separate 'LTO' vs. 'LTODump'.
+
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * lto-common.cc (compare_tree_sccs_1): Compare
+ TYPE_NO_NAMED_ARGS_STDARG_P.
+
+2022-10-28 Martin Liska <mliska@suse.cz>
+
+ * lto-dump.cc (dump_list): Remove trailing return.
+ (dump_symbol): Likewise.
+ (dump_body): Filter name based on mangled name.
+ (dump_tool_help): Use GIMPLE wording.
+ (lto_main): Update wording.
+
+2022-10-27 Martin Liska <mliska@suse.cz>
+
+ PR lto/107418
+ * lto-dump.cc (lto_main): Do not load LTO stream for aliases.
+
2022-09-15 Richard Biener <rguenther@suse.de>
* lto-lang.cc (lto_build_c_type_nodes): Do not initialize
diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt
index 550a50f..1ad2967 100644
--- a/gcc/lto/lang.opt
+++ b/gcc/lto/lang.opt
@@ -24,9 +24,6 @@
Language
LTO
-Language
-LTODump
-
Enum
Name(lto_linker_output) Type(enum lto_linker_output) UnknownError(unknown linker output %qs)
@@ -52,7 +49,6 @@ flinker-output=
LTO Driver Joined RejectNegative Enum(lto_linker_output) Var(flag_lto_linker_output) Init(LTO_LINKER_OUTPUT_UNKNOWN)
Set linker output type (used internally during LTO optimization).
-
fltrans
LTO Var(flag_ltrans)
Run the link-time optimizer in local transformation (LTRANS) mode.
@@ -61,6 +57,10 @@ fltrans-output-list=
LTO Joined Var(ltrans_output_list)
Specify a file to which a list of files output by LTRANS is written.
+fresolution=
+LTO Joined
+The resolution file.
+
fwpa
LTO Driver
Run the link-time optimizer in whole program analysis (WPA) mode.
@@ -70,6 +70,9 @@ LTO Driver RejectNegative Joined Var(flag_wpa)
Whole program analysis (WPA) mode with number of parallel jobs specified.
+Language
+LTODump
+
list
LTODump Var(flag_lto_dump_list)
Call the dump function for variables and function in IL.
@@ -131,8 +134,4 @@ callgraph
LTODump Var(flag_dump_callgraph)
Dump the symtab callgraph.
-fresolution=
-LTO Joined
-The resolution file.
-
; This comment is to ensure we retain the blank line above.
diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
index d8d0404..f643097 100644
--- a/gcc/lto/lto-common.cc
+++ b/gcc/lto/lto-common.cc
@@ -1270,6 +1270,7 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
if (AGGREGATE_TYPE_P (t1))
compare_values (TYPE_TYPELESS_STORAGE);
compare_values (TYPE_EMPTY_P);
+ compare_values (TYPE_NO_NAMED_ARGS_STDARG_P);
compare_values (TYPE_PACKED);
compare_values (TYPE_RESTRICT);
compare_values (TYPE_USER_ALIGN);
diff --git a/gcc/lto/lto-dump.cc b/gcc/lto/lto-dump.cc
index f3d852d..5c4dbf5 100644
--- a/gcc/lto/lto-dump.cc
+++ b/gcc/lto/lto-dump.cc
@@ -227,7 +227,6 @@ void dump_list (void)
{
dump_list_functions ();
dump_list_variables ();
- return;
}
/* Dump specific variables and functions used in IL. */
@@ -243,7 +242,6 @@ void dump_symbol ()
printf ("\n");
}
}
- return;
}
/* Dump specific gimple body of specified function. */
@@ -259,19 +257,17 @@ void dump_body ()
return;
}
cgraph_node *cnode;
- FOR_EACH_FUNCTION (cnode)
- if (cnode->definition
- && !cnode->alias
- && !strcmp (cnode->name (), flag_dump_body))
+ FOR_EACH_DEFINED_FUNCTION (cnode)
+ if (!cnode->alias
+ && !strcmp (cnode->asm_name (), flag_dump_body))
{
- printf ("Gimple Body of Function: %s\n", cnode->name ());
+ printf ("GIMPLE body of function: %s\n\n", cnode->asm_name ());
cnode->get_untransformed_body ();
debug_function (cnode->decl, flags);
flag = 1;
}
if (!flag)
error_at (input_location, "Function not found.");
- return;
}
/* List of command line options for dumping. */
@@ -292,13 +288,12 @@ void dump_tool_help ()
" -callgraph Dump the callgraph in graphviz format.\n"
" -type-stats Dump statistics of tree types.\n"
" -tree-stats Dump statistics of trees.\n"
- " -gimple-stats Dump statistics of gimple statements.\n"
- " -dump-body= Dump the specific gimple body.\n"
+ " -gimple-stats Dump statistics of GIMPLE statements.\n"
+ " -dump-body= Dump the specific GIMPLE body.\n"
" -dump-level= Deciding the optimization level of body.\n"
" -help Display the dump tool help.\n";
fputs (msg, stdout);
- return;
}
unsigned int
@@ -347,7 +342,8 @@ lto_main (void)
/* Dump gimple statement statistics. */
cgraph_node *node;
FOR_EACH_DEFINED_FUNCTION (node)
- node->get_untransformed_body ();
+ if (!node->alias)
+ node->get_untransformed_body ();
if (!GATHER_STATISTICS)
warning_at (input_location, 0,
"Not configured with "
@@ -364,7 +360,7 @@ lto_main (void)
"%<--enable-gather-detailed-mem-stats%>.");
else
{
- printf ("Tree Statistics\n");
+ printf ("Tree statistics\n");
dump_tree_statistics ();
}
}
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index a83c3c7..2584520 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * objc-next-runtime-abi-01.cc (build_next_objc_exception_stuff):
+ Use build_function_type to build type of objc_setjmp_decl.
+
2022-10-07 Martin Liska <mliska@suse.cz>
* objc-gnu-runtime-abi-01.cc (generate_static_references):
diff --git a/gcc/objc/objc-next-runtime-abi-01.cc b/gcc/objc/objc-next-runtime-abi-01.cc
index 409b777..8d41886 100644
--- a/gcc/objc/objc-next-runtime-abi-01.cc
+++ b/gcc/objc/objc-next-runtime-abi-01.cc
@@ -2443,7 +2443,7 @@ build_next_objc_exception_stuff (void)
/* int _setjmp(...); */
/* If the user includes <setjmp.h>, this shall be superseded by
'int _setjmp(jmp_buf);' */
- temp_type = build_varargs_function_type_list (integer_type_node, NULL_TREE);
+ temp_type = build_function_type (integer_type_node, NULL_TREE);
objc_setjmp_decl
= add_builtin_function (TAG_SETJMP, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index a880973..82a93d0 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -10710,6 +10710,28 @@ oacc_privatization_candidate_p (const location_t loc, const tree c,
}
}
+ /* If an artificial variable has been added to a bind, e.g.
+ a compiler-generated temporary structure used by the Fortran front-end, do
+ not consider it as a privatization candidate. Note that variables on
+ the stack are private per-thread by default: making them "gang-private"
+ for OpenACC actually means to share a single instance of a variable
+ amongst all workers and threads spawned within each gang.
+ At present, no compiler-generated artificial variables require such
+ sharing semantics, so this is safe. */
+
+ if (res && block && DECL_ARTIFICIAL (decl))
+ {
+ res = false;
+
+ if (dump_enabled_p ())
+ {
+ oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl);
+ dump_printf (l_dump_flags,
+ "isn%'t candidate for adjusting OpenACC privatization "
+ "level: %s\n", "artificial");
+ }
+ }
+
if (res)
{
if (dump_enabled_p ())
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk
index 49065ce..2b8557f 100644
--- a/gcc/optc-save-gen.awk
+++ b/gcc/optc-save-gen.awk
@@ -1291,7 +1291,22 @@ for (i = 0; i < n_opts; i++) {
var_opt_val_type[n_opt_val] = otype;
var_opt_val[n_opt_val] = "x_" name;
var_opt_hash[n_opt_val] = flag_set_p("Optimization", flags[i]);
- var_opt_init[n_opt_val] = opt_args("Init", flags[i]);
+
+ # If applicable, optimize streaming for the common case that
+ # the current value is unchanged from the 'Init' value:
+ # XOR-encode it so that we stream value zero.
+ # Not handling non-parameters as those really generally don't
+ # have large initializers.
+ # Not handling enums as we don't know if '(enum ...) 10' is
+ # even valid (see synthesized 'if' conditionals below).
+ if (flag_set_p("Param", flags[i]) \
+ && !(otype ~ "^enum ")) {
+ # Those without 'Init' are zero-initialized and thus
+ # already encoded ideally.
+ init = opt_args("Init", flags[i])
+ var_opt_optimize_init[n_opt_val] = init;
+ }
+
n_opt_val++;
}
}
@@ -1369,9 +1384,10 @@ for (i = 0; i < n_opt_val; i++) {
} else {
sgn = "int";
}
- if (name ~ "^x_param" && !(otype ~ "^enum ") && var_opt_init[i]) {
- print " if (" var_opt_init[i] " > (" var_opt_val_type[i] ") 10)";
- print " bp_pack_var_len_" sgn " (bp, ptr->" name" ^ " var_opt_init[i] ");";
+ # If applicable, encode the streamed value.
+ if (var_opt_optimize_init[i]) {
+ print " if (" var_opt_optimize_init[i] " > (" var_opt_val_type[i] ") 10)";
+ print " bp_pack_var_len_" sgn " (bp, ptr->" name" ^ " var_opt_optimize_init[i] ");";
print " else";
print " bp_pack_var_len_" sgn " (bp, ptr->" name");";
} else {
@@ -1405,9 +1421,10 @@ for (i = 0; i < n_opt_val; i++) {
sgn = "int";
}
print " ptr->" name" = (" var_opt_val_type[i] ") bp_unpack_var_len_" sgn " (bp);";
- if (name ~ "^x_param" && !(otype ~ "^enum ") && var_opt_init[i]) {
- print " if (" var_opt_init[i] " > (" var_opt_val_type[i] ") 10)";
- print " ptr->" name" ^= " var_opt_init[i] ";";
+ # If applicable, decode the streamed value.
+ if (var_opt_optimize_init[i]) {
+ print " if (" var_opt_optimize_init[i] " > (" var_opt_val_type[i] ") 10)";
+ print " ptr->" name" ^= " var_opt_optimize_init[i] ";";
}
}
}
diff --git a/gcc/target.def b/gcc/target.def
index a3d3b04..25f94c1 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -4680,7 +4680,9 @@ pass all their arguments on the stack.\n\
The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} data\n\
structure, containing the values that are obtained after processing the\n\
named arguments. The argument @var{arg} describes the last of these named\n\
-arguments.\n\
+arguments. The argument @var{arg} should not be used if the function type\n\
+satisfies @code{TYPE_NO_NAMED_ARGS_STDARG_P}, since in that case there are\n\
+no named arguments and all arguments are accessed with @code{va_arg}.\n\
\n\
The target hook should do two things: first, push onto the stack all the\n\
argument registers @emph{not} used for the named arguments, and second,\n\
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6fa9fb0..9dee429 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,324 @@
+2022-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/cpp23/ext-floating12.C: New test.
+
+2022-10-31 Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
+
+ * gcc.dg/debug/btf/btf-enum-1.c: Update testcase, with correct
+ info.kflags encoding.
+ * gcc.dg/debug/btf/btf-enum64-1.c: New testcase.
+
+2022-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/torture/floatn-builtin.h: Add tests for newly added builtins.
+
+2022-10-31 konglin1 <lingling.kong@intel.com>
+
+ * gcc.target/i386/avx-check.h: Add avxneconvert check.
+ * gcc.target/i386/funcspec-56.inc: Add new target attribute.
+ * gcc.target/i386/sse-12.c: Add -mavxneconvert.
+ * gcc.target/i386/sse-13.c: Ditto.
+ * gcc.target/i386/sse-14.c: Ditto.
+ * gcc.target/i386/sse-22.c: Ditto.
+ * gcc.target/i386/sse-23.c: Ditto.
+ * g++.dg/other/i386-2.C: Ditto.
+ * g++.dg/other/i386-3.C: Ditto.
+ * lib/target-supports.exp:add check_effective_target_avxneconvert.
+ * gcc.target/i386/avx-ne-convert-1.c: New test.
+ * gcc.target/i386/avx-ne-convert-vbcstnebf162ps-2.c: Ditto.
+ * gcc.target/i386/avx-ne-convert-vbcstnesh2ps-2.c: Ditto.
+ * gcc.target/i386/avx-ne-convert-vcvtneebf162ps-2.c: Ditto.
+ * gcc.target/i386/avx-ne-convert-vcvtneeph2ps-2.c: Ditto.
+ * gcc.target/i386/avx-ne-convert-vcvtneobf162ps-2.c: Ditto.
+ * gcc.target/i386/avx-ne-convert-vcvtneoph2ps-2.c: Ditto.
+ * gcc.target/i386/avx-ne-convert-vcvtneps2bf16-2.c: Ditto.
+ * gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1.c: Rename..
+ * gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1a.c: To this.
+ * gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1b.c: New test.
+
+2022-10-31 konglin1 <lingling.kong@intel.com>
+
+ * gcc.target/i386/avx512bf16-cvtsbh2ss-1.c: Add fpmath option.
+ * gcc.target/i386/avx512bf16-vdpbf16ps-2.c: Fixed
+ scan-assembler.
+ * gcc.target/i386/avx512bf16vl-cvtness2sbh-1.c: Add x/y suffix
+ for vcvtneps2bf16.
+ * gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1.c: Ditto.
+
+2022-10-31 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr107261.c: New test.
+
+2022-10-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * gdc.dg/simd19630.d: Move tests with errors to ...
+ * gdc.dg/simd19630b.d: ... here. New test.
+ * gdc.dg/simd19630c.d: New test.
+ * gdc.dg/simd_ctfe.d: Removed.
+ * gdc.dg/simd18867.d: New test.
+ * gdc.dg/simd19788.d: New test.
+ * gdc.dg/simd21469.d: New test.
+ * gdc.dg/simd21672.d: New test.
+ * gdc.dg/simd23077.d: New test.
+ * gdc.dg/simd23084.d: New test.
+ * gdc.dg/simd23085.d: New test.
+ * gdc.dg/torture/simd19632.d: New test.
+ * gdc.dg/torture/simd20041.d: New test.
+ * gdc.dg/torture/simd21673.d: New test.
+ * gdc.dg/torture/simd21676.d: New test.
+ * gdc.dg/torture/simd22438.d: New test.
+ * gdc.dg/torture/simd23009.d: New test.
+ * gdc.dg/torture/simd23077.d: New test.
+ * gdc.dg/torture/simd8.d: New test.
+ * gdc.dg/torture/simd9.d: New test.
+ * gdc.dg/torture/simd_prefetch.d: New test.
+
+2022-10-28 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/warn/Wdangling-reference4.C: New test.
+
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-stdarg-1.c, gcc.dg/c11-stdarg-2.c,
+ gcc.dg/c11-stdarg-3.c, gcc.dg/c2x-stdarg-1.c,
+ gcc.dg/c2x-stdarg-2.c, gcc.dg/c2x-stdarg-3.c,
+ gcc.dg/c2x-stdarg-4.c, gcc.dg/gnu2x-stdarg-1.c,
+ gcc.dg/torture/c2x-stdarg-split-1a.c,
+ gcc.dg/torture/c2x-stdarg-split-1b.c: New tests.
+ * gcc.dg/Wold-style-definition-2.c, gcc.dg/format/sentinel-1.c:
+ Update expected diagnostics.
+ * gcc.dg/c2x-nullptr-1.c (test5): Cast unused parameter to (void).
+ * gcc.dg/diagnostic-token-ranges.c: Use -pedantic. Expect warning
+ in place of error.
+
+2022-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107407
+ * gcc.dg/torture/pr107407.c: New testcase.
+
+2022-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107447
+ * gcc.dg/torture/pr107447.c: New testcase.
+
+2022-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107435
+ * gcc.dg/torture/pr107435.c: New testcase.
+
+2022-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/directive-1.c: New test.
+ * c-c++-common/gomp/clauses-6.c: New test.
+ * c-c++-common/gomp/declare-variant-2.c (f75a): Declare.
+ (f75): Use f75a as variant instead of f1 and don't expect error.
+ * g++.dg/gomp/clause-4.C (foo): Don't expect error on comma
+ before first clause.
+ * gcc.dg/gomp/clause-2.c (foo): Likewise.
+
+2022-10-28 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/pr100756.c: Adjust for larger vectors.
+
+2022-10-28 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gcc.dg/vect/bb-slp-cond-1.c: Fix target selector syntax.
+
+2022-10-28 Kewen Lin <linkw@linux.ibm.com>
+
+ PR testsuite/107240
+ * gcc.dg/vect/vect-bitfield-read-1.c: Add effective target checking
+ vect_shift.
+ * gcc.dg/vect/vect-bitfield-read-3.c: Likewise.
+ * gcc.dg/vect/vect-bitfield-read-5.c: Likewise.
+ * gcc.dg/vect/vect-bitfield-read-6.c: Likewise.
+ * gcc.dg/vect/vect-bitfield-read-7.c: Likewise.
+ * gcc.dg/vect/vect-bitfield-read-2.c: Add effective target checking
+ vect_shift and replace vect_int with vect_long_long.
+ * gcc.dg/vect/vect-bitfield-read-4.c: Likewise.
+
+2022-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/61469
+ * gcc.dg/c11-enum-4.c, gcc.dg/c11-enum-5.c, gcc.dg/c11-enum-6.c,
+ gcc.dg/c2x-enum-6.c, gcc.dg/c2x-enum-7.c, gcc.dg/c2x-enum-8.c,
+ gcc.dg/gnu2x-enum-1.c: New tests.
+
+2022-10-27 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/107172
+ * gcc.target/i386/pr107172.c: New test.
+
+2022-10-27 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/abi/lambda-ctx1-18.C: Adjust.
+ * g++.dg/abi/lambda-ctx1-18vs17.C: Adjust.
+ * g++.dg/abi/lambda-tpl1-17.C: New.
+ * g++.dg/abi/lambda-tpl1-18.C: New.
+ * g++.dg/abi/lambda-tpl1-18vs17.C: New.
+ * g++.dg/abi/lambda-tpl1.h: New.
+
+2022-10-27 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/107394
+ * gcc.dg/tree-ssa/pr107394.c: New test.
+
+2022-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/107382
+ PR c++/107383
+ * g++.dg/diagnostic/bad-binary-ops2.C: New test.
+
+2022-10-27 Jiawei <jiawei@iscas.ac.cn>
+
+ * gcc.target/riscv/_Float16-zhinx-1.c: New test.
+ * gcc.target/riscv/_Float16-zhinx-2.c: New test.
+ * gcc.target/riscv/_Float16-zhinx-3.c: New test.
+ * gcc.target/riscv/_Float16-zhinxmin-1.c: New test.
+ * gcc.target/riscv/_Float16-zhinxmin-2.c: New test.
+ * gcc.target/riscv/_Float16-zhinxmin-3.c: New test.
+
+2022-10-26 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/fd-3.c (test_5): Expect "opened here" message
+ even when flags are symbolic.
+ (test_read_from_symbolic_fd): New.
+ (test_write_to_symbolic_fd): New.
+
+2022-10-26 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/103413
+ * gfortran.dg/illegal_boz_arg_4.f90: New test.
+
+2022-10-26 David Faust <david.faust@oracle.com>
+
+ * gcc.target/bpf/core-builtin-fieldinfo-errors-1.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-errors-2.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-existence-1.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-lshift-1-be.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-lshift-1-le.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-lshift-2.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-offset-1.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-rshift-1.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-rshift-2.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-sign-1.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-sign-2.c: New test.
+ * gcc.target/bpf/core-builtin-fieldinfo-size-1.c: New test.
+
+2022-10-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106393
+ * g++.dg/cpp23/elision4.C: Use -Wdangling-reference, add dg-warning.
+ * g++.dg/cpp23/elision7.C: Likewise.
+ * g++.dg/warn/Wdangling-pointer-2.C: Use -Wno-dangling-reference.
+ * g++.dg/warn/Wdangling-reference1.C: New test.
+ * g++.dg/warn/Wdangling-reference2.C: New test.
+ * g++.dg/warn/Wdangling-reference3.C: New test.
+
+2022-10-26 Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
+
+ * gcc.target/riscv/rvv/base/mov-1.c: New.
+ * gcc.target/riscv/rvv/base/mov-10.c: New.
+ * gcc.target/riscv/rvv/base/mov-11.c: New.
+ * gcc.target/riscv/rvv/base/mov-12.c: New.
+ * gcc.target/riscv/rvv/base/mov-13.c: New.
+ * gcc.target/riscv/rvv/base/mov-2.c: New.
+ * gcc.target/riscv/rvv/base/mov-3.c: New.
+ * gcc.target/riscv/rvv/base/mov-4.c: New.
+ * gcc.target/riscv/rvv/base/mov-5.c: New.
+ * gcc.target/riscv/rvv/base/mov-6.c: New.
+ * gcc.target/riscv/rvv/base/mov-7.c: New.
+ * gcc.target/riscv/rvv/base/mov-8.c: New.
+ * gcc.target/riscv/rvv/base/mov-9.c: New.
+
+2022-10-26 Monk Chiang <monk.chiang@sifive.com>
+
+ * gcc.target/riscv/predef-24.c:New.
+ * gcc.target/riscv/predef-25.c:New.
+
+2022-10-26 Jiufu Guo <guojiufu@linux.ibm.com>
+
+ PR target/106460
+ * gcc.target/powerpc/pr106460.c: New test.
+
+2022-10-26 Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/arch-18.c: New.
+ * gcc.target/riscv/arch-5.c: Remove test for prefixed
+ with `h`.
+ * gcc.target/riscv/predef-23.c: New.
+
+2022-10-26 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * lib/profopt.exp: Don't force DWARF4 for AutoFDO tests
+
+2022-10-25 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/106848
+ PR c++/102600
+ * g++.dg/modules/enum-9_a.H: New test.
+ * g++.dg/modules/enum-9_b.C: New test.
+ * g++.dg/modules/enum-10_a.H: New test.
+ * g++.dg/modules/enum-10_b.C: New test.
+ * g++.dg/modules/enum-11_a.H: New test.
+ * g++.dg/modules/enum-11_b.C: New test.
+
+2022-10-25 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/107304
+ * gcc.target/i386/pr107304.c: New test.
+
+2022-10-25 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp23/attr-assume9.C: New test.
+ * g++.dg/cpp23/attr-assume10.C: New test.
+
+2022-10-25 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp23/attr-assume2.C: Expect constant values.
+
+2022-10-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/107176
+ PR tree-optimization/66375
+ PR tree-optimization/42512
+ * gcc.dg/torture/pr107176.c: New testcase.
+
+2022-10-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/coverage1.ads: New test.
+ * gnat.dg/specs/variant_part.ads: Minor tweak.
+ * gnat.dg/specs/weak1.ads: Add dg directive.
+
+2022-10-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/107368
+ * gcc.dg/attr-assume-5.c: New test.
+
+2022-10-25 YunQiang Su <yunqiang.su@cipunited.com>
+
+ * gcc.target/mips/compact-branches-1.c: add isa_rev>=6.
+ * gcc.target/mips/mips.exp: don't add -mipsXXr6 option for
+ -mcompact-branches=always. It is usable for pre-R6 now.
+ * gcc.target/mips/compact-branches-8.c: New test.
+ * gcc.target/mips/compact-branches-9.c: New test.
+
+2022-10-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/107369
+ * gcc.dg/attr-assume-4.c: New test.
+ * g++.dg/cpp23/attr-assume8.C: New test.
+
+2022-10-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/100756
+ * gcc.dg/vect/pr100756.c: New testcase.
+
+2022-10-25 Kewen Lin <linkw@linux.ibm.com>
+
+ * lib/target-supports.exp (check_effective_target_vect_long_long): Add
+ support for powerpc*-*-*.
+
2022-10-24 David Malcolm <dmalcolm@redhat.com>
PR analyzer/107349
diff --git a/gcc/testsuite/c-c++-common/gomp/clauses-6.c b/gcc/testsuite/c-c++-common/gomp/clauses-6.c
new file mode 100644
index 0000000..3502647
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/clauses-6.c
@@ -0,0 +1,604 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+typedef enum omp_allocator_handle_t
+#if __cplusplus >= 201103L
+: __UINTPTR_TYPE__
+#endif
+{
+ 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)
+{
+ #pragma omp 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++;
+ #pragma omp 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++;
+ #pragma omp 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++;
+}
+
+void
+qux (int p)
+{
+ #pragma omp 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)
+{
+ #pragma omp 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), allocate (p)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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 (p)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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), allocate (f)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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 (f)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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++;
+ #pragma omp 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 hda, int s,
+ int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm,
+ int n1, int n2)
+{
+ #pragma omp 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++;
+ #pragma omp 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++;
+ #pragma omp 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++;
+ #pragma omp 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++;
+ #pragma omp 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)
+ {
+ #pragma omp section
+ {}
+ #pragma omp section
+ {}
+ }
+ #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), in_reduction(+:r2), has_device_addr(hda)
+ ;
+ #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), in_reduction(+:r2), has_device_addr(hda)
+ 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), in_reduction(+:r2), has_device_addr(hda)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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), has_device_addr(hda)
+ 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 - 1:nte), thread_limit(tl), nowait depend(inout: dd[0]), \
+ allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+ ;
+ #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), order(concurrent), \
+ collapse(1), dist_schedule(static, 16), nowait, depend(inout: dd[0]), allocate (omp_default_mem_alloc:f), in_reduction(+:r2), \
+ has_device_addr(hda)
+ for (int i = 0; i < 64; i++)
+ ;
+ #pragma omp 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-1: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), has_device_addr(hda)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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), has_device_addr(hda)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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-1: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), has_device_addr(hda)
+ 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), in_reduction(+:r2), has_device_addr(hda)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp taskgroup, task_reduction(+:r2), allocate (r2)
+ #pragma omp 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(+:r), allocate (r)
+ #pragma omp 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++;
+ #pragma omp taskwait
+ #pragma omp 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++;
+ #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), order(concurrent)
+ for (int i = 0; i < 64; i++)
+ ;
+ #pragma omp target
+ #pragma omp teams distribute parallel for, \
+ private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1: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++;
+ #pragma omp target
+ #pragma omp 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++;
+ #pragma omp target
+ #pragma omp teams distribute simd, \
+ private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1: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++;
+ #pragma omp 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), copyin(t), allocate (f)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp teams distribute parallel for, \
+ private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1: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), allocate (f)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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), \
+ safelen(8), simdlen(4), aligned(q: 32), if (simd: i3), nontemporal(ntm), copyin(t), \
+ allocate (f)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp teams distribute parallel for simd, \
+ private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1: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 (f)
+ for (int i = 0; i < 64; i++)
+ ll++;
+ #pragma omp 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++;
+ #pragma omp 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)
+ ;
+ #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), \
+ reduction(default, +:r), in_reduction(+:r2), allocate (f)
+ 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), \
+ reduction(default, +:r), in_reduction(+:r2)
+ 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)
+ ll++;
+ #pragma omp 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++;
+ #pragma omp 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++;
+ #pragma omp teams loop, \
+ private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+ collapse(1), lastprivate (l), bind(teams), allocate (f)
+ for (l = 0; l < 64; ++l)
+ ;
+ #pragma omp 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)
+ ;
+ #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), bind(parallel), order(concurrent), collapse(1), \
+ allocate (omp_default_mem_alloc: f), in_reduction(+:r2), has_device_addr(hda)
+ 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), in_reduction(+:r2), has_device_addr(hda)
+ 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-1:nte), thread_limit(tl), nowait depend(inout: dd[0]), \
+ lastprivate (l), bind(teams), collapse(1), \
+ allocate (omp_default_mem_alloc: f), in_reduction(+:r2), has_device_addr(hda)
+ 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), in_reduction(+:r2), has_device_addr(hda)
+ for (l = 0; l < 64; ++l)
+ ;
+ #pragma omp critical
+ ;
+ #pragma omp critical (foobar),hint(omp_sync_hint_none)
+ ;
+ #pragma omp taskwait, depend (inout: dd[0])
+ ;
+ #pragma omp taskgroup, task_reduction(+:r2),allocate (r2)
+ ;
+ #pragma omp atomic, update,seq_cst,hint(omp_sync_hint_none)
+ p++;
+ #pragma omp atomic, read, hint(omp_sync_hint_none),relaxed
+ f = p;
+ #pragma omp atomic,write, release hint(omp_sync_hint_none)
+ p = f;
+ #pragma omp flush
+ ;
+ #pragma omp flush, acq_rel
+ ;
+ #pragma omp flush, acquire
+ ;
+ #pragma omp flush, release
+ ;
+ #pragma omp flush, seq_cst
+ ;
+ #pragma omp flush (p, f)
+ ;
+ #pragma omp 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++)
+ #pragma omp ordered, simd
+ ll++;
+ #pragma omp 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++)
+ #pragma omp ordered, threads
+ ll++;
+ #pragma omp for, ordered (1)
+ for (l = 0; l < 64; l++)
+ {
+ #pragma omp ordered, depend (sink: l - 1)
+ ;
+ #pragma omp ordered, depend (source)
+ ;
+ }
+ extern omp_depend_t depobj;
+ #pragma omp depobj(depobj),depend(in : dd[0])
+ ;
+ #pragma omp parallel
+ {
+ if (p) {
+ #pragma omp cancel, parallel
+ ;
+ } else {
+ #pragma omp cancellation point, parallel
+ ;
+ }
+ }
+ #pragma omp scope, private (p), firstprivate (f), reduction(+:r), nowait, \
+ allocate(omp_default_mem_alloc: r)
+ ;
+ #pragma omp scope, private (p), firstprivate (f), reduction(task, +:r), \
+ allocate (omp_default_mem_alloc: f)
+ ;
+ extern int t2;
+ #pragma omp threadprivate (t2)
+ extern int t2;
+ #pragma omp declare reduction (dr: int: omp_out += omp_in),initializer (omp_priv = 0)
+ #pragma omp assume, no_openmp, no_openmp_routines, no_parallelism, \
+ absent (atomic, barrier, cancel, cancellation point), \
+ absent (critical, depobj), \
+ absent (distribute, flush, loop, masked, master, nothing, ordered), \
+ absent (parallel, scan, scope, section, sections, simd, single, task), \
+ absent (taskgroup, taskloop, taskwait, taskyield), \
+ absent (target, teams, for, error), holds (n1 < n2)
+ if (0)
+ ;
+ #pragma omp assume, contains (simd)
+ #pragma omp for simd
+ for (int i = 0; i < 64; i++)
+ ;
+}
+
+void corge1 ();
+
+void
+corge ()
+{
+ #pragma omp declare variant (corge1),match (construct={parallel,for})
+ extern void corge2 ();
+ #pragma omp parallel
+ #pragma omp for
+ for (int i = 0; i < 5; i++)
+ corge2 ();
+ #pragma omp declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch
+ #pragma omp declare simd,simdlen(8),notinbranch
+ extern int corge3 (int l, int *p);
+ #pragma omp declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch
+ #pragma omp declare simd, simdlen(8),notinbranch
+ extern int corge4 (int l, int *p);
+ #pragma omp declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch
+ #pragma omp declare simd, simdlen(8),notinbranch
+ extern int corge5 (int l, int *p);
+ #pragma omp declare target
+ extern void corge6 ();
+ #pragma omp end declare target
+}
+
+int
+garply (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;
+ #pragma omp scan, exclusive (a)
+ a += c[i];
+ }
+ #pragma omp 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/c-c++-common/gomp/declare-variant-2.c b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
index 5554059..3c2c12c 100644
--- a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
@@ -149,7 +149,8 @@ void f72 (void);
void f73 (void);
#pragma omp declare variant (f1) match(construct={requires}) /* { dg-error "selector 'requires' not allowed for context selector set 'construct'" } */
void f74 (void);
-#pragma omp declare variant (f1),match(construct={parallel}) /* { dg-error "expected 'match' before ','" } */
+void f75a (void);
+#pragma omp declare variant (f75a),match(construct={parallel})
void f75 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order("relaxed")}) /* { dg-error "expected identifier before string constant" } */
void f76 (void);
diff --git a/gcc/testsuite/c-c++-common/gomp/directive-1.c b/gcc/testsuite/c-c++-common/gomp/directive-1.c
new file mode 100644
index 0000000..e1218bd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/directive-1.c
@@ -0,0 +1,28 @@
+int thr;
+#pragma omp threadprivate, (thr) /* { dg-error "expected '\\\(' before ',' token" } */
+ /* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
+#pragma omp declare reduction, (foo: int : omp_out += omp_in), initializer (omp_priv = 0) /* { dg-error "expected '\\\(' before ',' token" } */
+void f1 (void);
+#pragma omp declare variant, (f1), match (user={condition(true)}) /* { dg-error "expected '\\\(' before ',' token" } */
+void f2 (void);
+int j;
+#pragma omp declare target, (j) /* { dg-error "expected end of line before ',' token" } */
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+ char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+extern omp_depend_t d;
+
+void
+foo (void)
+{
+ int i, k = 0, l = 0;
+ #pragma omp allocate, (i) /* { dg-error "expected '\\\(' before ',' token" } */
+ /* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
+ /* { dg-message "not yet supported" "" { target *-*-* } .-2 } */
+ #pragma omp critical, (bar) /* { dg-error "expected '#pragma omp' clause before '\\\(' token" } */
+ ;
+ #pragma omp flush, (k, l) /* { dg-error "expected '\\\(' or end of line before ',' token" "" { target c } } */
+ /* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
+ #pragma omp depobj, (d) depend(in : l) /* { dg-error "expected '\\\(' before ',' token" } */
+}
diff --git a/gcc/testsuite/g++.dg/abi/lambda-ctx1-18.C b/gcc/testsuite/g++.dg/abi/lambda-ctx1-18.C
index c1c9e27..3dd68a4 100644
--- a/gcc/testsuite/g++.dg/abi/lambda-ctx1-18.C
+++ b/gcc/testsuite/g++.dg/abi/lambda-ctx1-18.C
@@ -6,6 +6,6 @@
// These correctly include the lambda's extra context as a
// substitution candidate, and thus demangle as expected
// { dg-final { scan-assembler {_ZNK1C1fMUlT_E_clIMS_iEEDaS1_:} } }
-// { dg-final { scan-assembler {_ZNK2L2MUlT_T0_E_clIifEEvS0_S1_:} } }
-// { dg-final { scan-assembler {_ZNK1B2L3MUlT_T0_E_clIjdEEvS1_S2_:} } }
+// { dg-final { scan-assembler {_ZNK2L2MUlTyTyT_T0_E_clIifEEvS0_S1_:} } }
+// { dg-final { scan-assembler {_ZNK1B2L3MUlTyTyT_T0_E_clIjdEEvS1_S2_:} } }
// { dg-final { scan-assembler {_Z3fooIN1qMUlvE_ENS0_UlvE0_EEiOT_OT0_:} } }
diff --git a/gcc/testsuite/g++.dg/abi/lambda-ctx1-18vs17.C b/gcc/testsuite/g++.dg/abi/lambda-ctx1-18vs17.C
index f5ec905..ec6709a 100644
--- a/gcc/testsuite/g++.dg/abi/lambda-ctx1-18vs17.C
+++ b/gcc/testsuite/g++.dg/abi/lambda-ctx1-18vs17.C
@@ -3,7 +3,7 @@
#include "lambda-ctx1.h"
-// { dg-regexp {[^\n]*lambda-ctx1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK1B2L3MUlT_T0_E_clIjdEEvS0_S1_'\) and '-fabi-version=18' \('_ZNK1B2L3MUlT_T0_E_clIjdEEvS1_S2_'\) [^\n]*\n} }
-// { dg-regexp {[^\n]*lambda-ctx1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK2L2MUlT_T0_E_clIifEEvS_S0_'\) and '-fabi-version=18' \('_ZNK2L2MUlT_T0_E_clIifEEvS0_S1_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-ctx1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK1B2L3MUlT_T0_E_clIjdEEvS0_S1_'\) and '-fabi-version=18' \('_ZNK1B2L3MUlTyTyT_T0_E_clIjdEEvS1_S2_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-ctx1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK2L2MUlT_T0_E_clIifEEvS_S0_'\) and '-fabi-version=18' \('_ZNK2L2MUlTyTyT_T0_E_clIifEEvS0_S1_'\) [^\n]*\n} }
// { dg-regexp {[^\n]*lambda-ctx1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK1C1fMUlT_E_clIMS_iEEDaS0_'\) and '-fabi-version=18' \('_ZNK1C1fMUlT_E_clIMS_iEEDaS1_'\) [^\n]*\n} }
// { dg-regexp {[^\n]*lambda-ctx1.h:[:0-9]* warning: the mangled name [^\n]* \('_Z3fooIN1qMUlvE_EN1qMUlvE0_EEiOT_OT0_'\) and '-fabi-version=18' \('_Z3fooIN1qMUlvE_ENS0_UlvE0_EEiOT_OT0_'\) [^\n]*\n} }
diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C b/gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C
new file mode 100644
index 0000000..b61aaf9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C
@@ -0,0 +1,20 @@
+// { dg-do compile { target c++20 } }
+// { dg-options -fabi-version=17 }
+
+#include "lambda-tpl1.h"
+
+// { dg-final { scan-assembler {_ZNK6l_autoMUlT_E_clIiEEDaS_:} } }
+// { dg-final { scan-assembler {_ZNK5l_tplMUlT_E_clIiEEDaS_:} } }
+// { dg-final { scan-assembler {_ZNK10l_tpl_autoMUlT_T0_E_clIiiEEDaS_S0_:} } }
+// { dg-final { scan-assembler {_ZNK12l_tpl_nt_aryMUlRAT__iE_clILi2EEEDaS0_:} } }
+// { dg-final { scan-assembler {_ZNK13l_tpl_nt_autoMUlvE_clILi0EEEDav:} } }
+// { dg-final { scan-assembler {_ZNK9l_tpl_tplMUlR3TPLIT_EE_clI1UEEDaS2_:} } }
+// { dg-final { scan-assembler {_ZNK13l_tpl_tpl_tplMUlR6TPLTPLIT_EE_clI3TPLEEDaS2_:} } }
+// { dg-final { scan-assembler {_ZNK5l_varMUlDpT_E_clIJiiiEEEDaS0_:} } }
+
+// This mangling might not be correct, it is my best guess:
+// { FIXMEdg-final { scan-assembler {_ZNK6l_var2MUlDpRAT__iE_clIJLi2ELi2EEEEDaS1_:} } }
+
+// { dg-final { scan-assembler {_ZNK6l_var3MUlRT_IJXspT0_EEEE_clI1XJLi1ELi2ELi3EEEEDaS1_:} } }
+// { dg-final { scan-assembler {_ZNK6l_var4MUlR1YIJDpT_EEE_clIJ1US6_EEEDaS3_:} } }
+// { dg-final { scan-assembler {_ZZ2FnILi1EEvvENKUlT_E_clIiEEDaS0_:} } }
diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C
new file mode 100644
index 0000000..dbeea40
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C
@@ -0,0 +1,25 @@
+// { dg-do compile { target c++20 } }
+
+#include "lambda-tpl1.h"
+
+// { dg-final { scan-assembler {_ZNK6l_autoMUlT_E_clIiEEDaS0_:} } }
+// { dg-final { scan-assembler {_ZNK5l_tplMUlTyT_E_clIiEEDaS0_:} } }
+// { dg-final { scan-assembler {_ZNK10l_tpl_autoMUlTyT_T0_E_clIiiEEDaS0_S1_:} } }
+// { dg-final { scan-assembler {_ZNK12l_tpl_nt_aryMUlTniRAT__iE_clILi2EEEDaS1_:} } }
+// { dg-final { scan-assembler {_ZNK13l_tpl_nt_autoMUlTnDavE_clILi0EEEDav:} } }
+// { dg-final { scan-assembler {_ZNK9l_tpl_tplMUlTtTyTnjER3TPLIT_EE_clI1UEEDaS3_:} } }
+// { dg-final { scan-assembler {_ZNK13l_tpl_tpl_tplMUlTtTtTyTnjEER6TPLTPLIT_EE_clI3TPLEEDaS3_:} } }
+// { dg-final { scan-assembler {_ZNK5l_varMUlTpTyDpT_E_clIJiiiEEEDaS1_:} } }
+
+// { FIXMEdg-final { scan-assembler {_ZNK6l_var2MUlTpTniDpRAT__iE_clIJLi2ELi2EEEEDaS2_:} } }
+
+// { dg-final { scan-assembler {_ZNK6l_var3MUlTtTpTniETpTniRT_IJXspT0_EEEE_clI1XJLi1ELi2ELi3EEEEDaS2_:} } }
+
+// { dg-final { scan-assembler {_ZNK6l_var4MUlTpTtTyTnjER1YIJDpT_EEE_clIJ1US7_EEEDaS4_:} } }
+// This is a different mangling to clang, which gets
+// _ZNK6l_var4MUlTpTtTyTnjER1YIJDpT_EEE_clIJ1US6_EEEDaS3_
+// However, I think that is incorrect -- it doesn't demangle as
+// expected (using the llvm demangler).
+// https://github.com/llvm/llvm-project/issues/58631
+
+// { dg-final { scan-assembler {_ZZ2FnILi1EEvvENKUlTyT_E_clIiEEDaS0_:} } }
diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C
new file mode 100644
index 0000000..8bead73
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++20 } }
+// { dg-options {-fabi-version=18 -Wabi=17} }
+
+#include "lambda-tpl1.h"
+
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZZ2FnILi1EEvvENKUlT_E_clIiEEDaS0_'\) and '-fabi-version=18' \('_ZZ2FnILi1EEvvENKUlTyT_E_clIiEEDaS0_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK6l_var4MUlR1YIJDpT_EEE_clIJ1US6_EEEDaS3_'\) and '-fabi-version=18' \('_ZNK6l_var4MUlTpTtTyTnjER1YIJDpT_EEE_clIJ1US7_EEEDaS4_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK6l_var3MUlRT_IJXspT0_EEEE_clI1XJLi1ELi2ELi3EEEEDaS1_'\) and '-fabi-version=18' \('_ZNK6l_var3MUlTtTpTniETpTniRT_IJXspT0_EEEE_clI1XJLi1ELi2ELi3EEEEDaS2_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK5l_varMUlDpT_E_clIJiiiEEEDaS0_'\) and '-fabi-version=18' \('_ZNK5l_varMUlTpTyDpT_E_clIJiiiEEEDaS1_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK13l_tpl_tpl_tplMUlR6TPLTPLIT_EE_clI3TPLEEDaS2_'\) and '-fabi-version=18' \('_ZNK13l_tpl_tpl_tplMUlTtTtTyTnjEER6TPLTPLIT_EE_clI3TPLEEDaS3_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK9l_tpl_tplMUlR3TPLIT_EE_clI1UEEDaS2_'\) and '-fabi-version=18' \('_ZNK9l_tpl_tplMUlTtTyTnjER3TPLIT_EE_clI1UEEDaS3_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK13l_tpl_nt_autoMUlvE_clILi0EEEDav'\) and '-fabi-version=18' \('_ZNK13l_tpl_nt_autoMUlTnDavE_clILi0EEEDav'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK12l_tpl_nt_aryMUlRAT__iE_clILi2EEEDaS0_'\) and '-fabi-version=18' \('_ZNK12l_tpl_nt_aryMUlTniRAT__iE_clILi2EEEDaS1_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK10l_tpl_autoMUlT_T0_E_clIiiEEDaS_S0_'\) and '-fabi-version=18' \('_ZNK10l_tpl_autoMUlTyT_T0_E_clIiiEEDaS0_S1_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK5l_tplMUlT_E_clIiEEDaS_'\) and '-fabi-version=18' \('_ZNK5l_tplMUlTyT_E_clIiEEDaS0_'\) [^\n]*\n} }
+// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK6l_autoMUlT_E_clIiEEDaS_'\) and '-fabi-version=18' \('_ZNK6l_autoMUlT_E_clIiEEDaS0_'\) [^\n]*\n} }
diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1.h b/gcc/testsuite/g++.dg/abi/lambda-tpl1.h
new file mode 100644
index 0000000..5d6fe5e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1.h
@@ -0,0 +1,59 @@
+inline auto l_auto = [] (auto) {};
+
+inline auto l_tpl = [] <typename T> (T) {};
+
+inline auto l_tpl_auto = [] <typename T> (T, auto) {};
+
+inline auto l_tpl_nt_ary = [] <int I> (int (&)[I]) {};
+
+inline auto l_tpl_nt_auto = [] <auto I = 0> () {};
+
+template<typename T, unsigned I> class U;
+
+template<template<typename, unsigned> typename> class TPL {};
+inline auto l_tpl_tpl = [] <template<typename, unsigned> typename T> (TPL<T> &) {};
+
+template<template<template<typename, unsigned> typename> typename> class TPLTPL {};
+inline auto l_tpl_tpl_tpl = []<template<template<typename, unsigned> typename> typename T> (TPLTPL<T> &) {};
+
+inline auto l_var = []<typename... Args> (Args...) {};
+
+#if FIXME // we fail to parse (&...) correctly
+inline auto l_var2 = []<int... I> (int (&...)[I]) {};
+#endif
+
+template<int...I> class X {};
+inline auto l_var3 = []<template<int...> typename T, int...I> (T<I...> &a) {};
+
+template<template<typename, unsigned> typename...T> class Y{};
+inline auto l_var4 = []<template<typename, unsigned> typename... T> (Y<T...> &a) {};
+
+template<int I> inline void Fn ()
+{
+ auto l = []<typename T> (T) {};
+ l (1);
+}
+
+void f ()
+{
+ l_auto (1);
+ l_tpl (1);
+ l_tpl_auto (1, 1);
+ int ary[2];
+ l_tpl_nt_ary (ary);
+ l_tpl_nt_auto ();
+ TPL<U> v;
+ l_tpl_tpl (v);
+ TPLTPL<TPL> u;
+ l_tpl_tpl_tpl (u);
+ l_var (1, 2, 3);
+#if FIXME
+ l_var2 (ary, ary);
+#endif
+ X<1,2,3> x;
+ l_var3 (x);
+ Y<U,U> y;
+ l_var4 (y);
+
+ Fn<1> ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/elision4.C b/gcc/testsuite/g++.dg/cpp23/elision4.C
index c19b86b..d39053a 100644
--- a/gcc/testsuite/g++.dg/cpp23/elision4.C
+++ b/gcc/testsuite/g++.dg/cpp23/elision4.C
@@ -1,5 +1,6 @@
// PR c++/101165 - P2266R1 - Simpler implicit move
// { dg-do compile { target c++23 } }
+// { dg-options "-Wdangling-reference" }
// Test from P2266R1, $ 5.2. LibreOffice OString constructor.
struct X {
@@ -33,6 +34,6 @@ T& temporary2(T&& x) { return static_cast<T&>(x); }
void
test ()
{
- int& r1 = temporary1 (42);
- int& r2 = temporary2 (42);
+ int& r1 = temporary1 (42); // { dg-warning "dangling reference" }
+ int& r2 = temporary2 (42); // { dg-warning "dangling reference" }
}
diff --git a/gcc/testsuite/g++.dg/cpp23/elision7.C b/gcc/testsuite/g++.dg/cpp23/elision7.C
index 19fa89a..0045842 100644
--- a/gcc/testsuite/g++.dg/cpp23/elision7.C
+++ b/gcc/testsuite/g++.dg/cpp23/elision7.C
@@ -1,5 +1,6 @@
// PR c++/101165 - P2266R1 - Simpler implicit move
// { dg-do compile { target c++23 } }
+// { dg-options "-Wdangling-reference" }
struct X {
X ();
@@ -68,5 +69,5 @@ f7 (T &&t)
void
do_f7 ()
{
- const int &x = f7 (0);
+ const int &x = f7 (0); // { dg-warning "dangling reference" }
}
diff --git a/gcc/testsuite/g++.dg/cpp23/ext-floating12.C b/gcc/testsuite/g++.dg/cpp23/ext-floating12.C
new file mode 100644
index 0000000..77ee4c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/ext-floating12.C
@@ -0,0 +1,182 @@
+// P1467R9 - Extended floating-point types and standard names.
+// { dg-do compile { target { c++23 && { i?86-*-linux* x86_64-*-linux* } } } }
+// { dg-options "" }
+
+#include <complex>
+#include <stdfloat>
+
+#if !defined(__STDCPP_FLOAT32_T__) \
+ || !defined(__STDCPP_FLOAT64_T__) || !defined(__STDCPP_FLOAT128_T__) \
+ || __FLT_MAX_EXP__ != __FLT32_MAX_EXP__ || __FLT_MANT_DIG__ != __FLT32_MANT_DIG__ \
+ || __DBL_MAX_EXP__ != __FLT64_MAX_EXP__ || __DBL_MANT_DIG__ != __FLT64_MANT_DIG__ \
+ || __LDBL_MAX_EXP__ != __FLT128_MAX_EXP__ || __LDBL_MANT_DIG__ >= __FLT128_MANT_DIG__ \
+ || !defined(__SIZEOF_FLOAT128__)
+#error Unexpected set of floating point types
+#endif
+
+using namespace std;
+
+int
+main()
+{
+ complex<float> a01(complex<float>(1.0f, 2.0f));
+ complex<float> a02 = complex<float>(1.0f, 2.0f);
+ complex<float> a03(complex<double>(1.0, 2.0));
+ complex<float> a04 = complex<double>(1.0, 2.0); // { dg-error "conversion from 'complex<double>' to non-scalar type 'complex<float>' requested" }
+ complex<float> a05(complex<long double>(1.0L, 2.0L));
+ complex<float> a06 = complex<long double>(1.0L, 2.0L); // { dg-error "conversion from 'complex<long double>' to non-scalar type 'complex<float>' requested" }
+ complex<float> a07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<float> a08 = complex<float32_t>(1.0f32, 2.0f32);
+ complex<float> a09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<float> a10 = complex<float64_t>(1.0f64, 2.0f64); // { dg-error "conversion from 'complex<_Float64>' to non-scalar type 'complex<float>' requested" }
+ complex<float> a11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<float> a12 = complex<float128_t>(1.0f128, 2.0f128); // { dg-error "conversion from 'complex<_Float128>' to non-scalar type 'complex<float>' requested" }
+#ifdef __STDCPP_FLOAT16_T__
+ complex<float> a13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<float> a14 = complex<float16_t>(1.0f16, 2.0f16);
+#endif
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<float> a15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<float> a16 = complex<bfloat16_t>(1.0bf16, 2.0bf16);
+#endif
+ complex<double> b01(complex<float>(1.0f, 2.0f));
+ complex<double> b02 = complex<float>(1.0f, 2.0f);
+ complex<double> b03(complex<double>(1.0, 2.0));
+ complex<double> b04 = complex<double>(1.0, 2.0);
+ complex<double> b05(complex<long double>(1.0L, 2.0L));
+ complex<double> b06 = complex<long double>(1.0L, 2.0L); // { dg-error "conversion from 'complex<long double>' to non-scalar type 'complex<double>' requested" }
+ complex<double> b07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<double> b08 = complex<float32_t>(1.0f32, 2.0f32);
+ complex<double> b09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<double> b10 = complex<float64_t>(1.0f64, 2.0f64);
+ complex<double> b11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<double> b12 = complex<float128_t>(1.0f128, 2.0f128); // { dg-error "conversion from 'complex<_Float128>' to non-scalar type 'complex<double>' requested" }
+#ifdef __STDCPP_FLOAT16_T__
+ complex<double> b13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<double> b14 = complex<float16_t>(1.0f16, 2.0f16);
+#endif
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<double> b15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<double> b16 = complex<bfloat16_t>(1.0bf16, 2.0bf16);
+#endif
+ complex<long double> c01(complex<float>(1.0f, 2.0f));
+ complex<long double> c02 = complex<float>(1.0f, 2.0f);
+ complex<long double> c03(complex<double>(1.0, 2.0));
+ complex<long double> c04 = complex<double>(1.0, 2.0);
+ complex<long double> c05(complex<long double>(1.0L, 2.0L));
+ complex<long double> c06 = complex<long double>(1.0L, 2.0L);
+ complex<long double> c07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<long double> c08 = complex<float32_t>(1.0f32, 2.0f32);
+ complex<long double> c09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<long double> c10 = complex<float64_t>(1.0f64, 2.0f64);
+ complex<long double> c11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<long double> c12 = complex<float128_t>(1.0f128, 2.0f128); // { dg-error "conversion from 'complex<_Float128>' to non-scalar type 'complex<long double>' requested" }
+#ifdef __STDCPP_FLOAT16_T__
+ complex<long double> c13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<long double> c14 = complex<float16_t>(1.0f16, 2.0f16);
+#endif
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<long double> c15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<long double> c16 = complex<bfloat16_t>(1.0bf16, 2.0bf16);
+#endif
+ complex<float32_t> d01(complex<float>(1.0f, 2.0f));
+ complex<float32_t> d02 = complex<float>(1.0f, 2.0f);
+ complex<float32_t> d03(complex<double>(1.0, 2.0));
+ complex<float32_t> d04 = complex<double>(1.0, 2.0); // { dg-error "conversion from 'complex<double>' to non-scalar type 'complex<_Float32>' requested" }
+ complex<float32_t> d05(complex<long double>(1.0L, 2.0L));
+ complex<float32_t> d06 = complex<long double>(1.0L, 2.0L); // { dg-error "conversion from 'complex<long double>' to non-scalar type 'complex<_Float32>' requested" }
+ complex<float32_t> d07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<float32_t> d08 = complex<float32_t>(1.0f32, 2.0f32);
+ complex<float32_t> d09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<float32_t> d10 = complex<float64_t>(1.0f64, 2.0f64); // { dg-error "conversion from 'complex<_Float64>' to non-scalar type 'complex<_Float32>' requested" }
+ complex<float32_t> d11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<float32_t> d12 = complex<float128_t>(1.0f128, 2.0f128); // { dg-error "conversion from 'complex<_Float128>' to non-scalar type 'complex<_Float32>' requested" }
+#ifdef __STDCPP_FLOAT16_T__
+ complex<float32_t> d13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<float32_t> d14 = complex<float16_t>(1.0f16, 2.0f16);
+#endif
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<float32_t> d15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<float32_t> d16 = complex<bfloat16_t>(1.0bf16, 2.0bf16);
+#endif
+ complex<float64_t> e01(complex<float>(1.0f, 2.0f));
+ complex<float64_t> e02 = complex<float>(1.0f, 2.0f);
+ complex<float64_t> e03(complex<double>(1.0, 2.0));
+ complex<float64_t> e04 = complex<double>(1.0, 2.0);
+ complex<float64_t> e05(complex<long double>(1.0L, 2.0L));
+ complex<float64_t> e06 = complex<long double>(1.0L, 2.0L); // { dg-error "conversion from 'complex<long double>' to non-scalar type 'complex<_Float64>' requested" }
+ complex<float64_t> e07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<float64_t> e08 = complex<float32_t>(1.0f32, 2.0f32);
+ complex<float64_t> e09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<float64_t> e10 = complex<float64_t>(1.0f64, 2.0f64);
+ complex<float64_t> e11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<float64_t> e12 = complex<float128_t>(1.0f128, 2.0f128); // { dg-error "conversion from 'complex<_Float128>' to non-scalar type 'complex<_Float64>' requested" }
+#ifdef __STDCPP_FLOAT16_T__
+ complex<float64_t> e13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<float64_t> e14 = complex<float16_t>(1.0f16, 2.0f16);
+#endif
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<float64_t> e15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<float64_t> e16 = complex<bfloat16_t>(1.0bf16, 2.0bf16);
+#endif
+ complex<float128_t> f01(complex<float>(1.0f, 2.0f));
+ complex<float128_t> f02 = complex<float>(1.0f, 2.0f);
+ complex<float128_t> f03(complex<double>(1.0, 2.0));
+ complex<float128_t> f04 = complex<double>(1.0, 2.0);
+ complex<float128_t> f05(complex<long double>(1.0L, 2.0L));
+ complex<float128_t> f06 = complex<long double>(1.0L, 2.0L);
+ complex<float128_t> f07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<float128_t> f08 = complex<float32_t>(1.0f32, 2.0f32);
+ complex<float128_t> f09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<float128_t> f10 = complex<float64_t>(1.0f64, 2.0f64);
+ complex<float128_t> f11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<float128_t> f12 = complex<float128_t>(1.0f128, 2.0f128);
+#ifdef __STDCPP_FLOAT16_T__
+ complex<float128_t> f13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<float128_t> f14 = complex<float16_t>(1.0f16, 2.0f16);
+#endif
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<float128_t> f15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<float128_t> f16 = complex<bfloat16_t>(1.0bf16, 2.0bf16);
+#endif
+#ifdef __STDCPP_FLOAT16_T__
+ complex<float16_t> g01(complex<float>(1.0f, 2.0f));
+ complex<float16_t> g02 = complex<float>(1.0f, 2.0f); // { dg-error "conversion from 'complex<float>' to non-scalar type 'complex<_Float16>' requested" "" { target float16 } }
+ complex<float16_t> g03(complex<double>(1.0, 2.0));
+ complex<float16_t> g04 = complex<double>(1.0, 2.0); // { dg-error "conversion from 'complex<double>' to non-scalar type 'complex<_Float16>' requested" "" { target float16 } }
+ complex<float16_t> g05(complex<long double>(1.0L, 2.0L));
+ complex<float16_t> g06 = complex<long double>(1.0L, 2.0L); // { dg-error "conversion from 'complex<long double>' to non-scalar type 'complex<_Float16>' requested" "" { target float16 } }
+ complex<float16_t> g07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<float16_t> g08 = complex<float32_t>(1.0f32, 2.0f32); // { dg-error "conversion from 'complex<_Float32>' to non-scalar type 'complex<_Float16>' requested" "" { target float16 } }
+ complex<float16_t> g09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<float16_t> g10 = complex<float64_t>(1.0f64, 2.0f64); // { dg-error "conversion from 'complex<_Float64>' to non-scalar type 'complex<_Float16>' requested" "" { target float16 } }
+ complex<float16_t> g11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<float16_t> g12 = complex<float128_t>(1.0f128, 2.0f128); // { dg-error "conversion from 'complex<_Float128>' to non-scalar type 'complex<_Float16>' requested" "" { target float16 } }
+ complex<float16_t> g13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<float16_t> g14 = complex<float16_t>(1.0f16, 2.0f16);
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<float16_t> g15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<float16_t> g16 = complex<bfloat16_t>(1.0bf16, 2.0bf16); // { dg-error "conversion from 'complex<\[^\n\r]*>' to non-scalar type 'complex<_Float16>' requested" "" { target { float16 && bfloat16 } } }
+#endif
+#endif
+#ifdef __STDCPP_BFLOAT16_T__
+ complex<bfloat16_t> h01(complex<float>(1.0f, 2.0f));
+ complex<bfloat16_t> h02 = complex<float>(1.0f, 2.0f); // { dg-error "conversion from 'complex<float>' to non-scalar type 'complex<\[^\n\r]*>' requested" "" { target bfloat16 } }
+ complex<bfloat16_t> h03(complex<double>(1.0, 2.0));
+ complex<bfloat16_t> h04 = complex<double>(1.0, 2.0); // { dg-error "conversion from 'complex<double>' to non-scalar type 'complex<\[^\n\r]*>' requested" "" { target bfloat16 } }
+ complex<bfloat16_t> h05(complex<long double>(1.0L, 2.0L));
+ complex<bfloat16_t> h06 = complex<long double>(1.0L, 2.0L); // { dg-error "conversion from 'complex<long double>' to non-scalar type 'complex<\[^\n\r]*>' requested" "" { target bfloat16 } }
+ complex<bfloat16_t> h07(complex<float32_t>(1.0f32, 2.0f32));
+ complex<bfloat16_t> h08 = complex<float32_t>(1.0f32, 2.0f32); // { dg-error "conversion from 'complex<_Float32>' to non-scalar type 'complex<\[^\n\r]*>' requested" "" { target bfloat16 } }
+ complex<bfloat16_t> h09(complex<float64_t>(1.0f64, 2.0f64));
+ complex<bfloat16_t> h10 = complex<float64_t>(1.0f64, 2.0f64); // { dg-error "conversion from 'complex<_Float64>' to non-scalar type 'complex<\[^\n\r]*>' requested" "" { target bfloat16 } }
+ complex<bfloat16_t> h11(complex<float128_t>(1.0f128, 2.0f128));
+ complex<bfloat16_t> h12 = complex<float128_t>(1.0f128, 2.0f128); // { dg-error "conversion from 'complex<_Float128>' to non-scalar type 'complex<\[^\n\r]*>' requested" "" { target bfloat16 } }
+#ifdef __STDCPP_FLOAT16_T__
+ complex<bfloat16_t> h13(complex<float16_t>(1.0f16, 2.0f16));
+ complex<bfloat16_t> h14 = complex<float16_t>(1.0f16, 2.0f16); // { dg-error "conversion from 'complex<_Float16>' to non-scalar type 'complex<\[^\n\r]*>' requested" "" { target { float16 && bfloat16 } } }
+#endif
+ complex<bfloat16_t> h15(complex<bfloat16_t>(1.0bf16, 2.0bf16));
+ complex<bfloat16_t> h16 = complex<bfloat16_t>(1.0bf16, 2.0bf16);
+#endif
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops2.C b/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops2.C
new file mode 100644
index 0000000..627e8a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops2.C
@@ -0,0 +1,26 @@
+// PR c++/107382
+// PR c++/107383
+// { dg-do compile }
+// { dg-options "-O2 -fexcess-precision=standard" }
+
+void
+foo ()
+{
+ float t[2] = { 1, 2 };
+ int const *s = 0;
+ t[1] / s; // { dg-error "invalid operands of types 'float' and 'const int\\\*' to binary 'operator/'" }
+}
+
+void
+bar ()
+{
+ float t[2] = { 1, 2 };
+ int const *s[2] = { 0, 0 };
+ t[1] / s[0]; // { dg-error "invalid operands of types 'float' and 'const int\\\*' to binary 'operator/'" }
+}
+
+void
+baz (float a, int* b)
+{
+ a -= b; // { dg-error "invalid operands of types 'float' and 'int\\\*' to binary 'operator-'" }
+}
diff --git a/gcc/testsuite/g++.dg/gomp/clause-4.C b/gcc/testsuite/g++.dg/gomp/clause-4.C
index 06b91e8..db191e2 100644
--- a/gcc/testsuite/g++.dg/gomp/clause-4.C
+++ b/gcc/testsuite/g++.dg/gomp/clause-4.C
@@ -14,7 +14,7 @@ foo (int x)
;
#pragma omp p num_threads(4),if(1),private(x)
;
-#pragma omp p, num_threads (4), if (1), private (x) // { dg-error "clause before" }
+#pragma omp p, num_threads (4), if (1), private (x)
;
#pragma omp p num_threads (4), if (1), private (x), // { dg-error "clause before" }
;
diff --git a/gcc/testsuite/g++.dg/modules/enum-10_a.H b/gcc/testsuite/g++.dg/modules/enum-10_a.H
new file mode 100644
index 0000000..fb7d10a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/enum-10_a.H
@@ -0,0 +1,5 @@
+// PR c++/106848
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+typedef enum memory_order { memory_order_seq_cst } memory_order;
diff --git a/gcc/testsuite/g++.dg/modules/enum-10_b.C b/gcc/testsuite/g++.dg/modules/enum-10_b.C
new file mode 100644
index 0000000..76dc315
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/enum-10_b.C
@@ -0,0 +1,6 @@
+// PR c++/106848
+// { dg-additional-options "-fmodules-ts -g" }
+
+import "enum-10_a.H";
+
+memory_order x = memory_order_seq_cst;
diff --git a/gcc/testsuite/g++.dg/modules/enum-11_a.H b/gcc/testsuite/g++.dg/modules/enum-11_a.H
new file mode 100644
index 0000000..1aecabf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/enum-11_a.H
@@ -0,0 +1,5 @@
+// PR c++/102600
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+enum class byte : unsigned char { };
diff --git a/gcc/testsuite/g++.dg/modules/enum-11_b.C b/gcc/testsuite/g++.dg/modules/enum-11_b.C
new file mode 100644
index 0000000..4d77cab
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/enum-11_b.C
@@ -0,0 +1,8 @@
+// PR c++/102600
+// { dg-additional-options -fmodules-ts }
+
+import "enum-11_a.H";
+
+void push(byte) {}
+void write(char v) { push(static_cast<byte>(v)); }
+int main() { write(char{}); }
diff --git a/gcc/testsuite/g++.dg/modules/enum-9_a.H b/gcc/testsuite/g++.dg/modules/enum-9_a.H
new file mode 100644
index 0000000..0dd4a0f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/enum-9_a.H
@@ -0,0 +1,13 @@
+// PR c++/106848
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+template<typename _T1>
+struct pair {
+ using type = void(*)(const _T1&);
+};
+
+struct _ScannerBase {
+ enum _TokenT { _S_token_anychar };
+ pair<_TokenT> _M_token_tbl;
+};
diff --git a/gcc/testsuite/g++.dg/modules/enum-9_b.C b/gcc/testsuite/g++.dg/modules/enum-9_b.C
new file mode 100644
index 0000000..95e2812
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/enum-9_b.C
@@ -0,0 +1,6 @@
+// PR c++/106848
+// { dg-additional-options "-fmodules-ts -g" }
+
+import "enum-9_a.H";
+
+_ScannerBase s;
diff --git a/gcc/testsuite/g++.dg/other/i386-2.C b/gcc/testsuite/g++.dg/other/i386-2.C
index ebd01fe..dd3e71f 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 -mavx512fp16 -mavxifma -mavxvnniint8" } */
+/* { 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 -mavxifma -mavxvnniint8 -mavxneconvert" } */
/* 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 b66498f..cd7045c 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 -mavx512fp16 -mavxifma -mavxvnniint8" } */
+/* { 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 -mavxifma -mavxvnniint8 -mavxneconvert" } */
/* 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/warn/Wdangling-pointer-2.C b/gcc/testsuite/g++.dg/warn/Wdangling-pointer-2.C
index 151418f..802ac9c 100644
--- a/gcc/testsuite/g++.dg/warn/Wdangling-pointer-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wdangling-pointer-2.C
@@ -1,5 +1,5 @@
/* { dg-do compile }
- { dg-options "-O1 -Wall -Wno-class-memaccess" } */
+ { dg-options "-O1 -Wall -Wno-class-memaccess -Wno-dangling-reference" } */
struct A { A (); };
diff --git a/gcc/testsuite/g++.dg/warn/Wdangling-reference1.C b/gcc/testsuite/g++.dg/warn/Wdangling-reference1.C
new file mode 100644
index 0000000..97c81ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wdangling-reference1.C
@@ -0,0 +1,144 @@
+// PR c++/106393
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wdangling-reference" }
+
+const int& f(const int& i) { return i; }
+const int& f_(const int& i) { return i; }
+const int& h(int);
+const int& rp(const int *);
+int g;
+const int& globref(const int&) { return g; }
+struct X {
+ int* i;
+ operator const int&() const { return *i; }
+};
+X x{&g};
+
+const int& r1 = f(10); // { dg-warning "dangling reference" }
+// r2 = _ZGR2r2_ = (int) *f ((const int &) &TARGET_EXPR <D.2429, 10>) + 1; (const int &) &_ZGR2r2_
+const int& r2 = f(10) + 1;
+// Don't warn here, we have
+// r3 = f (X::operator const int& (&x))
+const int& r3 = f(x);
+// Don't warn here, because we've seen the definition of globref
+// and could figure out that it may not return one of its parms.
+// Questionable -- it can also hide bugs --, but it helps here.
+const int& r4 = globref(1);
+const int& r5 = (42, f(10)); // { dg-warning "dangling reference" }
+const int& r6 = (f(10), 42);
+const int& r7 = (f(10)); // { dg-warning "dangling reference" }
+const int& r8 = g ? f(10) : f(9); // { dg-warning "dangling reference" }
+const int& r9 = (42, g ? f(10) : f(9)); // { dg-warning "dangling reference" }
+const int& r10 = (g ? f(10) : f(9), 42);
+// Binds to a reference temporary for r11. No dangling reference.
+const int& r11 = g ? f(10) : 9;
+const int& r12 = g ? 9 : f(10);
+// r12 = f (f ((const int &) &TARGET_EXPR <D.2459, 1>))
+const int& r13 = f(f(1)); // { dg-warning "dangling reference" }
+const int& r14 = f(f_(1)); // { dg-warning "dangling reference" }
+const int& r15 = f(g ? f(1) : f(2)); // { dg-warning "dangling reference" }
+const int& r16 = f(*&f(1)); // { dg-warning "dangling reference" }
+const int& r17 = rp(&f(1));
+const int& r18 = rp(&f(g));
+const int& r19 = h(f(1));
+// Other forms of initializers.
+const int& r20(f(10)); // { dg-warning "dangling reference" }
+const int& r21(f(10)); // { dg-warning "dangling reference" }
+// Returns a ref, but doesn't have a parameter of reference type.
+const int& r22 = h(10);
+const int& r23 = g ? h(10) : f(10); // { dg-warning "dangling reference" }
+const int& r24 = g ? f(10) : h(10); // { dg-warning "dangling reference" }
+const int& r25 = g ? h(10) : (1, f(10)); // { dg-warning "dangling reference" }
+const int& r26 = g ? (1, f(10)) : h(10); // { dg-warning "dangling reference" }
+const int& r29 = f((f_(1), 1)); // { dg-warning "dangling reference" }
+const int& r30 = f((f_(1), g));
+
+struct Z {
+ operator int() { return 42; }
+};
+
+const int& r27 = f(Z()); // { dg-warning "dangling reference" }
+const int& r28 = f(true ? Z() : Z()); // { dg-warning "dangling reference" }
+
+const int& operator|(const int &, Z);
+const int& r31 = 1 | Z(); // { dg-warning "dangling reference" }
+
+// OK: the reference is bound to the 10 so still valid at the point
+// where it's copied into i1.
+int i1 = f(10);
+
+int
+test1 ()
+{
+ const int &lr = f(10); // { dg-warning "dangling reference" }
+ int i2 = f(10);
+ return lr;
+}
+
+struct B { };
+struct D : B { };
+struct C {
+ D d;
+};
+
+C c;
+D d;
+
+using U = D[3];
+
+const B& frotz(const D&);
+const B& b1 = frotz(C{}.d); // { dg-warning "dangling reference" }
+const B& b2 = frotz(D{}); // { dg-warning "dangling reference" }
+const B& b3 = frotz(c.d);
+const B& b4 = frotz(d);
+const B& b5 = frotz(U{}[0]); // { dg-warning "dangling reference" }
+
+// Try returning a subobject.
+const B& bar (const D& d) { return d; }
+const B& b6 = bar (D{}); // { dg-warning "dangling reference" }
+const B& baz (const C& c) { return c.d; }
+const B& b7 = baz (C{}); // { dg-warning "dangling reference" }
+const D& qux (const C& c) { return c.d; }
+const D& d1 = qux (C{}); // { dg-warning "dangling reference" }
+
+struct E {
+ E(int);
+};
+const E& operator*(const E&);
+const E& b8 = *E(1); // { dg-warning "dangling reference" }
+
+struct F : virtual B { };
+struct G : virtual B { };
+struct H : F, G { };
+const B& yum (const F& f) { return f; }
+const B& b9 = yum (F{}); // { dg-warning "dangling reference" }
+const B& lox (const H& h) { return h; }
+const B& b10 = lox (H{}); // { dg-warning "dangling reference" }
+
+struct S {
+ const int &r; // { dg-warning "dangling reference" }
+ S() : r(f(10)) { } // { dg-message "destroyed" }
+};
+
+// From cppreference.
+template<class T>
+const T& max(const T& a, const T& b)
+{
+ return (a < b) ? b : a;
+}
+
+int n = 1;
+const int& refmax = max(n - 1, n + 1); // { dg-warning "dangling reference" }
+
+struct Y {
+ operator int&();
+ operator int&&();
+ const int& foo(const int&);
+};
+
+// x1 = Y::operator int&& (&TARGET_EXPR <D.2410, {}>)
+int&& x1 = Y(); // { dg-warning "dangling reference" }
+int&& x2 = Y{}; // { dg-warning "dangling reference" }
+int& x3 = Y(); // { dg-warning "dangling reference" }
+int& x4 = Y{}; // { dg-warning "dangling reference" }
+const int& t1 = Y().foo(10); // { dg-warning "dangling reference" }
diff --git a/gcc/testsuite/g++.dg/warn/Wdangling-reference2.C b/gcc/testsuite/g++.dg/warn/Wdangling-reference2.C
new file mode 100644
index 0000000..dafdb43
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wdangling-reference2.C
@@ -0,0 +1,28 @@
+// PR c++/106393
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wdangling-reference" }
+
+namespace std {
+struct any {};
+template <typename _ValueType> _ValueType any_cast(any &&);
+template <typename _Tp> struct remove_reference { using type = _Tp; };
+template <typename _Tp> _Tp forward(typename remove_reference<_Tp>::type);
+template <typename _Tp> typename remove_reference<_Tp>::type move(_Tp);
+} // namespace std
+
+const int &r = std::any_cast<int&>(std::any()); // { dg-warning "dangling reference" }
+
+template <class T> struct C {
+ T t_; // { dg-warning "dangling reference" }
+ C(T);
+ template <class U> C(U c) : t_(std::forward<T>(c.t_)) {}
+};
+struct A {};
+struct B {
+ B(A);
+};
+int main() {
+ A a;
+ C<A> ca(a);
+ C<B &&>(std::move(ca));
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wdangling-reference3.C b/gcc/testsuite/g++.dg/warn/Wdangling-reference3.C
new file mode 100644
index 0000000..4bc20c1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wdangling-reference3.C
@@ -0,0 +1,24 @@
+// PR c++/106393
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wdangling-reference" }
+
+struct A {
+ int ar[4];
+ int& operator[](int i) { return ar[i]; }
+};
+const int &r = A()[2]; // { dg-warning "dangling reference" }
+
+struct S {
+ const S& self () { return *this; }
+};
+const S& s = S().self(); // { dg-warning "dangling reference" }
+
+struct G {
+ const G& g() { return *this; }
+};
+
+struct F {
+ G& f();
+};
+
+const G& g = F().f().g(); // { dg-warning "dangling reference" }
diff --git a/gcc/testsuite/g++.dg/warn/Wdangling-reference4.C b/gcc/testsuite/g++.dg/warn/Wdangling-reference4.C
new file mode 100644
index 0000000..aee7a29
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wdangling-reference4.C
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++17 } }
+// { dg-options "-Wdangling-reference" }
+// Check that we warn here even without -Wsystem-headers.
+
+#include <optional>
+#include <string>
+
+auto f() -> std::optional<std::string>;
+
+void
+g ()
+{
+ for (char c : f().value()) { (void) c; } // { dg-warning "dangling reference" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wold-style-definition-2.c b/gcc/testsuite/gcc.dg/Wold-style-definition-2.c
index a69aae6..8e297c9 100644
--- a/gcc/testsuite/gcc.dg/Wold-style-definition-2.c
+++ b/gcc/testsuite/gcc.dg/Wold-style-definition-2.c
@@ -5,6 +5,6 @@
/* { dg-do compile } */
/* { dg-options "-Wold-style-definition" } */
-void bar1 ( ... ) {} /* { dg-error "ISO C requires a named argument" } */
+void bar1 ( ... ) {}
void bar2 (int a, ... ) {}
diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-3.c b/gcc/testsuite/gcc.dg/analyzer/fd-3.c
index 55e84e3..8e71b14 100644
--- a/gcc/testsuite/gcc.dg/analyzer/fd-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-3.c
@@ -50,9 +50,9 @@ test_5 (char *path, void *buf)
int flags = O_RDONLY;
if (some_condition())
flags |= O_NOATIME;
- int fd = open (path, flags);
+ int fd = open (path, flags); /* { dg-message "\\(1\\) opened here" } */
read (fd, buf, 1); /* { dg-warning "'read' on possibly invalid file descriptor 'fd'" } */
- /* { dg-message "\\(1\\) 'fd' could be invalid" "" { target *-*-* } .-1 } */
+ /* { dg-message "\\(2\\) 'fd' could be invalid" "" { target *-*-* } .-1 } */
close (fd);
}
@@ -82,4 +82,16 @@ test_7 (char *path, void *buf)
}
close(fd);
-} \ No newline at end of file
+}
+
+void
+test_read_from_symbolic_fd (int fd, void *buf)
+{
+ read (fd, buf, 1);
+}
+
+void
+test_write_to_symbolic_fd (int fd, void *buf)
+{
+ write (fd, buf, 1);
+}
diff --git a/gcc/testsuite/gcc.dg/c11-enum-4.c b/gcc/testsuite/gcc.dg/c11-enum-4.c
new file mode 100644
index 0000000..57dd92a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-enum-4.c
@@ -0,0 +1,7 @@
+/* Test C2x enumerations with fixed underlying type are diagnosed for C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+enum e1 : int; /* { dg-error "ISO C does not support specifying 'enum' underlying types" } */
+enum e2 : short { A }; /* { dg-error "ISO C does not support specifying 'enum' underlying types" } */
+enum : short { B }; /* { dg-error "ISO C does not support specifying 'enum' underlying types" } */
diff --git a/gcc/testsuite/gcc.dg/c11-enum-5.c b/gcc/testsuite/gcc.dg/c11-enum-5.c
new file mode 100644
index 0000000..91d681f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-enum-5.c
@@ -0,0 +1,7 @@
+/* Test C2x enumerations with fixed underlying type are diagnosed for C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+enum e1 : int; /* { dg-warning "ISO C does not support specifying 'enum' underlying types" } */
+enum e2 : short { A }; /* { dg-warning "ISO C does not support specifying 'enum' underlying types" } */
+enum : short { B }; /* { dg-warning "ISO C does not support specifying 'enum' underlying types" } */
diff --git a/gcc/testsuite/gcc.dg/c11-enum-6.c b/gcc/testsuite/gcc.dg/c11-enum-6.c
new file mode 100644
index 0000000..cd708bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-enum-6.c
@@ -0,0 +1,8 @@
+/* Test C2x enumerations with fixed underlying type are not diagnosed for C11
+ with -pedantic-errors -Wno-c11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors -Wno-c11-c2x-compat" } */
+
+enum e1 : int;
+enum e2 : short { A };
+enum : short { B };
diff --git a/gcc/testsuite/gcc.dg/c11-stdarg-1.c b/gcc/testsuite/gcc.dg/c11-stdarg-1.c
new file mode 100644
index 0000000..984577f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-stdarg-1.c
@@ -0,0 +1,7 @@
+/* Test variadic functions with no named parameters not supported in C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+int f (...); /* { dg-error "ISO C requires a named argument before" } */
+int g (int (...)); /* { dg-error "ISO C requires a named argument before" } */
+int h (...) { return 0; } /* { dg-error "ISO C requires a named argument before" } */
diff --git a/gcc/testsuite/gcc.dg/c11-stdarg-2.c b/gcc/testsuite/gcc.dg/c11-stdarg-2.c
new file mode 100644
index 0000000..bd115e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-stdarg-2.c
@@ -0,0 +1,7 @@
+/* Test variadic functions with no named parameters not supported in C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+int f (...); /* { dg-warning "ISO C requires a named argument before" } */
+int g (int (...)); /* { dg-warning "ISO C requires a named argument before" } */
+int h (...) { return 0; } /* { dg-warning "ISO C requires a named argument before" } */
diff --git a/gcc/testsuite/gcc.dg/c11-stdarg-3.c b/gcc/testsuite/gcc.dg/c11-stdarg-3.c
new file mode 100644
index 0000000..0092924
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-stdarg-3.c
@@ -0,0 +1,8 @@
+/* Test variadic functions with no named parameters not supported in C11, but
+ diagnostic disabled with -Wno-c11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors -Wno-c11-c2x-compat" } */
+
+int f (...);
+int g (int (...));
+int h (...) { return 0; }
diff --git a/gcc/testsuite/gcc.dg/c2x-enum-6.c b/gcc/testsuite/gcc.dg/c2x-enum-6.c
new file mode 100644
index 0000000..5ab9694
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-enum-6.c
@@ -0,0 +1,167 @@
+/* Test C2x enumerations with fixed underlying type. Valid code. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+/* Check a type while defining an enum (via a diagnostic for incompatible
+ pointer types if the wrong type was chosen). */
+#define TYPE_CHECK(cst, type) \
+ cst ## _type_check = sizeof (1 ? (type *) 0 : (typeof (cst) *) 0)
+
+extern int i;
+
+enum e1 : short { e1a = __SHRT_MAX__,
+ TYPE_CHECK (e1a, short),
+ e1z = (long long) 0,
+ TYPE_CHECK (e1z, enum e1),
+ e1b = -__SHRT_MAX__ - 1,
+ e1c,
+ TYPE_CHECK (e1c, enum e1) };
+extern enum e1 e1v;
+extern typeof (e1a) e1v;
+extern typeof (e1b) e1v;
+extern typeof (e1c) e1v;
+extern typeof (e1z) e1v;
+extern short e1v;
+static_assert (e1a == __SHRT_MAX__);
+static_assert (e1b == -__SHRT_MAX__ - 1);
+static_assert (e1c == -__SHRT_MAX__);
+static_assert (e1a > 0);
+static_assert (e1b < 0);
+static_assert (e1c < 0);
+static_assert (e1z == 0);
+extern typeof (+e1v) i;
+extern typeof (+e1a) i;
+extern typeof (e1a + e1b) i;
+enum e1 : short;
+enum e1 : volatile short;
+enum e1 : _Atomic short;
+enum e1 : typeof (short);
+
+enum e2 : bool { b0, b1, b0a = 0, b1a = 1 };
+extern enum e2 e2v;
+extern typeof (b0) e2v;
+extern typeof (b0a) e2v;
+extern typeof (b1) e2v;
+extern typeof (b1a) e2v;
+extern bool e2v;
+extern typeof (+e2v) i;
+extern typeof (+b0) i;
+static_assert (b0 == 0);
+static_assert (b1 == 1);
+static_assert (b0a == 0);
+static_assert (b1a == 1);
+
+enum e3 : volatile const _Atomic unsigned short;
+enum e3 : unsigned short { e3a, e3b };
+extern enum e3 e3v;
+extern typeof (e3a) e3v;
+extern typeof (e3b) e3v;
+extern unsigned short e3v;
+
+/* The enum type is complete from the end of the first enum type specifier
+ (which is nested inside another enum type specifier in this example). */
+enum e4 : typeof ((enum e4 : long { e4a = sizeof (enum e4) })0, 0L);
+extern enum e4 e4v;
+extern typeof (e4a) e4v;
+extern long e4v;
+
+enum e5 : unsigned int;
+extern enum e5 e5v;
+extern typeof (e5v + e5v) e5v;
+extern unsigned int e5v;
+
+enum : unsigned short { e6a, e6b, TYPE_CHECK (e6a, unsigned short) } e6v;
+extern typeof (e6a) e6v;
+extern typeof (e6b) e6v;
+extern unsigned short e6v;
+
+struct s1;
+struct s2 { int a; };
+union u1;
+union u2 { int a; };
+enum xe1 { XE1 };
+enum xe2 : long long { XE2 };
+enum xe3 : unsigned long;
+
+void
+f ()
+{
+ /* Tags can be redeclared in an inner scope. */
+ enum s1 : char;
+ enum s2 : int { S2 };
+ enum u1 : long { U1 };
+ enum u2 : unsigned char;
+ enum xe1 : long long;
+ enum xe2 : short;
+ enum xe3 : char { XE3 };
+ static_assert (sizeof (enum xe3) == 1);
+ static_assert (sizeof (enum xe2) == sizeof (short));
+ static_assert (sizeof (enum xe1) == sizeof (long long));
+}
+
+void *p;
+typeof (nullptr) np;
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main ()
+{
+ /* Conversions to enums with fixed underlying type have the same semantics as
+ converting to the underlying type. */
+ volatile enum e1 e1vm;
+ volatile enum e2 e2vm;
+ e1vm = __LONG_LONG_MAX__; /* { dg-warning "overflow" } */
+ if (e1vm != (short) __LONG_LONG_MAX__)
+ abort ();
+ e2vm = 10;
+ if (e2vm != 1)
+ abort ();
+ e2vm = 0;
+ if (e2vm != 0)
+ abort ();
+ /* Arithmetic on enums with fixed underlying type has the same semantics as
+ arithmetic on the underlying type; in particular, the special semantics
+ for bool apply to enums with bool as fixed underlying type. */
+ if (e2vm++ != 0)
+ abort ();
+ if (e2vm != 1)
+ abort ();
+ if (e2vm++ != 1)
+ abort ();
+ if (e2vm != 1)
+ abort ();
+ if (e2vm-- != 1)
+ abort ();
+ if (e2vm != 0)
+ abort ();
+ if (e2vm-- != 0)
+ abort ();
+ if (e2vm != 1)
+ abort ();
+ if (++e2vm != 1)
+ abort ();
+ if (e2vm != 1)
+ abort ();
+ e2vm = 0;
+ if (++e2vm != 1)
+ abort ();
+ if (e2vm != 1)
+ abort ();
+ if (--e2vm != 0)
+ abort ();
+ if (e2vm != 0)
+ abort ();
+ if (--e2vm != 1)
+ abort ();
+ if (e2vm != 1)
+ abort ();
+ e2vm = p;
+ e2vm = np;
+ e2vm = (bool) p;
+ e2vm = (bool) np;
+ if (e2vm != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-enum-7.c b/gcc/testsuite/gcc.dg/c2x-enum-7.c
new file mode 100644
index 0000000..08bae31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-enum-7.c
@@ -0,0 +1,97 @@
+/* Test C2x enumerations with fixed underlying type. Invalid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+/* An enum type specifier may only be used when the enum is defined, or in a
+ declaration of the form "enum name enum-type-specifier;". */
+extern enum e1 : int; /* { dg-error "storage class specifier in empty declaration with 'enum' underlying type" } */
+_Thread_local enum e2 : short; /* { dg-error "'_Thread_local' in empty declaration with 'enum' underlying type" } */
+const enum e3 : long; /* { dg-error "type qualifier in empty declaration with 'enum' underlying type" } */
+alignas (8) enum e4 : long; /* { dg-error "'alignas' in empty declaration with 'enum' underlying type" } */
+inline enum e5 : unsigned; /* { dg-error "'inline' in empty declaration" } */
+_Noreturn enum e6 : unsigned; /* { dg-error "'_Noreturn' in empty declaration" } */
+auto enum e7 : unsigned; /* { dg-error "'auto' in file-scope empty declaration" } */
+register enum e8 : unsigned; /* { dg-error "'register' in file-scope empty declaration" } */
+
+/* When the enum is defined, some extra declaration specifiers are permitted,
+ but diagnosed as useless. */
+extern enum e9 : int { E9 }; /* { dg-warning "useless storage class specifier in empty declaration" } */
+_Thread_local enum e10 : short { E10 }; /* { dg-warning "useless '_Thread_local' in empty declaration" } */
+const enum e11 : long { E11 }; /* { dg-warning "useless type qualifier in empty declaration" } */
+alignas (8) enum e12 : long { E12 }; /* { dg-warning "useless '_Alignas' in empty declaration" } */
+
+/* Nothing else may be declared with an enum type specifier for an enum not
+ being defined in that declaration. */
+enum e13 : short x13; /* { dg-error "'enum' underlying type may not be specified here" } */
+enum e14 : short f14 (); /* { dg-error "'enum' underlying type may not be specified here" } */
+typeof (enum e15 : long) x15; /* { dg-error "'enum' underlying type may not be specified here" } */
+int f16 (enum e16 : char p); /* { dg-error "'enum' underlying type may not be specified here" } */
+/* { dg-warning "will not be visible outside of this definition or declaration" "warning" { target *-*-* } .-1 } */
+int f17 (enum e17 : char); /* { dg-error "'enum' underlying type may not be specified here" } */
+/* { dg-warning "will not be visible outside of this definition or declaration" "warning" { target *-*-* } .-1 } */
+struct s18 { enum e18 : int x; }; /* { dg-error "'enum' underlying type may not be specified here" } */
+
+/* But those are OK if the enum content is defined. */
+enum e19 : short { E19 } x19;
+enum e20 : long { E20 } f20 ();
+typeof (enum e21 : long { E21 }) x21;
+int f22 (enum e22 : long long { E22 } p); /* { dg-warning "will not be visible outside of this definition or declaration" } */
+int f23 (enum e23 : long long { E23 } p); /* { dg-warning "will not be visible outside of this definition or declaration" } */
+struct s24 { enum e24 : int { E24 } x; };
+
+/* Incompatible kinds of tags in the same scope are errors. */
+struct s25;
+enum s25 : int; /* { dg-error "wrong kind of tag" } */
+struct s26;
+enum s26 : int { E26 }; /* { dg-error "wrong kind of tag" } */
+struct s27 { int x; };
+enum s27 : int; /* { dg-error "wrong kind of tag" } */
+struct s28 { int x; };
+enum s28 : int { E28 }; /* { dg-error "wrong kind of tag" } */
+union u29;
+enum u29 : int; /* { dg-error "wrong kind of tag" } */
+union u30;
+enum u30 : int { E30 }; /* { dg-error "wrong kind of tag" } */
+union u31 { int x; };
+enum u31 : int; /* { dg-error "wrong kind of tag" } */
+union u32 { int x; };
+enum u32 : int { E32 }; /* { dg-error "wrong kind of tag" } */
+
+/* If an enum has a fixed underlying type, that must be given when defining the
+ enum. */
+enum e33 : short;
+enum e33 { E33 }; /* { dg-error "'enum' declared with but defined without fixed underlying type" } */
+
+/* An enum defined without a fixed underlying type cannot then be declared with
+ one. */
+enum e34 { E34A = -__INT_MAX__, E34B = __INT_MAX__ };
+enum e34 : int; /* { dg-error "'enum' declared both with and without fixed underlying type" } */
+
+/* An enum with a fixed underlying type cannot be declared with an incompatible
+ fixed underlying type. */
+enum e35 : int;
+enum e35 : unsigned int; /* { dg-error "'enum' underlying type incompatible with previous declaration" } */
+enum e36 : int;
+enum e36 : unsigned int { E36 }; /* { dg-error "'enum' underlying type incompatible with previous declaration" } */
+enum e37 : unsigned int { E37 };
+enum e37 : int; /* { dg-error "'enum' underlying type incompatible with previous declaration" } */
+
+/* Enumeration constants must fit in the fixed underlying type. */
+enum e38 : unsigned char { E38 = (unsigned long long)((unsigned char) -1) + 1 }; /* { dg-error "enumerator value outside the range of underlying type" } */
+enum e39 : unsigned int { E39 = -1 }; /* { dg-error "enumerator value outside the range of underlying type" } */
+enum e40 : int { E40 = __INT_MAX__, E40A }; /* { dg-error "overflow in enumeration values" } */
+enum e41 : unsigned int { E41 = (unsigned int) -1, E41A }; /* { dg-error "overflow in enumeration values" } */
+enum e42 : bool { E42 = 2 }; /* { dg-error "enumerator value outside the range of underlying type" } */
+enum e43 : bool { E43 = 1, E43A }; /* { dg-error "overflow in enumeration values" } */
+
+/* The underlying type must be an integer type, not itself an enum (or
+ bit-precise) type. */
+enum e44 : double; /* { dg-error "invalid 'enum' underlying type" } */
+typedef int T;
+enum e45 : T;
+typedef int *TP;
+enum e46 : TP; /* { dg-error "invalid 'enum' underlying type" } */
+enum e47 : enum e45; /* { dg-error "invalid 'enum' underlying type" } */
+enum e48 : const; /* { dg-error "no 'enum' underlying type specified" } */
+/* 'restrict' is not valid on integer types. */
+enum e49 : int restrict; /* { dg-error "invalid use of 'restrict'" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-enum-8.c b/gcc/testsuite/gcc.dg/c2x-enum-8.c
new file mode 100644
index 0000000..f7757fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-enum-8.c
@@ -0,0 +1,7 @@
+/* Test C2x enumerations with fixed underlying type. Test -Wc11-c2x-compat
+ warnings. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" } */
+
+enum e1 : int; /* { dg-warning "ISO C does not support specifying 'enum' underlying types before" } */
+enum e2 : short { E2 }; /* { dg-warning "ISO C does not support specifying 'enum' underlying types before" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-1.c b/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
index 9501b51..9f2cb6c 100644
--- a/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
+++ b/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
@@ -226,6 +226,7 @@ test4 (void)
static void
test5 (int i, ...)
{
+ (void) i;
va_list ap;
va_start (ap, i);
if (va_arg (ap, void *))
diff --git a/gcc/testsuite/gcc.dg/c2x-stdarg-1.c b/gcc/testsuite/gcc.dg/c2x-stdarg-1.c
new file mode 100644
index 0000000..7def49d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-stdarg-1.c
@@ -0,0 +1,22 @@
+/* Test C2x variadic functions with no named parameters. Compilation tests,
+ valid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+int f (...);
+int g (int (...));
+int h (...) { return 0; }
+
+typedef int A[];
+typedef int A2[2];
+
+A *f1 (...);
+A2 *f1 (...);
+A *f1 (...) { return 0; }
+
+A2 *f2 (...);
+A *f2 (...);
+A2 *f2 (...) { return 0; }
+typeof (f1) f2;
+
+int t () { return f () + f (1) + f (1, 2) + h () + h (1.5, 2, f1) + g (f); }
diff --git a/gcc/testsuite/gcc.dg/c2x-stdarg-2.c b/gcc/testsuite/gcc.dg/c2x-stdarg-2.c
new file mode 100644
index 0000000..2778240
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-stdarg-2.c
@@ -0,0 +1,22 @@
+/* Test C2x variadic functions with no named parameters. Compilation tests,
+ valid code, verify not considered unprototyped functions. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wstrict-prototypes -Wold-style-definition" } */
+
+int f (...);
+int g (int (...));
+int h (...) { return 0; }
+
+typedef int A[];
+typedef int A2[2];
+
+A *f1 (...);
+A2 *f1 (...);
+A *f1 (...) { return 0; }
+
+A2 *f2 (...);
+A *f2 (...);
+A2 *f2 (...) { return 0; }
+typeof (f1) f2;
+
+int t () { return f () + f (1) + f (1, 2) + h () + h (1.5, 2, f1) + g (f); }
diff --git a/gcc/testsuite/gcc.dg/c2x-stdarg-3.c b/gcc/testsuite/gcc.dg/c2x-stdarg-3.c
new file mode 100644
index 0000000..e2e1406
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-stdarg-3.c
@@ -0,0 +1,16 @@
+/* Test C2x variadic functions with no named parameters. Compilation tests,
+ invalid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+int f (...); /* { dg-message "previous declaration" } */
+int f (); /* { dg-error "conflicting types" } */
+
+int f2 (...); /* { dg-message "previous declaration" } */
+int f2 (int); /* { dg-error "conflicting types" } */
+
+int g (); /* { dg-message "previous declaration" } */
+int g (...); /* { dg-error "conflicting types" } */
+
+int g2 (int); /* { dg-message "previous declaration" } */
+int g2 (...); /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-stdarg-4.c b/gcc/testsuite/gcc.dg/c2x-stdarg-4.c
new file mode 100644
index 0000000..1f8718d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-stdarg-4.c
@@ -0,0 +1,164 @@
+/* Test C2x variadic functions with no named parameters, or last named
+ parameter with a declaration not allowed in C17. Execution tests. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stdarg.h>
+
+extern void abort (void);
+extern void exit (int);
+
+double
+f (...)
+{
+ va_list ap;
+ va_start (ap);
+ double ret = va_arg (ap, int);
+ ret += va_arg (ap, double);
+ ret += va_arg (ap, int);
+ ret += va_arg (ap, double);
+ va_end (ap);
+ return ret;
+}
+
+void
+g (...)
+{
+ va_list ap;
+ va_start (ap, random ! ignored, ignored ** text);
+ for (int i = 0; i < 10; i++)
+ if (va_arg (ap, double) != i)
+ abort ();
+ va_end (ap);
+}
+
+void
+h1 (register int x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h2 (int x(), ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h3 (int x[10], ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h4 (char x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h5 (float x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h6 (volatile long x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+struct s { char c[1000]; };
+
+void
+h7 (volatile struct s x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+int
+main ()
+{
+ if (f (1, 2.0, 3, 4.0) != 10.0)
+ abort ();
+ g (0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
+ g (0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f);
+ h1 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h2 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h3 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h4 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h5 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h6 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h7 ((struct s) {}, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c
index 728493b..7e94052 100644
--- a/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c
@@ -4,7 +4,7 @@
/* { 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 "\[\t \]0x86000003\[\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 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c
new file mode 100644
index 0000000..e443d4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c
@@ -0,0 +1,44 @@
+/* Test BTF generation for 64 bits enums. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \].size\[\t \]myenum1,\[\t \]8" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \].size\[\t \]myenum2,\[\t \]8" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \].size\[\t \]myenum3,\[\t \]8" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x13000003\[\t \]+\[^\n\]*btt_info" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x93000003\[\t \]+\[^\n\]*btt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xffffffaa\[\t \]+\[^\n\]*bte_value_lo32" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xff\[\t \]+\[^\n\]*bte_value_hi32" 3 } } */
+/* { dg-final { scan-assembler-times "ascii \"B1.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"B2.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"B3.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"C1.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"C2.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"C3.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"D1.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"D2.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"D3.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
+/* { dg-final { scan-assembler-times "bte_value_lo32" 9 } } */
+/* { dg-final { scan-assembler-times "bte_value_hi32" 9 } } */
+
+enum default_enum
+{
+ B1 = 0xffffffffaa,
+ B2 = 0xbbbbbbbb,
+ B3 = 0xaabbccdd,
+} myenum1 = B1;
+
+enum explicit_unsigned
+{
+ C1 = 0xffffffffbbUL,
+ C2 = 0xbbbbbbbb,
+ C3 = 0xaabbccdd,
+} myenum2 = C1;
+
+enum signed64
+{
+ D1 = 0xffffffffaa,
+ D2 = 0xbbbbbbbb,
+ D3 = -0x1,
+} myenum3 = D1;
diff --git a/gcc/testsuite/gcc.dg/diagnostic-token-ranges.c b/gcc/testsuite/gcc.dg/diagnostic-token-ranges.c
index 7d7ec0a..31085be 100644
--- a/gcc/testsuite/gcc.dg/diagnostic-token-ranges.c
+++ b/gcc/testsuite/gcc.dg/diagnostic-token-ranges.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fdiagnostics-show-caret -Wc++-compat -std=c11" } */
+/* { dg-options "-fdiagnostics-show-caret -Wc++-compat -std=c11 -pedantic" } */
/* Verify that various diagnostics show source code ranges. */
@@ -48,7 +48,7 @@ void test_identifier_conflicts_with_cplusplus (void)
}
extern void
-bogus_varargs (...); /* { dg-error "ISO C requires a named argument before '...'" } */
+bogus_varargs (...); /* { dg-warning "ISO C requires a named argument before '...'" } */
/*
{ dg-begin-multiline-output "" }
bogus_varargs (...);
diff --git a/gcc/testsuite/gcc.dg/format/sentinel-1.c b/gcc/testsuite/gcc.dg/format/sentinel-1.c
index 0c8a2ac..16c75a8 100644
--- a/gcc/testsuite/gcc.dg/format/sentinel-1.c
+++ b/gcc/testsuite/gcc.dg/format/sentinel-1.c
@@ -15,7 +15,7 @@ extern char *envp[];
extern int a ATTR; /* { dg-warning "applies to function types" "sentinel" } */
extern void foo1 (const char *, ...) ATTR; /* { dg-message "note: declared here" } */
-extern void foo2 (...) ATTR; /* { dg-error "ISO C requires|named arguments" "sentinel" } */
+extern void foo2 (...) ATTR;
extern void foo3 () ATTR; /* { dg-warning "named arguments" "sentinel" } */
extern void foo4 (const char *, int) ATTR; /* { dg-warning "variadic functions" "sentinel" } */
extern void foo5 (const char *, ...) __attribute__ ((__sentinel__(1)));
diff --git a/gcc/testsuite/gcc.dg/gnu2x-enum-1.c b/gcc/testsuite/gcc.dg/gnu2x-enum-1.c
new file mode 100644
index 0000000..b72ed73
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu2x-enum-1.c
@@ -0,0 +1,11 @@
+/* Test C2x enumerations with fixed underlying type together with GNU
+ extensions: an enum cannot be forward declared without a fixed underlying
+ type and then declared or defined with one. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2x" } */
+
+enum e1;
+enum e1 : int; /* { dg-error "'enum' declared both with and without fixed underlying type" } */
+
+enum e2;
+enum e2 : long { A }; /* { dg-error "'enum' declared both with and without fixed underlying type" } */
diff --git a/gcc/testsuite/gcc.dg/gnu2x-stdarg-1.c b/gcc/testsuite/gcc.dg/gnu2x-stdarg-1.c
new file mode 100644
index 0000000..bb64cde
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu2x-stdarg-1.c
@@ -0,0 +1,8 @@
+/* Test variadic functions with no named parameters do not accept GNU
+ attributes before '...'. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2x" } */
+
+int f (__attribute__(()) ...); /* { dg-error "expected" } */
+int g (int (__attribute__(()) ...)); /* { dg-error "expected" } */
+int h (__attribute__(()) ...) { return 0; } /* { dg-error "expected" } */
diff --git a/gcc/testsuite/gcc.dg/gomp/clause-2.c b/gcc/testsuite/gcc.dg/gomp/clause-2.c
index 4b12fc8..4d37c41 100644
--- a/gcc/testsuite/gcc.dg/gomp/clause-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/clause-2.c
@@ -14,7 +14,7 @@ foo (int x)
;
#pragma omp p num_threads(4),if(1),private(x)
;
-#pragma omp p, num_threads (4), if (1), private (x) /* { dg-error "clause before" } */
+#pragma omp p, num_threads (4), if (1), private (x)
;
#pragma omp p num_threads (4), if (1), private (x), /* { dg-error "clause before" } */
;
diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-6.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-6.c
new file mode 100644
index 0000000..1f3be64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-6.c
@@ -0,0 +1,47 @@
+/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */
+/* { dg-add-options bind_pic_locally } */
+
+#define size_t long long int
+
+struct A
+{
+ size_t f1, f2, f3, f4;
+};
+struct C
+{
+ struct A a;
+ size_t b;
+};
+struct C x;
+
+__attribute__((hot)) struct C callee (struct A *a, struct C *c)
+{
+ c->a=(*a);
+
+ if((c->b + 7) & 17)
+ {
+ c->a.f1 = c->a.f2 + c->a.f1;
+ c->a.f2 = c->a.f3 - c->a.f2;
+ c->a.f3 = c->a.f2 + c->a.f3;
+ c->a.f4 = c->a.f2 - c->a.f4;
+ c->b = c->a.f2;
+
+ }
+ return *c;
+}
+
+__attribute__((hot)) struct C caller (size_t d, size_t e, size_t f, size_t g, struct C *c)
+{
+ struct A a;
+ a.f1 = 1 + d;
+ a.f2 = e;
+ a.f3 = 12 + f;
+ a.f4 = 68 + g;
+ if (c->b > 0)
+ return callee (&a, c);
+ else
+ return *c;
+}
+
+/* { dg-final { scan-ipa-dump "known_hot" "inline" } } */
+
diff --git a/gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1a.c b/gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1a.c
new file mode 100644
index 0000000..f527b8232
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1a.c
@@ -0,0 +1,37 @@
+/* Test C2x variadic functions with no named parameters, or last named
+ parameter with a declaration not allowed in C17. Execution tests split
+ between source files. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+/* { dg-additional-sources "c2x-stdarg-split-1b.c" } */
+
+extern void abort (void);
+extern void exit (int);
+
+double f (...);
+void g (...);
+void h1 (register int x, ...);
+void h2 (int x(), ...);
+void h3 (int x[10], ...);
+void h4 (char x, ...);
+void h5 (float x, ...);
+void h6 (volatile long x, ...);
+struct s { char c[1000]; };
+void h7 (volatile struct s x, ...);
+
+int
+main ()
+{
+ if (f (1, 2.0, 3, 4.0) != 10.0)
+ abort ();
+ g (0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
+ g (0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f);
+ h1 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h2 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h3 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h4 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h5 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h6 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ h7 ((struct s) {}, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1b.c b/gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1b.c
new file mode 100644
index 0000000..55a01b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1b.c
@@ -0,0 +1,147 @@
+/* Test C2x variadic functions with no named parameters, or last named
+ parameter with a declaration not allowed in C17. Execution tests split
+ between source files. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stdarg.h>
+
+extern void abort (void);
+
+double
+f (...)
+{
+ va_list ap;
+ va_start (ap);
+ double ret = va_arg (ap, int);
+ ret += va_arg (ap, double);
+ ret += va_arg (ap, int);
+ ret += va_arg (ap, double);
+ va_end (ap);
+ return ret;
+}
+
+void
+g (...)
+{
+ va_list ap;
+ va_start (ap, random ! ignored, ignored ** text);
+ for (int i = 0; i < 10; i++)
+ if (va_arg (ap, double) != i)
+ abort ();
+ va_end (ap);
+}
+
+void
+h1 (register int x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h2 (int x(), ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h3 (int x[10], ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h4 (char x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h5 (float x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+void
+h6 (volatile long x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
+
+struct s { char c[1000]; };
+
+void
+h7 (volatile struct s x, ...)
+{
+ va_list ap;
+ va_start (ap);
+ for (int i = 0; i < 10; i++)
+ {
+ if (va_arg (ap, double) != i)
+ abort ();
+ i++;
+ if (va_arg (ap, int) != i)
+ abort ();
+ }
+ va_end (ap);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/floatn-builtin.h b/gcc/testsuite/gcc.dg/torture/floatn-builtin.h
index c562812..304a459 100644
--- a/gcc/testsuite/gcc.dg/torture/floatn-builtin.h
+++ b/gcc/testsuite/gcc.dg/torture/floatn-builtin.h
@@ -20,6 +20,9 @@
extern void exit (int);
extern void abort (void);
+extern int test_i;
+extern long int test_l;
+extern long long int test_ll;
extern TYPE test_type;
extern __typeof (FN (__builtin_inf) ()) test_type;
extern __typeof (FN (__builtin_huge_val) ()) test_type;
@@ -27,12 +30,91 @@ extern __typeof (FN (__builtin_nan) ("")) test_type;
extern __typeof (FN (__builtin_nans) ("")) test_type;
extern __typeof (FN (__builtin_fabs) (0)) test_type;
extern __typeof (FN (__builtin_copysign) (0, 0)) test_type;
+extern __typeof (FN (__builtin_acosh) (0)) test_type;
+extern __typeof (FN (__builtin_acos) (0)) test_type;
+extern __typeof (FN (__builtin_asinh) (0)) test_type;
+extern __typeof (FN (__builtin_asin) (0)) test_type;
+extern __typeof (FN (__builtin_atanh) (0)) test_type;
+extern __typeof (FN (__builtin_atan) (0)) test_type;
+extern __typeof (FN (__builtin_cbrt) (0)) test_type;
+extern __typeof (FN (__builtin_cosh) (0)) test_type;
+extern __typeof (FN (__builtin_cos) (0)) test_type;
+extern __typeof (FN (__builtin_erfc) (0)) test_type;
+extern __typeof (FN (__builtin_erf) (0)) test_type;
+extern __typeof (FN (__builtin_exp2) (0)) test_type;
+extern __typeof (FN (__builtin_exp) (0)) test_type;
+extern __typeof (FN (__builtin_expm1) (0)) test_type;
+extern __typeof (FN (__builtin_lgamma) (0)) test_type;
+extern __typeof (FN (__builtin_log10) (0)) test_type;
+extern __typeof (FN (__builtin_log1p) (0)) test_type;
+extern __typeof (FN (__builtin_log2) (0)) test_type;
+extern __typeof (FN (__builtin_logb) (0)) test_type;
+extern __typeof (FN (__builtin_log) (0)) test_type;
+extern __typeof (FN (__builtin_nextafter) (0, 0)) test_type;
+extern __typeof (FN (__builtin_sinh) (0)) test_type;
+extern __typeof (FN (__builtin_sin) (0)) test_type;
+extern __typeof (FN (__builtin_tanh) (0)) test_type;
+extern __typeof (FN (__builtin_tan) (0)) test_type;
+extern __typeof (FN (__builtin_tgamma) (0)) test_type;
+extern __typeof (FN (__builtin_atan2) (0, 0)) test_type;
+extern __typeof (FN (__builtin_fdim) (0, 0)) test_type;
+extern __typeof (FN (__builtin_fmod) (0, 0)) test_type;
+extern __typeof (FN (__builtin_frexp) (0, &test_i)) test_type;
+extern __typeof (FN (__builtin_ldexp) (0, 0)) test_type;
+extern __typeof (FN (__builtin_hypot) (0, 0)) test_type;
+extern __typeof (FN (__builtin_ilogb) (0)) test_i;
+extern __typeof (FN (__builtin_llrint) (0)) test_ll;
+extern __typeof (FN (__builtin_llround) (0)) test_ll;
+extern __typeof (FN (__builtin_lrint) (0)) test_l;
+extern __typeof (FN (__builtin_lround) (0)) test_l;
+extern __typeof (FN (__builtin_modf) (0, &test_type)) test_type;
+extern __typeof (FN (__builtin_pow) (0, 0)) test_type;
+extern __typeof (FN (__builtin_remainder) (0, 0)) test_type;
+extern __typeof (FN (__builtin_remquo) (0, 0, &test_i)) test_type;
+extern __typeof (FN (__builtin_scalbln) (0, 0L)) test_type;
+extern __typeof (FN (__builtin_scalbn) (0, 0)) test_type;
volatile TYPE inf_cst = FN (__builtin_inf) ();
volatile TYPE huge_val_cst = FN (__builtin_huge_val) ();
volatile TYPE nan_cst = FN (__builtin_nan) ("");
volatile TYPE nans_cst = FN (__builtin_nans) ("");
volatile TYPE neg0 = -CST (0.0), neg1 = -CST (1.0), one = 1.0;
+volatile TYPE t1 = FN (__builtin_acosh) (CST (1.0));
+volatile TYPE t2 = FN (__builtin_acos) (CST (1.0));
+volatile TYPE t3 = FN (__builtin_asinh) (CST (0.0));
+volatile TYPE t4 = FN (__builtin_asin) (CST (0.0));
+volatile TYPE t5 = FN (__builtin_atanh) (CST (0.0));
+volatile TYPE t6 = FN (__builtin_atan) (CST (0.0));
+volatile TYPE t7 = FN (__builtin_cbrt) (CST (27.0));
+volatile TYPE t8 = FN (__builtin_cosh) (CST (0.0));
+volatile TYPE t9 = FN (__builtin_cos) (CST (0.0));
+volatile TYPE t10 = FN (__builtin_erfc) (CST (0.0));
+volatile TYPE t11 = FN (__builtin_erf) (CST (0.0));
+volatile TYPE t12 = FN (__builtin_exp2) (CST (1.0));
+volatile TYPE t13 = FN (__builtin_exp) (CST (0.0));
+volatile TYPE t14 = FN (__builtin_expm1) (CST (0.0));
+volatile TYPE t15 = FN (__builtin_log10) (CST (1.0));
+volatile TYPE t16 = FN (__builtin_log1p) (CST (0.0));
+volatile TYPE t17 = FN (__builtin_log2) (CST (1.0));
+volatile TYPE t18 = FN (__builtin_logb) (CST (1.0));
+volatile TYPE t19 = FN (__builtin_log) (CST (1.0));
+volatile TYPE t20 = FN (__builtin_nextafter) (CST (0.0), CST (0.0));
+volatile TYPE t21 = FN (__builtin_sinh) (CST (0.0));
+volatile TYPE t22 = FN (__builtin_sin) (CST (0.0));
+volatile TYPE t23 = FN (__builtin_tanh) (CST (0.0));
+volatile TYPE t24 = FN (__builtin_tan) (CST (0.0));
+volatile TYPE t25 = FN (__builtin_atan2) (CST (0.0), CST (1.0));
+volatile TYPE t26 = FN (__builtin_fdim) (CST (0.0), CST (0.0));
+volatile TYPE t27 = FN (__builtin_fmod) (CST (0.0), CST (1.0));
+volatile TYPE t28 = FN (__builtin_ldexp) (CST (1.0), 1);
+volatile TYPE t29 = FN (__builtin_hypot) (CST (3.0), CST (4.0));
+volatile int t30 = FN (__builtin_ilogb) (CST (1.0));
+volatile long long int t31 = FN (__builtin_llround) (CST (42.25));
+volatile long int t32 = FN (__builtin_lround) (CST (42.25));
+volatile TYPE t33 = FN (__builtin_pow) (CST (1.0), CST (2.0));
+volatile TYPE t34 = FN (__builtin_remainder) (CST (7.0), CST (4.0));
+volatile TYPE t35 = FN (__builtin_scalbln) (CST (1.0), 1L);
+volatile TYPE t36 = FN (__builtin_scalbn) (CST (1.0), 1);
int
main (void)
@@ -60,5 +142,77 @@ main (void)
r = FN (__builtin_copysign) (-inf_cst, one);
if (r != huge_val_cst)
abort ();
+ if (t1 != CST (0.0))
+ abort ();
+ if (t2 != CST (0.0))
+ abort ();
+ if (t3 != CST (0.0))
+ abort ();
+ if (t4 != CST (0.0))
+ abort ();
+ if (t5 != CST (0.0))
+ abort ();
+ if (t6 != CST (0.0))
+ abort ();
+ if (t7 != CST (3.0))
+ abort ();
+ if (t8 != CST (1.0))
+ abort ();
+ if (t9 != CST (1.0))
+ abort ();
+ if (t10 != CST (1.0))
+ abort ();
+ if (t11 != CST (0.0))
+ abort ();
+ if (t12 != CST (2.0))
+ abort ();
+ if (t13 != CST (1.0))
+ abort ();
+ if (t14 != CST (0.0))
+ abort ();
+ if (t15 != CST (0.0))
+ abort ();
+ if (t16 != CST (0.0))
+ abort ();
+ if (t17 != CST (0.0))
+ abort ();
+ if (t18 != CST (0.0))
+ abort ();
+ if (t19 != CST (0.0))
+ abort ();
+ if (t20 != CST (0.0))
+ abort ();
+ if (t21 != CST (0.0))
+ abort ();
+ if (t22 != CST (0.0))
+ abort ();
+ if (t23 != CST (0.0))
+ abort ();
+ if (t24 != CST (0.0))
+ abort ();
+ if (t25 != CST (0.0))
+ abort ();
+ if (t26 != CST (0.0))
+ abort ();
+ if (t27 != CST (0.0))
+ abort ();
+ if (t28 != CST (2.0))
+ abort ();
+ if (t29 != CST (5.0))
+ abort ();
+ if (t30 != 0)
+ abort ();
+ if (t31 != 42)
+ abort ();
+ if (t32 != 42)
+ abort ();
+ if (t33 != CST (1.0))
+ abort ();
+ if (t34 != -CST (1.0))
+ abort ();
+ if (t35 != CST (2.0))
+ abort ();
+ if (t36 != CST (2.0))
+ abort ();
exit (0);
}
diff --git a/gcc/testsuite/gcc.dg/torture/pr107407.c b/gcc/testsuite/gcc.dg/torture/pr107407.c
new file mode 100644
index 0000000..228fce1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr107407.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+int *a;
+int c[4];
+int d;
+
+static int
+f(char k, int j)
+{
+ for (; k <= 3; k++)
+ {
+ a = &c[k];
+ for (; d <= 1; d++)
+ *a = 3;
+ }
+ *a = 0;
+}
+
+int main()
+{
+ int i;
+ f(0, 0);
+ if (c[0] != 3)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr107435.c b/gcc/testsuite/gcc.dg/torture/pr107435.c
new file mode 100644
index 0000000..1012896
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr107435.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */
+
+struct qlist_head {
+ struct qlist_head *next;
+};
+void
+qlist_add (struct qlist_head *new, struct qlist_head *head)
+{
+ struct qlist_head *prev = head;
+ new->next = head->next;
+ prev->next = new;
+}
+struct {
+ struct qlist_head queue_link;
+} free_list, prealloc[64];
+void
+dbpf_open_cache_initialize()
+{
+ int i = 0;
+ for (; i < 64; i++)
+ qlist_add(&prealloc[i].queue_link, &free_list.queue_link);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr107447.c b/gcc/testsuite/gcc.dg/torture/pr107447.c
new file mode 100644
index 0000000..06f7b7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr107447.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+int n;
+
+void
+bar (int, int);
+
+__attribute__ ((noinline, returns_twice)) int
+zero (void)
+{
+ return 0;
+}
+
+void
+foo (void)
+{
+ (void) zero ();
+
+ n = 0;
+
+ for (;;)
+ bar (zero (), n);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107394.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107394.c
new file mode 100644
index 0000000..0e1e5ac4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107394.c
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+static double
+quux (double x)
+{
+ return __builtin_fabs (x);
+}
+
+__attribute__ ((flatten, optimize ("-ffinite-math-only"))) static int
+bar (int *p)
+{
+ *p = quux (0.0);
+
+ return 0;
+}
+
+void
+foo (int *p)
+{
+ (void) bar (p);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c
index 1f5c621..ccb4ef6 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c
@@ -46,6 +46,6 @@ int main ()
}
/* { dg-final { scan-tree-dump {(no need for alias check [^\n]* when VF is 1|no alias between [^\n]* when [^\n]* is outside \(-16, 16\))} "vect" { target vect_element_align } } } */
-/* { dg-final { scan-tree-dump-times "loop vectorized" 1 "vect" { target { vect_element_align && !amdgcn-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "loop vectorized" 1 "vect" { target { vect_element_align && { ! amdgcn-*-* } } } } } */
/* { dg-final { scan-tree-dump-times "loop vectorized" 2 "vect" { target amdgcn-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr100756.c b/gcc/testsuite/gcc.dg/vect/pr100756.c
index c1362f2..7847f3e 100644
--- a/gcc/testsuite/gcc.dg/vect/pr100756.c
+++ b/gcc/testsuite/gcc.dg/vect/pr100756.c
@@ -7,7 +7,7 @@ foo (int * restrict a, int n)
int i, result = 0;
a = __builtin_assume_aligned (a, __BIGGEST_ALIGNMENT__);
- for (i = 0; i < n * 4; i++)
+ for (i = 0; i < n * 16; i++)
result += a[i];
return result;
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-1.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-1.c
index 01cf34fb..42e50d9 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-1.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-2.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-2.c
index 1a4a157..a9aeefc 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-2.c
@@ -1,4 +1,5 @@
-/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_long_long } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-3.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-3.c
index 849f4a0..c7d0fd2 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-3.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-4.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-4.c
index 5bc9c41..6a3ed8c 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-4.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-4.c
@@ -1,4 +1,5 @@
-/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_long_long } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-5.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-5.c
index 1dc24d3..b2889df 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-5.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-6.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-6.c
index 7d24c29..2445f53 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-6.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-6.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-7.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-7.c
index 3b505db..4b1ec8a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-7.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-7.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
#include <stdarg.h>
#include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-1.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-1.c
new file mode 100644
index 0000000..2c67c38
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct F {
+ int bar;
+ char c;
+ int baz;
+ int arr[];
+};
+
+enum {
+ FIELD_BYTE_OFFSET = 0,
+ FIELD_BYTE_SIZE = 1,
+};
+
+unsigned int test (struct F *f) {
+
+ unsigned x = __builtin_preserve_field_info (f->arr, FIELD_BYTE_SIZE); /* { dg-error "unsupported variable size field access" } */
+
+ unsigned y = __builtin_preserve_field_info (f->baz, 99); /* { dg-error "invalid second argument to built-in function" } */
+
+ return x + y;
+}
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-2.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-2.c
new file mode 100644
index 0000000..31d7a03
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-errors-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct F {
+ int bar;
+ char c;
+ int baz;
+};
+
+enum {
+ FIELD_BYTE_OFFSET = 0,
+ FIELD_BYTE_SIZE = 1,
+};
+
+int test (struct F *f) {
+ int a;
+ unsigned x = __builtin_preserve_field_info (({ a = f->bar + f->baz; }), FIELD_BYTE_OFFSET); /* { dg-error "argument is not a field access" } */
+
+ int b;
+ unsigned y = __builtin_preserve_field_info (&(f->c), FIELD_BYTE_SIZE); /* { dg-error "argument is not a field access" } */
+
+ return a + b + x + y;
+}
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-existence-1.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-existence-1.c
new file mode 100644
index 0000000..c55f21a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-existence-1.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+enum {
+ FIELD_EXISTENCE = 2,
+};
+
+typedef unsigned uint;
+
+struct S {
+ unsigned char c;
+ int d;
+ uint u;
+ short ar[3];
+};
+
+unsigned int foo (struct S *s)
+{
+ unsigned c = __builtin_preserve_field_info (s->c, FIELD_EXISTENCE);
+ unsigned d = __builtin_preserve_field_info (s->d, FIELD_EXISTENCE);
+ unsigned u = __builtin_preserve_field_info (s->u, FIELD_EXISTENCE);
+ unsigned ar = __builtin_preserve_field_info (s->ar[1], FIELD_EXISTENCE);
+
+ return c + d + u + ar;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],1" 4 } } */
+
+/* { 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 "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:3:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "0x2\[\t \]+\[^\n\]*bpfcr_kind" 4 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-be.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-be.c
new file mode 100644
index 0000000..dabf73d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-be.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re -mbig-endian" } */
+
+struct S {
+ int x1: 6;
+ int x2: 3;
+ int x3: 7;
+ int x4: 16;
+};
+
+enum {
+ FIELD_LSHIFT_U64 = 4,
+};
+
+unsigned int foo (struct S *s)
+{
+ /* little endian: x1=58, x2=55, x3=48, x4=32 */
+ /* big endian: x1=32, x2=38, x3=41, x4=48 */
+ unsigned x1 = __builtin_preserve_field_info (s->x1, FIELD_LSHIFT_U64);
+ unsigned x2 = __builtin_preserve_field_info (s->x2, FIELD_LSHIFT_U64);
+ unsigned x3 = __builtin_preserve_field_info (s->x3, FIELD_LSHIFT_U64);
+ unsigned x4 = __builtin_preserve_field_info (s->x4, FIELD_LSHIFT_U64);
+
+ return x1 + x2 + x3 + x4;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],32" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],38" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],41" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],48" 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 "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "0x4\[\t \]+\[^\n\]*bpfcr_kind" 4 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-le.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-le.c
new file mode 100644
index 0000000..99e3982
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-1-le.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re -mlittle-endian" } */
+
+struct S {
+ int x1: 6;
+ int x2: 3;
+ int x3: 7;
+ int x4: 16;
+};
+
+enum {
+ FIELD_LSHIFT_U64 = 4,
+};
+
+unsigned int foo (struct S *s)
+{
+ /* little endian: x1=58, x2=55, x3=48, x4=32 */
+ /* big endian: x1=32, x2=38, x3=41, x4=48 */
+ unsigned x1 = __builtin_preserve_field_info (s->x1, FIELD_LSHIFT_U64);
+ unsigned x2 = __builtin_preserve_field_info (s->x2, FIELD_LSHIFT_U64);
+ unsigned x3 = __builtin_preserve_field_info (s->x3, FIELD_LSHIFT_U64);
+ unsigned x4 = __builtin_preserve_field_info (s->x4, FIELD_LSHIFT_U64);
+
+ return x1 + x2 + x3 + x4;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],58" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],55" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],48" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],32" 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 "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "0x4\[\t \]+\[^\n\]*bpfcr_kind" 4 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-2.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-2.c
new file mode 100644
index 0000000..25be969
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-lshift-2.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ char c;
+ short s;
+ int x;
+};
+
+union U {
+ struct S s[2];
+ long long ll;
+};
+
+enum {
+ FIELD_LSHIFT_U64 = 4,
+};
+
+unsigned int foo (union U *u)
+{
+ /* s0s = 48, s1c = 56, ll = 0; endianness independent. */
+ unsigned s0s = __builtin_preserve_field_info (u->s[0].s, FIELD_LSHIFT_U64);
+ unsigned s1c = __builtin_preserve_field_info (u->s[1].c, FIELD_LSHIFT_U64);
+ unsigned ll = __builtin_preserve_field_info (u->ll, FIELD_LSHIFT_U64);
+
+ return s0s + s1c + ll;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],48" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],56" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],0" 1 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"0:0:0:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:0:1: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 "0x4\[\t \]+\[^\n\]*bpfcr_kind" 3 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-offset-1.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-offset-1.c
new file mode 100644
index 0000000..590eea0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-offset-1.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ unsigned int a1: 7;
+ unsigned int a2: 4;
+ unsigned int a3: 13;
+ unsigned int a4: 5;
+ int x;
+};
+
+struct T {
+ unsigned int y;
+ struct S s[2];
+ char c;
+ char d;
+};
+
+enum {
+ FIELD_BYTE_OFFSET = 0,
+};
+
+
+unsigned int foo (struct T *t)
+{
+ unsigned s0a1 = __builtin_preserve_field_info (t->s[0].a1, FIELD_BYTE_OFFSET);
+ unsigned s0a4 = __builtin_preserve_field_info (t->s[0].a4, FIELD_BYTE_OFFSET);
+ unsigned s0x = __builtin_preserve_field_info (t->s[0].x, FIELD_BYTE_OFFSET);
+
+ unsigned s1a1 = __builtin_preserve_field_info (t->s[1].a1, FIELD_BYTE_OFFSET);
+ unsigned s1a4 = __builtin_preserve_field_info (t->s[1].a4, FIELD_BYTE_OFFSET);
+ unsigned s1x = __builtin_preserve_field_info (t->s[1].x, FIELD_BYTE_OFFSET);
+
+ unsigned c = __builtin_preserve_field_info (t->c, FIELD_BYTE_OFFSET);
+ unsigned d = __builtin_preserve_field_info (t->d, FIELD_BYTE_OFFSET);
+
+ return s0a1 + s0a4 + s0x + s1a1 + s1a4 + s1x + c + d;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],4" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],8" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],12" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],16" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],20" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],21" 1 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"0:1:0:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:0:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:0:4.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:1:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:1:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:1:4.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:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bpfcr_kind" 8 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-1.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-1.c
new file mode 100644
index 0000000..d0c75d9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-1.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ int x1: 6;
+ int x2: 3;
+ int x3: 7;
+ int x4: 16;
+};
+
+enum {
+ FIELD_RSHIFT_U64 = 5,
+};
+
+unsigned int foo (struct S *s)
+{
+ /* x1=58, x2=61, x3=57, x4=48; endianness independent. */
+ unsigned x1 = __builtin_preserve_field_info (s->x1, FIELD_RSHIFT_U64);
+ unsigned x2 = __builtin_preserve_field_info (s->x2, FIELD_RSHIFT_U64);
+ unsigned x3 = __builtin_preserve_field_info (s->x3, FIELD_RSHIFT_U64);
+ unsigned x4 = __builtin_preserve_field_info (s->x4, FIELD_RSHIFT_U64);
+
+ return x1 + x2 + x3 + x4;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],58" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],61" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],57" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],48" 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 "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "0x5\[\t \]+\[^\n\]*bpfcr_kind" 4 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-2.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-2.c
new file mode 100644
index 0000000..a71ddc1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-rshift-2.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ int x;
+ char c;
+};
+
+union U {
+ int i;
+ struct S s;
+};
+
+enum {
+ FIELD_RSHIFT_U64 = 5,
+};
+
+unsigned int foo (union U *u)
+{
+ /* sx = 32, sc = 56, i = 32; endianness independent. */
+ unsigned sx = __builtin_preserve_field_info (u->s.x, FIELD_RSHIFT_U64);
+ unsigned sc = __builtin_preserve_field_info (u->s.c, FIELD_RSHIFT_U64);
+ unsigned i = __builtin_preserve_field_info (u->i, FIELD_RSHIFT_U64);
+
+ return sx + sc + i;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],32" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],56" 1 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"0:1:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:1.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 "0x5\[\t \]+\[^\n\]*bpfcr_kind" 3 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-1.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-1.c
new file mode 100644
index 0000000..3b2081e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-1.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+enum {
+ FIELD_SIGNEDNESS = 3,
+};
+
+typedef unsigned uint;
+
+struct S {
+ unsigned char c;
+ int d;
+ uint u;
+ short ar[3];
+};
+
+unsigned int foo (struct S *s)
+{
+ unsigned d = __builtin_preserve_field_info (s->d, FIELD_SIGNEDNESS);
+ unsigned u = __builtin_preserve_field_info (s->u, FIELD_SIGNEDNESS);
+ unsigned ar = __builtin_preserve_field_info (s->ar[1], FIELD_SIGNEDNESS);
+
+ return d + u + ar;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],1" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],0" 1 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"0:1.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:3:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "0x3\[\t \]+\[^\n\]*bpfcr_kind" 3 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-2.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-2.c
new file mode 100644
index 0000000..bf18429
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-sign-2.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+enum {
+ FIELD_SIGNEDNESS = 3,
+};
+
+enum Esig {
+ SA = -1,
+ SB,
+ SC,
+};
+
+enum Eun {
+ UA = 0,
+ UB,
+};
+
+struct S {
+ enum Esig sig : 3;
+ enum Eun un : 3;
+};
+
+union U {
+ int i;
+ struct S s;
+};
+
+unsigned int foo (union U *u)
+{
+ unsigned i = __builtin_preserve_field_info (u->i, FIELD_SIGNEDNESS);
+ unsigned sig = __builtin_preserve_field_info (u->s.sig, FIELD_SIGNEDNESS);
+ unsigned un = __builtin_preserve_field_info (u->s.un, FIELD_SIGNEDNESS);
+
+ return i + sig + un;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],1" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],0" 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.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "3\[\t \]+\[^\n\]*bpfcr_kind" 3 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-size-1.c b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-size-1.c
new file mode 100644
index 0000000..8747bde
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-size-1.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -dA -gbtf -mco-re" } */
+
+struct S {
+ unsigned int a1: 7;
+ unsigned int a2: 4;
+ unsigned int a3: 13;
+ unsigned int a4: 5;
+ char carr[5][3];
+};
+
+enum {
+ FIELD_BYTE_SIZE = 1,
+};
+
+union U {
+ long long l[3];
+ struct S s;
+};
+
+unsigned int foo (union U *u)
+{
+ unsigned ls = __builtin_preserve_field_info (u->l, FIELD_BYTE_SIZE);
+ unsigned s = __builtin_preserve_field_info (u->s, FIELD_BYTE_SIZE);
+ unsigned a2 = __builtin_preserve_field_info (u->s.a2, FIELD_BYTE_SIZE);
+ unsigned a3 = __builtin_preserve_field_info (u->s.a3, FIELD_BYTE_SIZE);
+ unsigned ca = __builtin_preserve_field_info (u->s.carr, FIELD_BYTE_SIZE);
+
+ return ls + s + a2 + a3 + ca;
+}
+
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],24" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],20" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],4" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]mov\[\t \]%r\[0-9\],15" 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 "ascii \"0:1:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:1:4.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "0x1\[\t \]+\[^\n\]*bpfcr_kind" 5 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-check.h b/gcc/testsuite/gcc.target/i386/avx-check.h
index 77507ca..666eff5 100644
--- a/gcc/testsuite/gcc.target/i386/avx-check.h
+++ b/gcc/testsuite/gcc.target/i386/avx-check.h
@@ -29,6 +29,9 @@ main ()
#ifdef AVXVNNIINT8
&& __builtin_cpu_supports ("avxvnniint8")
#endif
+#ifdef AVXNECONVERT
+ && __builtin_cpu_supports ("avxneconvert")
+#endif
)
{
do_test ();
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-1.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-1.c
new file mode 100644
index 0000000..27188a6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-1.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-mavxneconvert -O2" } */
+/* { dg-final { scan-assembler-times "vbcstnebf162ps\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vbcstnebf162ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vbcstnesh2ps\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vbcstnesh2ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneebf162ps\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneebf162ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneeph2ps\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneeph2ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneobf162ps\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneobf162ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneoph2ps\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneoph2ps\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "\{vex\} vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "\{vex\} vcvtneps2bf16y\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+#include <immintrin.h>
+
+volatile __m128 x1;
+volatile __m256 x2;
+volatile __m128bh res1, res2;
+const void *a;
+__m128bh *b;
+__m256bh *c;
+__m128h *d;
+__m256h *e;
+
+void extern
+avx_ne_convert_test (void)
+{
+ x1 = _mm_bcstnebf16_ps (a);
+ x2 = _mm256_bcstnebf16_ps (a);
+ x1 = _mm_bcstnesh_ps (a);
+ x2 = _mm256_bcstnesh_ps (a);
+ x1 = _mm_cvtneebf16_ps (b);
+ x2 = _mm256_cvtneebf16_ps (c);
+ x1 = _mm_cvtneeph_ps (d);
+ x2 = _mm256_cvtneeph_ps (e);
+ x1 = _mm_cvtneobf16_ps (b);
+ x2 = _mm256_cvtneobf16_ps (c);
+ x1 = _mm_cvtneoph_ps (d);
+ x2 = _mm256_cvtneoph_ps (e);
+ res1 = _mm_cvtneps_avx_pbh (x1);
+ res2 = _mm256_cvtneps_avx_pbh (x2);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnebf162ps-2.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnebf162ps-2.c
new file mode 100644
index 0000000..2707c58
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnebf162ps-2.c
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+/* { dg-options "-mavxneconvert -O2" } */
+/* { dg-require-effective-target avxneconvert } */
+#define AVXNECONVERT
+#include <stdint.h>
+
+#ifndef CHECK
+#define CHECK "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK
+
+typedef union
+{
+ uint32_t int32;
+ float flt;
+} float_int_t;
+
+static uint16_t convert_fp32_to_bf16 (float fp)
+{
+ float_int_t fi;
+ fi.flt = fp;
+ return ((fi.int32 >> 16) & 0xffff);
+}
+
+void TEST (void)
+{
+ union128 dst_128;
+ union256 dst_256;
+ float res_ref_128[4], res_ref_256[8], fp32;
+ uint16_t var;
+ fp32 = (float) 3 * 2 + 5.5;
+ for (int i = 0; i < 4; i++)
+ {
+ res_ref_128[i] = fp32;
+ dst_128.a[i] = 117;
+ }
+ for (int i = 0; i < 8; i++)
+ {
+ res_ref_256[i] = fp32;
+ dst_256.a[i] = 117;
+ }
+ var = convert_fp32_to_bf16 (fp32);
+ dst_128.x = _mm_bcstnebf16_ps (&var);
+ dst_256.x = _mm256_bcstnebf16_ps (&var);
+ if (check_union128 (dst_128, res_ref_128))
+ abort();
+ if (check_union256 (dst_256, res_ref_256))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnesh2ps-2.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnesh2ps-2.c
new file mode 100644
index 0000000..0e6f383
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vbcstnesh2ps-2.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-mavxneconvert -mf16c -O2" } */
+/* { dg-require-effective-target avxneconvert } */
+#define AVXNECONVERT
+#include <stdint.h>
+#include <immintrin.h>
+
+#ifndef CHECK
+#define CHECK "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK
+
+void TEST (void)
+{
+ union128 dst_128;
+ union256 dst_256;
+ float res_ref_128[4], res_ref_256[8], fp32;
+ uint16_t var;
+ fp32 = (float) 3 * 2 + 8.5;
+ for (int i = 0; i < 4; i++)
+ {
+ res_ref_128[i] = fp32;
+ dst_128.a[i] = 117;
+ }
+ for (int i = 0; i < 8; i++)
+ {
+ res_ref_256[i] = fp32;
+ dst_256.a[i] = 117;
+ }
+ var = _cvtss_sh (fp32, 0);
+ dst_128.x = _mm_bcstnesh_ps (&var);
+ dst_256.x = _mm256_bcstnesh_ps (&var);
+ if (check_union128 (dst_128, res_ref_128))
+ abort();
+ if (check_union256 (dst_256, res_ref_256))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneebf162ps-2.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneebf162ps-2.c
new file mode 100644
index 0000000..bd02616
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneebf162ps-2.c
@@ -0,0 +1,73 @@
+/* { dg-do run } */
+/* { dg-options "-mavxneconvert -O2" } */
+/* { dg-require-effective-target avxneconvert } */
+#define AVXNECONVERT
+#include <stdint.h>
+
+#ifndef CHECK
+#define CHECK "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK
+
+typedef union
+{
+ uint32_t int32;
+ float flt;
+} float_int_t;
+
+typedef union
+{
+ __m128bh x;
+ uint32_t a[4];
+} union128bf16_i;
+
+typedef union
+{
+ __m256bh x;
+ uint32_t a[8];
+} union256bf16_i;
+
+static uint16_t convert_fp32_to_bf16 (float fp)
+{
+ float_int_t fi;
+ fi.flt = fp;
+ return ((fi.int32 >> 16) & 0xffff);
+}
+
+void TEST (void)
+{
+ union128 dst_128;
+ union256 dst_256;
+ float res_ref_128[4], res_ref_256[8], fp32;
+ uint16_t bf16;
+ union128bf16_i src_128bh;
+ union256bf16_i src_256bh;
+
+ for (int i = 0; i < 4; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ bf16 = convert_fp32_to_bf16 (fp32);
+ src_128bh.a[i] = bf16; // store bf16 at the lower part of the dword
+ res_ref_128[i] = fp32;
+ dst_128.a[i] = 117;
+ }
+ for (int i = 0; i < 8; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ bf16 = convert_fp32_to_bf16 (fp32);
+ src_256bh.a[i] = bf16; // store bf16 at the lower part of the dword
+ res_ref_256[i] = fp32;
+ dst_256.a[i] = 117;
+ }
+ dst_128.x = _mm_cvtneebf16_ps (&src_128bh.x);
+ dst_256.x = _mm256_cvtneebf16_ps (&src_256bh.x);
+ if (check_union128 (dst_128, res_ref_128))
+ abort();
+ if (check_union256 (dst_256, res_ref_256))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneeph2ps-2.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneeph2ps-2.c
new file mode 100644
index 0000000..a862894
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneeph2ps-2.c
@@ -0,0 +1,66 @@
+/* { dg-do run } */
+/* { dg-options "-mavxneconvert -mf16c -O2" } */
+/* { dg-require-effective-target avxneconvert } */
+#define AVXNECONVERT
+#include <stdint.h>
+
+#ifndef CHECK
+#define CHECK "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK
+
+typedef union
+{
+ uint32_t int32;
+ float flt;
+} float_int_t;
+
+typedef union
+{
+ __m128h x;
+ uint32_t a[4];
+} union128h;
+
+typedef union
+{
+ __m256h x;
+ uint32_t a[8];
+} union256h;
+
+void TEST (void)
+{
+ union128 dst_128;
+ union256 dst_256;
+ float res_ref_128[4], res_ref_256[8], fp32;
+ uint16_t fp16;
+ union128h src_128h;
+ union256h src_256h;
+
+ for (int i = 0; i < 4; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ fp16 = _cvtss_sh (fp32, 0);
+ src_128h.a[i] = fp16;
+ res_ref_128[i] = fp32;
+ dst_128.a[i] = 117;
+ }
+ for (int i = 0; i < 8; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ fp16 = _cvtss_sh (fp32, 0);
+ src_256h.a[i] = fp16;
+ res_ref_256[i] = fp32;
+ dst_256.a[i] = 117;
+ }
+ dst_128.x = _mm_cvtneeph_ps (&src_128h.x);
+ dst_256.x = _mm256_cvtneeph_ps (&src_256h.x);
+ if (check_union128 (dst_128, res_ref_128))
+ abort();
+ if (check_union256 (dst_256, res_ref_256))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneobf162ps-2.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneobf162ps-2.c
new file mode 100644
index 0000000..a6f722e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneobf162ps-2.c
@@ -0,0 +1,75 @@
+/* { dg-do run } */
+/* { dg-options "-mavxneconvert -O2" } */
+/* { dg-require-effective-target avxneconvert } */
+#define AVXNECONVERT
+#include <stdint.h>
+
+#ifndef CHECK
+#define CHECK "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK
+
+typedef union
+{
+ uint32_t int32;
+ float flt;
+} float_int_t;
+
+typedef union
+{
+ __m128bh x;
+ uint32_t a[4];
+} union128bf16_i;
+
+typedef union
+{
+ __m256bh x;
+ uint32_t a[8];
+} union256bf16_i;
+
+static uint16_t convert_fp32_to_bf16 (float fp)
+{
+ float_int_t fi;
+ fi.flt = fp;
+ return ((fi.int32 >> 16) & 0xffff);
+}
+
+void TEST (void)
+{
+ union128 dst_128;
+ union256 dst_256;
+ float res_ref_128[4], res_ref_256[8], fp32;
+ uint16_t bf16;
+ union128bf16_i src_128bh;
+ union256bf16_i src_256bh;
+
+ for (int i = 0; i < 4; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ bf16 = convert_fp32_to_bf16 (fp32);
+ // store bf16 at the upper part of the dword
+ src_128bh.a[i] = (bf16 << 16) & 0xffff0000;
+ res_ref_128[i] = fp32;
+ dst_128.a[i] = 117;
+ }
+ for (int i = 0; i < 8; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ bf16 = convert_fp32_to_bf16 (fp32);
+ // store bf16 at the upper part of the dword
+ src_256bh.a[i] = (bf16 << 16) & 0xffff0000;
+ res_ref_256[i] = fp32;
+ dst_256.a[i] = 117;
+ }
+ dst_128.x = _mm_cvtneobf16_ps (&src_128bh.x);
+ dst_256.x = _mm256_cvtneobf16_ps (&src_256bh.x);
+ if (check_union128 (dst_128, res_ref_128))
+ abort();
+ if (check_union256 (dst_256, res_ref_256))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneoph2ps-2.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneoph2ps-2.c
new file mode 100644
index 0000000..95eb5d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneoph2ps-2.c
@@ -0,0 +1,66 @@
+/* { dg-do run } */
+/* { dg-options "-mavxneconvert -mf16c -O2" } */
+/* { dg-require-effective-target avxneconvert } */
+#define AVXNECONVERT
+#include <stdint.h>
+
+#ifndef CHECK
+#define CHECK "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK
+
+typedef union
+{
+ uint32_t int32;
+ float flt;
+} float_int_t;
+
+typedef union
+{
+ __m128h x;
+ uint32_t a[4];
+} union128h;
+
+typedef union
+{
+ __m256h x;
+ uint32_t a[8];
+} union256h;
+
+void TEST (void)
+{
+ union128 dst_128;
+ union256 dst_256;
+ float res_ref_128[4], res_ref_256[8], fp32;
+ uint16_t fp16;
+ union128h src_128h;
+ union256h src_256h;
+
+ for (int i = 0; i < 4; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ fp16 = _cvtss_sh (fp32, 0);
+ src_128h.a[i] = fp16 << 16;
+ res_ref_128[i] = fp32;
+ dst_128.a[i] = 117;
+ }
+ for (int i = 0; i < 8; i++)
+ {
+ fp32 = (float) 3 * i + 5 + i * 0.5;
+ fp16 = _cvtss_sh (fp32, 0);
+ src_256h.a[i] = fp16 << 16;
+ res_ref_256[i] = fp32;
+ dst_256.a[i] = 117;
+ }
+ dst_128.x = _mm_cvtneoph_ps (&src_128h.x);
+ dst_256.x = _mm256_cvtneoph_ps (&src_256h.x);
+ if (check_union128 (dst_128, res_ref_128))
+ abort();
+ if (check_union256 (dst_256, res_ref_256))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneps2bf16-2.c b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneps2bf16-2.c
new file mode 100644
index 0000000..e673123
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-ne-convert-vcvtneps2bf16-2.c
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-options "-mavxneconvert -O2" } */
+/* { dg-require-effective-target avxneconvert } */
+#define AVXNECONVERT
+#include <stdint.h>
+
+#ifndef CHECK
+#define CHECK "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK
+
+typedef union
+{
+ uint32_t int32;
+ float flt;
+} float_int_t;
+
+typedef union
+{
+ __m128bh x;
+ unsigned short a[8];
+} union128bf16;
+
+void TEST (void)
+{
+ union128 src_128;
+ union256 src_256;
+ union128bf16 dst_128, dst_256;
+ uint16_t res_ref_128[8] = {0}, res_ref_256[8];
+ float_int_t fp32;
+ for (int i = 0; i < 4; i++)
+ {
+ fp32.flt = (float) 2 * i + 7 + i * 0.25;
+ src_128.a[i] = fp32.flt;
+ res_ref_128[i] = fp32.int32 >> 16;
+ dst_128.a[i] = 117;
+ }
+
+ for (int i = 0; i < 8; i++)
+ {
+ fp32.flt = (float) 2 * i + 7 + i * 0.25;
+ src_256.a[i] = fp32.flt;
+ res_ref_256[i] = fp32.int32 >> 16;
+ dst_256.a[i] = 117;
+ }
+ dst_128.x = _mm_cvtneps_avx_pbh (src_128.x);
+ dst_256.x = _mm256_cvtneps_avx_pbh (src_256.x);
+
+ if (checkVus (dst_128.a, res_ref_128, 8))
+ abort();
+ if (checkVus (dst_128.a, res_ref_128, 8))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c b/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c
index 831abd3..8e929e6 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bf16 -O2" } */
-/* { dg-additional-options "-fno-PIE" { target ia32 } } */
+/* { dg-additional-options "-fno-PIE -mfpmath=sse" { target ia32 } } */
/* { dg-final { scan-assembler-times "sall\[ \\t\]+\[^\{\n\]*16" 1 } } */
/* { dg-final { scan-assembler-times "movl" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512bf16-vdpbf16ps-2.c b/gcc/testsuite/gcc.target/i386/avx512bf16-vdpbf16ps-2.c
index b64ad7b..02ebdd8 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bf16-vdpbf16ps-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bf16-vdpbf16ps-2.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bf16 -O2" } */
-/* { dg-final { scan-assembler-times "vdpbf16ps\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vdpbf16ps\[ \\t\]+\[^\{\n\]*\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512bf16vl-cvtness2sbh-1.c b/gcc/testsuite/gcc.target/i386/avx512bf16vl-cvtness2sbh-1.c
index 8f21b1b..b71addd 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bf16vl-cvtness2sbh-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bf16vl-cvtness2sbh-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bf16 -mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vcvtneps2bf16\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1.c b/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1.c
deleted file mode 100644
index 0969ae1..0000000
--- a/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-mavx512bf16 -mavx512vl -O2" } */
-/* { dg-final { scan-assembler-times "vcvtneps2bf16\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtneps2bf16\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtneps2bf16\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtneps2bf16\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtneps2bf16\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtneps2bf16\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
-
-#include <immintrin.h>
-
-volatile __m128bh res1, res2;
-volatile __m128 x1;
-volatile __m256 x2;
-volatile __mmask8 m8;
-
-void extern
-avx512bf16_test (void)
-{
- res2 = _mm256_cvtneps_pbh (x2);
- res2 = _mm256_mask_cvtneps_pbh (res2, m8, x2);
- res2 = _mm256_maskz_cvtneps_pbh (m8, x2);
-
- res1 = _mm_cvtneps_pbh (x1);
- res1 = _mm_mask_cvtneps_pbh (res1, m8, x1);
- res1 = _mm_maskz_cvtneps_pbh (m8, x1);
-}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1a.c b/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1a.c
new file mode 100644
index 0000000..d3a9bdf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1a.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bf16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16y\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16y\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16y\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128bh res1, res2;
+volatile __m128 x1;
+volatile __m256 x2;
+volatile __mmask8 m8;
+
+void extern
+avx512bf16_test (void)
+{
+ res2 = _mm256_cvtneps_pbh (x2);
+ res2 = _mm256_mask_cvtneps_pbh (res2, m8, x2);
+ res2 = _mm256_maskz_cvtneps_pbh (m8, x2);
+
+ res1 = _mm_cvtneps_pbh (x1);
+ res1 = _mm_mask_cvtneps_pbh (res1, m8, x1);
+ res1 = _mm_maskz_cvtneps_pbh (m8, x1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1b.c b/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1b.c
new file mode 100644
index 0000000..e0687fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1b.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bf16 -mavx512vl -mavxneconvert -O2" } */
+/* { dg-final { scan-assembler-times "\{vex\} vcvtneps2bf16y\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16y\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16y\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "\{vex\} vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtneps2bf16x\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128bh res1, res2;
+volatile __m128 x1;
+volatile __m256 x2;
+volatile __mmask8 m8;
+
+void extern
+avx512bf16_test (void)
+{
+ res2 = _mm256_cvtneps_pbh (x2);
+ res2 = _mm256_mask_cvtneps_pbh (res2, m8, x2);
+ res2 = _mm256_maskz_cvtneps_pbh (m8, x2);
+
+ res1 = _mm_cvtneps_pbh (x1);
+ res1 = _mm_mask_cvtneps_pbh (res1, m8, x1);
+ res1 = _mm_maskz_cvtneps_pbh (m8, x1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
index fada66b..5655c5b 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc
+++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
@@ -82,6 +82,7 @@ extern void test_avxvnni (void) __attribute__((__target__("avxvnni")));
extern void test_avx512fp16 (void) __attribute__((__target__("avx512fp16")));
extern void test_avxifma (void) __attribute__((__target__("avxifma")));
extern void test_avxvnniint8 (void) __attribute__((__target__("avxvnniint8")));
+extern void test_avxneconvert (void) __attribute__((__target__("avxneconvert")));
extern void test_no_sgx (void) __attribute__((__target__("no-sgx")));
extern void test_no_avx5124fmaps(void) __attribute__((__target__("no-avx5124fmaps")));
@@ -165,6 +166,7 @@ extern void test_no_avxvnni (void) __attribute__((__target__("no-avxvnni")));
extern void test_no_avx512fp16 (void) __attribute__((__target__("no-avx512fp16")));
extern void test_no_avxifma (void) __attribute__((__target__("no-avxifma")));
extern void test_no_avxvnniint8 (void) __attribute__((__target__("no-avxvnniint8")));
+extern void test_no_avxneconvert (void) __attribute__((__target__("no-avxneconvert")));
extern void test_arch_nocona (void) __attribute__((__target__("arch=nocona")));
extern void test_arch_core2 (void) __attribute__((__target__("arch=core2")));
diff --git a/gcc/testsuite/gcc.target/i386/pr107172.c b/gcc/testsuite/gcc.target/i386/pr107172.c
new file mode 100644
index 0000000..d2c85f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr107172.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -ftree-vrp" } */
+
+int a, c, d;
+int
+main()
+{
+ long e = 1;
+ int f = a = 1;
+L1:
+ if (a)
+ a = 2;
+ int h = e = ~e;
+ c = -1;
+ if (e >= a)
+ goto L2;
+ if (-1 > a)
+ goto L1;
+ if (a)
+ f = -1;
+L2:
+ d = (-f + d) & h;
+ if (d)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr107261.c b/gcc/testsuite/gcc.target/i386/pr107261.c
new file mode 100644
index 0000000..eb1d232
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr107261.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef __bf16 v4bf __attribute__ ((vector_size (8)));
+typedef __bf16 v2bf __attribute__ ((vector_size (4)));
+
+v4bf
+v4bf_abi_1 (v4bf a)
+{
+ return a;
+}
+
+v4bf
+v4bf_abi_3 (v4bf a, v4bf b, v4bf c)
+{
+ return c;
+}
+
+/* { dg-final { scan-assembler-times "movq\[\\t \]*%mm2, %mm0" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movaps\[\\t \]*%xmm2, %xmm0" 1 { target { ! ia32 } } } } */
+
+v4bf
+v4bf_abi_4 (v4bf a, v4bf b, v4bf c, v4bf d)
+{
+ return d;
+}
+
+/* { dg-final { scan-assembler-times "movq\[\\t \]*4\\(%esp\\), %mm0" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movaps\[\\t \]*%xmm3, %xmm0" 1 { target { ! ia32 } } } } */
+
+v2bf
+v2bf_test (v2bf a, v2bf b, v2bf c, v2bf d)
+{
+ return b;
+}
+
+/* { dg-final { scan-assembler-times "movl\[\\t \]*8\\(%esp\\), %eax" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movaps\[\\t \]*%xmm1, %xmm0" 1 { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr107304.c b/gcc/testsuite/gcc.target/i386/pr107304.c
new file mode 100644
index 0000000..24d6879
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr107304.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -march=tigerlake" } */
+
+#include <stdint.h>
+
+typedef union {
+ uint8_t v __attribute__((aligned(256))) __attribute__ ((vector_size(64 * sizeof(uint8_t))));
+ uint8_t i[64] __attribute__((aligned(256)));
+} stress_vec_u8_64_t;
+
+typedef struct {
+ struct {
+ stress_vec_u8_64_t s;
+ stress_vec_u8_64_t o;
+ stress_vec_u8_64_t mask1;
+ stress_vec_u8_64_t mask2;
+ } u8_64;
+} stress_vec_data_t;
+
+__attribute__((target_clones("arch=alderlake", "default")))
+void
+stress_vecshuf_u8_64(stress_vec_data_t *data)
+{
+ stress_vec_u8_64_t *__restrict s;
+ stress_vec_u8_64_t *__restrict mask1;
+ stress_vec_u8_64_t *__restrict mask2;
+ register int i;
+
+ s = &data->u8_64.s;
+ mask1 = &data->u8_64.mask1;
+ mask2 = &data->u8_64.mask2;
+
+ for (i = 0; i < 256; i++) { /* was i < 65536 */
+ stress_vec_u8_64_t tmp;
+
+ tmp.v = __builtin_shuffle(s->v, mask1->v);
+ s->v = __builtin_shuffle(tmp.v, mask2->v);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse-12.c b/gcc/testsuite/gcc.target/i386/sse-12.c
index ddde2df..3eabc49 100644
--- a/gcc/testsuite/gcc.target/i386/sse-12.c
+++ b/gcc/testsuite/gcc.target/i386/sse-12.c
@@ -3,7 +3,7 @@
popcntintrin.h gfniintrin.h and mm_malloc.h are usable
with -O -std=c89 -pedantic-errors. */
/* { dg-do compile } */
-/* { dg-options "-O -std=c89 -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 -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512ifma -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 -mavxifma -mavxvnniint8" } */
+/* { dg-options "-O -std=c89 -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 -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512ifma -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 -mavxifma -mavxvnniint8 -mavxneconvert" } */
#include <x86intrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc/testsuite/gcc.target/i386/sse-13.c
index 2b29321..b9cdfb6 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 -mavx512fp16 -mavxifma -mavxvnniint8" } */
+/* { 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 -mavxifma -mavxvnniint8 -mavxneconvert" } */
/* { dg-add-options bind_pic_locally } */
#include <mm_malloc.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c
index 78b5104..b6ee380 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 -mavx512fp16 -mavxifma -mavxvnniint8" } */
+/* { 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 -mavxifma -mavxvnniint8 -mavxneconvert" } */
/* { dg-add-options bind_pic_locally } */
#include <mm_malloc.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc/testsuite/gcc.target/i386/sse-22.c
index cc1c8cf..71ac0f3 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,avx512fp16,avxifma,avxvnniint8")
+#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,avxifma,avxvnniint8,avxneconvert")
#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,avx512fp16,avxifma,avxvnniint8")
+#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,avxifma,avxvnniint8,avxneconvert")
#endif
#include <immintrin.h>
test_1 (_cvtss_sh, unsigned short, float, 1)
diff --git a/gcc/testsuite/gcc.target/i386/sse-23.c b/gcc/testsuite/gcc.target/i386/sse-23.c
index 270f448..898dde8 100644
--- a/gcc/testsuite/gcc.target/i386/sse-23.c
+++ b/gcc/testsuite/gcc.target/i386/sse-23.c
@@ -843,6 +843,6 @@
#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,avx512fp16,avxifma,avxvnniint8")
+#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,avxifma,avxvnniint8,avxneconvert")
#include <x86intrin.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106460.c b/gcc/testsuite/gcc.target/powerpc/pr106460.c
new file mode 100644
index 0000000..aae4b01
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106460.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
+
+/* (high:DI (symbol_ref:DI ("var_48")..))) should not cause ICE. */
+extern short var_48;
+void
+foo (double *r)
+{
+ if (var_48)
+ *r = 1234.5678;
+}
+
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c
new file mode 100644
index 0000000..90172b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinx -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ return b;
+}
+
+/* { dg-final { scan-assembler-not "fmv.h" } } */
+/* { dg-final { scan-assembler-times "mv" 1 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-2.c b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-2.c
new file mode 100644
index 0000000..26f0119
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinx -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fadd.h fa" } } */
+ /* { dg-final { scan-assembler-times "fadd.h a" 1 } } */
+ return a + b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-3.c b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-3.c
new file mode 100644
index 0000000..5739135
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-3.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinx -mabi=lp64 -O" } */
+
+int foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fgt.h fa" } } */
+ /* { dg-final { scan-assembler-times "fgt.h a" 1 } } */
+ return a > b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-1.c b/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-1.c
new file mode 100644
index 0000000..0070ebf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinxmin -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fmv.h" } } */
+ /* { dg-final { scan-assembler-not "fmv.s" } } */
+ /* { dg-final { scan-assembler-times "mv" 1 } } */
+ return b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-2.c b/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-2.c
new file mode 100644
index 0000000..17f45a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinxmin -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fadd.h" } } */
+ /* { dg-final { scan-assembler-not "fadd.s fa" } } */
+ /* { dg-final { scan-assembler-times "fadd.s a" 1 } } */
+ return a + b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-3.c b/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-3.c
new file mode 100644
index 0000000..7a43641
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfhmin -mabi=lp64f -O" } */
+
+int foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fgt.h" } } */
+ /* { dg-final { scan-assembler-not "fgt.s fa" } } */
+ /* { dg-final { scan-assembler-times "fgt.s a" 1 } } */
+ return a > b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/arch-18.c b/gcc/testsuite/gcc.target/riscv/arch-18.c
new file mode 100644
index 0000000..bb04536
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-18.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv32gcvh -mabi=ilp32 -mcmodel=medlow" } */
+int foo()
+{
+}
diff --git a/gcc/testsuite/gcc.target/riscv/arch-5.c b/gcc/testsuite/gcc.target/riscv/arch-5.c
index 2a0f3b78..b945a64 100644
--- a/gcc/testsuite/gcc.target/riscv/arch-5.c
+++ b/gcc/testsuite/gcc.target/riscv/arch-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv32isabc_hghi_zfoo_xbar -mabi=ilp32" } */
+/* { dg-options "-march=rv32isabc_zfoo_xbar -mabi=ilp32" } */
int foo()
{
}
diff --git a/gcc/testsuite/gcc.target/riscv/predef-23.c b/gcc/testsuite/gcc.target/riscv/predef-23.c
new file mode 100644
index 0000000..676023f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-23.c
@@ -0,0 +1,63 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv64ih_zfhmin -mabi=lp64f -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 64
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i)
+#error "__riscv_i"
+#endif
+
+#if defined(__riscv_c)
+#error "__riscv_c"
+#endif
+
+#if defined(__riscv_e)
+#error "__riscv_e"
+#endif
+
+#if defined(__riscv_a)
+#error "__riscv_a"
+#endif
+
+#if defined(__riscv_m)
+#error "__riscv_m"
+#endif
+
+#if !defined(__riscv_f)
+#error "__riscv_f"
+#endif
+
+#if defined(__riscv_d)
+#error "__riscv_d"
+#endif
+
+#if defined(__riscv_v)
+#error "__riscv_v"
+#endif
+
+#if defined(__riscv_zfh)
+#error "__riscv_zfh"
+#endif
+
+#if !defined(__riscv_zfhmin)
+#error "__riscv_zfhmin"
+#endif
+
+#if !defined(__riscv_zicsr)
+#error "__riscv_zicsr"
+#endif
+
+#if !defined(__riscv_h)
+#error "__riscv_h"
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/predef-24.c b/gcc/testsuite/gcc.target/riscv/predef-24.c
new file mode 100644
index 0000000..2b51a19
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-24.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_svnapot -mabi=lp64 -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 64
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i) || (__riscv_i != (2 * 1000 * 1000 + 1 * 1000))
+#error "__riscv_i"
+#endif
+
+#if !defined(__riscv_c) || (__riscv_c != (2 * 1000 * 1000))
+#error "__riscv_c"
+#endif
+
+#if defined(__riscv_e)
+#error "__riscv_e"
+#endif
+
+#if !defined(__riscv_a) || (__riscv_a != (2 * 1000 * 1000 + 1 * 1000))
+#error "__riscv_a"
+#endif
+
+#if !defined(__riscv_m) || (__riscv_m != (2 * 1000 * 1000))
+#error "__riscv_m"
+#endif
+
+#if !defined(__riscv_f) || (__riscv_f != (2 * 1000 * 1000 + 2 * 1000))
+#error "__riscv_f"
+#endif
+
+#if !defined(__riscv_d) || (__riscv_d != (2 * 1000 * 1000 + 2 * 1000))
+#error "__riscv_d"
+#endif
+
+#if !defined(__riscv_svnapot)
+#error "__riscv_svnapot"
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/predef-25.c b/gcc/testsuite/gcc.target/riscv/predef-25.c
new file mode 100644
index 0000000..64bde17
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-25.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_svinval -mabi=lp64 -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 64
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i) || (__riscv_i != (2 * 1000 * 1000 + 1 * 1000))
+#error "__riscv_i"
+#endif
+
+#if !defined(__riscv_c) || (__riscv_c != (2 * 1000 * 1000))
+#error "__riscv_c"
+#endif
+
+#if defined(__riscv_e)
+#error "__riscv_e"
+#endif
+
+#if !defined(__riscv_a) || (__riscv_a != (2 * 1000 * 1000 + 1 * 1000))
+#error "__riscv_a"
+#endif
+
+#if !defined(__riscv_m) || (__riscv_m != (2 * 1000 * 1000))
+#error "__riscv_m"
+#endif
+
+#if !defined(__riscv_f) || (__riscv_f != (2 * 1000 * 1000 + 2 * 1000))
+#error "__riscv_f"
+#endif
+
+#if !defined(__riscv_d) || (__riscv_d != (2 * 1000 * 1000 + 2 * 1000))
+#error "__riscv_d"
+#endif
+
+#if !defined(__riscv_svinval)
+#error "__riscv_svinval"
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-1.c
new file mode 100644
index 0000000..6a235e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-1.c
@@ -0,0 +1,179 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov1:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov1 (int8_t *in, int8_t *out)
+{
+ vint8mf8_t v = *(vint8mf8_t*)in;
+ *(vint8mf8_t*)out = v;
+}
+
+/*
+** mov2:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov2 (int8_t *in, int8_t *out)
+{
+ vint8mf4_t v = *(vint8mf4_t*)in;
+ *(vint8mf4_t*)out = v;
+}
+
+/*
+** mov3:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov3 (int8_t *in, int8_t *out)
+{
+ vint8mf2_t v = *(vint8mf2_t*)in;
+ *(vint8mf2_t*)out = v;
+}
+
+/*
+** mov4:
+** vl1re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov4 (int8_t *in, int8_t *out)
+{
+ vint8m1_t v = *(vint8m1_t*)in;
+ *(vint8m1_t*)out = v;
+}
+
+/*
+** mov5:
+** vl2re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov5 (int8_t *in, int8_t *out)
+{
+ vint8m2_t v = *(vint8m2_t*)in;
+ *(vint8m2_t*)out = v;
+}
+
+/*
+** mov6:
+** vl4re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov6 (int8_t *in, int8_t *out)
+{
+ vint8m4_t v = *(vint8m4_t*)in;
+ *(vint8m4_t*)out = v;
+}
+
+/*
+** mov7:
+** vl8re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov7 (int8_t *in, int8_t *out)
+{
+ vint8m8_t v = *(vint8m8_t*)in;
+ *(vint8m8_t*)out = v;
+}
+
+/*
+** mov8:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov8 (uint8_t *in, uint8_t *out)
+{
+ vuint8mf8_t v = *(vuint8mf8_t*)in;
+ *(vuint8mf8_t*)out = v;
+}
+
+/*
+** mov9:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov9 (uint8_t *in, uint8_t *out)
+{
+ vuint8mf4_t v = *(vuint8mf4_t*)in;
+ *(vuint8mf4_t*)out = v;
+}
+
+/*
+** mov10:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov10 (uint8_t *in, uint8_t *out)
+{
+ vuint8mf2_t v = *(vuint8mf2_t*)in;
+ *(vuint8mf2_t*)out = v;
+}
+
+/*
+** mov11:
+** vl1re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov11 (uint8_t *in, uint8_t *out)
+{
+ vuint8m1_t v = *(vuint8m1_t*)in;
+ *(vuint8m1_t*)out = v;
+}
+
+/*
+** mov12:
+** vl2re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov12 (uint8_t *in, uint8_t *out)
+{
+ vuint8m2_t v = *(vuint8m2_t*)in;
+ *(vuint8m2_t*)out = v;
+}
+
+/*
+** mov13:
+** vl4re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov13 (uint8_t *in, uint8_t *out)
+{
+ vuint8m4_t v = *(vuint8m4_t*)in;
+ *(vuint8m4_t*)out = v;
+}
+
+/*
+** mov14:
+** vl8re8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov14 (uint8_t *in, uint8_t *out)
+{
+ vuint8m8_t v = *(vuint8m8_t*)in;
+ *(vuint8m8_t*)out = v;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-10.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-10.c
new file mode 100644
index 0000000..10aa829
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-10.c
@@ -0,0 +1,385 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov1:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]
+** vle8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov1 (int8_t *in, int8_t *out)
+{
+ register vint8mf8_t v1 asm("v1") = *(vint8mf8_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint8mf8_t v2 asm("v2") = v1;
+ *(vint8mf8_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov2:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]
+** vle8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov2 (int8_t *in, int8_t *out)
+{
+ register vint8mf4_t v1 asm("v1") = *(vint8mf4_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint8mf4_t v2 asm("v2") = v1;
+ *(vint8mf4_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov3:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]
+** vle8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov3 (int8_t *in, int8_t *out)
+{
+ register vint8mf2_t v1 asm("v1") = *(vint8mf2_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint8mf2_t v2 asm("v2") = v1;
+ *(vint8mf2_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov4:
+** vl1re8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov4 (int8_t *in, int8_t *out)
+{
+ register vint8m1_t v1 asm("v1") = *(vint8m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint8m1_t v2 asm("v2") = v1;
+ *(vint8m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov5:
+** vl2re8\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov5 (int8_t *in, int8_t *out)
+{
+ register vint8m2_t v2 asm("v2") = *(vint8m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vint8m2_t v4 asm("v4") = v2;
+ *(vint8m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov6:
+** vl4re8\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov6 (int8_t *in, int8_t *out)
+{
+ register vint8m4_t v4 asm("v4") = *(vint8m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vint8m4_t v8 asm("v8") = v4;
+ *(vint8m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov7:
+** vl8re8\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov7 (int8_t *in, int8_t *out)
+{
+ register vint8m8_t v8 asm("v8") = *(vint8m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vint8m8_t v16 asm("v16") = v8;
+ *(vint8m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
+
+/*
+** mov8:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]
+** vle16\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov8 (int16_t *in, int16_t *out)
+{
+ register vint16mf4_t v1 asm("v1") = *(vint16mf4_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint16mf4_t v2 asm("v2") = v1;
+ *(vint16mf4_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov9:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]
+** vle16\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov9 (int16_t *in, int16_t *out)
+{
+ register vint16mf2_t v1 asm("v1") = *(vint16mf2_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint16mf2_t v2 asm("v2") = v1;
+ *(vint16mf2_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov10:
+** vl1re16\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov10 (int16_t *in, int16_t *out)
+{
+ register vint16m1_t v1 asm("v1") = *(vint16m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint16m1_t v2 asm("v2") = v1;
+ *(vint16m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov11:
+** vl2re16\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov11 (int16_t *in, int16_t *out)
+{
+ register vint16m2_t v2 asm("v2") = *(vint16m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vint16m2_t v4 asm("v4") = v2;
+ *(vint16m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov12:
+** vl4re16\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov12 (int16_t *in, int16_t *out)
+{
+ register vint16m4_t v4 asm("v4") = *(vint16m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vint16m4_t v8 asm("v8") = v4;
+ *(vint16m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov13:
+** vl8re16\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov13 (int32_t *in, int32_t *out)
+{
+ register vint16m8_t v8 asm("v8") = *(vint16m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vint16m8_t v16 asm("v16") = v8;
+ *(vint16m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
+
+/*
+** mov14:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]
+** vle32\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov14 (int32_t *in, int32_t *out)
+{
+ register vint32mf2_t v1 asm("v1") = *(vint32mf2_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint32mf2_t v2 asm("v2") = v1;
+ *(vint32mf2_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov15:
+** vl1re32\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov15 (int32_t *in, int32_t *out)
+{
+ register vint32m1_t v1 asm("v1") = *(vint32m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint32m1_t v2 asm("v2") = v1;
+ *(vint32m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov16:
+** vl2re32\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov16 (int32_t *in, int32_t *out)
+{
+ register vint32m2_t v2 asm("v2") = *(vint32m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vint32m2_t v4 asm("v4") = v2;
+ *(vint32m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov17:
+** vl4re32\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov17 (int32_t *in, int32_t *out)
+{
+ register vint32m4_t v4 asm("v4") = *(vint32m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vint32m4_t v8 asm("v8") = v4;
+ *(vint32m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov18:
+** vl8re32\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov18 (int32_t *in, int32_t *out)
+{
+ register vint32m8_t v8 asm("v8") = *(vint32m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vint32m8_t v16 asm("v16") = v8;
+ *(vint32m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
+
+/*
+** mov19:
+** vl1re64\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov19 (int64_t *in, int64_t *out)
+{
+ register vint64m1_t v1 asm("v1") = *(vint64m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint64m1_t v2 asm("v2") = v1;
+ *(vint64m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov20:
+** vl2re64\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov20 (int64_t *in, int64_t *out)
+{
+ register vint64m2_t v2 asm("v2") = *(vint64m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vint64m2_t v4 asm("v4") = v2;
+ *(vint64m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov21:
+** vl4re64\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov21 (int64_t *in, int64_t *out)
+{
+ register vint64m4_t v4 asm("v4") = *(vint64m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vint64m4_t v8 asm("v8") = v4;
+ *(vint64m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov22:
+** vl8re64\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov22 (int64_t *in, int64_t *out)
+{
+ register vint64m8_t v8 asm("v8") = *(vint64m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vint64m8_t v16 asm("v16") = v8;
+ *(vint64m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-11.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-11.c
new file mode 100644
index 0000000..f8da5bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-11.c
@@ -0,0 +1,385 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov1:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]
+** vle8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov1 (uint8_t *in, uint8_t *out)
+{
+ register vuint8mf8_t v1 asm("v1") = *(vuint8mf8_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint8mf8_t v2 asm("v2") = v1;
+ *(vuint8mf8_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov2:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]
+** vle8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov2 (uint8_t *in, uint8_t *out)
+{
+ register vuint8mf4_t v1 asm("v1") = *(vuint8mf4_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint8mf4_t v2 asm("v2") = v1;
+ *(vuint8mf4_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov3:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]
+** vle8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov3 (uint8_t *in, uint8_t *out)
+{
+ register vuint8mf2_t v1 asm("v1") = *(vuint8mf2_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint8mf2_t v2 asm("v2") = v1;
+ *(vuint8mf2_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov4:
+** vl1re8\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov4 (uint8_t *in, uint8_t *out)
+{
+ register vuint8m1_t v1 asm("v1") = *(vuint8m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint8m1_t v2 asm("v2") = v1;
+ *(vuint8m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov5:
+** vl2re8\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov5 (uint8_t *in, uint8_t *out)
+{
+ register vuint8m2_t v2 asm("v2") = *(vuint8m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vuint8m2_t v4 asm("v4") = v2;
+ *(vuint8m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov6:
+** vl4re8\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov6 (uint8_t *in, uint8_t *out)
+{
+ register vuint8m4_t v4 asm("v4") = *(vuint8m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vuint8m4_t v8 asm("v8") = v4;
+ *(vuint8m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov7:
+** vl8re8\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov7 (uint8_t *in, uint8_t *out)
+{
+ register vuint8m8_t v8 asm("v8") = *(vuint8m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vuint8m8_t v16 asm("v16") = v8;
+ *(vuint8m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
+
+/*
+** mov8:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]
+** vle16\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov8 (uint16_t *in, uint16_t *out)
+{
+ register vuint16mf4_t v1 asm("v1") = *(vuint16mf4_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint16mf4_t v2 asm("v2") = v1;
+ *(vuint16mf4_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov9:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]
+** vle16\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov9 (uint16_t *in, uint16_t *out)
+{
+ register vuint16mf2_t v1 asm("v1") = *(vuint16mf2_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint16mf2_t v2 asm("v2") = v1;
+ *(vuint16mf2_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov10:
+** vl1re16\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov10 (uint16_t *in, uint16_t *out)
+{
+ register vuint16m1_t v1 asm("v1") = *(vuint16m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint16m1_t v2 asm("v2") = v1;
+ *(vuint16m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov11:
+** vl2re16\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov11 (uint16_t *in, uint16_t *out)
+{
+ register vuint16m2_t v2 asm("v2") = *(vuint16m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vuint16m2_t v4 asm("v4") = v2;
+ *(vuint16m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov12:
+** vl4re16\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov12 (uint16_t *in, uint16_t *out)
+{
+ register vuint16m4_t v4 asm("v4") = *(vuint16m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vuint16m4_t v8 asm("v8") = v4;
+ *(vuint16m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov13:
+** vl8re16\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov13 (uint32_t *in, uint32_t *out)
+{
+ register vuint16m8_t v8 asm("v8") = *(vuint16m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vuint16m8_t v16 asm("v16") = v8;
+ *(vuint16m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
+
+/*
+** mov14:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]
+** vle32\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov14 (uint32_t *in, uint32_t *out)
+{
+ register vuint32mf2_t v1 asm("v1") = *(vuint32mf2_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint32mf2_t v2 asm("v2") = v1;
+ *(vuint32mf2_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov15:
+** vl1re32\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov15 (uint32_t *in, uint32_t *out)
+{
+ register vuint32m1_t v1 asm("v1") = *(vuint32m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint32m1_t v2 asm("v2") = v1;
+ *(vuint32m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov16:
+** vl2re32\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov16 (uint32_t *in, uint32_t *out)
+{
+ register vuint32m2_t v2 asm("v2") = *(vuint32m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vuint32m2_t v4 asm("v4") = v2;
+ *(vuint32m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov17:
+** vl4re32\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov17 (uint32_t *in, uint32_t *out)
+{
+ register vuint32m4_t v4 asm("v4") = *(vuint32m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vuint32m4_t v8 asm("v8") = v4;
+ *(vuint32m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov18:
+** vl8re32\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov18 (uint32_t *in, uint32_t *out)
+{
+ register vuint32m8_t v8 asm("v8") = *(vuint32m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vuint32m8_t v16 asm("v16") = v8;
+ *(vuint32m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
+
+/*
+** mov19:
+** vl1re64\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov19 (uint64_t *in, uint64_t *out)
+{
+ register vuint64m1_t v1 asm("v1") = *(vuint64m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vuint64m1_t v2 asm("v2") = v1;
+ *(vuint64m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov20:
+** vl2re64\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov20 (uint64_t *in, uint64_t *out)
+{
+ register vuint64m2_t v2 asm("v2") = *(vuint64m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vuint64m2_t v4 asm("v4") = v2;
+ *(vuint64m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov21:
+** vl4re64\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov21 (uint64_t *in, uint64_t *out)
+{
+ register vuint64m4_t v4 asm("v4") = *(vuint64m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vuint64m4_t v8 asm("v8") = v4;
+ *(vuint64m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov22:
+** vl8re64\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov22 (uint64_t *in, uint64_t *out)
+{
+ register vuint64m8_t v8 asm("v8") = *(vuint64m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vuint64m8_t v16 asm("v16") = v8;
+ *(vuint64m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-12.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-12.c
new file mode 100644
index 0000000..5b8ce40
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-12.c
@@ -0,0 +1,159 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov14:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]
+** vle32\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov14 (float *in, float *out)
+{
+ register vfloat32mf2_t v1 asm("v1") = *(vfloat32mf2_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vfloat32mf2_t v2 asm("v2") = v1;
+ *(vfloat32mf2_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov15:
+** vl1re32\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov15 (float *in, float *out)
+{
+ register vfloat32m1_t v1 asm("v1") = *(vfloat32m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vfloat32m1_t v2 asm("v2") = v1;
+ *(vfloat32m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov16:
+** vl2re32\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov16 (float *in, float *out)
+{
+ register vfloat32m2_t v2 asm("v2") = *(vfloat32m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vfloat32m2_t v4 asm("v4") = v2;
+ *(vfloat32m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov17:
+** vl4re32\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov17 (float *in, float *out)
+{
+ register vfloat32m4_t v4 asm("v4") = *(vfloat32m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vfloat32m4_t v8 asm("v8") = v4;
+ *(vfloat32m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov18:
+** vl8re32\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov18 (float *in, float *out)
+{
+ register vfloat32m8_t v8 asm("v8") = *(vfloat32m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vfloat32m8_t v16 asm("v16") = v8;
+ *(vfloat32m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
+
+/*
+** mov19:
+** vl1re64\.v\tv1,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv1r\.v\tv2,v1
+** ...
+** ret
+*/
+void mov19 (uint64_t *in, uint64_t *out)
+{
+ register vfloat64m1_t v1 asm("v1") = *(vfloat64m1_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vfloat64m1_t v2 asm("v2") = v1;
+ *(vfloat64m1_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
+
+/*
+** mov20:
+** vl2re64\.v\tv2,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv2r\.v\tv4,v2
+** ...
+** ret
+*/
+void mov20 (uint64_t *in, uint64_t *out)
+{
+ register vfloat64m2_t v2 asm("v2") = *(vfloat64m2_t*)in;
+ asm volatile ("# %0"::"vr"(v2));
+ register vfloat64m2_t v4 asm("v4") = v2;
+ *(vfloat64m2_t*)out = v4;
+ asm volatile ("# %0"::"vr"(v4));
+}
+
+/*
+** mov21:
+** vl4re64\.v\tv4,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv4r\.v\tv8,v4
+** ...
+** ret
+*/
+void mov21 (uint64_t *in, uint64_t *out)
+{
+ register vfloat64m4_t v4 asm("v4") = *(vfloat64m4_t*)in;
+ asm volatile ("# %0"::"vr"(v4));
+ register vfloat64m4_t v8 asm("v8") = v4;
+ *(vfloat64m4_t*)out = v8;
+ asm volatile ("# %0"::"vr"(v8));
+}
+
+/*
+** mov22:
+** vl8re64\.v\tv8,0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ...
+** vmv8r\.v\tv16,v8
+** ...
+** ret
+*/
+void mov22 (uint64_t *in, uint64_t *out)
+{
+ register vfloat64m8_t v8 asm("v8") = *(vfloat64m8_t*)in;
+ asm volatile ("# %0"::"vr"(v8));
+ register vfloat64m8_t v16 asm("v16") = v8;
+ *(vfloat64m8_t*)out = v16;
+ asm volatile ("# %0"::"vr"(v16));
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-13.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-13.c
new file mode 100644
index 0000000..8c630f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-13.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+
+#include <riscv_vector.h>
+
+void mov1 (int8_t *in, int8_t *out)
+{
+ register vint8mf8_t v1 asm("v1") = *(vint8mf8_t*)in;
+ asm volatile ("# %0"::"vr"(v1));
+ register vint8mf8_t v2 asm("v2") = v1;
+ asm volatile ("#":::"v2");
+ *(vint8mf8_t*)out = v2;
+ asm volatile ("# %0"::"vr"(v2));
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-2.c
new file mode 100644
index 0000000..b9bdd51
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-2.c
@@ -0,0 +1,153 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov2:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]
+** vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov2 (int16_t *in, int16_t *out)
+{
+ vint16mf4_t v = *(vint16mf4_t*)in;
+ *(vint16mf4_t*)out = v;
+}
+
+/*
+** mov3:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]
+** vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov3 (int16_t *in, int16_t *out)
+{
+ vint16mf2_t v = *(vint16mf2_t*)in;
+ *(vint16mf2_t*)out = v;
+}
+
+/*
+** mov4:
+** vl1re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov4 (int16_t *in, int16_t *out)
+{
+ vint16m1_t v = *(vint16m1_t*)in;
+ *(vint16m1_t*)out = v;
+}
+
+/*
+** mov5:
+** vl2re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov5 (int16_t *in, int16_t *out)
+{
+ vint16m2_t v = *(vint16m2_t*)in;
+ *(vint16m2_t*)out = v;
+}
+
+/*
+** mov6:
+** vl4re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov6 (int16_t *in, int16_t *out)
+{
+ vint16m4_t v = *(vint16m4_t*)in;
+ *(vint16m4_t*)out = v;
+}
+
+/*
+** mov7:
+** vl8re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov7 (int16_t *in, int16_t *out)
+{
+ vint16m8_t v = *(vint16m8_t*)in;
+ *(vint16m8_t*)out = v;
+}
+
+/*
+** mov8:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]
+** vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov8 (uint16_t *in, uint16_t *out)
+{
+ vuint16mf4_t v = *(vuint16mf4_t*)in;
+ *(vuint16mf4_t*)out = v;
+}
+
+/*
+** mov9:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]
+** vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov9 (uint16_t *in, uint16_t *out)
+{
+ vuint16mf2_t v = *(vuint16mf2_t*)in;
+ *(vuint16mf2_t*)out = v;
+}
+
+/*
+** mov10:
+** vl1re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov10 (uint16_t *in, uint16_t *out)
+{
+ vuint16m1_t v = *(vuint16m1_t*)in;
+ *(vuint16m1_t*)out = v;
+}
+
+/*
+** mov11:
+** vl2re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov11 (uint16_t *in, uint16_t *out)
+{
+ vuint16m2_t v = *(vuint16m2_t*)in;
+ *(vuint16m2_t*)out = v;
+}
+
+/*
+** mov12:
+** vl4re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov12 (uint16_t *in, uint16_t *out)
+{
+ vuint16m4_t v = *(vuint16m4_t*)in;
+ *(vuint16m4_t*)out = v;
+}
+
+/*
+** mov13:
+** vl8re16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov13 (uint16_t *in, uint16_t *out)
+{
+ vuint16m8_t v = *(vuint16m8_t*)in;
+ *(vuint16m8_t*)out = v;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-3.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-3.c
new file mode 100644
index 0000000..a7a89db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-3.c
@@ -0,0 +1,127 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov3:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]
+** vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov3 (int32_t *in, int32_t *out)
+{
+ vint32mf2_t v = *(vint32mf2_t*)in;
+ *(vint32mf2_t*)out = v;
+}
+
+/*
+** mov4:
+** vl1re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov4 (int32_t *in, int32_t *out)
+{
+ vint32m1_t v = *(vint32m1_t*)in;
+ *(vint32m1_t*)out = v;
+}
+
+/*
+** mov5:
+** vl2re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov5 (int32_t *in, int32_t *out)
+{
+ vint32m2_t v = *(vint32m2_t*)in;
+ *(vint32m2_t*)out = v;
+}
+
+/*
+** mov6:
+** vl4re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov6 (int32_t *in, int32_t *out)
+{
+ vint32m4_t v = *(vint32m4_t*)in;
+ *(vint32m4_t*)out = v;
+}
+
+/*
+** mov7:
+** vl8re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov7 (int32_t *in, int32_t *out)
+{
+ vint32m8_t v = *(vint32m8_t*)in;
+ *(vint32m8_t*)out = v;
+}
+
+/*
+** mov8:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]
+** vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov8 (uint32_t *in, uint32_t *out)
+{
+ vuint32mf2_t v = *(vuint32mf2_t*)in;
+ *(vuint32mf2_t*)out = v;
+}
+
+/*
+** mov9:
+** vl1re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov9 (uint32_t *in, uint32_t *out)
+{
+ vuint32m1_t v = *(vuint32m1_t*)in;
+ *(vuint32m1_t*)out = v;
+}
+
+/*
+** mov10:
+** vl2re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov10 (uint32_t *in, uint32_t *out)
+{
+ vuint32m2_t v = *(vuint32m2_t*)in;
+ *(vuint32m2_t*)out = v;
+}
+
+/*
+** mov11:
+** vl4re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov11 (uint32_t *in, uint32_t *out)
+{
+ vuint32m4_t v = *(vuint32m4_t*)in;
+ *(vuint32m4_t*)out = v;
+}
+
+/*
+** mov12:
+** vl8re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov12 (uint32_t *in, uint32_t *out)
+{
+ vuint32m8_t v = *(vuint32m8_t*)in;
+ *(vuint32m8_t*)out = v;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-4.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-4.c
new file mode 100644
index 0000000..e8cfb4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-4.c
@@ -0,0 +1,101 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov4:
+** vl1re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov4 (int64_t *in, int64_t *out)
+{
+ vint64m1_t v = *(vint64m1_t*)in;
+ *(vint64m1_t*)out = v;
+}
+
+/*
+** mov5:
+** vl2re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov5 (int64_t *in, int64_t *out)
+{
+ vint64m2_t v = *(vint64m2_t*)in;
+ *(vint64m2_t*)out = v;
+}
+
+/*
+** mov6:
+** vl4re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov6 (int64_t *in, int64_t *out)
+{
+ vint64m4_t v = *(vint64m4_t*)in;
+ *(vint64m4_t*)out = v;
+}
+
+/*
+** mov7:
+** vl8re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov7 (int64_t *in, int64_t *out)
+{
+ vint64m8_t v = *(vint64m8_t*)in;
+ *(vint64m8_t*)out = v;
+}
+
+/*
+** mov8:
+** vl1re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov8 (uint64_t *in, uint64_t *out)
+{
+ vuint64m1_t v = *(vuint64m1_t*)in;
+ *(vuint64m1_t*)out = v;
+}
+
+/*
+** mov9:
+** vl2re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov9 (uint64_t *in, uint64_t *out)
+{
+ vuint64m2_t v = *(vuint64m2_t*)in;
+ *(vuint64m2_t*)out = v;
+}
+
+/*
+** mov10:
+** vl4re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov10 (uint64_t *in, uint64_t *out)
+{
+ vuint64m4_t v = *(vuint64m4_t*)in;
+ *(vuint64m4_t*)out = v;
+}
+
+/*
+** mov11:
+** vl8re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov11 (uint64_t *in, uint64_t *out)
+{
+ vuint64m8_t v = *(vuint64m8_t*)in;
+ *(vuint64m8_t*)out = v;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-5.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-5.c
new file mode 100644
index 0000000..5ca232b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-5.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov3:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]
+** vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov3 (float *in, float *out)
+{
+ vfloat32mf2_t v = *(vfloat32mf2_t*)in;
+ *(vfloat32mf2_t*)out = v;
+}
+
+/*
+** mov4:
+** vl1re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov4 (float *in, float *out)
+{
+ vfloat32m1_t v = *(vfloat32m1_t*)in;
+ *(vfloat32m1_t*)out = v;
+}
+
+/*
+** mov5:
+** vl2re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov5 (float *in, float *out)
+{
+ vfloat32m2_t v = *(vfloat32m2_t*)in;
+ *(vfloat32m2_t*)out = v;
+}
+
+/*
+** mov6:
+** vl4re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov6 (float *in, float *out)
+{
+ vfloat32m4_t v = *(vfloat32m4_t*)in;
+ *(vfloat32m4_t*)out = v;
+}
+
+/*
+** mov7:
+** vl8re32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov7 (float *in, float *out)
+{
+ vfloat32m8_t v = *(vfloat32m8_t*)in;
+ *(vfloat32m8_t*)out = v;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-6.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-6.c
new file mode 100644
index 0000000..41fc73b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-6.c
@@ -0,0 +1,53 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov4:
+** vl1re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs1r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov4 (double *in, double *out)
+{
+ vfloat64m1_t v = *(vfloat64m1_t*)in;
+ *(vfloat64m1_t*)out = v;
+}
+
+/*
+** mov5:
+** vl2re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs2r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov5 (double *in, double *out)
+{
+ vfloat64m2_t v = *(vfloat64m2_t*)in;
+ *(vfloat64m2_t*)out = v;
+}
+
+/*
+** mov6:
+** vl4re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs4r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov6 (double *in, double *out)
+{
+ vfloat64m4_t v = *(vfloat64m4_t*)in;
+ *(vfloat64m4_t*)out = v;
+}
+
+/*
+** mov7:
+** vl8re64\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vs8r\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov7 (double *in, double *out)
+{
+ vfloat64m8_t v = *(vfloat64m8_t*)in;
+ *(vfloat64m8_t*)out = v;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-7.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-7.c
new file mode 100644
index 0000000..d4636e0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-7.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+
+#include <riscv_vector.h>
+
+/* This testcase is testing whether RISC-V define REGMODE_NATURAL_SIZE. */
+void foo (int8_t *in, int8_t *out)
+{
+ vint8mf2_t v = *(vint8mf2_t*)in;
+ vint32mf2_t v2 = *(vint32mf2_t*)in;
+ *(vint8mf2_t*)out = v;
+ *(vint32mf2_t*)(out + 16) = v2;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-8.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-8.c
new file mode 100644
index 0000000..9447b05
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-8.c
@@ -0,0 +1,96 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/*
+** mov1:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]
+** vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vsm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov1 (int8_t *in, int8_t *out)
+{
+ vbool64_t v = *(vbool64_t*)in;
+ *(vbool64_t*)out = v;
+}
+
+/*
+** mov2:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]
+** vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vsm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov2 (int8_t *in, int8_t *out)
+{
+ vbool32_t v = *(vbool32_t*)in;
+ *(vbool32_t*)out = v;
+}
+
+/*
+** mov3:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]
+** vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vsm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov3 (int8_t *in, int8_t *out)
+{
+ vbool16_t v = *(vbool16_t*)in;
+ *(vbool16_t*)out = v;
+}
+
+/*
+** mov4:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]
+** vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vsm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov4 (int8_t *in, int8_t *out)
+{
+ vbool8_t v = *(vbool8_t*)in;
+ *(vbool8_t*)out = v;
+}
+
+/*
+** mov5:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]
+** vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vsm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov5 (int8_t *in, int8_t *out)
+{
+ vbool4_t v = *(vbool4_t*)in;
+ *(vbool4_t*)out = v;
+}
+
+/*
+** mov6:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]
+** vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vsm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov6 (int8_t *in, int8_t *out)
+{
+ vbool2_t v = *(vbool2_t*)in;
+ *(vbool2_t*)out = v;
+}
+
+/*
+** mov7:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]
+** vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vsm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov7 (int8_t *in, int8_t *out)
+{
+ vbool1_t v = *(vbool1_t*)in;
+ *(vbool1_t*)out = v;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mov-9.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-9.c
new file mode 100644
index 0000000..6d39e3c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mov-9.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <riscv_vector.h>
+
+/* Test tieable of RVV types with same LMUL. */
+/*
+** mov1:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** addi\t(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),1
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** addi\t(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),2
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov1 (int8_t *in, int8_t *out, int M)
+{
+ vint8mf2_t v1 = *(vint8mf2_t*)(in);
+ vint16mf2_t v2 = *(vint16mf2_t*)(in);
+ vint32mf2_t v3 = *(vint32mf2_t*)(in);
+ *(vint8mf2_t*)(out) = v1;
+ *(vint16mf2_t*)(out + 1) = v2;
+ *(vint32mf2_t*)(out + 2) = v3;
+}
+
+/*
+** mov2:
+** vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]
+** vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** addi\t(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),1
+** vse8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\)
+** ret
+*/
+void mov2 (int8_t *in, int8_t *out, int M)
+{
+ vint8mf4_t v1 = *(vint8mf4_t*)(in);
+ vint16mf4_t v2 = *(vint16mf4_t*)(in);
+ *(vint8mf4_t*)(out) = v1;
+ *(vint16mf4_t*)(out + 1) = v2;
+}
diff --git a/gcc/testsuite/gdc.dg/simd18867.d b/gcc/testsuite/gdc.dg/simd18867.d
new file mode 100644
index 0000000..295b0f8
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd18867.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=18867
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+ulong2 test18867(ulong s)
+{
+ ulong2 v;
+ v[0] = s;
+ return v;
+}
diff --git a/gcc/testsuite/gdc.dg/simd19630.d b/gcc/testsuite/gdc.dg/simd19630.d
index 0d45d28..c29acfe 100644
--- a/gcc/testsuite/gdc.dg/simd19630.d
+++ b/gcc/testsuite/gdc.dg/simd19630.d
@@ -3,19 +3,13 @@
// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
import core.simd;
-enum fail19630a = int4.init[1..2];
enum fail19630b = int4.init.array[1..2];
enum fail19630c = (cast(int[4])int4.init.array)[1..2];
enum fail19630d = (cast(int[4])int4.init)[1..2];
-enum fail19630e = int4(0)[1..2];
enum fail19630f = int4(0).array[1..2];
enum fail19630g = (cast(int[4])int4(0).array)[1..2];
enum fail19630h = (cast(int[4])int4(0))[1..2];
-enum int4 v19630a = int4.init;
-enum slice19630a = v19630a[1..2];
-static assert(slice19630a == [0]);
-
enum int[4] v19630b = int4.init.array;
enum slice19630b = v19630b[1..2];
static assert(slice19630b == [0]);
@@ -28,10 +22,6 @@ enum int[4] v19630d = cast(int[4])int4.init;
enum slice19630d = v19630d[1..2];
static assert(slice19630d == [0]);
-enum int4 v19630e = int4(0);
-enum slice19630e = v19630e[1..2];
-static assert(slice19630e == [0]);
-
enum int[4] v19630f = int4(0).array;
enum slice19630f = v19630f[1..2];
static assert(slice19630f == [0]);
diff --git a/gcc/testsuite/gdc.dg/simd19630b.d b/gcc/testsuite/gdc.dg/simd19630b.d
new file mode 100644
index 0000000..4f09597
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd19630b.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=19630
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+enum fail19630a = int4.init[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+enum fail19630e = int4(0)[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+
+enum int4 v19630a = int4.init;
+enum slice19630a = v19630a[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+
+enum int4 v19630e = int4(0);
+enum slice19630e = v19630e[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/gdc.dg/simd19630c.d b/gcc/testsuite/gdc.dg/simd19630c.d
new file mode 100644
index 0000000..d17cf1a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd19630c.d
@@ -0,0 +1,15 @@
+// https://issues.dlang.org/show_bug.cgi?id=19630
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+int4 testz19630()
+{
+ return [0,0,0,0];
+}
+
+void test19630()
+{
+ assert(testz19630()[] == [0,0,0,0]);
+ // { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/gdc.dg/simd19788.d b/gcc/testsuite/gdc.dg/simd19788.d
new file mode 100644
index 0000000..74ab008
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd19788.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=19788
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test19788()
+{
+ enum v = __vector(float[4]).init;
+ const(float)[] a = v[];
+ // { dg-error "'__vector\\\(float\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/gdc.dg/simd21469.d b/gcc/testsuite/gdc.dg/simd21469.d
new file mode 100644
index 0000000..9596f5e
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd21469.d
@@ -0,0 +1,9 @@
+// https://issues.dlang.org/show_bug.cgi?id=18867
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+int4 test21469(short a)
+{
+ return cast(int4)(short8(a));
+}
diff --git a/gcc/testsuite/gdc.dg/simd21672.d b/gcc/testsuite/gdc.dg/simd21672.d
new file mode 100644
index 0000000..c5bd1df
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd21672.d
@@ -0,0 +1,17 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=213
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+
+import core.simd;
+
+struct S213
+{
+ int4 vec;
+}
+
+void test213()
+{
+ S213 s, b;
+
+ assert(s == b);
+}
diff --git a/gcc/testsuite/gdc.dg/simd23077.d b/gcc/testsuite/gdc.dg/simd23077.d
new file mode 100644
index 0000000..150ec9f
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd23077.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=23077
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+float test23077(float x)
+{
+ short i = *cast(short*)&x;
+ ++i;
+ return *cast(float*)&i; // this cast is not allowed in @safe code
+}
diff --git a/gcc/testsuite/gdc.dg/simd23084.d b/gcc/testsuite/gdc.dg/simd23084.d
new file mode 100644
index 0000000..1f40e3c
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd23084.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=23084
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+__vector(int[4]) test23084a(__vector(int[4]) a)
+{
+ __vector(short[8]) r = cast(short)(a.array[0]);
+ return cast(__vector(int[4]))r;
+}
+
+__vector(int[4]) test23084b(__vector(int[4]) a)
+{
+ __vector(byte[16]) r = cast(byte)(a.array[0]);
+ return cast(__vector(int[4]))r;
+}
diff --git a/gcc/testsuite/gdc.dg/simd23085.d b/gcc/testsuite/gdc.dg/simd23085.d
new file mode 100644
index 0000000..66444ad
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd23085.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=23085
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+float test23085(float x)
+{
+ byte i = *cast(byte*)&x;
+ ++i;
+ return *cast(float*)&i; // this cast is not allowed in @safe code
+}
diff --git a/gcc/testsuite/gdc.dg/simd_ctfe.d b/gcc/testsuite/gdc.dg/simd_ctfe.d
deleted file mode 100644
index 507de17..0000000
--- a/gcc/testsuite/gdc.dg/simd_ctfe.d
+++ /dev/null
@@ -1,88 +0,0 @@
-// { dg-additional-options "-mavx" { target avx_runtime } }
-// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
-import core.simd;
-
-// https://issues.dlang.org/show_bug.cgi?id=19627
-enum int[4] fail19627 = cast(int[4])int4(0);
-
-// https://issues.dlang.org/show_bug.cgi?id=19628
-enum ice19628a = int4.init[0];
-enum ice19628b = int4.init.array[0];
-enum ice19628c = (cast(int[4])int4.init.array)[0];
-enum ice19628d = (cast(int[4])int4.init)[0];
-
-// https://issues.dlang.org/show_bug.cgi?id=19629
-enum fail19629a = int4(0)[0];
-enum fail19629b = int4(0).array[0];
-enum fail19629c = (cast(int[4])int4(0).array)[0];
-enum fail19628d = (cast(int[4])int4(0))[0];
-
-// https://issues.dlang.org/show_bug.cgi?id=19630
-enum fail19630a = int4.init[1..2];
-enum fail19630b = int4.init.array[1..2];
-enum fail19630c = (cast(int[4])int4.init.array)[1..2];
-enum fail19630d = int4(0)[1..2];
-enum fail19630e = int4(0).array[1..2];
-enum fail19630f = (cast(int[4])int4(0).array)[1..2];
-enum fail19630g = (cast(int[4])int4.init)[1..2];
-enum fail19630h = (cast(int[4])int4(0))[1..2];
-
-// Same tests as above, but use access via enum.
-enum int4 V1 = int4.init;
-enum int[4] V2 = int4.init.array;
-enum int[4] V3 = cast(int[4])int4.init;
-enum int[4] V4 = cast(int[4])int4.init.array;
-enum int4 V5 = int4(0);
-enum int[4] V6 = int4(0).array;
-enum int[4] V7 = cast(int[4])int4(0);
-enum int[4] V8 = cast(int[4])int4(0).array;
-
-// CTFE index tests
-enum I1 = V1[0]; static assert(I1 == 0);
-enum I2 = V2[0]; static assert(I2 == 0);
-enum I3 = V3[0]; static assert(I3 == 0);
-enum I4 = V4[0]; static assert(I4 == 0);
-enum I5 = V5[0]; static assert(I5 == 0);
-enum I6 = V6[0]; static assert(I6 == 0);
-enum I7 = V7[0]; static assert(I7 == 0);
-enum I8 = V8[0]; static assert(I8 == 0);
-
-// CTFE slice tests
-enum S1 = V1[1..2]; static assert(S1 == [0]);
-enum S2 = V2[1..2]; static assert(S2 == [0]);
-enum S3 = V3[1..2]; static assert(S3 == [0]);
-enum S4 = V4[1..2]; static assert(S4 == [0]);
-enum S5 = V5[1..2]; static assert(S5 == [0]);
-enum S6 = V6[1..2]; static assert(S6 == [0]);
-enum S7 = V7[1..2]; static assert(S7 == [0]);
-enum S8 = V8[1..2]; static assert(S8 == [0]);
-
-// Same tests as above, but use access via immutable.
-//immutable int4 v1 = int4.init; // Cannot cast to immutable at compile time
-immutable int[4] v2 = int4.init.array;
-immutable int[4] v3 = cast(int[4])int4.init;
-immutable int[4] v4 = cast(int[4])int4.init.array;
-//immutable int4 v5 = int4(0); // Cannot cast to immutable at compile time
-immutable int[4] v6 = int4(0).array;
-immutable int[4] v7 = cast(int[4])int4(0);
-immutable int[4] v8 = cast(int[4])int4(0).array;
-
-// CTFE index tests
-//immutable i1 = v1[0]; static assert(i1 == 0);
-immutable i2 = v2[0]; static assert(i2 == 0);
-immutable i3 = v3[0]; static assert(i3 == 0);
-immutable i4 = v4[0]; static assert(i4 == 0);
-//immutable i5 = v5[0]; static assert(i5 == 0);
-immutable i6 = v6[0]; static assert(i6 == 0);
-immutable i7 = v7[0]; static assert(i7 == 0);
-immutable i8 = v8[0]; static assert(i8 == 0);
-
-// CTFE slice tests
-//immutable s1 = v1[1..2]; static assert(s1 == [0]);
-immutable s2 = v2[1..2]; static assert(s2 == [0]);
-immutable s3 = v3[1..2]; static assert(s3 == [0]);
-immutable s4 = v4[1..2]; static assert(s4 == [0]);
-//immutable s5 = v5[1..2]; static assert(s5 == [0]);
-immutable s6 = v6[1..2]; static assert(s6 == [0]);
-immutable s7 = v7[1..2]; static assert(s7 == [0]);
-immutable s8 = v8[1..2]; static assert(s8 == [0]);
diff --git a/gcc/testsuite/gdc.dg/torture/simd19632.d b/gcc/testsuite/gdc.dg/torture/simd19632.d
new file mode 100644
index 0000000..e74a3e8
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd19632.d
@@ -0,0 +1,15 @@
+// https://issues.dlang.org/show_bug.cgi?id=19632
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+void main()
+{
+ int4 v = [1, 2, 3, 4];
+ int sum = 0;
+ foreach (ref e; v)
+ sum += (e *= 2);
+ assert(v.array[] == [2, 4, 6, 8]);
+ assert(sum == 20);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd20041.d b/gcc/testsuite/gdc.dg/torture/simd20041.d
new file mode 100644
index 0000000..a74f58a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd20041.d
@@ -0,0 +1,22 @@
+// https://issues.dlang.org/show_bug.cgi?id=20041
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+immutable(float4) test20041()
+{
+ float4 raw = 2.0f;
+ raw.array[0] = 1;
+ return cast(immutable)raw;
+}
+
+void main()
+{
+ static immutable float4 v = test20041();
+
+ assert(v.array[0] == 1);
+ assert(v.array[1] == 2);
+ assert(v.array[2] == 2);
+ assert(v.array[3] == 2);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd21673.d b/gcc/testsuite/gdc.dg/torture/simd21673.d
new file mode 100644
index 0000000..701e33a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd21673.d
@@ -0,0 +1,20 @@
+// https://issues.dlang.org/show_bug.cgi?id=21673
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+float4 _mm_move_ss(float4 a, float4 b)
+{
+ a.ptr[0] = b.array[0];
+ return a;
+}
+
+void main()
+{
+ float4 A = [1.0f, 2.0f, 3.0f, 4.0f];
+ float4 B = [5.0f, 6.0f, 7.0f, 8.0f];
+ float4 R = _mm_move_ss(A, B);
+ float[4] correct = [5.0f, 2.0f, 3.0f, 4.0f];
+ assert(R.array == correct);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd21676.d b/gcc/testsuite/gdc.dg/torture/simd21676.d
new file mode 100644
index 0000000..1d7b911
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd21676.d
@@ -0,0 +1,36 @@
+// https://issues.dlang.org/show_bug.cgi?id=23009
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+double2 loadUnaligned21676(const(double)* pvec)
+{
+ double2 result;
+ foreach(i; 0..2)
+ {
+ result[i] = pvec[i];
+ }
+ return result;
+}
+
+double2 _mm_setr_pd(double e1, double e0)
+{
+ double[2] result = [e1, e0];
+ return loadUnaligned21676(result.ptr);
+}
+
+double2 fun(double2 a, double2 b)
+{
+ a[0] = (a[0] < b[0]) ? a[0] : b[0];
+ return a;
+}
+
+void main()
+{
+ double2 A = _mm_setr_pd(1.0, 2.0);
+ double2 B = _mm_setr_pd(4.0, 1.0);
+ double2 C = fun(A, B);
+ assert(C.array[0] == 1.0);
+ assert(C.array[1] == 2.0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd22438.d b/gcc/testsuite/gdc.dg/torture/simd22438.d
new file mode 100644
index 0000000..9199be6
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd22438.d
@@ -0,0 +1,18 @@
+// https://issues.dlang.org/show_bug.cgi?id=22438
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct T22438 { int x; double d; }
+
+T22438 foo22438(int x, double d) { return T22438(x, d); }
+
+struct S22438 { T22438 t; string r; }
+
+void main()
+{
+ S22438 s = S22438(foo22438(10, 3.14), "str");
+ assert(s.t.x == 10);
+ assert(s.t.d == 3.14);
+ assert(s.r == "str");
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd23009.d b/gcc/testsuite/gdc.dg/torture/simd23009.d
new file mode 100644
index 0000000..a45ec4d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd23009.d
@@ -0,0 +1,22 @@
+// https://issues.dlang.org/show_bug.cgi?id=23009
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+double2 _mm_loadl_pd(double2 a, const(double)* mem_addr)
+{
+ a[0] = *mem_addr;
+ return a;
+}
+
+void main()
+{
+ double A = 7.0;
+ double2 B;
+ B[0] = 4.0;
+ B[1] = -5.0;
+ double2 R = _mm_loadl_pd(B, &A);
+ double[2] correct = [ 7.0, -5.0 ];
+ assert(R.array == correct);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd23077.d b/gcc/testsuite/gdc.dg/torture/simd23077.d
new file mode 100644
index 0000000..150ec9f
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd23077.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=23077
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+float test23077(float x)
+{
+ short i = *cast(short*)&x;
+ ++i;
+ return *cast(float*)&i; // this cast is not allowed in @safe code
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd8.d b/gcc/testsuite/gdc.dg/torture/simd8.d
new file mode 100644
index 0000000..3847732
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd8.d
@@ -0,0 +1,26 @@
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import gcc.simd;
+
+alias __m128 = __vector(float[4]);
+
+__m128 _mm_setr_ps (float e3, float e2, float e1, float e0) pure @trusted
+{
+ float[4] result = [e3, e2, e1, e0];
+ return loadUnaligned!(__m128)(cast(__m128*)result.ptr);
+}
+
+__m128 _mm_movehdup_ps (__m128 a) pure @trusted
+{
+ a.ptr[0] = a.array[1];
+ a.ptr[2] = a.array[3];
+ return a;
+}
+
+void main()
+{
+ __m128 A = _mm_movehdup_ps(_mm_setr_ps(1, 2, 3, 4));
+ float[4] correct = [2.0f, 2, 4, 4 ];
+ assert(A.array == correct);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd9.d b/gcc/testsuite/gdc.dg/torture/simd9.d
new file mode 100644
index 0000000..0653531
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd9.d
@@ -0,0 +1,46 @@
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+__gshared int testsroa_x;
+
+template SROA(T1, T2)
+{
+ struct FPoint
+ {
+ T1 x;
+ T2 y;
+ }
+
+ void sroa(FPoint p1, ref FPoint quad)
+ {
+ quad = FPoint(p1.x, p1.y);
+ }
+
+ void testit()
+ {
+ FPoint p1 = FPoint(1, 2);
+
+ FPoint quad;
+ sroa(p1, quad);
+
+ if (quad != p1)
+ {
+ assert(0);
+ }
+ ++testsroa_x;
+ }
+}
+
+void main()
+{
+ SROA!(int, int ).testit();
+ SROA!(int, float).testit();
+ SROA!(float, float).testit();
+ SROA!(float, int ).testit();
+
+ SROA!(long, long ).testit();
+ SROA!(long, double).testit();
+ SROA!(double, double).testit();
+ SROA!(double, long ).testit();
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd_prefetch.d b/gcc/testsuite/gdc.dg/torture/simd_prefetch.d
new file mode 100644
index 0000000..1778476
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd_prefetch.d
@@ -0,0 +1,21 @@
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import gcc.simd;
+
+int testprefetch(byte a)
+{
+ prefetch!(false, 0)(&a);
+ prefetch!(false, 1)(&a);
+ prefetch!(false, 2)(&a);
+ prefetch!(false, 3)(&a);
+ prefetch!(true, 0)(&a);
+ prefetch!(true, 1)(&a);
+ prefetch!(true, 2)(&a);
+ prefetch!(true, 3)(&a);
+ return 3;
+}
+
+void main()
+{
+ int i = testprefetch(1);
+ assert(i == 3);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/cdcmp.d b/gcc/testsuite/gdc.test/compilable/cdcmp.d
index 305f097b..16abde0 100644
--- a/gcc/testsuite/gdc.test/compilable/cdcmp.d
+++ b/gcc/testsuite/gdc.test/compilable/cdcmp.d
@@ -60,20 +60,6 @@ bool test_nez(long x) { return x != 0; }
bool test_gez(long x) { return x >= 0; }
bool test_gtz(long x) { return x > 0; }
-bool test_ltz(float x) { return x < 0; }
-bool test_lez(float x) { return x <= 0; }
-bool test_eqz(float x) { return x == 0; }
-bool test_nez(float x) { return x != 0; }
-bool test_gez(float x) { return x >= 0; }
-bool test_gtz(float x) { return x > 0; }
-
-bool test_ltz(double x) { return x < 0; }
-bool test_lez(double x) { return x <= 0; }
-bool test_eqz(double x) { return x == 0; }
-bool test_nez(double x) { return x != 0; }
-bool test_gez(double x) { return x >= 0; }
-bool test_gtz(double x) { return x > 0; }
-
/* ----------------------------------- */
bool test_lt(ubyte x, ubyte y) { return x < y; }
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/header2.d b/gcc/testsuite/gdc.test/compilable/extra-files/header2.d
index 7dc4659..7c011d2 100644
--- a/gcc/testsuite/gdc.test/compilable/extra-files/header2.d
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/header2.d
@@ -162,6 +162,18 @@ align(2) struct S12200_2
align(1):
}
+// https://issues.dlang.org/show_bug.cgi?id=14694
+inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted pure nothrow
+{
+ alias U = inout(T);
+ static U* max(U* a, U* b) nothrow { return a > b ? a : b; }
+ static U* min(U* a, U* b) nothrow { return a < b ? a : b; }
+
+ auto b = max(r1.ptr, r2.ptr);
+ auto e = min(r1.ptr + r1.length, r2.ptr + r2.length);
+ return b < e ? b[0 .. e - b] : null;
+}
+
// https://issues.dlang.org/show_bug.cgi?id=16140
void gun()()
{
@@ -173,6 +185,13 @@ void gun()()
else break;
}
+// https://issues.dlang.org/show_bug.cgi?id=14690
+pragma(inline, true)
+int fun(int a, int b)
+{
+ return 3;
+}
+
// https://issues.dlang.org/show_bug.cgi?id=16649
void leFoo()()
{
diff --git a/gcc/testsuite/gdc.test/compilable/imports/cimports2a.i b/gcc/testsuite/gdc.test/compilable/imports/cimports2a.i
index c8ff976..0d001e8 100644
--- a/gcc/testsuite/gdc.test/compilable/imports/cimports2a.i
+++ b/gcc/testsuite/gdc.test/compilable/imports/cimports2a.i
@@ -2,3 +2,10 @@ extern int xx;
typedef struct Foo *FooRef;
FooRef make_foo(void);
+
+
+typedef struct Foo2 *FooRef2;
+struct Foo2 {
+ int x;
+};
+FooRef2 make_foo2(void);
diff --git a/gcc/testsuite/gdc.test/compilable/imports/cimports2b.i b/gcc/testsuite/gdc.test/compilable/imports/cimports2b.i
index 03b22b2..a0a9c2f 100644
--- a/gcc/testsuite/gdc.test/compilable/imports/cimports2b.i
+++ b/gcc/testsuite/gdc.test/compilable/imports/cimports2b.i
@@ -2,3 +2,11 @@ extern int xx;
typedef struct Foo *FooRef;
void free_foo(FooRef foo);
+
+/****************************/
+
+typedef struct Foo2 *FooRef2;
+struct Foo2 {
+ int x;
+};
+void free_foo2(FooRef2 foo);
diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg22952/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg22952/package.d
new file mode 100644
index 0000000..1a804d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/pkg22952/package.d
@@ -0,0 +1 @@
+module lib;
diff --git a/gcc/testsuite/gdc.test/compilable/noreturn3.d b/gcc/testsuite/gdc.test/compilable/noreturn3.d
new file mode 100644
index 0000000..737125d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/noreturn3.d
@@ -0,0 +1,257 @@
+/*
+REQUIRED_ARGS: -w -o- -d
+
+More complex examples from the DIP
+https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1034.md
+*/
+
+alias noreturn = typeof(*null);
+static assert (!is(noreturn == void));
+
+void initialize()
+{
+ noreturn a;
+ noreturn b = noreturn.init;
+}
+
+void foo(const noreturn);
+void foo(const int);
+
+noreturn bar();
+
+void overloads()
+{
+ noreturn n;
+ foo(n);
+
+ foo(bar());
+}
+
+// /*****************************************************************************/
+
+auto inferNoreturn(int i)
+{
+ if (i < 0)
+ return assert(false);
+ else if (i == 0)
+ return assert(false);
+ else
+ return assert(false);
+}
+
+auto inferReturn(int i)
+{
+ if (i < 0)
+ return assert(false);
+ else if (i == 0)
+ return i;
+ else
+ return assert(false);
+}
+
+// /*****************************************************************************/
+// // https://issues.dlang.org/show_bug.cgi?id=22004
+
+alias fun22004 = _ => {}();
+alias gun22004 = _ => assert(0);
+auto bun22004(bool b)
+{
+ if (b)
+ return gun22004(0);
+ else
+ return fun22004(0);
+}
+
+static assert(is(typeof(bun22004(true)) == void));
+
+// // Reversed order
+auto bun22004_reversed(bool b)
+{
+ if (b)
+ return fun22004(0);
+ else
+ return gun22004(0);
+}
+
+static assert(is(typeof(bun22004_reversed(true)) == void));
+
+// /*****************************************************************************/
+
+// // Also works fine with non-void types and ref inference
+
+int global;
+
+auto ref forwardOrExit(ref int num)
+{
+ if (num)
+ return num;
+ else
+ return assert(false);
+}
+
+static assert( is(typeof(forwardOrExit(global)) == int));
+
+// // Must not infer ref due to the noreturn rvalue
+static assert(!is(typeof(&forwardOrExit(global))));
+
+auto ref forwardOrExit2(ref int num)
+{
+ if (num)
+ return assert(false);
+ else
+ return num;
+}
+
+static assert( is(typeof(forwardOrExit2(global)) == int));
+
+// // Must not infer ref due to the noreturn rvalue
+static assert(!is(typeof(&forwardOrExit2(global))));
+
+/*****************************************************************************/
+
+void inference()
+{
+ auto inf = cast(noreturn) 1;
+ static assert(is(typeof(inf) == noreturn));
+
+ noreturn n;
+ auto c = cast(const shared noreturn) n;
+ static assert(is(typeof(c) == const shared noreturn));
+ static assert(is(typeof(n) == noreturn));
+
+ auto c2 = cast(immutable noreturn) n;
+ static assert(is(typeof(c) == const shared noreturn));
+ static assert(is(typeof(c2) == immutable noreturn));
+ static assert(is(typeof(n) == noreturn));
+}
+
+
+/******************************************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=21957
+// Calculate proper alignment and size for noreturn members
+
+enum longPad = long.alignof - int.sizeof;
+
+struct BasicStruct
+{
+ int firstInt;
+ noreturn noRet;
+ long lastLong;
+}
+
+static assert(BasicStruct.sizeof == (int.sizeof + longPad + long.sizeof));
+
+static assert(BasicStruct.firstInt.offsetof == 0);
+static assert(BasicStruct.noRet.offsetof == 4);
+static assert(BasicStruct.lastLong.offsetof == (4 + longPad));
+
+struct AlignedStruct
+{
+ int firstInt;
+ align(16) noreturn noRet;
+ long lastLong;
+}
+
+static assert(AlignedStruct.sizeof == 32);
+
+static assert(AlignedStruct.firstInt.offsetof == 0);
+static assert(AlignedStruct.noRet.offsetof == 16);
+static assert(AlignedStruct.lastLong.offsetof == 16);
+
+union BasicUnion
+{
+ int firstInt;
+ noreturn noRet;
+ long lastLong;
+}
+
+static assert(BasicUnion.sizeof == 8);
+
+static assert(BasicUnion.firstInt.offsetof == 0);
+static assert(BasicUnion.noRet.offsetof == 0);
+static assert(BasicUnion.lastLong.offsetof == 0);
+
+union AlignedUnion
+{
+ int firstInt;
+ align(16) noreturn noRet;
+ long lastLong;
+}
+
+static assert(AlignedUnion.sizeof == 16);
+
+static assert(AlignedUnion.firstInt.offsetof == 0);
+static assert(AlignedUnion.noRet.offsetof == 0);
+static assert(AlignedUnion.lastLong.offsetof == 0);
+
+class BasicClass
+{
+ int firstInt;
+ noreturn noRet;
+ long lastLong;
+}
+
+enum objectMemberSize = __traits(classInstanceSize, Object);
+
+static assert(__traits(classInstanceSize, BasicClass) == objectMemberSize + (int.sizeof + longPad + long.sizeof));
+
+static assert(BasicClass.firstInt.offsetof == objectMemberSize + 0);
+static assert(BasicClass.noRet.offsetof == objectMemberSize + 4);
+static assert(BasicClass.lastLong.offsetof == objectMemberSize + (4 + longPad));
+
+class AlignedClass
+{
+ int firstInt;
+ align(16) noreturn noRet;
+ long lastLong;
+}
+
+enum offset = (objectMemberSize + 4 + 16) & ~15;
+
+static assert(__traits(classInstanceSize, AlignedClass) == offset + 8);
+
+static assert(AlignedClass.firstInt.offsetof == objectMemberSize + 0);
+static assert(AlignedClass.noRet.offsetof == offset);
+static assert(AlignedClass.lastLong.offsetof == offset);
+
+struct EmptyStruct
+{
+ noreturn noRet;
+}
+
+static assert(EmptyStruct.sizeof == 1);
+static assert(EmptyStruct.noRet.offsetof == 0);
+
+struct EmptyStruct2
+{
+ noreturn[4] noRet;
+}
+
+static assert(EmptyStruct2.sizeof == 1);
+static assert(EmptyStruct2.noRet.offsetof == 0);
+
+// https://issues.dlang.org/show_bug.cgi?id=22858
+// Shouldn't mess with the alignment of other zero-sized types.
+
+struct S22858
+{
+ int a;
+ void*[0] arr;
+ char c;
+ noreturn[0] arr2;
+ char c2;
+}
+
+static assert (S22858.arr.offsetof % size_t.sizeof == 0);
+static assert (S22858.arr2.offsetof == S22858.c.offsetof + 1);
+static assert (S22858.arr2.offsetof == S22858.c2.offsetof);
+
+// https://issues.dlang.org/show_bug.cgi?id=23331
+
+auto fun() { return double(new noreturn[](0)[0]); }
+auto gun() { return double(assert(0)); }
+auto hun() { return int(assert(0)); }
+
+// https://issues.dlang.org/show_bug.cgi?id=23379
+
+void casting_noreturn() { auto b = cast(double)(assert(0)); }
diff --git a/gcc/testsuite/gdc.test/compilable/scope_tuple_expansion.d b/gcc/testsuite/gdc.test/compilable/scope_tuple_expansion.d
new file mode 100644
index 0000000..cac180c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/scope_tuple_expansion.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS: -preview=dip1000
+
+// Reduced from `std.systime`.
+// Tuple expansion can trip up scope checking with errors like:
+// Error: scope variable `__tup4` assigned to `found` with longer lifetime
+
+struct Tuple(T...)
+{
+ T t;
+ alias t this;
+}
+
+Tuple!(int*, int) find(return scope int* x) @safe
+{
+ assert(0);
+}
+
+void fromISOExtString(scope int* str) @safe
+{
+ int* found = str.find()[0];
+}
diff --git a/gcc/testsuite/gdc.test/compilable/shortened_methods.d b/gcc/testsuite/gdc.test/compilable/shortened_methods.d
index 5a7ac87..71350af 100644
--- a/gcc/testsuite/gdc.test/compilable/shortened_methods.d
+++ b/gcc/testsuite/gdc.test/compilable/shortened_methods.d
@@ -1,4 +1,4 @@
-// REQUIRED_ARGS: -preview=shortenedMethods
+// N.B. Shortened methods are no longer under a preview flag
class A {
int _x = 34;
// short syntax works in all contexts
diff --git a/gcc/testsuite/gdc.test/compilable/test11980.d b/gcc/testsuite/gdc.test/compilable/test11980.d
index 27974e4..29ec7a1 100644
--- a/gcc/testsuite/gdc.test/compilable/test11980.d
+++ b/gcc/testsuite/gdc.test/compilable/test11980.d
@@ -1,2 +1,5 @@
-void start() {}
+void start()
+{
+ pragma(startaddress, start);
+}
pragma(startaddress, start);
diff --git a/gcc/testsuite/gdc.test/compilable/test22674.d b/gcc/testsuite/gdc.test/compilable/test22674.d
index cc6e3bb..00750b0 100644
--- a/gcc/testsuite/gdc.test/compilable/test22674.d
+++ b/gcc/testsuite/gdc.test/compilable/test22674.d
@@ -8,3 +8,10 @@ void do_foo(){
FooRef f = make_foo(); // use_foo.d(5)
free_foo(f); // use_foo.d(6)
}
+
+// https://issues.dlang.org/show_bug.cgi?id=23357
+
+void do_foo2(){
+ FooRef2 f = make_foo2();
+ free_foo2(f);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test22784.d b/gcc/testsuite/gdc.test/compilable/test22784.d
new file mode 100644
index 0000000..1709be4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test22784.d
@@ -0,0 +1,10 @@
+// Issue 22784 - pragma(printf) applies to nested functions
+// https://issues.dlang.org/show_bug.cgi?id=22784
+
+import core.stdc.stdarg;
+extern(C)
+pragma(printf)
+void fn(const(char)* fmt, ...)
+{
+ void inner(){}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test22952.d b/gcc/testsuite/gdc.test/compilable/test22952.d
new file mode 100644
index 0000000..d0524b1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test22952.d
@@ -0,0 +1,10 @@
+/*
+REQUIRED_ARGS: -Icompilable/imports -mv=lib=pkg22952
+EXTRA_FILES: imports/pkg22952/package.d
+*/
+
+// Issue 22952 - Compiler fails to find package.d modules via -mv map
+// https://issues.dlang.org/show_bug.cgi?id=22952
+
+module test22952;
+import lib;
diff --git a/gcc/testsuite/gdc.test/compilable/test23380.d b/gcc/testsuite/gdc.test/compilable/test23380.d
new file mode 100644
index 0000000..bf82604
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23380.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -preview=dip1000
+
+// https://issues.dlang.org/show_bug.cgi?id=23380
+// Issue 23380 - [dip1000] class parameter should not be treated as ref qua lifetime
+
+@safe void test(scope Object o0, scope Object o1)
+{
+ o1 = o0;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test23386.d b/gcc/testsuite/gdc.test/compilable/test23386.d
new file mode 100644
index 0000000..dc1d754
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23386.d
@@ -0,0 +1,12 @@
+// https://issues.dlang.org/show_bug.cgi?id=23386
+// Segfault on enum member UDA inside template
+
+template E()
+{
+ enum E : byte
+ {
+ @(1) none,
+ }
+}
+
+alias T = E!();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag23384.d b/gcc/testsuite/gdc.test/fail_compilation/diag23384.d
new file mode 100644
index 0000000..1fa4da5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag23384.d
@@ -0,0 +1,29 @@
+// https://issues.dlang.org/show_bug.cgi?id=23384
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag23384.d(28): Error: function `diag23384.Derived.fun(B b)` is not callable using argument types `(A)`
+fail_compilation/diag23384.d(28): function `diag23384.Derived.fun` hides base class function `diag23384.Base.fun`
+fail_compilation/diag23384.d(28): add `alias fun = diag23384.Base.fun` to `diag23384.Derived`'s body to merge the overload sets
+---
+*/
+
+struct A {}
+struct B {}
+
+class Base
+{
+ void fun(A a) {}
+}
+
+class Derived : Base
+{
+ void fun(B b) {}
+}
+
+void main()
+{
+ Derived d;
+ d.fun(A());
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10905.d b/gcc/testsuite/gdc.test/fail_compilation/fail10905.d
deleted file mode 100644
index 52b5285..0000000
--- a/gcc/testsuite/gdc.test/fail_compilation/fail10905.d
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-REQUIRED_ARGS: -m64
-TEST_OUTPUT:
----
-fail_compilation/fail10905.d(20): Error: incompatible types for `(this.x) == (cast(const(__vector(long[2])))cast(__vector(long[2]))1L)`: both operands are of type `const(__vector(long[2]))`
----
-*/
-
-struct Foo
-{
- enum __vector(long[2]) y = 1;
-}
-
-struct Bar
-{
- __vector(long[2]) x;
-
- bool spam() const
- {
- return x == Foo.y;
- }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19898a.d b/gcc/testsuite/gdc.test/fail_compilation/fail19898a.d
index ccdbb57..e23ed04 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail19898a.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail19898a.d
@@ -2,7 +2,7 @@
REQUIRED_ARGS: -m64
TEST_OUTPUT:
---
-fail_compilation/fail19898a.d(10): Error: incompatible types for `(__key2) < (__limit3)`: both operands are of type `__vector(int[4])`
+fail_compilation/fail19898a.d(10): Error: expression `__key2 < __limit3` of type `__vector(int[4])` does not have a boolean value
---
*/
void f (__vector(int[4]) n)
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19898b.d b/gcc/testsuite/gdc.test/fail_compilation/fail19898b.d
index 254c2ca..5101da5 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail19898b.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail19898b.d
@@ -3,7 +3,7 @@ REQUIRED_ARGS: -m64
TEST_OUTPUT:
---
fail_compilation/fail19898b.d(17): Error: cannot implicitly convert expression `m` of type `S` to `__vector(int[4])`
-fail_compilation/fail19898b.d(17): Error: incompatible types for `(__key2) != (__limit3)`: both operands are of type `__vector(int[4])`
+fail_compilation/fail19898b.d(17): Error: expression `__key2 != __limit3` of type `__vector(int[4])` does not have a boolean value
fail_compilation/fail19898b.d(17): Error: cannot cast expression `__key2` of type `__vector(int[4])` to `S`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22366.d b/gcc/testsuite/gdc.test/fail_compilation/fail22366.d
index 3a2469f..6960d5e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail22366.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail22366.d
@@ -3,7 +3,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail22366.d(13): Error: scope variable `__aaval2` assigned to non-scope `aa[0]`
+fail_compilation/fail22366.d(13): Error: scope variable `x` may not be copied into allocated memory
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail23406.d b/gcc/testsuite/gdc.test/fail_compilation/fail23406.d
new file mode 100644
index 0000000..8ac3f14
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail23406.d
@@ -0,0 +1,40 @@
+// https://issues.dlang.org/show_bug.cgi?id=23406
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail23406.d(39): Error: cannot implicitly convert expression `0` of type `int` to `alphakey`
+---
+*/
+
+struct flagenum
+{
+ int i = 1;
+ alias i this;
+
+ auto opBinary(string s)(int j)
+ {
+ assert(j == 1);
+ return typeof(this)(i*2);
+ }
+
+ auto opEquals(int a)
+ {
+ return false;
+ }
+}
+
+enum alphakey
+{
+ a = flagenum(),
+ b,c,d,e,f,g,h,i,
+ k,l,m,n,o,p,q,r,
+ s,t,u,v,w,x,y,z
+}
+
+alphakey alpha;
+
+void main()
+{
+ alpha = 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/issue21378.d b/gcc/testsuite/gdc.test/fail_compilation/issue21378.d
index 22c60a3..172110a 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/issue21378.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/issue21378.d
@@ -3,7 +3,7 @@ TEST_OUTPUT:
---
fail_compilation/issue21378.d(13): Error: function `issue21378.fn` circular dependency. Functions cannot be interpreted while being compiled
fail_compilation/issue21378.d(12): called from here: `fn()`
-fail_compilation/issue21378.d(12): Error: pragma `inline` pragma(`inline`, `true` or `false`) expected, not `fn()`
+fail_compilation/issue21378.d(12): Error: pragma(`inline`, `true` or `false`) expected, not `fn()`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/lexer1.d b/gcc/testsuite/gdc.test/fail_compilation/lexer1.d
index e6cabf2..0ad3f01 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/lexer1.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/lexer1.d
@@ -23,9 +23,9 @@ fail_compilation/lexer1.d(49): Error: unterminated named entity &*;
fail_compilation/lexer1.d(50): Error: unterminated named entity &s1";
fail_compilation/lexer1.d(51): Error: unterminated named entity &2;
fail_compilation/lexer1.d(52): Error: escape octal sequence \400 is larger than \377
+fail_compilation/lexer1.d(53): Error: html entity requires 2 code units, use a string instead of a character
---
*/
-
// https://dlang.dawg.eu/coverage/src/lexer.c.gcov.html
x"01 02 03"w;
0x80000001;
@@ -50,3 +50,4 @@ static s5 = "\&*";
static s6 = "\&s1";
static s7 = "\&2;";
static s7 = "\400;";
+dchar s8 = '\&acE;';
diff --git a/gcc/testsuite/gdc.test/fail_compilation/pragmainline.d b/gcc/testsuite/gdc.test/fail_compilation/pragmainline.d
index 5d43277..23f3bfe 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/pragmainline.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/pragmainline.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
-fail_compilation/pragmainline.d(8): Error: pragma `inline` one boolean expression expected for `pragma(inline)`, not 3
+fail_compilation/pragmainline.d(8): Error: one boolean expression expected for `pragma(inline)`, not 3
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/pragmas.d b/gcc/testsuite/gdc.test/fail_compilation/pragmas.d
index cd56ff4..5a4b5d9 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/pragmas.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/pragmas.d
@@ -3,8 +3,8 @@
/*
TEST_OUTPUT:
---
-fail_compilation/pragmas.d(103): Error: boolean expression expected for `pragma(inline)`
-fail_compilation/pragmas.d(108): Error: boolean expression expected for `pragma(inline)`
+fail_compilation/pragmas.d(103): Error: one boolean expression expected for `pragma(inline)`, not 2
+fail_compilation/pragmas.d(108): Error: one boolean expression expected for `pragma(inline)`, not 2
fail_compilation/pragmas.d(118): Error: unrecognized `pragma(unrecognized)`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/previewin.d b/gcc/testsuite/gdc.test/fail_compilation/previewin.d
index ce0cf92..ca54093 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/previewin.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/previewin.d
@@ -8,10 +8,10 @@ fail_compilation/previewin.d(5): Error: function `previewin.takeFunction(void fu
fail_compilation/previewin.d(5): cannot pass argument `__lambda2` of type `void function(const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
fail_compilation/previewin.d(6): Error: function `previewin.takeFunction(void function(in real) f)` is not callable using argument types `(void function(ref const(real) x) pure nothrow @nogc @safe)`
fail_compilation/previewin.d(6): cannot pass argument `__lambda3` of type `void function(ref const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
-fail_compilation/previewin.d(15): Error: scope variable `arg` assigned to non-scope `myGlobal`
-fail_compilation/previewin.d(16): Error: scope variable `arg` assigned to non-scope `myGlobal`
+fail_compilation/previewin.d(15): Error: scope variable `arg` assigned to global variable `myGlobal`
+fail_compilation/previewin.d(16): Error: scope variable `arg` assigned to global variable `myGlobal`
fail_compilation/previewin.d(17): Error: scope parameter `arg` may not be returned
-fail_compilation/previewin.d(18): Error: scope variable `arg` assigned to `escape` with longer lifetime
+fail_compilation/previewin.d(18): Error: scope variable `arg` assigned to `ref` variable `escape` with longer lifetime
fail_compilation/previewin.d(22): Error: returning `arg` escapes a reference to parameter `arg`
fail_compilation/previewin.d(22): perhaps annotate the parameter with `return`
---
diff --git a/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d b/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d
index 6e7e909..29f96ec 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d
@@ -117,6 +117,7 @@ fail_compilation/reserved_version.d(218): Error: version identifier `D_PreCondit
fail_compilation/reserved_version.d(219): Error: version identifier `D_PostConditions` is reserved and cannot be set
fail_compilation/reserved_version.d(220): Error: version identifier `D_ProfileGC` is reserved and cannot be set
fail_compilation/reserved_version.d(221): Error: version identifier `D_Invariants` is reserved and cannot be set
+fail_compilation/reserved_version.d(222): Error: version identifier `D_Optimized` is reserved and cannot be set
---
*/
@@ -240,6 +241,7 @@ version = D_PreConditions;
version = D_PostConditions;
version = D_ProfileGC;
version = D_Invariants;
+version = D_Optimized;
// This should work though
debug = DigitalMars;
@@ -351,3 +353,4 @@ debug = AVR;
debug = D_PreConditions;
debug = D_PostConditions;
debug = D_ProfileGC;
+debug = D_Optimized;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d b/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d
index cd85b41..f5f6b1c 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d
@@ -107,6 +107,7 @@
// REQUIRED_ARGS: -version=D_PostConditions
// REQUIRED_ARGS: -version=D_ProfileGC
// REQUIRED_ARGS: -version=D_Invariants
+// REQUIRED_ARGS: -version=D_Optimized
// REQUIRED_ARGS: -debug=DigitalMars
// REQUIRED_ARGS: -debug=GNU
// REQUIRED_ARGS: -debug=LDC
@@ -211,6 +212,7 @@
// REQUIRED_ARGS: -debug=D_PostConditions
// REQUIRED_ARGS: -debug=D_ProfileGC
// REQUIRED_ARGS: -debug=D_Invariants
+// REQUIRED_ARGS: -debug=D_Optimized
/*
TEST_OUTPUT:
---
@@ -321,5 +323,6 @@ Error: version identifier `D_PreConditions` is reserved and cannot be set
Error: version identifier `D_PostConditions` is reserved and cannot be set
Error: version identifier `D_ProfileGC` is reserved and cannot be set
Error: version identifier `D_Invariants` is reserved and cannot be set
+Error: version identifier `D_Optimized` is reserved and cannot be set
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope.d b/gcc/testsuite/gdc.test/fail_compilation/retscope.d
index 2a69fe0..ece6a8c 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/retscope.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/retscope.d
@@ -4,9 +4,9 @@ TEST_OUTPUT:
---
fail_compilation/retscope.d(22): Error: scope parameter `p` may not be returned
fail_compilation/retscope.d(32): Error: returning `b ? nested1(& i) : nested2(& j)` escapes a reference to local variable `j`
-fail_compilation/retscope.d(45): Error: scope variable `p` assigned to non-scope `q`
+fail_compilation/retscope.d(45): Error: scope variable `p` assigned to global variable `q`
fail_compilation/retscope.d(47): Error: address of variable `i` assigned to `q` with longer lifetime
-fail_compilation/retscope.d(48): Error: scope variable `a` assigned to non-scope `b`
+fail_compilation/retscope.d(48): Error: scope variable `a` assigned to global variable `b`
fail_compilation/retscope.d(49): Error: address of struct temporary returned by `(*fp2)()` assigned to longer lived variable `q`
---
*/
@@ -662,7 +662,7 @@ int test21()
/*********************************************
TEST_OUTPUT:
---
-fail_compilation/retscope.d(1907): Error: scope variable `x` assigned to `this` with longer lifetime
+fail_compilation/retscope.d(1907): Error: scope variable `x` assigned to `ref` variable `this` with longer lifetime
fail_compilation/retscope.d(1913): Error: scope variable `x` may not be returned
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope2.d b/gcc/testsuite/gdc.test/fail_compilation/retscope2.d
index 9f1e13d..1cb76d6 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/retscope2.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/retscope2.d
@@ -2,7 +2,7 @@
REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
-fail_compilation/retscope2.d(102): Error: scope variable `s` assigned to `p` with longer lifetime
+fail_compilation/retscope2.d(102): Error: scope variable `s` assigned to `ref` variable `p` with longer lifetime
fail_compilation/retscope2.d(107): Error: address of variable `s` assigned to `p` with longer lifetime
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d
index 95d5dbe..9736d37 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d
@@ -25,7 +25,7 @@ int* test() @safe
---
fail_compilation/retscope6.d(7034): Error: address of variable `i` assigned to `s` with longer lifetime
fail_compilation/retscope6.d(7035): Error: address of variable `i` assigned to `s` with longer lifetime
-fail_compilation/retscope6.d(7025): Error: scope variable `_param_2` assigned to `t` with longer lifetime
+fail_compilation/retscope6.d(7025): Error: scope variable `_param_2` assigned to `ref` variable `t` with longer lifetime
fail_compilation/retscope6.d(7037): Error: template instance `retscope6.S.emplace4!(int*)` error instantiating
fail_compilation/retscope6.d(7037): Error: address of variable `i` assigned to `s` with longer lifetime
---
diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables.d
new file mode 100644
index 0000000..0079719
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables.d
@@ -0,0 +1,48 @@
+/*
+REQUIRED_ARGS: -preview=systemVariables
+TEST_OUTPUT:
+---
+fail_compilation/systemvariables.d(30): Error: cannot access `@system` variable `gInt` in @safe code
+fail_compilation/systemvariables.d(31): Error: cannot access `@system` variable `gInt` in @safe code
+fail_compilation/systemvariables.d(32): Error: cannot access `@system` variable `gArr` in @safe code
+fail_compilation/systemvariables.d(33): Error: cannot access `@system` variable `gArr` in @safe code
+fail_compilation/systemvariables.d(34): Error: cannot access `@system` variable `gInt` in @safe code
+fail_compilation/systemvariables.d(37): Error: cannot access `@system` variable `lSys` in @safe code
+fail_compilation/systemvariables.d(38): Error: cannot access `@system` variable `lSys` in @safe code
+fail_compilation/systemvariables.d(39): Error: cannot access `@system` variable `lSys` in @safe code
+fail_compilation/systemvariables.d(41): Error: cannot access `@system` variable `eInt` in @safe code
+---
+*/
+
+// http://dlang.org/dips/1035
+
+
+@system int gInt;
+@system enum int eInt = 3;
+@system { int[] gArr; }
+alias aliasToSys = gInt;
+
+void increment(ref int x) @safe { x++; }
+void incrementP(int* x) @safe { (*x)++; }
+
+void basic() @safe
+{
+ gInt = 0; // error
+ gInt++; // error
+ gArr ~= 30; // error
+ const c = gArr[0]; // error
+ aliasToSys++; // error
+
+ @system int lSys = 0;
+ lSys = 0; // error
+ increment(lSys); // error
+ incrementP(&lSys); // error
+
+ int a = eInt; // error
+ int b = typeof(eInt).max; // allowed
+
+ void f() @trusted
+ {
+ lSys = 0; // allowed
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d
new file mode 100644
index 0000000..75dbe2d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d
@@ -0,0 +1,28 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/systemvariables_deprecation.d(16): Deprecation: `@safe` function `main` calling `middle`
+fail_compilation/systemvariables_deprecation.d(21): which calls `systemvariables_deprecation.inferred`
+fail_compilation/systemvariables_deprecation.d(27): which would be `@system` because of:
+fail_compilation/systemvariables_deprecation.d(27): cannot access `@system` variable `x0` in @safe code
+---
+*/
+
+// test deprecation messages before -preview=systemVariables becomes default
+
+void main() @safe
+{
+ middle(); // nested deprecation
+}
+
+auto middle()
+{
+ return inferred(); // no deprecation, inferredC is not explicit `@safe`
+}
+
+auto inferred()
+{
+ @system int* x0;
+ x0 = null;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d
new file mode 100644
index 0000000..7d8bfab
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d
@@ -0,0 +1,60 @@
+/*
+REQUIRED_ARGS: -preview=systemVariables
+TEST_OUTPUT:
+---
+fail_compilation/systemvariables_struct.d(31): Error: cannot access `@system` field `S.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(32): Error: cannot access `@system` field `S.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(33): Error: cannot access `@system` field `S.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(36): Error: cannot access `@system` field `S.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(37): Error: cannot access `@system` field `S.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(38): Error: cannot access `@system` field `S.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(54): Error: cannot access `@system` field `S2.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(55): Error: cannot access `@system` field `S2.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(56): Error: cannot access `@system` field `S.syst` in `@safe` code
+fail_compilation/systemvariables_struct.d(57): Error: cannot access `@system` field `S.syst` in `@safe` code
+---
+*/
+
+// http://dlang.org/dips/1035
+
+struct S
+{
+ @system S* syst;
+ @safe S* safe;
+}
+
+void aggregate() @safe
+{
+ S s0;
+
+ // write access
+ s0.syst = null;
+ __traits(getMember, s0, "syst") = null;
+ s0.tupleof[0] = null;
+
+ // read access
+ auto a0 = s0.syst;
+ auto a1 = __traits(getMember, s0, "syst");
+ auto a2 = s0.tupleof[0];
+
+ S s1;
+ s1 = s0; // allowed
+}
+
+struct S2
+{
+ @system S syst;
+ @safe S safe;
+}
+
+@safe S2 gs2;
+
+void aggregate2() @safe
+{
+ gs2.syst.syst = null;
+ gs2.syst.safe = null;
+ gs2.safe.syst = null;
+ gs2.safe.syst.safe = null;
+
+ gs2.safe.safe = null; // allowed
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d
new file mode 100644
index 0000000..6f44093
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d
@@ -0,0 +1,32 @@
+/**
+REQUIRED_ARGS: -preview=systemVariables
+TEST_OUTPUT:
+---
+fail_compilation/systemvariables_void_init.d(29): Error: `void` initializers for `@system` variables not allowed in safe functions
+fail_compilation/systemvariables_void_init.d(30): Error: `void` initializers for `@system` variables not allowed in safe functions
+fail_compilation/systemvariables_void_init.d(31): Error: `void` initializers for `@system` variables not allowed in safe functions
+---
+*/
+
+struct S
+{
+ int x;
+ @system int y;
+}
+
+struct C
+{
+ S[2] x;
+}
+
+enum E : C
+{
+ x = C.init,
+}
+
+void main() @safe
+{
+ S s = void;
+ C c = void;
+ E e = void;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/templatethis.d b/gcc/testsuite/gdc.test/fail_compilation/templatethis.d
new file mode 100644
index 0000000..73036d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/templatethis.d
@@ -0,0 +1,37 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/templatethis.d(13): Error: cannot use `this` outside an aggregate type
+fail_compilation/templatethis.d(17): Error: cannot use `this` outside an aggregate type
+fail_compilation/templatethis.d(21): Error: cannot use `this` outside an aggregate type
+fail_compilation/templatethis.d(23): Error: cannot use `this` outside an aggregate type
+fail_compilation/templatethis.d(29): Error: cannot use `this` outside an aggregate type
+fail_compilation/templatethis.d(32): Error: mixin `templatethis.t2!()` error instantiating
+---
+*/
+
+template t(this T)
+{
+}
+
+struct S(this T)
+{
+}
+
+enum e(this T) = 1;
+
+void f(this T)()
+{
+}
+
+mixin template t2()
+{
+ int i(this T) = 1;
+}
+
+mixin t2;
+
+class C
+{
+ mixin t2; // OK
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test14496.d b/gcc/testsuite/gdc.test/fail_compilation/test14496.d
index 9f628ca..94d5d0f 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test14496.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test14496.d
@@ -6,10 +6,10 @@ fail_compilation/test14496.d(24): Error: `void` initializers for pointers not al
fail_compilation/test14496.d(28): Error: `void` initializers for pointers not allowed in safe functions
fail_compilation/test14496.d(48): Error: `void` initializers for pointers not allowed in safe functions
fail_compilation/test14496.d(49): Error: `void` initializers for pointers not allowed in safe functions
+fail_compilation/test14496.d(50): Error: `void` initializers for pointers not allowed in safe functions
---
*/
// https://issues.dlang.org/show_bug.cgi?id=14496
-
@safe void foo()
{
struct Foo {
@@ -47,4 +47,5 @@ struct Baz {
@safe void sinister() {
Bar bar;
Baz baz;
+ Bar[2] bars; // https://issues.dlang.org/show_bug.cgi?id=23412
}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17764.d b/gcc/testsuite/gdc.test/fail_compilation/test17764.d
index 6ee988a..befcdb1 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test17764.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test17764.d
@@ -1,7 +1,7 @@
/* REQUIRED_ARGS: -preview=dip1000
* TEST_OUTPUT:
---
-fail_compilation/test17764.d(109): Error: scope variable `c` assigned to non-scope `global`
+fail_compilation/test17764.d(109): Error: scope variable `c` assigned to global variable `global`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test19097.d b/gcc/testsuite/gdc.test/fail_compilation/test19097.d
index 9c025a8..980931e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test19097.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test19097.d
@@ -3,7 +3,7 @@
---
fail_compilation/test19097.d(44): Error: scope variable `s` may not be returned
fail_compilation/test19097.d(48): Error: scope variable `s1` may not be returned
-fail_compilation/test19097.d(77): Error: scope variable `z` assigned to `refPtr` with longer lifetime
+fail_compilation/test19097.d(77): Error: scope variable `z` assigned to `ref` variable `refPtr` with longer lifetime
fail_compilation/test19097.d(108): Error: scope variable `s4` may not be returned
fail_compilation/test19097.d(126): Error: scope variable `s5c` may not be returned
fail_compilation/test19097.d(130): Error: scope variable `s5m` may not be returned
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22145.d b/gcc/testsuite/gdc.test/fail_compilation/test22145.d
index 394116d..55e7c63 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test22145.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test22145.d
@@ -1,7 +1,7 @@
/* TEST_OUTPUT:
REQUIRED_ARGS: -preview=dip1000
---
-fail_compilation/test22145.d(115): Error: scope variable `x` assigned to non-scope `global`
+fail_compilation/test22145.d(115): Error: scope variable `x` assigned to global variable `global`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22680.d b/gcc/testsuite/gdc.test/fail_compilation/test22680.d
index caf0f4a..85e653e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test22680.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test22680.d
@@ -1,7 +1,7 @@
/* REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
-fail_compilation/test22680.d(104): Error: scope variable `this` assigned to non-scope `c`
+fail_compilation/test22680.d(104): Error: scope variable `this` assigned to global variable `c`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/warn14905.d b/gcc/testsuite/gdc.test/fail_compilation/warn14905.d
new file mode 100644
index 0000000..55520ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/warn14905.d
@@ -0,0 +1,23 @@
+// REQUIRED_ARGS: -o- -w
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/warn14905.d(16): Warning: statement is not reachable in template instance warn14905.fun!"a".fun
+fail_compilation/warn14905.d(16): Warning: statement is not reachable in template instance warn14905.fun!"b".fun
+Error: warnings are treated as errors
+ Use -wi if you wish to treat warnings only as informational.
+---
+*/
+
+bool fun(string s)()
+{
+ return true;
+ return false;
+}
+
+void main()
+{
+ cast(void)fun!"a";
+ cast(void)fun!"b";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/xmmslice.d b/gcc/testsuite/gdc.test/fail_compilation/xmmslice.d
new file mode 100644
index 0000000..6cf0e23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/xmmslice.d
@@ -0,0 +1,22 @@
+
+/* REQUIRED_ARGS: -mcpu=avx
+DISABLED: win32 freebsd32 linux32 osx32
+TEST_OUTPUT:
+---
+fail_compilation/xmmslice.d(110): Error: `__vector(int[4])` cannot be sliced with `[]`
+---
+ */
+
+#line 100
+
+import core.simd;
+
+int4 testz4()
+{
+ return [0,0,0,0];
+}
+
+void test()
+{
+ assert(testz4()[] == [0,0,0,0]);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/cdcmp.d b/gcc/testsuite/gdc.test/runnable/cdcmp.d
new file mode 100644
index 0000000..1c998dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/cdcmp.d
@@ -0,0 +1,146 @@
+
+
+bool test_ltz(float x) { return x < 0; }
+bool test_lez(float x) { return x <= 0; }
+bool test_eqz(float x) { return x == 0; }
+bool test_nez(float x) { return x != 0; }
+bool test_gez(float x) { return x >= 0; }
+bool test_gtz(float x) { return x > 0; }
+
+void test1f()
+{
+ assert(!test_ltz(0.0f));
+ assert(!test_ltz(1.0f));
+ assert( test_ltz(-1.0f));
+
+ assert( test_lez(0.0f));
+ assert(!test_lez(1.0f));
+ assert( test_lez(-1.0f));
+
+ assert( test_eqz(0.0f));
+ assert(!test_eqz(1.0f));
+ assert(!test_eqz(-1.0f));
+
+ assert(!test_nez(0.0f));
+ assert( test_nez(1.0f));
+ assert( test_nez(-1.0f));
+
+ assert( test_gez(0.0f));
+ assert( test_gez(1.0f));
+ assert(!test_gez(-1.0f));
+
+ assert(!test_gtz(0.0f));
+ assert( test_gtz(1.0f));
+ assert(!test_gtz(-1.0f));
+}
+
+bool test_ltz(double x) { return x < 0; }
+bool test_lez(double x) { return x <= 0; }
+bool test_eqz(double x) { return x == 0; }
+bool test_nez(double x) { return x != 0; }
+bool test_gez(double x) { return x >= 0; }
+bool test_gtz(double x) { return x > 0; }
+
+void test1d()
+{
+ assert(!test_ltz(0.0));
+ assert(!test_ltz(1.0));
+ assert( test_ltz(-1.0));
+
+ assert( test_lez(0.0));
+ assert(!test_lez(1.0));
+ assert( test_lez(-1.0));
+
+ assert( test_eqz(0.0));
+ assert(!test_eqz(1.0));
+ assert(!test_eqz(-1.0));
+
+ assert(!test_nez(0.0));
+ assert( test_nez(1.0));
+ assert( test_nez(-1.0));
+
+ assert( test_gez(0.0));
+ assert( test_gez(1.0));
+ assert(!test_gez(-1.0));
+
+ assert(!test_gtz(0.0));
+ assert( test_gtz(1.0));
+ assert(!test_gtz(-1.0));
+}
+
+bool test_lt(float x, float y) { return x < y; }
+bool test_le(float x, float y) { return x <= y; }
+bool test_eq(float x, float y) { return x == y; }
+bool test_ne(float x, float y) { return x != y; }
+bool test_ge(float x, float y) { return x >= y; }
+bool test_gt(float x, float y) { return x > y; }
+
+void test2f()
+{
+ assert(!test_lt(1.0f, 1.0f));
+ assert( test_lt(1.0f, 2.0f));
+ assert(!test_lt(2.0f, 1.0f));
+
+ assert( test_le(1.0f, 1.0f));
+ assert( test_le(1.0f, 2.0f));
+ assert(! test_le(2.0f, 1.0f));
+
+ assert( test_eq(1.0f, 1.0f));
+ assert(!test_eq(1.0f, 2.0f));
+ assert(!test_eq(2.0f, 1.0f));
+
+ assert(!test_ne(1.0f, 1.0f));
+ assert( test_ne(1.0f, 2.0f));
+ assert( test_ne(2.0f, 1.0f));
+
+ assert( test_ge(1.0f, 1.0f));
+ assert(!test_ge(1.0f, 2.0f));
+ assert( test_ge(2.0f, 1.0f));
+
+ assert(!test_gt(1.0f, 1.0f));
+ assert(!test_gt(1.0f, 2.0f));
+ assert( test_gt(2.0f, 1.0f));
+}
+
+bool test_lt(double x, double y) { return x < y; }
+bool test_le(double x, double y) { return x <= y; }
+bool test_eq(double x, double y) { return x == y; }
+bool test_ne(double x, double y) { return x != y; }
+bool test_ge(double x, double y) { return x >= y; }
+bool test_gt(double x, double y) { return x > y; }
+
+void test2d()
+{
+ assert(!test_lt(1.0, 1.0));
+ assert( test_lt(1.0, 2.0));
+ assert(!test_lt(2.0, 1.0));
+
+ assert( test_le(1.0, 1.0));
+ assert( test_le(1.0, 2.0));
+ assert(! test_le(2.0, 1.0));
+
+ assert( test_eq(1.0, 1.0));
+ assert(!test_eq(1.0, 2.0));
+ assert(!test_eq(2.0, 1.0));
+
+ assert(!test_ne(1.0, 1.0));
+ assert( test_ne(1.0, 2.0));
+ assert( test_ne(2.0, 1.0));
+
+ assert( test_ge(1.0, 1.0));
+ assert(!test_ge(1.0, 2.0));
+ assert( test_ge(2.0, 1.0));
+
+ assert(!test_gt(1.0, 1.0));
+ assert(!test_gt(1.0, 2.0));
+ assert( test_gt(2.0, 1.0));
+}
+
+int main()
+{
+ test1f();
+ test1d();
+ test2f();
+ test2d();
+ return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/lexer.d b/gcc/testsuite/gdc.test/runnable/lexer.d
index 6e31c07..8975146 100644
--- a/gcc/testsuite/gdc.test/runnable/lexer.d
+++ b/gcc/testsuite/gdc.test/runnable/lexer.d
@@ -87,6 +87,10 @@ enum e13102=184467440737095516153.6L;
/*********************************************************/
+static assert("\&acE;" == "\U0000223E\U00000333"); // ="\xe2\x88\xbe\xcc\xb3"
+
+/*********************************************************/
+
int main()
{
test6();
diff --git a/gcc/testsuite/gdc.test/runnable/test20734.d b/gcc/testsuite/gdc.test/runnable/test20734.d
index b3c5916..bd012bb 100644
--- a/gcc/testsuite/gdc.test/runnable/test20734.d
+++ b/gcc/testsuite/gdc.test/runnable/test20734.d
@@ -17,6 +17,14 @@ extern(C) int main() nothrow @nogc @safe
takeScopeSlice([ S(1), S(2) ]); // @nogc => no GC allocation
(() @trusted { assert(numDtor == 2); })(); // stack-allocated array literal properly destructed
assert23100([]);
+
+ // https://issues.dlang.org/show_bug.cgi?id=22306
+ // scope array variable should be stack allocated
+ scope int[] sa = [10, 20];
+ assert(sa[0] == 10);
+ assert(sa[1] == 20);
+ assert(sa.length == 2);
+
return 0;
}
diff --git a/gcc/testsuite/gdc.test/runnable/test23337.d b/gcc/testsuite/gdc.test/runnable/test23337.d
new file mode 100644
index 0000000..47deaba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test23337.d
@@ -0,0 +1,182 @@
+// https://issues.dlang.org/show_bug.cgi?id=23337
+
+int copies, destroyed;
+
+void reset() { copies = destroyed = 0; }
+
+struct S
+{
+ this(inout ref S) inout { ++copies; }
+ ~this() { ++destroyed; }
+}
+
+S[3] globals;
+
+S[3] makeStaticArray() { return (S[3]).init; }
+
+S[] makeSlice(ref S[3] sa) { return sa[]; }
+
+void main()
+{
+ {
+ S[3] fromLvalStaticArray = globals;
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ S[3] fromRvalStaticArray = makeStaticArray();
+ assert(copies == 0); // moved or emplaced
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ S[3] fromArrayLiteral = [S(), S(), S()];
+ assert(copies == 0); // moved or emplaced
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ S[3] fromSliceExp = globals[];
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ S[] slice = globals[];
+ S[3] fromLvalSlice = slice;
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ S[3] fromRvalSlice = makeSlice(globals);
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ S *p = &globals[0];
+ S[3] fromSingleLval = *p;
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ S[3] fromSingleRval = S();
+ assert(destroyed == 1); // temporary
+ assert(copies == 3);
+ }
+ assert(destroyed == 4);
+ reset();
+
+ // slice-exp left-hand-sides (*construction* only in ctors):
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int) { ss[] = globals; }
+ }
+ T fromLvalStaticArray = T(0);
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int) { ss[] = makeStaticArray(); }
+ }
+ T fromRvalStaticArray = T(0);
+ assert(copies == 0); // moved or emplaced
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int) { ss[] = [S(), S(), S()]; }
+ }
+ T fromArrayLiteral = T(0);
+ assert(copies == 0); // moved or emplaced
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int) { ss[] = globals[]; }
+ }
+ T fromSliceExp = T(0);
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int)
+ {
+ S[] slice = globals[];
+ ss[] = slice;
+ }
+ }
+ T fromLvalSlice = T(0);
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int) { ss[] = makeSlice(globals); }
+ }
+ T fromRvalSlice = T(0);
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int) { ss[] = globals[0]; }
+ }
+ T fromSingleLval = T(0);
+ assert(copies == 3);
+ }
+ assert(destroyed == 3);
+ reset();
+
+ {
+ static struct T
+ {
+ S[3] ss;
+ this(int) { ss[] = S(); }
+ }
+ T fromSingleRval = T(0);
+ assert(destroyed == 1); // temporary
+ assert(copies == 3);
+ }
+ assert(destroyed == 4);
+ reset();
+}
diff --git a/gcc/testsuite/gfortran.dg/illegal_boz_arg_4.f90 b/gcc/testsuite/gfortran.dg/illegal_boz_arg_4.f90
new file mode 100644
index 0000000..856cfa9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/illegal_boz_arg_4.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-std=f2018" }
+! PR fortran/103413
+! Contributed by G.Steinmetz
+
+program p
+ type t
+ class(*), allocatable :: a
+ end type
+ type(t) :: x
+ allocate (x%a, source=z'1') ! { dg-error "type incompatible" }
+ allocate (x%a, mold=z'1') ! { dg-error "type incompatible" }
+end
diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index ac7712a..fe88d2f 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -289,7 +289,7 @@ proc auto-profopt-execute { src } {
return
}
set profile_wrapper [profopt-perf-wrapper]
- set profile_option "-gdwarf-4 -DFOR_AUTOFDO_TESTING"
+ set profile_option "-g -DFOR_AUTOFDO_TESTING"
set feedback_option "-fauto-profile -DFOR_AUTOFDO_TESTING -fearly-inlining"
set run_autofdo 1
profopt-execute $src
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ccbbee8..750897d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9549,6 +9549,18 @@ proc check_effective_target_avxvnniint8 { } {
} "-O0 -mavxvnniint8" ]
}
+# Return 1 if avxneconvert instructions can be compiled.
+proc check_effective_target_avxneconvert { } {
+ return [check_no_compiler_messages avxneconvert object {
+ typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+ __m128
+ _mm_bcstnebf16_ps (const void *__P)
+ {
+ return (__m128) __builtin_ia32_vbcstnebf162ps128 ((const __bf16 *) __P);
+ }
+ } "-O0 -mavxneconvert" ]
+}
+
# Return 1 if sse instructions can be compiled.
proc check_effective_target_sse { } {
return [check_no_compiler_messages sse object {
diff --git a/gcc/tree-call-cdce.cc b/gcc/tree-call-cdce.cc
index feb61f3..b4b14a0 100644
--- a/gcc/tree-call-cdce.cc
+++ b/gcc/tree-call-cdce.cc
@@ -295,22 +295,35 @@ can_test_argument_range (gcall *call)
{
/* Trig functions. */
CASE_FLT_FN (BUILT_IN_ACOS):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOS):
CASE_FLT_FN (BUILT_IN_ASIN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASIN):
/* Hyperbolic functions. */
CASE_FLT_FN (BUILT_IN_ACOSH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOSH):
CASE_FLT_FN (BUILT_IN_ATANH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATANH):
CASE_FLT_FN (BUILT_IN_COSH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_COSH):
CASE_FLT_FN (BUILT_IN_SINH):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_SINH):
/* Log functions. */
CASE_FLT_FN (BUILT_IN_LOG):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG):
CASE_FLT_FN (BUILT_IN_LOG2):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG2):
CASE_FLT_FN (BUILT_IN_LOG10):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG10):
CASE_FLT_FN (BUILT_IN_LOG1P):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG1P):
/* Exp functions. */
CASE_FLT_FN (BUILT_IN_EXP):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP):
CASE_FLT_FN (BUILT_IN_EXP2):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP2):
CASE_FLT_FN (BUILT_IN_EXP10):
CASE_FLT_FN (BUILT_IN_EXPM1):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXPM1):
CASE_FLT_FN (BUILT_IN_POW10):
/* Sqrt. */
CASE_FLT_FN (BUILT_IN_SQRT):
@@ -337,15 +350,22 @@ edom_only_function (gcall *call)
switch (DECL_FUNCTION_CODE (gimple_call_fndecl (call)))
{
CASE_FLT_FN (BUILT_IN_ACOS):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOS):
CASE_FLT_FN (BUILT_IN_ASIN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASIN):
CASE_FLT_FN (BUILT_IN_ATAN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATAN):
CASE_FLT_FN (BUILT_IN_COS):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_COS):
CASE_FLT_FN (BUILT_IN_SIGNIFICAND):
CASE_FLT_FN (BUILT_IN_SIN):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_SIN):
CASE_FLT_FN (BUILT_IN_SQRT):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_SQRT):
CASE_FLT_FN (BUILT_IN_FMOD):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_FMOD):
CASE_FLT_FN (BUILT_IN_REMAINDER):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_REMAINDER):
return true;
default:
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 80b886c..af75522 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -1717,7 +1717,8 @@ struct GTY(()) tree_type_common {
unsigned typeless_storage : 1;
unsigned empty_flag : 1;
unsigned indivisible_p : 1;
- unsigned spare : 16;
+ unsigned no_named_args_stdarg_p : 1;
+ unsigned spare : 15;
alias_set_type alias_set;
tree pointer_to;
diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc
index c14e5e4..82976bd 100644
--- a/gcc/tree-ssa-dse.cc
+++ b/gcc/tree-ssa-dse.cc
@@ -978,14 +978,6 @@ dse_classify_store (ao_ref *ref, gimple *stmt,
if (gimple_code (temp) == GIMPLE_PHI)
{
- /* If we visit this PHI by following a backedge then we have to
- make sure ref->ref only refers to SSA names that are invariant
- with respect to the loop represented by this PHI node. */
- if (dominated_by_p (CDI_DOMINATORS, gimple_bb (stmt),
- gimple_bb (temp))
- && !for_each_index (ref->ref ? &ref->ref : &ref->base,
- check_name, gimple_bb (temp)))
- return DSE_STORE_LIVE;
defvar = PHI_RESULT (temp);
bitmap_set_bit (visited, SSA_NAME_VERSION (defvar));
}
@@ -1019,6 +1011,15 @@ dse_classify_store (ao_ref *ref, gimple *stmt,
if (!bitmap_bit_p (visited,
SSA_NAME_VERSION (PHI_RESULT (use_stmt))))
{
+ /* If we visit this PHI by following a backedge then we have
+ to make sure ref->ref only refers to SSA names that are
+ invariant with respect to the loop represented by this
+ PHI node. */
+ if (dominated_by_p (CDI_DOMINATORS, gimple_bb (stmt),
+ gimple_bb (use_stmt))
+ && !for_each_index (ref->ref ? &ref->ref : &ref->base,
+ check_name, gimple_bb (use_stmt)))
+ return DSE_STORE_LIVE;
defs.safe_push (use_stmt);
if (!first_phi_def)
first_phi_def = as_a <gphi *> (use_stmt);
diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 2ea8150..2119d40 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -835,10 +835,15 @@ determine_max_movement (gimple *stmt, bool must_preserve_exec)
return true;
}
- else
- FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_USE)
- if (!add_dependency (val, lim_data, loop, true))
- return false;
+
+ /* A stmt that receives abnormal edges cannot be hoisted. */
+ if (is_a <gcall *> (stmt)
+ && (gimple_call_flags (stmt) & ECF_RETURNS_TWICE))
+ return false;
+
+ FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_USE)
+ if (!add_dependency (val, lim_data, loop, true))
+ return false;
if (gimple_vuse (stmt))
{
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 925bd7d..996700b 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-match.h"
#include "dbgcnt.h"
#include "tree-ssa-propagate.h"
+#include "tree-ssa-dce.h"
static unsigned int tree_ssa_phiopt_worker (bool, bool, bool);
static bool two_value_replacement (basic_block, basic_block, edge, gphi *,
@@ -74,7 +75,6 @@ static bool cond_store_replacement (basic_block, basic_block, edge, edge,
hash_set<tree> *);
static bool cond_if_else_store_replacement (basic_block, basic_block, basic_block);
static hash_set<tree> * get_non_trapping ();
-static void replace_phi_edge_with_variable (basic_block, edge, gphi *, tree);
static void hoist_adjacent_loads (basic_block, basic_block,
basic_block, basic_block);
static bool gate_hoist_loads (void);
@@ -402,7 +402,8 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
static void
replace_phi_edge_with_variable (basic_block cond_block,
- edge e, gphi *phi, tree new_tree)
+ edge e, gphi *phi, tree new_tree,
+ bitmap dce_ssa_names = auto_bitmap())
{
basic_block bb = gimple_bb (phi);
gimple_stmt_iterator gsi;
@@ -477,6 +478,8 @@ replace_phi_edge_with_variable (basic_block cond_block,
gimple_cond_make_true (cond);
}
+ simple_dce_from_worklist (dce_ssa_names);
+
statistics_counter_event (cfun, "Replace PHI with variable", 1);
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -986,6 +989,7 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
gimple_seq seq = NULL;
tree result;
gimple *stmt_to_move = NULL;
+ auto_bitmap inserted_exprs;
/* Special case A ? B : B as this will always simplify to B. */
if (operand_equal_for_phi_arg_p (arg0, arg1))
@@ -1060,14 +1064,22 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
gsi = gsi_last_bb (cond_bb);
/* Insert the sequence generated from gimple_simplify_phiopt. */
if (seq)
+ {
+ // Mark the lhs of the new statements maybe for dce
+ gimple_stmt_iterator gsi1 = gsi_start (seq);
+ for (; !gsi_end_p (gsi1); gsi_next (&gsi1))
+ {
+ gimple *stmt = gsi_stmt (gsi1);
+ tree name = gimple_get_lhs (stmt);
+ if (name && TREE_CODE (name) == SSA_NAME)
+ bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (name));
+ }
gsi_insert_seq_before (&gsi, seq, GSI_CONTINUE_LINKING);
+ }
- /* If there was a statement to move and the result of the statement
- is going to be used, move it to right before the original
- conditional. */
- if (stmt_to_move
- && (gimple_assign_lhs (stmt_to_move) == result
- || !has_single_use (gimple_assign_lhs (stmt_to_move))))
+ /* If there was a statement to move, move it to right before
+ the original conditional. */
+ if (stmt_to_move)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1075,12 +1087,17 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
print_gimple_stmt (dump_file, stmt_to_move, 0,
TDF_VOPS|TDF_MEMSYMS);
}
+
+ tree name = gimple_get_lhs (stmt_to_move);
+ // Mark the name to be renamed if there is one.
+ if (name && TREE_CODE (name) == SSA_NAME)
+ bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (name));
gimple_stmt_iterator gsi1 = gsi_for_stmt (stmt_to_move);
gsi_move_before (&gsi1, &gsi);
reset_flow_sensitive_info (gimple_assign_lhs (stmt_to_move));
}
- replace_phi_edge_with_variable (cond_bb, e1, phi, result);
+ replace_phi_edge_with_variable (cond_bb, e1, phi, result, inserted_exprs);
/* Add Statistic here even though replace_phi_edge_with_variable already
does it as we want to be able to count when match-simplify happens vs
diff --git a/gcc/tree-streamer-in.cc b/gcc/tree-streamer-in.cc
index 57923da..0fa1eba 100644
--- a/gcc/tree-streamer-in.cc
+++ b/gcc/tree-streamer-in.cc
@@ -398,6 +398,7 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
if (AGGREGATE_TYPE_P (expr))
TYPE_TYPELESS_STORAGE (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_EMPTY_P (expr) = (unsigned) bp_unpack_value (bp, 1);
+ TYPE_NO_NAMED_ARGS_STDARG_P (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_PRECISION (expr) = bp_unpack_var_len_unsigned (bp);
SET_TYPE_ALIGN (expr, bp_unpack_var_len_unsigned (bp));
#ifdef ACCEL_COMPILER
diff --git a/gcc/tree-streamer-out.cc b/gcc/tree-streamer-out.cc
index 68a2818..3bf95ff 100644
--- a/gcc/tree-streamer-out.cc
+++ b/gcc/tree-streamer-out.cc
@@ -365,6 +365,7 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
if (AGGREGATE_TYPE_P (expr))
bp_pack_value (bp, TYPE_TYPELESS_STORAGE (expr), 1);
bp_pack_value (bp, TYPE_EMPTY_P (expr), 1);
+ bp_pack_value (bp, TYPE_NO_NAMED_ARGS_STDARG_P (expr), 1);
bp_pack_var_len_unsigned (bp, TYPE_PRECISION (expr));
bp_pack_var_len_unsigned (bp, TYPE_ALIGN (expr));
}
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index 4a23d61..6c89279 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -4016,6 +4016,11 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
if (reversep)
return false;
+ /* PR 107346. Packed structs can have fields at offsets that are not
+ multiples of BITS_PER_UNIT. Do not use gather/scatters in such cases. */
+ if (!multiple_p (pbitpos, BITS_PER_UNIT))
+ return false;
+
poly_int64 pbytepos = exact_div (pbitpos, BITS_PER_UNIT);
if (TREE_CODE (base) == MEM_REF)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index d5c2bff..aacbb12 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -8469,6 +8469,12 @@ vectorizable_recurr (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
edge pe = loop_preheader_edge (LOOP_VINFO_LOOP (loop_vinfo));
basic_block bb = gimple_bb (phi);
tree preheader = PHI_ARG_DEF_FROM_EDGE (phi, pe);
+ if (!useless_type_conversion_p (TREE_TYPE (vectype), TREE_TYPE (preheader)))
+ {
+ gimple_seq stmts = NULL;
+ preheader = gimple_convert (&stmts, TREE_TYPE (vectype), preheader);
+ gsi_insert_seq_on_edge_immediate (pe, stmts);
+ }
tree vec_init = build_vector_from_val (vectype, preheader);
vec_init = vect_init_vector (loop_vinfo, stmt_info, vec_init, vectype, NULL);
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 04603c8..1720987 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -6112,7 +6112,9 @@ type_cache_hasher::equal (type_hash *a, type_hash *b)
TYPE_FIELDS (b->type))));
case FUNCTION_TYPE:
- if (TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
+ if ((TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
+ && (TYPE_NO_NAMED_ARGS_STDARG_P (a->type)
+ == TYPE_NO_NAMED_ARGS_STDARG_P (b->type)))
|| (TYPE_ARG_TYPES (a->type)
&& TREE_CODE (TYPE_ARG_TYPES (a->type)) == TREE_LIST
&& TYPE_ARG_TYPES (b->type)
@@ -7364,10 +7366,13 @@ maybe_canonicalize_argtypes (tree argtypes,
given arguments of types ARG_TYPES.
ARG_TYPES is a chain of TREE_LIST nodes whose TREE_VALUEs
are data type nodes for the arguments of the function.
+ NO_NAMED_ARGS_STDARG_P is true if this is a prototyped
+ variable-arguments function with (...) prototype (no named arguments).
If such a type has already been constructed, reuse it. */
tree
-build_function_type (tree value_type, tree arg_types)
+build_function_type (tree value_type, tree arg_types,
+ bool no_named_args_stdarg_p)
{
tree t;
inchash::hash hstate;
@@ -7386,6 +7391,11 @@ build_function_type (tree value_type, tree arg_types)
t = make_node (FUNCTION_TYPE);
TREE_TYPE (t) = value_type;
TYPE_ARG_TYPES (t) = arg_types;
+ if (no_named_args_stdarg_p)
+ {
+ gcc_assert (arg_types == NULL_TREE);
+ TYPE_NO_NAMED_ARGS_STDARG_P (t) = 1;
+ }
/* If we already have such a type, use the old one. */
hashval_t hash = type_hash_canon_hash (t);
@@ -7436,7 +7446,7 @@ build_function_type_list_1 (bool vaargs, tree return_type, va_list argp)
args = nreverse (args);
TREE_CHAIN (last) = void_list_node;
}
- args = build_function_type (return_type, args);
+ args = build_function_type (return_type, args, vaargs && args == NULL_TREE);
return args;
}
@@ -7491,7 +7501,7 @@ build_function_type_array_1 (bool vaargs, tree return_type, int n,
for (i = n - 1; i >= 0; i--)
t = tree_cons (NULL_TREE, arg_types[i], t);
- return build_function_type (return_type, t);
+ return build_function_type (return_type, t, vaargs && n == 0);
}
/* Build a function type. RETURN_TYPE is the type returned by the
@@ -9994,7 +10004,8 @@ reconstruct_complex_type (tree type, tree bottom)
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
inner = reconstruct_complex_type (TREE_TYPE (type), bottom);
- outer = build_function_type (inner, TYPE_ARG_TYPES (type));
+ outer = build_function_type (inner, TYPE_ARG_TYPES (type),
+ TYPE_NO_NAMED_ARGS_STDARG_P (type));
}
else if (TREE_CODE (type) == METHOD_TYPE)
{
@@ -11612,6 +11623,9 @@ stdarg_p (const_tree fntype)
if (!fntype)
return false;
+ if (TYPE_NO_NAMED_ARGS_STDARG_P (fntype))
+ return true;
+
FOREACH_FUNCTION_ARGS (fntype, t, args_iter)
{
n = t;
@@ -11629,6 +11643,9 @@ prototype_p (const_tree fntype)
gcc_assert (fntype != NULL_TREE);
+ if (TYPE_NO_NAMED_ARGS_STDARG_P (fntype))
+ return true;
+
t = TYPE_ARG_TYPES (fntype);
return (t != NULL_TREE);
}
@@ -13647,7 +13664,9 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
trust_type_canonical))
return false;
- if (TYPE_ARG_TYPES (t1) == TYPE_ARG_TYPES (t2))
+ if (TYPE_ARG_TYPES (t1) == TYPE_ARG_TYPES (t2)
+ && (TYPE_NO_NAMED_ARGS_STDARG_P (t1)
+ == TYPE_NO_NAMED_ARGS_STDARG_P (t2)))
return true;
else
{
diff --git a/gcc/tree.h b/gcc/tree.h
index a50f7b2..d6a5fdf 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -772,6 +772,12 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
normal GNU extensions for target-specific vector types. */
#define TYPE_INDIVISIBLE_P(NODE) (TYPE_CHECK (NODE)->type_common.indivisible_p)
+/* True if this is a stdarg function with no named arguments (C2x
+ (...) prototype, where arguments can be accessed with va_start and
+ va_arg), as opposed to an unprototyped function. */
+#define TYPE_NO_NAMED_ARGS_STDARG_P(NODE) \
+ (TYPE_CHECK (NODE)->type_common.no_named_args_stdarg_p)
+
/* In an IDENTIFIER_NODE, this means that assemble_name was called with
this string as an argument. */
#define TREE_SYMBOL_REFERENCED(NODE) \
@@ -4734,7 +4740,7 @@ extern tree build_array_type_1 (tree, tree, bool, bool, bool);
extern tree build_array_type (tree, tree, bool = false);
extern tree build_nonshared_array_type (tree, tree);
extern tree build_array_type_nelts (tree, poly_uint64);
-extern tree build_function_type (tree, tree);
+extern tree build_function_type (tree, tree, bool = false);
extern tree build_function_type_list (tree, ...);
extern tree build_varargs_function_type_list (tree, ...);
extern tree build_function_type_array (tree, int, tree *);
diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc
index 6e05462..462447b 100644
--- a/gcc/value-range-storage.cc
+++ b/gcc/value-range-storage.cc
@@ -261,17 +261,28 @@ frange_storage_slot::get_frange (frange &r, tree type) const
{
gcc_checking_assert (r.supports_type_p (type));
- r.set_undefined ();
- r.m_kind = m_kind;
- r.m_type = type;
- r.m_min = m_min;
- r.m_max = m_max;
- r.m_pos_nan = m_pos_nan;
- r.m_neg_nan = m_neg_nan;
- r.normalize_kind ();
-
- if (flag_checking)
- r.verify_range ();
+ // Handle explicit NANs.
+ if (m_kind == VR_NAN)
+ {
+ if (HONOR_NANS (type))
+ {
+ if (m_pos_nan && m_neg_nan)
+ r.set_nan (type);
+ else
+ r.set_nan (type, m_neg_nan);
+ }
+ else
+ r.set_undefined ();
+ return;
+ }
+
+ // Use the constructor because it will canonicalize the range.
+ r = frange (type, m_min, m_max, m_kind);
+
+ // The constructor will set the NAN bits for HONOR_NANS, but we must
+ // make sure to set the NAN sign if known.
+ if (HONOR_NANS (type) && (m_pos_nan ^ m_neg_nan) == 1)
+ r.update_nan (m_neg_nan);
}
bool
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index d8ee6ec..03b3c4b 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -341,7 +341,7 @@ frange::set (tree type,
// For -ffinite-math-only we can drop ranges outside the
// representable numbers to min/max for the type.
- if (flag_finite_math_only)
+ if (!HONOR_INFINITIES (m_type))
{
REAL_VALUE_TYPE min_repr = frange_val_min (m_type);
REAL_VALUE_TYPE max_repr = frange_val_max (m_type);
@@ -712,8 +712,8 @@ frange::supports_type_p (const_tree type) const
void
frange::verify_range ()
{
- if (flag_finite_math_only)
- gcc_checking_assert (!maybe_isnan ());
+ if (!undefined_p ())
+ gcc_checking_assert (HONOR_NANS (m_type) || !maybe_isnan ());
switch (m_kind)
{
case VR_UNDEFINED:
@@ -4031,7 +4031,7 @@ range_tests_floats ()
r0.intersect (r1);
ASSERT_TRUE (r0.undefined_p ());
- if (!flag_finite_math_only)
+ if (HONOR_INFINITIES (float_type_node))
{
// Make sure [-Inf, -Inf] doesn't get normalized.
r0 = frange_float ("-Inf", "-Inf");
diff --git a/gcc/value-range.h b/gcc/value-range.h
index b48542a..c87734d 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -1201,10 +1201,10 @@ real_min_representable (const_tree type)
inline REAL_VALUE_TYPE
frange_val_min (const_tree type)
{
- if (flag_finite_math_only)
- return real_min_representable (type);
- else
+ if (HONOR_INFINITIES (type))
return dconstninf;
+ else
+ return real_min_representable (type);
}
// Return the maximum value for TYPE.
@@ -1212,10 +1212,10 @@ frange_val_min (const_tree type)
inline REAL_VALUE_TYPE
frange_val_max (const_tree type)
{
- if (flag_finite_math_only)
- return real_max_representable (type);
- else
+ if (HONOR_INFINITIES (type))
return dconstinf;
+ else
+ return real_max_representable (type);
}
// Return TRUE if R is the minimum value for TYPE.
diff --git a/include/ChangeLog b/include/ChangeLog
index b69f2b8..64b158a 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,15 @@
+2022-10-31 Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
+
+ * btf.h (btf_enum64): Add new definition and new symbolic
+ constant to BTF_KIND_ENUM64 and BTF_KF_ENUM_{UN,}SIGNED.
+
+2022-10-31 Lulu Cheng <chenglulu@loongson.cn>
+ qijingwen <qijingwen@loongson.cn>
+
+ * vtv-change-permission.h (defined): Determines whether the macro
+ __loongarch_lp64 is defined
+ (VTV_PAGE_SIZE): Set VTV_PAGE_SIZE to 16KiB for loongarch64.
+
2022-10-24 Tobias Burnus <tobias@codesourcery.com>
* cuda/cuda.h (enum CUdevice_attribute): Add
diff --git a/include/btf.h b/include/btf.h
index 78b551c..eba67f9 100644
--- a/include/btf.h
+++ b/include/btf.h
@@ -109,7 +109,8 @@ struct btf_type
#define BTF_KIND_VAR 14 /* Variable. */
#define BTF_KIND_DATASEC 15 /* Section such as .bss or .data. */
#define BTF_KIND_FLOAT 16 /* Floating point. */
-#define BTF_KIND_MAX BTF_KIND_FLOAT
+#define BTF_KIND_ENUM64 19 /* Enumeration up to 64 bits. */
+#define BTF_KIND_MAX BTF_KIND_ENUM64
#define NR_BTF_KINDS (BTF_KIND_MAX + 1)
/* For some BTF_KINDs, struct btf_type is immediately followed by
@@ -130,14 +131,17 @@ struct btf_type
#define BTF_INT_BOOL (1 << 2)
/* BTF_KIND_ENUM is followed by VLEN struct btf_enum entries,
- which describe the enumerators. Note that BTF currently only
- supports signed 32-bit enumerator values. */
+ which describe the enumerators. */
struct btf_enum
{
uint32_t name_off; /* Offset in string section of enumerator name. */
int32_t val; /* Enumerator value. */
};
+/* BTF_KF_ENUM_ holds the flags for kflags in BTF_KIND_ENUM{,64}. */
+#define BTF_KF_ENUM_UNSIGNED (0)
+#define BTF_KF_ENUM_SIGNED (1 << 0)
+
/* BTF_KIND_ARRAY is followed by a single struct btf_array. */
struct btf_array
{
@@ -190,6 +194,15 @@ struct btf_var_secinfo
uint32_t size; /* Size (in bytes) of variable. */
};
+/* BTF_KIND_ENUM64 is followed by VLEN struct btf_enum64 entries,
+ which describe the 64 bits enumerators. */
+struct btf_enum64
+{
+ uint32_t name_off; /* Offset in string section of enumerator name. */
+ uint32_t val_lo32; /* lower 32-bit value for a 64-bit value Enumerator */
+ uint32_t val_hi32; /* high 32-bit value for a 64-bit value Enumerator */
+};
+
#ifdef __cplusplus
}
#endif
diff --git a/include/vtv-change-permission.h b/include/vtv-change-permission.h
index 70bdad9..e7b9294 100644
--- a/include/vtv-change-permission.h
+++ b/include/vtv-change-permission.h
@@ -48,6 +48,10 @@ extern void __VLTChangePermission (int);
#else
#if defined(__sun__) && defined(__svr4__) && defined(__sparc__)
#define VTV_PAGE_SIZE 8192
+#elif defined(__loongarch_lp64)
+/* The page size is configurable by the kernel to be 4, 16 or 64 KiB.
+ For now, only the default page size of 16KiB is supported. */
+#define VTV_PAGE_SIZE 16384
#else
#define VTV_PAGE_SIZE 4096
#endif
diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go
index fa3389d..1e84f4f 100644
--- a/libgo/go/runtime/mem_gccgo.go
+++ b/libgo/go/runtime/mem_gccgo.go
@@ -15,7 +15,7 @@ import (
//go:linkname sysFree
//extern mmap
-func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _libgo_off_t_type) unsafe.Pointer
//extern munmap
func munmap(addr unsafe.Pointer, length uintptr) int32
@@ -38,7 +38,7 @@ func init() {
}
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) {
- p := sysMmap(addr, n, prot, flags, fd, off)
+ p := sysMmap(addr, n, prot, flags, fd, _libgo_off_t_type(off))
if uintptr(p) == _MAP_FAILED {
return nil, errno()
}
@@ -47,6 +47,7 @@ func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (u
// Don't split the stack as this method may be invoked without a valid G, which
// prevents us from allocating more stack.
+//
//go:nosplit
func sysAlloc(n uintptr, sysStat *sysMemStat) unsafe.Pointer {
p, err := mmap(nil, n, _PROT_READ|_PROT_WRITE, _MAP_ANON|_MAP_PRIVATE, mmapFD, 0)
@@ -165,6 +166,7 @@ func sysHugePage(v unsafe.Pointer, n uintptr) {
// Don't split the stack as this function may be invoked without a valid G,
// which prevents us from allocating more stack.
+//
//go:nosplit
func sysFree(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
sysStat.add(-int64(n))
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index d61a806..477b35f 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,13 @@
+2022-10-28 Julian Brown <julian@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+
+ PR middle-end/90115
+ * testsuite/libgomp.oacc-fortran/declare-1.f90: Adjust scan output.
+ * testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise.
+ * testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
+ * testsuite/libgomp.oacc-fortran/print-1.f90: Likewise.
+ * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.
+
2022-10-24 Thomas Schwinge <thomas@codesourcery.com>
* plugin/plugin-nvptx.c (nvptx_open_device): Initialize
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
index 51776a1..89bd4a2 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
@@ -215,7 +215,7 @@ program main
! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
- ! { dg-note {variable 'desc\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-4 }
+ ! { dg-note {variable 'desc\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-4 }
use vars
use openacc
implicit none
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90 b/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90
index 93e9ee0..c3453a5 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90
@@ -43,7 +43,7 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-2 }
! { dg-note {variable 'p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target { ! openacc_host_selected } } .-5 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-5 }
#if !ACC_MEM_SHARED
if (acc_is_present(p, c_sizeof(p))) stop 5
if (acc_is_present(parr, 1)) stop 6
@@ -54,8 +54,8 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
- ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-6 }
- ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-6 }
+ ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-7 }
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-8 }
! not mapped yet, so it will be equal to the host pointer.
if (transfer(c_loc(p), host_p) /= host_p) stop 7
@@ -74,9 +74,9 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 }
! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-7 }
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 }
- ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-9 }
- ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-10 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-8 }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-9 }
+ ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-10 }
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-11 }
if (.not. acc_is_present(p, c_sizeof(p))) stop 11
if (.not. acc_is_present(parr, 1)) stop 12
@@ -90,8 +90,8 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
- ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-6 }
- ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-6 }
+ ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-7 }
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-8 }
#if ACC_MEM_SHARED
if (transfer(c_loc(p), host_p) /= host_p) stop 15
@@ -110,8 +110,8 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 }
- ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
- ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-7 }
+ ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-8 }
#if ACC_MEM_SHARED
if (transfer(c_loc(p), host_p) /= host_p) stop 19
if (transfer(c_loc(parr), host_parr) /= host_parr) stop 20
@@ -129,8 +129,8 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 }
- ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
- ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 }
+ ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-7 }
+ ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-8 }
#if ACC_MEM_SHARED
if (transfer(c_loc(p), host_p) /= host_p) stop 23
if (transfer(c_loc(parr), host_parr) /= host_parr) stop 24
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90
index c6d6764..e0cfd91 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90
@@ -382,7 +382,7 @@ program main
b(:) = 1.0
!$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target { ! openacc_host_selected } } .-1 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-1 }
#if !ACC_MEM_SHARED
if (acc_is_present (a) .eqv. .TRUE.) STOP 21
@@ -396,7 +396,7 @@ program main
!$acc data copyin (a(1:N)) if (1 == 1)
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target { ! openacc_host_selected } } .-2 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
#if !ACC_MEM_SHARED
if (acc_is_present (a) .eqv. .FALSE.) STOP 23
@@ -404,7 +404,7 @@ program main
!$acc data copyout (b(1:N)) if (0 == 1)
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target { ! openacc_host_selected } } .-2 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
#if !ACC_MEM_SHARED
if (acc_is_present (b) .eqv. .TRUE.) STOP 24
#endif
@@ -877,7 +877,7 @@ program main
b(:) = 1.0
!$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target { ! openacc_host_selected } } .-1 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-1 }
#if !ACC_MEM_SHARED
if (acc_is_present (a) .eqv. .TRUE.) STOP 56
@@ -891,7 +891,7 @@ program main
!$acc data copyin (a(1:N)) if (1 == 1)
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target { ! openacc_host_selected } } .-2 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
#if !ACC_MEM_SHARED
if (acc_is_present (a) .eqv. .FALSE.) STOP 58
@@ -899,7 +899,7 @@ program main
!$acc data copyout (b(1:N)) if (0 == 1)
! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
- ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target { ! openacc_host_selected } } .-2 }
+ ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
#if !ACC_MEM_SHARED
if (acc_is_present (b) .eqv. .TRUE.) STOP 59
#endif
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90
index 42a8538..d2f89d9 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90
@@ -6,15 +6,6 @@
! Separate file 'print-1-nvptx.f90' for nvptx offloading.
! { dg-skip-if "separate file" { offload_target_nvptx } }
-! For GCN offloading compilation, when gang-privatizing 'dt_parm.N'
-! (see below), we run into an 'gang-private data-share memory exhausted'
-! error: the default '-mgang-private-size' is too small. Per
-! 'gcc/fortran/trans-io.cc'/'libgfortran/io/io.h', that one is
-! 'struct st_parameter_dt', which indeed is rather big. Instead of
-! working out its exact size (which may vary per GCC configuration),
-! raise '-mgang-private-size' to an arbitrary high value.
-! { dg-additional-options "-foffload-options=amdgcn-amdhsa=-mgang-private-size=13579" { target openacc_radeon_accel_selected } }
-
! { dg-additional-options "-fopt-info-note-omp" }
! { dg-additional-options "-foffload=-fopt-info-note-omp" }
@@ -36,9 +27,7 @@ program main
integer :: var = 42
!$acc parallel ! { dg-line l_compute[incr c_compute] }
- ! { dg-note {variable 'dt_parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} {} { target *-*-* } l_compute$c_compute }
- ! { dg-note {variable 'dt_parm\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} {} { target *-*-* } l_compute$c_compute }
- ! { dg-note {variable 'dt_parm\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} {} { target { ! openacc_host_selected } } l_compute$c_compute }
+ ! { dg-note {variable 'dt_parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} {} { target *-*-* } l_compute$c_compute }
write (0, '("The answer is ", I2)') var
!$acc end parallel
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
index b31f406..498ef70 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -122,9 +122,7 @@ contains
! { dg-note {variable 'str' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
! { dg-note {variable 'str' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
! { dg-note {variable 'str' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
- ! { dg-note {variable 'char\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
- ! { dg-note {variable 'char\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
- ! { dg-note {variable 'char\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
+ ! { dg-note {variable 'char\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } l_loop$c_loop }
! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } l_loop$c_loop }
do i = 1, 10
str(i:i) = achar(ichar('A') + i)
@@ -167,9 +165,7 @@ contains
! { dg-note {variable 'scalar' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
! { dg-note {variable 'scalar' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
! { dg-note {variable 'scalar' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
- ! { dg-note {variable 'char\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
- ! { dg-note {variable 'char\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
- ! { dg-note {variable 'char\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
+ ! { dg-note {variable 'char\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } l_loop$c_loop }
do i = 1, 15
scalar(i:i) = achar(ichar('A') + i)
end do
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 552d29b..35bf543 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-31 Xiongchuan Tan <xc-tan@outlook.com>
+
+ * configure.tgt: Add riscv support.
+ * config/riscv/asm.h: New file.
+ * config/riscv/sjlj.S: New file.
+ * config/riscv/target.h: New file.
+
2022-10-13 Lulu Cheng <chenglulu@loongson.cn>
* config/loongarch/sjlj.S: Add a soft floating point condition to the
diff --git a/libitm/config/riscv/asm.h b/libitm/config/riscv/asm.h
new file mode 100644
index 0000000..f0e3bd0
--- /dev/null
+++ b/libitm/config/riscv/asm.h
@@ -0,0 +1,63 @@
+/* Copyright (C) 2022 Free Software Foundation, Inc.
+ Contributed by Xiongchuan Tan <xc-tan@outlook.com>.
+
+ This file is part of the GNU Transactional Memory Library (libitm).
+
+ Libitm 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.
+
+ Libitm 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _RV_ASM_H
+#define _RV_ASM_H
+
+#ifdef __riscv_e
+# error "rv32e and rv64e unsupported"
+#endif
+
+#if __riscv_xlen == 64
+# define GPR_L ld
+# define GPR_S sd
+# define SZ_GPR 8
+# define LEN_GPR 14
+#elif __riscv_xlen == 32
+# define GPR_L lw
+# define GPR_S sw
+# define SZ_GPR 4
+# define LEN_GPR 16 /* Extra padding to align the stack to 16 bytes */
+#else
+# error Unsupported XLEN (must be 64-bit or 32-bit).
+#endif
+
+#if defined(__riscv_flen) && __riscv_flen == 64
+# define FPR_L fld
+# define FPR_S fsd
+# define SZ_FPR 8
+#elif defined(__riscv_flen) && __riscv_flen == 32
+# define FPR_L flw
+# define FPR_S fsw
+# define SZ_FPR 4
+#elif defined(__riscv_flen)
+# error Q-extension unsupported
+#else
+# define SZ_FPR 0
+#endif
+
+/* The size of gtm_jmpbuf */
+#define ADJ_STACK_SIZE (LEN_GPR*SZ_GPR+12*SZ_FPR)
+
+#endif /* _RV_ASM_H */
diff --git a/libitm/config/riscv/sjlj.S b/libitm/config/riscv/sjlj.S
new file mode 100644
index 0000000..18521ae
--- /dev/null
+++ b/libitm/config/riscv/sjlj.S
@@ -0,0 +1,144 @@
+/* Copyright (C) 2022 Free Software Foundation, Inc.
+ Contributed by Xiongchuan Tan <xc-tan@outlook.com>.
+
+ This file is part of the GNU Transactional Memory Library (libitm).
+
+ Libitm 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.
+
+ Libitm 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "asmcfi.h"
+#include "asm.h"
+
+ .text
+ .align 2
+ .global _ITM_beginTransaction
+ .type _ITM_beginTransaction, @function
+
+_ITM_beginTransaction:
+ cfi_startproc
+ mv a1, sp
+ addi sp, sp, -ADJ_STACK_SIZE
+ cfi_adjust_cfa_offset(ADJ_STACK_SIZE)
+
+ /* Return Address */
+ GPR_S ra, 0*SZ_GPR(sp)
+ cfi_rel_offset(ra, 0*SZ_GPR)
+
+ /* Caller's sp */
+ GPR_S a1, 1*SZ_GPR(sp)
+
+ /* Caller's s0/fp */
+ GPR_S fp, 2*SZ_GPR(sp)
+ cfi_rel_offset(fp, 2*SZ_GPR)
+
+ /* Callee-saved registers */
+ GPR_S s1, 3*SZ_GPR(sp)
+ GPR_S s2, 4*SZ_GPR(sp)
+ GPR_S s3, 5*SZ_GPR(sp)
+ GPR_S s4, 6*SZ_GPR(sp)
+ GPR_S s5, 7*SZ_GPR(sp)
+ GPR_S s6, 8*SZ_GPR(sp)
+ GPR_S s7, 9*SZ_GPR(sp)
+ GPR_S s8, 10*SZ_GPR(sp)
+ GPR_S s9, 11*SZ_GPR(sp)
+ GPR_S s10, 12*SZ_GPR(sp)
+ GPR_S s11, 13*SZ_GPR(sp)
+
+#if defined(__riscv_flen)
+ /* Callee-saved floating-point registers */
+ FPR_S fs0, 0*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs1, 1*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs2, 2*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs3, 3*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs4, 4*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs5, 5*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs6, 6*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs7, 7*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs8, 8*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs9, 9*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs10, 10*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+ FPR_S fs11, 11*SZ_FPR+LEN_GPR*SZ_GPR(sp)
+#endif
+ mv fp, sp
+
+ /* Invoke GTM_begin_transaction with the struct we've just built. */
+ mv a1, sp
+ jal ra, GTM_begin_transaction
+
+ /* Return; we don't need to restore any of the call-saved regs. */
+ GPR_L ra, 0*SZ_GPR(sp)
+ cfi_restore(ra)
+ GPR_L fp, 2*SZ_GPR(sp)
+ cfi_restore(fp)
+
+ addi sp, sp, ADJ_STACK_SIZE
+ cfi_adjust_cfa_offset(-ADJ_STACK_SIZE)
+
+ ret
+ cfi_endproc
+ .size _ITM_beginTransaction, . - _ITM_beginTransaction
+
+ .align 2
+ .global GTM_longjmp
+ .hidden GTM_longjmp
+ .type GTM_longjmp, @function
+
+GTM_longjmp:
+ /* The first parameter becomes the return value (a0).
+ The third parameter is ignored for now. */
+ cfi_startproc
+ GPR_L s1, 3*SZ_GPR(a1)
+ GPR_L s2, 4*SZ_GPR(a1)
+ GPR_L s3, 5*SZ_GPR(a1)
+ GPR_L s4, 6*SZ_GPR(a1)
+ GPR_L s5, 7*SZ_GPR(a1)
+ GPR_L s6, 8*SZ_GPR(a1)
+ GPR_L s7, 9*SZ_GPR(a1)
+ GPR_L s8, 10*SZ_GPR(a1)
+ GPR_L s9, 11*SZ_GPR(a1)
+ GPR_L s10, 12*SZ_GPR(a1)
+ GPR_L s11, 13*SZ_GPR(a1)
+
+#if defined(__riscv_flen)
+ FPR_L fs0, 0*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs1, 1*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs2, 2*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs3, 3*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs4, 4*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs5, 5*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs6, 6*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs7, 7*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs8, 8*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs9, 9*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs10, 10*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+ FPR_L fs11, 11*SZ_FPR+LEN_GPR*SZ_GPR(a1)
+#endif
+
+ GPR_L ra, 0*SZ_GPR(a1)
+ GPR_L fp, 2*SZ_GPR(a1)
+ GPR_L a3, 1*SZ_GPR(a1)
+ cfi_def_cfa(a1, 0)
+ mv sp, a3
+ jr ra
+ cfi_endproc
+ .size GTM_longjmp, . - GTM_longjmp
+
+#ifdef __linux__
+.section .note.GNU-stack, "", @progbits
+#endif
diff --git a/libitm/config/riscv/target.h b/libitm/config/riscv/target.h
new file mode 100644
index 0000000..7dcaa6a
--- /dev/null
+++ b/libitm/config/riscv/target.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 2022 Free Software Foundation, Inc.
+ Contributed by Xiongchuan Tan <xc-tan@outlook.com>.
+
+ This file is part of the GNU Transactional Memory Library (libitm).
+
+ Libitm 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.
+
+ Libitm 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+namespace GTM HIDDEN {
+
+typedef struct gtm_jmpbuf
+ {
+ long int pc;
+ void *cfa;
+ long int s[12]; /* Saved registers, s0 is fp */
+
+#if __riscv_xlen == 32
+ /* Ensure that the stack is 16-byte aligned */
+ long int padding[2];
+#endif
+
+ /* FP saved registers */
+#if defined(__riscv_flen) && __riscv_flen == 64
+ double fs[12];
+#elif defined(__riscv_flen) && __riscv_flen == 32
+ float fs[12];
+#elif defined(__riscv_flen)
+# error Q-extension unsupported
+#endif
+ } gtm_jmpbuf;
+
+/* The size of one line in hardware caches (in bytes). */
+/* 64 bytes is a suggested value in the RVA profiles (see
+ https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc). */
+#define HW_CACHELINE_SIZE 64
+
+static inline void
+cpu_relax (void)
+{
+ #ifdef __riscv_zihintpause
+ __asm volatile ("pause");
+ #else
+ /* Encoding of the pause instruction */
+ __asm volatile (".4byte 0x100000F");
+ #endif
+}
+
+} // namespace GTM
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index 4c0e78c..635c1d4 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -82,6 +82,8 @@ EOF
loongarch*) ARCH=loongarch ;;
+ riscv*) ARCH=riscv ;;
+
sh*) ARCH=sh ;;
sparc)
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index 7d4582e..d3bdedd 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * libdruntime/MERGE: Merge upstream druntime e4f8919591.
+ * src/MERGE: Merge upstream phobos 3ad507b51.
+
2022-10-12 Martin Liska <mliska@suse.cz>
* configure: Regenerate.
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index a4c46f3..2398875 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-4219ba670ce9ff92f3e874f0f048f2c28134c008
+e4f89195913be1dc638707b1abb24c4f3ae7e0bf
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index 5242ba9..dbe7daa 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -24,7 +24,6 @@ else version (WatchOS)
version = Darwin;
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/stdc/signal.d b/libphobos/libdruntime/core/stdc/signal.d
index 8d5d845..13c6f9e 100644
--- a/libphobos/libdruntime/core/stdc/signal.d
+++ b/libphobos/libdruntime/core/stdc/signal.d
@@ -15,7 +15,6 @@
module core.stdc.signal;
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/stdc/stdarg.d b/libphobos/libdruntime/core/stdc/stdarg.d
index 646905e..5b79813 100644
--- a/libphobos/libdruntime/core/stdc/stdarg.d
+++ b/libphobos/libdruntime/core/stdc/stdarg.d
@@ -12,7 +12,6 @@
module core.stdc.stdarg;
-@system:
@nogc:
nothrow:
diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d
index fc98350..ee37da1 100644
--- a/libphobos/libdruntime/core/stdc/stdio.d
+++ b/libphobos/libdruntime/core/stdc/stdio.d
@@ -49,7 +49,6 @@ private
}
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/stdc/stdlib.d b/libphobos/libdruntime/core/stdc/stdlib.d
index 920c311..0b42de8 100644
--- a/libphobos/libdruntime/core/stdc/stdlib.d
+++ b/libphobos/libdruntime/core/stdc/stdlib.d
@@ -31,7 +31,6 @@ version (CRuntime_Glibc)
else {}
extern (C):
-@system:
/* Placed outside `nothrow` and `@nogc` in order to not constrain what the callback does.
*/
diff --git a/libphobos/libdruntime/core/stdc/string.d b/libphobos/libdruntime/core/stdc/string.d
index f15ef85..3591a6d 100644
--- a/libphobos/libdruntime/core/stdc/string.d
+++ b/libphobos/libdruntime/core/stdc/string.d
@@ -30,7 +30,6 @@ else version (CRuntime_UClibc)
version = ReturnStrerrorR;
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/stdc/wchar_.d b/libphobos/libdruntime/core/stdc/wchar_.d
index d087029..fe5fce4 100644
--- a/libphobos/libdruntime/core/stdc/wchar_.d
+++ b/libphobos/libdruntime/core/stdc/wchar_.d
@@ -22,7 +22,6 @@ public import core.stdc.time; // for tm
public import core.stdc.stdint; // for WCHAR_MIN, WCHAR_MAX
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/darwin/fcntl.d b/libphobos/libdruntime/core/sys/darwin/fcntl.d
index 47d895a..413d9c6 100644
--- a/libphobos/libdruntime/core/sys/darwin/fcntl.d
+++ b/libphobos/libdruntime/core/sys/darwin/fcntl.d
@@ -15,6 +15,5 @@ version (Darwin):
extern (C):
nothrow:
@nogc:
-@system:
enum F_FULLFSYNC = 51;
diff --git a/libphobos/libdruntime/core/sys/darwin/ifaddrs.d b/libphobos/libdruntime/core/sys/darwin/ifaddrs.d
index a254036..2e744b0 100644
--- a/libphobos/libdruntime/core/sys/darwin/ifaddrs.d
+++ b/libphobos/libdruntime/core/sys/darwin/ifaddrs.d
@@ -29,7 +29,6 @@ version (Darwin):
extern (C):
nothrow:
@nogc:
-@system:
import core.sys.posix.sys.socket;
diff --git a/libphobos/libdruntime/core/sys/elf/package.d b/libphobos/libdruntime/core/sys/elf/package.d
index 2dcfd20..b120ee5 100644
--- a/libphobos/libdruntime/core/sys/elf/package.d
+++ b/libphobos/libdruntime/core/sys/elf/package.d
@@ -8,7 +8,6 @@ module core.sys.elf;
extern (C):
pure:
nothrow:
-@system:
import core.stdc.stdint;
diff --git a/libphobos/libdruntime/core/sys/linux/dlfcn.d b/libphobos/libdruntime/core/sys/linux/dlfcn.d
index fbb8462..a13bae7 100644
--- a/libphobos/libdruntime/core/sys/linux/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/linux/dlfcn.d
@@ -9,7 +9,6 @@ version (linux):
extern (C):
nothrow:
@nogc:
-@system:
version (ARM) version = ARM_Any;
version (AArch64) version = ARM_Any;
diff --git a/libphobos/libdruntime/core/sys/linux/elf.d b/libphobos/libdruntime/core/sys/linux/elf.d
index 168b936..0486cbe 100644
--- a/libphobos/libdruntime/core/sys/linux/elf.d
+++ b/libphobos/libdruntime/core/sys/linux/elf.d
@@ -9,7 +9,6 @@ version (linux):
extern (C):
pure:
nothrow:
-@system:
import core.stdc.stdint;
public import core.sys.elf;
diff --git a/libphobos/libdruntime/core/sys/linux/epoll.d b/libphobos/libdruntime/core/sys/linux/epoll.d
index f5ff7db..99099b5 100644
--- a/libphobos/libdruntime/core/sys/linux/epoll.d
+++ b/libphobos/libdruntime/core/sys/linux/epoll.d
@@ -13,10 +13,8 @@ version (linux):
import core.sys.posix.signal : sigset_t;
extern (C):
-@system:
@nogc:
nothrow:
-@system:
version (ARM) version = ARM_Any;
version (AArch64) version = ARM_Any;
diff --git a/libphobos/libdruntime/core/sys/linux/err.d b/libphobos/libdruntime/core/sys/linux/err.d
index be5378d..c3752de 100644
--- a/libphobos/libdruntime/core/sys/linux/err.d
+++ b/libphobos/libdruntime/core/sys/linux/err.d
@@ -12,7 +12,6 @@ version (linux):
extern (C):
nothrow:
@nogc:
-@system:
void err(int eval, scope const char* fmt, ...);
void errx(int eval, scope const char* fmt, ...);
diff --git a/libphobos/libdruntime/core/sys/linux/errno.d b/libphobos/libdruntime/core/sys/linux/errno.d
index d7a39ac..74844e7 100644
--- a/libphobos/libdruntime/core/sys/linux/errno.d
+++ b/libphobos/libdruntime/core/sys/linux/errno.d
@@ -8,7 +8,6 @@ module core.sys.linux.errno;
version (linux):
extern (C):
nothrow:
-@system:
public import core.stdc.errno;
import core.sys.linux.config;
diff --git a/libphobos/libdruntime/core/sys/linux/execinfo.d b/libphobos/libdruntime/core/sys/linux/execinfo.d
index 4169ca3..50dc60d 100644
--- a/libphobos/libdruntime/core/sys/linux/execinfo.d
+++ b/libphobos/libdruntime/core/sys/linux/execinfo.d
@@ -10,7 +10,6 @@ module core.sys.linux.execinfo;
version (linux):
extern (C):
nothrow:
-@system:
@nogc:
int backtrace(void** buffer, int size);
diff --git a/libphobos/libdruntime/core/sys/linux/fcntl.d b/libphobos/libdruntime/core/sys/linux/fcntl.d
index 89dc019..d666efe 100644
--- a/libphobos/libdruntime/core/sys/linux/fcntl.d
+++ b/libphobos/libdruntime/core/sys/linux/fcntl.d
@@ -5,7 +5,6 @@ public import core.sys.posix.fcntl;
version (linux):
extern(C):
nothrow:
-@system:
// From linux/falloc.h
/// fallocate(2) params
diff --git a/libphobos/libdruntime/core/sys/linux/fs.d b/libphobos/libdruntime/core/sys/linux/fs.d
index c5525066..ca88567 100644
--- a/libphobos/libdruntime/core/sys/linux/fs.d
+++ b/libphobos/libdruntime/core/sys/linux/fs.d
@@ -18,7 +18,6 @@ public import core.sys.posix.sys.ioctl;
import core.stdc.config : c_ulong, c_long;
extern (C):
-@system:
@nogc:
nothrow:
diff --git a/libphobos/libdruntime/core/sys/linux/ifaddrs.d b/libphobos/libdruntime/core/sys/linux/ifaddrs.d
index 5490e97a..479dfa8 100644
--- a/libphobos/libdruntime/core/sys/linux/ifaddrs.d
+++ b/libphobos/libdruntime/core/sys/linux/ifaddrs.d
@@ -22,7 +22,6 @@ version (linux):
extern (C):
nothrow:
@nogc:
-@system:
struct ifaddrs
{
diff --git a/libphobos/libdruntime/core/sys/linux/io_uring.d b/libphobos/libdruntime/core/sys/linux/io_uring.d
index 5e1a20c..7bafb9f 100644
--- a/libphobos/libdruntime/core/sys/linux/io_uring.d
+++ b/libphobos/libdruntime/core/sys/linux/io_uring.d
@@ -14,10 +14,8 @@ version (linux):
import core.sys.linux.fs : __kernel_rwf_t;
extern (C):
-@system:
@nogc:
nothrow:
-@system:
/**
* IO submission data structure (Submission Queue Entry)
diff --git a/libphobos/libdruntime/core/sys/linux/link.d b/libphobos/libdruntime/core/sys/linux/link.d
index b417ec8..4d7eb1e 100644
--- a/libphobos/libdruntime/core/sys/linux/link.d
+++ b/libphobos/libdruntime/core/sys/linux/link.d
@@ -8,7 +8,6 @@ module core.sys.linux.link;
version (linux):
extern (C):
nothrow:
-@system:
version (ARM) version = ARM_Any;
version (AArch64) version = ARM_Any;
diff --git a/libphobos/libdruntime/core/sys/linux/perf_event.d b/libphobos/libdruntime/core/sys/linux/perf_event.d
index 9e96a7f..b9993a7 100644
--- a/libphobos/libdruntime/core/sys/linux/perf_event.d
+++ b/libphobos/libdruntime/core/sys/linux/perf_event.d
@@ -9,7 +9,6 @@ module core.sys.linux.perf_event;
version (linux) : extern (C):
@nogc:
nothrow:
-@system:
import core.sys.posix.sys.ioctl;
import core.sys.posix.unistd;
diff --git a/libphobos/libdruntime/core/sys/linux/sched.d b/libphobos/libdruntime/core/sys/linux/sched.d
index e828b74..5cd512e 100644
--- a/libphobos/libdruntime/core/sys/linux/sched.d
+++ b/libphobos/libdruntime/core/sys/linux/sched.d
@@ -26,7 +26,6 @@ version (linux):
extern (C):
@nogc:
nothrow:
-@system:
private // helpers
diff --git a/libphobos/libdruntime/core/sys/linux/stdio.d b/libphobos/libdruntime/core/sys/linux/stdio.d
index ab8971b..2d079fd 100644
--- a/libphobos/libdruntime/core/sys/linux/stdio.d
+++ b/libphobos/libdruntime/core/sys/linux/stdio.d
@@ -13,7 +13,6 @@ import core.sys.linux.config : __USE_FILE_OFFSET64;
import core.stdc.stdio : FILE;
import core.stdc.stddef : wchar_t;
-@system:
extern(C) nothrow
{
@@ -29,7 +28,7 @@ extern(C) nothrow
cookie_seek_function_t seek;
cookie_close_function_t close;
}
- FILE* fopencookie(in void* cookie, in char* mode, cookie_io_functions_t io_funcs);
+ FILE* fopencookie(void* cookie, const(char)* mode, cookie_io_functions_t io_funcs);
void setbuffer(FILE *stream, char *buf, size_t size); // note: _DEFAULT_SOURCE
}
diff --git a/libphobos/libdruntime/core/sys/linux/string.d b/libphobos/libdruntime/core/sys/linux/string.d
index 880faa4..a8da398 100644
--- a/libphobos/libdruntime/core/sys/linux/string.d
+++ b/libphobos/libdruntime/core/sys/linux/string.d
@@ -14,7 +14,6 @@ version (linux):
extern (C):
nothrow:
@nogc:
-@system:
static if (_GNU_SOURCE)
{
diff --git a/libphobos/libdruntime/core/sys/linux/sys/eventfd.d b/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
index 0954b3f..a35d714 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
@@ -9,7 +9,6 @@ module core.sys.linux.sys.eventfd;
version (linux):
extern (C):
@nogc:
-@system:
nothrow:
version (ARM) version = ARM_Any;
diff --git a/libphobos/libdruntime/core/sys/linux/sys/inotify.d b/libphobos/libdruntime/core/sys/linux/sys/inotify.d
index 11bdc85..c74aaa6 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/inotify.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/inotify.d
@@ -22,7 +22,6 @@ version (DragonFlyBSD) version = LinuxOrCompatible;
version (LinuxOrCompatible):
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/linux/sys/mman.d b/libphobos/libdruntime/core/sys/linux/sys/mman.d
index 649e2af..43a1aec 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/mman.d
@@ -8,7 +8,6 @@ module core.sys.linux.sys.mman;
version (linux):
extern (C):
nothrow:
-@system:
@nogc:
version (ARM) version = ARM_Any;
diff --git a/libphobos/libdruntime/core/sys/linux/sys/prctl.d b/libphobos/libdruntime/core/sys/linux/sys/prctl.d
index a732216..363e1e3 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/prctl.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/prctl.d
@@ -8,7 +8,6 @@ module core.sys.linux.sys.prctl;
version (linux):
extern (C):
-@system:
@nogc:
nothrow:
diff --git a/libphobos/libdruntime/core/sys/linux/sys/signalfd.d b/libphobos/libdruntime/core/sys/linux/sys/signalfd.d
index 736b145..8834be4 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/signalfd.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/signalfd.d
@@ -12,7 +12,6 @@ import core.sys.posix.signal;
version (linux):
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/linux/sys/sysinfo.d b/libphobos/libdruntime/core/sys/linux/sys/sysinfo.d
index 0c9ed59..699cd3e 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/sysinfo.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/sysinfo.d
@@ -7,7 +7,6 @@
module core.sys.linux.sys.sysinfo;
version (linux) extern(C) @nogc nothrow:
-@system:
import core.sys.linux.config;
diff --git a/libphobos/libdruntime/core/sys/linux/sys/xattr.d b/libphobos/libdruntime/core/sys/linux/sys/xattr.d
index 6446ff8..8618fc9 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/xattr.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/xattr.d
@@ -11,7 +11,6 @@ import core.sys.posix.sys.types;
version (linux):
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/linux/timerfd.d b/libphobos/libdruntime/core/sys/linux/timerfd.d
index f8a9719..eacc448 100644
--- a/libphobos/libdruntime/core/sys/linux/timerfd.d
+++ b/libphobos/libdruntime/core/sys/linux/timerfd.d
@@ -11,7 +11,6 @@ version (linux):
public import core.sys.posix.time;
extern (C):
-@system:
@nogc:
nothrow:
diff --git a/libphobos/libdruntime/core/sys/linux/tipc.d b/libphobos/libdruntime/core/sys/linux/tipc.d
index 4d5d886..50f90ee 100644
--- a/libphobos/libdruntime/core/sys/linux/tipc.d
+++ b/libphobos/libdruntime/core/sys/linux/tipc.d
@@ -10,7 +10,6 @@ module core.sys.linux.tipc;
version (linux):
extern (C) nothrow @nogc:
-@system:
struct tipc_portid
{
diff --git a/libphobos/libdruntime/core/sys/linux/unistd.d b/libphobos/libdruntime/core/sys/linux/unistd.d
index 4845746..faa226c 100644
--- a/libphobos/libdruntime/core/sys/linux/unistd.d
+++ b/libphobos/libdruntime/core/sys/linux/unistd.d
@@ -5,7 +5,6 @@ public import core.sys.posix.unistd;
version (linux):
extern(C):
nothrow:
-@system:
// Additional seek constants for sparse file handling
// from Linux's unistd.h, stdio.h, and linux/fs.h
diff --git a/libphobos/libdruntime/core/sys/openbsd/sys/mman.d b/libphobos/libdruntime/core/sys/openbsd/sys/mman.d
index 7654834..8a8542a 100644
--- a/libphobos/libdruntime/core/sys/openbsd/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/openbsd/sys/mman.d
@@ -47,5 +47,6 @@ static if (__BSD_VISIBLE)
int madvise(void *, size_t, int);
int minherit(void *, size_t, int);
+ int mimmutable(void *, size_t);
void* mquery(void *, size_t, int, int, int, off_t);
}
diff --git a/libphobos/libdruntime/core/sys/posix/aio.d b/libphobos/libdruntime/core/sys/posix/aio.d
index a76846e..3ea7f6a 100644
--- a/libphobos/libdruntime/core/sys/posix/aio.d
+++ b/libphobos/libdruntime/core/sys/posix/aio.d
@@ -23,7 +23,6 @@ else version (WatchOS)
version (Posix):
extern (C):
-@system:
@nogc:
nothrow:
diff --git a/libphobos/libdruntime/core/sys/posix/config.d b/libphobos/libdruntime/core/sys/posix/config.d
index 7bd0722..ae6752f2 100644
--- a/libphobos/libdruntime/core/sys/posix/config.d
+++ b/libphobos/libdruntime/core/sys/posix/config.d
@@ -19,7 +19,6 @@ public import core.stdc.config;
version (Posix):
extern (C) nothrow @nogc:
-@system:
enum _XOPEN_SOURCE = 600;
enum _POSIX_SOURCE = true;
diff --git a/libphobos/libdruntime/core/sys/posix/dirent.d b/libphobos/libdruntime/core/sys/posix/dirent.d
index bffbc51..c7e8649 100644
--- a/libphobos/libdruntime/core/sys/posix/dirent.d
+++ b/libphobos/libdruntime/core/sys/posix/dirent.d
@@ -31,7 +31,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/dlfcn.d b/libphobos/libdruntime/core/sys/posix/dlfcn.d
index 04a8e8b..5797b8f 100644
--- a/libphobos/libdruntime/core/sys/posix/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/posix/dlfcn.d
@@ -45,7 +45,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// XOpen (XSI)
diff --git a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
index dc0a183..0a58034 100644
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d
@@ -49,7 +49,6 @@ extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/grp.d b/libphobos/libdruntime/core/sys/posix/grp.d
index 92dcf34..3a9b993 100644
--- a/libphobos/libdruntime/core/sys/posix/grp.d
+++ b/libphobos/libdruntime/core/sys/posix/grp.d
@@ -30,7 +30,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/iconv.d b/libphobos/libdruntime/core/sys/posix/iconv.d
index cea8987..e588fb8 100644
--- a/libphobos/libdruntime/core/sys/posix/iconv.d
+++ b/libphobos/libdruntime/core/sys/posix/iconv.d
@@ -34,7 +34,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
alias void* iconv_t;
diff --git a/libphobos/libdruntime/core/sys/posix/inttypes.d b/libphobos/libdruntime/core/sys/posix/inttypes.d
index 4bde28f..e0a4473 100644
--- a/libphobos/libdruntime/core/sys/posix/inttypes.d
+++ b/libphobos/libdruntime/core/sys/posix/inttypes.d
@@ -19,7 +19,6 @@ public import core.stdc.inttypes;
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/libgen.d b/libphobos/libdruntime/core/sys/posix/libgen.d
index b90765f..6770cd8 100644
--- a/libphobos/libdruntime/core/sys/posix/libgen.d
+++ b/libphobos/libdruntime/core/sys/posix/libgen.d
@@ -15,7 +15,6 @@
module core.sys.posix.libgen;
@nogc nothrow:
-@system:
extern (C):
version (Posix):
diff --git a/libphobos/libdruntime/core/sys/posix/locale.d b/libphobos/libdruntime/core/sys/posix/locale.d
index 85e2fb6..0864f7c 100644
--- a/libphobos/libdruntime/core/sys/posix/locale.d
+++ b/libphobos/libdruntime/core/sys/posix/locale.d
@@ -12,7 +12,6 @@ module core.sys.posix.locale;
version (Posix):
extern(C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/posix/mqueue.d b/libphobos/libdruntime/core/sys/posix/mqueue.d
index 7085fc4..ac697bf 100644
--- a/libphobos/libdruntime/core/sys/posix/mqueue.d
+++ b/libphobos/libdruntime/core/sys/posix/mqueue.d
@@ -31,7 +31,6 @@ version (Posix):
version (CRuntime_Glibc):
extern (C):
@nogc nothrow:
-@system:
/// Message queue descriptor.
diff --git a/libphobos/libdruntime/core/sys/posix/netdb.d b/libphobos/libdruntime/core/sys/posix/netdb.d
index d1411ea..70a5fe1 100644
--- a/libphobos/libdruntime/core/sys/posix/netdb.d
+++ b/libphobos/libdruntime/core/sys/posix/netdb.d
@@ -33,7 +33,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/poll.d b/libphobos/libdruntime/core/sys/posix/poll.d
index 7c2d570..5901f62 100644
--- a/libphobos/libdruntime/core/sys/posix/poll.d
+++ b/libphobos/libdruntime/core/sys/posix/poll.d
@@ -29,7 +29,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// XOpen (XSI)
diff --git a/libphobos/libdruntime/core/sys/posix/pthread.d b/libphobos/libdruntime/core/sys/posix/pthread.d
index 395ed0f..6c5f1a9 100644
--- a/libphobos/libdruntime/core/sys/posix/pthread.d
+++ b/libphobos/libdruntime/core/sys/posix/pthread.d
@@ -33,7 +33,6 @@ else version (WatchOS)
version (Posix):
extern (C)
nothrow:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/pwd.d b/libphobos/libdruntime/core/sys/posix/pwd.d
index e7ddda7..e2a77de 100644
--- a/libphobos/libdruntime/core/sys/posix/pwd.d
+++ b/libphobos/libdruntime/core/sys/posix/pwd.d
@@ -30,7 +30,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/sched.d b/libphobos/libdruntime/core/sys/posix/sched.d
index 35463d4..f6f0a58 100644
--- a/libphobos/libdruntime/core/sys/posix/sched.d
+++ b/libphobos/libdruntime/core/sys/posix/sched.d
@@ -32,7 +32,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/semaphore.d b/libphobos/libdruntime/core/sys/posix/semaphore.d
index a163e59..d755f86 100644
--- a/libphobos/libdruntime/core/sys/posix/semaphore.d
+++ b/libphobos/libdruntime/core/sys/posix/semaphore.d
@@ -30,7 +30,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/setjmp.d b/libphobos/libdruntime/core/sys/posix/setjmp.d
index 5a15d82..0d43c61 100644
--- a/libphobos/libdruntime/core/sys/posix/setjmp.d
+++ b/libphobos/libdruntime/core/sys/posix/setjmp.d
@@ -19,7 +19,6 @@ import core.sys.posix.signal; // for sigset_t
version (Posix):
extern (C) nothrow @nogc:
-@system:
version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any;
diff --git a/libphobos/libdruntime/core/sys/posix/spawn.d b/libphobos/libdruntime/core/sys/posix/spawn.d
index 2064962..7890533 100644
--- a/libphobos/libdruntime/core/sys/posix/spawn.d
+++ b/libphobos/libdruntime/core/sys/posix/spawn.d
@@ -49,7 +49,6 @@ public import core.sys.posix.sched : sched_param;
extern(C):
@nogc:
nothrow:
-@system:
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t*, int);
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t*, int, int);
diff --git a/libphobos/libdruntime/core/sys/posix/stdio.d b/libphobos/libdruntime/core/sys/posix/stdio.d
index d0d3d60..d379989 100644
--- a/libphobos/libdruntime/core/sys/posix/stdio.d
+++ b/libphobos/libdruntime/core/sys/posix/stdio.d
@@ -32,7 +32,6 @@ extern (C):
nothrow:
@nogc:
-@system:
//
// Required (defined in core.stdc.stdio)
diff --git a/libphobos/libdruntime/core/sys/posix/stdlib.d b/libphobos/libdruntime/core/sys/posix/stdlib.d
index df96a3d..8dd7b68 100644
--- a/libphobos/libdruntime/core/sys/posix/stdlib.d
+++ b/libphobos/libdruntime/core/sys/posix/stdlib.d
@@ -31,7 +31,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required (defined in core.stdc.stdlib)
diff --git a/libphobos/libdruntime/core/sys/posix/string.d b/libphobos/libdruntime/core/sys/posix/string.d
index 79d2562..8c4ea38 100644
--- a/libphobos/libdruntime/core/sys/posix/string.d
+++ b/libphobos/libdruntime/core/sys/posix/string.d
@@ -16,7 +16,6 @@ module core.sys.posix.string;
version (Posix):
extern(C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/posix/strings.d b/libphobos/libdruntime/core/sys/posix/strings.d
index 96fbccc..768a47f 100644
--- a/libphobos/libdruntime/core/sys/posix/strings.d
+++ b/libphobos/libdruntime/core/sys/posix/strings.d
@@ -15,7 +15,6 @@ module core.sys.posix.strings;
version (Posix):
extern(C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/posix/sys/filio.d b/libphobos/libdruntime/core/sys/posix/sys/filio.d
index a8d837c..bedbd6a 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/filio.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/filio.d
@@ -20,7 +20,6 @@ else version (WatchOS)
version (Posix):
nothrow @nogc:
-@system:
version (Darwin)
{
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ioccom.d b/libphobos/libdruntime/core/sys/posix/sys/ioccom.d
index 4a0e96b..3691765 100755
--- a/libphobos/libdruntime/core/sys/posix/sys/ioccom.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/ioccom.d
@@ -18,7 +18,6 @@ else version (WatchOS)
version (Posix):
nothrow @nogc:
-@system:
version (Darwin)
{
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ioctl.d b/libphobos/libdruntime/core/sys/posix/sys/ioctl.d
index 36d1edc..caf3eba 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/ioctl.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/ioctl.d
@@ -29,7 +29,6 @@ else version (WatchOS)
version (Posix):
extern (C) nothrow @nogc:
-@system:
version (linux)
{
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ipc.d b/libphobos/libdruntime/core/sys/posix/sys/ipc.d
index 1718243..32caba9 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/ipc.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/ipc.d
@@ -28,7 +28,6 @@ else version (WatchOS)
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// XOpen (XSI)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d
index 430f215..0d3d517 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d
@@ -45,7 +45,6 @@ version (X86_64) version = X86_Any;
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// Advisory Information (ADV)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/msg.d b/libphobos/libdruntime/core/sys/posix/sys/msg.d
index 4760f2e..208e5c2 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/msg.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/msg.d
@@ -14,7 +14,6 @@ import core.stdc.config;
version (CRuntime_Glibc):
// Some of these may be from linux kernel headers.
extern (C):
-@system:
version (ARM) version = ARM_Any;
version (AArch64) version = ARM_Any;
diff --git a/libphobos/libdruntime/core/sys/posix/sys/resource.d b/libphobos/libdruntime/core/sys/posix/sys/resource.d
index 5ab0174..1f46f03 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/resource.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/resource.d
@@ -23,7 +23,6 @@ else version (WatchOS)
version = Darwin;
nothrow @nogc extern(C):
-@system:
//
// XOpen (XSI)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/select.d b/libphobos/libdruntime/core/sys/posix/sys/select.d
index 925976d..06b0940 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/select.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/select.d
@@ -27,7 +27,6 @@ else version (WatchOS)
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/sys/shm.d b/libphobos/libdruntime/core/sys/posix/sys/shm.d
index d04e792..6ecdc0d 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/shm.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/shm.d
@@ -29,7 +29,6 @@ else version (WatchOS)
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// XOpen (XSI)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
index fc5dc5d..340f3ce 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
@@ -45,7 +45,6 @@ version (X86_64) version = X86_Any;
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
index 1fb4e44..ecc98cc 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d
@@ -35,7 +35,6 @@ version (SPARC64) version = SPARC_Any;
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d
index df9030d..eae0e5c 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d
@@ -16,7 +16,6 @@ version (Posix):
extern (C) :
nothrow:
@nogc:
-@system:
version (CRuntime_Glibc) {
static if (__WORDSIZE == 32)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/time.d b/libphobos/libdruntime/core/sys/posix/sys/time.d
index 95cf883..b536eed 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/time.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/time.d
@@ -31,7 +31,6 @@ version (linux) public import core.sys.linux.sys.time;
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// XOpen (XSI)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ttycom.d b/libphobos/libdruntime/core/sys/posix/sys/ttycom.d
index 0cc2d9c..f4c9c58 100755
--- a/libphobos/libdruntime/core/sys/posix/sys/ttycom.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/ttycom.d
@@ -22,7 +22,6 @@ else version (WatchOS)
version (Posix):
nothrow @nogc:
-@system:
version (Darwin)
{
diff --git a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
index 3e515c4..cd11b0d 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d
@@ -30,7 +30,6 @@ else version (WatchOS)
version (Posix):
extern (C):
-@system:
//
// bits/typesizes.h -- underlying types for *_t.
diff --git a/libphobos/libdruntime/core/sys/posix/sys/uio.d b/libphobos/libdruntime/core/sys/posix/sys/uio.d
index 2563c6d..e283963 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/uio.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/uio.d
@@ -28,7 +28,6 @@ else version (WatchOS)
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/sys/un.d b/libphobos/libdruntime/core/sys/posix/sys/un.d
index 5030e16..11e98a7 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/un.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/un.d
@@ -25,7 +25,6 @@ else version (WatchOS)
version (Posix):
extern(C):
-@system:
public import core.sys.posix.sys.socket: sa_family_t;
diff --git a/libphobos/libdruntime/core/sys/posix/sys/utsname.d b/libphobos/libdruntime/core/sys/posix/sys/utsname.d
index 0abbf14..5de50ac 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/utsname.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/utsname.d
@@ -16,7 +16,6 @@ version (Posix):
extern(C):
nothrow:
@nogc:
-@system:
version (CRuntime_Glibc)
{
diff --git a/libphobos/libdruntime/core/sys/posix/sys/wait.d b/libphobos/libdruntime/core/sys/posix/sys/wait.d
index 91b9c9e..766a4e0 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/wait.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/wait.d
@@ -30,7 +30,6 @@ else version (WatchOS)
version (Posix):
extern (C) nothrow @nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/syslog.d b/libphobos/libdruntime/core/sys/posix/syslog.d
index cf85664..ba2a4ac 100644
--- a/libphobos/libdruntime/core/sys/posix/syslog.d
+++ b/libphobos/libdruntime/core/sys/posix/syslog.d
@@ -27,7 +27,6 @@ else version (WatchOS)
version (Posix):
extern (C) nothrow @nogc:
-@system:
version (CRuntime_Glibc)
{
diff --git a/libphobos/libdruntime/core/sys/posix/termios.d b/libphobos/libdruntime/core/sys/posix/termios.d
index 357060b..e4a99e6 100644
--- a/libphobos/libdruntime/core/sys/posix/termios.d
+++ b/libphobos/libdruntime/core/sys/posix/termios.d
@@ -31,7 +31,6 @@ extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/posix/time.d b/libphobos/libdruntime/core/sys/posix/time.d
index ff3a3c4..af52002 100644
--- a/libphobos/libdruntime/core/sys/posix/time.d
+++ b/libphobos/libdruntime/core/sys/posix/time.d
@@ -33,7 +33,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required (defined in core.stdc.time)
diff --git a/libphobos/libdruntime/core/sys/posix/ucontext.d b/libphobos/libdruntime/core/sys/posix/ucontext.d
index e8c2f87..512d730 100644
--- a/libphobos/libdruntime/core/sys/posix/ucontext.d
+++ b/libphobos/libdruntime/core/sys/posix/ucontext.d
@@ -22,7 +22,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
version (OSX)
version = Darwin;
diff --git a/libphobos/libdruntime/core/sys/posix/unistd.d b/libphobos/libdruntime/core/sys/posix/unistd.d
index d996556..d1300e1 100644
--- a/libphobos/libdruntime/core/sys/posix/unistd.d
+++ b/libphobos/libdruntime/core/sys/posix/unistd.d
@@ -32,7 +32,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
enum STDIN_FILENO = 0;
enum STDOUT_FILENO = 1;
diff --git a/libphobos/libdruntime/core/sys/posix/utime.d b/libphobos/libdruntime/core/sys/posix/utime.d
index 66aea58..fcec7af 100644
--- a/libphobos/libdruntime/core/sys/posix/utime.d
+++ b/libphobos/libdruntime/core/sys/posix/utime.d
@@ -30,7 +30,6 @@ version (Posix):
extern (C):
nothrow:
@nogc:
-@system:
//
// Required
diff --git a/libphobos/libdruntime/core/sys/windows/aclapi.d b/libphobos/libdruntime/core/sys/windows/aclapi.d
index f145ac2..4905351 100644
--- a/libphobos/libdruntime/core/sys/windows/aclapi.d
+++ b/libphobos/libdruntime/core/sys/windows/aclapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.aclapi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "advapi32");
diff --git a/libphobos/libdruntime/core/sys/windows/aclui.d b/libphobos/libdruntime/core/sys/windows/aclui.d
index c5a2899..08be626 100644
--- a/libphobos/libdruntime/core/sys/windows/aclui.d
+++ b/libphobos/libdruntime/core/sys/windows/aclui.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.aclui;
version (Windows):
-@system:
pragma(lib, "aclui");
import core.sys.windows.w32api;
diff --git a/libphobos/libdruntime/core/sys/windows/basetsd.d b/libphobos/libdruntime/core/sys/windows/basetsd.d
index 0c68902..3c5c35f 100644
--- a/libphobos/libdruntime/core/sys/windows/basetsd.d
+++ b/libphobos/libdruntime/core/sys/windows/basetsd.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.basetsd;
version (Windows):
-@system:
/* This template is used in these modules to declare constant pointer types,
* in order to support both D 1.x and 2.x.
diff --git a/libphobos/libdruntime/core/sys/windows/basetyps.d b/libphobos/libdruntime/core/sys/windows/basetyps.d
index 086e6ab..d90d9f3 100644
--- a/libphobos/libdruntime/core/sys/windows/basetyps.d
+++ b/libphobos/libdruntime/core/sys/windows/basetyps.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.basetyps;
version (Windows):
-@system:
import core.sys.windows.windef, core.sys.windows.basetsd;
diff --git a/libphobos/libdruntime/core/sys/windows/com.d b/libphobos/libdruntime/core/sys/windows/com.d
index 6935dd9..c724f1c 100644
--- a/libphobos/libdruntime/core/sys/windows/com.d
+++ b/libphobos/libdruntime/core/sys/windows/com.d
@@ -1,6 +1,5 @@
module core.sys.windows.com;
version (Windows):
-@system:
pragma(lib,"uuid");
diff --git a/libphobos/libdruntime/core/sys/windows/comcat.d b/libphobos/libdruntime/core/sys/windows/comcat.d
index 3018c64..4cc35f4 100644
--- a/libphobos/libdruntime/core/sys/windows/comcat.d
+++ b/libphobos/libdruntime/core/sys/windows/comcat.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.comcat;
version (Windows):
-@system:
import core.sys.windows.ole2;
import core.sys.windows.basetyps, core.sys.windows.cguid, core.sys.windows.objbase, core.sys.windows.unknwn,
diff --git a/libphobos/libdruntime/core/sys/windows/commctrl.d b/libphobos/libdruntime/core/sys/windows/commctrl.d
index 4bc60b1..dabee56 100644
--- a/libphobos/libdruntime/core/sys/windows/commctrl.d
+++ b/libphobos/libdruntime/core/sys/windows/commctrl.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.commctrl;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "comctl32");
diff --git a/libphobos/libdruntime/core/sys/windows/commdlg.d b/libphobos/libdruntime/core/sys/windows/commdlg.d
index b49d2fb..9be9a9f 100644
--- a/libphobos/libdruntime/core/sys/windows/commdlg.d
+++ b/libphobos/libdruntime/core/sys/windows/commdlg.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.commdlg;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "comdlg32");
diff --git a/libphobos/libdruntime/core/sys/windows/cpl.d b/libphobos/libdruntime/core/sys/windows/cpl.d
index 49ebb20..df98703 100644
--- a/libphobos/libdruntime/core/sys/windows/cpl.d
+++ b/libphobos/libdruntime/core/sys/windows/cpl.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.cpl;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/cplext.d b/libphobos/libdruntime/core/sys/windows/cplext.d
index e13316b..4aff3a9 100644
--- a/libphobos/libdruntime/core/sys/windows/cplext.d
+++ b/libphobos/libdruntime/core/sys/windows/cplext.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.cplext;
version (Windows):
-@system:
enum : uint {
CPLPAGE_MOUSE_BUTTONS = 1,
diff --git a/libphobos/libdruntime/core/sys/windows/custcntl.d b/libphobos/libdruntime/core/sys/windows/custcntl.d
index c736cb3..f9234ac 100644
--- a/libphobos/libdruntime/core/sys/windows/custcntl.d
+++ b/libphobos/libdruntime/core/sys/windows/custcntl.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.custcntl;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/dbghelp.d b/libphobos/libdruntime/core/sys/windows/dbghelp.d
index 96698e8..de14bce 100644
--- a/libphobos/libdruntime/core/sys/windows/dbghelp.d
+++ b/libphobos/libdruntime/core/sys/windows/dbghelp.d
@@ -11,7 +11,6 @@
module core.sys.windows.dbghelp;
version (Windows):
-@system:
import core.sys.windows.winbase /+: FreeLibrary, GetProcAddress, LoadLibraryA+/;
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/dbghelp_types.d b/libphobos/libdruntime/core/sys/windows/dbghelp_types.d
index 64477df..f75f98b 100644
--- a/libphobos/libdruntime/core/sys/windows/dbghelp_types.d
+++ b/libphobos/libdruntime/core/sys/windows/dbghelp_types.d
@@ -11,7 +11,6 @@
module core.sys.windows.dbghelp_types;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/dbt.d b/libphobos/libdruntime/core/sys/windows/dbt.d
index 308c609..41f1c32 100644
--- a/libphobos/libdruntime/core/sys/windows/dbt.d
+++ b/libphobos/libdruntime/core/sys/windows/dbt.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.dbt;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/dde.d b/libphobos/libdruntime/core/sys/windows/dde.d
index bec339c..d9b8bec 100644
--- a/libphobos/libdruntime/core/sys/windows/dde.d
+++ b/libphobos/libdruntime/core/sys/windows/dde.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.dde;
version (Windows):
-@system:
pragma(lib, "user32");
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/ddeml.d b/libphobos/libdruntime/core/sys/windows/ddeml.d
index 22b330c..00bad1d 100644
--- a/libphobos/libdruntime/core/sys/windows/ddeml.d
+++ b/libphobos/libdruntime/core/sys/windows/ddeml.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ddeml;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "user32");
diff --git a/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d b/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d
index 0d3d716..d21169a 100644
--- a/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d
+++ b/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.dhcpcsdk;
version (Windows):
-@system:
import core.sys.windows.w32api, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/dlgs.d b/libphobos/libdruntime/core/sys/windows/dlgs.d
index 34cab9b..5256862 100644
--- a/libphobos/libdruntime/core/sys/windows/dlgs.d
+++ b/libphobos/libdruntime/core/sys/windows/dlgs.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.dlgs;
version (Windows):
-@system:
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/dll.d b/libphobos/libdruntime/core/sys/windows/dll.d
index d602347..367c1d9 100644
--- a/libphobos/libdruntime/core/sys/windows/dll.d
+++ b/libphobos/libdruntime/core/sys/windows/dll.d
@@ -14,7 +14,6 @@
*/
module core.sys.windows.dll;
version (Windows):
-@system:
import core.sys.windows.winbase;
import core.sys.windows.winnt;
diff --git a/libphobos/libdruntime/core/sys/windows/docobj.d b/libphobos/libdruntime/core/sys/windows/docobj.d
index 4e45693..4abbea3 100644
--- a/libphobos/libdruntime/core/sys/windows/docobj.d
+++ b/libphobos/libdruntime/core/sys/windows/docobj.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.docobj;
version (Windows):
-@system:
import core.sys.windows.basetyps, core.sys.windows.oaidl, core.sys.windows.objidl, core.sys.windows.oleidl,
core.sys.windows.unknwn, core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/errorrep.d b/libphobos/libdruntime/core/sys/windows/errorrep.d
index 63ec8d7..42fad9a 100644
--- a/libphobos/libdruntime/core/sys/windows/errorrep.d
+++ b/libphobos/libdruntime/core/sys/windows/errorrep.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.errorrep;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/exdisp.d b/libphobos/libdruntime/core/sys/windows/exdisp.d
index 8ee3c26..5a9ea98 100644
--- a/libphobos/libdruntime/core/sys/windows/exdisp.d
+++ b/libphobos/libdruntime/core/sys/windows/exdisp.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.exdisp;
version (Windows):
-@system:
import core.sys.windows.docobj, core.sys.windows.oaidl, core.sys.windows.ocidl;
import core.sys.windows.basetyps, core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/httpext.d b/libphobos/libdruntime/core/sys/windows/httpext.d
index 4e07c6a..6973879 100644
--- a/libphobos/libdruntime/core/sys/windows/httpext.d
+++ b/libphobos/libdruntime/core/sys/windows/httpext.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.httpext;
version (Windows):
-@system:
/* Comment from MinGW
httpext.h - Header for ISAPI extensions.
diff --git a/libphobos/libdruntime/core/sys/windows/imagehlp.d b/libphobos/libdruntime/core/sys/windows/imagehlp.d
index ed93746..399c0b2 100644
--- a/libphobos/libdruntime/core/sys/windows/imagehlp.d
+++ b/libphobos/libdruntime/core/sys/windows/imagehlp.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.imagehlp;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/imm.d b/libphobos/libdruntime/core/sys/windows/imm.d
index 128fd56..4ad678c 100644
--- a/libphobos/libdruntime/core/sys/windows/imm.d
+++ b/libphobos/libdruntime/core/sys/windows/imm.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.imm;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "imm32");
diff --git a/libphobos/libdruntime/core/sys/windows/intshcut.d b/libphobos/libdruntime/core/sys/windows/intshcut.d
index eab7a8d..ab662e4 100644
--- a/libphobos/libdruntime/core/sys/windows/intshcut.d
+++ b/libphobos/libdruntime/core/sys/windows/intshcut.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.intshcut;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/ipexport.d b/libphobos/libdruntime/core/sys/windows/ipexport.d
index dbb4a0e..b0a4a01 100644
--- a/libphobos/libdruntime/core/sys/windows/ipexport.d
+++ b/libphobos/libdruntime/core/sys/windows/ipexport.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ipexport;
version (Windows):
-@system:
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/iphlpapi.d b/libphobos/libdruntime/core/sys/windows/iphlpapi.d
index f95e799..4a8e64c 100644
--- a/libphobos/libdruntime/core/sys/windows/iphlpapi.d
+++ b/libphobos/libdruntime/core/sys/windows/iphlpapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.iphlpapi;
version (Windows):
-@system:
import core.sys.windows.ipexport, core.sys.windows.iprtrmib, core.sys.windows.iptypes;
import core.sys.windows.winbase, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/iprtrmib.d b/libphobos/libdruntime/core/sys/windows/iprtrmib.d
index 3db4539..05c31b3 100644
--- a/libphobos/libdruntime/core/sys/windows/iprtrmib.d
+++ b/libphobos/libdruntime/core/sys/windows/iprtrmib.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.iprtrmib;
version (Windows):
-@system:
import core.sys.windows.ipifcons;
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/iptypes.d b/libphobos/libdruntime/core/sys/windows/iptypes.d
index 7cce34b..baaf6ae 100644
--- a/libphobos/libdruntime/core/sys/windows/iptypes.d
+++ b/libphobos/libdruntime/core/sys/windows/iptypes.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.iptypes;
version (Windows):
-@system:
import core.sys.windows.windef;
import core.stdc.time;
diff --git a/libphobos/libdruntime/core/sys/windows/lm.d b/libphobos/libdruntime/core/sys/windows/lm.d
index 3d48856..115925c 100644
--- a/libphobos/libdruntime/core/sys/windows/lm.d
+++ b/libphobos/libdruntime/core/sys/windows/lm.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lm;
version (Windows):
-@system:
/* removed - now supporting only Win2k up
version (WindowsVista) {
diff --git a/libphobos/libdruntime/core/sys/windows/lmaccess.d b/libphobos/libdruntime/core/sys/windows/lmaccess.d
index b23e52e..9791ff6 100644
--- a/libphobos/libdruntime/core/sys/windows/lmaccess.d
+++ b/libphobos/libdruntime/core/sys/windows/lmaccess.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmaccess;
version (Windows):
-@system:
pragma(lib, "netapi32");
/**
diff --git a/libphobos/libdruntime/core/sys/windows/lmalert.d b/libphobos/libdruntime/core/sys/windows/lmalert.d
index 5ddd6d0..ad0c3ca 100644
--- a/libphobos/libdruntime/core/sys/windows/lmalert.d
+++ b/libphobos/libdruntime/core/sys/windows/lmalert.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmalert;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmat.d b/libphobos/libdruntime/core/sys/windows/lmat.d
index 3e1468a..ee1249e 100644
--- a/libphobos/libdruntime/core/sys/windows/lmat.d
+++ b/libphobos/libdruntime/core/sys/windows/lmat.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmat;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmaudit.d b/libphobos/libdruntime/core/sys/windows/lmaudit.d
index f4a7ca2..8db56f1 100644
--- a/libphobos/libdruntime/core/sys/windows/lmaudit.d
+++ b/libphobos/libdruntime/core/sys/windows/lmaudit.d
@@ -9,7 +9,6 @@
// COMMENT: This file may be deprecated.
module core.sys.windows.lmaudit;
version (Windows):
-@system:
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmbrowsr.d b/libphobos/libdruntime/core/sys/windows/lmbrowsr.d
index ea0e0f3..16cc661 100644
--- a/libphobos/libdruntime/core/sys/windows/lmbrowsr.d
+++ b/libphobos/libdruntime/core/sys/windows/lmbrowsr.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmbrowsr;
version (Windows):
-@system:
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmchdev.d b/libphobos/libdruntime/core/sys/windows/lmchdev.d
index 00aaafc..55460e1 100644
--- a/libphobos/libdruntime/core/sys/windows/lmchdev.d
+++ b/libphobos/libdruntime/core/sys/windows/lmchdev.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmchdev;
version (Windows):
-@system:
// COMMENT: This file might be deprecated.
diff --git a/libphobos/libdruntime/core/sys/windows/lmconfig.d b/libphobos/libdruntime/core/sys/windows/lmconfig.d
index 57d3ed9..6652a52 100644
--- a/libphobos/libdruntime/core/sys/windows/lmconfig.d
+++ b/libphobos/libdruntime/core/sys/windows/lmconfig.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmconfig;
version (Windows):
-@system:
// All functions in this file are deprecated!
diff --git a/libphobos/libdruntime/core/sys/windows/lmcons.d b/libphobos/libdruntime/core/sys/windows/lmcons.d
index 69a63df..838748a 100644
--- a/libphobos/libdruntime/core/sys/windows/lmcons.d
+++ b/libphobos/libdruntime/core/sys/windows/lmcons.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmcons;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/lmerr.d b/libphobos/libdruntime/core/sys/windows/lmerr.d
index d50ec49..23f5e59 100644
--- a/libphobos/libdruntime/core/sys/windows/lmerr.d
+++ b/libphobos/libdruntime/core/sys/windows/lmerr.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmerr;
version (Windows):
-@system:
import core.sys.windows.winerror;
diff --git a/libphobos/libdruntime/core/sys/windows/lmerrlog.d b/libphobos/libdruntime/core/sys/windows/lmerrlog.d
index a49b498..effe73a 100644
--- a/libphobos/libdruntime/core/sys/windows/lmerrlog.d
+++ b/libphobos/libdruntime/core/sys/windows/lmerrlog.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmerrlog;
version (Windows):
-@system:
// COMMENT: This appears to be only for Win16. All functions are deprecated.
diff --git a/libphobos/libdruntime/core/sys/windows/lmmsg.d b/libphobos/libdruntime/core/sys/windows/lmmsg.d
index c87f1e0..a3abd60 100644
--- a/libphobos/libdruntime/core/sys/windows/lmmsg.d
+++ b/libphobos/libdruntime/core/sys/windows/lmmsg.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmmsg;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmcons, core.sys.windows.windef, core.sys.windows.w32api;
diff --git a/libphobos/libdruntime/core/sys/windows/lmremutl.d b/libphobos/libdruntime/core/sys/windows/lmremutl.d
index d0f3b41..8c90df7 100644
--- a/libphobos/libdruntime/core/sys/windows/lmremutl.d
+++ b/libphobos/libdruntime/core/sys/windows/lmremutl.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmremutl;
version (Windows):
-@system:
pragma(lib, "netapi32");
// D Conversion Note: DESC_CHAR is defined as TCHAR.
diff --git a/libphobos/libdruntime/core/sys/windows/lmrepl.d b/libphobos/libdruntime/core/sys/windows/lmrepl.d
index 093588c..1563a5e 100644
--- a/libphobos/libdruntime/core/sys/windows/lmrepl.d
+++ b/libphobos/libdruntime/core/sys/windows/lmrepl.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmrepl;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmserver.d b/libphobos/libdruntime/core/sys/windows/lmserver.d
index fad5bc5..5a550bc 100644
--- a/libphobos/libdruntime/core/sys/windows/lmserver.d
+++ b/libphobos/libdruntime/core/sys/windows/lmserver.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmserver;
version (Windows):
-@system:
import core.sys.windows.winsvc;
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmshare.d b/libphobos/libdruntime/core/sys/windows/lmshare.d
index d81080e..bd8eecb 100644
--- a/libphobos/libdruntime/core/sys/windows/lmshare.d
+++ b/libphobos/libdruntime/core/sys/windows/lmshare.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmshare;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmcons;
diff --git a/libphobos/libdruntime/core/sys/windows/lmsname.d b/libphobos/libdruntime/core/sys/windows/lmsname.d
index 09b1b00..a8f4f76 100644
--- a/libphobos/libdruntime/core/sys/windows/lmsname.d
+++ b/libphobos/libdruntime/core/sys/windows/lmsname.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmsname;
version (Windows):
-@system:
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmstats.d b/libphobos/libdruntime/core/sys/windows/lmstats.d
index 4baa390..e83808b 100644
--- a/libphobos/libdruntime/core/sys/windows/lmstats.d
+++ b/libphobos/libdruntime/core/sys/windows/lmstats.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmstats;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/lmsvc.d b/libphobos/libdruntime/core/sys/windows/lmsvc.d
index c0df699..ddea61c 100644
--- a/libphobos/libdruntime/core/sys/windows/lmsvc.d
+++ b/libphobos/libdruntime/core/sys/windows/lmsvc.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmsvc;
version (Windows):
-@system:
// FIXME: Is this file deprecated? All of the functions are only for Win16.
/**
diff --git a/libphobos/libdruntime/core/sys/windows/lmuse.d b/libphobos/libdruntime/core/sys/windows/lmuse.d
index 03e153a..a48d72e 100644
--- a/libphobos/libdruntime/core/sys/windows/lmuse.d
+++ b/libphobos/libdruntime/core/sys/windows/lmuse.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmuse;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmuseflg;
diff --git a/libphobos/libdruntime/core/sys/windows/lmwksta.d b/libphobos/libdruntime/core/sys/windows/lmwksta.d
index cdd3a07..29ddca7 100644
--- a/libphobos/libdruntime/core/sys/windows/lmwksta.d
+++ b/libphobos/libdruntime/core/sys/windows/lmwksta.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lmwksta;
version (Windows):
-@system:
pragma(lib, "netapi32");
import core.sys.windows.lmuseflg;
diff --git a/libphobos/libdruntime/core/sys/windows/lzexpand.d b/libphobos/libdruntime/core/sys/windows/lzexpand.d
index a01489b..6c3bd00 100644
--- a/libphobos/libdruntime/core/sys/windows/lzexpand.d
+++ b/libphobos/libdruntime/core/sys/windows/lzexpand.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.lzexpand;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "lz32");
diff --git a/libphobos/libdruntime/core/sys/windows/mapi.d b/libphobos/libdruntime/core/sys/windows/mapi.d
index 06fd955..8f8eea1 100644
--- a/libphobos/libdruntime/core/sys/windows/mapi.d
+++ b/libphobos/libdruntime/core/sys/windows/mapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.mapi;
version (Windows):
-@system:
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/mciavi.d b/libphobos/libdruntime/core/sys/windows/mciavi.d
index 4e3d14e..08410f5 100644
--- a/libphobos/libdruntime/core/sys/windows/mciavi.d
+++ b/libphobos/libdruntime/core/sys/windows/mciavi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.mciavi;
version (Windows):
-@system:
import core.sys.windows.mmsystem;
diff --git a/libphobos/libdruntime/core/sys/windows/mcx.d b/libphobos/libdruntime/core/sys/windows/mcx.d
index 0322413..5c6ac24 100644
--- a/libphobos/libdruntime/core/sys/windows/mcx.d
+++ b/libphobos/libdruntime/core/sys/windows/mcx.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.mcx;
version (Windows):
-@system:
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/mgmtapi.d b/libphobos/libdruntime/core/sys/windows/mgmtapi.d
index d9fb6b7..8f84eea 100644
--- a/libphobos/libdruntime/core/sys/windows/mgmtapi.d
+++ b/libphobos/libdruntime/core/sys/windows/mgmtapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.mgmtapi;
version (Windows):
-@system:
import core.sys.windows.snmp;
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/mmsystem.d b/libphobos/libdruntime/core/sys/windows/mmsystem.d
index 5c3d920..7e7c34b 100644
--- a/libphobos/libdruntime/core/sys/windows/mmsystem.d
+++ b/libphobos/libdruntime/core/sys/windows/mmsystem.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.mmsystem;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "winmm");
diff --git a/libphobos/libdruntime/core/sys/windows/msacm.d b/libphobos/libdruntime/core/sys/windows/msacm.d
index 4726328..645e40d 100644
--- a/libphobos/libdruntime/core/sys/windows/msacm.d
+++ b/libphobos/libdruntime/core/sys/windows/msacm.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.msacm;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/mshtml.d b/libphobos/libdruntime/core/sys/windows/mshtml.d
index d5cf7cb..d20c4bb 100644
--- a/libphobos/libdruntime/core/sys/windows/mshtml.d
+++ b/libphobos/libdruntime/core/sys/windows/mshtml.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.mshtml;
version (Windows):
-@system:
import core.sys.windows.basetyps, core.sys.windows.oaidl, core.sys.windows.unknwn,
core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/mswsock.d b/libphobos/libdruntime/core/sys/windows/mswsock.d
index 27c0cdb..d8beee4 100644
--- a/libphobos/libdruntime/core/sys/windows/mswsock.d
+++ b/libphobos/libdruntime/core/sys/windows/mswsock.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.mswsock;
version (Windows):
-@system:
import core.sys.windows.winbase, core.sys.windows.windef;
import core.sys.windows.basetyps, core.sys.windows.w32api;
diff --git a/libphobos/libdruntime/core/sys/windows/nb30.d b/libphobos/libdruntime/core/sys/windows/nb30.d
index 8f92edd..cfa57d6 100644
--- a/libphobos/libdruntime/core/sys/windows/nb30.d
+++ b/libphobos/libdruntime/core/sys/windows/nb30.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.nb30;
version (Windows):
-@system:
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/nddeapi.d b/libphobos/libdruntime/core/sys/windows/nddeapi.d
index dc3890c..3efca62 100644
--- a/libphobos/libdruntime/core/sys/windows/nddeapi.d
+++ b/libphobos/libdruntime/core/sys/windows/nddeapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.nddeapi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/nspapi.d b/libphobos/libdruntime/core/sys/windows/nspapi.d
index 79c9fce..bac6526 100644
--- a/libphobos/libdruntime/core/sys/windows/nspapi.d
+++ b/libphobos/libdruntime/core/sys/windows/nspapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.nspapi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/ntdef.d b/libphobos/libdruntime/core/sys/windows/ntdef.d
index 78e60e7..a0213dc 100644
--- a/libphobos/libdruntime/core/sys/windows/ntdef.d
+++ b/libphobos/libdruntime/core/sys/windows/ntdef.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ntdef;
version (Windows):
-@system:
import core.sys.windows.basetsd, core.sys.windows.subauth, core.sys.windows.windef, core.sys.windows.winnt;
diff --git a/libphobos/libdruntime/core/sys/windows/ntdll.d b/libphobos/libdruntime/core/sys/windows/ntdll.d
index 4ac1bcc..28d560c 100644
--- a/libphobos/libdruntime/core/sys/windows/ntdll.d
+++ b/libphobos/libdruntime/core/sys/windows/ntdll.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ntdll;
version (Windows):
-@system:
import core.sys.windows.w32api;
diff --git a/libphobos/libdruntime/core/sys/windows/ntldap.d b/libphobos/libdruntime/core/sys/windows/ntldap.d
index 52cadde..8f9abfe 100644
--- a/libphobos/libdruntime/core/sys/windows/ntldap.d
+++ b/libphobos/libdruntime/core/sys/windows/ntldap.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ntldap;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/ntsecapi.d b/libphobos/libdruntime/core/sys/windows/ntsecapi.d
index 1118057..fbc6b7f 100644
--- a/libphobos/libdruntime/core/sys/windows/ntsecapi.d
+++ b/libphobos/libdruntime/core/sys/windows/ntsecapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ntsecapi;
version (Windows):
-@system:
pragma(lib, "advapi32");
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/ntsecpkg.d b/libphobos/libdruntime/core/sys/windows/ntsecpkg.d
index d8c5e95..56803b0 100644
--- a/libphobos/libdruntime/core/sys/windows/ntsecpkg.d
+++ b/libphobos/libdruntime/core/sys/windows/ntsecpkg.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ntsecpkg;
version (Windows):
-@system:
import core.sys.windows.windef, core.sys.windows.ntsecapi, core.sys.windows.security, core.sys.windows.ntdef, core.sys.windows.sspi;
import core.sys.windows.basetyps : GUID;
diff --git a/libphobos/libdruntime/core/sys/windows/oaidl.d b/libphobos/libdruntime/core/sys/windows/oaidl.d
index 6c93682..cd11061 100644
--- a/libphobos/libdruntime/core/sys/windows/oaidl.d
+++ b/libphobos/libdruntime/core/sys/windows/oaidl.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.oaidl;
version (Windows):
-@system:
import core.sys.windows.basetyps, core.sys.windows.unknwn, core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/objbase.d b/libphobos/libdruntime/core/sys/windows/objbase.d
index bb9e7ea0..350c2b8 100644
--- a/libphobos/libdruntime/core/sys/windows/objbase.d
+++ b/libphobos/libdruntime/core/sys/windows/objbase.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.objbase;
version (Windows):
-@system:
nothrow:
pragma(lib, "ole32");
diff --git a/libphobos/libdruntime/core/sys/windows/objfwd.d b/libphobos/libdruntime/core/sys/windows/objfwd.d
index 89d5cad..076e02e 100644
--- a/libphobos/libdruntime/core/sys/windows/objfwd.d
+++ b/libphobos/libdruntime/core/sys/windows/objfwd.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.objfwd;
version (Windows):
-@system:
import core.sys.windows.objidl;
diff --git a/libphobos/libdruntime/core/sys/windows/objidl.d b/libphobos/libdruntime/core/sys/windows/objidl.d
index 528c58b..aa51840 100644
--- a/libphobos/libdruntime/core/sys/windows/objidl.d
+++ b/libphobos/libdruntime/core/sys/windows/objidl.d
@@ -12,7 +12,6 @@
// # do we need the proxies that are defined in this file?
module core.sys.windows.objidl;
version (Windows):
-@system:
import core.sys.windows.unknwn;
import core.sys.windows.objfwd;
diff --git a/libphobos/libdruntime/core/sys/windows/objsafe.d b/libphobos/libdruntime/core/sys/windows/objsafe.d
index 449a4c3..f7dc445 100644
--- a/libphobos/libdruntime/core/sys/windows/objsafe.d
+++ b/libphobos/libdruntime/core/sys/windows/objsafe.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.objsafe;
version (Windows):
-@system:
import core.sys.windows.basetyps, core.sys.windows.unknwn, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/ocidl.d b/libphobos/libdruntime/core/sys/windows/ocidl.d
index af42bea..9bacbf0 100644
--- a/libphobos/libdruntime/core/sys/windows/ocidl.d
+++ b/libphobos/libdruntime/core/sys/windows/ocidl.d
@@ -10,7 +10,6 @@
*/
module core.sys.windows.ocidl;
version (Windows):
-@system:
import core.sys.windows.ole2, core.sys.windows.oleidl, core.sys.windows.oaidl, core.sys.windows.objfwd,
core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/odbcinst.d b/libphobos/libdruntime/core/sys/windows/odbcinst.d
index b0ca42a..ebacb58 100644
--- a/libphobos/libdruntime/core/sys/windows/odbcinst.d
+++ b/libphobos/libdruntime/core/sys/windows/odbcinst.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.odbcinst;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/ole.d b/libphobos/libdruntime/core/sys/windows/ole.d
index 21218f1..c29ec50 100644
--- a/libphobos/libdruntime/core/sys/windows/ole.d
+++ b/libphobos/libdruntime/core/sys/windows/ole.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.ole;
version (Windows):
-@system:
pragma(lib, "ole32");
import core.sys.windows.windef, core.sys.windows.wingdi, core.sys.windows.uuid;
diff --git a/libphobos/libdruntime/core/sys/windows/ole2.d b/libphobos/libdruntime/core/sys/windows/ole2.d
index 0945fca..3fef058 100644
--- a/libphobos/libdruntime/core/sys/windows/ole2.d
+++ b/libphobos/libdruntime/core/sys/windows/ole2.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.ole2;
version (Windows):
-@system:
pragma(lib, "ole32");
public import core.sys.windows.basetyps, core.sys.windows.objbase, core.sys.windows.oleauto, core.sys.windows.olectlid,
diff --git a/libphobos/libdruntime/core/sys/windows/oleacc.d b/libphobos/libdruntime/core/sys/windows/oleacc.d
index 77137c6..b19855d 100644
--- a/libphobos/libdruntime/core/sys/windows/oleacc.d
+++ b/libphobos/libdruntime/core/sys/windows/oleacc.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.oleacc;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "oleacc");
diff --git a/libphobos/libdruntime/core/sys/windows/oleauto.d b/libphobos/libdruntime/core/sys/windows/oleauto.d
index f8d76e1..1888136 100644
--- a/libphobos/libdruntime/core/sys/windows/oleauto.d
+++ b/libphobos/libdruntime/core/sys/windows/oleauto.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.oleauto;
version (Windows):
-@system:
pragma(lib, "oleaut32");
import core.sys.windows.oaidl;
diff --git a/libphobos/libdruntime/core/sys/windows/olectl.d b/libphobos/libdruntime/core/sys/windows/olectl.d
index f671ce4..df8266b 100644
--- a/libphobos/libdruntime/core/sys/windows/olectl.d
+++ b/libphobos/libdruntime/core/sys/windows/olectl.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.olectl;
version (Windows):
-@system:
// In conversion from MinGW, the following was deleted:
//#define FONTSIZE(n) {n##0000, 0}
diff --git a/libphobos/libdruntime/core/sys/windows/oledlg.d b/libphobos/libdruntime/core/sys/windows/oledlg.d
index f1a0510..f810f6c 100644
--- a/libphobos/libdruntime/core/sys/windows/oledlg.d
+++ b/libphobos/libdruntime/core/sys/windows/oledlg.d
@@ -7,7 +7,6 @@
* Source: $(DRUNTIMESRC core/sys/windows/_oledlg.d)
*/
module core.sys.windows.oledlg;
-@system:
version (Windows):
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/oleidl.d b/libphobos/libdruntime/core/sys/windows/oleidl.d
index 4ef564d..17e1d64 100644
--- a/libphobos/libdruntime/core/sys/windows/oleidl.d
+++ b/libphobos/libdruntime/core/sys/windows/oleidl.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.oleidl;
version (Windows):
-@system:
// DAC: This is defined in ocidl !!
// what is it doing in here?
diff --git a/libphobos/libdruntime/core/sys/windows/pbt.d b/libphobos/libdruntime/core/sys/windows/pbt.d
index 3b65ba5..2689884 100644
--- a/libphobos/libdruntime/core/sys/windows/pbt.d
+++ b/libphobos/libdruntime/core/sys/windows/pbt.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.pbt;
version (Windows):
-@system:
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/powrprof.d b/libphobos/libdruntime/core/sys/windows/powrprof.d
index 275dbea..be4d0aa 100644
--- a/libphobos/libdruntime/core/sys/windows/powrprof.d
+++ b/libphobos/libdruntime/core/sys/windows/powrprof.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.powrprof;
version (Windows):
-@system:
pragma(lib, "powrprof");
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/prsht.d b/libphobos/libdruntime/core/sys/windows/prsht.d
index ba04b57..92596b5 100644
--- a/libphobos/libdruntime/core/sys/windows/prsht.d
+++ b/libphobos/libdruntime/core/sys/windows/prsht.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.prsht;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "comctl32");
diff --git a/libphobos/libdruntime/core/sys/windows/psapi.d b/libphobos/libdruntime/core/sys/windows/psapi.d
index 585f908..968ce6c 100644
--- a/libphobos/libdruntime/core/sys/windows/psapi.d
+++ b/libphobos/libdruntime/core/sys/windows/psapi.d
@@ -13,7 +13,6 @@
module core.sys.windows.psapi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/rapi.d b/libphobos/libdruntime/core/sys/windows/rapi.d
index 086b7a6..2fc6404 100644
--- a/libphobos/libdruntime/core/sys/windows/rapi.d
+++ b/libphobos/libdruntime/core/sys/windows/rapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.rapi;
version (Windows):
-@system:
/* Comment from MinGW
NOTE: This strictly does not belong in the Win32 API since it's
diff --git a/libphobos/libdruntime/core/sys/windows/ras.d b/libphobos/libdruntime/core/sys/windows/ras.d
index 1f66546..cb69686 100644
--- a/libphobos/libdruntime/core/sys/windows/ras.d
+++ b/libphobos/libdruntime/core/sys/windows/ras.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.ras;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "rasapi32");
diff --git a/libphobos/libdruntime/core/sys/windows/rasdlg.d b/libphobos/libdruntime/core/sys/windows/rasdlg.d
index 1add3ae..a980d27 100644
--- a/libphobos/libdruntime/core/sys/windows/rasdlg.d
+++ b/libphobos/libdruntime/core/sys/windows/rasdlg.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.rasdlg;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/raserror.d b/libphobos/libdruntime/core/sys/windows/raserror.d
index c21409b..48a2756 100644
--- a/libphobos/libdruntime/core/sys/windows/raserror.d
+++ b/libphobos/libdruntime/core/sys/windows/raserror.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.raserror;
version (Windows):
-@system:
enum {
SUCCESS = 0,
diff --git a/libphobos/libdruntime/core/sys/windows/rassapi.d b/libphobos/libdruntime/core/sys/windows/rassapi.d
index aed14f1..5244ca4 100644
--- a/libphobos/libdruntime/core/sys/windows/rassapi.d
+++ b/libphobos/libdruntime/core/sys/windows/rassapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.rassapi;
version (Windows):
-@system:
import core.sys.windows.lmcons, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/reason.d b/libphobos/libdruntime/core/sys/windows/reason.d
index 4274efa..e1fb1ca 100644
--- a/libphobos/libdruntime/core/sys/windows/reason.d
+++ b/libphobos/libdruntime/core/sys/windows/reason.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.reason;
version (Windows):
-@system:
import core.sys.windows.w32api, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/regstr.d b/libphobos/libdruntime/core/sys/windows/regstr.d
index 71a86ef..f8851fa 100644
--- a/libphobos/libdruntime/core/sys/windows/regstr.d
+++ b/libphobos/libdruntime/core/sys/windows/regstr.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.regstr;
version (Windows):
-@system:
// TODO: fix possible conflict with shloj. Sort out NEC_98 issue.
diff --git a/libphobos/libdruntime/core/sys/windows/richedit.d b/libphobos/libdruntime/core/sys/windows/richedit.d
index 6760764..0f56fef 100644
--- a/libphobos/libdruntime/core/sys/windows/richedit.d
+++ b/libphobos/libdruntime/core/sys/windows/richedit.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.richedit;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/richole.d b/libphobos/libdruntime/core/sys/windows/richole.d
index 288ef22..0151818 100644
--- a/libphobos/libdruntime/core/sys/windows/richole.d
+++ b/libphobos/libdruntime/core/sys/windows/richole.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.richole;
version (Windows):
-@system:
import core.sys.windows.objfwd, core.sys.windows.objidl, core.sys.windows.ole2, core.sys.windows.unknwn,
core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/rpc.d b/libphobos/libdruntime/core/sys/windows/rpc.d
index a9640ad..b432bc7 100644
--- a/libphobos/libdruntime/core/sys/windows/rpc.d
+++ b/libphobos/libdruntime/core/sys/windows/rpc.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.rpc;
version (Windows):
-@system:
/* Moved to rpcdecp (duplicate definition).
typedef void *I_RPC_HANDLE;
diff --git a/libphobos/libdruntime/core/sys/windows/rpcdce.d b/libphobos/libdruntime/core/sys/windows/rpcdce.d
index 1eccb0d..4f3f3cc 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcdce.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcdce.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.rpcdce;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "Rpcrt4");
diff --git a/libphobos/libdruntime/core/sys/windows/rpcdce2.d b/libphobos/libdruntime/core/sys/windows/rpcdce2.d
index c8223f6..08348c0 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcdce2.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcdce2.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.rpcdce2;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/rpcdcep.d b/libphobos/libdruntime/core/sys/windows/rpcdcep.d
index 1abbb78..cebe981 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcdcep.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcdcep.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.rpcdcep;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/rpcndr.d b/libphobos/libdruntime/core/sys/windows/rpcndr.d
index 6e9722c..127d88b 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcndr.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcndr.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.rpcndr;
version (Windows):
-@system:
pragma(lib, "rpcrt4");
/* Translation notes:
diff --git a/libphobos/libdruntime/core/sys/windows/rpcnsi.d b/libphobos/libdruntime/core/sys/windows/rpcnsi.d
index 608b92c..1294d0d 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcnsi.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcnsi.d
@@ -10,7 +10,6 @@
*/
module core.sys.windows.rpcnsi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "rpcns4");
diff --git a/libphobos/libdruntime/core/sys/windows/rpcnsip.d b/libphobos/libdruntime/core/sys/windows/rpcnsip.d
index 219d7b0..ccf026f 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcnsip.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcnsip.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.rpcnsip;
version (Windows):
-@system:
import core.sys.windows.rpcdce, core.sys.windows.rpcdcep, core.sys.windows.rpcnsi;
diff --git a/libphobos/libdruntime/core/sys/windows/rpcnterr.d b/libphobos/libdruntime/core/sys/windows/rpcnterr.d
index 426077a..bbead74 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcnterr.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcnterr.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.rpcnterr;
version (Windows):
-@system:
import core.sys.windows.winerror;
diff --git a/libphobos/libdruntime/core/sys/windows/schannel.d b/libphobos/libdruntime/core/sys/windows/schannel.d
index 98c5cf8..6ffab30 100644
--- a/libphobos/libdruntime/core/sys/windows/schannel.d
+++ b/libphobos/libdruntime/core/sys/windows/schannel.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.schannel;
version (Windows):
-@system:
import core.sys.windows.wincrypt;
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/sdkddkver.d b/libphobos/libdruntime/core/sys/windows/sdkddkver.d
index 4b5bad5..3f5c01b 100644
--- a/libphobos/libdruntime/core/sys/windows/sdkddkver.d
+++ b/libphobos/libdruntime/core/sys/windows/sdkddkver.d
@@ -9,7 +9,6 @@
module core.sys.windows.sdkddkver;
version (Windows):
-@system:
enum _WIN32_WINNT_NT4 = 0x0400;
enum _WIN32_WINNT_WIN2K = 0x0500;
diff --git a/libphobos/libdruntime/core/sys/windows/secext.d b/libphobos/libdruntime/core/sys/windows/secext.d
index 6b92fcd..ab61536 100644
--- a/libphobos/libdruntime/core/sys/windows/secext.d
+++ b/libphobos/libdruntime/core/sys/windows/secext.d
@@ -9,7 +9,6 @@
// Don't include this file directly, use core.sys.windows.security instead.
module core.sys.windows.secext;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "secur32");
diff --git a/libphobos/libdruntime/core/sys/windows/security.d b/libphobos/libdruntime/core/sys/windows/security.d
index b81abb3..f93dc81 100644
--- a/libphobos/libdruntime/core/sys/windows/security.d
+++ b/libphobos/libdruntime/core/sys/windows/security.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.security;
version (Windows):
-@system:
enum : SECURITY_STATUS
{
diff --git a/libphobos/libdruntime/core/sys/windows/servprov.d b/libphobos/libdruntime/core/sys/windows/servprov.d
index 89ab47c..ae8bef1 100644
--- a/libphobos/libdruntime/core/sys/windows/servprov.d
+++ b/libphobos/libdruntime/core/sys/windows/servprov.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.servprov;
version (Windows):
-@system:
import core.sys.windows.basetyps, core.sys.windows.unknwn, core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/setupapi.d b/libphobos/libdruntime/core/sys/windows/setupapi.d
index 80e8dba..7a052cd 100644
--- a/libphobos/libdruntime/core/sys/windows/setupapi.d
+++ b/libphobos/libdruntime/core/sys/windows/setupapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.setupapi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "setupapi");
diff --git a/libphobos/libdruntime/core/sys/windows/shellapi.d b/libphobos/libdruntime/core/sys/windows/shellapi.d
index f401997..fdd9938 100644
--- a/libphobos/libdruntime/core/sys/windows/shellapi.d
+++ b/libphobos/libdruntime/core/sys/windows/shellapi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.shellapi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "shell32");
diff --git a/libphobos/libdruntime/core/sys/windows/shldisp.d b/libphobos/libdruntime/core/sys/windows/shldisp.d
index ecb0ede..144f907 100644
--- a/libphobos/libdruntime/core/sys/windows/shldisp.d
+++ b/libphobos/libdruntime/core/sys/windows/shldisp.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.shldisp;
version (Windows):
-@system:
import core.sys.windows.unknwn, core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/shlguid.d b/libphobos/libdruntime/core/sys/windows/shlguid.d
index e0c1af1..f4c73ef 100644
--- a/libphobos/libdruntime/core/sys/windows/shlguid.d
+++ b/libphobos/libdruntime/core/sys/windows/shlguid.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.shlguid;
version (Windows):
-@system:
import core.sys.windows.basetyps, core.sys.windows.w32api;
diff --git a/libphobos/libdruntime/core/sys/windows/shlobj.d b/libphobos/libdruntime/core/sys/windows/shlobj.d
index 75ac622..bcd254b 100644
--- a/libphobos/libdruntime/core/sys/windows/shlobj.d
+++ b/libphobos/libdruntime/core/sys/windows/shlobj.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.shlobj;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "shell32");
diff --git a/libphobos/libdruntime/core/sys/windows/shlwapi.d b/libphobos/libdruntime/core/sys/windows/shlwapi.d
index d1a61a3..cfabbad 100644
--- a/libphobos/libdruntime/core/sys/windows/shlwapi.d
+++ b/libphobos/libdruntime/core/sys/windows/shlwapi.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.shlwapi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "shlwapi");
diff --git a/libphobos/libdruntime/core/sys/windows/snmp.d b/libphobos/libdruntime/core/sys/windows/snmp.d
index bf56b28..62c81e1 100644
--- a/libphobos/libdruntime/core/sys/windows/snmp.d
+++ b/libphobos/libdruntime/core/sys/windows/snmp.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.snmp;
version (Windows):
-@system:
import core.sys.windows.basetsd /+: HANDLE+/;
import core.sys.windows.windef /+: BOOL, BYTE, DWORD, INT, LONG, UINT, ULONG+/;
diff --git a/libphobos/libdruntime/core/sys/windows/sql.d b/libphobos/libdruntime/core/sys/windows/sql.d
index 7c8758e..58c6d42 100644
--- a/libphobos/libdruntime/core/sys/windows/sql.d
+++ b/libphobos/libdruntime/core/sys/windows/sql.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.sql;
version (Windows):
-@system:
public import core.sys.windows.sqltypes;
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/sqlext.d b/libphobos/libdruntime/core/sys/windows/sqlext.d
index 2ddff20..8702cda 100644
--- a/libphobos/libdruntime/core/sys/windows/sqlext.d
+++ b/libphobos/libdruntime/core/sys/windows/sqlext.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.sqlext;
version (Windows):
-@system:
/* Conversion notes:
The MinGW file was a horrible mess. All of the #defines were sorted alphabetically,
diff --git a/libphobos/libdruntime/core/sys/windows/sqltypes.d b/libphobos/libdruntime/core/sys/windows/sqltypes.d
index fd77b81..28d5f5d 100644
--- a/libphobos/libdruntime/core/sys/windows/sqltypes.d
+++ b/libphobos/libdruntime/core/sys/windows/sqltypes.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.sqltypes;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/sqlucode.d b/libphobos/libdruntime/core/sys/windows/sqlucode.d
index 85f0d06..d4f03f6 100644
--- a/libphobos/libdruntime/core/sys/windows/sqlucode.d
+++ b/libphobos/libdruntime/core/sys/windows/sqlucode.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.sqlucode;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/sspi.d b/libphobos/libdruntime/core/sys/windows/sspi.d
index 21e982d..3686c6f 100644
--- a/libphobos/libdruntime/core/sys/windows/sspi.d
+++ b/libphobos/libdruntime/core/sys/windows/sspi.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.sspi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/stacktrace.d b/libphobos/libdruntime/core/sys/windows/stacktrace.d
index 7982085..6e5c4cd 100644
--- a/libphobos/libdruntime/core/sys/windows/stacktrace.d
+++ b/libphobos/libdruntime/core/sys/windows/stacktrace.d
@@ -11,7 +11,6 @@
module core.sys.windows.stacktrace;
version (Windows):
-@system:
import core.demangle;
import core.stdc.stdlib;
diff --git a/libphobos/libdruntime/core/sys/windows/stat.d b/libphobos/libdruntime/core/sys/windows/stat.d
index 16f66e1..c87c749 100644
--- a/libphobos/libdruntime/core/sys/windows/stat.d
+++ b/libphobos/libdruntime/core/sys/windows/stat.d
@@ -6,7 +6,6 @@ module core.sys.windows.stat;
version (Windows):
extern (C) nothrow @nogc:
-@system:
import core.sys.windows.stdc.time;
diff --git a/libphobos/libdruntime/core/sys/windows/stdc/malloc.d b/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
index 278c9fe..768102c 100644
--- a/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
+++ b/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
@@ -10,7 +10,6 @@
module core.sys.windows.stdc.malloc;
version (CRuntime_Microsoft):
extern (C):
-@system:
nothrow:
@nogc:
diff --git a/libphobos/libdruntime/core/sys/windows/subauth.d b/libphobos/libdruntime/core/sys/windows/subauth.d
index e0d67ff..a48fb99 100644
--- a/libphobos/libdruntime/core/sys/windows/subauth.d
+++ b/libphobos/libdruntime/core/sys/windows/subauth.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.subauth;
version (Windows):
-@system:
import core.sys.windows.ntdef, core.sys.windows.windef;
diff --git a/libphobos/libdruntime/core/sys/windows/threadaux.d b/libphobos/libdruntime/core/sys/windows/threadaux.d
index 34fda65..92bd1c6 100644
--- a/libphobos/libdruntime/core/sys/windows/threadaux.d
+++ b/libphobos/libdruntime/core/sys/windows/threadaux.d
@@ -14,7 +14,6 @@
*/
module core.sys.windows.threadaux;
version (Windows):
-@system:
import core.sys.windows.basetsd/+ : HANDLE+/;
import core.sys.windows.winbase/+ : CloseHandle, GetCurrentThreadId, GetCurrentProcessId,
diff --git a/libphobos/libdruntime/core/sys/windows/tlhelp32.d b/libphobos/libdruntime/core/sys/windows/tlhelp32.d
index 34ed101..ecbfe38 100644
--- a/libphobos/libdruntime/core/sys/windows/tlhelp32.d
+++ b/libphobos/libdruntime/core/sys/windows/tlhelp32.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.tlhelp32;
version (Windows):
-@system:
pragma(lib, "kernel32");
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/tmschema.d b/libphobos/libdruntime/core/sys/windows/tmschema.d
index b82dc5c..7bca878 100644
--- a/libphobos/libdruntime/core/sys/windows/tmschema.d
+++ b/libphobos/libdruntime/core/sys/windows/tmschema.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.tmschema;
version (Windows):
-@system:
/* BUTTON parts */
enum {
diff --git a/libphobos/libdruntime/core/sys/windows/unknwn.d b/libphobos/libdruntime/core/sys/windows/unknwn.d
index 6db1db8..0b00279 100644
--- a/libphobos/libdruntime/core/sys/windows/unknwn.d
+++ b/libphobos/libdruntime/core/sys/windows/unknwn.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.unknwn;
version (Windows):
-@system:
nothrow:
import core.sys.windows.objfwd, core.sys.windows.windef, core.sys.windows.wtypes;
diff --git a/libphobos/libdruntime/core/sys/windows/uuid.d b/libphobos/libdruntime/core/sys/windows/uuid.d
index 7e8d4b9..d3b979d 100644
--- a/libphobos/libdruntime/core/sys/windows/uuid.d
+++ b/libphobos/libdruntime/core/sys/windows/uuid.d
@@ -1,6 +1,5 @@
module core.sys.windows.uuid;
version (Windows):
-@system:
import core.sys.windows.basetyps;
diff --git a/libphobos/libdruntime/core/sys/windows/vfw.d b/libphobos/libdruntime/core/sys/windows/vfw.d
index c67753a..ebe0ed0 100644
--- a/libphobos/libdruntime/core/sys/windows/vfw.d
+++ b/libphobos/libdruntime/core/sys/windows/vfw.d
@@ -9,7 +9,6 @@
module core.sys.windows.vfw;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "vfw32");
diff --git a/libphobos/libdruntime/core/sys/windows/w32api.d b/libphobos/libdruntime/core/sys/windows/w32api.d
index 2752da1..5a8a59b 100644
--- a/libphobos/libdruntime/core/sys/windows/w32api.d
+++ b/libphobos/libdruntime/core/sys/windows/w32api.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.w32api;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/winbase.d b/libphobos/libdruntime/core/sys/windows/winbase.d
index 1806796..3b571ad 100644
--- a/libphobos/libdruntime/core/sys/windows/winbase.d
+++ b/libphobos/libdruntime/core/sys/windows/winbase.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.winbase;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "kernel32");
diff --git a/libphobos/libdruntime/core/sys/windows/winber.d b/libphobos/libdruntime/core/sys/windows/winber.d
index d6a79cd..b211938 100644
--- a/libphobos/libdruntime/core/sys/windows/winber.d
+++ b/libphobos/libdruntime/core/sys/windows/winber.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winber;
version (Windows):
-@system:
/* Comment from MinGW
winber.h - Header file for the Windows LDAP Basic Encoding Rules API
diff --git a/libphobos/libdruntime/core/sys/windows/wincon.d b/libphobos/libdruntime/core/sys/windows/wincon.d
index a404c5c..a00ba2e3 100644
--- a/libphobos/libdruntime/core/sys/windows/wincon.d
+++ b/libphobos/libdruntime/core/sys/windows/wincon.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.wincon;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "kernel32");
diff --git a/libphobos/libdruntime/core/sys/windows/wincrypt.d b/libphobos/libdruntime/core/sys/windows/wincrypt.d
index d6c617d2..cb52d9e 100644
--- a/libphobos/libdruntime/core/sys/windows/wincrypt.d
+++ b/libphobos/libdruntime/core/sys/windows/wincrypt.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.wincrypt;
version (Windows):
-@system:
pragma(lib, "advapi32");
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/windef.d b/libphobos/libdruntime/core/sys/windows/windef.d
index 31af66a..4e951f3 100644
--- a/libphobos/libdruntime/core/sys/windows/windef.d
+++ b/libphobos/libdruntime/core/sys/windows/windef.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.windef;
version (Windows):
-@system:
public import core.sys.windows.winnt;
import core.sys.windows.w32api;
diff --git a/libphobos/libdruntime/core/sys/windows/windows.d b/libphobos/libdruntime/core/sys/windows/windows.d
index 4a1b02f..a289fb1 100644
--- a/libphobos/libdruntime/core/sys/windows/windows.d
+++ b/libphobos/libdruntime/core/sys/windows/windows.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.windows;
version (Windows):
-@system:
/*
windows.h - main header file for the Win32 API
diff --git a/libphobos/libdruntime/core/sys/windows/winerror.d b/libphobos/libdruntime/core/sys/windows/winerror.d
index a26b05c..865319b 100644
--- a/libphobos/libdruntime/core/sys/windows/winerror.d
+++ b/libphobos/libdruntime/core/sys/windows/winerror.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.winerror;
version (Windows):
-@system:
/* Comments from the Mingw header:
* WAIT_TIMEOUT is also defined in winbase.h
diff --git a/libphobos/libdruntime/core/sys/windows/wingdi.d b/libphobos/libdruntime/core/sys/windows/wingdi.d
index ba45c27..5a4eeaa 100644
--- a/libphobos/libdruntime/core/sys/windows/wingdi.d
+++ b/libphobos/libdruntime/core/sys/windows/wingdi.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.wingdi;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "gdi32");
diff --git a/libphobos/libdruntime/core/sys/windows/winhttp.d b/libphobos/libdruntime/core/sys/windows/winhttp.d
index f665805..63d59cb 100644
--- a/libphobos/libdruntime/core/sys/windows/winhttp.d
+++ b/libphobos/libdruntime/core/sys/windows/winhttp.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.winhttp;
version (Windows):
-@system:
pragma(lib, "winhttp");
// FIXME: Grouping of constants. Windows SDK doesn't make this entirely clear
// FIXME: Verify WINHTTP_STATUS_CALLBACK function declaration works correctly
diff --git a/libphobos/libdruntime/core/sys/windows/wininet.d b/libphobos/libdruntime/core/sys/windows/wininet.d
index f4aa997..328af50 100644
--- a/libphobos/libdruntime/core/sys/windows/wininet.d
+++ b/libphobos/libdruntime/core/sys/windows/wininet.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.wininet;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "wininet");
diff --git a/libphobos/libdruntime/core/sys/windows/winioctl.d b/libphobos/libdruntime/core/sys/windows/winioctl.d
index b91ddda1..f9db05d 100644
--- a/libphobos/libdruntime/core/sys/windows/winioctl.d
+++ b/libphobos/libdruntime/core/sys/windows/winioctl.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winioctl;
version (Windows):
-@system:
// FIXME: check types of some constants
diff --git a/libphobos/libdruntime/core/sys/windows/winldap.d b/libphobos/libdruntime/core/sys/windows/winldap.d
index 0ab11d6..bcdb2b3 100644
--- a/libphobos/libdruntime/core/sys/windows/winldap.d
+++ b/libphobos/libdruntime/core/sys/windows/winldap.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winldap;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/winnetwk.d b/libphobos/libdruntime/core/sys/windows/winnetwk.d
index e0c7551..9bf2e64 100644
--- a/libphobos/libdruntime/core/sys/windows/winnetwk.d
+++ b/libphobos/libdruntime/core/sys/windows/winnetwk.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winnetwk;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "mpr");
diff --git a/libphobos/libdruntime/core/sys/windows/winnls.d b/libphobos/libdruntime/core/sys/windows/winnls.d
index b487a17..f2b5409 100644
--- a/libphobos/libdruntime/core/sys/windows/winnls.d
+++ b/libphobos/libdruntime/core/sys/windows/winnls.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winnls;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "kernel32");
diff --git a/libphobos/libdruntime/core/sys/windows/winnt.d b/libphobos/libdruntime/core/sys/windows/winnt.d
index bf30072..3bd9966 100644
--- a/libphobos/libdruntime/core/sys/windows/winnt.d
+++ b/libphobos/libdruntime/core/sys/windows/winnt.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.winnt;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
diff --git a/libphobos/libdruntime/core/sys/windows/winperf.d b/libphobos/libdruntime/core/sys/windows/winperf.d
index cd31990..77638c8 100644
--- a/libphobos/libdruntime/core/sys/windows/winperf.d
+++ b/libphobos/libdruntime/core/sys/windows/winperf.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.winperf;
version (Windows):
-@system:
import core.sys.windows.windef;
import core.sys.windows.winbase; // for SYSTEMTIME
diff --git a/libphobos/libdruntime/core/sys/windows/winreg.d b/libphobos/libdruntime/core/sys/windows/winreg.d
index c3e5854..6bffe88 100644
--- a/libphobos/libdruntime/core/sys/windows/winreg.d
+++ b/libphobos/libdruntime/core/sys/windows/winreg.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winreg;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "advapi32");
diff --git a/libphobos/libdruntime/core/sys/windows/winsock2.d b/libphobos/libdruntime/core/sys/windows/winsock2.d
index 8a4b1fd..5225645 100644
--- a/libphobos/libdruntime/core/sys/windows/winsock2.d
+++ b/libphobos/libdruntime/core/sys/windows/winsock2.d
@@ -6,7 +6,6 @@
module core.sys.windows.winsock2;
version (Windows):
-@system:
pragma(lib, "ws2_32");
diff --git a/libphobos/libdruntime/core/sys/windows/winspool.d b/libphobos/libdruntime/core/sys/windows/winspool.d
index 2ff621a..12942fb 100644
--- a/libphobos/libdruntime/core/sys/windows/winspool.d
+++ b/libphobos/libdruntime/core/sys/windows/winspool.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.winspool;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "winspool");
diff --git a/libphobos/libdruntime/core/sys/windows/winsvc.d b/libphobos/libdruntime/core/sys/windows/winsvc.d
index 14ab6e4..f7f2fa7 100644
--- a/libphobos/libdruntime/core/sys/windows/winsvc.d
+++ b/libphobos/libdruntime/core/sys/windows/winsvc.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winsvc;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "advapi32");
diff --git a/libphobos/libdruntime/core/sys/windows/winuser.d b/libphobos/libdruntime/core/sys/windows/winuser.d
index 078e061..71cd882 100644
--- a/libphobos/libdruntime/core/sys/windows/winuser.d
+++ b/libphobos/libdruntime/core/sys/windows/winuser.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.winuser;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "user32");
diff --git a/libphobos/libdruntime/core/sys/windows/winver.d b/libphobos/libdruntime/core/sys/windows/winver.d
index 5099c3f..dc3d881 100644
--- a/libphobos/libdruntime/core/sys/windows/winver.d
+++ b/libphobos/libdruntime/core/sys/windows/winver.d
@@ -9,7 +9,6 @@
*/
module core.sys.windows.winver;
version (Windows):
-@system:
import core.sys.windows.w32api;
import core.sys.windows.winbase;
import core.sys.windows.sdkddkver;
diff --git a/libphobos/libdruntime/core/sys/windows/wtsapi32.d b/libphobos/libdruntime/core/sys/windows/wtsapi32.d
index 13576bd..4db697a 100644
--- a/libphobos/libdruntime/core/sys/windows/wtsapi32.d
+++ b/libphobos/libdruntime/core/sys/windows/wtsapi32.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.wtsapi32;
version (Windows):
-@system:
version (ANSI) {} else version = Unicode;
pragma(lib, "wtsapi32");
diff --git a/libphobos/libdruntime/core/sys/windows/wtypes.d b/libphobos/libdruntime/core/sys/windows/wtypes.d
index c27dd3a..0206839 100644
--- a/libphobos/libdruntime/core/sys/windows/wtypes.d
+++ b/libphobos/libdruntime/core/sys/windows/wtypes.d
@@ -8,7 +8,6 @@
*/
module core.sys.windows.wtypes;
version (Windows):
-@system:
import core.sys.windows.rpc, core.sys.windows.rpcndr;
import core.sys.windows.windef;
diff --git a/libphobos/libdruntime/rt/dmain2.d b/libphobos/libdruntime/rt/dmain2.d
index 0739b74..264fdf6 100644
--- a/libphobos/libdruntime/rt/dmain2.d
+++ b/libphobos/libdruntime/rt/dmain2.d
@@ -577,7 +577,7 @@ extern (C) void _d_print_throwable(Throwable t)
{
WCHAR* ptr; size_t len;
- void sink(const scope char[] s) scope nothrow
+ void sink(in char[] s) scope nothrow
{
if (!s.length) return;
int swlen = MultiByteToWideChar(
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 4d63826..d02f72d 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-88aa69b14f8a28255a0ac7626f6509a13cfdb67a
+3ad507b5125573c5b47736a0913105bfb1249746
The first line of this file holds the git revision number of the last
merge done from the dlang/phobos repository.
diff --git a/libphobos/src/std/algorithm/iteration.d b/libphobos/src/std/algorithm/iteration.d
index 39eff0d..9a365d5 100644
--- a/libphobos/src/std/algorithm/iteration.d
+++ b/libphobos/src/std/algorithm/iteration.d
@@ -7926,7 +7926,13 @@ if (isRandomAccessRange!Range && hasLength!Range)
_indices = iota(size_t(r.length)).array;
_empty = r.length == 0;
}
-
+ private this(size_t[] indices, size_t[] state, Range r, bool empty_)
+ {
+ _indices = indices;
+ _state = state;
+ _r = r;
+ _empty = empty_;
+ }
/// Returns: `true` if the range is empty, `false` otherwise.
@property bool empty() const pure nothrow @safe @nogc
{
@@ -7967,6 +7973,11 @@ if (isRandomAccessRange!Range && hasLength!Range)
next(2);
}
+ /// Returns: an independent copy of the permutations range.
+ auto save()
+ {
+ return typeof(this)(_indices.dup, _state.dup, _r.save, _empty);
+ }
}
///
@@ -7982,3 +7993,15 @@ if (isRandomAccessRange!Range && hasLength!Range)
[1, 2, 0],
[2, 1, 0]]));
}
+
+@safe unittest
+{
+ import std.algorithm.comparison : equal;
+ import std.range : ElementType;
+ import std.array : array;
+ auto p = [1, 2, 3].permutations;
+ auto x = p.save.front;
+ p.popFront;
+ auto y = p.front;
+ assert(x != y);
+}
diff --git a/libphobos/src/std/algorithm/mutation.d b/libphobos/src/std/algorithm/mutation.d
index b0e7707..839183d 100644
--- a/libphobos/src/std/algorithm/mutation.d
+++ b/libphobos/src/std/algorithm/mutation.d
@@ -1943,6 +1943,7 @@ if (Offset.length >= 1 && allSatisfy!(isValidIntegralTuple, Offset))
return removeImpl!s(range, offset);
}
+/// ditto
deprecated("Use of non-integral tuples is deprecated. Use remove(tuple(start, end).")
Range remove
(SwapStrategy s = SwapStrategy.stable, Range, Offset ...)
diff --git a/libphobos/src/std/array.d b/libphobos/src/std/array.d
index f48602e..3e88200 100644
--- a/libphobos/src/std/array.d
+++ b/libphobos/src/std/array.d
@@ -586,7 +586,7 @@ if (isInputRange!Range)
static assert(isMutable!ValueType, "assocArray: value type must be mutable");
ValueType[KeyType] aa;
- foreach (t; r)
+ foreach (ref t; r)
aa[t[0]] = t[1];
return aa;
}
@@ -4676,6 +4676,7 @@ nothrow pure @safe @nogc unittest
assert(a == [0, 1]);
}
+/// ditto
pragma(inline, true) U[n] staticArray(U, T, size_t n)(auto ref T[n] a)
if (!is(T == U) && is(T : U))
{
diff --git a/libphobos/src/std/ascii.d b/libphobos/src/std/ascii.d
index 3b6face..367c981 100644
--- a/libphobos/src/std/ascii.d
+++ b/libphobos/src/std/ascii.d
@@ -187,7 +187,8 @@ else
+/
bool isAlphaNum(dchar c) @safe pure nothrow @nogc
{
- return c <= 'z' && c >= '0' && (c <= '9' || c >= 'a' || (c >= 'A' && c <= 'Z'));
+ const hc = c | 0x20;
+ return ('0' <= c && c <= '9') || ('a' <= hc && hc <= 'z');
}
///
@@ -377,7 +378,8 @@ bool isOctalDigit(dchar c) @safe pure nothrow @nogc
+/
bool isHexDigit(dchar c) @safe pure nothrow @nogc
{
- return c <= 'f' && c >= '0' && (c <= '9' || c >= 'a' || (c >= 'A' && c <= 'F'));
+ const hc = c | 0x20;
+ return ('0' <= c && c <= '9') || ('a' <= hc && hc <= 'f');
}
///
diff --git a/libphobos/src/std/base64.d b/libphobos/src/std/base64.d
index d971dba..2f7213b 100644
--- a/libphobos/src/std/base64.d
+++ b/libphobos/src/std/base64.d
@@ -922,7 +922,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
* length $(D_PARAM sourceLength).
*/
@safe
- pure nothrow size_t decodeLength(in size_t sourceLength)
+ pure @nogc nothrow size_t decodeLength(in size_t sourceLength)
{
static if (Padding == NoPadding)
return (sourceLength / 4) * 3 + (sourceLength % 4 < 2 ? 0 : sourceLength % 4 == 2 ? 1 : 2);
@@ -946,7 +946,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
// Used in decode contracts. Calculates the actual size the decoded
// result should have, taking into account trailing padding.
@safe
- pure nothrow private size_t realDecodeLength(R)(R source)
+ pure @nogc nothrow private size_t realDecodeLength(R)(R source)
{
auto expect = decodeLength(source.length);
static if (Padding != NoPadding)
diff --git a/libphobos/src/std/bitmanip.d b/libphobos/src/std/bitmanip.d
index de2e0fb..f131257 100644
--- a/libphobos/src/std/bitmanip.d
+++ b/libphobos/src/std/bitmanip.d
@@ -784,48 +784,6 @@ if (is(T == class))
static assert(!__traits(compiles, bar(s)));
}
-/**
- Allows manipulating the fraction, exponent, and sign parts of a
- `float` separately. The definition is:
-
-----
-struct FloatRep
-{
- union
- {
- float value;
- mixin(bitfields!(
- uint, "fraction", 23,
- ubyte, "exponent", 8,
- bool, "sign", 1));
- }
- enum uint bias = 127, fractionBits = 23, exponentBits = 8, signBits = 1;
-}
-----
-*/
-alias FloatRep = FloatingPointRepresentation!float;
-
-/**
- Allows manipulating the fraction, exponent, and sign parts of a
- `double` separately. The definition is:
-
-----
-struct DoubleRep
-{
- union
- {
- double value;
- mixin(bitfields!(
- ulong, "fraction", 52,
- ushort, "exponent", 11,
- bool, "sign", 1));
- }
- enum uint bias = 1023, signBits = 1, fractionBits = 52, exponentBits = 11;
-}
-----
-*/
-alias DoubleRep = FloatingPointRepresentation!double;
-
private struct FloatingPointRepresentation(T)
{
static if (is(T == float))
@@ -851,6 +809,27 @@ private struct FloatingPointRepresentation(T)
}
}
+/**
+ Allows manipulating the fraction, exponent, and sign parts of a
+ `float` separately. The definition is:
+
+----
+struct FloatRep
+{
+ union
+ {
+ float value;
+ mixin(bitfields!(
+ uint, "fraction", 23,
+ ubyte, "exponent", 8,
+ bool, "sign", 1));
+ }
+ enum uint bias = 127, fractionBits = 23, exponentBits = 8, signBits = 1;
+}
+----
+*/
+alias FloatRep = FloatingPointRepresentation!float;
+
///
@safe unittest
{
@@ -899,6 +878,27 @@ private struct FloatingPointRepresentation(T)
assert(rep.sign);
}
+/**
+ Allows manipulating the fraction, exponent, and sign parts of a
+ `double` separately. The definition is:
+
+----
+struct DoubleRep
+{
+ union
+ {
+ double value;
+ mixin(bitfields!(
+ ulong, "fraction", 52,
+ ushort, "exponent", 11,
+ bool, "sign", 1));
+ }
+ enum uint bias = 1023, signBits = 1, fractionBits = 52, exponentBits = 11;
+}
+----
+*/
+alias DoubleRep = FloatingPointRepresentation!double;
+
///
@safe unittest
{
@@ -986,17 +986,17 @@ private:
size_t* _ptr;
enum bitsPerSizeT = size_t.sizeof * 8;
- @property size_t fullWords() const @nogc pure nothrow
+ @property size_t fullWords() const scope @safe @nogc pure nothrow
{
return _len / bitsPerSizeT;
}
// Number of bits after the last full word
- @property size_t endBits() const @nogc pure nothrow
+ @property size_t endBits() const scope @safe @nogc pure nothrow
{
return _len % bitsPerSizeT;
}
// Bit mask to extract the bits after the last full word
- @property size_t endMask() const @nogc pure nothrow
+ @property size_t endMask() const scope @safe @nogc pure nothrow
{
return (size_t(1) << endBits) - 1;
}
@@ -1440,15 +1440,15 @@ public:
/**********************************************
* Counts all the set bits in the `BitArray`
*/
- size_t count() const @nogc pure nothrow
+ size_t count() const scope @safe @nogc pure nothrow
{
if (_ptr)
{
size_t bitCount;
foreach (i; 0 .. fullWords)
- bitCount += countBitsSet(_ptr[i]);
+ bitCount += (() @trusted => countBitsSet(_ptr[i]))();
if (endBits)
- bitCount += countBitsSet(_ptr[fullWords] & endMask);
+ bitCount += (() @trusted => countBitsSet(_ptr[fullWords] & endMask))();
return bitCount;
}
else
@@ -4544,7 +4544,7 @@ if (canSwapEndianness!T && isOutputRange!(R, ubyte))
Counts the number of set bits in the binary representation of `value`.
For signed integers, the sign bit is included in the count.
*/
-private uint countBitsSet(T)(const T value) @nogc pure nothrow
+private uint countBitsSet(T)(const T value)
if (isIntegral!T)
{
static if (T.sizeof == 8)
diff --git a/libphobos/src/std/container/binaryheap.d b/libphobos/src/std/container/binaryheap.d
index e763357..723630c 100644
--- a/libphobos/src/std/container/binaryheap.d
+++ b/libphobos/src/std/container/binaryheap.d
@@ -89,6 +89,8 @@ if (isRandomAccessRange!(Store) || isRandomAccessRange!(typeof(Store.init[])))
Store _store;
size_t _length;
}
+ // TODO: migrate to use the SafeRefCounted. The problem is that some member
+ // functions here become @system with a naive switch.
private RefCounted!(Data, RefCountedAutoInitialize.no) _payload;
// Comparison predicate
private alias comp = binaryFun!(less);
diff --git a/libphobos/src/std/digest/murmurhash.d b/libphobos/src/std/digest/murmurhash.d
index 533db92..b94042f 100644
--- a/libphobos/src/std/digest/murmurhash.d
+++ b/libphobos/src/std/digest/murmurhash.d
@@ -38,11 +38,6 @@ $(BR) $(LINK2 https://en.wikipedia.org/wiki/MurmurHash, Wikipedia)
*/
module std.digest.murmurhash;
-version (X86)
- version = HaveUnalignedLoads;
-else version (X86_64)
- version = HaveUnalignedLoads;
-
///
@safe unittest
{
@@ -97,6 +92,11 @@ else version (X86_64)
assert(hashed == [188, 165, 108, 2]);
}
+version (X86)
+ version = HaveUnalignedLoads;
+else version (X86_64)
+ version = HaveUnalignedLoads;
+
public import std.digest;
@safe:
diff --git a/libphobos/src/std/exception.d b/libphobos/src/std/exception.d
index 94a2e7a..129c05d 100644
--- a/libphobos/src/std/exception.d
+++ b/libphobos/src/std/exception.d
@@ -799,108 +799,107 @@ enum emptyExceptionMsg = "<Empty Exception Message>";
}
/**
- * Casts a mutable array to an immutable array in an idiomatic
- * manner. Technically, `assumeUnique` just inserts a cast,
- * but its name documents assumptions on the part of the
- * caller. `assumeUnique(arr)` should only be called when
- * there are no more active mutable aliases to elements of $(D
- * arr). To strengthen this assumption, `assumeUnique(arr)`
- * also clears `arr` before returning. Essentially $(D
- * assumeUnique(arr)) indicates commitment from the caller that there
- * is no more mutable access to any of `arr`'s elements
- * (transitively), and that all future accesses will be done through
- * the immutable array returned by `assumeUnique`.
- *
- * Typically, `assumeUnique` is used to return arrays from
- * functions that have allocated and built them.
- *
- * Params:
- * array = The array to cast to immutable.
- *
- * Returns: The immutable array.
- *
- * Example:
- *
- * $(RUNNABLE_EXAMPLE
- * ----
- * string letters()
- * {
- * char[] result = new char['z' - 'a' + 1];
- * foreach (i, ref e; result)
- * {
- * e = cast(char)('a' + i);
- * }
- * return assumeUnique(result);
- * }
- * ----
- * )
- *
- * The use in the example above is correct because `result`
- * was private to `letters` and is inaccessible in writing
- * after the function returns. The following example shows an
- * incorrect use of `assumeUnique`.
- *
- * Bad:
- *
- * $(RUNNABLE_EXAMPLE
- * ----
- * private char[] buffer;
- * string letters(char first, char last)
- * {
- * if (first >= last) return null; // fine
- * auto sneaky = buffer;
- * sneaky.length = last - first + 1;
- * foreach (i, ref e; sneaky)
- * {
- * e = cast(char)('a' + i);
- * }
- * return assumeUnique(sneaky); // BAD
- * }
- * ----
- * )
- *
- * The example above wreaks havoc on client code because it is
- * modifying arrays that callers considered immutable. To obtain an
- * immutable array from the writable array `buffer`, replace
- * the last line with:
- *
- * ----
- * return to!(string)(sneaky); // not that sneaky anymore
- * ----
- *
- * The call will duplicate the array appropriately.
- *
- * Note that checking for uniqueness during compilation is
- * possible in certain cases, especially when a function is
- * marked as a pure function. The following example does not
- * need to call assumeUnique because the compiler can infer the
- * uniqueness of the array in the pure function:
- *
- * $(RUNNABLE_EXAMPLE
- * ----
- * string letters() pure
- * {
- * char[] result = new char['z' - 'a' + 1];
- * foreach (i, ref e; result)
- * {
- * e = cast(char)('a' + i);
- * }
- * return result;
- * }
- * ----
- * )
- *
- * For more on infering uniqueness see the $(B unique) and
- * $(B lent) keywords in the
- * $(HTTP www.cs.cmu.edu/~aldrich/papers/aldrich-dissertation.pdf, ArchJava)
- * language.
- *
- * The downside of using `assumeUnique`'s
- * convention-based usage is that at this time there is no
- * formal checking of the correctness of the assumption;
- * on the upside, the idiomatic use of `assumeUnique` is
- * simple and rare enough to be tolerable.
- *
+Casts a mutable array to an immutable array in an idiomatic
+manner. Technically, `assumeUnique` just inserts a cast,
+but its name documents assumptions on the part of the
+caller. `assumeUnique(arr)` should only be called when
+there are no more active mutable aliases to elements of $(D
+arr). To strengthen this assumption, `assumeUnique(arr)`
+also clears `arr` before returning. Essentially $(D
+assumeUnique(arr)) indicates commitment from the caller that there
+is no more mutable access to any of `arr`'s elements
+(transitively), and that all future accesses will be done through
+the immutable array returned by `assumeUnique`.
+
+Typically, `assumeUnique` is used to return arrays from
+functions that have allocated and built them.
+
+Params:
+ array = The array to cast to immutable.
+
+Returns: The immutable array.
+
+Example:
+
+$(RUNNABLE_EXAMPLE
+----
+string letters()
+{
+ char[] result = new char['z' - 'a' + 1];
+ foreach (i, ref e; result)
+ {
+ e = cast(char)('a' + i);
+ }
+ return assumeUnique(result);
+}
+----
+)
+
+The use in the example above is correct because `result`
+was private to `letters` and is inaccessible in writing
+after the function returns. The following example shows an
+incorrect use of `assumeUnique`.
+
+Bad:
+
+$(RUNNABLE_EXAMPLE
+----
+char[] buffer;
+string letters(char first, char last)
+{
+ if (first >= last) return null; // fine
+ auto sneaky = buffer;
+ sneaky.length = last - first + 1;
+ foreach (i, ref e; sneaky)
+ {
+ e = cast(char)('a' + i);
+ }
+ return assumeUnique(sneaky); // BAD
+}
+----
+)
+
+The example above wreaks havoc on client code because it is
+modifying arrays that callers considered immutable. To obtain an
+immutable array from the writable array `buffer`, replace
+the last line with:
+
+----
+return to!(string)(sneaky); // not that sneaky anymore
+----
+
+The call will duplicate the array appropriately.
+
+Note that checking for uniqueness during compilation is
+possible in certain cases, especially when a function is
+marked as a pure function. The following example does not
+need to call `assumeUnique` because the compiler can infer the
+uniqueness of the array in the pure function:
+
+$(RUNNABLE_EXAMPLE
+----
+static string letters() pure
+{
+ char[] result = new char['z' - 'a' + 1];
+ foreach (i, ref e; result)
+ {
+ e = cast(char)('a' + i);
+ }
+ return result;
+}
+----
+)
+
+For more on infering uniqueness see the $(B unique) and
+$(B lent) keywords in the
+$(HTTP www.cs.cmu.edu/~aldrich/papers/aldrich-dissertation.pdf, ArchJava)
+language.
+
+The downside of using `assumeUnique`'s
+convention-based usage is that at this time there is no
+formal checking of the correctness of the assumption;
+on the upside, the idiomatic use of `assumeUnique` is
+simple and rare enough to be tolerable.
*/
immutable(T)[] assumeUnique(T)(T[] array) pure nothrow
{
diff --git a/libphobos/src/std/experimental/allocator/common.d b/libphobos/src/std/experimental/allocator/common.d
index 8acd763..d2efe33 100644
--- a/libphobos/src/std/experimental/allocator/common.d
+++ b/libphobos/src/std/experimental/allocator/common.d
@@ -12,6 +12,26 @@ module std.experimental.allocator.common;
import std.algorithm.comparison, std.traits;
/**
+Is `true` iff `A` is an allocator.
+ */
+enum isAllocator(A) = (is(typeof(A.allocate(size_t.init)) == void[]) && is(typeof(A.alignment) : size_t));
+
+///
+@safe @nogc nothrow pure
+unittest
+{
+ import std.experimental.allocator.building_blocks.null_allocator : NullAllocator;
+ import std.experimental.allocator.mallocator : Mallocator;
+ import std.experimental.allocator.gc_allocator : GCAllocator;
+ import std.experimental.allocator.mmap_allocator : MmapAllocator;
+ static assert(isAllocator!NullAllocator);
+ static assert(isAllocator!Mallocator);
+ static assert(isAllocator!GCAllocator);
+ static assert(isAllocator!MmapAllocator);
+ static assert(!isAllocator!int);
+}
+
+/**
Returns the size in bytes of the state that needs to be allocated to hold an
object of type `T`. `stateSize!T` is zero for `struct`s that are not
nested and have no nonstatic member variables.
diff --git a/libphobos/src/std/file.d b/libphobos/src/std/file.d
index 8957089..8d1b431 100644
--- a/libphobos/src/std/file.d
+++ b/libphobos/src/std/file.d
@@ -4465,9 +4465,10 @@ void rmdirRecurse(ref scope DirEntry de) @safe
}
else
{
- // dirEntries is @system because it uses a DirIterator with a
- // RefCounted variable, but here, no references to the payload is
- // escaped to the outside, so this should be @trusted
+ // dirEntries is @system without DIP1000 because it uses
+ // a DirIterator with a SafeRefCounted variable, but here, no
+ // references to the payload are escaped to the outside, so this should
+ // be @trusted
() @trusted {
// all children, recursively depth-first
foreach (DirEntry e; dirEntries(de.name, SpanMode.depth, false))
@@ -4863,20 +4864,31 @@ private struct DirIteratorImpl
}
}
-struct DirIterator
+// Must be a template, because the destructor is unsafe or safe depending on
+// whether `-preview=dip1000` is in use. Otherwise, linking errors would
+// result.
+struct _DirIterator(bool useDIP1000)
{
-@safe:
+ static assert(useDIP1000 == dip1000Enabled,
+ "Please don't override useDIP1000 to disagree with compiler switch.");
+
private:
- RefCounted!(DirIteratorImpl, RefCountedAutoInitialize.no) impl;
+ SafeRefCounted!(DirIteratorImpl, RefCountedAutoInitialize.no) impl;
+
this(string pathname, SpanMode mode, bool followSymlink) @trusted
{
impl = typeof(impl)(pathname, mode, followSymlink);
}
public:
- @property bool empty() { return impl.empty; }
- @property DirEntry front() { return impl.front; }
- void popFront() { impl.popFront(); }
+ @property bool empty() @trusted { return impl.empty; }
+ @property DirEntry front() @trusted { return impl.front; }
+ void popFront() @trusted { impl.popFront(); }
}
+
+// This has the client code to automatically use and link to the correct
+// template instance
+alias DirIterator = _DirIterator!dip1000Enabled;
+
/++
Returns an $(REF_ALTTEXT input range, isInputRange, std,range,primitives)
of `DirEntry` that lazily iterates a given directory,
@@ -4890,6 +4902,11 @@ public:
operating system / filesystem, and may not follow any particular sorting.
Params:
+ useDIP1000 = used to instantiate this function separately for code with
+ and without -preview=dip1000 compiler switch, because it
+ affects the ABI of this function. Set automatically -
+ don't touch.
+
path = The directory to iterate over.
If empty, the current directory will be iterated.
@@ -4955,9 +4972,13 @@ foreach (d; dFiles)
writeln(d.name);
--------------------
+/
-auto dirEntries(string path, SpanMode mode, bool followSymlink = true)
+
+// For some reason, doing the same alias-to-a-template trick as with DirIterator
+// does not work here.
+auto dirEntries(bool useDIP1000 = dip1000Enabled)
+ (string path, SpanMode mode, bool followSymlink = true)
{
- return DirIterator(path, mode, followSymlink);
+ return _DirIterator!useDIP1000(path, mode, followSymlink);
}
/// Duplicate functionality of D1's `std.file.listdir()`:
@@ -4976,13 +4997,14 @@ auto dirEntries(string path, SpanMode mode, bool followSymlink = true)
.array;
}
- void main(string[] args)
+ // Can be safe only with -preview=dip1000
+ @safe void main(string[] args)
{
import std.stdio;
string[] files = listdir(args[1]);
writefln("%s", files);
- }
+ }
}
@system unittest
@@ -5057,14 +5079,15 @@ auto dirEntries(string path, SpanMode mode, bool followSymlink = true)
}
/// Ditto
-auto dirEntries(string path, string pattern, SpanMode mode,
+auto dirEntries(bool useDIP1000 = dip1000Enabled)
+ (string path, string pattern, SpanMode mode,
bool followSymlink = true)
{
import std.algorithm.iteration : filter;
import std.path : globMatch, baseName;
bool f(DirEntry de) { return globMatch(baseName(de.name), pattern); }
- return filter!f(DirIterator(path, mode, followSymlink));
+ return filter!f(_DirIterator!useDIP1000(path, mode, followSymlink));
}
@safe unittest
@@ -5145,7 +5168,7 @@ auto dirEntries(string path, string pattern, SpanMode mode,
// Make sure that dirEntries does not butcher Unicode file names
// https://issues.dlang.org/show_bug.cgi?id=17962
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.algorithm.iteration : map;
diff --git a/libphobos/src/std/format/internal/write.d b/libphobos/src/std/format/internal/write.d
index 2fd6ff7..8089cfa 100644
--- a/libphobos/src/std/format/internal/write.d
+++ b/libphobos/src/std/format/internal/write.d
@@ -3017,33 +3017,31 @@ if (is(T == enum))
import std.array : appender;
import std.range.primitives : put;
- if (f.spec == 's')
+ if (f.spec != 's')
+ return formatValueImpl(w, cast(OriginalType!T) val, f);
+
+ static foreach (e; EnumMembers!T)
{
- foreach (i, e; EnumMembers!T)
+ if (val == e)
{
- if (val == e)
- {
- formatValueImpl(w, __traits(allMembers, T)[i], f);
- return;
- }
+ formatValueImpl(w, __traits(identifier, e), f);
+ return;
}
+ }
- auto w2 = appender!string();
+ auto w2 = appender!string();
- // val is not a member of T, output cast(T) rawValue instead.
- put(w2, "cast(");
- put(w2, T.stringof);
- put(w2, ")");
- static assert(!is(OriginalType!T == T), "OriginalType!" ~ T.stringof ~
- "must not be equal to " ~ T.stringof);
+ // val is not a member of T, output cast(T) rawValue instead.
+ put(w2, "cast(");
+ put(w2, T.stringof);
+ put(w2, ")");
+ static assert(!is(OriginalType!T == T), "OriginalType!" ~ T.stringof ~
+ "must not be equal to " ~ T.stringof);
- FormatSpec!Char f2 = f;
- f2.width = 0;
- formatValueImpl(w2, cast(OriginalType!T) val, f2);
- writeAligned(w, w2.data, f);
- return;
- }
- formatValueImpl(w, cast(OriginalType!T) val, f);
+ FormatSpec!Char f2 = f;
+ f2.width = 0;
+ formatValueImpl(w2, cast(OriginalType!T) val, f2);
+ writeAligned(w, w2.data, f);
}
@safe unittest
diff --git a/libphobos/src/std/internal/windows/advapi32.d b/libphobos/src/std/internal/windows/advapi32.d
index 6f999ba..1b26f43 100644
--- a/libphobos/src/std/internal/windows/advapi32.d
+++ b/libphobos/src/std/internal/windows/advapi32.d
@@ -36,7 +36,9 @@ pragma(lib, "advapi32.lib");
HMODULE hAdvapi32 = null;
extern (Windows)
{
- LONG function(in HKEY hkey, in LPCWSTR lpSubKey, in REGSAM samDesired, in DWORD reserved) pRegDeleteKeyExW;
+ LONG function(
+ scope const HKEY hkey, scope const LPCWSTR lpSubKey,
+ scope const REGSAM samDesired, scope const DWORD reserved) pRegDeleteKeyExW;
}
void loadAdvapi32()
diff --git a/libphobos/src/std/json.d b/libphobos/src/std/json.d
index ac397e5..088e77f 100644
--- a/libphobos/src/std/json.d
+++ b/libphobos/src/std/json.d
@@ -678,6 +678,7 @@ struct JSONValue
assert( j["language"].str == "Perl" );
}
+ /// ditto
void opIndexAssign(T)(T arg, size_t i)
{
auto a = this.arrayNoRef;
@@ -754,11 +755,13 @@ struct JSONValue
assert(j["author"].str == "Walter");
}
+ ///
bool opEquals(const JSONValue rhs) const @nogc nothrow pure @safe
{
return opEquals(rhs);
}
+ /// ditto
bool opEquals(ref const JSONValue rhs) const @nogc nothrow pure @trusted
{
// Default doesn't work well since store is a union. Compare only
diff --git a/libphobos/src/std/net/curl.d b/libphobos/src/std/net/curl.d
index 2318279..8745bbd 100644
--- a/libphobos/src/std/net/curl.d
+++ b/libphobos/src/std/net/curl.d
@@ -28,7 +28,7 @@ to your $(B dub.json) file if you are using $(LINK2 http://code.dlang.org, DUB).
Windows x86 note:
A DMD compatible libcurl static library can be downloaded from the dlang.org
-$(LINK2 http://downloads.dlang.org/other/index.html, download archive page).
+$(LINK2 https://downloads.dlang.org/other/index.html, download archive page).
This module is not available for iOS, tvOS or watchOS.
diff --git a/libphobos/src/std/random.d b/libphobos/src/std/random.d
index 70b87dd..9b3c5ed 100644
--- a/libphobos/src/std/random.d
+++ b/libphobos/src/std/random.d
@@ -107,18 +107,6 @@ module std.random;
import std.range.primitives;
import std.traits;
-version (OSX)
- version = Darwin;
-else version (iOS)
- version = Darwin;
-else version (TVOS)
- version = Darwin;
-else version (WatchOS)
- version = Darwin;
-
-version (D_InlineAsm_X86) version = InlineAsm_X86_Any;
-version (D_InlineAsm_X86_64) version = InlineAsm_X86_Any;
-
///
@safe unittest
{
@@ -178,6 +166,18 @@ version (D_InlineAsm_X86_64) version = InlineAsm_X86_Any;
assert([0, 1, 2, 4, 5].randomShuffle(rnd2).equal([4, 2, 5, 0, 1]));
}
+version (OSX)
+ version = Darwin;
+else version (iOS)
+ version = Darwin;
+else version (TVOS)
+ version = Darwin;
+else version (WatchOS)
+ version = Darwin;
+
+version (D_InlineAsm_X86) version = InlineAsm_X86_Any;
+version (D_InlineAsm_X86_64) version = InlineAsm_X86_Any;
+
version (StdUnittest)
{
static import std.meta;
diff --git a/libphobos/src/std/stdio.d b/libphobos/src/std/stdio.d
index cd1a356..ffd6da8 100644
--- a/libphobos/src/std/stdio.d
+++ b/libphobos/src/std/stdio.d
@@ -145,8 +145,8 @@ version (Windows)
// encoded in CP_ACP on Windows instead of UTF-8.
/+ Waiting for druntime pull 299
+/
- extern (C) nothrow @nogc FILE* _wfopen(in wchar* filename, in wchar* mode);
- extern (C) nothrow @nogc FILE* _wfreopen(in wchar* filename, in wchar* mode, FILE* fp);
+ extern (C) nothrow @nogc FILE* _wfopen(scope const wchar* filename, scope const wchar* mode);
+ extern (C) nothrow @nogc FILE* _wfreopen(scope const wchar* filename, scope const wchar* mode, FILE* fp);
import core.sys.windows.basetsd : HANDLE;
}
@@ -5210,7 +5210,7 @@ enum StdFileHandle: string
{
with (StdFileHandle)
assert(_iob == stdin || _iob == stdout || _iob == stderr);
- impl.handle = mixin(_iob);
+ impl.handle = cast() mixin(_iob);
result._p = &impl;
atomicOp!"+="(spinlock, uint.max / 2);
break;
diff --git a/libphobos/src/std/string.d b/libphobos/src/std/string.d
index 7ed24f7..b1063ee 100644
--- a/libphobos/src/std/string.d
+++ b/libphobos/src/std/string.d
@@ -4845,6 +4845,7 @@ if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) &&
assert(detabber(" \n\tx", 9).array == " \n x");
}
+/// ditto
auto detabber(Range)(auto ref Range r, size_t tabSize = 8)
if (isConvertibleToString!Range)
{
diff --git a/libphobos/src/std/traits.d b/libphobos/src/std/traits.d
index cc08ea6..1cbff84 100644
--- a/libphobos/src/std/traits.d
+++ b/libphobos/src/std/traits.d
@@ -9136,3 +9136,11 @@ package(std) template DeducedParameterType(T)
{
static assert(is(DeducedParameterType!(inout(int[])) == inout(int)[]));
}
+
+private auto dip1000Test(int x) {return *&x;}
+// We don't use isSafe, because betterC client code needs to instantiate
+// core.internal.array.comparison.__cmp in the client side. isSafe uses
+// __cmp of two strings, so using it would instantate that here instead. That
+// won't do because betterC compilations do not link the Phobos binary in.
+package(std) enum dip1000Enabled
+ = is(typeof(&dip1000Test) : int function(int) @safe);
diff --git a/libphobos/src/std/typecons.d b/libphobos/src/std/typecons.d
index 094628b..231ac93 100644
--- a/libphobos/src/std/typecons.d
+++ b/libphobos/src/std/typecons.d
@@ -22,8 +22,8 @@ $(TR $(TD Flags) $(TD
$(LREF Yes)
))
$(TR $(TD Memory allocation) $(TD
- $(LREF RefCounted)
- $(LREF refCounted)
+ $(LREF SafeRefCounted)
+ $(LREF safeRefCounted)
$(LREF RefCountedAutoInitialize)
$(LREF scoped)
$(LREF Unique)
@@ -2759,6 +2759,9 @@ Nullable!T) object starts in the null state. Assigning it renders it
non-null. Calling `nullify` can nullify it again.
Practically `Nullable!T` stores a `T` and a `bool`.
+
+See also:
+ $(LREF apply), an alternative way to use the payload.
*/
struct Nullable(T)
{
@@ -4178,7 +4181,7 @@ Returns:
See also:
$(HTTPS en.wikipedia.org/wiki/Monad_(functional_programming)#The_Maybe_monad, The `Maybe` monad)
- */
+*/
template apply(alias fun)
{
import std.functional : unaryFun;
@@ -6550,8 +6553,8 @@ package template Bind(alias Template, args1...)
/**
-Options regarding auto-initialization of a `RefCounted` object (see
-the definition of `RefCounted` below).
+Options regarding auto-initialization of a `SafeRefCounted` object (see
+the definition of `SafeRefCounted` below).
*/
enum RefCountedAutoInitialize
{
@@ -6572,6 +6575,27 @@ enum RefCountedAutoInitialize
int a = 42;
}
+ SafeRefCounted!(Foo, RefCountedAutoInitialize.yes) rcAuto;
+ SafeRefCounted!(Foo, RefCountedAutoInitialize.no) rcNoAuto;
+
+ assert(rcAuto.refCountedPayload.a == 42);
+
+ assertThrown!AssertError(rcNoAuto.refCountedPayload);
+ rcNoAuto.refCountedStore.ensureInitialized;
+ assert(rcNoAuto.refCountedPayload.a == 42);
+}
+
+// Same the above but for old RefCounted and not documented
+@system unittest
+{
+ import core.exception : AssertError;
+ import std.exception : assertThrown;
+
+ struct Foo
+ {
+ int a = 42;
+ }
+
RefCounted!(Foo, RefCountedAutoInitialize.yes) rcAuto;
RefCounted!(Foo, RefCountedAutoInitialize.no) rcNoAuto;
@@ -6586,16 +6610,16 @@ enum RefCountedAutoInitialize
Defines a reference-counted object containing a `T` value as
payload.
-An instance of `RefCounted` is a reference to a structure,
+An instance of `SafeRefCounted` is a reference to a structure,
which is referred to as the $(I store), or $(I storage implementation
struct) in this documentation. The store contains a reference count
-and the `T` payload. `RefCounted` uses `malloc` to allocate
-the store. As instances of `RefCounted` are copied or go out of
+and the `T` payload. `SafeRefCounted` uses `malloc` to allocate
+the store. As instances of `SafeRefCounted` are copied or go out of
scope, they will automatically increment or decrement the reference
-count. When the reference count goes down to zero, `RefCounted`
+count. When the reference count goes down to zero, `SafeRefCounted`
will call `destroy` against the payload and call `free` to
deallocate the store. If the `T` payload contains any references
-to GC-allocated memory, then `RefCounted` will add it to the GC memory
+to GC-allocated memory, then `SafeRefCounted` will add it to the GC memory
that is scanned for pointers, and remove it from GC scanning before
`free` is called on the store.
@@ -6607,8 +6631,15 @@ still be valid during the destructor call. This allows the `T` to
deallocate or clean up any non-GC resources immediately after the
reference count has reached zero.
-`RefCounted` is unsafe and should be used with care. No references
-to the payload should be escaped outside the `RefCounted` object.
+Without -preview=dip1000, `SafeRefCounted` is unsafe and should be
+used with care. No references to the payload should be escaped outside
+the `SafeRefCounted` object.
+
+With -preview=dip1000, `SafeRefCounted` is safe if it's payload is accessed only
+with the $(LREF borrow) function. Scope semantics can also prevent accidental
+escaping of `refCountedPayload`, but it's still up to the user to not destroy
+the last counted reference while the payload is in use. Due to that,
+`refCountedPayload` remains accessible only in `@system` code.
The `autoInit` option makes the object ensure the store is
automatically initialized. Leaving $(D autoInit ==
@@ -6621,8 +6652,11 @@ pointer dereference.
If `T.this()` is annotated with `@disable` then `autoInit` must be
`RefCountedAutoInitialize.no` in order to compile.
+
+See_Also:
+ $(LREF RefCounted)
*/
-struct RefCounted(T, RefCountedAutoInitialize autoInit =
+struct SafeRefCounted(T, RefCountedAutoInitialize autoInit =
RefCountedAutoInitialize.yes)
if (!is(T == class) && !(is(T == interface)))
{
@@ -6642,7 +6676,20 @@ if (!is(T == class) && !(is(T == interface)))
import core.memory : GC;
}
- /// `RefCounted` storage implementation.
+ pragma(inline, true) private void checkInit()()
+ if (autoInit == RefCountedAutoInitialize.yes)
+ {
+ _refCounted.ensureInitialized();
+ }
+
+ pragma(inline, true) private void checkInit()() inout
+ if (autoInit == RefCountedAutoInitialize.no)
+ {
+ assert(_refCounted.isInitialized,
+ "Attempted to use an uninitialized payload.");
+ }
+
+ /// `SafeRefCounted` storage implementation.
struct RefCountedStore
{
private struct Impl
@@ -6658,7 +6705,7 @@ if (!is(T == class) && !(is(T == interface)))
import core.lifetime : emplace, forward;
allocateStore();
- version (D_Exceptions) scope(failure) deallocateStore();
+ version (D_Exceptions) scope(failure) () @trusted { deallocateStore(); }();
emplace(&_store._payload, forward!args);
_store._count = 1;
}
@@ -6668,7 +6715,7 @@ if (!is(T == class) && !(is(T == interface)))
import std.algorithm.mutation : moveEmplace;
allocateStore();
- moveEmplace(source, _store._payload);
+ () @trusted { moveEmplace(source, _store._payload); }();
_store._count = 1;
}
@@ -6678,13 +6725,15 @@ if (!is(T == class) && !(is(T == interface)))
static if (enableGCScan)
{
import std.internal.memory : enforceCalloc;
- _store = cast(Impl*) enforceCalloc(1, Impl.sizeof);
- GC.addRange(&_store._payload, T.sizeof);
+ auto ptr = enforceCalloc(1, Impl.sizeof);
+ _store = () @trusted { return cast(Impl*) ptr; }();
+ () @trusted { GC.addRange(&_store._payload, T.sizeof); }();
}
else
{
import std.internal.memory : enforceMalloc;
- _store = cast(Impl*) enforceMalloc(Impl.sizeof);
+ auto ptr = enforceMalloc(Impl.sizeof);
+ _store = () @trusted { return cast(Impl*) ptr; }();
}
}
@@ -6725,6 +6774,7 @@ if (!is(T == class) && !(is(T == interface)))
This function is unavailable if `T.this()` is annotated with
`@disable`.
*/
+ @safe pure nothrow
void ensureInitialized()()
{
// By checking for `@disable this()` and failing early we can
@@ -6763,7 +6813,7 @@ Postcondition: `refCountedStore.isInitialized`
}
/// Ditto
- this(T val)
+ this(return scope T val)
{
_refCounted.move(val);
}
@@ -6786,18 +6836,30 @@ to deallocate the corresponding resource.
*/
~this()
{
+ import std.traits : dip1000Enabled;
+
+ // This prevents the same reference from decrementing the count twice.
+ scope(exit) _refCounted = _refCounted.init;
+
if (!_refCounted.isInitialized) return;
assert(_refCounted._store._count > 0);
- if (--_refCounted._store._count)
- return;
+ if (--_refCounted._store._count) return;
// Done, destroy and deallocate
.destroy(_refCounted._store._payload);
- _refCounted.deallocateStore();
+
+ static if (dip1000Enabled)
+ {
+ () @trusted { _refCounted.deallocateStore(); }();
+ }
+ else _refCounted.deallocateStore();
}
/**
-Assignment operators
- */
+Assignment operators.
+
+Note: You may not assign a new payload to an uninitialized SafeRefCounted, if
+auto initialization is off. Assigning another counted reference is still okay.
+*/
void opAssign(typeof(this) rhs)
{
import std.algorithm.mutation : swap;
@@ -6810,14 +6872,7 @@ Assignment operators
{
import std.algorithm.mutation : move;
- static if (autoInit == RefCountedAutoInitialize.yes)
- {
- _refCounted.ensureInitialized();
- }
- else
- {
- assert(_refCounted.isInitialized);
- }
+ checkInit();
move(rhs, _refCounted._store._payload);
}
@@ -6829,20 +6884,20 @@ Assignment operators
RefCountedAutoInitialize.yes), calls $(D
refCountedStore.ensureInitialized). Otherwise, just issues $(D
assert(refCountedStore.isInitialized)). Used with $(D alias
- refCountedPayload this;), so callers can just use the `RefCounted`
+ refCountedPayload this;), so callers can just use the `SafeRefCounted`
object as a `T`.
$(BLUE The first overload exists only if $(D autoInit == RefCountedAutoInitialize.yes).)
So if $(D autoInit == RefCountedAutoInitialize.no)
or called for a constant or immutable object, then
- `refCountedPayload` will also be qualified as safe and nothrow
+ `refCountedPayload` will also be qualified as nothrow
(but will still assert if not initialized).
*/
- @property @trusted
+ @property @system
ref T refCountedPayload() return;
/// ditto
- @property nothrow @safe pure @nogc
+ @property nothrow @system pure @nogc
ref inout(T) refCountedPayload() inout return;
}
else
@@ -6850,19 +6905,21 @@ Assignment operators
static if (autoInit == RefCountedAutoInitialize.yes)
{
//Can't use inout here because of potential mutation
- @property
+ @property @system
ref T refCountedPayload() return
{
- _refCounted.ensureInitialized();
+ checkInit();
return _refCounted._store._payload;
}
}
-
- @property nothrow @safe pure @nogc
- ref inout(T) refCountedPayload() inout return
+ else
{
- assert(_refCounted.isInitialized, "Attempted to access an uninitialized payload.");
- return _refCounted._store._payload;
+ @property nothrow @system pure @nogc
+ ref inout(T) refCountedPayload() inout return
+ {
+ checkInit();
+ return _refCounted._store._payload;
+ }
}
}
@@ -6898,7 +6955,7 @@ assert(refCountedStore.isInitialized)).
{
// A pair of an `int` and a `size_t` - the latter being the
// reference count - will be dynamically allocated
- auto rc1 = RefCounted!int(5);
+ auto rc1 = SafeRefCounted!int(5);
assert(rc1 == 5);
// No more allocation, add just one extra reference count
auto rc2 = rc1;
@@ -6908,46 +6965,66 @@ assert(refCountedStore.isInitialized)).
// the pair will be freed when rc1 and rc2 go out of scope
}
-pure @system unittest
+// This test can't be betterC because the test extractor won't see the private
+// `initialize` method accessed here
+pure @safe nothrow @nogc unittest
{
- RefCounted!int* p;
- {
- auto rc1 = RefCounted!int(5);
- p = &rc1;
- assert(rc1 == 5);
- assert(rc1._refCounted._store._count == 1);
- auto rc2 = rc1;
- assert(rc1._refCounted._store._count == 2);
- // Reference semantics
- rc2 = 42;
- assert(rc1 == 42);
- rc2 = rc2;
- assert(rc2._refCounted._store._count == 2);
- rc1 = rc2;
- assert(rc1._refCounted._store._count == 2);
- }
- assert(p._refCounted._store == null);
+ auto rc1 = SafeRefCounted!(int, RefCountedAutoInitialize.no)(5);
+ rc1._refCounted.initialize();
+}
- // RefCounted as a member
- struct A
+pure @system unittest
+{
+ foreach (MyRefCounted; AliasSeq!(SafeRefCounted, RefCounted))
{
- RefCounted!int x;
- this(int y)
+ MyRefCounted!int* p;
{
- x._refCounted.initialize(y);
+ auto rc1 = MyRefCounted!int(5);
+ p = &rc1;
+ assert(rc1 == 5);
+ assert(rc1._refCounted._store._count == 1);
+ auto rc2 = rc1;
+ assert(rc1._refCounted._store._count == 2);
+ // Reference semantics
+ rc2 = 42;
+ assert(rc1 == 42);
+ rc2 = rc2;
+ assert(rc2._refCounted._store._count == 2);
+ rc1 = rc2;
+ assert(rc1._refCounted._store._count == 2);
}
- A copy()
+ assert(p._refCounted._store == null);
+
+ // [Safe]RefCounted as a member
+ struct A
{
- auto another = this;
- return another;
+ MyRefCounted!int x;
+ this(int y)
+ {
+ x._refCounted.initialize(y);
+ }
+ A copy()
+ {
+ auto another = this;
+ return another;
+ }
}
- }
- auto a = A(4);
- auto b = a.copy();
- assert(a.x._refCounted._store._count == 2,
- "https://issues.dlang.org/show_bug.cgi?id=4356 still unfixed");
+ auto a = A(4);
+ auto b = a.copy();
+ assert(a.x._refCounted._store._count == 2,
+ "https://issues.dlang.org/show_bug.cgi?id=4356 still unfixed");
+ }
}
+@betterC pure @safe nothrow @nogc unittest
+{
+ import std.algorithm.mutation : swap;
+
+ SafeRefCounted!int p1, p2;
+ swap(p1, p2);
+}
+
+// Same as above but for old RefCounted and not @safe
@betterC pure @system nothrow @nogc unittest
{
import std.algorithm.mutation : swap;
@@ -6968,25 +7045,52 @@ pure @system unittest
U u;
}
+ alias SRC = SafeRefCounted!S;
+}
+
+// Same as above but for old RefCounted and not @safe
+@betterC @system pure nothrow @nogc unittest
+{
+ union U {
+ size_t i;
+ void* p;
+ }
+
+ struct S {
+ U u;
+ }
+
alias SRC = RefCounted!S;
}
// https://issues.dlang.org/show_bug.cgi?id=6436
@betterC @system pure unittest
{
+ import std.meta : AliasSeq;
struct S
{
this(int rval) { assert(rval == 1); }
this(ref int lval) { assert(lval == 3); ++lval; }
}
- auto s1 = RefCounted!S(1);
- int lval = 3;
- auto s2 = RefCounted!S(lval);
- assert(lval == 4);
+ foreach (MyRefCounted; AliasSeq!(SafeRefCounted, RefCounted))
+ {
+ auto s1 = MyRefCounted!S(1);
+ int lval = 3;
+ auto s2 = MyRefCounted!S(lval);
+ assert(lval == 4);
+ }
}
// gc_addRange coverage
+@betterC @safe pure unittest
+{
+ struct S { int* p; }
+
+ auto s = SafeRefCounted!S(null);
+}
+
+// Same as above but for old RefCounted and not @safe
@betterC @system pure unittest
{
struct S { int* p; }
@@ -6996,69 +7100,253 @@ pure @system unittest
@betterC @system pure nothrow @nogc unittest
{
- RefCounted!int a;
- a = 5; //This should not assert
- assert(a == 5);
+ import std.meta : AliasSeq;
+ foreach (MyRefCounted; AliasSeq!(SafeRefCounted, RefCounted))
+ {
+ MyRefCounted!int a;
+ a = 5; //This should not assert
+ assert(a == 5);
- RefCounted!int b;
- b = a; //This should not assert either
- assert(b == 5);
+ MyRefCounted!int b;
+ b = a; //This should not assert either
+ assert(b == 5);
- RefCounted!(int*) c;
+ MyRefCounted!(int*) c;
+ }
}
// https://issues.dlang.org/show_bug.cgi?id=21638
@betterC @system pure nothrow @nogc unittest
{
+ import std.meta : AliasSeq;
static struct NoDefaultCtor
{
@disable this();
this(int x) @nogc nothrow pure { this.x = x; }
int x;
}
- auto rc = RefCounted!(NoDefaultCtor, RefCountedAutoInitialize.no)(5);
- assert(rc.x == 5);
+
+ foreach (MyRefCounted; AliasSeq!(SafeRefCounted, RefCounted))
+ {
+ auto rc = MyRefCounted!(NoDefaultCtor, RefCountedAutoInitialize.no)(5);
+ assert(rc.x == 5);
+ }
}
// https://issues.dlang.org/show_bug.cgi?id=20502
@system unittest
{
- import std.conv : to;
- // Check that string conversion is transparent for refcounted
- // structs that do not have either toString or alias this.
- static struct A { Object a; }
- auto a = A(new Object());
- auto r = refCounted(a);
- assert(to!string(r) == to!string(a));
- assert(to!string(cast(const) r) == to!string(cast(const) a));
- // Check that string conversion is still transparent for refcounted
- // structs that have alias this.
- static struct B { int b; alias b this; }
- static struct C { B b; alias b this; }
- assert(to!string(refCounted(C(B(123)))) == to!string(C(B(123))));
- // https://issues.dlang.org/show_bug.cgi?id=22093
- // Check that uninitialized refcounted structs that previously could be
- // converted to strings still can be.
- alias R = typeof(r);
- R r2;
- cast(void) (((const ref R a) => to!string(a))(r2));
- cast(void) to!string(RefCounted!(A, RefCountedAutoInitialize.no).init);
+ alias Types = AliasSeq!(SafeRefCounted, RefCounted);
+ alias funcs = AliasSeq!(safeRefCounted, refCounted);
+ static foreach (aliasI; 0 .. 2)
+ {{
+ alias MyRefCounted = Types[aliasI];
+ alias myRefCounted = funcs[aliasI];
+ import std.conv : to;
+
+ // Check that string conversion is transparent for refcounted
+ // structs that do not have either toString or alias this.
+ static struct A { Object a; }
+ auto a = A(new Object());
+ auto r = myRefCounted(a);
+ assert(to!string(r) == to!string(a));
+ assert(to!string(cast(const) r) == to!string(cast(const) a));
+ // Check that string conversion is still transparent for refcounted
+ // structs that have alias this.
+ static struct B { int b; alias b this; }
+ static struct C { B b; alias b this; }
+ assert(to!string(myRefCounted(C(B(123)))) == to!string(C(B(123))));
+ // https://issues.dlang.org/show_bug.cgi?id=22093
+ // Check that uninitialized refcounted structs that previously could be
+ // converted to strings still can be.
+ alias R = typeof(r);
+ R r2;
+ cast(void) (((const ref R a) => to!string(a))(r2));
+ cast(void) to!string(MyRefCounted!(A, RefCountedAutoInitialize.no).init);
+ }}
+}
+
+// We tried to make `refCountedPayload` `@safe` in
+// https://github.com/dlang/phobos/pull/8368 . It proved impossible, but it may
+// be possible in the future. This test checks for false `@safe` issues we
+// encountered.
+@safe unittest
+{
+ struct Container
+ {
+ int[] data;
+ }
+
+ int[] getArr1 (scope Container local)
+ {
+ // allowed because the argument is inferred as return scope.
+ return local.data;
+ }
+
+ int[] getArr2 (scope Container local)
+ {
+ SafeRefCounted!Container rc = local;
+ // Escapes a reference to expired reference counted struct
+ // don't do this!
+ return rc.refCountedPayload().data;
+ }
+
+ int destroyFirstAndUseLater()
+ {
+ auto rc = SafeRefCounted!int(123);
+ int* ptr = &rc.refCountedPayload();
+ destroy(rc);
+ return *ptr;
+ }
+
+ // This is here mainly to test that safety gets inferred correctly for the
+ // next tests
+ static assert(isSafe!getArr1);
+ // https://github.com/dlang/phobos/pull/8101#issuecomment-843017282
+ // This got apparently fixed automatically by compiler updates.
+ static assert(!isSafe!getArr2);
+ // As of writing, this is the issue that is still preventing payload access
+ // from being `@safe`
+ static assert(!isSafe!destroyFirstAndUseLater);
+}
+
+/**
+Borrows the payload of $(LREF SafeRefCounted) for use in `fun`. Inferred as `@safe`
+if `fun` is `@safe` and does not escape a reference to the payload.
+The reference count will be incremented for the duration of the operation,
+so destroying the last reference will not leave dangling references in
+`fun`.
+
+Params:
+ fun = A callable accepting the payload either by value or by reference.
+ refCount = The counted reference to the payload.
+Returns:
+ The return value of `fun`, if any. `ref` in the return value will be
+ forwarded.
+Issues:
+ For yet unknown reason, code that uses this function with UFCS syntax
+ will not be inferred as `@safe`. It will still compile if the code is
+ explicitly marked `@safe` and nothing in `fun` prevents that.
+*/
+template borrow(alias fun)
+{
+ import std.functional : unaryFun;
+
+ auto ref borrow(RC)(RC refCount) if
+ (
+ isInstanceOf!(SafeRefCounted, RC)
+ && is(typeof(unaryFun!fun(refCount.refCountedPayload)))
+ )
+ {
+ refCount.checkInit();
+
+ // If `fun` escapes a reference to the payload, it will be inferred
+ // as unsafe due to the scope storage class here.
+ scope plPtr = &refCount._refCounted._store._payload;
+ return unaryFun!fun(*plPtr);
+
+ // We destroy our copy of the reference here, automatically destroying
+ // the payload if `fun` destroyed the last reference outside.
+ }
+}
+
+/// This example can be marked `@safe` with `-preview=dip1000`.
+@safe pure nothrow unittest
+{
+ auto rcInt = safeRefCounted(5);
+ assert(rcInt.borrow!(theInt => theInt) == 5);
+ auto sameInt = rcInt;
+ assert(sameInt.borrow!"a" == 5);
+
+ // using `ref` in the function
+ auto arr = [0, 1, 2, 3, 4, 5, 6];
+ sameInt.borrow!(ref (x) => arr[x]) = 10;
+ assert(arr == [0, 1, 2, 3, 4, 10, 6]);
+
+ // modifying the payload via an alias
+ sameInt.borrow!"a*=2";
+ assert(rcInt.borrow!"a" == 10);
+}
+
+// Some memory safety penetration testing.
+@system unittest
+{
+ int* globalPtr;
+ int torpedoesFired = 0;
+ struct Destroyer { ~this() @safe { torpedoesFired++; } }
+
+ alias RcInt = typeof(safeRefCounted(0));
+ auto standardUsage(RcInt arg)
+ {
+ return borrow!((ref x) => x)(arg);
+ }
+ ref harmlessRefReturn(RcInt arg)
+ {
+ return borrow!(ref (ref x) => *globalPtr = x)(arg);
+ }
+ ref problematicRefReturn(RcInt arg)
+ {
+ return borrow!(ref (ref x) => x)(arg);
+ }
+ auto sideChannelEscape(RcInt arg)
+ {
+ return borrow!((ref x)
+ {
+ globalPtr = &x;
+ return x;
+ })(arg);
+ }
+ auto destroyDuringApply()
+ {
+ auto rc = safeRefCounted(Destroyer());
+ return borrow!((ref x)
+ {
+ // Destroys the last reference to the payload, decrementing it's
+ // reference count.
+ rc.__dtor();
+ // Destroy again! rc should be set to it's init value so that this
+ // won't decrement the reference count of the original payload.
+ rc.__dtor();
+ // The internal reference count increment done for duration of
+ // `apply` should make sure that the payload destructor is not yet
+ // run, and this value thus not incremented.
+ return torpedoesFired;
+ })(rc);
+ }
+
+ // First, let's verify the dangerous functions really do what they are
+ // supposed to do.
+ auto testRc = safeRefCounted(42);
+ assert(sideChannelEscape(testRc) == 42);
+ assert(&problematicRefReturn(testRc) == globalPtr);
+
+ // Now, are the @safe attributes inferred correctly?
+ assert(isSafe!standardUsage);
+ assert(isSafe!harmlessRefReturn);
+ assert(!isSafe!problematicRefReturn);
+ assert(!isSafe!sideChannelEscape);
+ assert(isSafe!destroyDuringApply);
+
+ // Finally, we test protection against early destruction during `apply`.
+ auto torpedoesUpToReturn = destroyDuringApply();
+ assert(torpedoesFired == torpedoesUpToReturn + 1);
}
/**
- * Initializes a `RefCounted` with `val`. The template parameter
- * `T` of `RefCounted` is inferred from `val`.
+ * Initializes a `SafeRefCounted` with `val`. The template parameter
+ * `T` of `SafeRefCounted` is inferred from `val`.
* This function can be used to move non-copyable values to the heap.
- * It also disables the `autoInit` option of `RefCounted`.
+ * It also disables the `autoInit` option of `SafeRefCounted`.
*
* Params:
* val = The value to be reference counted
* Returns:
- * An initialized `RefCounted` containing `val`.
+ * An initialized `SafeRefCounted` containing `val`.
* See_Also:
+ * $(LREF refCounted)
* $(HTTP en.cppreference.com/w/cpp/memory/shared_ptr/make_shared, C++'s make_shared)
*/
-RefCounted!(T, RefCountedAutoInitialize.no) refCounted(T)(T val)
+SafeRefCounted!(T, RefCountedAutoInitialize.no) safeRefCounted(T)(T val)
{
typeof(return) res;
res._refCounted.move(val);
@@ -7083,13 +7371,13 @@ RefCounted!(T, RefCountedAutoInitialize.no) refCounted(T)(T val)
assert(File.nDestroyed == 0);
- // make the file refcounted to share ownership
+ // make the file ref counted to share ownership
// Note:
- // We write a compound statement (brace-delimited scope) in which all `RefCounted!File` handles are created and deleted.
+ // We write a compound statement (brace-delimited scope) in which all `SafeRefCounted!File` handles are created and deleted.
// This allows us to see (after the scope) what happens after all handles have been destroyed.
{
// We move the content of `file` to a separate (and heap-allocated) `File` object,
- // managed-and-accessed via one-or-multiple (initially: one) `RefCounted!File` objects ("handles").
+ // managed-and-accessed via one-or-multiple (initially: one) `SafeRefCounted!File` objects ("handles").
// This "moving":
// (1) invokes `file`'s destructor (=> `File.nDestroyed` is incremented from 0 to 1 and `file.name` becomes `null`);
// (2) overwrites `file` with `File.init` (=> `file.name` becomes `null`).
@@ -7097,18 +7385,18 @@ RefCounted!(T, RefCountedAutoInitialize.no) refCounted(T)(T val)
// but please note that (2) is only performed if `File` defines a destructor (or post-blit operator),
// and in the absence of the `nDestroyed` instrumentation there would have been no reason to define a destructor.
import std.algorithm.mutation : move;
- auto rcFile = refCounted(move(file));
+ auto rcFile = safeRefCounted(move(file));
assert(rcFile.name == "name");
assert(File.nDestroyed == 1);
assert(file.name == null);
- // We create another `RefCounted!File` handle to the same separate `File` object.
+ // We create another `SafeRefCounted!File` handle to the same separate `File` object.
// While any of the handles is still alive, the `File` object is kept alive (=> `File.nDestroyed` is not modified).
auto rcFile2 = rcFile;
assert(rcFile.refCountedStore.refCount == 2);
assert(File.nDestroyed == 1);
}
- // The separate `File` object is deleted when the last `RefCounted!File` handle is destroyed
+ // The separate `File` object is deleted when the last `SafeRefCounted!File` handle is destroyed
// (i.e. at the closing brace of the compound statement above, which destroys both handles: `rcFile` and `rcFile2`)
// (=> `File.nDestroyed` is incremented again, from 1 to 2):
assert(File.nDestroyed == 2);
@@ -9823,3 +10111,265 @@ unittest
Nullable!S s2 = s1;
assert(s2.get().b == 3);
}
+
+/// The old version of $(LREF SafeRefCounted), before $(LREF borrow) existed.
+/// Old code may be relying on `@safe`ty of some of the member functions which
+/// cannot be safe in the new scheme, and
+/// can avoid breakage by continuing to use this. `SafeRefCounted` should be
+/// preferred, as this type is outdated and unrecommended for new code.
+struct RefCounted(T, RefCountedAutoInitialize autoInit =
+ RefCountedAutoInitialize.yes)
+{
+ version (D_BetterC)
+ {
+ private enum enableGCScan = false;
+ }
+ else
+ {
+ private enum enableGCScan = hasIndirections!T;
+ }
+
+ extern(C) private pure nothrow @nogc static
+ {
+ pragma(mangle, "free") void pureFree( void *ptr );
+ static if (enableGCScan)
+ import core.memory : GC;
+ }
+
+ struct RefCountedStore
+ {
+ private struct Impl
+ {
+ T _payload;
+ size_t _count;
+ }
+
+ private Impl* _store;
+
+ private void initialize(A...)(auto ref A args)
+ {
+ import core.lifetime : emplace, forward;
+
+ allocateStore();
+ version (D_Exceptions) scope(failure) deallocateStore();
+ emplace(&_store._payload, forward!args);
+ _store._count = 1;
+ }
+
+ private void move(ref T source) nothrow pure
+ {
+ import std.algorithm.mutation : moveEmplace;
+
+ allocateStore();
+ moveEmplace(source, _store._payload);
+ _store._count = 1;
+ }
+
+ // 'nothrow': can only generate an Error
+ private void allocateStore() nothrow pure
+ {
+ static if (enableGCScan)
+ {
+ import std.internal.memory : enforceCalloc;
+ _store = cast(Impl*) enforceCalloc(1, Impl.sizeof);
+ GC.addRange(&_store._payload, T.sizeof);
+ }
+ else
+ {
+ import std.internal.memory : enforceMalloc;
+ _store = cast(Impl*) enforceMalloc(Impl.sizeof);
+ }
+ }
+
+ private void deallocateStore() nothrow pure
+ {
+ static if (enableGCScan)
+ {
+ GC.removeRange(&this._store._payload);
+ }
+ pureFree(_store);
+ _store = null;
+ }
+
+ @property nothrow @safe pure @nogc
+ bool isInitialized() const
+ {
+ return _store !is null;
+ }
+
+ @property nothrow @safe pure @nogc
+ size_t refCount() const
+ {
+ return isInitialized ? _store._count : 0;
+ }
+
+ void ensureInitialized()()
+ {
+ // By checking for `@disable this()` and failing early we can
+ // produce a clearer error message.
+ static assert(__traits(compiles, { static T t; }),
+ "Cannot automatically initialize `" ~ fullyQualifiedName!T ~
+ "` because `" ~ fullyQualifiedName!T ~
+ ".this()` is annotated with `@disable`.");
+ if (!isInitialized) initialize();
+ }
+
+ }
+ RefCountedStore _refCounted;
+
+ @property nothrow @safe
+ ref inout(RefCountedStore) refCountedStore() inout
+ {
+ return _refCounted;
+ }
+
+ this(A...)(auto ref A args) if (A.length > 0)
+ out
+ {
+ assert(refCountedStore.isInitialized);
+ }
+ do
+ {
+ import core.lifetime : forward;
+ _refCounted.initialize(forward!args);
+ }
+
+ this(T val)
+ {
+ _refCounted.move(val);
+ }
+
+ this(this) @safe pure nothrow @nogc
+ {
+ if (!_refCounted.isInitialized) return;
+ ++_refCounted._store._count;
+ }
+
+ ~this()
+ {
+ if (!_refCounted.isInitialized) return;
+ assert(_refCounted._store._count > 0);
+ if (--_refCounted._store._count)
+ return;
+ // Done, destroy and deallocate
+ .destroy(_refCounted._store._payload);
+ _refCounted.deallocateStore();
+ }
+
+ void opAssign(typeof(this) rhs)
+ {
+ import std.algorithm.mutation : swap;
+
+ swap(_refCounted._store, rhs._refCounted._store);
+ }
+
+ void opAssign(T rhs)
+ {
+ import std.algorithm.mutation : move;
+
+ static if (autoInit == RefCountedAutoInitialize.yes)
+ {
+ _refCounted.ensureInitialized();
+ }
+ else
+ {
+ assert(_refCounted.isInitialized);
+ }
+ move(rhs, _refCounted._store._payload);
+ }
+
+ static if (autoInit == RefCountedAutoInitialize.yes)
+ {
+ //Can't use inout here because of potential mutation
+ @property
+ ref T refCountedPayload() return
+ {
+ _refCounted.ensureInitialized();
+ return _refCounted._store._payload;
+ }
+ }
+
+ @property nothrow @safe pure @nogc
+ ref inout(T) refCountedPayload() inout return
+ {
+ assert(_refCounted.isInitialized, "Attempted to access an uninitialized payload.");
+ return _refCounted._store._payload;
+ }
+
+ alias refCountedPayload this;
+
+ static if (is(T == struct) && !is(typeof((ref T t) => t.toString())))
+ {
+ string toString(this This)()
+ {
+ import std.conv : to;
+
+ static if (autoInit)
+ return to!string(refCountedPayload);
+ else
+ {
+ if (!_refCounted.isInitialized)
+ return This.stringof ~ "(RefCountedStore(null))";
+ else
+ return to!string(_refCounted._store._payload);
+ }
+ }
+ }
+}
+
+///
+@betterC pure @system nothrow @nogc unittest
+{
+ auto rc1 = RefCounted!int(5);
+ assert(rc1 == 5);
+ auto rc2 = rc1;
+ rc2 = 42;
+ assert(rc1 == 42);
+}
+
+// More unit tests below SafeRefCounted
+
+/**
+ * Like $(LREF safeRefCounted) but used to initialize $(LREF RefCounted)
+ * instead. Intended for backwards compatibility, otherwise it is preferable
+ * to use `safeRefCounted`.
+ */
+RefCounted!(T, RefCountedAutoInitialize.no) refCounted(T)(T val)
+{
+ typeof(return) res;
+ res._refCounted.move(val);
+ return res;
+}
+
+///
+@system unittest
+{
+ static struct File
+ {
+ static size_t nDestroyed;
+ string name;
+ @disable this(this); // not copyable
+ ~this() { name = null; ++nDestroyed; }
+ }
+
+ auto file = File("name");
+ assert(file.name == "name");
+ static assert(!__traits(compiles, {auto file2 = file;}));
+ assert(File.nDestroyed == 0);
+
+ {
+ import std.algorithm.mutation : move;
+ auto rcFile = refCounted(move(file));
+ assert(rcFile.name == "name");
+ assert(File.nDestroyed == 1);
+ assert(file.name == null);
+
+ auto rcFile2 = rcFile;
+ assert(rcFile.refCountedStore.refCount == 2);
+ assert(File.nDestroyed == 1);
+ }
+
+ assert(File.nDestroyed == 2);
+}
+
+// More unit tests below safeRefCounted
diff --git a/libphobos/src/std/uni/package.d b/libphobos/src/std/uni/package.d
index 8a032aa..81b949e 100644
--- a/libphobos/src/std/uni/package.d
+++ b/libphobos/src/std/uni/package.d
@@ -10193,16 +10193,7 @@ bool isAlpha(dchar c)
// optimization
if (c < 0xAA)
{
- size_t x = c - 'A';
- if (x <= 'Z' - 'A')
- return true;
- else
- {
- x = c - 'a';
- if (x <= 'z'-'a')
- return true;
- }
- return false;
+ return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
}
return alphaTrie[c];
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b668b93..a4d9275 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,88 @@
+2022-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * include/std/complex (complex::complex converting ctor): For C++23
+ use explicit specifier with constant expression. Explicitly cast
+ both parts to _Tp.
+ (__complex_abs, __complex_arg, __complex_cos, __complex_cosh,
+ __complex_exp, __complex_log, __complex_sin, __complex_sinh,
+ __complex_sqrt, __complex_tan, __complex_tanh, __complex_pow): Add
+ __complex__ _Float{16,32,64,128} and __complex__ decltype(0.0bf16)
+ overloads.
+ (complex<float>::complex converting ctor,
+ complex<double>::complex converting ctor,
+ complex<long double>::complex converting ctor): For C++23 implement
+ as template with explicit specifier with constant expression
+ and explicit casts.
+ (__complex_type): New template.
+ (complex): New partial specialization for types with extended floating
+ point types.
+ (__complex_acos, __complex_asin, __complex_atan, __complex_acosh,
+ __complex_asinh, __complex_atanh): Add __complex__ _Float{16,32,64,128}
+ and __complex__ decltype(0.0bf16) overloads.
+ (__complex_proj): Likewise. Add template for complex of extended
+ floating point types.
+ * include/bits/cpp_type_traits.h (__is_floating): Specialize for
+ _Float{16,32,64,128} and __gnu_cxx::__bfloat16_t.
+ * testsuite/26_numerics/complex/ext_c++23.cc: New test.
+
+2022-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * config/os/gnu-linux/os_defines.h (_GLIBCXX_HAVE_FLOAT128_MATH):
+ Uncomment.
+ * include/c_global/cmath (nextafter(_Float16, _Float16)): Make it constexpr.
+ If std::__is_constant_evaluated() call __builtin_nextafterf16.
+ (nextafter(__gnu_cxx::__bfloat16_t, __gnu_cxx::__bfloat16_t)): Similarly
+ but call __builtin_nextafterf16b.
+ * testsuite/26_numerics/headers/cmath/nextafter_c++23.cc (test): Add
+ static assertions to test constexpr nextafter.
+
+2022-10-28 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/fs_path.h (path::filename()): Fix dangling
+ reference.
+
+2022-10-28 Arsen Arsenović <arsen@aarsen.me>
+
+ * include/std/functional: Make placeholders inline, if possible.
+
+2022-10-28 Arsen Arsenović <arsen@aarsen.me>
+
+ * configure.ac: Stop generating gstdint.h.
+ * src/c++11/compatibility-atomic-c++0x.cc: Stop using gstdint.h.
+ * Makefile.in: Regenerate.
+ * aclocal.m4: Regenerate.
+ * config.h.in: Regenerate.
+ * configure: Regenerate.
+ * doc/Makefile.in: Regenerate.
+ * include/Makefile.in: Regenerate.
+ * libsupc++/Makefile.in: Regenerate.
+ * po/Makefile.in: Regenerate.
+ * python/Makefile.in: Regenerate.
+ * src/Makefile.in: Regenerate.
+ * src/c++11/Makefile.in: Regenerate.
+ * src/c++17/Makefile.in: Regenerate.
+ * src/c++20/Makefile.in: Regenerate.
+ * src/c++98/Makefile.in: Regenerate.
+ * src/filesystem/Makefile.in: Regenerate.
+ * src/libbacktrace/Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+
+2022-10-28 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/107376
+ * include/bits/regex_executor.h (_Executor::_Executor): Use same
+ allocator for _M_cur_results and _M_results.
+ * include/bits/regex_executor.tcc (_Executor::_M_main_dispatch):
+ Prevent possibly incorrect allocator propagating to
+ _M_cur_results.
+ * testsuite/28_regex/algorithms/regex_match/107376.cc: New test.
+
+2022-10-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106393
+ * include/bits/locale_classes.tcc: Add #pragma to disable
+ -Wdangling-reference with std::use_facet.
+
2022-10-21 Arsen Arsenović <arsen@aarsen.me>
* acinclude.m4: Default hosted to off if building without
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index a7c2b60..e6a5a5c 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -103,7 +103,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/aclocal.m4 b/libstdc++-v3/aclocal.m4
index b2f43aa..e5af3f6 100644
--- a/libstdc++-v3/aclocal.m4
+++ b/libstdc++-v3/aclocal.m4
@@ -865,7 +865,6 @@ m4_include([../config/lthostflags.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
-m4_include([../config/stdint.m4])
m4_include([../config/toolexeclibdir.m4])
m4_include([../config/unwind_ipinfo.m4])
m4_include([../libtool.m4])
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 2a3972e..acdfa99 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -760,21 +760,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* The size of `char', as computed by sizeof. */
-#undef SIZEOF_CHAR
-
-/* The size of `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
-/* The size of `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* The size of `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
-
-/* The size of `void *', as computed by sizeof. */
-#undef SIZEOF_VOID_P
-
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
diff --git a/libstdc++-v3/config/os/gnu-linux/os_defines.h b/libstdc++-v3/config/os/gnu-linux/os_defines.h
index e5b640a..044b4fc 100644
--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h
+++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h
@@ -57,7 +57,7 @@
|| (defined(__powerpc__) && defined(_ARCH_PWR8) \
&& defined(__LITTLE_ENDIAN__) && (_CALL_ELF == 2) \
&& defined(__FLOAT128__)))
-//# define _GLIBCXX_HAVE_FLOAT128_MATH 1
+# define _GLIBCXX_HAVE_FLOAT128_MATH 1
#endif
#if __GLIBC_PREREQ(2, 27)
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 72c8d3b..31ccff5d 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -2619,60 +2619,6 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_cxx_check_func
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=no"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof ($2))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-
# ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES
# ---------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -12236,7 +12182,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12239 "configure"
+#line 12185 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12342,7 +12288,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12345 "configure"
+#line 12291 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16066,7 +16012,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16069 "configure"
+#line 16015 "configure"
int main()
{
typedef bool atomic_type;
@@ -16101,7 +16047,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16104 "configure"
+#line 16050 "configure"
int main()
{
typedef short atomic_type;
@@ -16136,7 +16082,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16139 "configure"
+#line 16085 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16172,7 +16118,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16175 "configure"
+#line 16121 "configure"
int main()
{
typedef long long atomic_type;
@@ -16328,7 +16274,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16331 "configure"
+#line 16277 "configure"
int main()
{
_Decimal32 d1;
@@ -16370,7 +16316,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16373 "configure"
+#line 16319 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -68484,412 +68430,6 @@ $as_echo "#define HAVE_LINUX_FUTEX 1" >>confdefs.h
fi
-if test "$is_hosted" = yes; then
-# TODO: remove this and change src/c++11/compatibility-atomic-c++0x.cc to
-# use <stdint.h> instead of <gstdint.h>.
-
-
-inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'`
-
-acx_cv_header_stdint=stddef.h
-acx_cv_header_stdint_kind="(already complete)"
-for i in stdint.h $inttype_headers; do
- unset ac_cv_type_uintptr_t
- unset ac_cv_type_uintmax_t
- unset ac_cv_type_int_least32_t
- unset ac_cv_type_int_fast32_t
- unset ac_cv_type_uint64_t
- $as_echo_n "looking for a compliant stdint.h in $i, " >&6
- ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_uintmax_t" = xyes; then :
- acx_cv_header_stdint=$i
-else
- continue
-fi
-
- ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_uintptr_t" = xyes; then :
-
-else
- acx_cv_header_stdint_kind="(mostly complete)"
-fi
-
- ac_fn_c_check_type "$LINENO" "int_least32_t" "ac_cv_type_int_least32_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_int_least32_t" = xyes; then :
-
-else
- acx_cv_header_stdint_kind="(mostly complete)"
-fi
-
- ac_fn_c_check_type "$LINENO" "int_fast32_t" "ac_cv_type_int_fast32_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_int_fast32_t" = xyes; then :
-
-else
- acx_cv_header_stdint_kind="(mostly complete)"
-fi
-
- ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_uint64_t" = xyes; then :
-
-else
- acx_cv_header_stdint_kind="(lacks uint64_t)"
-fi
-
- break
-done
-if test "$acx_cv_header_stdint" = stddef.h; then
- acx_cv_header_stdint_kind="(lacks uintmax_t)"
- for i in stdint.h $inttype_headers; do
- unset ac_cv_type_uintptr_t
- unset ac_cv_type_uint32_t
- unset ac_cv_type_uint64_t
- $as_echo_n "looking for an incomplete stdint.h in $i, " >&6
- ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_uint32_t" = xyes; then :
- acx_cv_header_stdint=$i
-else
- continue
-fi
-
- ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_uint64_t" = xyes; then :
-
-fi
-
- ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_uintptr_t" = xyes; then :
-
-fi
-
- break
- done
-fi
-if test "$acx_cv_header_stdint" = stddef.h; then
- acx_cv_header_stdint_kind="(u_intXX_t style)"
- for i in sys/types.h $inttype_headers; do
- unset ac_cv_type_u_int32_t
- unset ac_cv_type_u_int64_t
- $as_echo_n "looking for u_intXX_t types in $i, " >&6
- ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_u_int32_t" = xyes; then :
- acx_cv_header_stdint=$i
-else
- continue
-fi
-
- ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "#include <sys/types.h>
-#include <$i>
-"
-if test "x$ac_cv_type_u_int64_t" = xyes; then :
-
-fi
-
- break
- done
-fi
-if test "$acx_cv_header_stdint" = stddef.h; then
- acx_cv_header_stdint_kind="(using manual detection)"
-fi
-
-test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no
-test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no
-test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no
-test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no
-test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no
-
-# ----------------- Summarize what we found so far
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what to include in include/gstdint.h" >&5
-$as_echo_n "checking what to include in include/gstdint.h... " >&6; }
-
-case `$as_basename -- include/gstdint.h ||
-$as_expr X/include/gstdint.h : '.*/\([^/][^/]*\)/*$' \| \
- Xinclude/gstdint.h : 'X\(//\)$' \| \
- Xinclude/gstdint.h : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/include/gstdint.h |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'` in
- stdint.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5
-$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
- inttypes.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5
-$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
- *) ;;
-esac
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5
-$as_echo "$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6; }
-
-# ----------------- done included file, check C basic types --------
-
-# Lacking an uintptr_t? Test size of void *
-case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in
- stddef.h:* | *:no) # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_void_p" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_void_p=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
-
- ;;
-esac
-
-# Lacking an uint64_t? Test size of long
-case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in
- stddef.h:*:* | *:no:no) # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if ${ac_cv_sizeof_long+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_long" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_long=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
- ;;
-esac
-
-if test $acx_cv_header_stdint = stddef.h; then
- # Lacking a good header? Test size of everything and deduce all types.
- # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if ${ac_cv_sizeof_int+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_int" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (int)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_int=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
-
-
- # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
-$as_echo_n "checking size of short... " >&6; }
-if ${ac_cv_sizeof_short+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_short" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (short)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_short=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
-$as_echo "$ac_cv_sizeof_short" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
-_ACEOF
-
-
- # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5
-$as_echo_n "checking size of char... " >&6; }
-if ${ac_cv_sizeof_char+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_char" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (char)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_char=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5
-$as_echo "$ac_cv_sizeof_char" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_CHAR $ac_cv_sizeof_char
-_ACEOF
-
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int8_t" >&5
-$as_echo_n "checking for type equivalent to int8_t... " >&6; }
- case "$ac_cv_sizeof_char" in
- 1) acx_cv_type_int8_t=char ;;
- *) as_fn_error $? "no 8-bit type, please report a bug" "$LINENO" 5
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int8_t" >&5
-$as_echo "$acx_cv_type_int8_t" >&6; }
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int16_t" >&5
-$as_echo_n "checking for type equivalent to int16_t... " >&6; }
- case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in
- 2:*) acx_cv_type_int16_t=int ;;
- *:2) acx_cv_type_int16_t=short ;;
- *) as_fn_error $? "no 16-bit type, please report a bug" "$LINENO" 5
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int16_t" >&5
-$as_echo "$acx_cv_type_int16_t" >&6; }
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int32_t" >&5
-$as_echo_n "checking for type equivalent to int32_t... " >&6; }
- case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in
- 4:*) acx_cv_type_int32_t=int ;;
- *:4) acx_cv_type_int32_t=long ;;
- *) as_fn_error $? "no 32-bit type, please report a bug" "$LINENO" 5
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int32_t" >&5
-$as_echo "$acx_cv_type_int32_t" >&6; }
-fi
-
-# These tests are here to make the output prettier
-
-if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then
- case "$ac_cv_sizeof_long" in
- 8) acx_cv_type_int64_t=long ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int64_t" >&5
-$as_echo_n "checking for type equivalent to int64_t... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5
-$as_echo "${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6; }
-fi
-
-# Now we can use the above types
-
-if test "$ac_cv_type_uintptr_t" != yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to intptr_t" >&5
-$as_echo_n "checking for type equivalent to intptr_t... " >&6; }
- case $ac_cv_sizeof_void_p in
- 2) acx_cv_type_intptr_t=int16_t ;;
- 4) acx_cv_type_intptr_t=int32_t ;;
- 8) acx_cv_type_intptr_t=int64_t ;;
- *) as_fn_error $? "no equivalent for intptr_t, please report a bug" "$LINENO" 5
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_intptr_t" >&5
-$as_echo "$acx_cv_type_intptr_t" >&6; }
-fi
-
-# ----------------- done all checks, emit header -------------
-ac_config_commands="$ac_config_commands include/gstdint.h"
-
-
-
-fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU c++filt" >&5
$as_echo_n "checking for GNU c++filt... " >&6; }
@@ -74304,24 +73844,6 @@ fi
-GCC="$GCC"
-CC="$CC"
-acx_cv_header_stdint="$acx_cv_header_stdint"
-acx_cv_type_int8_t="$acx_cv_type_int8_t"
-acx_cv_type_int16_t="$acx_cv_type_int16_t"
-acx_cv_type_int32_t="$acx_cv_type_int32_t"
-acx_cv_type_int64_t="$acx_cv_type_int64_t"
-acx_cv_type_intptr_t="$acx_cv_type_intptr_t"
-ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t"
-ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t"
-ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
-ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
-ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t"
-ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
-ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
-ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p"
-
-
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -74333,7 +73855,6 @@ do
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
- "include/gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/gstdint.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"scripts/testsuite_flags") CONFIG_FILES="$CONFIG_FILES scripts/testsuite_flags" ;;
"scripts/extract_symvers") CONFIG_FILES="$CONFIG_FILES scripts/extract_symvers" ;;
@@ -75767,378 +75288,6 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
_LT_EOF
;;
- "include/gstdint.h":C)
-if test "$GCC" = yes; then
- echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
-else
- echo "/* generated for $CC */" > tmp-stdint.h
-fi
-
-sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- #ifndef GCC_GENERATED_STDINT_H
- #define GCC_GENERATED_STDINT_H 1
-
- #include <sys/types.h>
-EOF
-
-if test "$acx_cv_header_stdint" != stdint.h; then
- echo "#include <stddef.h>" >> tmp-stdint.h
-fi
-if test "$acx_cv_header_stdint" != stddef.h; then
- echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h
-fi
-
-sed 's/^ *//' >> tmp-stdint.h <<EOF
- /* glibc uses these symbols as guards to prevent redefinitions. */
- #ifdef __int8_t_defined
- #define _INT8_T
- #define _INT16_T
- #define _INT32_T
- #endif
- #ifdef __uint32_t_defined
- #define _UINT32_T
- #endif
-
-EOF
-
-# ----------------- done header, emit basic int types -------------
-if test "$acx_cv_header_stdint" = stddef.h; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- #ifndef _UINT8_T
- #define _UINT8_T
- #ifndef __uint8_t_defined
- #define __uint8_t_defined
- #ifndef uint8_t
- typedef unsigned $acx_cv_type_int8_t uint8_t;
- #endif
- #endif
- #endif
-
- #ifndef _UINT16_T
- #define _UINT16_T
- #ifndef __uint16_t_defined
- #define __uint16_t_defined
- #ifndef uint16_t
- typedef unsigned $acx_cv_type_int16_t uint16_t;
- #endif
- #endif
- #endif
-
- #ifndef _UINT32_T
- #define _UINT32_T
- #ifndef __uint32_t_defined
- #define __uint32_t_defined
- #ifndef uint32_t
- typedef unsigned $acx_cv_type_int32_t uint32_t;
- #endif
- #endif
- #endif
-
- #ifndef _INT8_T
- #define _INT8_T
- #ifndef __int8_t_defined
- #define __int8_t_defined
- #ifndef int8_t
- typedef $acx_cv_type_int8_t int8_t;
- #endif
- #endif
- #endif
-
- #ifndef _INT16_T
- #define _INT16_T
- #ifndef __int16_t_defined
- #define __int16_t_defined
- #ifndef int16_t
- typedef $acx_cv_type_int16_t int16_t;
- #endif
- #endif
- #endif
-
- #ifndef _INT32_T
- #define _INT32_T
- #ifndef __int32_t_defined
- #define __int32_t_defined
- #ifndef int32_t
- typedef $acx_cv_type_int32_t int32_t;
- #endif
- #endif
- #endif
-EOF
-elif test "$ac_cv_type_u_int32_t" = yes; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */
- #ifndef _INT8_T
- #define _INT8_T
- #endif
- #ifndef _INT16_T
- #define _INT16_T
- #endif
- #ifndef _INT32_T
- #define _INT32_T
- #endif
-
- #ifndef _UINT8_T
- #define _UINT8_T
- #ifndef __uint8_t_defined
- #define __uint8_t_defined
- #ifndef uint8_t
- typedef u_int8_t uint8_t;
- #endif
- #endif
- #endif
-
- #ifndef _UINT16_T
- #define _UINT16_T
- #ifndef __uint16_t_defined
- #define __uint16_t_defined
- #ifndef uint16_t
- typedef u_int16_t uint16_t;
- #endif
- #endif
- #endif
-
- #ifndef _UINT32_T
- #define _UINT32_T
- #ifndef __uint32_t_defined
- #define __uint32_t_defined
- #ifndef uint32_t
- typedef u_int32_t uint32_t;
- #endif
- #endif
- #endif
-EOF
-else
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* Some systems have guard macros to prevent redefinitions, define them. */
- #ifndef _INT8_T
- #define _INT8_T
- #endif
- #ifndef _INT16_T
- #define _INT16_T
- #endif
- #ifndef _INT32_T
- #define _INT32_T
- #endif
- #ifndef _UINT8_T
- #define _UINT8_T
- #endif
- #ifndef _UINT16_T
- #define _UINT16_T
- #endif
- #ifndef _UINT32_T
- #define _UINT32_T
- #endif
-EOF
-fi
-
-# ------------- done basic int types, emit int64_t types ------------
-if test "$ac_cv_type_uint64_t" = yes; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* system headers have good uint64_t and int64_t */
- #ifndef _INT64_T
- #define _INT64_T
- #endif
- #ifndef _UINT64_T
- #define _UINT64_T
- #endif
-EOF
-elif test "$ac_cv_type_u_int64_t" = yes; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* system headers have an u_int64_t (and int64_t) */
- #ifndef _INT64_T
- #define _INT64_T
- #endif
- #ifndef _UINT64_T
- #define _UINT64_T
- #ifndef __uint64_t_defined
- #define __uint64_t_defined
- #ifndef uint64_t
- typedef u_int64_t uint64_t;
- #endif
- #endif
- #endif
-EOF
-elif test -n "$acx_cv_type_int64_t"; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* architecture has a 64-bit type, $acx_cv_type_int64_t */
- #ifndef _INT64_T
- #define _INT64_T
- #ifndef int64_t
- typedef $acx_cv_type_int64_t int64_t;
- #endif
- #endif
- #ifndef _UINT64_T
- #define _UINT64_T
- #ifndef __uint64_t_defined
- #define __uint64_t_defined
- #ifndef uint64_t
- typedef unsigned $acx_cv_type_int64_t uint64_t;
- #endif
- #endif
- #endif
-EOF
-else
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* some common heuristics for int64_t, using compiler-specific tests */
- #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L
- #ifndef _INT64_T
- #define _INT64_T
- #ifndef __int64_t_defined
- #ifndef int64_t
- typedef long long int64_t;
- #endif
- #endif
- #endif
- #ifndef _UINT64_T
- #define _UINT64_T
- #ifndef uint64_t
- typedef unsigned long long uint64_t;
- #endif
- #endif
-
- #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0
- /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
- does not implement __extension__. But that compiler doesn't define
- __GNUC_MINOR__. */
- # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
- # define __extension__
- # endif
-
- # ifndef _INT64_T
- # define _INT64_T
- # ifndef int64_t
- __extension__ typedef long long int64_t;
- # endif
- # endif
- # ifndef _UINT64_T
- # define _UINT64_T
- # ifndef uint64_t
- __extension__ typedef unsigned long long uint64_t;
- # endif
- # endif
-
- #elif !defined __STRICT_ANSI__
- # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
-
- # ifndef _INT64_T
- # define _INT64_T
- # ifndef int64_t
- typedef __int64 int64_t;
- # endif
- # endif
- # ifndef _UINT64_T
- # define _UINT64_T
- # ifndef uint64_t
- typedef unsigned __int64 uint64_t;
- # endif
- # endif
- # endif /* compiler */
-
- #endif /* ANSI version */
-EOF
-fi
-
-# ------------- done int64_t types, emit intptr types ------------
-if test "$ac_cv_type_uintptr_t" != yes; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */
- #ifndef __uintptr_t_defined
- #ifndef uintptr_t
- typedef u$acx_cv_type_intptr_t uintptr_t;
- #endif
- #endif
- #ifndef __intptr_t_defined
- #ifndef intptr_t
- typedef $acx_cv_type_intptr_t intptr_t;
- #endif
- #endif
-EOF
-fi
-
-# ------------- done intptr types, emit int_least types ------------
-if test "$ac_cv_type_int_least32_t" != yes; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* Define int_least types */
- typedef int8_t int_least8_t;
- typedef int16_t int_least16_t;
- typedef int32_t int_least32_t;
- #ifdef _INT64_T
- typedef int64_t int_least64_t;
- #endif
-
- typedef uint8_t uint_least8_t;
- typedef uint16_t uint_least16_t;
- typedef uint32_t uint_least32_t;
- #ifdef _UINT64_T
- typedef uint64_t uint_least64_t;
- #endif
-EOF
-fi
-
-# ------------- done intptr types, emit int_fast types ------------
-if test "$ac_cv_type_int_fast32_t" != yes; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* Define int_fast types. short is often slow */
- typedef int8_t int_fast8_t;
- typedef int int_fast16_t;
- typedef int32_t int_fast32_t;
- #ifdef _INT64_T
- typedef int64_t int_fast64_t;
- #endif
-
- typedef uint8_t uint_fast8_t;
- typedef unsigned int uint_fast16_t;
- typedef uint32_t uint_fast32_t;
- #ifdef _UINT64_T
- typedef uint64_t uint_fast64_t;
- #endif
-EOF
-fi
-
-if test "$ac_cv_type_uintmax_t" != yes; then
- sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- /* Define intmax based on what we found */
- #ifndef intmax_t
- #ifdef _INT64_T
- typedef int64_t intmax_t;
- #else
- typedef long intmax_t;
- #endif
- #endif
- #ifndef uintmax_t
- #ifdef _UINT64_T
- typedef uint64_t uintmax_t;
- #else
- typedef unsigned long uintmax_t;
- #endif
- #endif
-EOF
-fi
-
-sed 's/^ *//' >> tmp-stdint.h <<EOF
-
- #endif /* GCC_GENERATED_STDINT_H */
-EOF
-
-if test -r include/gstdint.h && cmp -s tmp-stdint.h include/gstdint.h; then
- rm -f tmp-stdint.h
-else
- mv -f tmp-stdint.h include/gstdint.h
-fi
-
- ;;
"scripts/testsuite_flags":F) chmod +x scripts/testsuite_flags ;;
"scripts/extract_symvers":F) chmod +x scripts/extract_symvers ;;
"include/Makefile":F) cat > vpsed$$ << \_EOF
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 42c4530..3e89d09 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -425,12 +425,6 @@ GCC_CHECK_UNWIND_GETIPINFO
GCC_LINUX_FUTEX([AC_DEFINE(HAVE_LINUX_FUTEX, 1, [Define if futex syscall is available.])])
-if test "$is_hosted" = yes; then
-# TODO: remove this and change src/c++11/compatibility-atomic-c++0x.cc to
-# use <stdint.h> instead of <gstdint.h>.
-GCC_HEADER_STDINT(include/gstdint.h)
-fi
-
GLIBCXX_ENABLE_SYMVERS([yes])
AC_SUBST(libtool_VERSION)
diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in
index 469a608..db5e81a 100644
--- a/libstdc++-v3/doc/Makefile.in
+++ b/libstdc++-v3/doc/Makefile.in
@@ -103,7 +103,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 2255e0b..5107c6c 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -103,7 +103,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index 8f91bbe..592673a 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -315,6 +315,51 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
typedef __true_type __type;
};
+#ifdef __STDCPP_FLOAT16_T__
+ template<>
+ struct __is_floating<_Float16>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
+#ifdef __STDCPP_FLOAT32_T__
+ template<>
+ struct __is_floating<_Float32>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
+#ifdef __STDCPP_FLOAT64_T__
+ template<>
+ struct __is_floating<_Float64>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
+#ifdef __STDCPP_FLOAT128_T__
+ template<>
+ struct __is_floating<_Float128>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
+#ifdef __STDCPP_BFLOAT16_T__
+ template<>
+ struct __is_floating<__gnu_cxx::__bfloat16_t>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
//
// Pointer types
//
diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h
index 6e7b366..2fc7dcd 100644
--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -1262,9 +1262,9 @@ namespace __detail
{
if (_M_pathname.back() == preferred_separator)
return {};
- auto& __last = *--end();
- if (__last._M_type() == _Type::_Filename)
- return __last;
+ auto __last = --end();
+ if (__last->_M_type() == _Type::_Filename)
+ return *__last;
}
return {};
}
diff --git a/libstdc++-v3/include/bits/locale_classes.tcc b/libstdc++-v3/include/bits/locale_classes.tcc
index 64cd753..9cc4f23 100644
--- a/libstdc++-v3/include/bits/locale_classes.tcc
+++ b/libstdc++-v3/include/bits/locale_classes.tcc
@@ -127,6 +127,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @return Reference to facet of type Facet.
* @throw std::bad_cast if @p __loc doesn't contain a facet of type _Facet.
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-reference"
template<typename _Facet>
const _Facet&
use_facet(const locale& __loc)
@@ -141,6 +143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return static_cast<const _Facet&>(*__facets[__i]);
#endif
}
+#pragma GCC diagnostic pop
// Generic version does nothing.
diff --git a/libstdc++-v3/include/bits/regex_executor.h b/libstdc++-v3/include/bits/regex_executor.h
index dc0878c..cdafcd5 100644
--- a/libstdc++-v3/include/bits/regex_executor.h
+++ b/libstdc++-v3/include/bits/regex_executor.h
@@ -71,14 +71,15 @@ namespace __detail
_ResultsVec& __results,
const _RegexT& __re,
_FlagT __flags)
- : _M_begin(__begin),
- _M_end(__end),
- _M_re(__re),
- _M_nfa(*__re._M_automaton),
- _M_results(__results),
- _M_rep_count(_M_nfa.size()),
- _M_states(_M_nfa._M_start(), _M_nfa.size()),
- _M_flags(__flags)
+ : _M_cur_results(__results.get_allocator()),
+ _M_begin(__begin),
+ _M_end(__end),
+ _M_re(__re),
+ _M_nfa(*__re._M_automaton),
+ _M_results(__results),
+ _M_rep_count(_M_nfa.size()),
+ _M_states(_M_nfa._M_start(), _M_nfa.size()),
+ _M_flags(__flags)
{
using namespace regex_constants;
if (__flags & match_prev_avail) // ignore not_bol and not_bow
diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc
index b93e958..a5885ed 100644
--- a/libstdc++-v3/include/bits/regex_executor.tcc
+++ b/libstdc++-v3/include/bits/regex_executor.tcc
@@ -124,9 +124,10 @@ namespace __detail
break;
std::fill_n(_M_states._M_visited_states, _M_nfa.size(), false);
auto __old_queue = std::move(_M_states._M_match_queue);
+ auto __alloc = _M_cur_results.get_allocator();
for (auto& __task : __old_queue)
{
- _M_cur_results = std::move(__task.second);
+ _M_cur_results = _ResultsVec(std::move(__task.second), __alloc);
_M_dfs(__match_mode, __task.first);
}
if (__match_mode == _Match_mode::_Prefix)
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 555d644..e52055a 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -2755,9 +2755,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
nearbyint(_Float16 __x)
{ return _Float16(__builtin_nearbyintf(__x)); }
- inline _Float16
+ constexpr _Float16
nextafter(_Float16 __x, _Float16 __y)
{
+ if (std::__is_constant_evaluated())
+ return __builtin_nextafterf16(__x, __y);
#ifdef __INT16_TYPE__
using __float16_int_type = __INT16_TYPE__;
#else
@@ -3471,9 +3473,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
nearbyint(__gnu_cxx::__bfloat16_t __x)
{ return __gnu_cxx::__bfloat16_t(__builtin_nearbyintf(__x)); }
- inline __gnu_cxx::__bfloat16_t
+ constexpr __gnu_cxx::__bfloat16_t
nextafter(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
{
+ if (std::__is_constant_evaluated())
+ return __builtin_nextafterf16b(__x, __y);
#ifdef __INT16_TYPE__
using __bfloat16_int_type = __INT16_TYPE__;
#else
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 8f9368f..da2df91 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -142,8 +142,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Converting constructor.
template<typename _Up>
- _GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z)
- : _M_real(__z.real()), _M_imag(__z.imag()) { }
+#if __cplusplus > 202002L
+ explicit(!requires(_Up __u) { _Tp{__u}; })
+#endif
+ _GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z)
+ : _M_real(_Tp(__z.real())), _M_imag(_Tp(__z.imag())) { }
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -1077,6 +1080,264 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: std::pow(complex<_Tp>(__x), __y);
}
+#if _GLIBCXX_USE_C99_COMPLEX
+#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline _Float16
+ __complex_abs(__complex__ _Float16 __z)
+ { return _Float16(__builtin_cabsf(__z)); }
+
+ inline _Float16
+ __complex_arg(__complex__ _Float16 __z)
+ { return _Float16(__builtin_cargf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_cos(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ccosf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_cosh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ccoshf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_exp(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_cexpf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_log(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_clogf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_sin(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_csinf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_sinh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_csinhf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_sqrt(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_csqrtf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_tan(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ctanf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_tanh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ctanhf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_pow(__complex__ _Float16 __x, __complex__ _Float16 __y)
+ { return static_cast<__complex__ _Float16>(__builtin_cpowf(__x, __y)); }
+#endif
+
+#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline _Float32
+ __complex_abs(__complex__ _Float32 __z) { return __builtin_cabsf(__z); }
+
+ inline _Float32
+ __complex_arg(__complex__ _Float32 __z) { return __builtin_cargf(__z); }
+
+ inline __complex__ _Float32
+ __complex_cos(__complex__ _Float32 __z) { return __builtin_ccosf(__z); }
+
+ inline __complex__ _Float32
+ __complex_cosh(__complex__ _Float32 __z) { return __builtin_ccoshf(__z); }
+
+ inline __complex__ _Float32
+ __complex_exp(__complex__ _Float32 __z) { return __builtin_cexpf(__z); }
+
+ inline __complex__ _Float32
+ __complex_log(__complex__ _Float32 __z) { return __builtin_clogf(__z); }
+
+ inline __complex__ _Float32
+ __complex_sin(__complex__ _Float32 __z) { return __builtin_csinf(__z); }
+
+ inline __complex__ _Float32
+ __complex_sinh(__complex__ _Float32 __z) { return __builtin_csinhf(__z); }
+
+ inline __complex__ _Float32
+ __complex_sqrt(__complex__ _Float32 __z) { return __builtin_csqrtf(__z); }
+
+ inline __complex__ _Float32
+ __complex_tan(__complex__ _Float32 __z) { return __builtin_ctanf(__z); }
+
+ inline __complex__ _Float32
+ __complex_tanh(__complex__ _Float32 __z) { return __builtin_ctanhf(__z); }
+
+ inline __complex__ _Float32
+ __complex_pow(__complex__ _Float32 __x, __complex__ _Float32 __y)
+ { return __builtin_cpowf(__x, __y); }
+#endif
+
+#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
+ inline _Float64
+ __complex_abs(__complex__ _Float64 __z) { return __builtin_cabs(__z); }
+
+ inline _Float64
+ __complex_arg(__complex__ _Float64 __z) { return __builtin_carg(__z); }
+
+ inline __complex__ _Float64
+ __complex_cos(__complex__ _Float64 __z) { return __builtin_ccos(__z); }
+
+ inline __complex__ _Float64
+ __complex_cosh(__complex__ _Float64 __z) { return __builtin_ccosh(__z); }
+
+ inline __complex__ _Float64
+ __complex_exp(__complex__ _Float64 __z) { return __builtin_cexp(__z); }
+
+ inline __complex__ _Float64
+ __complex_log(__complex__ _Float64 __z) { return __builtin_clog(__z); }
+
+ inline __complex__ _Float64
+ __complex_sin(__complex__ _Float64 __z) { return __builtin_csin(__z); }
+
+ inline __complex__ _Float64
+ __complex_sinh(__complex__ _Float64 __z) { return __builtin_csinh(__z); }
+
+ inline __complex__ _Float64
+ __complex_sqrt(__complex__ _Float64 __z) { return __builtin_csqrt(__z); }
+
+ inline __complex__ _Float64
+ __complex_tan(__complex__ _Float64 __z) { return __builtin_ctan(__z); }
+
+ inline __complex__ _Float64
+ __complex_tanh(__complex__ _Float64 __z) { return __builtin_ctanh(__z); }
+
+ inline __complex__ _Float64
+ __complex_pow(__complex__ _Float64 __x, __complex__ _Float64 __y)
+ { return __builtin_cpow(__x, __y); }
+#endif
+
+#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
+ inline _Float128
+ __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsl(__z); }
+
+ inline _Float128
+ __complex_arg(__complex__ _Float128 __z) { return __builtin_cargl(__z); }
+
+ inline __complex__ _Float128
+ __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosl(__z); }
+
+ inline __complex__ _Float128
+ __complex_cosh(__complex__ _Float128 __z) { return __builtin_ccoshl(__z); }
+
+ inline __complex__ _Float128
+ __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpl(__z); }
+
+ inline __complex__ _Float128
+ __complex_log(__complex__ _Float128 __z) { return __builtin_clogl(__z); }
+
+ inline __complex__ _Float128
+ __complex_sin(__complex__ _Float128 __z) { return __builtin_csinl(__z); }
+
+ inline __complex__ _Float128
+ __complex_sinh(__complex__ _Float128 __z) { return __builtin_csinhl(__z); }
+
+ inline __complex__ _Float128
+ __complex_sqrt(__complex__ _Float128 __z) { return __builtin_csqrtl(__z); }
+
+ inline __complex__ _Float128
+ __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanl(__z); }
+
+ inline __complex__ _Float128
+ __complex_tanh(__complex__ _Float128 __z) { return __builtin_ctanhl(__z); }
+
+ inline __complex__ _Float128
+ __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
+ { return __builtin_cpowl(__x, __y); }
+#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
+ inline _Float128
+ __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsf128(__z); }
+
+ inline _Float128
+ __complex_arg(__complex__ _Float128 __z) { return __builtin_cargf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_cosh(__complex__ _Float128 __z) { return __builtin_ccoshf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_log(__complex__ _Float128 __z) { return __builtin_clogf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_sin(__complex__ _Float128 __z) { return __builtin_csinf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_sinh(__complex__ _Float128 __z) { return __builtin_csinhf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_sqrt(__complex__ _Float128 __z) { return __builtin_csqrtf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_tanh(__complex__ _Float128 __z) { return __builtin_ctanhf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
+ { return __builtin_cpowf128(__x, __y); }
+#endif
+
+#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __gnu_cxx::__bfloat16_t
+ __complex_abs(__complex__ decltype(0.0bf16) __z)
+ { return __gnu_cxx::__bfloat16_t(__builtin_cabsf(__z)); }
+
+ inline __gnu_cxx::__bfloat16_t
+ __complex_arg(__complex__ decltype(0.0bf16) __z)
+ { return __gnu_cxx::__bfloat16_t(__builtin_cargf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_cos(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ccosf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_cosh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ccoshf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_exp(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cexpf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_log(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_clogf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_sin(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csinf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_sinh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csinhf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_sqrt(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csqrtf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_tan(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ctanf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_tanh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ctanhf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_pow(__complex__ decltype(0.0bf16) __x,
+ __complex__ decltype(0.0bf16) __y)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cpowf(__x,
+ __y)); }
+#endif
+#endif
+
/// 26.2.3 complex specializations
/// complex<float> specialization
template<>
@@ -1098,8 +1359,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
+#if __cplusplus > 202002L
+ template<typename _Up>
+ explicit(!requires(_Up __u) { value_type{__u}; })
+ constexpr complex(const complex<_Up>& __z)
+ : _M_value{ value_type(__z.real()), value_type(__z.imag()) } { }
+#else
explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&);
explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
+#endif
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -1244,10 +1512,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
+#if __cplusplus > 202002L
+ template<typename _Up>
+ explicit(!requires(_Up __u) { value_type{__u}; })
+ constexpr complex(const complex<_Up>& __z)
+ : _M_value{ value_type(__z.real()), value_type(__z.imag()) } { }
+#else
_GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
+#endif
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -1391,11 +1666,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
+#if __cplusplus > 202002L
+ template<typename _Up>
+ explicit(!requires(_Up __u) { value_type{__u}; })
+ constexpr complex(const complex<_Up>& __z)
+ : _M_value{ value_type(__z.real()), value_type(__z.imag()) } { }
+#else
_GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
_GLIBCXX_CONSTEXPR complex(const complex<double>& __z)
: _M_value(__z.__rep()) { }
+#endif
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -1517,6 +1799,161 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_ComplexT _M_value;
};
+#if __cplusplus > 202002L
+ template<typename _Tp>
+ struct __complex_type
+ { };
+
+#ifdef __STDCPP_FLOAT16_T__
+ template<>
+ struct __complex_type<_Float16>
+ { typedef __complex__ _Float16 type; };
+#endif
+
+#ifdef __STDCPP_FLOAT32_T__
+ template<>
+ struct __complex_type<_Float32>
+ { typedef __complex__ _Float32 type; };
+#endif
+
+#ifdef __STDCPP_FLOAT64_T__
+ template<>
+ struct __complex_type<_Float64>
+ { typedef __complex__ _Float64 type; };
+#endif
+
+#ifdef __STDCPP_FLOAT128_T__
+ template<>
+ struct __complex_type<_Float128>
+ { typedef __complex__ _Float128 type; };
+#endif
+
+#ifdef __STDCPP_BFLOAT16_T__
+ template<>
+ struct __complex_type<__gnu_cxx::__bfloat16_t>
+ { typedef __complex__ decltype(0.0bf16) type; };
+#endif
+
+ template<typename _Tp>
+ requires(__complex_type<_Tp>::type)
+ class complex<_Tp>
+ {
+ public:
+ typedef _Tp value_type;
+ typedef std::__complex_type<_Tp>::type _ComplexT;
+
+ constexpr complex(_ComplexT __z) : _M_value(__z) { }
+
+ constexpr complex(_Tp __r = _Tp(), _Tp __i = _Tp())
+ : _M_value{ __r, __i } { }
+
+ template<typename _Up>
+ explicit(!requires(_Up __u) { value_type{__u}; })
+ constexpr complex(const complex<_Up>& __z)
+ : _M_value{ value_type(__z.real()), value_type(__z.imag()) } { }
+
+ constexpr _Tp
+ real() const { return __real__ _M_value; }
+
+ constexpr _Tp
+ imag() const { return __imag__ _M_value; }
+
+ constexpr void
+ real(_Tp __val) { __real__ _M_value = __val; }
+
+ constexpr void
+ imag(_Tp __val) { __imag__ _M_value = __val; }
+
+ constexpr complex&
+ operator=(_Tp __f)
+ {
+ _M_value = __f;
+ return *this;
+ }
+
+ constexpr complex&
+ operator+=(_Tp __f)
+ {
+ _M_value += __f;
+ return *this;
+ }
+
+ constexpr complex&
+ operator-=(_Tp __f)
+ {
+ _M_value -= __f;
+ return *this;
+ }
+
+ constexpr complex&
+ operator*=(_Tp __f)
+ {
+ _M_value *= __f;
+ return *this;
+ }
+
+ constexpr complex&
+ operator/=(_Tp __f)
+ {
+ _M_value /= __f;
+ return *this;
+ }
+
+ // Let the compiler synthesize the copy and assignment
+ // operator. It always does a pretty good job.
+ constexpr complex& operator=(const complex&) = default;
+
+ template<typename _Up>
+ constexpr complex&
+ operator=(const complex<_Up>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ return *this;
+ }
+
+ template<typename _Up>
+ constexpr complex&
+ operator+=(const complex<_Up>& __z)
+ {
+ _M_value += __z.__rep();
+ return *this;
+ }
+
+ template<class _Up>
+ constexpr complex&
+ operator-=(const complex<_Up>& __z)
+ {
+ _M_value -= __z.__rep();
+ return *this;
+ }
+
+ template<class _Up>
+ constexpr complex&
+ operator*=(const complex<_Up>& __z)
+ {
+ const _ComplexT __t = __z.__rep();
+ _M_value *= __t;
+ return *this;
+ }
+
+ template<class _Up>
+ constexpr complex&
+ operator/=(const complex<_Up>& __z)
+ {
+ const _ComplexT __t = __z.__rep();
+ _M_value /= __t;
+ return *this;
+ }
+
+ constexpr _ComplexT __rep() const { return _M_value; }
+
+ private:
+ _ComplexT _M_value;
+ };
+#endif
+
+#if __cplusplus <= 202002L
// These bits have to be at the end of this file, so that the
// specializations have all been defined.
inline _GLIBCXX_CONSTEXPR
@@ -1530,6 +1967,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline _GLIBCXX_CONSTEXPR
complex<double>::complex(const complex<long double>& __z)
: _M_value(__z.__rep()) { }
+#endif
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
@@ -1809,6 +2247,162 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __complex_atanh(__z); }
#endif
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ _Float16
+ __complex_acos(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_cacosf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_asin(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_casinf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_atan(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_catanf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_acosh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_cacoshf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_asinh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_casinhf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_atanh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_catanhf(__z)); }
+#endif
+
+#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ _Float32
+ __complex_acos(__complex__ _Float32 __z)
+ { return __builtin_cacosf(__z); }
+
+ inline __complex__ _Float32
+ __complex_asin(__complex__ _Float32 __z)
+ { return __builtin_casinf(__z); }
+
+ inline __complex__ _Float32
+ __complex_atan(__complex__ _Float32 __z)
+ { return __builtin_catanf(__z); }
+
+ inline __complex__ _Float32
+ __complex_acosh(__complex__ _Float32 __z)
+ { return __builtin_cacoshf(__z); }
+
+ inline __complex__ _Float32
+ __complex_asinh(__complex__ _Float32 __z)
+ { return __builtin_casinhf(__z); }
+
+ inline __complex__ _Float32
+ __complex_atanh(__complex__ _Float32 __z)
+ { return __builtin_catanhf(__z); }
+#endif
+
+#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
+ inline __complex__ _Float64
+ __complex_acos(__complex__ _Float64 __z)
+ { return __builtin_cacos(__z); }
+
+ inline __complex__ _Float64
+ __complex_asin(__complex__ _Float64 __z)
+ { return __builtin_casin(__z); }
+
+ inline __complex__ _Float64
+ __complex_atan(__complex__ _Float64 __z)
+ { return __builtin_catan(__z); }
+
+ inline __complex__ _Float64
+ __complex_acosh(__complex__ _Float64 __z)
+ { return __builtin_cacosh(__z); }
+
+ inline __complex__ _Float64
+ __complex_asinh(__complex__ _Float64 __z)
+ { return __builtin_casinh(__z); }
+
+ inline __complex__ _Float64
+ __complex_atanh(__complex__ _Float64 __z)
+ { return __builtin_catanh(__z); }
+#endif
+
+#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
+ inline __complex__ _Float128
+ __complex_acos(__complex__ _Float128 __z)
+ { return __builtin_cacosl(__z); }
+
+ inline __complex__ _Float128
+ __complex_asin(__complex__ _Float128 __z)
+ { return __builtin_casinl(__z); }
+
+ inline __complex__ _Float128
+ __complex_atan(__complex__ _Float128 __z)
+ { return __builtin_catanl(__z); }
+
+ inline __complex__ _Float128
+ __complex_acosh(__complex__ _Float128 __z)
+ { return __builtin_cacoshl(__z); }
+
+ inline __complex__ _Float128
+ __complex_asinh(__complex__ _Float128 __z)
+ { return __builtin_casinhl(__z); }
+
+ inline __complex__ _Float128
+ __complex_atanh(__complex__ _Float128 __z)
+ { return __builtin_catanhl(__z); }
+#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
+ inline __complex__ _Float128
+ __complex_acos(__complex__ _Float128 __z)
+ { return __builtin_cacosf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_asin(__complex__ _Float128 __z)
+ { return __builtin_casinf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_atan(__complex__ _Float128 __z)
+ { return __builtin_catanf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_acosh(__complex__ _Float128 __z)
+ { return __builtin_cacoshf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_asinh(__complex__ _Float128 __z)
+ { return __builtin_casinhf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_atanh(__complex__ _Float128 __z)
+ { return __builtin_catanhf128(__z); }
+#endif
+
+#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ decltype(0.0bf16)
+ __complex_acos(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cacosf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_asin(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_casinf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_atan(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_catanf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_acosh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cacoshf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_asinh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_casinhf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_atanh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_catanhf(__z)); }
+#endif
+#endif
+
template<typename _Tp>
inline _Tp
/// fabs(__z) [8.1.8].
@@ -1897,6 +2491,49 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline complex<long double>
__complex_proj(const complex<long double>& __z)
{ return __builtin_cprojl(__z.__rep()); }
+
+#if __cplusplus > 202002L
+#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ _Float16
+ __complex_proj(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_cprojf(__z)); }
+#endif
+
+#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ _Float32
+ __complex_proj(__complex__ _Float32 __z)
+ { return __builtin_cprojf(__z); }
+#endif
+
+#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
+ inline __complex__ _Float64
+ __complex_proj(__complex__ _Float64 __z)
+ { return __builtin_cproj(__z); }
+#endif
+
+#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
+ inline __complex__ _Float128
+ __complex_proj(__complex__ _Float128 __z)
+ { return __builtin_cprojl(__z); }
+#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
+ inline __complex__ _Float128
+ __complex_proj(__complex__ _Float128 __z)
+ { return __builtin_cprojf128(__z); }
+#endif
+
+#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ decltype(0.0bf16)
+ __complex_proj(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cprojf(__z)); }
+#endif
+
+ template<typename _Tp>
+ requires(__complex_type<_Tp>::type)
+ inline complex<_Tp>
+ __complex_proj(const complex<_Tp>& __z)
+ { return __complex_proj(__z.__rep()); }
+#endif
+
#elif defined _GLIBCXX_USE_C99_MATH_TR1
inline complex<float>
__complex_proj(const complex<float>& __z)
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index d22acaa..b396e8d 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -285,35 +285,43 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* simplify this with variadic templates, because we're introducing
* unique names for each.
*/
- extern const _Placeholder<1> _1;
- extern const _Placeholder<2> _2;
- extern const _Placeholder<3> _3;
- extern const _Placeholder<4> _4;
- extern const _Placeholder<5> _5;
- extern const _Placeholder<6> _6;
- extern const _Placeholder<7> _7;
- extern const _Placeholder<8> _8;
- extern const _Placeholder<9> _9;
- extern const _Placeholder<10> _10;
- extern const _Placeholder<11> _11;
- extern const _Placeholder<12> _12;
- extern const _Placeholder<13> _13;
- extern const _Placeholder<14> _14;
- extern const _Placeholder<15> _15;
- extern const _Placeholder<16> _16;
- extern const _Placeholder<17> _17;
- extern const _Placeholder<18> _18;
- extern const _Placeholder<19> _19;
- extern const _Placeholder<20> _20;
- extern const _Placeholder<21> _21;
- extern const _Placeholder<22> _22;
- extern const _Placeholder<23> _23;
- extern const _Placeholder<24> _24;
- extern const _Placeholder<25> _25;
- extern const _Placeholder<26> _26;
- extern const _Placeholder<27> _27;
- extern const _Placeholder<28> _28;
- extern const _Placeholder<29> _29;
+#if __cpp_inline_variables
+# define _GLIBCXX_PLACEHOLDER inline
+#else
+# define _GLIBCXX_PLACEHOLDER extern
+#endif
+
+ _GLIBCXX_PLACEHOLDER const _Placeholder<1> _1;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<2> _2;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<3> _3;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<4> _4;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<5> _5;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<6> _6;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<7> _7;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<8> _8;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<9> _9;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<10> _10;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<11> _11;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<12> _12;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<13> _13;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<14> _14;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<15> _15;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<16> _16;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<17> _17;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<18> _18;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<19> _19;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<20> _20;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<21> _21;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<22> _22;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<23> _23;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<24> _24;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<25> _25;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<26> _26;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<27> _27;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<28> _28;
+ _GLIBCXX_PLACEHOLDER const _Placeholder<29> _29;
+
+#undef _GLIBCXX_PLACEHOLDER
}
/**
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 1127095..2e755ab 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -105,7 +105,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
index af3d4c4..8e93445 100644
--- a/libstdc++-v3/po/Makefile.in
+++ b/libstdc++-v3/po/Makefile.in
@@ -103,7 +103,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in
index 0c600de..05e79b5 100644
--- a/libstdc++-v3/python/Makefile.in
+++ b/libstdc++-v3/python/Makefile.in
@@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 8f8092a..9aeb46a 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in
index 013ab3c..77e11a9 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc
index 5a0c545..e21bd76 100644
--- a/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc
+++ b/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc
@@ -22,7 +22,6 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-#include "gstdint.h"
#include <atomic>
#include <mutex>
@@ -119,13 +118,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_CONST __atomic_flag_base*
__atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW
{
- uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
+ using guintptr_t = __UINTPTR_TYPE__;
+ guintptr_t __u = reinterpret_cast<guintptr_t>(__z);
__u += (__u >> 2) + (__u << 4);
__u += (__u >> 7) + (__u << 5);
__u += (__u >> 17) + (__u << 13);
- if (sizeof(uintptr_t) > 4)
+ if (sizeof(guintptr_t) > 4)
__u += (__u >> 31);
- __u &= ~((~uintptr_t(0)) << LOGSIZE);
+ __u &= ~((~guintptr_t(0)) << LOGSIZE);
return flag_table + __u;
}
diff --git a/libstdc++-v3/src/c++17/Makefile.in b/libstdc++-v3/src/c++17/Makefile.in
index 217cbbe..84bba4d 100644
--- a/libstdc++-v3/src/c++17/Makefile.in
+++ b/libstdc++-v3/src/c++17/Makefile.in
@@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/src/c++20/Makefile.in b/libstdc++-v3/src/c++20/Makefile.in
index c04bb7d..9db70a3 100644
--- a/libstdc++-v3/src/c++20/Makefile.in
+++ b/libstdc++-v3/src/c++20/Makefile.in
@@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in
index 77ec8c7..bd63782a 100644
--- a/libstdc++-v3/src/c++98/Makefile.in
+++ b/libstdc++-v3/src/c++98/Makefile.in
@@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/src/filesystem/Makefile.in b/libstdc++-v3/src/filesystem/Makefile.in
index 010bcfc..852390e 100644
--- a/libstdc++-v3/src/filesystem/Makefile.in
+++ b/libstdc++-v3/src/filesystem/Makefile.in
@@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/src/libbacktrace/Makefile.in b/libstdc++-v3/src/libbacktrace/Makefile.in
index a52f645..4bc0556 100644
--- a/libstdc++-v3/src/libbacktrace/Makefile.in
+++ b/libstdc++-v3/src/libbacktrace/Makefile.in
@@ -135,7 +135,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/ext_c++23.cc b/libstdc++-v3/testsuite/26_numerics/complex/ext_c++23.cc
new file mode 100644
index 0000000..bdc9af0
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/ext_c++23.cc
@@ -0,0 +1,89 @@
+// Copyright (C) 2022 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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.
+
+// This library 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 this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2b" }
+// { dg-do link { target c++23 } }
+
+#include <stdfloat>
+#include <complex>
+
+template <typename T>
+__attribute__((__noipa__)) void
+test_functions(T *p, std::complex<T> *q)
+{
+ p[0] = std::abs(q[0]);
+ p[1] = std::arg(q[1]);
+ q[2] = std::cos(q[2]);
+ q[3] = std::cosh(q[3]);
+ q[4] = std::exp(q[4]);
+ q[5] = std::log(q[5]);
+ q[6] = std::sin(q[6]);
+ q[7] = std::sinh(q[7]);
+ q[8] = std::sqrt(q[8]);
+ q[9] = std::tan(q[9]);
+ q[10] = std::tanh(q[10]);
+ q[11] = std::pow(q[11], q[19]);
+ q[12] = std::acos(q[12]);
+ q[13] = std::asin(q[13]);
+ q[14] = std::atan(q[14]);
+ q[15] = std::acosh(q[15]);
+ q[16] = std::asinh(q[16]);
+ q[17] = std::atanh(q[17]);
+ q[18] = std::proj(q[18]);
+}
+
+int
+main()
+{
+#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ {
+ std::float16_t p[2] = {};
+ std::complex<std::float16_t> q[20] = {};
+ test_functions(p, q);
+ }
+#endif
+#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ {
+ std::float32_t p[2] = {};
+ std::complex<std::float32_t> q[20] = {};
+ test_functions(p, q);
+ }
+#endif
+#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
+ {
+ std::float64_t p[2] = {};
+ std::complex<std::float64_t> q[20] = {};
+ test_functions(p, q);
+ }
+#endif
+#if defined(__STDCPP_FLOAT128_T__) \
+ && (defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY128) \
+ || defined(_GLIBCXX_HAVE_FLOAT128_MATH))
+ {
+ std::float128_t p[2] = {};
+ std::complex<std::float128_t> q[20] = {};
+ test_functions(p, q);
+ }
+#endif
+#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ {
+ std::bfloat16_t p[2] = {};
+ std::complex<std::bfloat16_t> q[20] = {};
+ test_functions(p, q);
+ }
+#endif
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc
index 45aa3b7..8d7daa9 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc
@@ -100,6 +100,8 @@ test ()
VERIFY(std::fpclassify(t36) == FP_NAN);
T t37 = std::nextafter(T(-0.0), T());
VERIFY(t37 == T() && !std::signbit(t37));
+ static_assert(std::nextafter(T(1.0), T(2.0)) > T(1.0));
+ static_assert(std::nextafter(std::nextafter(T(1.0), T(5.0)), T(0.0)) == T(1.0));
}
int
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/107376.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/107376.cc
new file mode 100644
index 0000000..da4f7ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/107376.cc
@@ -0,0 +1,76 @@
+// { dg-do run { target c++11 } }
+#include <regex>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+template<typename T>
+struct Alloc
+{
+ using value_type = T;
+ explicit Alloc(int) { }
+ template<typename U> Alloc(const Alloc&) { }
+
+ T* allocate(std::size_t n)
+ { return std::allocator<T>().allocate(n); }
+ void deallocate(T* ptr, std::size_t n)
+ { std::allocator<T>().deallocate(ptr, n); }
+
+ bool operator==(const Alloc&) const { return true; }
+ bool operator!=(const Alloc&) const { return false; }
+};
+
+void
+test_non_default_constructible()
+{
+ using sub_match = std::sub_match<const char*>;
+ using alloc_type = Alloc<sub_match>;
+ using match_results = std::match_results<const char*, alloc_type>;
+ match_results res(alloc_type(1));
+
+ std::regex_match("x", res, std::regex(".")); // PR libstdc++/107376
+}
+
+template<typename T>
+struct PropAlloc
+{
+ int id;
+
+ using value_type = T;
+ explicit PropAlloc(int id) : id(id) { }
+ template<typename U> PropAlloc(const PropAlloc& a) : id(a.id) { }
+
+ using propagate_on_container_move_assignment = std::true_type;
+ using propagate_on_container_copy_assignment = std::true_type;
+
+ PropAlloc select_on_container_copy_construction() const
+ { return PropAlloc(0); }
+
+ T* allocate(std::size_t n)
+ { return std::allocator<T>().allocate(n); }
+ void deallocate(T* ptr, std::size_t n)
+ { std::allocator<T>().deallocate(ptr, n); }
+
+ bool operator==(const PropAlloc& a) const { return id == a.id; }
+ bool operator!=(const PropAlloc& a) const { return id != a.id; }
+};
+
+void
+test_propagation()
+{
+ using sub_match = std::sub_match<const char*>;
+ using alloc_type = PropAlloc<sub_match>;
+ using match_results = std::match_results<const char*, alloc_type>;
+ alloc_type alloc(107376);
+ match_results res(alloc);
+
+ std::regex re("..", std::regex_constants::__polynomial);
+ std::regex_match("xx", res, re);
+
+ VERIFY( res.get_allocator() == alloc );
+}
+
+int main()
+{
+ test_non_default_constructible();
+ test_propagation();
+}
diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
index 328a036..5081fdf 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -103,7 +103,6 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
- $(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index 3c5ec86f..cadb0ae 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-31 Lulu Cheng <chenglulu@loongson.cn>
+ qijingwen <qijingwen@loongson.cn>
+
+ * configure.tgt: Add loongarch support.
+
2022-10-12 Martin Liska <mliska@suse.cz>
* configure: Regenerate.
diff --git a/libvtv/configure.tgt b/libvtv/configure.tgt
index aa2a3f6..6cdd1e9 100644
--- a/libvtv/configure.tgt
+++ b/libvtv/configure.tgt
@@ -50,6 +50,9 @@ case "${target}" in
;;
x86_64-*-darwin[1]* | i?86-*-darwin[1]*)
;;
+ loongarch*-*-linux*)
+ VTV_SUPPORTED=yes
+ ;;
*)
;;
esac